1*e4a36f41SAndroid Build Coastguard Worker# healthd - battery/charger monitoring service daemon 2*e4a36f41SAndroid Build Coastguard Workertype healthd, domain; 3*e4a36f41SAndroid Build Coastguard Workertype healthd_exec, system_file_type, exec_type, file_type; 4*e4a36f41SAndroid Build Coastguard Worker 5*e4a36f41SAndroid Build Coastguard Worker# Write to /dev/kmsg 6*e4a36f41SAndroid Build Coastguard Workerallow healthd kmsg_device:chr_file rw_file_perms; 7*e4a36f41SAndroid Build Coastguard Worker 8*e4a36f41SAndroid Build Coastguard Worker# Read access to pseudo filesystems. 9*e4a36f41SAndroid Build Coastguard Workerallow healthd sysfs_type:dir search; 10*e4a36f41SAndroid Build Coastguard Worker# Allow to read /sys/class/power_supply directory. 11*e4a36f41SAndroid Build Coastguard Workerallow healthd sysfs:dir r_dir_perms; 12*e4a36f41SAndroid Build Coastguard Workerr_dir_file(healthd, rootfs) 13*e4a36f41SAndroid Build Coastguard Workerr_dir_file(healthd, cgroup) 14*e4a36f41SAndroid Build Coastguard Worker 15*e4a36f41SAndroid Build Coastguard Workerallow healthd self:global_capability_class_set { sys_tty_config }; 16*e4a36f41SAndroid Build Coastguard Workerallow healthd self:global_capability_class_set sys_boot; 17*e4a36f41SAndroid Build Coastguard Workerdontaudit healthd self:global_capability_class_set sys_resource; 18*e4a36f41SAndroid Build Coastguard Worker 19*e4a36f41SAndroid Build Coastguard Workerallow healthd self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl; 20*e4a36f41SAndroid Build Coastguard Worker 21*e4a36f41SAndroid Build Coastguard Workerwakelock_use(healthd) 22*e4a36f41SAndroid Build Coastguard Worker 23*e4a36f41SAndroid Build Coastguard Workerhal_client_domain(healthd, hal_health) 24*e4a36f41SAndroid Build Coastguard Worker 25*e4a36f41SAndroid Build Coastguard Worker# Read/write to /sys/power/state 26*e4a36f41SAndroid Build Coastguard Workerallow healthd sysfs_power:file rw_file_perms; 27*e4a36f41SAndroid Build Coastguard Worker 28*e4a36f41SAndroid Build Coastguard Worker# TODO: added to match above sysfs rule. Remove me? 29*e4a36f41SAndroid Build Coastguard Workerallow healthd sysfs_usb:file write; 30*e4a36f41SAndroid Build Coastguard Worker 31*e4a36f41SAndroid Build Coastguard Workerr_dir_file(healthd, sysfs_batteryinfo) 32*e4a36f41SAndroid Build Coastguard Worker 33*e4a36f41SAndroid Build Coastguard Worker### 34*e4a36f41SAndroid Build Coastguard Worker### healthd: charger mode 35*e4a36f41SAndroid Build Coastguard Worker### 36*e4a36f41SAndroid Build Coastguard Worker 37*e4a36f41SAndroid Build Coastguard Worker# Read /sys/fs/pstore/console-ramoops 38*e4a36f41SAndroid Build Coastguard Worker# Don't worry about overly broad permissions for now, as there's 39*e4a36f41SAndroid Build Coastguard Worker# only one file in /sys/fs/pstore 40*e4a36f41SAndroid Build Coastguard Workerallow healthd pstorefs:dir r_dir_perms; 41*e4a36f41SAndroid Build Coastguard Workerallow healthd pstorefs:file r_file_perms; 42*e4a36f41SAndroid Build Coastguard Worker 43*e4a36f41SAndroid Build Coastguard Workerallow healthd graphics_device:dir r_dir_perms; 44*e4a36f41SAndroid Build Coastguard Workerallow healthd graphics_device:chr_file rw_file_perms; 45*e4a36f41SAndroid Build Coastguard Workerallow healthd input_device:dir r_dir_perms; 46*e4a36f41SAndroid Build Coastguard Workerallow healthd input_device:chr_file r_file_perms; 47*e4a36f41SAndroid Build Coastguard Workerallow healthd tty_device:chr_file rw_file_perms; 48*e4a36f41SAndroid Build Coastguard Workerallow healthd ashmem_device:chr_file execute; 49*e4a36f41SAndroid Build Coastguard Workerallow healthd self:process execmem; 50*e4a36f41SAndroid Build Coastguard Workerallow healthd proc_sysrq:file rw_file_perms; 51*e4a36f41SAndroid Build Coastguard Worker 52*e4a36f41SAndroid Build Coastguard Worker# Healthd needs to tell init to continue the boot 53*e4a36f41SAndroid Build Coastguard Worker# process when running in charger mode. 54*e4a36f41SAndroid Build Coastguard Workerset_prop(healthd, system_prop) 55*e4a36f41SAndroid Build Coastguard Workerset_prop(healthd, exported_system_prop) 56*e4a36f41SAndroid Build Coastguard Workerset_prop(healthd, exported2_system_prop) 57*e4a36f41SAndroid Build Coastguard Workerset_prop(healthd, exported3_system_prop) 58