Tri Vo | bc8dc3a | 2019-05-26 13:17:08 -0700 | [diff] [blame^] | 1 | # This command set moves the artifact corresponding to the current slot |
| 2 | # from /data/ota to /data/dalvik-cache. |
| 3 | |
| 4 | type otapreopt_slot, domain, mlstrustedsubject, coredomain; |
| 5 | type 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. |
| 9 | init_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. |
| 13 | allow otapreopt_slot ota_data_file:dir { rw_dir_perms rename reparent rmdir }; |
| 14 | allow otapreopt_slot ota_data_file:{ file lnk_file } getattr; |
| 15 | # (du follows symlinks) |
| 16 | allow otapreopt_slot ota_data_file:lnk_file read; |
| 17 | |
| 18 | # Delete old content of the dalvik-cache. |
| 19 | allow otapreopt_slot dalvikcache_data_file:dir { add_name getattr open read remove_name rmdir search write }; |
| 20 | allow otapreopt_slot dalvikcache_data_file:file { getattr unlink }; |
| 21 | allow otapreopt_slot dalvikcache_data_file:lnk_file { getattr read unlink }; |
| 22 | |
| 23 | # Allow cppreopts to execute itself using #!/system/bin/sh |
| 24 | allow 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. |
| 28 | allow otapreopt_slot toolbox_exec:file rx_file_perms; |