From 20b8d6b9a67fdced44773ee2f616ef7c55b2f011 Mon Sep 17 00:00:00 2001
From: Myles Watson <mylesgw@google.com>
Date: Wed, 22 Feb 2017 11:50:20 -0800
Subject: [PATCH] Allow the Bluetooth HAL to toggle rfkill

Bug: 35657600
Test: user build of Marlin starts with BT
Change-Id: Ic2380da66467b9b1c385da7d7fa10fddf4c7fae1
---
 private/hal_bluetooth_default.te | 5 -----
 public/hal_bluetooth.te          | 3 +++
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/private/hal_bluetooth_default.te b/private/hal_bluetooth_default.te
index 4fcb3221d..d22015b72 100644
--- a/private/hal_bluetooth_default.te
+++ b/private/hal_bluetooth_default.te
@@ -4,11 +4,6 @@ hal_server_domain(hal_bluetooth_default, hal_bluetooth)
 type hal_bluetooth_default_exec, exec_type, file_type;
 init_daemon_domain(hal_bluetooth_default)
 
-# VTS tests need to be able to toggle rfkill
-userdebug_or_eng(`
-  allow hal_bluetooth_default self:capability net_admin;
-')
-
 # Logging for backward compatibility
 allow hal_bluetooth_default bluetooth_data_file:dir ra_dir_perms;
 allow hal_bluetooth_default bluetooth_data_file:file create_file_perms;
diff --git a/public/hal_bluetooth.te b/public/hal_bluetooth.te
index 207f718b3..e9679de5c 100644
--- a/public/hal_bluetooth.te
+++ b/public/hal_bluetooth.te
@@ -4,6 +4,9 @@ binder_call(hal_bluetooth_server, hal_bluetooth_client)
 
 wakelock_use(hal_bluetooth);
 
+# The HAL toggles rfkill to power the chip off/on.
+allow hal_bluetooth self:capability net_admin;
+
 # bluetooth factory file accesses.
 r_dir_file(hal_bluetooth, bluetooth_efs_file)
 
-- 
GitLab