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

Commit 62078979 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Broaden temporary workaround.

We have logic that automatically grants the legacy "Storage"
permission when the user grants either of the new "Music" or
"Photos & Videos" permissions, but that logic only lives in
PermissionController, and does not apply to pre-grants.

As a temporary workaround, explicitly grant the "Storage"
permission in pre-grants until we can refactor the
PermissionController logic.

Bug: 124766975, 124466734
Test: manual
Change-Id: I85cdf567af7683c0a3cfba755a9135ebad7a290f
parent 3805e941
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -206,6 +206,11 @@ public final class DefaultPermissionGrantPolicy {
        // STOPSHIP(b/112545973): remove once feature enabled by default
        if (StorageManager.hasIsolatedStorage()) {
            MEDIA_AURAL_PERMISSIONS.add(Manifest.permission.READ_MEDIA_AUDIO);

            // STOPSHIP(b/124466734): remove these manual grants once the legacy
            // permission logic is unified with PermissionController
            MEDIA_AURAL_PERMISSIONS.add(Manifest.permission.READ_EXTERNAL_STORAGE);
            MEDIA_AURAL_PERMISSIONS.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
        }
    }

@@ -215,6 +220,11 @@ public final class DefaultPermissionGrantPolicy {
        if (StorageManager.hasIsolatedStorage()) {
            MEDIA_VISUAL_PERMISSIONS.add(Manifest.permission.READ_MEDIA_VIDEO);
            MEDIA_VISUAL_PERMISSIONS.add(Manifest.permission.READ_MEDIA_IMAGES);

            // STOPSHIP(b/124466734): remove these manual grants once the legacy
            // permission logic is unified with PermissionController
            MEDIA_VISUAL_PERMISSIONS.add(Manifest.permission.READ_EXTERNAL_STORAGE);
            MEDIA_VISUAL_PERMISSIONS.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
        }
    }

@@ -642,16 +652,10 @@ public final class DefaultPermissionGrantPolicy {
        // Location
        if (locationPackageNames != null) {
            for (String packageName : locationPackageNames) {
                // STOPSHIP: remove this force-granting of legacy storage
                // permissions once b/124466734 is resolved
                final Set<String> storageWorkaround = new ArraySet<>();
                storageWorkaround.add(Manifest.permission.READ_EXTERNAL_STORAGE);
                storageWorkaround.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);

                grantPermissionsToSystemPackage(packageName, userId,
                        CONTACTS_PERMISSIONS, CALENDAR_PERMISSIONS, MICROPHONE_PERMISSIONS,
                        PHONE_PERMISSIONS, SMS_PERMISSIONS, CAMERA_PERMISSIONS,
                        SENSORS_PERMISSIONS, STORAGE_PERMISSIONS, storageWorkaround);
                        SENSORS_PERMISSIONS, STORAGE_PERMISSIONS, MEDIA_AURAL_PERMISSIONS);
                grantSystemFixedPermissionsToSystemPackage(packageName, userId,
                        LOCATION_PERMISSIONS, ACTIVITY_RECOGNITION_PERMISSIONS);
            }