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

Commit 2b90ab41 authored by Nate Myren's avatar Nate Myren Committed by Alessandra Loro
Browse files

Add READ_MEDIA_VISUAL_USER_SELECTED permission and appop

Bug: 25178384
Test: atest PermissionPolicyTest
Merged-In: I4dadcad364d0a646619e50165c06d5b4be6d6726
Change-Id: I4dadcad364d0a646619e50165c06d5b4be6d6726
parent c4b8a921
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -140,6 +140,7 @@ package android {
    field public static final String READ_MEDIA_AUDIO = "android.permission.READ_MEDIA_AUDIO";
    field public static final String READ_MEDIA_IMAGES = "android.permission.READ_MEDIA_IMAGES";
    field public static final String READ_MEDIA_VIDEO = "android.permission.READ_MEDIA_VIDEO";
    field public static final String READ_MEDIA_VISUAL_USER_SELECTED = "android.permission.READ_MEDIA_VISUAL_USER_SELECTED";
    field public static final String READ_NEARBY_STREAMING_POLICY = "android.permission.READ_NEARBY_STREAMING_POLICY";
    field public static final String READ_PHONE_NUMBERS = "android.permission.READ_PHONE_NUMBERS";
    field public static final String READ_PHONE_STATE = "android.permission.READ_PHONE_STATE";
+1 −0
Original line number Diff line number Diff line
@@ -571,6 +571,7 @@ package android.app {
    field public static final String OPSTR_READ_MEDIA_AUDIO = "android:read_media_audio";
    field public static final String OPSTR_READ_MEDIA_IMAGES = "android:read_media_images";
    field public static final String OPSTR_READ_MEDIA_VIDEO = "android:read_media_video";
    field public static final String OPSTR_READ_MEDIA_VISUAL_USER_SELECTED = "android:read_media_visual_user_selected";
    field public static final String OPSTR_RECEIVE_EMERGENCY_BROADCAST = "android:receive_emergency_broadcast";
    field public static final String OPSTR_REQUEST_DELETE_PACKAGES = "android:request_delete_packages";
    field public static final String OPSTR_REQUEST_INSTALL_PACKAGES = "android:request_install_packages";
+19 −1
Original line number Diff line number Diff line
@@ -1343,9 +1343,17 @@ public class AppOpsManager {
    public static final int OP_RECEIVE_AMBIENT_TRIGGER_AUDIO =
            AppProtoEnums.APP_OP_RECEIVE_AMBIENT_TRIGGER_AUDIO;

    /**
     * Notify apps that they have been granted URI permission photos
     *
     * @hide
     */
    public static final int OP_READ_MEDIA_VISUAL_USER_SELECTED =
            AppProtoEnums.APP_OP_READ_MEDIA_VISUAL_USER_SELECTED;

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

    /** Access to coarse location information. */
    public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
@@ -1815,6 +1823,14 @@ public class AppOpsManager {
     */
    public static final String OPSTR_RECEIVE_AMBIENT_TRIGGER_AUDIO =
            "android:receive_ambient_trigger_audio";
    /**
     * Notify apps that they have been granted URI permission photos
     *
     * @hide
     */
    @SystemApi
    public static final String OPSTR_READ_MEDIA_VISUAL_USER_SELECTED =
            "android:read_media_visual_user_selected";

    /** {@link #sAppOpsToNote} not initialized yet for this op */
    private static final byte SHOULD_COLLECT_NOTE_OP_NOT_INITIALIZED = 0;
@@ -1906,6 +1922,7 @@ public class AppOpsManager {
            OP_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER,
            OP_SCHEDULE_EXACT_ALARM,
            OP_MANAGE_MEDIA,
            OP_READ_MEDIA_VISUAL_USER_SELECTED,
    };

    /**
@@ -2038,6 +2055,7 @@ public class AppOpsManager {
            OP_ESTABLISH_VPN_MANAGER,           // OP_ESTABLISH_VPN_MANAGER
            OP_ACCESS_RESTRICTED_SETTINGS,      // OP_ACCESS_RESTRICTED_SETTINGS
            OP_RECEIVE_AMBIENT_TRIGGER_AUDIO,      // RECEIVE_SOUNDTRIGGER_AUDIO
            OP_READ_MEDIA_VISUAL_USER_SELECTED,  // READ_MEDIA_VISUAL_USER_SELECTED
    };

    /**
+12 −0
Original line number Diff line number Diff line
@@ -1146,6 +1146,18 @@
                android:description="@string/permdesc_readMediaImages"
                android:protectionLevel="dangerous" />

    <!-- Allows an application to read image or video files from external storage that a user has
      selected via the permission prompt photo picker. Apps can check this permission to verify that
      a user has decided to use the photo picker, instead of granting access to
      {@link #READ_MEDIA_IMAGES or #READ_MEDIA_VIDEO}. It does not prevent apps from accessing the
      standard photo picker manually.
   <p>Protection level: dangerous -->
    <permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED"
        android:permissionGroup="android.permission-group.UNDEFINED"
        android:label="@string/permlab_readVisualUserSelect"
        android:description="@string/permdesc_readVisualUserSelect"
        android:protectionLevel="dangerous" />

    <!-- Allows an application to write to external storage.
         <p><strong>Note: </strong>If your app targets {@link android.os.Build.VERSION_CODES#R} or
         higher, this permission has no effect.
+5 −0
Original line number Diff line number Diff line
@@ -1922,6 +1922,11 @@
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. "shared storage" refers to a storage space on the device that all apps with this permission can read from. [CHAR LIMIT=none] -->
    <string name="permdesc_readMediaImages">Allows the app to read image files from your shared storage.</string>

    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. "shared storage" refers to a storage space on the device that all apps with this permission can read from. [CHAR LIMIT=none] -->
    <string name="permlab_readVisualUserSelect">read user selected image and video files from shared storage</string>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. "shared storage" refers to a storage space on the device that all apps with this permission can read from. [CHAR LIMIT=none] -->
    <string name="permdesc_readVisualUserSelect">Allows the app to read image and video files that you select from your shared storage.</string>

    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. "shared storage" refers to a storage space on the device that all apps with this permission can write to. [CHAR LIMIT=none] -->
    <string name="permlab_sdcardWrite">modify or delete the contents of your shared storage</string>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. "shared storage" refers to a storage space on the device that all apps with this permission can write to. [CHAR LIMIT=none] -->