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

Commit 811fb71a authored by Jay Thomas Sullivan's avatar Jay Thomas Sullivan
Browse files

Define new AUDIO/VIDEO/IMAGE permissions

Define three new permissions:

- READ_MEDIA_AUDIO: read audio files from external storage
- READ_MEDIA_VIDEO: read video files from external storage
- READ_MEDIA_IMAGE: read image files from external storage

Also, define two new permission groups:

- READ_MEDIA_AURAL
- READ_MEDIA_VISUAL

The permissions are assigned to permission groups as follows:

  READ_MEDIA_AURAL {
      READ_MEDIA_AUDIO
  }
  READ_MEDIA_VISUAL {
      READ_MEDIA_VIDEO
      READ_MEDIA_IMAGE
  }

The motivation for this change is to support the "Media Permission
Update for Android T" project.

Bug: 201318587
Test: manual
Change-Id: If3d357baed15b66319a6c2308416622e5e57fe28
parent 673f2e55
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -131,6 +131,9 @@ package android {
    field public static final String READ_EXTERNAL_STORAGE = "android.permission.READ_EXTERNAL_STORAGE";
    field @Deprecated public static final String READ_INPUT_STATE = "android.permission.READ_INPUT_STATE";
    field public static final String READ_LOGS = "android.permission.READ_LOGS";
    field public static final String READ_MEDIA_AUDIO = "android.permission.READ_MEDIA_AUDIO";
    field public static final String READ_MEDIA_IMAGE = "android.permission.READ_MEDIA_IMAGE";
    field public static final String READ_MEDIA_VIDEO = "android.permission.READ_MEDIA_VIDEO";
    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";
@@ -212,6 +215,8 @@ package android {
    field public static final String NEARBY_DEVICES = "android.permission-group.NEARBY_DEVICES";
    field public static final String NOTIFICATIONS = "android.permission-group.NOTIFICATIONS";
    field public static final String PHONE = "android.permission-group.PHONE";
    field public static final String READ_MEDIA_AURAL = "android.permission-group.READ_MEDIA_AURAL";
    field public static final String READ_MEDIA_VISUAL = "android.permission-group.READ_MEDIA_VISUAL";
    field public static final String SENSORS = "android.permission-group.SENSORS";
    field public static final String SMS = "android.permission-group.SMS";
    field public static final String STORAGE = "android.permission-group.STORAGE";
+3 −3
Original line number Diff line number Diff line
@@ -2344,11 +2344,11 @@ public class AppOpsManager {
            Manifest.permission.USE_BIOMETRIC,
            Manifest.permission.ACTIVITY_RECOGNITION,
            Manifest.permission.SMS_FINANCIAL_TRANSACTIONS,
            null,
            Manifest.permission.READ_MEDIA_AUDIO,
            null, // no permission for OP_WRITE_MEDIA_AUDIO
            null,
            Manifest.permission.READ_MEDIA_VIDEO,
            null, // no permission for OP_WRITE_MEDIA_VIDEO
            null,
            Manifest.permission.READ_MEDIA_IMAGE,
            null, // no permission for OP_WRITE_MEDIA_IMAGES
            null, // no permission for OP_LEGACY_STORAGE
            null, // no permission for OP_ACCESS_ACCESSIBILITY
+55 −0
Original line number Diff line number Diff line
@@ -973,6 +973,61 @@
        android:permissionFlags="softRestricted|immutablyRestricted"
        android:protectionLevel="dangerous" />

    <!-- Required to be able to read audio files from shared storage.
     <p>Protection level: dangerous -->
    <permission-group android:name="android.permission-group.READ_MEDIA_AURAL"
                      android:icon="@drawable/perm_group_read_media_aural"
                      android:label="@string/permgrouplab_readMediaAural"
                      android:description="@string/permgroupdesc_readMediaAural"
                      android:priority="950" />

    <!-- Allows an application to read audio files from external storage.
      <p>This permission is enforced starting in API level
      {@link android.os.Build.VERSION_CODES#TIRAMISU}.
      For apps with a <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
      targetSdkVersion}</a> of {@link android.os.Build.VERSION_CODES#S} or lower, this permission
      must not be used and the READ_EXTERNAL_STORAGE permission must be used instead.
     <p>Protection level: dangerous -->
    <permission android:name="android.permission.READ_MEDIA_AUDIO"
                android:permissionGroup="android.permission-group.UNDEFINED"
                android:label="@string/permlab_readMediaAudio"
                android:description="@string/permdesc_readMediaAudio"
                android:protectionLevel="dangerous" />

    <!-- Required to be able to read image and video files from shared storage.
     <p>Protection level: dangerous -->
    <permission-group android:name="android.permission-group.READ_MEDIA_VISUAL"
                      android:icon="@drawable/perm_group_read_media_visual"
                      android:label="@string/permgrouplab_readMediaVisual"
                      android:description="@string/permgroupdesc_readMediaVisual"
                      android:priority="1000" />

    <!-- Allows an application to read audio files from external storage.
    <p>This permission is enforced starting in API level
    {@link android.os.Build.VERSION_CODES#TIRAMISU}.
    For apps with a <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
    targetSdkVersion}</a> of {@link android.os.Build.VERSION_CODES#S} or lower, this permission
    must not be used and the READ_EXTERNAL_STORAGE permission must be used instead.
   <p>Protection level: dangerous -->
    <permission android:name="android.permission.READ_MEDIA_VIDEO"
                android:permissionGroup="android.permission-group.UNDEFINED"
                android:label="@string/permlab_readMediaVideo"
                android:description="@string/permdesc_readMediaVideo"
                android:protectionLevel="dangerous" />

    <!-- Allows an application to read image files from external storage.
      <p>This permission is enforced starting in API level
      {@link android.os.Build.VERSION_CODES#TIRAMISU}.
      For apps with a <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
      targetSdkVersion}</a> of {@link android.os.Build.VERSION_CODES#S} or lower, this permission
      must not be used and the READ_EXTERNAL_STORAGE permission must be used instead.
     <p>Protection level: dangerous -->
    <permission android:name="android.permission.READ_MEDIA_IMAGE"
                android:permissionGroup="android.permission-group.UNDEFINED"
                android:label="@string/permlab_readMediaImage"
                android:description="@string/permdesc_readMediaImage"
                android:protectionLevel="dangerous" />

    <!-- Allows an application to write to external storage.
         <p class="note"><strong>Note:</strong> If <em>both</em> your <a
         href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
+26 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2015 The Android Open Source Project

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24"
        android:tint="?attr/colorControlNormal">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M10,21q-1.65,0 -2.825,-1.175Q6,18.65 6,17q0,-1.65 1.175,-2.825Q8.35,13 10,13q0.575,0 1.063,0.137 0.487,0.138 0.937,0.413V3h6v4h-4v10q0,1.65 -1.175,2.825Q11.65,21 10,21z"/>
</vector>
 No newline at end of file
+26 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2015 The Android Open Source Project

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24"
        android:tint="?attr/colorControlNormal">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M9,14h10l-3.45,-4.5 -2.3,3 -1.55,-2zM8,18q-0.825,0 -1.412,-0.587Q6,16.825 6,16L6,4q0,-0.825 0.588,-1.413Q7.175,2 8,2h12q0.825,0 1.413,0.587Q22,3.175 22,4v12q0,0.825 -0.587,1.413Q20.825,18 20,18zM8,16h12L20,4L8,4v12zM4,22q-0.825,0 -1.413,-0.587Q2,20.825 2,20L2,6h2v14h14v2zM8,4v12L8,4z"/>
</vector>
 No newline at end of file
Loading