summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java3
-rw-r--r--services/core/java/com/android/server/MountService.java9
2 files changed, 10 insertions, 2 deletions
diff --git a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
index 46b73d8..f72832a 100644
--- a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
+++ b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
@@ -135,7 +135,8 @@ public class ExternalStorageProvider extends DocumentsProvider {
final VolumeInfo privateVol = mStorageManager.findPrivateForEmulated(volume);
title = mStorageManager.getBestVolumeDescription(privateVol);
}
- } else if (volume.getType() == VolumeInfo.TYPE_PUBLIC) {
+ } else if (volume.getType() == VolumeInfo.TYPE_PUBLIC
+ && volume.getMountUserId() == userId) {
rootId = volume.getFsUuid();
title = mStorageManager.getBestVolumeDescription(volume);
} else {
diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java
index d539201..60d7428 100644
--- a/services/core/java/com/android/server/MountService.java
+++ b/services/core/java/com/android/server/MountService.java
@@ -169,6 +169,11 @@ class MountService extends IMountService.Stub
}
@Override
+ public void onSwitchUser(int userHandle) {
+ mMountService.mCurrentUserId = userHandle;
+ }
+
+ @Override
public void onStartUser(int userHandle) {
mMountService.onStartUser(userHandle);
}
@@ -307,6 +312,8 @@ class MountService extends IMountService.Stub
@GuardedBy("mLock")
private String mMoveTargetUuid;
+ private volatile int mCurrentUserId = UserHandle.USER_OWNER;
+
private VolumeInfo findVolumeByIdOrThrow(String id) {
synchronized (mLock) {
final VolumeInfo vol = mVolumes.get(id);
@@ -1193,7 +1200,7 @@ class MountService extends IMountService.Stub
vol.mountFlags |= VolumeInfo.MOUNT_FLAG_VISIBLE;
}
- vol.mountUserId = UserHandle.USER_OWNER;
+ vol.mountUserId = mCurrentUserId;
mHandler.obtainMessage(H_VOLUME_MOUNT, vol).sendToTarget();
} else if (vol.type == VolumeInfo.TYPE_PRIVATE) {