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

Commit b32a4e01 authored by Xiaogang Cui's avatar Xiaogang Cui Committed by Gerrit - the friendly Code Review server
Browse files

restrict updateExternalMediaStatus to non-emulated storage

The applications in emulated storage will be scaned by packageManager
Service. Only updateExternalMediaStatus for non-emulated storage to
avoid deadlock between MountService and PackageManager

Change-Id: I53c8d269c478256abb8e397c0c2b3271e29e2ec7
CRs-Fixed: 814188
parent cccc3f05
Loading
Loading
Loading
Loading
+15 −13
Original line number Diff line number Diff line
@@ -767,8 +767,9 @@ class MountService extends IMountService.Stub

        Slog.d(TAG, "volume state changed for " + path + " (" + oldState + " -> " + state + ")");

        // Tell PackageManager about changes, not only to primary volume,
        // to all the non-emulated storage volumes
        // Tell PackageManager about changes, only to the non-emulated
        // storage volumes.
        if (!volume.isEmulated()) {
            if (Environment.MEDIA_UNMOUNTED.equals(state)) {
                mPms.updateExternalMediaStatus(false, false);

@@ -782,6 +783,7 @@ class MountService extends IMountService.Stub
            } else if (Environment.MEDIA_MOUNTED.equals(state)) {
                mPms.updateExternalMediaStatus(true, false);
            }
        }

        synchronized (mListeners) {
            for (int i = mListeners.size() -1; i >= 0; i--) {