Add power.stats HAL 1.0 sepolicy

Also giving statsd permission to access it. This change copies the internal sepolicy to AOSP.

Bug: 111185513
Bug: 120551881
Test: make
Change-Id: I7e0386777e05580299caf9b97cb7804459f1a9d0
This commit is contained in:
Benjamin Schwartz 2018-12-10 14:59:57 -08:00
parent 130fee6e95
commit e7040eada0
10 changed files with 18 additions and 0 deletions

View file

@ -263,6 +263,7 @@ neverallow all_untrusted_apps {
hal_nfc_hwservice hal_nfc_hwservice
hal_oemlock_hwservice hal_oemlock_hwservice
hal_power_hwservice hal_power_hwservice
hal_power_stats_hwservice
hal_secure_element_hwservice hal_secure_element_hwservice
hal_sensors_hwservice hal_sensors_hwservice
hal_telephony_hwservice hal_telephony_hwservice

View file

@ -33,6 +33,7 @@
color_display_service color_display_service
hal_atrace_hwservice hal_atrace_hwservice
hal_health_storage_hwservice hal_health_storage_hwservice
hal_power_stats_hwservice
hal_system_suspend_default hal_system_suspend_default
hal_system_suspend_default_exec hal_system_suspend_default_exec
hal_system_suspend_default_tmpfs hal_system_suspend_default_tmpfs

View file

@ -43,6 +43,7 @@ android.hardware.neuralnetworks::IDevice u:object_r:hal_n
android.hardware.nfc::INfc u:object_r:hal_nfc_hwservice:s0 android.hardware.nfc::INfc u:object_r:hal_nfc_hwservice:s0
android.hardware.oemlock::IOemLock u:object_r:hal_oemlock_hwservice:s0 android.hardware.oemlock::IOemLock u:object_r:hal_oemlock_hwservice:s0
android.hardware.power::IPower u:object_r:hal_power_hwservice:s0 android.hardware.power::IPower u:object_r:hal_power_hwservice:s0
android.hardware.power.stats::IPowerStats u:object_r:hal_power_stats_hwservice:s0
android.hardware.radio.config::IRadioConfig u:object_r:hal_telephony_hwservice:s0 android.hardware.radio.config::IRadioConfig u:object_r:hal_telephony_hwservice:s0
android.hardware.radio.deprecated::IOemHook u:object_r:hal_telephony_hwservice:s0 android.hardware.radio.deprecated::IOemHook u:object_r:hal_telephony_hwservice:s0
android.hardware.radio::IRadio u:object_r:hal_telephony_hwservice:s0 android.hardware.radio::IRadio u:object_r:hal_telephony_hwservice:s0

View file

@ -216,6 +216,7 @@ hal_client_domain(system_server, hal_neuralnetworks)
hal_client_domain(system_server, hal_oemlock) hal_client_domain(system_server, hal_oemlock)
hal_client_domain(system_server, hal_omx) hal_client_domain(system_server, hal_omx)
hal_client_domain(system_server, hal_power) hal_client_domain(system_server, hal_power)
hal_client_domain(system_server, hal_power_stats)
hal_client_domain(system_server, hal_sensors) hal_client_domain(system_server, hal_sensors)
hal_client_domain(system_server, hal_system_suspend) hal_client_domain(system_server, hal_system_suspend)
hal_client_domain(system_server, hal_tetheroffload) hal_client_domain(system_server, hal_tetheroffload)

View file

@ -275,6 +275,7 @@ hal_attribute(nfc);
hal_attribute(oemlock); hal_attribute(oemlock);
hal_attribute(omx); hal_attribute(omx);
hal_attribute(power); hal_attribute(power);
hal_attribute(power_stats);
hal_attribute(secure_element); hal_attribute(secure_element);
hal_attribute(sensors); hal_attribute(sensors);
hal_attribute(system_suspend); hal_attribute(system_suspend);

View file

@ -0,0 +1,5 @@
# HwBinder IPC from client to server, and callbacks
binder_call(hal_power_stats_client, hal_power_stats_server)
binder_call(hal_power_stats_server, hal_power_stats_client)
hal_attribute_hwservice(hal_power_stats, hal_power_stats_hwservice)

View file

@ -38,6 +38,7 @@ type hal_nfc_hwservice, hwservice_manager_type;
type hal_oemlock_hwservice, hwservice_manager_type; type hal_oemlock_hwservice, hwservice_manager_type;
type hal_omx_hwservice, hwservice_manager_type; type hal_omx_hwservice, hwservice_manager_type;
type hal_power_hwservice, hwservice_manager_type; type hal_power_hwservice, hwservice_manager_type;
type hal_power_stats_hwservice, hwservice_manager_type;
type hal_renderscript_hwservice, hwservice_manager_type, same_process_hwservice; type hal_renderscript_hwservice, hwservice_manager_type, same_process_hwservice;
type hal_secure_element_hwservice, hwservice_manager_type; type hal_secure_element_hwservice, hwservice_manager_type;
type hal_sensors_hwservice, hwservice_manager_type; type hal_sensors_hwservice, hwservice_manager_type;

View file

@ -60,6 +60,7 @@ allow statsd dumpstate:fifo_file { getattr write };
allow statsd proc_uid_cputime_showstat:file { getattr open read }; allow statsd proc_uid_cputime_showstat:file { getattr open read };
hal_client_domain(statsd, hal_health) hal_client_domain(statsd, hal_health)
hal_client_domain(statsd, hal_power) hal_client_domain(statsd, hal_power)
hal_client_domain(statsd, hal_power_stats)
hal_client_domain(statsd, hal_thermal) hal_client_domain(statsd, hal_thermal)
# Allow 'adb shell cmd' to upload configs and download output. # Allow 'adb shell cmd' to upload configs and download output.

View file

@ -38,6 +38,7 @@
/(vendor|system/vendor)/bin/hw/android\.hardware\.nfc@1\.1-service u:object_r:hal_nfc_default_exec:s0 /(vendor|system/vendor)/bin/hw/android\.hardware\.nfc@1\.1-service u:object_r:hal_nfc_default_exec:s0
/(vendor|system/vendor)/bin/hw/android\.hardware\.media\.omx@1\.0-service u:object_r:mediacodec_exec:s0 /(vendor|system/vendor)/bin/hw/android\.hardware\.media\.omx@1\.0-service u:object_r:mediacodec_exec:s0
/(vendor|system/vendor)/bin/hw/android\.hardware\.power@1\.0-service u:object_r:hal_power_default_exec:s0 /(vendor|system/vendor)/bin/hw/android\.hardware\.power@1\.0-service u:object_r:hal_power_default_exec:s0
/(vendor|system/vendor)/bin/hw/android\.hardware\.power\.stats@1\.0-service u:object_r:hal_power_stats_default_exec:s0
/(vendor|system/vendor)/bin/hw/android\.hardware\.radio\.config@1\.0-service u:object_r:hal_radio_config_default_exec:s0 /(vendor|system/vendor)/bin/hw/android\.hardware\.radio\.config@1\.0-service u:object_r:hal_radio_config_default_exec:s0
/(vendor|system/vendor)/bin/hw/android\.hardware\.radio@1\.2-radio-service u:object_r:hal_radio_default_exec:s0 /(vendor|system/vendor)/bin/hw/android\.hardware\.radio@1\.2-radio-service u:object_r:hal_radio_default_exec:s0
/(vendor|system/vendor)/bin/hw/android\.hardware\.radio@1\.2-sap-service u:object_r:hal_radio_default_exec:s0 /(vendor|system/vendor)/bin/hw/android\.hardware\.radio@1\.2-sap-service u:object_r:hal_radio_default_exec:s0

5
vendor/hal_power_stats_default.te vendored Normal file
View file

@ -0,0 +1,5 @@
type hal_power_stats_default, domain;
hal_server_domain(hal_power_stats_default, hal_power_stats)
type hal_power_stats_default_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(hal_power_stats_default)