From a1767a290a9325047908414a17d055d421f103a8 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Sat, 5 Jan 2019 12:59:04 -0700 Subject: [PATCH] Grant/revoke legacy "Storage" permissions. The new isolated storage model we're building in Q introduces new strongly-typed media permissions which replace the broad "Storage" runtime permission. That legacy "Storage" permission is marked as being "removed", and it also splits into the new media permissions, but apps are confused when they request the "Storage" permission, which no longer appears as granted when the user accepts the new split media permissions. After discussing with the permissions team, the best short-term solution is to add special-case logic that grants the legacy permissions when *any* of the new media permissions have also been granted. Only when the user revokes *all* of the new media permissions is the legacy permission then revoked. (MediaProvider is already internally filtering the relevant content based on what new media permissions the caller holds.) Bug: 121227859 Test: manual Change-Id: Ic87f7f93a816e91f7189509386255a260378c255 --- api/system-current.txt | 1 + core/java/android/os/storage/StorageManager.java | 1 + 2 files changed, 2 insertions(+) diff --git a/api/system-current.txt b/api/system-current.txt index 05aa0ad43bf3d..e79ede8dc9b71 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -4588,6 +4588,7 @@ package android.os.storage { method public void allocateBytes(java.util.UUID, long, int) throws java.io.IOException; method public void allocateBytes(java.io.FileDescriptor, long, int) throws java.io.IOException; method public long getAllocatableBytes(java.util.UUID, int) throws java.io.IOException; + method public static boolean hasIsolatedStorage(); field public static final int FLAG_ALLOCATE_AGGRESSIVE = 1; // 0x1 } diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java index 9594a713a5062..735f4f253594f 100644 --- a/core/java/android/os/storage/StorageManager.java +++ b/core/java/android/os/storage/StorageManager.java @@ -1540,6 +1540,7 @@ public class StorageManager { } /** {@hide} */ + @SystemApi @TestApi public static boolean hasIsolatedStorage() { // Prefer to use snapshot for current boot when available