diff options
author | Kenny Root <kroot@google.com> | 2010-09-15 16:32:45 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-09-15 16:32:45 -0700 |
commit | 6545fcfd9642860389619dd5c83f6e6bfd455e5b (patch) | |
tree | 859f7af9dbefd5013404d61fb24df24ef672fc93 | |
parent | e28d80a80a6806b5550139b9ea8c25a90d01a379 (diff) | |
parent | 79a1ee4249aadc84558dad2e275b8edde198da76 (diff) | |
download | frameworks_base-6545fcfd9642860389619dd5c83f6e6bfd455e5b.zip frameworks_base-6545fcfd9642860389619dd5c83f6e6bfd455e5b.tar.gz frameworks_base-6545fcfd9642860389619dd5c83f6e6bfd455e5b.tar.bz2 |
am 79a1ee42: am cee0b97e: Merge "Free AssetManager weak refs before unmounting" into gingerbread
Merge commit '79a1ee4249aadc84558dad2e275b8edde198da76'
* commit '79a1ee4249aadc84558dad2e275b8edde198da76':
Free AssetManager weak refs before unmounting
-rw-r--r-- | services/java/com/android/server/MountService.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java index c07007a..32f5e73 100644 --- a/services/java/com/android/server/MountService.java +++ b/services/java/com/android/server/MountService.java @@ -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 { |