From a5a8072f3caf8f7fefcdedcf07e008f07df17c16 Mon Sep 17 00:00:00 2001 From: Felipe Leme <felipeal@google.com> Date: Wed, 21 Sep 2016 10:44:11 -0700 Subject: [PATCH] Let system_server writes to dumpstate.options property. Currently, we define 4 hardcoded init services to launch dumpstate with different command-line options (since dumpstate must be launched by root): - bugreport - bugreportplus - bugreportwear - bugreportremote This approach does not scale well; a better option is to have just one service, and let the framework pass the extra arguments through a system property. BUG: 31649719 Test: manual Change-Id: I7ebbb7ce6a0fd3588baca6fd76653f87367ed0e5 --- dumpstate.te | 2 ++ property.te | 1 + property_contexts | 1 + system_server.te | 1 + 4 files changed, 5 insertions(+) diff --git a/dumpstate.te b/dumpstate.te index 2ed725da7..dd132a987 100644 --- a/dumpstate.te +++ b/dumpstate.te @@ -170,6 +170,8 @@ allow dumpstate devpts:chr_file rw_file_perms; # Set properties. # dumpstate_prop is used to share state with the Shell app. set_prop(dumpstate, dumpstate_prop) +# dumpstate_options_prop is used to pass extra command-line args. +set_prop(dumpstate, dumpstate_options_prop) # systrace support - allow atrace to run allow dumpstate debugfs_tracing:dir r_dir_perms; diff --git a/property.te b/property.te index 2802c0d33..2c2ddcce8 100644 --- a/property.te +++ b/property.te @@ -2,6 +2,7 @@ type default_prop, property_type, core_property_type; type shell_prop, property_type, core_property_type; type debug_prop, property_type, core_property_type; type dumpstate_prop, property_type, core_property_type; +type dumpstate_options_prop, property_type; type persist_debug_prop, property_type, core_property_type; type debuggerd_prop, property_type, core_property_type; type dhcp_prop, property_type, core_property_type; diff --git a/property_contexts b/property_contexts index 2ae1bb0f3..34191db45 100644 --- a/property_contexts +++ b/property_contexts @@ -32,6 +32,7 @@ bluetooth. u:object_r:bluetooth_prop:s0 debug. u:object_r:debug_prop:s0 debug.db. u:object_r:debuggerd_prop:s0 dumpstate. u:object_r:dumpstate_prop:s0 +dumpstate.options u:object_r:dumpstate_options_prop:s0 log. u:object_r:log_prop:s0 log.tag u:object_r:log_tag_prop:s0 log.tag.WifiHAL u:object_r:wifi_log_prop:s0 diff --git a/system_server.te b/system_server.te index 5ccc05f05..b9fe97b71 100644 --- a/system_server.te +++ b/system_server.te @@ -349,6 +349,7 @@ set_prop(system_server, powerctl_prop) set_prop(system_server, fingerprint_prop) set_prop(system_server, device_logging_prop) set_prop(system_server, wifi_prop) +set_prop(system_server, dumpstate_options_prop) userdebug_or_eng(`set_prop(system_server, wifi_log_prop)') # ctl interface -- GitLab