# Policy for /vendor/bin/thermal-engine
type thermal-engine, domain;
type thermal-engine_exec, exec_type, file_type;

init_daemon_domain(thermal-engine)

# Grant access to Qualcomm MSM Interface (QMI) radio sockets
qmux_socket(thermal-engine)

allow thermal-engine self:socket create_socket_perms;
allowxperm thermal-engine self:socket ioctl msm_sock_ipc_ioctls;

# /dev/msm_thermal_query
allow thermal-engine thermal_device:chr_file rw_file_perms;

# files in /sys/
r_dir_file(thermal-engine, sysfs_type)
allow thermal-engine sysfs_msm_subsys:file write;
allow thermal-engine sysfs_thermal:file write;

allow thermal-engine uio_device:chr_file rw_file_perms;

# access to /dev/diag on debug builds
userdebug_or_eng(`
  allow thermal-engine diag_device:chr_file rw_file_perms;
')

allow thermal-engine self:capability sys_boot;