1# bluetooth subsystem
2
3typeattribute bluetooth coredomain;
4typeattribute bluetooth domain_deprecated;
5
6app_domain(bluetooth)
7net_domain(bluetooth)
8
9# Socket creation under /data/misc/bluedroid.
10type_transition bluetooth bluetooth_data_file:sock_file bluetooth_socket;
11
12# Allow access to net_admin ioctls
13allowxperm bluetooth self:udp_socket ioctl priv_sock_ioctls;
14
15wakelock_use(bluetooth);
16
17# Data file accesses.
18allow bluetooth bluetooth_data_file:dir create_dir_perms;
19allow bluetooth bluetooth_data_file:notdevfile_class_set create_file_perms;
20allow bluetooth bluetooth_logs_data_file:dir rw_dir_perms;
21allow bluetooth bluetooth_logs_data_file:file create_file_perms;
22
23# Socket creation under /data/misc/bluedroid.
24allow bluetooth bluetooth_socket:sock_file create_file_perms;
25
26allow bluetooth self:capability net_admin;
27allow bluetooth self:capability2 wake_alarm;
28
29# tethering
30allow bluetooth self:packet_socket create_socket_perms_no_ioctl;
31allow bluetooth self:capability { net_admin net_raw net_bind_service };
32allow bluetooth self:tun_socket create_socket_perms_no_ioctl;
33allow bluetooth tun_device:chr_file rw_file_perms;
34allow bluetooth efs_file:dir search;
35
36# allow Bluetooth to access uhid device for HID profile
37allow bluetooth uhid_device:chr_file rw_file_perms;
38
39# proc access.
40allow bluetooth proc_bluetooth_writable:file rw_file_perms;
41
42# Allow write access to bluetooth specific properties
43set_prop(bluetooth, bluetooth_prop)
44set_prop(bluetooth, pan_result_prop)
45
46allow bluetooth audioserver_service:service_manager find;
47allow bluetooth bluetooth_service:service_manager find;
48allow bluetooth drmserver_service:service_manager find;
49allow bluetooth mediaserver_service:service_manager find;
50allow bluetooth radio_service:service_manager find;
51allow bluetooth surfaceflinger_service:service_manager find;
52allow bluetooth app_api_service:service_manager find;
53allow 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-*.
58allow bluetooth shell_data_file:file read;
59
60# Bluetooth audio needs RT scheduling to meet deadlines, allow sys_nice
61allow bluetooth self:capability sys_nice;
62
63hal_client_domain(bluetooth, hal_bluetooth)
64hal_client_domain(bluetooth, hal_telephony)
65
66read_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.
76neverallow bluetooth self:capability ~{ net_admin net_raw net_bind_service sys_nice};
77neverallow bluetooth self:capability2 ~{ wake_alarm block_suspend };
78