xref: /aosp_15_r20/system/sepolicy/private/hal_health.te (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1*e4a36f41SAndroid Build Coastguard Worker# HwBinder IPC from client to server, and callbacks
2*e4a36f41SAndroid Build Coastguard Workerbinder_call(hal_health_client, hal_health_server)
3*e4a36f41SAndroid Build Coastguard Workerbinder_call(hal_health_server, hal_health_client)
4*e4a36f41SAndroid Build Coastguard Worker
5*e4a36f41SAndroid Build Coastguard Workerhal_attribute_hwservice(hal_health, hal_health_hwservice)
6*e4a36f41SAndroid Build Coastguard Workerhal_attribute_service(hal_health, hal_health_service)
7*e4a36f41SAndroid Build Coastguard Worker
8*e4a36f41SAndroid Build Coastguard Worker# Common rules for a health service.
9*e4a36f41SAndroid Build Coastguard Worker
10*e4a36f41SAndroid Build Coastguard Worker# Allow to listen to uevents for updates
11*e4a36f41SAndroid Build Coastguard Workerallow hal_health_server self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl;
12*e4a36f41SAndroid Build Coastguard Worker
13*e4a36f41SAndroid Build Coastguard Worker# Allow to read /sys/class/power_supply directory
14*e4a36f41SAndroid Build Coastguard Workerallow hal_health_server sysfs:dir r_dir_perms;
15*e4a36f41SAndroid Build Coastguard Worker
16*e4a36f41SAndroid Build Coastguard Worker# Allow to read files under /sys/class/power_supply. Implementations typically have symlinks
17*e4a36f41SAndroid Build Coastguard Worker# to vendor specific files. Vendors should mark sysfs_batteryinfo on all files read by health
18*e4a36f41SAndroid Build Coastguard Worker# HAL service.
19*e4a36f41SAndroid Build Coastguard Workerr_dir_file(hal_health_server, sysfs_batteryinfo)
20*e4a36f41SAndroid Build Coastguard Worker
21*e4a36f41SAndroid Build Coastguard Worker# Allow to wake up to send periodic events
22*e4a36f41SAndroid Build Coastguard Workerwakelock_use(hal_health_server)
23*e4a36f41SAndroid Build Coastguard Worker
24*e4a36f41SAndroid Build Coastguard Worker# Write to /dev/kmsg
25*e4a36f41SAndroid Build Coastguard Workerallow hal_health_server kmsg_device:chr_file { getattr w_file_perms };
26*e4a36f41SAndroid Build Coastguard Worker
27*e4a36f41SAndroid Build Coastguard Worker# Allow to use timerfd to wake itself up periodically to send health info.
28*e4a36f41SAndroid Build Coastguard Workerallow hal_health_server self:capability2 wake_alarm;
29*e4a36f41SAndroid Build Coastguard Worker
30*e4a36f41SAndroid Build Coastguard Worker# Use bpf programs
31*e4a36f41SAndroid Build Coastguard Workerallow hal_health_server fs_bpf_vendor:dir search;
32*e4a36f41SAndroid Build Coastguard Workerallow hal_health_server fs_bpf_vendor:file read;
33*e4a36f41SAndroid Build Coastguard Workerallow hal_health_server bpfloader:bpf prog_run;
34