From 4736afef809ff0241941eb0865e31093bf063c84 Mon Sep 17 00:00:00 2001 From: Arc Wang Date: Fri, 9 Dec 2022 02:12:08 +0000 Subject: [PATCH] Revert "Fixing Storage Volume listing for Cloned User." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Revert submission 20517233-Cloned User Storage Issue-tm-qpr-dev Reason for revert: “DroidMonitor: Potential culprit for Bug 261921307 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.” Reverted Changes: I6835cc4d2:Fixing Storage Volume(s) Retrieval. I617bae9b2:Fixing Storage Volume listing for Cloned User. Change-Id: I08722e8467fafa53ab914ec5de0380d2df62b55d --- core/api/system-current.txt | 2 +- core/java/android/os/storage/StorageManager.java | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index d3a726e15ae96..0126199add0c2 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -10003,7 +10003,7 @@ package android.os.storage { method @WorkerThread public long getAllocatableBytes(@NonNull java.util.UUID, @RequiresPermission int) throws java.io.IOException; method @RequiresPermission(android.Manifest.permission.WRITE_MEDIA_STORAGE) public int getExternalStorageMountMode(int, @NonNull String); method public static boolean hasIsolatedStorage(); - method @RequiresPermission(android.Manifest.permission.MANAGE_EXTERNAL_STORAGE) public void updateExternalStorageFileQuotaType(@NonNull java.io.File, int) throws java.io.IOException; + method public void updateExternalStorageFileQuotaType(@NonNull java.io.File, int) throws java.io.IOException; field @RequiresPermission(android.Manifest.permission.ALLOCATE_AGGRESSIVE) public static final int FLAG_ALLOCATE_AGGRESSIVE = 1; // 0x1 field public static final int MOUNT_MODE_EXTERNAL_ANDROID_WRITABLE = 4; // 0x4 field public static final int MOUNT_MODE_EXTERNAL_DEFAULT = 1; // 0x1 diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java index 5a7e697bdb476..497bfa6380bc1 100644 --- a/core/java/android/os/storage/StorageManager.java +++ b/core/java/android/os/storage/StorageManager.java @@ -2552,7 +2552,7 @@ public class StorageManager { * called on first creation of a new file on external storage, and whenever the * media type of the file is updated later. * - * This API requires MANAGE_EXTERNAL_STORAGE permission and typical implementations + * This API doesn't require any special permissions, though typical implementations * will require being called from an SELinux domain that allows setting file attributes * related to quota (eg the GID or project ID). * @@ -2571,16 +2571,11 @@ public class StorageManager { * @hide */ @SystemApi - @RequiresPermission(android.Manifest.permission.MANAGE_EXTERNAL_STORAGE) public void updateExternalStorageFileQuotaType(@NonNull File path, @QuotaType int quotaType) throws IOException { long projectId; final String filePath = path.getCanonicalPath(); - // MANAGE_EXTERNAL_STORAGE permission is required as FLAG_INCLUDE_SHARED_PROFILE is being - // set while querying getVolumeList. - final StorageVolume[] availableVolumes = getVolumeList(mContext.getUserId(), - FLAG_REAL_STATE | FLAG_INCLUDE_INVISIBLE | FLAG_INCLUDE_SHARED_PROFILE); - final StorageVolume volume = getStorageVolume(availableVolumes, path); + final StorageVolume volume = getStorageVolume(path); if (volume == null) { Log.w(TAG, "Failed to update quota type for " + filePath); return;