1*e4a36f41SAndroid Build Coastguard Worker# HwBinder IPC from client to server, and callbacks 2*e4a36f41SAndroid Build Coastguard Workerbinder_call(hal_neuralnetworks_client, hal_neuralnetworks_server) 3*e4a36f41SAndroid Build Coastguard Workerbinder_call(hal_neuralnetworks_server, hal_neuralnetworks_client) 4*e4a36f41SAndroid Build Coastguard Worker 5*e4a36f41SAndroid Build Coastguard Workerhal_attribute_hwservice(hal_neuralnetworks, hal_neuralnetworks_hwservice) 6*e4a36f41SAndroid Build Coastguard Workerallow hal_neuralnetworks hidl_memory_hwservice:hwservice_manager find; 7*e4a36f41SAndroid Build Coastguard Workerallow hal_neuralnetworks hal_allocator:fd use; 8*e4a36f41SAndroid Build Coastguard Workerallow hal_neuralnetworks hal_graphics_mapper_hwservice:hwservice_manager find; 9*e4a36f41SAndroid Build Coastguard Workerallow hal_neuralnetworks hal_graphics_allocator:fd use; 10*e4a36f41SAndroid Build Coastguard Workerallow hal_neuralnetworks gpu_device:chr_file rw_file_perms; 11*e4a36f41SAndroid Build Coastguard Workerallow hal_neuralnetworks gpu_device:dir r_dir_perms; 12*e4a36f41SAndroid Build Coastguard Worker 13*e4a36f41SAndroid Build Coastguard Worker# Allow NN HAL service to use a client-provided fd residing in /data/data/. 14*e4a36f41SAndroid Build Coastguard Workerallow hal_neuralnetworks_server app_data_file:file { read write getattr map }; 15*e4a36f41SAndroid Build Coastguard Workerallow hal_neuralnetworks_server privapp_data_file:file { read write getattr map }; 16*e4a36f41SAndroid Build Coastguard Worker 17*e4a36f41SAndroid Build Coastguard Worker# Allow NN HAL service to use a client-provided fd residing in /data/local/tmp/. 18*e4a36f41SAndroid Build Coastguard Workerallow hal_neuralnetworks_server shell_data_file:file { read write getattr map }; 19*e4a36f41SAndroid Build Coastguard Worker 20*e4a36f41SAndroid Build Coastguard Worker# Allow NN HAL service to read a client-provided ION memory fd. 21*e4a36f41SAndroid Build Coastguard Workerallow hal_neuralnetworks_server ion_device:chr_file r_file_perms; 22*e4a36f41SAndroid Build Coastguard Worker 23*e4a36f41SAndroid Build Coastguard Worker# Allow NN HAL service to use a client-provided fd residing in /storage 24*e4a36f41SAndroid Build Coastguard Workerallow hal_neuralnetworks_server storage_file:file { getattr map read }; 25*e4a36f41SAndroid Build Coastguard Worker 26*e4a36f41SAndroid Build Coastguard Worker# Allow NN HAL service to read a client-provided fd residing in /data/app/. 27*e4a36f41SAndroid Build Coastguard Workerallow hal_neuralnetworks_server apk_data_file:file { getattr map read }; 28*e4a36f41SAndroid Build Coastguard Worker 29*e4a36f41SAndroid Build Coastguard Worker# Allow NN HAL client to check the ro.nnapi.extensions.deny_on_product 30*e4a36f41SAndroid Build Coastguard Worker# property to determine whether to deny NNAPI extensions use for apps 31*e4a36f41SAndroid Build Coastguard Worker# on product partition (apps in GSI are not allowed to use NNAPI extensions). 32*e4a36f41SAndroid Build Coastguard Workerget_prop(hal_neuralnetworks_client, nnapi_ext_deny_product_prop); 33*e4a36f41SAndroid Build Coastguard Worker 34*e4a36f41SAndroid Build Coastguard Worker# Allow NN HAL client to read device_config_nnapi_native_prop. 35*e4a36f41SAndroid Build Coastguard Workerget_prop(hal_neuralnetworks_client, device_config_nnapi_native_prop) 36*e4a36f41SAndroid Build Coastguard Worker 37*e4a36f41SAndroid Build Coastguard Worker# This property is only expected to be found in /product/build.prop, 38*e4a36f41SAndroid Build Coastguard Worker# allow to be set only by init. 39*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -init } nnapi_ext_deny_product_prop:property_service set; 40*e4a36f41SAndroid Build Coastguard Worker 41*e4a36f41SAndroid Build Coastguard Worker# Define sepolicy for NN AIDL HAL service 42*e4a36f41SAndroid Build Coastguard Workerhal_attribute_service(hal_neuralnetworks, hal_neuralnetworks_service) 43*e4a36f41SAndroid Build Coastguard Workerbinder_call(hal_neuralnetworks_server, servicemanager) 44*e4a36f41SAndroid Build Coastguard Worker 45*e4a36f41SAndroid Build Coastguard Workerbinder_use(hal_neuralnetworks_server) 46*e4a36f41SAndroid Build Coastguard Worker 47*e4a36f41SAndroid Build Coastguard Workerallow hal_neuralnetworks_server dumpstate:fifo_file write; 48