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

Commit 430b94bb authored by shafik's avatar shafik
Browse files

Add settings UI for MANAGE_EXTERNAL_STORAGE

Adds a Special App Access setting for the app-op
OP_MANAGE_EXTERNAL_STORAGE. All apps requesting the corresponding
permission will be displayed in the settings page. Toggling the
preference switch for an app will grant/revoke the app-op.

All of the external references to the permission, app-op and their
corresponding activities and logic use the name "Manage External
Storage". All of the external displays and strings use the name "All
files access"

Test: * Install app with uses-permission MANAGE_EXTERNAL_STORAGE
      * Observe it appearing the All files access page
      * Toggle the switch and observe the change in
        'adb shell dumpsys appops'
Bug: 146425146

Change-Id: If5c9c5daa3616a3310c090283acfda933bf9df26
parent 6b7b92ce
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -6954,6 +6954,8 @@
    <string name="help_uri_apps_photography" translatable="false"></string>
    <!-- Help URI, manage apps wifi access [DO NOT TRANSLATE] -->
    <string name="help_uri_apps_wifi_access" translatable="false"></string>
    <!-- Help URI, manage apps that have access to all files [DO NOT TRANSLATE] -->
    <string name="help_uri_manage_external_storage" translatable="false"></string>
    <!-- Help URI, Storage [DO NOT TRANSLATE] -->
    <string name="help_uri_storage" translatable="false"></string>
    <!-- Help URI, Accessibility [DO NOT TRANSLATE] -->
@@ -9429,6 +9431,16 @@
    <!-- Description of allowing overlay setting [CHAR LIMIT=NONE] -->
    <string name="allow_overlay_description">Allow this app to display on top of other apps you\u2019re using. It may interfere with your use of those apps or change the way they seem to appear or behave.</string>
    <!-- Manager External Storage settings title [CHAR LIMIT=30] -->
    <string name="manage_external_storage_title">All files access</string>
    <!-- Label for a setting which controls whether an app can manage external storage [CHAR LIMIT=45] -->
    <string name="permit_manage_external_storage">Allow access to manage all files</string>
    <!-- Description for a setting which controls whether an app can manage external storage
         [CHAR LIMIT=NONE] -->
    <string name="allow_manage_external_storage_description">Allow this app to read, modify and delete all files on this device or any connected storage volumes. If granted, app may access files without your explicit knowledge.</string>
    <!-- Label for showing apps that can manage external storage[CHAR LIMIT=45] -->
    <string name="filter_manage_external_storage">Can access all files</string>
    <!-- Keyword for VR setting -->
    <string name="keywords_vr_listener">vr virtual reality listener stereo helper service</string>
    <!-- Main settings screen item's title to go into the overlay settings screen [CHAR LIMIT=30] -->
+29 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2020 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.
-->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    android:key="manage_external_storage_permission_details"
    android:title="@string/manage_external_storage_title">

    <SwitchPreference
        android:key="app_ops_settings_switch"
        android:title="@string/permit_manage_external_storage"/>

    <Preference
        android:summary="@string/allow_manage_external_storage_description"
        android:selectable="false"/>

</PreferenceScreen>
+9 −0
Original line number Diff line number Diff line
@@ -20,6 +20,15 @@
    android:key="special_app_access_screen"
    android:title="@string/special_access">

    <Preference
        android:key="manage_external_storage"
        android:title="@string/manage_external_storage_title"
        android:fragment="com.android.settings.applications.manageapplications.ManageApplications">
        <extra
            android:name="classname"
            android:value="com.android.settings.Settings$ManageExternalStorageActivity" />
    </Preference>

    <Preference
        android:key="high_power_apps"
        android:title="@string/high_power_apps"
+1 −0
Original line number Diff line number Diff line
@@ -138,6 +138,7 @@ public class Settings extends SettingsActivity {
    public static class MemorySettingsActivity extends SettingsActivity { /* empty */ }
    public static class AppMemoryUsageActivity extends SettingsActivity { /* empty */ }
    public static class OverlaySettingsActivity extends SettingsActivity { /* empty */ }
    public static class ManageExternalStorageActivity extends SettingsActivity { /* empty */ }
    public static class WriteSettingsActivity extends SettingsActivity { /* empty */ }
    public static class ChangeWifiStateActivity extends SettingsActivity { /* empty */ }
    public static class AppDrawOverlaySettingsActivity extends SettingsActivity { /* empty */ }
+1 −1
Original line number Diff line number Diff line
@@ -328,7 +328,7 @@ public abstract class AppStateAppOpsBridge extends AppStateBaseBridge {
        public boolean isPermissible() {
            // defining the default behavior as permissible as long as the package requested this
            // permission (this means pre-M gets approval during install time; M apps gets approval
            // during runtime.
            // during runtime).
            if (appOpMode == AppOpsManager.MODE_DEFAULT) {
                return staticPermissionGranted;
            }
Loading