diff --git a/core/api/current.txt b/core/api/current.txt index 8a642e67a9ea..6844a904abb0 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -55,6 +55,7 @@ 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_ADVERTISE = "android.permission.BLUETOOTH_ADVERTISE"; 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"; diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index 8e2626a8139b..df9530fee68a 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -1076,6 +1076,8 @@ public class AppOpsManager { 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 */ + public static final int OP_BLUETOOTH_ADVERTISE = AppProtoEnums.APP_OP_BLUETOOTH_ADVERTISE; /** @hide Use the BiometricPrompt/BiometricManager APIs. */ public static final int OP_USE_BIOMETRIC = AppProtoEnums.APP_OP_USE_BIOMETRIC; /** @hide Physical activity recognition. */ @@ -1237,7 +1239,7 @@ public class AppOpsManager { /** @hide */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) - public static final int _NUM_OP = 114; + public static final int _NUM_OP = 115; /** Access to coarse location information. */ public static final String OPSTR_COARSE_LOCATION = "android:coarse_location"; @@ -1483,6 +1485,8 @@ public class AppOpsManager { public static final String OPSTR_BLUETOOTH_SCAN = "android:bluetooth_scan"; /** @hide */ public static final String OPSTR_BLUETOOTH_CONNECT = "android:bluetooth_connect"; + /** @hide */ + public static final String OPSTR_BLUETOOTH_ADVERTISE = "android:bluetooth_advertise"; /** @hide Use the BiometricPrompt/BiometricManager APIs. */ public static final String OPSTR_USE_BIOMETRIC = "android:use_biometric"; @@ -1733,6 +1737,7 @@ public class AppOpsManager { // Nearby devices OP_BLUETOOTH_SCAN, OP_BLUETOOTH_CONNECT, + OP_BLUETOOTH_ADVERTISE, OP_UWB_RANGING, // APPOP PERMISSIONS @@ -1875,7 +1880,8 @@ public class AppOpsManager { OP_MANAGE_MEDIA, // MANAGE_MEDIA OP_BLUETOOTH_CONNECT, // OP_BLUETOOTH_CONNECT OP_UWB_RANGING, // OP_UWB_RANGING - OP_ACTIVITY_RECOGNITION_SOURCE // OP_ACTIVITY_RECOGNITION_SOURCE + OP_ACTIVITY_RECOGNITION_SOURCE, // OP_ACTIVITY_RECOGNITION_SOURCE + OP_BLUETOOTH_ADVERTISE, // OP_BLUETOOTH_ADVERTISE }; /** @@ -1995,7 +2001,8 @@ public class AppOpsManager { OPSTR_MANAGE_MEDIA, OPSTR_BLUETOOTH_CONNECT, OPSTR_UWB_RANGING, - OPSTR_ACTIVITY_RECOGNITION_SOURCE + OPSTR_ACTIVITY_RECOGNITION_SOURCE, + OPSTR_BLUETOOTH_ADVERTISE, }; /** @@ -2116,7 +2123,8 @@ public class AppOpsManager { "MANAGE_MEDIA", "BLUETOOTH_CONNECT", "UWB_RANGING", - "ACTIVITY_RECOGNITION_SOURCE" + "ACTIVITY_RECOGNITION_SOURCE", + "BLUETOOTH_ADVERTISE", }; /** @@ -2239,6 +2247,7 @@ public class AppOpsManager { Manifest.permission.BLUETOOTH_CONNECT, Manifest.permission.UWB_RANGING, null, // no permission for OP_ACTIVITY_RECOGNITION_SOURCE, + Manifest.permission.BLUETOOTH_ADVERTISE, }; /** @@ -2361,6 +2370,7 @@ public class AppOpsManager { null, // BLUETOOTH_CONNECT null, // UWB_RANGING null, // ACTIVITY_RECOGNITION_SOURCE + null, // BLUETOOTH_ADVERTISE }; /** @@ -2481,7 +2491,8 @@ public class AppOpsManager { null, // MANAGE_MEDIA null, // BLUETOOTH_CONNECT null, // UWB_RANGING - null // ACTIVITY_RECOGNITION_SOURCE + null, // ACTIVITY_RECOGNITION_SOURCE + null, // BLUETOOTH_ADVERTISE }; /** @@ -2602,6 +2613,7 @@ public class AppOpsManager { AppOpsManager.MODE_ALLOWED, // BLUETOOTH_CONNECT AppOpsManager.MODE_ALLOWED, // UWB_RANGING AppOpsManager.MODE_ALLOWED, // ACTIVITY_RECOGNITION_SOURCE + AppOpsManager.MODE_ALLOWED, // BLUETOOTH_ADVERTISE }; /** @@ -2726,6 +2738,7 @@ public class AppOpsManager { false, // BLUETOOTH_CONNECT false, // UWB_RANGING false, // ACTIVITY_RECOGNITION_SOURCE + false, // BLUETOOTH_ADVERTISE }; /** diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 58abfeb26e07..7d1ac95657fc 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -1953,7 +1953,15 @@ android:label="@string/permlab_bluetooth_connect" android:protectionLevel="dangerous" /> - + + + connect to paired Bluetooth devices Allows the app to connect to paired Bluetooth devices + + advertise to nearby Bluetooth devices + + Allows the app to advertise to nearby Bluetooth devices determine relative position between nearby Ultra-Wideband devices diff --git a/core/tests/bluetoothtests/AndroidManifest.xml b/core/tests/bluetoothtests/AndroidManifest.xml index f8c69ac17bb0..75583d5298cb 100644 --- a/core/tests/bluetoothtests/AndroidManifest.xml +++ b/core/tests/bluetoothtests/AndroidManifest.xml @@ -20,6 +20,7 @@ + diff --git a/core/tests/coretests/AndroidManifest.xml b/core/tests/coretests/AndroidManifest.xml index 408624a6f1b4..520d2f1e7371 100644 --- a/core/tests/coretests/AndroidManifest.xml +++ b/core/tests/coretests/AndroidManifest.xml @@ -44,6 +44,7 @@ + diff --git a/core/tests/hosttests/test-apps/ExternalLocAllPermsTestApp/AndroidManifest.xml b/core/tests/hosttests/test-apps/ExternalLocAllPermsTestApp/AndroidManifest.xml index b3b34ef93ebe..79beca76b4eb 100644 --- a/core/tests/hosttests/test-apps/ExternalLocAllPermsTestApp/AndroidManifest.xml +++ b/core/tests/hosttests/test-apps/ExternalLocAllPermsTestApp/AndroidManifest.xml @@ -32,6 +32,7 @@ + diff --git a/core/tests/hosttests/test-apps/ExternalSharedPermsBT/AndroidManifest.xml b/core/tests/hosttests/test-apps/ExternalSharedPermsBT/AndroidManifest.xml index 42d94071400d..6d14001643b4 100644 --- a/core/tests/hosttests/test-apps/ExternalSharedPermsBT/AndroidManifest.xml +++ b/core/tests/hosttests/test-apps/ExternalSharedPermsBT/AndroidManifest.xml @@ -22,6 +22,7 @@ + diff --git a/data/etc/platform.xml b/data/etc/platform.xml index 321339073c0b..1c11f9557d81 100644 --- a/data/etc/platform.xml +++ b/data/etc/platform.xml @@ -236,6 +236,10 @@ targetSdk="31"> + + + @@ -244,6 +248,10 @@ targetSdk="31"> + + + diff --git a/media/packages/BluetoothMidiService/AndroidManifest.xml b/media/packages/BluetoothMidiService/AndroidManifest.xml index 3794ccddb48f..03606bac6840 100644 --- a/media/packages/BluetoothMidiService/AndroidManifest.xml +++ b/media/packages/BluetoothMidiService/AndroidManifest.xml @@ -28,6 +28,7 @@ android:required="true"/> + diff --git a/media/tests/ScoAudioTest/AndroidManifest.xml b/media/tests/ScoAudioTest/AndroidManifest.xml index 5af77ee9d35d..ea836e06139f 100644 --- a/media/tests/ScoAudioTest/AndroidManifest.xml +++ b/media/tests/ScoAudioTest/AndroidManifest.xml @@ -23,6 +23,7 @@ + diff --git a/packages/CompanionDeviceManager/AndroidManifest.xml b/packages/CompanionDeviceManager/AndroidManifest.xml index d36836c1af19..c5926a5c75cc 100644 --- a/packages/CompanionDeviceManager/AndroidManifest.xml +++ b/packages/CompanionDeviceManager/AndroidManifest.xml @@ -25,6 +25,7 @@ + diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml index 16937b7d368b..820b180f2c7d 100644 --- a/packages/Shell/AndroidManifest.xml +++ b/packages/Shell/AndroidManifest.xml @@ -49,6 +49,7 @@ + diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index 88d7710e56c6..dc359a766a30 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -62,6 +62,7 @@ + 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 9bc9d9f8e0a3..34003c7f2341 100644 --- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java +++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java @@ -208,6 +208,7 @@ final class DefaultPermissionGrantPolicy { private static final Set NEARBY_DEVICES_PERMISSIONS = new ArraySet<>(); static { + NEARBY_DEVICES_PERMISSIONS.add(Manifest.permission.BLUETOOTH_ADVERTISE); NEARBY_DEVICES_PERMISSIONS.add(Manifest.permission.BLUETOOTH_CONNECT); NEARBY_DEVICES_PERMISSIONS.add(Manifest.permission.BLUETOOTH_SCAN); } diff --git a/services/tests/servicestests/AndroidManifest.xml b/services/tests/servicestests/AndroidManifest.xml index d1cd7cd526d1..bcb2cf8fa0c3 100644 --- a/services/tests/servicestests/AndroidManifest.xml +++ b/services/tests/servicestests/AndroidManifest.xml @@ -76,6 +76,7 @@ + diff --git a/tests/UsesFeature2Test/AndroidManifest.xml b/tests/UsesFeature2Test/AndroidManifest.xml index 1f1a90958298..a0ea45adae19 100644 --- a/tests/UsesFeature2Test/AndroidManifest.xml +++ b/tests/UsesFeature2Test/AndroidManifest.xml @@ -23,6 +23,7 @@ +