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

Commit 32a1a709 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Remove typed media permissions

Test: Looked at permission UI
Change-Id: If3aafefc8f16aabf31d48bc82f969dedc67a168d
parent bc678fde
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -448,12 +448,6 @@
    <!-- Label for showing a permission group's description in the header of the list of apps that have the location permission [CHAR LIMIT=none] -->
    <string name="permission_description_summary_location">Apps with this permission can access this device\'s location</string>

    <!-- Label for showing a permission group's description in the header of the list of apps that have the media_aural permission [CHAR LIMIT=none] -->
    <string name="permission_description_summary_media_aural">Apps with this permission can access your music</string>

    <!-- Label for showing a permission group's description in the header of the list of apps that have the media_visual permission [CHAR LIMIT=none] -->
    <string name="permission_description_summary_media_visual">Apps with this permission can access your photos &amp; videos</string>

    <!-- Label for showing a permission group's description in the header of the list of apps that have the microphone permission [CHAR LIMIT=none] -->
    <string name="permission_description_summary_microphone">Apps with this permission can record audio</string>

@@ -466,6 +460,9 @@
    <!-- Label for showing a permission group's description in the header of the list of apps that have the SMS permission [CHAR LIMIT=none] -->
    <string name="permission_description_summary_sms">Apps with this permission can send and view SMS messages</string>

    <!-- Label for showing a permission group's description in the header of the list of apps that have the Storage permission [CHAR LIMIT=none] -->
    <string name="permission_description_summary_storage">Apps with this permission can access photos, media, and files on your device</string>

    <!-- Summary for showing the time and/or date of the most recent access of a permission by an app [CHAR LIMIT=60] -->
    <string name="app_permission_most_recent_summary">Last access: <xliff:g id="time_date" example="12:42 PM">%1$s</xliff:g></string>

+6 −11
Original line number Diff line number Diff line
@@ -68,13 +68,9 @@
        <permission name="android.permission.BODY_SENSORS" />
    </permission-set>

    <permission-set name="media_aural">
        <permission name="android.permission.READ_MEDIA_AUDIO" />
    </permission-set>

    <permission-set name="media_visual">
        <permission name="android.permission.READ_MEDIA_VIDEO" />
        <permission name="android.permission.READ_MEDIA_IMAGES" />
    <permission-set name="storage">
        <permission name="android.permission.READ_EXTERNAL_STORAGE" />
        <permission name="android.permission.WRITE_EXTERNAL_STORAGE" />
    </permission-set>

    <role
@@ -263,8 +259,7 @@
            <permission-set name="phone" />
            <permission-set name="contacts" />
            <permission-set name="sms" />
            <permission-set name="media_aural" />
            <permission-set name="media_visual" />
            <permission-set name="storage" />
            <permission-set name="microphone" />
            <permission-set name="camera" />
        </permissions>
@@ -387,7 +382,7 @@
            </activity>
        </required-components>
        <permissions>
            <permission-set name="media_aural" />
            <permission-set name="storage" />
        </permissions>
        <app-ops>
            <app-op name="android:write_media_audio" mode="allowed" />
@@ -426,7 +421,7 @@
            </activity>
        </required-components>
        <permissions>
            <permission-set name="media_visual" />
            <permission-set name="storage" />
        </permissions>
        <app-ops>
            <app-op name="android:write_media_video" mode="allowed" />
+8 −15
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import static android.app.AppOpsManager.MODE_ALLOWED;
import static android.app.AppOpsManager.MODE_FOREGROUND;
import static android.app.AppOpsManager.MODE_IGNORED;
import static android.app.AppOpsManager.OPSTR_LEGACY_STORAGE;
import static android.content.pm.PackageManager.FLAG_PERMISSION_HIDDEN;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;

import android.app.ActivityManager;
@@ -106,7 +105,7 @@ public final class AppPermissionGroup implements Comparable<AppPermissionGroup>

    private final boolean mAppSupportsRuntimePermissions;
    private final boolean mIsEphemeralApp;
    private final boolean mIsGrandfatheredModernStorageGroup;
    private final boolean mIsNonIsolatedStorage;
    private boolean mContainsEphemeralPermission;
    private boolean mContainsPreRuntimePermission;

@@ -306,10 +305,6 @@ public final class AppPermissionGroup implements Comparable<AppPermissionGroup>
        for (int i = 0; i < numPermissions; i++) {
            Permission permission = allPermissions.valueAt(i);

            if ((permission.getFlags() & FLAG_PERMISSION_HIDDEN) != 0) {
                continue;
            }

            if (permission.isBackgroundPermission()) {
                if (group.getBackgroundPermissions() == null) {
                    group.mBackgroundPermissions = new AppPermissionGroup(group.mContext,
@@ -410,8 +405,7 @@ public final class AppPermissionGroup implements Comparable<AppPermissionGroup>
            mIconResId = R.drawable.ic_perm_device_info;
        }

        mIsGrandfatheredModernStorageGroup = targetSDK >= Build.VERSION_CODES.Q
                        && mAppOps.unsafeCheckOpNoThrow(OPSTR_LEGACY_STORAGE,
        mIsNonIsolatedStorage = mAppOps.unsafeCheckOpNoThrow(OPSTR_LEGACY_STORAGE,
                        packageInfo.applicationInfo.uid, packageInfo.packageName) == MODE_ALLOWED;
    }

@@ -1065,15 +1059,14 @@ public final class AppPermissionGroup implements Comparable<AppPermissionGroup>
    }

    /**
     * Is the group a grandfathered modern storage permission group.
     *
     * <p>Such permissions cannot be revoked. The user needs to uninstall and reinstall the app to
     * reset the permission
     * Is the group a storage permission group that is referring to an app that does not have
     * isolated storage
     *
     * @return {@code true} iff this is a grandfathered modern storage permission group.
     * @return {@code true} iff this is a storage group on an app that does not have isolated
     * storage
     */
    public boolean isGrandfatheredModernStorageGroup() {
        return mIsGrandfatheredModernStorageGroup;
    public boolean isNonIsolatedStorage() {
        return mIsNonIsolatedStorage;
    }

    /**
+1 −7
Original line number Diff line number Diff line
@@ -366,13 +366,7 @@ public class AppPermissionFragment extends SettingsWithLargeHeader {
        }

        // Handle the UI for various special cases.
        if (mGroup.isGrandfatheredModernStorageGroup()) {
            mAlwaysButton.setClickable(false);
            mDenyButton.setClickable(false);

            mRadioGroup.setClickable(true);
            mRadioGroup.setOnClickListener(v -> showGrandfatheredModernStorageGroupWarningDialog());
        } else if (isSystemFixed() || isPolicyFullyFixed() || isForegroundDisabledByPolicy()) {
        if (isSystemFixed() || isPolicyFullyFixed() || isForegroundDisabledByPolicy()) {
            // Disable changing permissions and potentially show administrator message.
            mAlwaysButton.setEnabled(false);
            mForegroundOnlyButton.setEnabled(false);
+3 −12
Original line number Diff line number Diff line
@@ -23,8 +23,6 @@ import static android.Manifest.permission_group.CALL_LOG;
import static android.Manifest.permission_group.CAMERA;
import static android.Manifest.permission_group.CONTACTS;
import static android.Manifest.permission_group.LOCATION;
import static android.Manifest.permission_group.MEDIA_AURAL;
import static android.Manifest.permission_group.MEDIA_VISUAL;
import static android.Manifest.permission_group.MICROPHONE;
import static android.Manifest.permission_group.PHONE;
import static android.Manifest.permission_group.SENSORS;
@@ -134,12 +132,7 @@ public final class Utils {

        PLATFORM_PERMISSIONS.put(Manifest.permission.READ_EXTERNAL_STORAGE, STORAGE);
        PLATFORM_PERMISSIONS.put(Manifest.permission.WRITE_EXTERNAL_STORAGE, STORAGE);

        PLATFORM_PERMISSIONS.put(Manifest.permission.READ_MEDIA_AUDIO, MEDIA_AURAL);

        PLATFORM_PERMISSIONS.put(Manifest.permission.READ_MEDIA_IMAGES, MEDIA_VISUAL);
        PLATFORM_PERMISSIONS.put(Manifest.permission.READ_MEDIA_VIDEO, MEDIA_VISUAL);
        PLATFORM_PERMISSIONS.put(Manifest.permission.ACCESS_MEDIA_LOCATION, MEDIA_VISUAL);
        PLATFORM_PERMISSIONS.put(Manifest.permission.ACCESS_MEDIA_LOCATION, STORAGE);

        PLATFORM_PERMISSIONS.put(Manifest.permission.ACCESS_FINE_LOCATION, LOCATION);
        PLATFORM_PERMISSIONS.put(Manifest.permission.ACCESS_COARSE_LOCATION, LOCATION);
@@ -726,10 +719,6 @@ public final class Utils {
                return context.getString(R.string.permission_description_summary_contacts);
            case LOCATION:
                return context.getString(R.string.permission_description_summary_location);
            case MEDIA_AURAL:
                return context.getString(R.string.permission_description_summary_media_aural);
            case MEDIA_VISUAL:
                return context.getString(R.string.permission_description_summary_media_visual);
            case MICROPHONE:
                return context.getString(R.string.permission_description_summary_microphone);
            case PHONE:
@@ -738,6 +727,8 @@ public final class Utils {
                return context.getString(R.string.permission_description_summary_sensors);
            case SMS:
                return context.getString(R.string.permission_description_summary_sms);
            case STORAGE:
                return context.getString(R.string.permission_description_summary_storage);
            default:
                return context.getString(R.string.permission_description_summary_generic,
                        description);
Loading