summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Arc Wang <arcwang@google.com> 2022-12-09 02:12:08 +0000
committer Arc Wang <arcwang@google.com> 2022-12-09 02:12:08 +0000
commit2616b20e7a32e197f93ff42e731b279fbff51835 (patch)
tree606dca41e81bc91d79741b7f2432e6b1641a8c4f
parent7527f61d86bcec324b26c835a922094721c286f4 (diff)
Revert "Fixing Storage Volume(s) Retrieval."
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: Ia8b8b4f35bf9bdfe7eefa36372ae3525dc405e53
-rw-r--r--services/core/java/com/android/server/StorageManagerService.java23
1 files changed, 9 insertions, 14 deletions
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index 8a429331f766..c4333d96f92e 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -3813,13 +3813,6 @@ class StorageManagerService extends IStorageManager.Stub
final boolean includeSharedProfile =
(flags & StorageManager.FLAG_INCLUDE_SHARED_PROFILE) != 0;
- // When the caller is the app actually hosting external storage, we
- // should never attempt to augment the actual storage volume state,
- // otherwise we risk confusing it with race conditions as users go
- // through various unlocked states
- final boolean callerIsMediaStore = UserHandle.isSameApp(callingUid,
- mMediaStoreAuthorityAppId);
-
// Only Apps with MANAGE_EXTERNAL_STORAGE should call the API with includeSharedProfile
if (includeSharedProfile) {
try {
@@ -3832,13 +3825,8 @@ class StorageManagerService extends IStorageManager.Stub
// Checking first entry in packagesFromUid is enough as using "sharedUserId"
// mechanism is rare and discouraged. Also, Apps that share same UID share the same
// permissions.
- // Allowing Media Provider is an exception, Media Provider process should be allowed
- // to query users across profiles, even without MANAGE_EXTERNAL_STORAGE access.
- // Note that ordinarily Media provider process has the above permission, but if they
- // are revoked, Storage Volume(s) should still be returned.
- if (!callerIsMediaStore
- && !mStorageManagerInternal.hasExternalStorageAccess(callingUid,
- packagesFromUid[0])) {
+ if (!mStorageManagerInternal.hasExternalStorageAccess(callingUid,
+ packagesFromUid[0])) {
throw new SecurityException("Only File Manager Apps permitted");
}
} catch (RemoteException re) {
@@ -3851,6 +3839,13 @@ class StorageManagerService extends IStorageManager.Stub
// point
final boolean systemUserUnlocked = isSystemUnlocked(UserHandle.USER_SYSTEM);
+ // When the caller is the app actually hosting external storage, we
+ // should never attempt to augment the actual storage volume state,
+ // otherwise we risk confusing it with race conditions as users go
+ // through various unlocked states
+ final boolean callerIsMediaStore = UserHandle.isSameApp(callingUid,
+ mMediaStoreAuthorityAppId);
+
final boolean userIsDemo;
final boolean userKeyUnlocked;
final boolean storagePermission;