diff options
| -rw-r--r-- | services/core/java/com/android/server/BluetoothManagerService.java | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java index 7f42d1c030e1..2682cd156af5 100644 --- a/services/core/java/com/android/server/BluetoothManagerService.java +++ b/services/core/java/com/android/server/BluetoothManagerService.java @@ -685,9 +685,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub { mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission"); - if (!isEnabled() && mPermissionReviewRequired - && startConsentUiIfNeeded(packageName, callingUid, - BluetoothAdapter.ACTION_REQUEST_ENABLE)) { + if (!isEnabled() && mPermissionReviewRequired) { + startConsentUi(packageName, callingUid, BluetoothAdapter.ACTION_REQUEST_ENABLE); return false; } } @@ -721,9 +720,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub { mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission"); - if (isEnabled() && mPermissionReviewRequired - && startConsentUiIfNeeded(packageName, callingUid, - BluetoothAdapter.ACTION_REQUEST_DISABLE)) { + if (isEnabled() && mPermissionReviewRequired) { + startConsentUi(packageName, callingUid, BluetoothAdapter.ACTION_REQUEST_DISABLE); return false; } } @@ -743,8 +741,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub { return true; } - private boolean startConsentUiIfNeeded(String packageName, - int callingUid, String intentAction) throws RemoteException { + private void startConsentUi(String packageName, int callingUid, String intentAction) + throws RemoteException { try { // Validate the package only if we are going to use it ApplicationInfo applicationInfo = mContext.getPackageManager() @@ -756,16 +754,12 @@ class BluetoothManagerService extends IBluetoothManager.Stub { + " not in uid " + callingUid); } - // Legacy apps in permission review mode trigger a user prompt - if (applicationInfo.targetSdkVersion < Build.VERSION_CODES.M) { - Intent intent = new Intent(intentAction); - mContext.startActivity(intent); - return true; - } + // Permission review mode, trigger a user prompt + Intent intent = new Intent(intentAction); + mContext.startActivity(intent); } catch (PackageManager.NameNotFoundException e) { throw new RemoteException(e.getMessage()); } - return false; } public void unbindAndFinish() { |