Add charger related property contexts
ro.enable_boot_charger_mode and sys.boot_from_charger_mode are moved to
new property contexts for charger props to remove exported*_prop.
Bug: 155844385
Test: boot device with ro.enable_boot_charger_mode
Change-Id: I17d195d3c9c002a42125d46a5efcdb890f1c2a5c
diff --git a/private/charger.te b/private/charger.te
index 719ae3c..2b52aac 100644
--- a/private/charger.te
+++ b/private/charger.te
@@ -5,5 +5,22 @@
set_prop(charger, system_prop)
set_prop(charger, exported_system_prop)
set_prop(charger, exported3_system_prop)
+set_prop(charger, charger_status_prop)
get_prop(charger, charger_prop)
+get_prop(charger, charger_config_prop)
+
+compatible_property_only(`
+ neverallow {
+ -init
+ -dumpstate
+ -charger
+ } charger_prop:file no_rw_file_perms;
+')
+
+neverallow {
+ -init
+ -dumpstate
+ -vendor_init
+ -charger
+} { charger_config_prop charger_status_prop }:file no_rw_file_perms;
diff --git a/private/compat/27.0/27.0.ignore.cil b/private/compat/27.0/27.0.ignore.cil
index a42538f..d17b5bd 100644
--- a/private/compat/27.0/27.0.ignore.cil
+++ b/private/compat/27.0/27.0.ignore.cil
@@ -37,7 +37,9 @@
build_vendor_prop
camera_config_prop
cgroup_bpf
+ charger_config_prop
charger_exec
+ charger_status_prop
color_display_service
content_capture_service
crossprofileapps_service
diff --git a/private/compat/30.0/30.0.cil b/private/compat/30.0/30.0.cil
index c99cecd..7c9d913 100644
--- a/private/compat/30.0/30.0.cil
+++ b/private/compat/30.0/30.0.cil
@@ -1359,6 +1359,7 @@
(typeattributeset exported3_default_prop_30_0
( exported3_default_prop
camera_config_prop
+ charger_config_prop
drm_service_config_prop
hdmi_config_prop
keyguard_config_prop
@@ -1396,7 +1397,7 @@
(typeattributeset exported_pm_prop_30_0 (exported_pm_prop))
(typeattributeset exported_radio_prop_30_0 (exported_radio_prop telephony_status_prop))
(typeattributeset exported_secure_prop_30_0 (exported_secure_prop))
-(typeattributeset exported_system_prop_30_0 (exported_system_prop))
+(typeattributeset exported_system_prop_30_0 (exported_system_prop charger_status_prop))
(typeattributeset exported_system_radio_prop_30_0
( exported_system_radio_prop
usb_config_prop
diff --git a/private/property_contexts b/private/property_contexts
index 524cd05..b6b7295 100644
--- a/private/property_contexts
+++ b/private/property_contexts
@@ -227,7 +227,9 @@
ro.cold_boot_done u:object_r:cold_boot_done_prop:s0
# Charger properties
-ro.charger. u:object_r:charger_prop:s0
+ro.charger. u:object_r:charger_prop:s0
+sys.boot_from_charger_mode u:object_r:charger_status_prop:s0 exact int
+ro.enable_boot_charger_mode u:object_r:charger_config_prop:s0 exact bool
# Virtual A/B properties
ro.virtual_ab.enabled u:object_r:virtual_ab_prop:s0
@@ -416,8 +418,6 @@
external_storage.casefold.enabled u:object_r:storage_config_prop:s0 exact bool
external_storage.sdcardfs.enabled u:object_r:storage_config_prop:s0 exact bool
-ro.enable_boot_charger_mode u:object_r:exported3_default_prop:s0 exact bool
-
ro.lmk.critical u:object_r:lmkd_config_prop:s0 exact int
ro.lmk.critical_upgrade u:object_r:lmkd_config_prop:s0 exact bool
ro.lmk.debug u:object_r:lmkd_config_prop:s0 exact bool
@@ -645,7 +645,6 @@
service.bootanim.exit u:object_r:exported_system_prop:s0 exact int
-sys.boot_from_charger_mode u:object_r:exported_system_prop:s0 exact int
sys.init.userspace_reboot.in_progress u:object_r:userspace_reboot_exported_prop:s0 exact bool
sys.use_memfd u:object_r:use_memfd_prop:s0 exact bool
diff --git a/public/property.te b/public/property.te
index 4d002a6..f9d3fda 100644
--- a/public/property.te
+++ b/public/property.te
@@ -61,6 +61,7 @@
system_restricted_prop(boot_status_prop)
system_restricted_prop(bq_config_prop)
system_restricted_prop(build_prop)
+system_restricted_prop(charger_status_prop)
system_restricted_prop(fingerprint_prop)
system_restricted_prop(init_service_status_prop)
system_restricted_prop(libc_debug_prop)
@@ -108,6 +109,7 @@
system_vendor_config_prop(build_odm_prop)
system_vendor_config_prop(build_vendor_prop)
system_vendor_config_prop(camera_config_prop)
+system_vendor_config_prop(charger_config_prop)
system_vendor_config_prop(cpu_variant_prop)
system_vendor_config_prop(dalvik_config_prop)
system_vendor_config_prop(drm_service_config_prop)