diff options
author | Martijn Coenen <maco@google.com> | 2019-12-03 16:06:19 +0100 |
---|---|---|
committer | Martijn Coenen <maco@google.com> | 2019-12-03 16:09:14 +0100 |
commit | 44db1aca43ebb02b04b46cca2e5c09e0ff025c7f (patch) | |
tree | 040c6c9a736da34398a037e467752088b295024e | |
parent | ed4645763c2a2a41ce9f0bea7e1a110624b4afcd (diff) |
Determine pass_through mount mode based on UID.
We previously using the packagename, but if we start the media process
for another package (eg DownloadProvider, which is hosted in the same
process), then the packagename won't match, and we would mount the FUSE
mount instead.
Bug: 13789012
Test: atest AdoptableHostTest
Change-Id: I9b5fea07f3620b28595274a264f96d9f891f6715
-rw-r--r-- | services/core/java/com/android/server/StorageManagerService.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java index a4bc3bd9101c..3c296ea8bff4 100644 --- a/services/core/java/com/android/server/StorageManagerService.java +++ b/services/core/java/com/android/server/StorageManagerService.java @@ -354,8 +354,7 @@ class StorageManagerService extends IStorageManager.Stub @GuardedBy("mLock") private String mMoveTargetUuid; - @Nullable - private volatile String mMediaStoreAuthorityPackageName = null; + private volatile int mMediaStoreAuthorityAppId = -1; private volatile int mCurrentUserId = UserHandle.USER_SYSTEM; @@ -1697,7 +1696,7 @@ class StorageManagerService extends IStorageManager.Stub | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, UserHandle.getUserId(UserHandle.USER_SYSTEM)); if (provider != null) { - mMediaStoreAuthorityPackageName = provider.packageName; + mMediaStoreAuthorityAppId = UserHandle.getAppId(provider.applicationInfo.uid); } try { @@ -3724,8 +3723,10 @@ class StorageManagerService extends IStorageManager.Stub return Zygote.MOUNT_EXTERNAL_NONE; } - if (mIsFuseEnabled && packageName.equals(mMediaStoreAuthorityPackageName)) { - // Determine if caller requires pass_through mount + if (mIsFuseEnabled && mMediaStoreAuthorityAppId == UserHandle.getAppId(uid)) { + // Determine if caller requires pass_through mount; note that we do this for + // all processes that share a UID with MediaProvider; but this is fine, since + // those processes anyway share the same rights as MediaProvider. return Zygote.MOUNT_EXTERNAL_PASS_THROUGH; } |