diff options
author | 2021-03-23 12:56:30 +0000 | |
---|---|---|
committer | 2021-03-23 12:56:30 +0000 | |
commit | 9f5392e8b7496d6248196e4da99b21c288925f02 (patch) | |
tree | 894135c4544fd184f731166107c4ac6304c68714 | |
parent | 68d118e3c6b94ebead5b0caa6d053e7c002e11d8 (diff) | |
parent | 7b14b87647323371a8f29d38accbcd8fc2373331 (diff) |
Merge changes from topic "nearby-bluetooth-permission-group" into sc-dev
* changes:
Request new Bluetooth runtime permissions.
Default grants for "Nearby devices" permission.
Add BLUETOOTH_SCAN and BLUETOOTH_CONNECT app ops
Split new NEARBY_DEVICES permissions
Define new NEARBY_DEVICES permission group
-rw-r--r-- | core/api/current.txt | 3 | ||||
-rw-r--r-- | core/java/android/app/AppOpsManager.java | 21 | ||||
-rw-r--r-- | core/res/AndroidManifest.xml | 24 | ||||
-rw-r--r-- | core/res/res/values/strings.xml | 13 | ||||
-rw-r--r-- | core/tests/bluetoothtests/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | core/tests/coretests/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | core/tests/hosttests/test-apps/ExternalLocAllPermsTestApp/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | core/tests/hosttests/test-apps/ExternalSharedPermsBT/AndroidManifest.xml | 3 | ||||
-rw-r--r-- | data/etc/platform.xml | 17 | ||||
-rw-r--r-- | media/packages/BluetoothMidiService/AndroidManifest.xml | 3 | ||||
-rw-r--r-- | media/tests/ScoAudioTest/AndroidManifest.xml | 3 | ||||
-rw-r--r-- | packages/CompanionDeviceManager/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | packages/Shell/AndroidManifest.xml | 3 | ||||
-rw-r--r-- | packages/SystemUI/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java | 13 | ||||
-rw-r--r-- | services/tests/servicestests/AndroidManifest.xml | 3 | ||||
-rw-r--r-- | tests/UsesFeature2Test/AndroidManifest.xml | 3 |
17 files changed, 112 insertions, 7 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 0f00b540fc09..bc74372d4638 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -55,7 +55,9 @@ package android { field public static final String BIND_WALLPAPER = "android.permission.BIND_WALLPAPER"; field public static final String BLUETOOTH = "android.permission.BLUETOOTH"; field public static final String BLUETOOTH_ADMIN = "android.permission.BLUETOOTH_ADMIN"; + field public static final String BLUETOOTH_CONNECT = "android.permission.BLUETOOTH_CONNECT"; field public static final String BLUETOOTH_PRIVILEGED = "android.permission.BLUETOOTH_PRIVILEGED"; + field public static final String BLUETOOTH_SCAN = "android.permission.BLUETOOTH_SCAN"; field public static final String BODY_SENSORS = "android.permission.BODY_SENSORS"; field public static final String BROADCAST_PACKAGE_REMOVED = "android.permission.BROADCAST_PACKAGE_REMOVED"; field public static final String BROADCAST_SMS = "android.permission.BROADCAST_SMS"; @@ -194,6 +196,7 @@ package android { field public static final String CONTACTS = "android.permission-group.CONTACTS"; field public static final String LOCATION = "android.permission-group.LOCATION"; field public static final String MICROPHONE = "android.permission-group.MICROPHONE"; + field public static final String NEARBY_DEVICES = "android.permission-group.NEARBY_DEVICES"; field public static final String PHONE = "android.permission-group.PHONE"; field public static final String SENSORS = "android.permission-group.SENSORS"; field public static final String SMS = "android.permission-group.SMS"; diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index 27b19bcd31a1..a6aa28effe00 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -1073,6 +1073,8 @@ public class AppOpsManager { /** @hide */ @UnsupportedAppUsage public static final int OP_BLUETOOTH_SCAN = AppProtoEnums.APP_OP_BLUETOOTH_SCAN; + /** @hide */ + public static final int OP_BLUETOOTH_CONNECT = AppProtoEnums.APP_OP_BLUETOOTH_CONNECT; /** @hide Use the BiometricPrompt/BiometricManager APIs. */ public static final int OP_USE_BIOMETRIC = AppProtoEnums.APP_OP_USE_BIOMETRIC; /** @hide Physical activity recognition. */ @@ -1221,7 +1223,7 @@ public class AppOpsManager { /** @hide */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) - public static final int _NUM_OP = 111; + public static final int _NUM_OP = 112; /** Access to coarse location information. */ public static final String OPSTR_COARSE_LOCATION = "android:coarse_location"; @@ -1465,6 +1467,8 @@ public class AppOpsManager { public static final String OPSTR_START_FOREGROUND = "android:start_foreground"; /** @hide */ public static final String OPSTR_BLUETOOTH_SCAN = "android:bluetooth_scan"; + /** @hide */ + public static final String OPSTR_BLUETOOTH_CONNECT = "android:bluetooth_connect"; /** @hide Use the BiometricPrompt/BiometricManager APIs. */ public static final String OPSTR_USE_BIOMETRIC = "android:use_biometric"; @@ -1696,6 +1700,9 @@ public class AppOpsManager { OP_WRITE_MEDIA_VIDEO, OP_READ_MEDIA_IMAGES, OP_WRITE_MEDIA_IMAGES, + // Nearby devices + OP_BLUETOOTH_SCAN, + OP_BLUETOOTH_CONNECT, // APPOP PERMISSIONS OP_ACCESS_NOTIFICATIONS, @@ -1801,7 +1808,7 @@ public class AppOpsManager { OP_ACCEPT_HANDOVER, // ACCEPT_HANDOVER OP_MANAGE_IPSEC_TUNNELS, // MANAGE_IPSEC_HANDOVERS OP_START_FOREGROUND, // START_FOREGROUND - OP_COARSE_LOCATION, // BLUETOOTH_SCAN + OP_BLUETOOTH_SCAN, // BLUETOOTH_SCAN OP_USE_BIOMETRIC, // BIOMETRIC OP_ACTIVITY_RECOGNITION, // ACTIVITY_RECOGNITION OP_SMS_FINANCIAL_TRANSACTIONS, // SMS_FINANCIAL_TRANSACTIONS @@ -1835,6 +1842,7 @@ public class AppOpsManager { OP_FINE_LOCATION, // OP_FINE_LOCATION_SOURCE OP_COARSE_LOCATION, // OP_COARSE_LOCATION_SOURCE OP_MANAGE_MEDIA, // MANAGE_MEDIA + OP_BLUETOOTH_CONNECT, // OP_BLUETOOTH_CONNECT }; /** @@ -1952,6 +1960,7 @@ public class AppOpsManager { OPSTR_FINE_LOCATION_SOURCE, OPSTR_COARSE_LOCATION_SOURCE, OPSTR_MANAGE_MEDIA, + OPSTR_BLUETOOTH_CONNECT, }; /** @@ -2070,6 +2079,7 @@ public class AppOpsManager { "FINE_LOCATION_SOURCE", "COARSE_LOCATION_SOURCE", "MANAGE_MEDIA", + "BLUETOOTH_CONNECT", }; /** @@ -2155,7 +2165,7 @@ public class AppOpsManager { Manifest.permission.ACCEPT_HANDOVER, Manifest.permission.MANAGE_IPSEC_TUNNELS, Manifest.permission.FOREGROUND_SERVICE, - null, // no permission for OP_BLUETOOTH_SCAN + Manifest.permission.BLUETOOTH_SCAN, Manifest.permission.USE_BIOMETRIC, Manifest.permission.ACTIVITY_RECOGNITION, Manifest.permission.SMS_FINANCIAL_TRANSACTIONS, @@ -2189,6 +2199,7 @@ public class AppOpsManager { null, // no permission for OP_ACCESS_FINE_LOCATION_SOURCE, null, // no permission for OP_ACCESS_COARSE_LOCATION_SOURCE, Manifest.permission.MANAGE_MEDIA, + Manifest.permission.BLUETOOTH_CONNECT, }; /** @@ -2308,6 +2319,7 @@ public class AppOpsManager { null, // ACCESS_FINE_LOCATION_SOURCE null, // ACCESS_COARSE_LOCATION_SOURCE null, // MANAGE_MEDIA + null, // BLUETOOTH_CONNECT }; /** @@ -2426,6 +2438,7 @@ public class AppOpsManager { null, // ACCESS_FINE_LOCATION_SOURCE null, // ACCESS_COARSE_LOCATION_SOURCE null, // MANAGE_MEDIA + null, // BLUETOOTH_CONNECT }; /** @@ -2543,6 +2556,7 @@ public class AppOpsManager { AppOpsManager.MODE_ALLOWED, // ACCESS_FINE_LOCATION_SOURCE AppOpsManager.MODE_ALLOWED, // ACCESS_COARSE_LOCATION_SOURCE AppOpsManager.MODE_DEFAULT, // MANAGE_MEDIA + AppOpsManager.MODE_ALLOWED, // BLUETOOTH_CONNECT }; /** @@ -2664,6 +2678,7 @@ public class AppOpsManager { false, // ACCESS_FINE_LOCATION_SOURCE false, // ACCESS_COARSE_LOCATION_SOURCE false, // MANAGE_MEDIA + false, // BLUETOOTH_CONNECT }; /** diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 8d7f5425ea62..4157af8cec99 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -1388,6 +1388,14 @@ android:backgroundPermission="android.permission.BACKGROUND_CAMERA" android:protectionLevel="dangerous|instant" /> + <!-- Required to be able to discover and connect to nearby Bluetooth devices. + <p>Protection level: dangerous --> + <permission-group android:name="android.permission-group.NEARBY_DEVICES" + android:icon="@drawable/ic_qs_bluetooth" + android:label="@string/permgrouplab_nearby_devices" + android:description="@string/permgroupdesc_nearby_devices" + android:priority="750" /> + <!-- @SystemApi @TestApi Required to be able to access the camera device in the background. This permission is not intended to be held by apps. <p>Protection level: internal @@ -1930,6 +1938,22 @@ android:label="@string/permlab_bluetooth" android:protectionLevel="normal" /> + <!-- Required to be able to discover and pair nearby Bluetooth devices. + <p>Protection level: dangerous --> + <permission android:name="android.permission.BLUETOOTH_SCAN" + android:permissionGroup="android.permission-group.UNDEFINED" + android:description="@string/permdesc_bluetooth_scan" + android:label="@string/permlab_bluetooth_scan" + android:protectionLevel="dangerous" /> + + <!-- Required to be able to connect to paired Bluetooth devices. + <p>Protection level: dangerous --> + <permission android:name="android.permission.BLUETOOTH_CONNECT" + android:permissionGroup="android.permission-group.UNDEFINED" + android:description="@string/permdesc_bluetooth_connect" + android:label="@string/permlab_bluetooth_connect" + android:protectionLevel="dangerous" /> + <!-- @SystemApi @TestApi Allows an application to suspend other apps, which will prevent the user from using them until they are unsuspended. @hide diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 7ea762c2fbbb..0b3c4052e204 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -822,6 +822,11 @@ <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. --> <string name="permgroupdesc_camera">take pictures and record video</string> + <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=40]--> + <string name="permgrouplab_nearby_devices">Nearby Bluetooth Devices</string> + <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=NONE]--> + <string name="permgroupdesc_nearby_devices">discover and connect to nearby Bluetooth devices</string> + <!-- Title of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. --> <string name="permgrouplab_calllog">Call logs</string> <!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. --> @@ -1471,6 +1476,14 @@ <string name="permdesc_bluetooth" product="default">Allows the app to view the configuration of the Bluetooth on the phone, and to make and accept connections with paired devices.</string> + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=50]--> + <string name="permlab_bluetooth_scan">discover and pair nearby Bluetooth devices</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=120]--> + <string name="permdesc_bluetooth_scan" product="default">Allows the app to discover and pair nearby Bluetooth devices</string> + <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=50]--> + <string name="permlab_bluetooth_connect">connect to paired Bluetooth devices</string> + <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=120]--> + <string name="permdesc_bluetooth_connect" product="default">Allows the app to connect to paired Bluetooth devices</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_preferredPaymentInfo">Preferred NFC Payment Service Information</string> diff --git a/core/tests/bluetoothtests/AndroidManifest.xml b/core/tests/bluetoothtests/AndroidManifest.xml index 6849a90f5010..f8c69ac17bb0 100644 --- a/core/tests/bluetoothtests/AndroidManifest.xml +++ b/core/tests/bluetoothtests/AndroidManifest.xml @@ -20,6 +20,8 @@ <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> + <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> + <uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" /> <uses-permission android:name="android.permission.BROADCAST_STICKY" /> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> diff --git a/core/tests/coretests/AndroidManifest.xml b/core/tests/coretests/AndroidManifest.xml index f31233b29cd0..408624a6f1b4 100644 --- a/core/tests/coretests/AndroidManifest.xml +++ b/core/tests/coretests/AndroidManifest.xml @@ -44,6 +44,8 @@ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> + <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> + <uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.BROADCAST_STICKY" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> diff --git a/core/tests/hosttests/test-apps/ExternalLocAllPermsTestApp/AndroidManifest.xml b/core/tests/hosttests/test-apps/ExternalLocAllPermsTestApp/AndroidManifest.xml index 0898faeb7080..b3b34ef93ebe 100644 --- a/core/tests/hosttests/test-apps/ExternalLocAllPermsTestApp/AndroidManifest.xml +++ b/core/tests/hosttests/test-apps/ExternalLocAllPermsTestApp/AndroidManifest.xml @@ -32,6 +32,8 @@ <uses-permission android:name="android.permission.BIND_INPUT_METHOD" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> + <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> + <uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <uses-permission android:name="android.permission.BRICK" /> <uses-permission android:name="android.permission.BROADCAST_PACKAGE_REMOVED" /> <uses-permission android:name="android.permission.BROADCAST_SMS" /> diff --git a/core/tests/hosttests/test-apps/ExternalSharedPermsBT/AndroidManifest.xml b/core/tests/hosttests/test-apps/ExternalSharedPermsBT/AndroidManifest.xml index 98f7177992e2..42d94071400d 100644 --- a/core/tests/hosttests/test-apps/ExternalSharedPermsBT/AndroidManifest.xml +++ b/core/tests/hosttests/test-apps/ExternalSharedPermsBT/AndroidManifest.xml @@ -21,6 +21,9 @@ android:sharedUserId="com.android.framework.externalsharedpermstestapp"> <uses-permission android:name="android.permission.BLUETOOTH" /> + <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> + <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> + <uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <application> <uses-library android:name="android.test.runner" /> diff --git a/data/etc/platform.xml b/data/etc/platform.xml index 27bf4ef4c84d..8da4a37e44cd 100644 --- a/data/etc/platform.xml +++ b/data/etc/platform.xml @@ -224,7 +224,22 @@ targetSdk="29"> <new-permission name="android.permission.ACCESS_MEDIA_LOCATION" /> </split-permission> - + <split-permission name="android.permission.BLUETOOTH" + targetSdk="31"> + <new-permission name="android.permission.BLUETOOTH_SCAN" /> + </split-permission> + <split-permission name="android.permission.BLUETOOTH" + targetSdk="31"> + <new-permission name="android.permission.BLUETOOTH_CONNECT" /> + </split-permission> + <split-permission name="android.permission.BLUETOOTH_ADMIN" + targetSdk="31"> + <new-permission name="android.permission.BLUETOOTH_SCAN" /> + </split-permission> + <split-permission name="android.permission.BLUETOOTH_ADMIN" + targetSdk="31"> + <new-permission name="android.permission.BLUETOOTH_CONNECT" /> + </split-permission> <!-- This is a list of all the libraries available for application code to link against. --> diff --git a/media/packages/BluetoothMidiService/AndroidManifest.xml b/media/packages/BluetoothMidiService/AndroidManifest.xml index fc96fd926e2d..3794ccddb48f 100644 --- a/media/packages/BluetoothMidiService/AndroidManifest.xml +++ b/media/packages/BluetoothMidiService/AndroidManifest.xml @@ -27,6 +27,9 @@ <uses-feature android:name="android.software.midi" android:required="true"/> <uses-permission android:name="android.permission.BLUETOOTH"/> + <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> + <uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/> + <uses-permission android:name="android.permission.BLUETOOTH_SCAN"/> <application tools:replace="android:label" diff --git a/media/tests/ScoAudioTest/AndroidManifest.xml b/media/tests/ScoAudioTest/AndroidManifest.xml index a0fba733370e..5af77ee9d35d 100644 --- a/media/tests/ScoAudioTest/AndroidManifest.xml +++ b/media/tests/ScoAudioTest/AndroidManifest.xml @@ -22,6 +22,9 @@ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.BROADCAST_STICKY"/> <uses-permission android:name="android.permission.BLUETOOTH"/> + <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> + <uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/> + <uses-permission android:name="android.permission.BLUETOOTH_SCAN"/> <application> <activity android:label="@string/app_name" diff --git a/packages/CompanionDeviceManager/AndroidManifest.xml b/packages/CompanionDeviceManager/AndroidManifest.xml index f9795c601431..d36836c1af19 100644 --- a/packages/CompanionDeviceManager/AndroidManifest.xml +++ b/packages/CompanionDeviceManager/AndroidManifest.xml @@ -25,6 +25,8 @@ <uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> + <uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/> + <uses-permission android:name="android.permission.BLUETOOTH_SCAN"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml index 2b4fef0c9ba7..90f77e737036 100644 --- a/packages/Shell/AndroidManifest.xml +++ b/packages/Shell/AndroidManifest.xml @@ -45,6 +45,9 @@ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.BLUETOOTH" /> + <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> + <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> + <uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <uses-permission android:name="android.permission.LOCAL_MAC_ADDRESS" /> <uses-permission android:name="android.permission.EXPAND_STATUS_BAR" /> <uses-permission android:name="android.permission.DISABLE_KEYGUARD" /> diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index 3904201d2ee8..4135bbe3e86d 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -62,6 +62,8 @@ <!-- Networking and telephony --> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> + <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> + <uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java index 27bf8a13766a..f0d54b4c0617 100644 --- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java +++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java @@ -206,6 +206,12 @@ final class DefaultPermissionGrantPolicy { STORAGE_PERMISSIONS.add(Manifest.permission.ACCESS_MEDIA_LOCATION); } + private static final Set<String> NEARBY_DEVICES_PERMISSIONS = new ArraySet<>(); + static { + NEARBY_DEVICES_PERMISSIONS.add(Manifest.permission.BLUETOOTH_CONNECT); + NEARBY_DEVICES_PERMISSIONS.add(Manifest.permission.BLUETOOTH_SCAN); + } + private static final int MSG_READ_DEFAULT_PERMISSION_EXCEPTIONS = 1; private static final String ACTION_TRACK = "com.android.fitness.TRACK"; @@ -733,14 +739,15 @@ final class DefaultPermissionGrantPolicy { PHONE_PERMISSIONS, SMS_PERMISSIONS, CAMERA_PERMISSIONS, SENSORS_PERMISSIONS, STORAGE_PERMISSIONS); grantSystemFixedPermissionsToSystemPackage(pm, packageName, userId, - ALWAYS_LOCATION_PERMISSIONS, ACTIVITY_RECOGNITION_PERMISSIONS); + ALWAYS_LOCATION_PERMISSIONS, NEARBY_DEVICES_PERMISSIONS, + ACTIVITY_RECOGNITION_PERMISSIONS); } } if (locationExtraPackageNames != null) { // Also grant location and activity recognition permission to location extra packages. for (String packageName : locationExtraPackageNames) { grantPermissionsToSystemPackage(pm, packageName, userId, - ALWAYS_LOCATION_PERMISSIONS); + ALWAYS_LOCATION_PERMISSIONS, NEARBY_DEVICES_PERMISSIONS); grantSystemFixedPermissionsToSystemPackage(pm, packageName, userId, ACTIVITY_RECOGNITION_PERMISSIONS); } @@ -809,7 +816,7 @@ final class DefaultPermissionGrantPolicy { // Companion devices grantSystemFixedPermissionsToSystemPackage(pm, CompanionDeviceManager.COMPANION_DEVICE_DISCOVERY_PACKAGE_NAME, userId, - ALWAYS_LOCATION_PERMISSIONS); + ALWAYS_LOCATION_PERMISSIONS, NEARBY_DEVICES_PERMISSIONS); // Ringtone Picker grantSystemFixedPermissionsToSystemPackage(pm, diff --git a/services/tests/servicestests/AndroidManifest.xml b/services/tests/servicestests/AndroidManifest.xml index b9aa554aa0ac..5761958ea89d 100644 --- a/services/tests/servicestests/AndroidManifest.xml +++ b/services/tests/servicestests/AndroidManifest.xml @@ -74,6 +74,9 @@ <uses-permission android:name="android.permission.WRITE_DEVICE_CONFIG"/> <uses-permission android:name="android.permission.HARDWARE_TEST"/> <uses-permission android:name="android.permission.BLUETOOTH"/> + <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/> + <uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/> + <uses-permission android:name="android.permission.BLUETOOTH_SCAN"/> <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/> <uses-permission android:name="android.permission.DUMP"/> <uses-permission android:name="android.permission.READ_DREAM_STATE"/> diff --git a/tests/UsesFeature2Test/AndroidManifest.xml b/tests/UsesFeature2Test/AndroidManifest.xml index 8caf4a158867..1f1a90958298 100644 --- a/tests/UsesFeature2Test/AndroidManifest.xml +++ b/tests/UsesFeature2Test/AndroidManifest.xml @@ -22,6 +22,9 @@ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.BLUETOOTH" /> + <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> + <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> + <uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <uses-feature android:name="android.hardware.sensor.accelerometer" /> <feature-group android:label="@string/minimal"> |