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

Commit e958da73 authored by Oscar Shu's avatar Oscar Shu Committed by Android (Google) Code Review
Browse files

Merge changes from topic "nearbyWifi"

* changes:
  Adding wifi nearby permission to DefaultPermissionGrantPolicy
  Add new wifi nearby devices app-ops
  New runtime permission NEARBY_WIFI_DEVICES
parents d3e12f60 fe4797b6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -114,6 +114,7 @@ package android {
    field public static final String MODIFY_PHONE_STATE = "android.permission.MODIFY_PHONE_STATE";
    field public static final String MOUNT_FORMAT_FILESYSTEMS = "android.permission.MOUNT_FORMAT_FILESYSTEMS";
    field public static final String MOUNT_UNMOUNT_FILESYSTEMS = "android.permission.MOUNT_UNMOUNT_FILESYSTEMS";
    field public static final String NEARBY_WIFI_DEVICES = "android.permission.NEARBY_WIFI_DEVICES";
    field public static final String NFC = "android.permission.NFC";
    field public static final String NFC_PREFERRED_PAYMENT_INFO = "android.permission.NFC_PREFERRED_PAYMENT_INFO";
    field public static final String NFC_TRANSACTION_EVENT = "android.permission.NFC_TRANSACTION_EVENT";
+15 −1
Original line number Diff line number Diff line
@@ -1292,6 +1292,9 @@ public class AppOpsManager {
    /** @hide */
    public static final int OP_UWB_RANGING = AppProtoEnums.APP_OP_UWB_RANGING;

    /** @hide */
    public static final int OP_NEARBY_WIFI_DEVICES = AppProtoEnums.APP_OP_NEARBY_WIFI_DEVICES;

    /**
     * Activity recognition being accessed by an activity recognition source, which
     * is a component that already has access since it is the one that detects
@@ -1312,7 +1315,7 @@ public class AppOpsManager {

    /** @hide */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public static final int _NUM_OP = 116;
    public static final int _NUM_OP = 117;

    /** Access to coarse location information. */
    public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
@@ -1731,6 +1734,8 @@ public class AppOpsManager {
    public static final String OPSTR_MANAGE_MEDIA = "android:manage_media";
    /** @hide */
    public static final String OPSTR_UWB_RANGING = "android:uwb_ranging";
    /** @hide */
    public static final String OPSTR_NEARBY_WIFI_DEVICES = "android:nearby_wifi_devices";

    /**
     * Activity recognition being accessed by an activity recognition source, which
@@ -1819,6 +1824,7 @@ public class AppOpsManager {
            OP_BLUETOOTH_CONNECT,
            OP_BLUETOOTH_ADVERTISE,
            OP_UWB_RANGING,
            OP_NEARBY_WIFI_DEVICES,
            // Notifications
            OP_POST_NOTIFICATION,

@@ -1965,6 +1971,7 @@ public class AppOpsManager {
            OP_ACTIVITY_RECOGNITION,            // OP_ACTIVITY_RECOGNITION_SOURCE
            OP_BLUETOOTH_ADVERTISE,             // OP_BLUETOOTH_ADVERTISE
            OP_RECORD_INCOMING_PHONE_AUDIO,     // OP_RECORD_INCOMING_PHONE_AUDIO
            OP_NEARBY_WIFI_DEVICES,             // OP_NEARBY_WIFI_DEVICES
    };

    /**
@@ -2087,6 +2094,7 @@ public class AppOpsManager {
            OPSTR_ACTIVITY_RECOGNITION_SOURCE,
            OPSTR_BLUETOOTH_ADVERTISE,
            OPSTR_RECORD_INCOMING_PHONE_AUDIO,
            OPSTR_NEARBY_WIFI_DEVICES,
    };

    /**
@@ -2210,6 +2218,7 @@ public class AppOpsManager {
            "ACTIVITY_RECOGNITION_SOURCE",
            "BLUETOOTH_ADVERTISE",
            "RECORD_INCOMING_PHONE_AUDIO",
            "NEARBY_WIFI_DEVICES"
    };

    /**
@@ -2334,6 +2343,7 @@ public class AppOpsManager {
            null, // no permission for OP_ACTIVITY_RECOGNITION_SOURCE,
            Manifest.permission.BLUETOOTH_ADVERTISE,
            null, // no permission for OP_RECORD_INCOMING_PHONE_AUDIO,
            Manifest.permission.NEARBY_WIFI_DEVICES,
    };

    /**
@@ -2458,6 +2468,7 @@ public class AppOpsManager {
            null, // ACTIVITY_RECOGNITION_SOURCE
            null, // BLUETOOTH_ADVERTISE
            null, // RECORD_INCOMING_PHONE_AUDIO
            null, // NEARBY_WIFI_DEVICES
    };

    /**
@@ -2581,6 +2592,7 @@ public class AppOpsManager {
            null, // ACTIVITY_RECOGNITION_SOURCE
            null, // BLUETOOTH_ADVERTISE
            null, // RECORD_INCOMING_PHONE_AUDIO
            null, // NEARBY_WIFI_DEVICES
    };

    /**
@@ -2703,6 +2715,7 @@ public class AppOpsManager {
            AppOpsManager.MODE_ALLOWED, // ACTIVITY_RECOGNITION_SOURCE
            AppOpsManager.MODE_ALLOWED, // BLUETOOTH_ADVERTISE
            AppOpsManager.MODE_ALLOWED, // RECORD_INCOMING_PHONE_AUDIO
            AppOpsManager.MODE_ALLOWED, // NEARBY_WIFI_DEVICES
    };

    /**
@@ -2829,6 +2842,7 @@ public class AppOpsManager {
            false, // ACTIVITY_RECOGNITION_SOURCE
            false, // BLUETOOTH_ADVERTISE
            false, // RECORD_INCOMING_PHONE_AUDIO
            false, // NEARBY_WIFI_DEVICES
    };

    /**
+8 −0
Original line number Diff line number Diff line
@@ -2011,6 +2011,14 @@
        android:label="@string/permlab_uwb_ranging"
        android:protectionLevel="dangerous" />

    <!-- Required to be able to advertise and connect to nearby devices via Wi-Fi.
         <p>Protection level: dangerous -->
    <permission android:name="android.permission.NEARBY_WIFI_DEVICES"
                android:permissionGroup="android.permission-group.UNDEFINED"
                android:description="@string/permdesc_nearby_wifi_devices"
                android:label="@string/permlab_nearby_wifi_devices"
                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
+5 −0
Original line number Diff line number Diff line
@@ -1493,6 +1493,11 @@
    <!-- 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_uwb_ranging">Allow the app to determine relative position between nearby Ultra-Wideband 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_nearby_wifi_devices">interact with nearby Wi\u2011Fi 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_nearby_wifi_devices">Allows the app to advertise, connect, and determine the relative position of nearby Wi\u2011Fi 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>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+1 −0
Original line number Diff line number Diff line
@@ -213,6 +213,7 @@ final class DefaultPermissionGrantPolicy {
        NEARBY_DEVICES_PERMISSIONS.add(Manifest.permission.BLUETOOTH_CONNECT);
        NEARBY_DEVICES_PERMISSIONS.add(Manifest.permission.BLUETOOTH_SCAN);
        NEARBY_DEVICES_PERMISSIONS.add(Manifest.permission.UWB_RANGING);
        NEARBY_DEVICES_PERMISSIONS.add(Manifest.permission.NEARBY_WIFI_DEVICES);
    }

    private static final int MSG_READ_DEFAULT_PERMISSION_EXCEPTIONS = 1;