1*e4a36f41SAndroid Build Coastguard Worker### 2*e4a36f41SAndroid Build Coastguard Worker### Apps signed with the platform key. 3*e4a36f41SAndroid Build Coastguard Worker### 4*e4a36f41SAndroid Build Coastguard Worker 5*e4a36f41SAndroid Build Coastguard Workertypeattribute platform_app coredomain; 6*e4a36f41SAndroid Build Coastguard Worker 7*e4a36f41SAndroid Build Coastguard Workerapp_domain(platform_app) 8*e4a36f41SAndroid Build Coastguard Worker 9*e4a36f41SAndroid Build Coastguard Worker# Access the network. 10*e4a36f41SAndroid Build Coastguard Workernet_domain(platform_app) 11*e4a36f41SAndroid Build Coastguard Worker# Access bluetooth. 12*e4a36f41SAndroid Build Coastguard Workerbluetooth_domain(platform_app) 13*e4a36f41SAndroid Build Coastguard Worker# Read from /data/local/tmp or /data/data/com.android.shell. 14*e4a36f41SAndroid Build Coastguard Workerallow platform_app shell_data_file:dir search; 15*e4a36f41SAndroid Build Coastguard Workerallow platform_app shell_data_file:file { open getattr read }; 16*e4a36f41SAndroid Build Coastguard Workerallow platform_app icon_file:file { open getattr read }; 17*e4a36f41SAndroid Build Coastguard Worker# Populate /data/app/vmdl*.tmp, /data/app-private/vmdl*.tmp files 18*e4a36f41SAndroid Build Coastguard Worker# created by system server. 19*e4a36f41SAndroid Build Coastguard Workerallow platform_app { apk_tmp_file apk_private_tmp_file }:dir rw_dir_perms; 20*e4a36f41SAndroid Build Coastguard Workerallow platform_app { apk_tmp_file apk_private_tmp_file }:file rw_file_perms; 21*e4a36f41SAndroid Build Coastguard Workerallow platform_app apk_private_data_file:dir search; 22*e4a36f41SAndroid Build Coastguard Worker# ASEC 23*e4a36f41SAndroid Build Coastguard Workerallow platform_app asec_apk_file:dir create_dir_perms; 24*e4a36f41SAndroid Build Coastguard Workerallow platform_app asec_apk_file:file create_file_perms; 25*e4a36f41SAndroid Build Coastguard Worker 26*e4a36f41SAndroid Build Coastguard Worker# Access to /data/media. 27*e4a36f41SAndroid Build Coastguard Workerallow platform_app media_rw_data_file:dir create_dir_perms; 28*e4a36f41SAndroid Build Coastguard Workerallow platform_app media_rw_data_file:file create_file_perms; 29*e4a36f41SAndroid Build Coastguard Worker 30*e4a36f41SAndroid Build Coastguard Worker# Write to /cache. 31*e4a36f41SAndroid Build Coastguard Workerallow platform_app cache_file:dir create_dir_perms; 32*e4a36f41SAndroid Build Coastguard Workerallow platform_app cache_file:file create_file_perms; 33*e4a36f41SAndroid Build Coastguard Worker 34*e4a36f41SAndroid Build Coastguard Worker# Direct access to vold-mounted storage under /mnt/media_rw 35*e4a36f41SAndroid Build Coastguard Worker# This is a performance optimization that allows platform apps to bypass the FUSE layer 36*e4a36f41SAndroid Build Coastguard Workerallow platform_app mnt_media_rw_file:dir r_dir_perms; 37*e4a36f41SAndroid Build Coastguard Workerallow platform_app sdcard_type:dir create_dir_perms; 38*e4a36f41SAndroid Build Coastguard Workerallow platform_app sdcard_type:file create_file_perms; 39*e4a36f41SAndroid Build Coastguard Worker 40*e4a36f41SAndroid Build Coastguard Worker# com.android.systemui 41*e4a36f41SAndroid Build Coastguard Workerallow platform_app rootfs:dir getattr; 42*e4a36f41SAndroid Build Coastguard Workerget_prop(platform_app, radio_cdma_ecm_prop) 43*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 44*e4a36f41SAndroid Build Coastguard Worker set_prop(platform_app, persist_wm_debug_prop) 45*e4a36f41SAndroid Build Coastguard Worker') 46*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -init -dumpstate userdebug_or_eng(`-domain') } persist_wm_debug_prop:property_service set; 47*e4a36f41SAndroid Build Coastguard Worker 48*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 49*e4a36f41SAndroid Build Coastguard Worker set_prop(platform_app, persist_sysui_builder_extras_prop) 50*e4a36f41SAndroid Build Coastguard Worker') 51*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 52*e4a36f41SAndroid Build Coastguard Worker set_prop(platform_app, persist_sysui_ranking_update_prop) 53*e4a36f41SAndroid Build Coastguard Worker') 54*e4a36f41SAndroid Build Coastguard Workerset_prop(platform_app, debug_tracing_desktop_mode_visible_tasks_prop) 55*e4a36f41SAndroid Build Coastguard Worker 56*e4a36f41SAndroid Build Coastguard Worker# com.android.captiveportallogin reads /proc/vmstat 57*e4a36f41SAndroid Build Coastguard Workerallow platform_app { 58*e4a36f41SAndroid Build Coastguard Worker proc_vmstat 59*e4a36f41SAndroid Build Coastguard Worker}:file r_file_perms; 60*e4a36f41SAndroid Build Coastguard Worker 61*e4a36f41SAndroid Build Coastguard Worker# /proc/net access. 62*e4a36f41SAndroid Build Coastguard Worker# TODO(b/9496886) Audit access for removal. 63*e4a36f41SAndroid Build Coastguard Workerr_dir_file(platform_app, proc_net_type) 64*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 65*e4a36f41SAndroid Build Coastguard Worker auditallow platform_app proc_net_type:{ dir file lnk_file } { getattr open read }; 66*e4a36f41SAndroid Build Coastguard Worker') 67*e4a36f41SAndroid Build Coastguard Worker 68*e4a36f41SAndroid Build Coastguard Worker# Allow sharing traces to betterbug from /data/misc/wmtrace. 69*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 70*e4a36f41SAndroid Build Coastguard Worker allow platform_app trace_data_file:file create_file_perms; 71*e4a36f41SAndroid Build Coastguard Worker allow platform_app trace_data_file:dir rw_dir_perms; 72*e4a36f41SAndroid Build Coastguard Worker') 73*e4a36f41SAndroid Build Coastguard Worker 74*e4a36f41SAndroid Build Coastguard Worker# Allow writing and removing wmshell protolog in /data/misc/wmtrace. 75*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 76*e4a36f41SAndroid Build Coastguard Worker allow platform_app wm_trace_data_file:dir rw_dir_perms; 77*e4a36f41SAndroid Build Coastguard Worker allow platform_app wm_trace_data_file:file { getattr setattr create unlink rw_file_perms }; 78*e4a36f41SAndroid Build Coastguard Worker') 79*e4a36f41SAndroid Build Coastguard Worker 80*e4a36f41SAndroid Build Coastguard Worker 81*e4a36f41SAndroid Build Coastguard Worker# To exec the perfetto cmdline client and pass it the trace config on 82*e4a36f41SAndroid Build Coastguard Worker# stdint through a pipe. Allow to access traced's privileged consumer socket. 83*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 84*e4a36f41SAndroid Build Coastguard Worker allow platform_app perfetto_exec:file rx_file_perms; 85*e4a36f41SAndroid Build Coastguard Worker unix_socket_connect(platform_app, traced_consumer, traced); 86*e4a36f41SAndroid Build Coastguard Worker') 87*e4a36f41SAndroid Build Coastguard Worker 88*e4a36f41SAndroid Build Coastguard Workerallow platform_app audioserver_service:service_manager find; 89*e4a36f41SAndroid Build Coastguard Workerallow platform_app cameraserver_service:service_manager find; 90*e4a36f41SAndroid Build Coastguard Workerallow platform_app drmserver_service:service_manager find; 91*e4a36f41SAndroid Build Coastguard Workerallow platform_app mediaserver_service:service_manager find; 92*e4a36f41SAndroid Build Coastguard Workerallow platform_app mediametrics_service:service_manager find; 93*e4a36f41SAndroid Build Coastguard Workerallow platform_app mediaextractor_service:service_manager find; 94*e4a36f41SAndroid Build Coastguard Workerallow platform_app mediadrmserver_service:service_manager find; 95*e4a36f41SAndroid Build Coastguard Workerallow platform_app persistent_data_block_service:service_manager find; 96*e4a36f41SAndroid Build Coastguard Workerallow platform_app radio_service:service_manager find; 97*e4a36f41SAndroid Build Coastguard Workerallow platform_app thermal_service:service_manager find; 98*e4a36f41SAndroid Build Coastguard Workerallow platform_app app_api_service:service_manager find; 99*e4a36f41SAndroid Build Coastguard Workerallow platform_app system_api_service:service_manager find; 100*e4a36f41SAndroid Build Coastguard Workerallow platform_app vr_manager_service:service_manager find; 101*e4a36f41SAndroid Build Coastguard Workerallow platform_app stats_service:service_manager find; 102*e4a36f41SAndroid Build Coastguard Workerallow platform_app tradeinmode_service:service_manager find; 103*e4a36f41SAndroid Build Coastguard Worker 104*e4a36f41SAndroid Build Coastguard Worker# Allow platform apps to log via statsd. 105*e4a36f41SAndroid Build Coastguard Workerbinder_call(platform_app, statsd) 106*e4a36f41SAndroid Build Coastguard Worker 107*e4a36f41SAndroid Build Coastguard Worker# Allow platform applications to find and call artd for testing 108*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(` 109*e4a36f41SAndroid Build Coastguard Worker allow platform_app artd_service:service_manager find; 110*e4a36f41SAndroid Build Coastguard Worker binder_call(platform_app, artd) 111*e4a36f41SAndroid Build Coastguard Worker') 112*e4a36f41SAndroid Build Coastguard Worker 113*e4a36f41SAndroid Build Coastguard Worker# Access to /data/preloads 114*e4a36f41SAndroid Build Coastguard Workerallow platform_app preloads_data_file:file r_file_perms; 115*e4a36f41SAndroid Build Coastguard Workerallow platform_app preloads_data_file:dir r_dir_perms; 116*e4a36f41SAndroid Build Coastguard Workerallow platform_app preloads_media_file:file r_file_perms; 117*e4a36f41SAndroid Build Coastguard Workerallow platform_app preloads_media_file:dir r_dir_perms; 118*e4a36f41SAndroid Build Coastguard Worker 119*e4a36f41SAndroid Build Coastguard Workerread_runtime_log_tags(platform_app) 120*e4a36f41SAndroid Build Coastguard Worker 121*e4a36f41SAndroid Build Coastguard Worker# allow platform apps to use UDP sockets provided by the system server but not 122*e4a36f41SAndroid Build Coastguard Worker# modify them other than to connect 123*e4a36f41SAndroid Build Coastguard Workerallow platform_app system_server:udp_socket { 124*e4a36f41SAndroid Build Coastguard Worker connect getattr read recvfrom sendto write getopt setopt }; 125*e4a36f41SAndroid Build Coastguard Worker 126*e4a36f41SAndroid Build Coastguard Worker# allow platform apps to connect to the property service 127*e4a36f41SAndroid Build Coastguard Workerset_prop(platform_app, test_boot_reason_prop) 128*e4a36f41SAndroid Build Coastguard Worker 129*e4a36f41SAndroid Build Coastguard Worker# allow platform apps to read keyguard.no_require_sim 130*e4a36f41SAndroid Build Coastguard Workerget_prop(platform_app, keyguard_config_prop) 131*e4a36f41SAndroid Build Coastguard Worker 132*e4a36f41SAndroid Build Coastguard Worker# allow platform apps to read qemu.hw.mainkeys 133*e4a36f41SAndroid Build Coastguard Workerget_prop(platform_app, qemu_hw_prop) 134*e4a36f41SAndroid Build Coastguard Worker 135*e4a36f41SAndroid Build Coastguard Worker# allow platform apps to read sys.boot.reason.last 136*e4a36f41SAndroid Build Coastguard Workerget_prop(platform_app, last_boot_reason_prop) 137*e4a36f41SAndroid Build Coastguard Worker 138*e4a36f41SAndroid Build Coastguard Worker# allow platform apps to create symbolic link 139*e4a36f41SAndroid Build Coastguard Workerallow platform_app app_data_file:lnk_file create_file_perms; 140*e4a36f41SAndroid Build Coastguard Worker 141*e4a36f41SAndroid Build Coastguard Worker# suppress denials caused by debugfs_tracing 142*e4a36f41SAndroid Build Coastguard Workerdontaudit platform_app debugfs_tracing:file rw_file_perms; 143*e4a36f41SAndroid Build Coastguard Worker 144*e4a36f41SAndroid Build Coastguard Worker# Allow platform apps to create VMs 145*e4a36f41SAndroid Build Coastguard Workervirtualizationservice_use(platform_app) 146*e4a36f41SAndroid Build Coastguard Worker 147*e4a36f41SAndroid Build Coastguard Worker### 148*e4a36f41SAndroid Build Coastguard Worker### Neverallow rules 149*e4a36f41SAndroid Build Coastguard Worker### 150*e4a36f41SAndroid Build Coastguard Worker 151*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -init userdebug_or_eng(`-shell -platform_app') } persist_sysui_builder_extras_prop:property_service set; 152*e4a36f41SAndroid Build Coastguard Worker 153*e4a36f41SAndroid Build Coastguard Worker# app domains which access /dev/fuse should not run as platform_app 154*e4a36f41SAndroid Build Coastguard Workerneverallow platform_app fuse_device:chr_file *; 155