1# This command set moves the artifact corresponding to the current slot
2# from /data/ota to /data/dalvik-cache.
3
4type otapreopt_slot, domain, mlstrustedsubject, coredomain;
5type otapreopt_slot_exec, system_file_type, exec_type, file_type;
6
7# Technically not a daemon but we do want the transition from init domain to
8# cppreopts to occur.
9init_daemon_domain(otapreopt_slot)
10
11# The otapreopt_slot renames the OTA dalvik-cache to the regular dalvik-cache, and cleans up
12# the directory afterwards. For logging of aggregate size, we need getattr.
13allow otapreopt_slot ota_data_file:dir { rw_dir_perms rename reparent rmdir };
14allow otapreopt_slot ota_data_file:{ file lnk_file } getattr;
15# (du follows symlinks)
16allow otapreopt_slot ota_data_file:lnk_file read;
17
18# Delete old content of the dalvik-cache.
19allow otapreopt_slot dalvikcache_data_file:dir { add_name getattr open read remove_name rmdir search write };
20allow otapreopt_slot dalvikcache_data_file:file { getattr unlink };
21allow otapreopt_slot dalvikcache_data_file:lnk_file { getattr read unlink };
22
23# Allow cppreopts to execute itself using #!/system/bin/sh
24allow otapreopt_slot shell_exec:file rx_file_perms;
25
26# Allow running the mv and rm/rmdir commands using otapreopt_slot  permissions.
27# Needed so we can move artifacts into /data/dalvik-cache/dalvik-cache.
28allow otapreopt_slot toolbox_exec:file rx_file_perms;
29