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