Clear calling identity when determining instant app status.

This requires INTERACT_ACROSS_USERS_FULL, which the current caller
(MediaProvider) lacks.

Bug: 199988018
Test: inspect logs
Change-Id: I4ef3494315b996473a0fb14b967ddaf62b5d7aa6
This commit is contained in:
Martijn Coenen
2021-09-27 15:45:22 +02:00
parent 12876ad8c0
commit 7c01c22c39

View File

@@ -4366,8 +4366,13 @@ class StorageManagerService extends IStorageManager.Stub
packageName = packagesForUid[0];
}
if (mPmInternal.isInstantApp(packageName, UserHandle.getUserId(uid))) {
return StorageManager.MOUNT_MODE_EXTERNAL_NONE;
final long token = Binder.clearCallingIdentity();
try {
if (mPmInternal.isInstantApp(packageName, UserHandle.getUserId(uid))) {
return StorageManager.MOUNT_MODE_EXTERNAL_NONE;
}
} finally {
Binder.restoreCallingIdentity(token);
}
if (mStorageManagerInternal.isExternalStorageService(uid)) {