summaryrefslogtreecommitdiff
path: root/packages/ExternalStorageProvider
diff options
context:
space:
mode:
authorZim <zezeozue@google.com>2019-09-25 14:37:55 +0100
committerZim <zezeozue@google.com>2019-11-12 16:40:39 +0000
commit17be6f999bfee954d2b03a193858556476b8d2c5 (patch)
tree3c80c0096cf67c4b49b1fd93e89245de961d1ab0 /packages/ExternalStorageProvider
parentb814d6b3179c24849c4243a94d4742b1e90e40da (diff)
Fix multi-user and multi-storage with FUSE
Up until now, the FUSE mount logic has made two assumptions: 1. The primary external volume is an emulated volume on /data/media 2. Only the primary user is running, as user zero With this change, we are able to handle the following cases: 1. Mount new external storage volumes as as portable storage (PublicVolume) managed by FUSE. The PublicVolume originally mounted on /mnt/media_rw/<uuid> is availabe on /storage/<uuid> as a FUSE mount 2. Mount new external storage volumes as adoptable storage (PrivateVolume) with a stacked EmulatedVolume managed by FUSE. The EmulatedVolume orignally mounted on /mnt/expand/<uuid>/media will be available on /storage/emulated if set as the primary storage 3. Run the MediaProvider as a secondary user handling requests on /mnt/user/<userid>/<volid> Test: atest AdoptableHostTest Bug: 135341433 Bug: 140120303 Change-Id: I5fb48616b4143277ea14c6846037e2fd176e16db
Diffstat (limited to 'packages/ExternalStorageProvider')
-rw-r--r--packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
index af96982f5426..4a50210d1a60 100644
--- a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
+++ b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
@@ -162,12 +162,12 @@ public class ExternalStorageProvider extends FileSystemProvider {
final String title;
final UUID storageUuid;
if (volume.getType() == VolumeInfo.TYPE_EMULATED) {
- // We currently only support a single emulated volume mounted at
+ // We currently only support a single emulated volume per user mounted at
// a time, and it's always considered the primary
if (DEBUG) Log.d(TAG, "Found primary volume: " + volume);
rootId = ROOT_ID_PRIMARY_EMULATED;
- if (VolumeInfo.ID_EMULATED_INTERNAL.equals(volume.getId())) {
+ if (volume.isPrimaryEmulatedForUser(userId)) {
// This is basically the user's primary device storage.
// Use device name for the volume since this is likely same thing
// the user sees when they mount their phone on another device.