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

Commit efd1f124 authored by yuanhuihui's avatar yuanhuihui
Browse files

fixes mStartedUsers shoule be locked by mLock, not mVolumes

when create/delete multiple user, plug/unplug externel storage(such as sdcard) at the same time.
multiple threads run concurrency , the newly created user can not get state of externel storage.

https://code.google.com/p/android/issues/detail?id=215901



Change-Id: I097f5291108af89a430e12045376065d71d48175
Signed-off-by: default avataryuanhuihui <yuanhuihui@xiaomi.com>
parent f7c508ae
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -922,7 +922,7 @@ class MountService extends IMountService.Stub

        // Record user as started so newly mounted volumes kick off events
        // correctly, then synthesize events for any already-mounted volumes.
        synchronized (mVolumes) {
        synchronized (mLock) {
            for (int i = 0; i < mVolumes.size(); i++) {
                final VolumeInfo vol = mVolumes.valueAt(i);
                if (vol.isVisibleForRead(userId) && vol.isMountedReadable()) {
@@ -945,7 +945,7 @@ class MountService extends IMountService.Stub
        } catch (NativeDaemonConnectorException ignored) {
        }

        synchronized (mVolumes) {
        synchronized (mLock) {
            mSystemUnlockedUsers = ArrayUtils.removeInt(mSystemUnlockedUsers, userId);
        }
    }