# kickstart processes and scripts (system process)
type kickstart, domain;
type kickstart_exec, file_type, exec_type;

init_daemon_domain(kickstart)

# Run kickstart_checker.sh
allow kickstart shell_exec:file rx_file_perms;
allow kickstart kickstart_exec:file rx_file_perms;

# kickstart_checker.sh changes block devices
# /dev/block/platform/msm_sdcc.1/by-name/m9kefs*
allow kickstart self:capability { chown fowner };

# Let qcks access /dev/mdm node (modem driver)
allow kickstart radio_device:chr_file r_file_perms;

# Access USB host ks bridge drivers
allow kickstart kickstart_device:chr_file rw_file_perms;

# Read and write to /dev/block/mmcblk0p[567]
allow kickstart efs_block_device:blk_file { setattr rw_file_perms };
allow kickstart block_device:dir { getattr write search };

# Write contents of block device to kickstart data dir
allow kickstart kickstart_data_file:file create_file_perms;
allow kickstart kickstart_data_file:dir rw_dir_perms;

# Read radio firmware file(s)
allow kickstart radio_efs_file:dir search;
allow kickstart radio_efs_file:file r_file_perms;

# Run dd from toolbox on firmware files
allow kickstart shell_exec:file rx_file_perms;
allow kickstart system_file:file execute_no_trans;

# Wake lock access
wakelock_use(kickstart)

# Set property key gsm.radio.kickstart
allow kickstart radio_prop:property_service set;
unix_socket_connect(kickstart, property, init)

# Access /sys/module/rmnet_usb/parameters/rmnet_data_init
allow kickstart sysfs_rmnet:file w_file_perms;