Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9f5392e8 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

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
parents 68d118e3 7b14b876
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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";
+18 −3
Original line number Diff line number Diff line
@@ -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
    };

    /**
+24 −0
Original line number Diff line number Diff line
@@ -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
+13 −0
Original line number Diff line number Diff line
@@ -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>
+2 −0
Original line number Diff line number Diff line
@@ -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" />
Loading