am 7f3a53a4: am 7b69e401: Merge "Fix starting window memory leak"

* commit '7f3a53a447d40db36f8f0c2b4c8c7305c5dd4429':
  Fix starting window memory leak
This commit is contained in:
Dianne Hackborn
2013-02-27 20:09:27 +00:00
committed by Android Git Automerger

View File

@@ -1500,6 +1500,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
@@ -1559,8 +1562,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
@@ -1590,6 +1593,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;