1 # bluetooth subsystem 2 3 typeattribute bluetooth coredomain; 4 typeattribute bluetooth domain_deprecated; 5 6 app_domain(bluetooth) 7 net_domain(bluetooth) 8 9 # Socket creation under /data/misc/bluedroid. 10 type_transition bluetooth bluetooth_data_file:sock_file bluetooth_socket; 11 12 # Allow access to net_admin ioctls 13 allowxperm bluetooth self:udp_socket ioctl priv_sock_ioctls; 14 15 wakelock_use(bluetooth); 16 17 # Data file accesses. 18 allow bluetooth bluetooth_data_file:dir create_dir_perms; 19 allow bluetooth bluetooth_data_file:notdevfile_class_set create_file_perms; 20 allow bluetooth bluetooth_logs_data_file:dir rw_dir_perms; 21 allow bluetooth bluetooth_logs_data_file:file create_file_perms; 22 23 # Socket creation under /data/misc/bluedroid. 24 allow bluetooth bluetooth_socket:sock_file create_file_perms; 25 26 allow bluetooth self:capability net_admin; 27 allow bluetooth self:capability2 wake_alarm; 28 29 # tethering 30 allow bluetooth self:packet_socket create_socket_perms_no_ioctl; 31 allow bluetooth self:capability { net_admin net_raw net_bind_service }; 32 allow bluetooth self:tun_socket create_socket_perms_no_ioctl; 33 allow bluetooth tun_device:chr_file rw_file_perms; 34 allow bluetooth efs_file:dir search; 35 36 # allow Bluetooth to access uhid device for HID profile 37 allow bluetooth uhid_device:chr_file rw_file_perms; 38 39 # proc access. 40 allow bluetooth proc_bluetooth_writable:file rw_file_perms; 41 42 # Allow write access to bluetooth specific properties 43 set_prop(bluetooth, bluetooth_prop) 44 set_prop(bluetooth, pan_result_prop) 45 46 allow bluetooth audioserver_service:service_manager find; 47 allow bluetooth bluetooth_service:service_manager find; 48 allow bluetooth drmserver_service:service_manager find; 49 allow bluetooth mediaserver_service:service_manager find; 50 allow bluetooth radio_service:service_manager find; 51 allow bluetooth surfaceflinger_service:service_manager find; 52 allow bluetooth app_api_service:service_manager find; 53 allow bluetooth system_api_service:service_manager find; 54 55 # already open bugreport file descriptors may be shared with 56 # the bluetooth process, from a file in 57 # /data/data/com.android.shell/files/bugreports/bugreport-*. 58 allow bluetooth shell_data_file:file read; 59 60 # Bluetooth audio needs RT scheduling to meet deadlines, allow sys_nice 61 allow bluetooth self:capability sys_nice; 62 63 hal_client_domain(bluetooth, hal_bluetooth) 64 hal_client_domain(bluetooth, hal_telephony) 65 66 read_runtime_log_tags(bluetooth) 67 68 ### 69 ### Neverallow rules 70 ### 71 ### These are things that the bluetooth app should NEVER be able to do 72 ### 73 74 # Superuser capabilities. 75 # Bluetooth requires net_{admin,raw,bind_service} and wake_alarm and block_suspend and sys_nice. 76 neverallow bluetooth self:capability ~{ net_admin net_raw net_bind_service sys_nice}; 77 neverallow bluetooth self:capability2 ~{ wake_alarm block_suspend }; 78