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