diff options
author | Dianne Hackborn <hackbod@android.com> | 2013-02-27 23:23:11 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-02-27 23:23:11 +0000 |
commit | 3ad6c2703f004fb36690a25e0294b406abb09290 (patch) | |
tree | 238bf343c3b65189983f476dc22542eb3667d850 /policy | |
parent | 47788d148efd15bd88a89fa55cbeb832b87ef402 (diff) | |
parent | c7288579c788c9c8863ec63561282a3e11006b65 (diff) | |
download | frameworks_base-3ad6c2703f004fb36690a25e0294b406abb09290.zip frameworks_base-3ad6c2703f004fb36690a25e0294b406abb09290.tar.gz frameworks_base-3ad6c2703f004fb36690a25e0294b406abb09290.tar.bz2 |
am c7288579: am 7f3a53a4: am 7b69e401: Merge "Fix starting window memory leak"
* commit 'c7288579c788c9c8863ec63561282a3e11006b65':
Fix starting window memory leak
Diffstat (limited to 'policy')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 9f62f6a..940ec28 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -1503,6 +1503,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { return null; } + WindowManager wm = null; + View view = null; + try { Context context = mContext; if (DEBUG_STARTING_WINDOW) Slog.d(TAG, "addStartingWindow " + packageName @@ -1562,8 +1565,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS; params.setTitle("Starting " + packageName); - WindowManager wm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); - View view = win.getDecorView(); + wm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); + view = win.getDecorView(); if (win.isFloating()) { // Whoops, there is no way to display an animation/preview @@ -1593,6 +1596,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { // failure loading resources because we are loading from an app // on external storage that has been unmounted. Log.w(TAG, appToken + " failed creating starting window", e); + } finally { + if (view != null && view.getParent() == null) { + Log.w(TAG, "view not successfully added to wm, removing view"); + wm.removeViewImmediate(view); + } } return null; |