From 5a24bb9f91b8868379f25cd38063f2f86d986432 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Thu, 1 Apr 2021 09:18:35 -0700 Subject: [PATCH 1/2] Add a new uwb ranging runtime permission This will be part of the nearby devices permission group. Bug: 183904955 Test: Compiles Change-Id: I83ce43a893cef699b2c40918998cf9c6d3131507 --- core/api/current.txt | 1 + core/res/AndroidManifest.xml | 8 ++++++++ core/res/res/values/strings.xml | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/core/api/current.txt b/core/api/current.txt index 10851e881246f..0d4999db89a32 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -174,6 +174,7 @@ package android { field public static final String USE_FULL_SCREEN_INTENT = "android.permission.USE_FULL_SCREEN_INTENT"; field public static final String USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER = "android.permission.USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER"; field public static final String USE_SIP = "android.permission.USE_SIP"; + field public static final String UWB_RANGING = "android.permission.UWB_RANGING"; field public static final String VIBRATE = "android.permission.VIBRATE"; field public static final String WAKE_LOCK = "android.permission.WAKE_LOCK"; field public static final String WRITE_APN_SETTINGS = "android.permission.WRITE_APN_SETTINGS"; diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index fc264f313d709..333c8f0be226a 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -1955,6 +1955,14 @@ android:label="@string/permlab_bluetooth_connect" android:protectionLevel="dangerous" /> + + + Allows the app to connect to paired Bluetooth devices + + range to devices using ultra-wideband + + Allows the app to range to devices using ultra-wideband + Preferred NFC Payment Service Information From f5b1cf217eaa3f97a9257be6e348d5d63a21fd9a Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Thu, 1 Apr 2021 09:30:00 -0700 Subject: [PATCH 2/2] Add a new uwb ranging app-ops This will be part of the nearby devices permission group. Bug: 183904955 Test: Compiles Change-Id: I8d225f6b9f40cc106aeb5ad661282cd394d7b826 --- core/java/android/app/AppOpsManager.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index 6ce0b22836039..5a35bbed3fa4f 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -1222,9 +1222,12 @@ public class AppOpsManager { */ public static final int OP_MANAGE_MEDIA = AppProtoEnums.APP_OP_MANAGE_MEDIA; + /** @hide */ + public static final int OP_UWB_RANGING = AppProtoEnums.APP_OP_UWB_RANGING; + /** @hide */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) - public static final int _NUM_OP = 112; + public static final int _NUM_OP = 113; /** Access to coarse location information. */ public static final String OPSTR_COARSE_LOCATION = "android:coarse_location"; @@ -1637,6 +1640,8 @@ public class AppOpsManager { * @hide */ public static final String OPSTR_MANAGE_MEDIA = "android:manage_media"; + /** @hide */ + public static final String OPSTR_UWB_RANGING = "android:uwb_ranging"; /** {@link #sAppOpsToNote} not initialized yet for this op */ private static final byte SHOULD_COLLECT_NOTE_OP_NOT_INITIALIZED = 0; @@ -1706,6 +1711,7 @@ public class AppOpsManager { // Nearby devices OP_BLUETOOTH_SCAN, OP_BLUETOOTH_CONNECT, + OP_UWB_RANGING, // APPOP PERMISSIONS OP_ACCESS_NOTIFICATIONS, @@ -1846,6 +1852,7 @@ public class AppOpsManager { OP_COARSE_LOCATION, // OP_COARSE_LOCATION_SOURCE OP_MANAGE_MEDIA, // MANAGE_MEDIA OP_BLUETOOTH_CONNECT, // OP_BLUETOOTH_CONNECT + OP_UWB_RANGING, // OP_UWB_RANGING }; /** @@ -1964,6 +1971,7 @@ public class AppOpsManager { OPSTR_COARSE_LOCATION_SOURCE, OPSTR_MANAGE_MEDIA, OPSTR_BLUETOOTH_CONNECT, + OPSTR_UWB_RANGING, }; /** @@ -2083,6 +2091,7 @@ public class AppOpsManager { "COARSE_LOCATION_SOURCE", "MANAGE_MEDIA", "BLUETOOTH_CONNECT", + "UWB_RANGING" }; /** @@ -2203,6 +2212,7 @@ public class AppOpsManager { null, // no permission for OP_ACCESS_COARSE_LOCATION_SOURCE, Manifest.permission.MANAGE_MEDIA, Manifest.permission.BLUETOOTH_CONNECT, + Manifest.permission.UWB_RANGING, }; /** @@ -2323,6 +2333,7 @@ public class AppOpsManager { null, // ACCESS_COARSE_LOCATION_SOURCE null, // MANAGE_MEDIA null, // BLUETOOTH_CONNECT + null, // UWB_RANGING }; /** @@ -2442,6 +2453,7 @@ public class AppOpsManager { null, // ACCESS_COARSE_LOCATION_SOURCE null, // MANAGE_MEDIA null, // BLUETOOTH_CONNECT + null, // UWB_RANGING }; /** @@ -2560,6 +2572,7 @@ public class AppOpsManager { AppOpsManager.MODE_ALLOWED, // ACCESS_COARSE_LOCATION_SOURCE AppOpsManager.MODE_DEFAULT, // MANAGE_MEDIA AppOpsManager.MODE_ALLOWED, // BLUETOOTH_CONNECT + AppOpsManager.MODE_ALLOWED, // UWB_RANGING }; /** @@ -2682,6 +2695,7 @@ public class AppOpsManager { false, // ACCESS_COARSE_LOCATION_SOURCE false, // MANAGE_MEDIA false, // BLUETOOTH_CONNECT + false, // UWB_RANGING }; /**