1*e4a36f41SAndroid Build Coastguard Worker# viewcompiler 2*e4a36f41SAndroid Build Coastguard Workertype viewcompiler, domain, coredomain, mlstrustedsubject; 3*e4a36f41SAndroid Build Coastguard Workertype viewcompiler_exec, system_file_type, exec_type, file_type; 4*e4a36f41SAndroid Build Coastguard Workertype viewcompiler_tmpfs, file_type; 5*e4a36f41SAndroid Build Coastguard Worker 6*e4a36f41SAndroid Build Coastguard Worker# Reading an APK opens a ZipArchive, which unpack to tmpfs. 7*e4a36f41SAndroid Build Coastguard Worker# Use tmpfs_domain() which will give tmpfs files created by viewcompiler their 8*e4a36f41SAndroid Build Coastguard Worker# own label, which differs from other labels created by other processes. 9*e4a36f41SAndroid Build Coastguard Worker# This allows to distinguish in policy files created by viewcompiler vs other 10*e4a36f41SAndroid Build Coastguard Worker# processes. 11*e4a36f41SAndroid Build Coastguard Workertmpfs_domain(viewcompiler) 12*e4a36f41SAndroid Build Coastguard Worker 13*e4a36f41SAndroid Build Coastguard Workerallow viewcompiler installd:fd use; 14*e4a36f41SAndroid Build Coastguard Worker 15*e4a36f41SAndroid Build Coastguard Worker# Include write permission for app data files so viewcompiler can generate 16*e4a36f41SAndroid Build Coastguard Worker# compiled layout dex files 17*e4a36f41SAndroid Build Coastguard Workerallow viewcompiler app_data_file:file { getattr write }; 18*e4a36f41SAndroid Build Coastguard Worker 19*e4a36f41SAndroid Build Coastguard Worker# Allow the view compiler to read resources from the apps APK. 20*e4a36f41SAndroid Build Coastguard Workerallow viewcompiler apk_data_file:file { read map }; 21*e4a36f41SAndroid Build Coastguard Worker 22*e4a36f41SAndroid Build Coastguard Worker# priv-apps are moving to a world where they can only execute 23*e4a36f41SAndroid Build Coastguard Worker# signed code. Make sure viewcompiler never can write to privapp 24*e4a36f41SAndroid Build Coastguard Worker# directories to avoid introducing unsigned executable code 25*e4a36f41SAndroid Build Coastguard Workerneverallow viewcompiler privapp_data_file:file no_w_file_perms; 26