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

Commit 6545fcfd authored by Kenny Root's avatar Kenny Root Committed by Android Git Automerger
Browse files

am 79a1ee42: am cee0b97e: Merge "Free AssetManager weak refs before unmounting" into gingerbread

Merge commit '79a1ee42'

* commit '79a1ee42':
  Free AssetManager weak refs before unmounting
parents e28d80a8 79a1ee42
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -832,6 +832,15 @@ class MountService extends IMountService.Stub
        if (!getVolumeState(path).equals(Environment.MEDIA_MOUNTED)) {
            return VoldResponseCode.OpFailedVolNotMounted;
        }

        /*
         * Force a GC to make sure AssetManagers in other threads of the
         * system_server are cleaned up. We have to do this since AssetManager
         * instances are kept as a WeakReference and it's possible we have files
         * open on the external storage.
         */
        Runtime.getRuntime().gc();

        // Redundant probably. But no harm in updating state again.
        mPms.updateExternalMediaStatus(false, false);
        try {
@@ -1290,6 +1299,14 @@ class MountService extends IMountService.Stub
        waitForReady();
        warnOnNotMounted();

        /*
         * Force a GC to make sure AssetManagers in other threads of the
         * system_server are cleaned up. We have to do this since AssetManager
         * instances are kept as a WeakReference and it's possible we have files
         * open on the external storage.
         */
        Runtime.getRuntime().gc();

        int rc = StorageResultCode.OperationSucceeded;
        try {
            mConnector.doCommand(String.format("asec destroy %s%s", id, (force ? " force" : "")));
@@ -1354,6 +1371,14 @@ class MountService extends IMountService.Stub
            }
         }

        /*
         * Force a GC to make sure AssetManagers in other threads of the
         * system_server are cleaned up. We have to do this since AssetManager
         * instances are kept as a WeakReference and it's possible we have files
         * open on the external storage.
         */
        Runtime.getRuntime().gc();

        int rc = StorageResultCode.OperationSucceeded;
        String cmd = String.format("asec unmount %s%s", id, (force ? " force" : ""));
        try {