1# bluetooth subsystem
2type bluetooth, domain, domain_deprecated;
3app_domain(bluetooth)
4net_domain(bluetooth)
5
6wakelock_use(bluetooth);
7
8# Data file accesses.
9allow bluetooth bluetooth_data_file:dir create_dir_perms;
10allow bluetooth bluetooth_data_file:notdevfile_class_set create_file_perms;
11
12# Socket creation under /data/misc/bluedroid.
13type_transition bluetooth bluetooth_data_file:sock_file bluetooth_socket;
14allow bluetooth bluetooth_socket:sock_file create_file_perms;
15
16# bluetooth factory file accesses.
17r_dir_file(bluetooth, bluetooth_efs_file)
18
19allow bluetooth { uhid_device hci_attach_dev }:chr_file rw_file_perms;
20
21# sysfs access.
22allow bluetooth sysfs_bluetooth_writable:file rw_file_perms;
23allow bluetooth self:capability net_admin;
24allow bluetooth self:capability2 wake_alarm;
25
26# tethering
27allow bluetooth self:packet_socket create_socket_perms;
28allow bluetooth self:capability { net_admin net_raw net_bind_service };
29allow bluetooth self:tun_socket create_socket_perms;
30allow bluetooth tun_device:chr_file rw_file_perms;
31allow bluetooth efs_file:dir search;
32
33# proc access.
34allow bluetooth proc_bluetooth_writable:file rw_file_perms;
35
36# Allow write access to bluetooth specific properties
37set_prop(bluetooth, bluetooth_prop)
38set_prop(bluetooth, pan_result_prop)
39
40allow bluetooth audioserver_service:service_manager find;
41allow bluetooth bluetooth_service:service_manager find;
42allow bluetooth drmserver_service:service_manager find;
43allow bluetooth mediaserver_service:service_manager find;
44allow bluetooth radio_service:service_manager find;
45allow bluetooth surfaceflinger_service:service_manager find;
46allow bluetooth app_api_service:service_manager find;
47allow bluetooth system_api_service:service_manager find;
48
49# Bluetooth Sim Access Profile Socket to the RIL
50unix_socket_connect(bluetooth, sap_uim, rild)
51
52# already open bugreport file descriptors may be shared with
53# the bluetooth process, from a file in
54# /data/data/com.android.shell/files/bugreports/bugreport-*.
55allow bluetooth shell_data_file:file read;
56
57# Access to /data/media.
58# This should be removed if sdcardfs is modified to alter the secontext for its
59# accesses to the underlying FS.
60allow bluetooth media_rw_data_file:dir create_dir_perms;
61allow bluetooth media_rw_data_file:file create_file_perms;
62
63###
64### Neverallow rules
65###
66### These are things that the bluetooth app should NEVER be able to do
67###
68
69# Superuser capabilities.
70# bluetooth requires net_{admin,raw,bind_service} and wake_alarm and block_suspend.
71neverallow bluetooth self:capability ~{ net_admin net_raw net_bind_service };
72neverallow bluetooth self:capability2 ~{ wake_alarm block_suspend };
73