Remove logd from Microdroid
Logs are now sent directly to /dev/hvc2, instead of being sent to logd
and then forwarded by logcat.
ro.log.file_logger.enabled is statically set to 1 so that the liblog
library doesn't attempt to send logs to logd which doesn't exist.
ro.log.file_logger.path is dynamically set to either /dev/hvc2 or
/dev/stderr depending on whether the VM is debuggable or not.
Bug: 222592894
Test: run Microdroid using the VM tool and see if logs are still shown
Test: logd process doesn't exist
Change-Id: I3412d4f853f2def8ca1e22fece8b6bf1debc3e92
diff --git a/microdroid/init.rc b/microdroid/init.rc
index 42aa983..cd7332b 100644
--- a/microdroid/init.rc
+++ b/microdroid/init.rc
@@ -17,6 +17,14 @@
start ueventd
+# If VM is debuggable, send logs to outside ot the VM via the serial console.
+# If non-debuggable, logs are internally consumed at /dev/null
+on early-init && property:ro.boot.microdroid.app_debuggable=1
+ setprop ro.log.file_logger.path /dev/hvc2
+
+on early-init && property:ro.boot.microdroid.app_debuggable=0
+ setprop ro.log.file_logger.path /dev/null
+
on init
# Mount binderfs
mkdir /dev/binderfs
@@ -62,12 +70,6 @@
start vendor.dice-microdroid
start diced
-on init && property:ro.boot.logd.enabled=1
- # Start logd before any other services run to ensure we capture all of their logs.
- # TODO(b/217796229) set filterspec if debug_level is app_only
- start logd
- start seriallogging
-
on init
mkdir /mnt/apk 0755 system system
mkdir /mnt/extra-apk 0755 root root
@@ -99,10 +101,6 @@
on init && property:ro.boot.adb.enabled=1
start adbd
-on load_persist_props_action && property:ro.boot.logd.enabled=1
- start logd
- start logd-reinit
-
# Mount filesystems and start core system services.
on late-init
trigger early-fs
@@ -206,13 +204,3 @@
seclabel u:r:shell:s0
setenv HOSTNAME console
-service seriallogging /system/bin/logcat -b all -v threadtime -f /dev/hvc2 *:V
- disabled
- user logd
- group root logd
-
-on fs
- write /dev/event-log-tags "# content owned by logd
-"
- chown logd logd /dev/event-log-tags
- chmod 0644 /dev/event-log-tags