Loading core/res/AndroidManifest.xml +11 −0 Original line number Diff line number Diff line Loading @@ -1412,6 +1412,12 @@ <permission android:name="android.permission.MANAGE_LOWPAN_INTERFACES" android:protectionLevel="signature|privileged" /> <!-- @hide Allows internal management of Wi-Fi connectivity state when on permission review mode. <p>Not for use by third-party applications. --> <permission android:name="android.permission.MANAGE_WIFI_WHEN_PERMISSION_REVIEW_REQUIRED" android:protectionLevel="signature" /> <!-- ======================================= --> <!-- Permissions for short range, peripheral networks --> <!-- ======================================= --> Loading Loading @@ -1495,6 +1501,11 @@ <permission android:name="android.permission.NFC_HANDOVER_STATUS" android:protectionLevel="signature|privileged" /> <!-- @hide Allows internal management of Bluetooth state when on permission review mode. <p>Not for use by third-party applications. --> <permission android:name="android.permission.MANAGE_BLUETOOTH_WHEN_PERMISSION_REVIEW_REQUIRED" android:protectionLevel="signature" /> <!-- ================================== --> <!-- Permissions for accessing accounts --> <!-- ================================== --> Loading packages/Shell/AndroidManifest.xml +5 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,11 @@ <uses-permission android:name="android.permission.MANAGE_SENSORS" /> <uses-permission android:name="android.permission.MANAGE_AUDIO_POLICY" /> <uses-permission android:name="android.permission.MANAGE_CAMERA" /> <!-- Permission needed to enable/disable Bluetooth/Wifi when on permission review mode --> <uses-permission android:name="android.permission.MANAGE_BLUETOOTH_WHEN_PERMISSION_REVIEW_REQUIRED" /> <uses-permission android:name="android.permission.MANAGE_WIFI_WHEN_PERMISSION_REVIEW_REQUIRED" /> <application android:label="@string/app_label" android:defaultToDeviceProtectedStorage="true" Loading services/core/java/com/android/server/BluetoothManagerService.java +27 −3 Original line number Diff line number Diff line Loading @@ -948,8 +948,11 @@ class BluetoothManagerService extends IBluetoothManager.Stub { return true; } private boolean startConsentUiIfNeeded(String packageName, int callingUid, String intentAction) throws RemoteException { private boolean startConsentUiIfNeeded(String packageName, int callingUid, String intentAction) throws RemoteException { if (checkBluetoothPermissionWhenPermissionReviewRequired()) { return false; } try { // Validate the package only if we are going to use it ApplicationInfo applicationInfo = mContext.getPackageManager() Loading @@ -957,7 +960,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub { PackageManager.MATCH_DEBUG_TRIAGED_MISSING, UserHandle.getUserId(callingUid)); if (applicationInfo.uid != callingUid) { throw new SecurityException("Package " + callingUid + " not in uid " + callingUid); throw new SecurityException("Package " + packageName + " not in uid " + callingUid); } Intent intent = new Intent(intentAction); Loading @@ -977,6 +981,26 @@ class BluetoothManagerService extends IBluetoothManager.Stub { } } /** * Check if the caller must still pass permission check or if the caller is exempted * from the consent UI via the MANAGE_BLUETOOTH_WHEN_PERMISSION_REVIEW_REQUIRED check. * * Commands from some callers may be exempted from triggering the consent UI when * enabling bluetooth. This exemption is checked via the * MANAGE_BLUETOOTH_WHEN_PERMISSION_REVIEW_REQUIRED and allows calls to skip * the consent UI where it may otherwise be required. * * @hide */ private boolean checkBluetoothPermissionWhenPermissionReviewRequired() { if (!mPermissionReviewRequired) { return false; } int result = mContext.checkCallingPermission( android.Manifest.permission.MANAGE_BLUETOOTH_WHEN_PERMISSION_REVIEW_REQUIRED); return result == PackageManager.PERMISSION_GRANTED; } public void unbindAndFinish() { if (DBG) { Slog.d(TAG, "unbindAndFinish(): " + mBluetooth + " mBinding = " + mBinding Loading Loading
core/res/AndroidManifest.xml +11 −0 Original line number Diff line number Diff line Loading @@ -1412,6 +1412,12 @@ <permission android:name="android.permission.MANAGE_LOWPAN_INTERFACES" android:protectionLevel="signature|privileged" /> <!-- @hide Allows internal management of Wi-Fi connectivity state when on permission review mode. <p>Not for use by third-party applications. --> <permission android:name="android.permission.MANAGE_WIFI_WHEN_PERMISSION_REVIEW_REQUIRED" android:protectionLevel="signature" /> <!-- ======================================= --> <!-- Permissions for short range, peripheral networks --> <!-- ======================================= --> Loading Loading @@ -1495,6 +1501,11 @@ <permission android:name="android.permission.NFC_HANDOVER_STATUS" android:protectionLevel="signature|privileged" /> <!-- @hide Allows internal management of Bluetooth state when on permission review mode. <p>Not for use by third-party applications. --> <permission android:name="android.permission.MANAGE_BLUETOOTH_WHEN_PERMISSION_REVIEW_REQUIRED" android:protectionLevel="signature" /> <!-- ================================== --> <!-- Permissions for accessing accounts --> <!-- ================================== --> Loading
packages/Shell/AndroidManifest.xml +5 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,11 @@ <uses-permission android:name="android.permission.MANAGE_SENSORS" /> <uses-permission android:name="android.permission.MANAGE_AUDIO_POLICY" /> <uses-permission android:name="android.permission.MANAGE_CAMERA" /> <!-- Permission needed to enable/disable Bluetooth/Wifi when on permission review mode --> <uses-permission android:name="android.permission.MANAGE_BLUETOOTH_WHEN_PERMISSION_REVIEW_REQUIRED" /> <uses-permission android:name="android.permission.MANAGE_WIFI_WHEN_PERMISSION_REVIEW_REQUIRED" /> <application android:label="@string/app_label" android:defaultToDeviceProtectedStorage="true" Loading
services/core/java/com/android/server/BluetoothManagerService.java +27 −3 Original line number Diff line number Diff line Loading @@ -948,8 +948,11 @@ class BluetoothManagerService extends IBluetoothManager.Stub { return true; } private boolean startConsentUiIfNeeded(String packageName, int callingUid, String intentAction) throws RemoteException { private boolean startConsentUiIfNeeded(String packageName, int callingUid, String intentAction) throws RemoteException { if (checkBluetoothPermissionWhenPermissionReviewRequired()) { return false; } try { // Validate the package only if we are going to use it ApplicationInfo applicationInfo = mContext.getPackageManager() Loading @@ -957,7 +960,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub { PackageManager.MATCH_DEBUG_TRIAGED_MISSING, UserHandle.getUserId(callingUid)); if (applicationInfo.uid != callingUid) { throw new SecurityException("Package " + callingUid + " not in uid " + callingUid); throw new SecurityException("Package " + packageName + " not in uid " + callingUid); } Intent intent = new Intent(intentAction); Loading @@ -977,6 +981,26 @@ class BluetoothManagerService extends IBluetoothManager.Stub { } } /** * Check if the caller must still pass permission check or if the caller is exempted * from the consent UI via the MANAGE_BLUETOOTH_WHEN_PERMISSION_REVIEW_REQUIRED check. * * Commands from some callers may be exempted from triggering the consent UI when * enabling bluetooth. This exemption is checked via the * MANAGE_BLUETOOTH_WHEN_PERMISSION_REVIEW_REQUIRED and allows calls to skip * the consent UI where it may otherwise be required. * * @hide */ private boolean checkBluetoothPermissionWhenPermissionReviewRequired() { if (!mPermissionReviewRequired) { return false; } int result = mContext.checkCallingPermission( android.Manifest.permission.MANAGE_BLUETOOTH_WHEN_PERMISSION_REVIEW_REQUIRED); return result == PackageManager.PERMISSION_GRANTED; } public void unbindAndFinish() { if (DBG) { Slog.d(TAG, "unbindAndFinish(): " + mBluetooth + " mBinding = " + mBinding Loading