type hal_parts_default, domain, coredomain;
type hal_parts_default_exec, exec_type, file_type, system_file_type;

add_service(hal_parts_default, hal_parts_service);
init_daemon_domain(hal_parts_default);

binder_use(hal_parts_default);

# Battery
allow hal_parts_default sysfs_sec_switch:dir { search };
allow hal_parts_default sysfs_sec_switch_writable:file rw_file_perms;
allow hal_parts_default sysfs_battery_writable:file rw_file_perms;
allow hal_parts_default sysfs_sec_switch_writable:dir { search };
allow hal_parts_default sysfs_battery_writable:dir { search };
allow hal_parts_default sysfs_battery:dir { search };
allow hal_parts_default sysfs_virtual:dir search;
allow hal_parts_default self:capability setuid;

# FlashLight
allow hal_parts_default sysfs_flashlight:file { read open write getattr };
allow hal_parts_default sysfs_flashlight:dir search;
allow hal_parts_default sysfs_virtual:dir search;

# Display
allow hal_parts_default sysfs_sec_touchscreen:dir search;
allow hal_parts_default sysfs_touchscreen_writable:file rw_file_perms;

# Swap
type parts_data_file, file_type, data_file_type, core_data_file_type;
allow hal_parts_default parts_data_file:dir rw_dir_perms;
allow hal_parts_default parts_data_file:file rw_file_perms;
allow hal_parts_default parts_data_file:file create_file_perms;
allow hal_parts_default self:capability sys_admin;
