bcl: Add mitigation ready device sepolicy

Instead of relying on vendor.thermal.link_ready property to gate write
to BCL's SYSFS node, adding mitigation ready SYSFS so that writes to
BCL's SYSFS node would not cause NULL pointer dereference.

Bug: 249130916
Test: Confirm property vendor.brownout.mitigation.ready is set
Signed-off-by: George Lee <geolee@google.com>
Change-Id: I1b21a1c745e7e17f78e9d4c001032dd2c46673cf
This commit is contained in:
George Lee 2022-10-05 14:03:34 -07:00
parent bdf3d6abcc
commit 2260099ad3
3 changed files with 10 additions and 0 deletions

View file

@ -2,6 +2,7 @@ type battery_mitigation, domain;
type battery_mitigation_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(battery_mitigation)
get_prop(battery_mitigation, boot_status_prop)
set_prop(battery_mitigation, vendor_mitigation_ready_prop)
hal_client_domain(battery_mitigation, hal_thermal);
hal_client_domain(battery_mitigation, hal_health);
@ -11,6 +12,9 @@ r_dir_file(battery_mitigation, sysfs_iio_devices)
r_dir_file(battery_mitigation, sysfs_thermal)
r_dir_file(battery_mitigation, thermal_link_device)
r_dir_file(battery_mitigation, sysfs_odpm)
allow battery_mitigation sysfs_bcl:dir r_dir_perms;
allow battery_mitigation sysfs_bcl:file r_file_perms;
allow battery_mitigation sysfs_bcl:lnk_file r_file_perms;
allow battery_mitigation sysfs_thermal:lnk_file r_file_perms;
allow battery_mitigation mitigation_vendor_data_file:dir rw_dir_perms;
allow battery_mitigation mitigation_vendor_data_file:file create_file_perms;

View file

@ -36,3 +36,6 @@ vendor_internal_prop(vendor_dynamic_sensor_prop)
# Telephony debug app
vendor_internal_prop(vendor_telephony_app_prop)
# Battery Mitigation
vendor_internal_prop(vendor_mitigation_ready_prop)

View file

@ -106,3 +106,6 @@ persist.vendor.ims. u:object_r:vendor_imssvc_prop:s0
# for vendor telephony debug app
vendor.config.debug. u:object_r:vendor_telephony_app_prop:s0
# Battery Mitigation
vendor.brownout.mitigation.ready u:object_r:vendor_mitigation_ready_prop:s0