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

Commit 30def9e7 authored by Mohamed Abbas's avatar Mohamed Abbas Committed by Steve Kondik
Browse files

Make sure emulated storage path index is 0



MediaProvider blindly assumes that path index 0 of the array returned by
StorageManager::getVolumePaths() is the emulated storage.
However, this is not true when you have multiple users.
This patch modifies StorageVolume::getVolumeList(). to make sure that
assumption is always true.

Change-Id: I4650478274a87adfed91fe53097c1e47fb2f10c7
Signed-off-by: default avatarFernando Guzman Lugo <fernando.guzman.lugo@intel.com>
Signed-off-by: default avatarMohamed Abbas <mohamed.abbas@intel.com>
Signed-off-by: default avatarIrina Patru <irina.patru@intel.com>
Signed-off-by: default avatarYong Yao <yong.yao@intel.com>
parent 4e302a66
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -2554,9 +2554,13 @@ class MountService extends IMountService.Stub
                final UserHandle owner = volume.getOwner();
                final UserHandle owner = volume.getOwner();
                final boolean ownerMatch = owner == null || owner.getIdentifier() == callingUserId;
                final boolean ownerMatch = owner == null || owner.getIdentifier() == callingUserId;
                if (accessAll || ownerMatch) {
                if (accessAll || ownerMatch) {
                    if (!accessAll && volume.isEmulated()) {
                        filtered.add(0, volume);
                    } else {
                        filtered.add(volume);
                        filtered.add(volume);
                    }
                    }
                }
                }
            }
            return filtered.toArray(new StorageVolume[filtered.size()]);
            return filtered.toArray(new StorageVolume[filtered.size()]);
        }
        }
    }
    }