Merge changes from topic "t-media-permissions"

* changes:
  Define splits for AUDIO/VIDEO/IMAGE permissions
  Define new AUDIO/VIDEO/IMAGE permissions
This commit is contained in:
Jay Sullivan
2022-02-04 18:18:37 +00:00
committed by Android (Google) Code Review
7 changed files with 152 additions and 3 deletions

View File

@@ -135,6 +135,9 @@ package android {
field public static final String READ_HOME_APP_SEARCH_DATA = "android.permission.READ_HOME_APP_SEARCH_DATA";
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";
@@ -220,6 +223,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";

View File

@@ -2363,11 +2363,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

View File

@@ -978,6 +978,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

View File

@@ -0,0 +1,26 @@
<?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>

View File

@@ -0,0 +1,26 @@
<?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>

View File

@@ -880,6 +880,16 @@
<!-- 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_storage">access photos, media, and files on your device</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_readMediaAural">Music &amp; other audio</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_readMediaAural">access audio files on your device</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_readMediaVisual">Photos &amp; videos</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_readMediaVisual">access images and video files on your device</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_microphone">Microphone</string>
<!-- Description of a category of application permissions, listed so the user can choose whether they want to allow the application to do this. -->
@@ -1893,6 +1903,21 @@
<!-- 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_sdcardRead">Allows the app to read the contents of 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_readMediaAudio">read audio 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_readMediaAudio">Allows the app to read audio 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_readMediaVideo">read 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_readMediaVideo">Allows the app to read video 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_readMediaImage">read image 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_readMediaImage">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 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] -->

View File

@@ -231,6 +231,18 @@
targetSdk="29">
<new-permission name="android.permission.ACCESS_MEDIA_LOCATION" />
</split-permission>
<split-permission name="android.permission.READ_EXTERNAL_STORAGE"
targetSdk="33">
<new-permission name="android.permission.READ_MEDIA_AUDIO" />
</split-permission>
<split-permission name="android.permission.READ_EXTERNAL_STORAGE"
targetSdk="33">
<new-permission name="android.permission.READ_MEDIA_VIDEO" />
</split-permission>
<split-permission name="android.permission.READ_EXTERNAL_STORAGE"
targetSdk="33">
<new-permission name="android.permission.READ_MEDIA_IMAGE" />
</split-permission>
<split-permission name="android.permission.BLUETOOTH"
targetSdk="31">
<new-permission name="android.permission.BLUETOOTH_SCAN" />