summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorAdrian Roos <roosa@google.com>2014-08-18 15:31:57 +0200
committerAdrian Roos <roosa@google.com>2014-08-18 16:28:45 +0200
commitbd9a9a53ed09ca355eb0911d2aeee526b964aa7b (patch)
treebc116dbde32b01441f03684305a8b0e3a602ac5e /services
parent9a888b9be1085200ebd16a5aa0ff761e5a0a739f (diff)
downloadframeworks_base-bd9a9a53ed09ca355eb0911d2aeee526b964aa7b.zip
frameworks_base-bd9a9a53ed09ca355eb0911d2aeee526b964aa7b.tar.gz
frameworks_base-bd9a9a53ed09ca355eb0911d2aeee526b964aa7b.tar.bz2
Allow SystemUI to control Bluetooth for secondary users
Bug: 15818610 Change-Id: I9eaeaffc73f7675957ed3cd6a896ea83a79d6cff
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/BluetoothManagerService.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index 07c9048..7b64139 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -121,6 +121,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
private int mState;
private final BluetoothHandler mHandler;
private int mErrorRecoveryRetryCounter;
+ private final int mSystemUiUid;
private void registerForAirplaneMode(IntentFilter filter) {
final ContentResolver resolver = mContext.getContentResolver();
@@ -218,6 +219,15 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
if (isBluetoothPersistedStateOn()) {
mEnableExternal = true;
}
+
+ int sysUiUid = -1;
+ try {
+ sysUiUid = mContext.getPackageManager().getPackageUid("com.android.systemui",
+ UserHandle.USER_OWNER);
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.wtf(TAG, "Unable to resolve SystemUI's UID.", e);
+ }
+ mSystemUiUid = sysUiUid;
}
/**
@@ -1118,7 +1128,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
try {
foregroundUser = ActivityManager.getCurrentUser();
valid = (callingUser == foregroundUser) ||
- callingAppId == Process.NFC_UID;
+ callingAppId == Process.NFC_UID ||
+ callingAppId == mSystemUiUid;
if (DBG) {
Log.d(TAG, "checkIfCallerIsForegroundUser: valid=" + valid
+ " callingUser=" + callingUser