Fix volumes registered in ExternalStorageProvider
Now that emulated volumes are per user, ESP should not register any volume that does not match it's running user. Bug: 144936488 Test: On device with secondary user, Files > Show internal storage displays "internal storage" Change-Id: If4820c684a0a8ef52cc97ae9087b1a0884f9cee7
This commit is contained in:
@@ -160,7 +160,7 @@ public class ExternalStorageProvider extends FileSystemProvider {
|
||||
final int userId = UserHandle.myUserId();
|
||||
final List<VolumeInfo> volumes = mStorageManager.getVolumes();
|
||||
for (VolumeInfo volume : volumes) {
|
||||
if (!volume.isMountedReadable()) continue;
|
||||
if (!volume.isMountedReadable() || volume.getMountUserId() != userId) continue;
|
||||
|
||||
final String rootId;
|
||||
final String title;
|
||||
@@ -192,9 +192,8 @@ public class ExternalStorageProvider extends FileSystemProvider {
|
||||
title = mStorageManager.getBestVolumeDescription(privateVol);
|
||||
storageUuid = StorageManager.convert(privateVol.fsUuid);
|
||||
}
|
||||
} else if ((volume.getType() == VolumeInfo.TYPE_PUBLIC
|
||||
|| volume.getType() == VolumeInfo.TYPE_STUB)
|
||||
&& volume.getMountUserId() == userId) {
|
||||
} else if (volume.getType() == VolumeInfo.TYPE_PUBLIC
|
||||
|| volume.getType() == VolumeInfo.TYPE_STUB) {
|
||||
rootId = volume.getFsUuid();
|
||||
title = mStorageManager.getBestVolumeDescription(volume);
|
||||
storageUuid = null;
|
||||
|
||||
Reference in New Issue
Block a user