Public volumes belong to a single user.
am: 3a062a67fa
Change-Id: Ibe40a7985bde6ff6d8bc307c28b94f7b1445c961
This commit is contained in:
@@ -135,7 +135,8 @@ public class ExternalStorageProvider extends DocumentsProvider {
|
|||||||
final VolumeInfo privateVol = mStorageManager.findPrivateForEmulated(volume);
|
final VolumeInfo privateVol = mStorageManager.findPrivateForEmulated(volume);
|
||||||
title = mStorageManager.getBestVolumeDescription(privateVol);
|
title = mStorageManager.getBestVolumeDescription(privateVol);
|
||||||
}
|
}
|
||||||
} else if (volume.getType() == VolumeInfo.TYPE_PUBLIC) {
|
} else if (volume.getType() == VolumeInfo.TYPE_PUBLIC
|
||||||
|
&& volume.getMountUserId() == userId) {
|
||||||
rootId = volume.getFsUuid();
|
rootId = volume.getFsUuid();
|
||||||
title = mStorageManager.getBestVolumeDescription(volume);
|
title = mStorageManager.getBestVolumeDescription(volume);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -168,6 +168,11 @@ class MountService extends IMountService.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSwitchUser(int userHandle) {
|
||||||
|
mMountService.mCurrentUserId = userHandle;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStartUser(int userHandle) {
|
public void onStartUser(int userHandle) {
|
||||||
mMountService.onStartUser(userHandle);
|
mMountService.onStartUser(userHandle);
|
||||||
@@ -307,6 +312,8 @@ class MountService extends IMountService.Stub
|
|||||||
@GuardedBy("mLock")
|
@GuardedBy("mLock")
|
||||||
private String mMoveTargetUuid;
|
private String mMoveTargetUuid;
|
||||||
|
|
||||||
|
private volatile int mCurrentUserId = UserHandle.USER_OWNER;
|
||||||
|
|
||||||
private VolumeInfo findVolumeByIdOrThrow(String id) {
|
private VolumeInfo findVolumeByIdOrThrow(String id) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final VolumeInfo vol = mVolumes.get(id);
|
final VolumeInfo vol = mVolumes.get(id);
|
||||||
@@ -1189,7 +1196,7 @@ class MountService extends IMountService.Stub
|
|||||||
vol.mountFlags |= VolumeInfo.MOUNT_FLAG_VISIBLE;
|
vol.mountFlags |= VolumeInfo.MOUNT_FLAG_VISIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
vol.mountUserId = UserHandle.USER_OWNER;
|
vol.mountUserId = mCurrentUserId;
|
||||||
mHandler.obtainMessage(H_VOLUME_MOUNT, vol).sendToTarget();
|
mHandler.obtainMessage(H_VOLUME_MOUNT, vol).sendToTarget();
|
||||||
|
|
||||||
} else if (vol.type == VolumeInfo.TYPE_PRIVATE) {
|
} else if (vol.type == VolumeInfo.TYPE_PRIVATE) {
|
||||||
|
|||||||
Reference in New Issue
Block a user