xref: /aosp_15_r20/system/sepolicy/prebuilts/api/29.0/public/charger.te (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1*e4a36f41SAndroid Build Coastguard Workertype charger, domain;
2*e4a36f41SAndroid Build Coastguard Workertype charger_exec, system_file_type, exec_type, file_type;
3*e4a36f41SAndroid Build Coastguard Worker
4*e4a36f41SAndroid Build Coastguard Worker# Write to /dev/kmsg
5*e4a36f41SAndroid Build Coastguard Workerallow charger kmsg_device:chr_file rw_file_perms;
6*e4a36f41SAndroid Build Coastguard Worker
7*e4a36f41SAndroid Build Coastguard Worker# Read access to pseudo filesystems.
8*e4a36f41SAndroid Build Coastguard Workerr_dir_file(charger, rootfs)
9*e4a36f41SAndroid Build Coastguard Workerr_dir_file(charger, cgroup)
10*e4a36f41SAndroid Build Coastguard Worker
11*e4a36f41SAndroid Build Coastguard Worker# Allow to read /sys/class/power_supply directory
12*e4a36f41SAndroid Build Coastguard Workerallow charger sysfs_type:dir r_dir_perms;
13*e4a36f41SAndroid Build Coastguard Worker
14*e4a36f41SAndroid Build Coastguard Workerallow charger self:global_capability_class_set { sys_tty_config };
15*e4a36f41SAndroid Build Coastguard Workerallow charger self:global_capability_class_set sys_boot;
16*e4a36f41SAndroid Build Coastguard Worker
17*e4a36f41SAndroid Build Coastguard Workerwakelock_use(charger)
18*e4a36f41SAndroid Build Coastguard Worker
19*e4a36f41SAndroid Build Coastguard Workerallow charger self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl;
20*e4a36f41SAndroid Build Coastguard Worker
21*e4a36f41SAndroid Build Coastguard Worker# Read/write to /sys/power/state
22*e4a36f41SAndroid Build Coastguard Workerallow charger sysfs_power:file rw_file_perms;
23*e4a36f41SAndroid Build Coastguard Worker
24*e4a36f41SAndroid Build Coastguard Workerr_dir_file(charger, sysfs_batteryinfo)
25*e4a36f41SAndroid Build Coastguard Worker
26*e4a36f41SAndroid Build Coastguard Worker# Read /sys/fs/pstore/console-ramoops
27*e4a36f41SAndroid Build Coastguard Worker# Don't worry about overly broad permissions for now, as there's
28*e4a36f41SAndroid Build Coastguard Worker# only one file in /sys/fs/pstore
29*e4a36f41SAndroid Build Coastguard Workerallow charger pstorefs:dir r_dir_perms;
30*e4a36f41SAndroid Build Coastguard Workerallow charger pstorefs:file r_file_perms;
31*e4a36f41SAndroid Build Coastguard Worker
32*e4a36f41SAndroid Build Coastguard Workerallow charger graphics_device:dir r_dir_perms;
33*e4a36f41SAndroid Build Coastguard Workerallow charger graphics_device:chr_file rw_file_perms;
34*e4a36f41SAndroid Build Coastguard Workerallow charger input_device:dir r_dir_perms;
35*e4a36f41SAndroid Build Coastguard Workerallow charger input_device:chr_file r_file_perms;
36*e4a36f41SAndroid Build Coastguard Workerallow charger tty_device:chr_file rw_file_perms;
37*e4a36f41SAndroid Build Coastguard Workerallow charger proc_sysrq:file rw_file_perms;
38*e4a36f41SAndroid Build Coastguard Worker
39*e4a36f41SAndroid Build Coastguard Worker# charger needs to tell init to continue the boot
40*e4a36f41SAndroid Build Coastguard Worker# process when running in charger mode.
41*e4a36f41SAndroid Build Coastguard Workerset_prop(charger, system_prop)
42*e4a36f41SAndroid Build Coastguard Workerset_prop(charger, exported_system_prop)
43*e4a36f41SAndroid Build Coastguard Workerset_prop(charger, exported2_system_prop)
44*e4a36f41SAndroid Build Coastguard Workerset_prop(charger, exported3_system_prop)
45