Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34849c22 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Public volumes belong to a single user." into mnc-dev

parents 8c94179f 3a062a67
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -134,7 +134,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 {
+8 −1
Original line number Diff line number Diff line
@@ -168,6 +168,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);
@@ -1183,7 +1190,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) {