Add logd.ready

logd.ready is a system property that logd sets when it is ready to
serve incoming socket requests for reading and writing logs. Clients of
logd (e.g. logcat) can use this to synchronize with logd, otherwise they
may experience a crash due to the refused socket connection to logd when
they are started before logd is ready.

Bug: 206826522
Test: run microdroid. see logcat logs are shown immediately
Change-Id: Iee13485b0f4c2beda9bc8434f514c4e32e119492
This commit is contained in:
Jiyong Park 2021-11-22 14:18:03 +09:00
parent 53b6de0642
commit ff3048349a
4 changed files with 7 additions and 0 deletions

View file

@ -12,4 +12,8 @@ allow logcat serial_device:chr_file ra_file_perms;
# logcat can get logs from logd # logcat can get logs from logd
read_logd(logcat) read_logd(logcat)
# Allow logcat to read ro.logd.ready so that it waits until logd is ready to
# accept commands
get_prop(logcat, logd_prop)
allow logcat self:global_capability_class_set { sys_nice }; allow logcat self:global_capability_class_set { sys_nice };

View file

@ -38,6 +38,7 @@ sys.powerctl u:object_r:powerctl_prop:s0
service.adb.root u:object_r:shell_prop:s0 exact bool service.adb.root u:object_r:shell_prop:s0 exact bool
ro.logd.kernel u:object_r:logd_prop:s0 exact bool ro.logd.kernel u:object_r:logd_prop:s0 exact bool
logd.ready u:object_r:logd_prop:s0 exact bool
ro.config.low_ram u:object_r:build_prop:s0 exact bool ro.config.low_ram u:object_r:build_prop:s0 exact bool

View file

@ -15,6 +15,7 @@ userdebug_or_eng(`
control_logd(logpersist) control_logd(logpersist)
unix_socket_connect(logpersist, logdr, logd) unix_socket_connect(logpersist, logdr, logd)
get_prop(logpersist, logd_prop)
read_runtime_log_tags(logpersist) read_runtime_log_tags(logpersist)
') ')

View file

@ -8,6 +8,7 @@ net_domain(shell)
# logcat # logcat
read_logd(shell) read_logd(shell)
control_logd(shell) control_logd(shell)
get_prop(shell, logd_prop)
# logcat -L (directly, or via dumpstate) # logcat -L (directly, or via dumpstate)
allow shell pstorefs:dir search; allow shell pstorefs:dir search;
allow shell pstorefs:file r_file_perms; allow shell pstorefs:file r_file_perms;