Merge "Fixing Storage Volume(s) Retrieval." into tm-qpr-dev am: 7527f61d86
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20582336 Change-Id: I951ee4b1ce79fe0159ee2b5dd359b30c981edd6e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -3757,6 +3757,13 @@ class StorageManagerService extends IStorageManager.Stub
|
|||||||
final boolean includeSharedProfile =
|
final boolean includeSharedProfile =
|
||||||
(flags & StorageManager.FLAG_INCLUDE_SHARED_PROFILE) != 0;
|
(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
|
// Only Apps with MANAGE_EXTERNAL_STORAGE should call the API with includeSharedProfile
|
||||||
if (includeSharedProfile) {
|
if (includeSharedProfile) {
|
||||||
try {
|
try {
|
||||||
@@ -3769,7 +3776,12 @@ class StorageManagerService extends IStorageManager.Stub
|
|||||||
// Checking first entry in packagesFromUid is enough as using "sharedUserId"
|
// Checking first entry in packagesFromUid is enough as using "sharedUserId"
|
||||||
// mechanism is rare and discouraged. Also, Apps that share same UID share the same
|
// mechanism is rare and discouraged. Also, Apps that share same UID share the same
|
||||||
// permissions.
|
// permissions.
|
||||||
if (!mStorageManagerInternal.hasExternalStorageAccess(callingUid,
|
// 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])) {
|
packagesFromUid[0])) {
|
||||||
throw new SecurityException("Only File Manager Apps permitted");
|
throw new SecurityException("Only File Manager Apps permitted");
|
||||||
}
|
}
|
||||||
@@ -3783,13 +3795,6 @@ class StorageManagerService extends IStorageManager.Stub
|
|||||||
// point
|
// point
|
||||||
final boolean systemUserUnlocked = isSystemUnlocked(UserHandle.USER_SYSTEM);
|
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 userIsDemo;
|
||||||
final boolean userKeyUnlocked;
|
final boolean userKeyUnlocked;
|
||||||
final boolean storagePermission;
|
final boolean storagePermission;
|
||||||
|
|||||||
Reference in New Issue
Block a user