Temporary workaround to grant Storage permission.

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: 124466734
Test: manual
Change-Id: Ic3b07e82092a9100aea89263a1175d9fe2284382
This commit is contained in:
Jeff Sharkey
2019-02-20 14:20:58 -07:00
parent ef5a6c92a5
commit 3805e94129

View File

@@ -642,10 +642,16 @@ 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, MEDIA_AURAL_PERMISSIONS);
SENSORS_PERMISSIONS, STORAGE_PERMISSIONS, storageWorkaround);
grantSystemFixedPermissionsToSystemPackage(packageName, userId,
LOCATION_PERMISSIONS, ACTIVITY_RECOGNITION_PERMISSIONS);
}