From 7a2107c12ab238671922a39d3a23d33d68ac0e6d Mon Sep 17 00:00:00 2001
From: Ajay Panicker <apanicke@google.com>
Date: Fri, 16 Sep 2016 12:55:42 -0700
Subject: [PATCH] Allow bluetooth service to access bluetooth directory and add
 /logs (3/14)

Bug: 31466840
Change-Id: I3984754034349e6c41de6ae9cccbaab95ca5a918
(cherry picked from commit a45672614defede20f2690f03be0c7929a68f349)
---
 bluetooth.te  | 2 ++
 file.te       | 1 +
 file_contexts | 1 +
 3 files changed, 4 insertions(+)

diff --git a/bluetooth.te b/bluetooth.te
index 4b20a5828..a5b4d7155 100644
--- a/bluetooth.te
+++ b/bluetooth.te
@@ -8,6 +8,8 @@ wakelock_use(bluetooth);
 # Data file accesses.
 allow bluetooth bluetooth_data_file:dir create_dir_perms;
 allow bluetooth bluetooth_data_file:notdevfile_class_set create_file_perms;
+allow bluetooth bluetooth_logs_data_file:dir rw_dir_perms;
+allow bluetooth bluetooth_logs_data_file:file create_file_perms;
 
 # Socket creation under /data/misc/bluedroid.
 type_transition bluetooth bluetooth_data_file:sock_file bluetooth_socket;
diff --git a/file.te b/file.te
index 84af4a719..87cec8295 100644
--- a/file.te
+++ b/file.te
@@ -138,6 +138,7 @@ type adb_keys_file, file_type, data_file_type;
 type audio_data_file, file_type, data_file_type;
 type audioserver_data_file, file_type, data_file_type;
 type bluetooth_data_file, file_type, data_file_type;
+type bluetooth_logs_data_file, file_type, data_file_type;
 type bootstat_data_file, file_type, data_file_type;
 type boottrace_data_file, file_type, data_file_type;
 type camera_data_file, file_type, data_file_type;
diff --git a/file_contexts b/file_contexts
index 3448f2152..085a57bb6 100644
--- a/file_contexts
+++ b/file_contexts
@@ -274,6 +274,7 @@
 /data/misc/bootstat(/.*)?       u:object_r:bootstat_data_file:s0
 /data/misc/boottrace(/.*)?      u:object_r:boottrace_data_file:s0
 /data/misc/bluetooth(/.*)?      u:object_r:bluetooth_data_file:s0
+/data/misc/bluetooth/logs(/.*)? u:object_r:bluetooth_logs_data_file:s0
 /data/misc/bluedroid(/.*)?      u:object_r:bluetooth_data_file:s0
 /data/misc/bluedroid/\.a2dp_ctrl u:object_r:bluetooth_socket:s0
 /data/misc/bluedroid/\.a2dp_data u:object_r:bluetooth_socket:s0
-- 
GitLab