summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorMathias Jeppsson <mathias.jeppsson@sonymobile.com>2012-08-24 15:25:32 +0200
committerGerrit Code Review <gerrit@cyanogenmod.org>2013-02-27 21:45:30 -0800
commit8a73bce7a4f54e1f138ac04f7d3577fe4b5fc4f9 (patch)
tree468e4eb2c77cfb60691315729091b71f2f55c317 /policy
parent8dc6fca96701e57d349f4d59d6035a13b1ced1a8 (diff)
downloadframeworks_base-8a73bce7a4f54e1f138ac04f7d3577fe4b5fc4f9.zip
frameworks_base-8a73bce7a4f54e1f138ac04f7d3577fe4b5fc4f9.tar.gz
frameworks_base-8a73bce7a4f54e1f138ac04f7d3577fe4b5fc4f9.tar.bz2
Framework: AOSP Fix - starting window memory leak
If starting window is added to arrays like mViews in WindowManagerImpl.java, but not accepted by WindowManagerService, we leak starting windows. To avoid leaking, remove the view from WindowManager. Change-Id: I4d98b883e9dfaf5e71bdece385643ba1b59b2633
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindowManager.java12
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 abc9223..0504b6d 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1895,6 +1895,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
@@ -1957,8 +1960,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
@@ -1988,6 +1991,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;