diff options
author | Craig Mautner <cmautner@google.com> | 2013-10-01 20:35:01 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-10-01 20:35:01 +0000 |
commit | 3c98926bf2105571a149d810a52461e01e5e7cdb (patch) | |
tree | cca42e01bf1aa02423377bd3147247e677e1e1e9 /services/java/com | |
parent | f079a6d07f64045526a094077a1e9f4ceb40da76 (diff) | |
parent | 68cc241e8dca1ba20c2004afceac428d1aec31ef (diff) | |
download | frameworks_base-3c98926bf2105571a149d810a52461e01e5e7cdb.zip frameworks_base-3c98926bf2105571a149d810a52461e01e5e7cdb.tar.gz frameworks_base-3c98926bf2105571a149d810a52461e01e5e7cdb.tar.bz2 |
Merge "Add a timeout for removing starting windows." into klp-dev
Diffstat (limited to 'services/java/com')
-rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 2 | ||||
-rw-r--r-- | services/java/com/android/server/wm/WindowManagerService.java | 52 |
2 files changed, 42 insertions, 12 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index dc915c6..c1ac7d5 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -235,7 +235,7 @@ public final class ActivityManagerService extends ActivityManagerNative static final boolean DEBUG_USER_LEAVING = localLOGV || false; static final boolean DEBUG_VISBILITY = localLOGV || false; static final boolean DEBUG_PSS = localLOGV || false; - static final boolean DEBUG_LOCKSCREEN = localLOGV || true; + static final boolean DEBUG_LOCKSCREEN = localLOGV || false; static final boolean VALIDATE_TOKENS = true; static final boolean SHOW_ACTIVITY_START_TIME = true; diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 80c50cc..e6b0531 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -255,6 +255,9 @@ public class WindowManagerService extends IWindowManager.Stub /** Amount of time (in milliseconds) to delay before declaring a window freeze timeout. */ static final int WINDOW_FREEZE_TIMEOUT_DURATION = 2000; + /** Amount of time (in milliseconds) to delay before declaring a starting window leaked. */ + static final int STARTING_WINDOW_TIMEOUT_DURATION = 10000; + /** * If true, the window manager will do its own custom freezing and general * management of the screen during rotation. @@ -2256,6 +2259,8 @@ public class WindowManagerService extends IWindowManager.Stub token.appWindowToken.startingWindow = win; if (DEBUG_STARTING_WINDOW) Slog.v (TAG, "addWindow: " + token.appWindowToken + " startingWindow=" + win); + Message m = mH.obtainMessage(H.REMOVE_STARTING_TIMEOUT, token.appWindowToken); + mH.sendMessageDelayed(m, STARTING_WINDOW_TIMEOUT_DURATION); } boolean imMayMove = true; @@ -2356,6 +2361,10 @@ public class WindowManagerService extends IWindowManager.Stub } public void removeWindowLocked(Session session, WindowState win) { + if (win.mAttrs.type == TYPE_APPLICATION_STARTING) { + if (DEBUG_STARTING_WINDOW) Slog.d(TAG, "Starting window removed " + win); + removeStartingWindowTimeout(win.mAppToken); + } if (localLOGV || DEBUG_FOCUS || DEBUG_FOCUS_LIGHT && win==mCurrentFocus) Slog.v( TAG, "Remove " + win + " client=" @@ -2498,6 +2507,7 @@ public class WindowManagerService extends IWindowManager.Stub if (atoken != null) { if (atoken.startingWindow == win) { if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Nulling startingWindow " + win); + removeStartingWindowTimeout(atoken); atoken.startingWindow = null; } else if (atoken.allAppWindows.size() == 0 && atoken.startingData != null) { // If this is the last window and we had requested a starting @@ -2507,12 +2517,7 @@ public class WindowManagerService extends IWindowManager.Stub } else if (atoken.allAppWindows.size() == 1 && atoken.startingView != null) { // If this is the last window except for a starting transition // window, we need to get rid of the starting transition. - if (DEBUG_STARTING_WINDOW) { - Slog.v(TAG, "Schedule remove starting " + token - + ": no more real windows"); - } - Message m = mH.obtainMessage(H.REMOVE_STARTING, atoken); - mH.sendMessage(m); + scheduleRemoveStartingWindow(atoken); } } @@ -3964,6 +3969,7 @@ public class WindowManagerService extends IWindowManager.Stub if (DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE || DEBUG_STARTING_WINDOW) { Slog.v(TAG, "Removing starting window: " + startingWindow); } + removeStartingWindowTimeout(ttoken); startingWindow.getWindowList().remove(startingWindow); mWindowsChanged = true; if (DEBUG_ADD_REMOVE) Slog.v(TAG, @@ -4527,14 +4533,29 @@ public class WindowManagerService extends IWindowManager.Stub } Binder.restoreCallingIdentity(origId); - if (startingToken != null) { - if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Schedule remove starting " - + startingToken + ": app token removed"); - Message m = mH.obtainMessage(H.REMOVE_STARTING, startingToken); - mH.sendMessage(m); + // Will only remove if startingToken non null. + scheduleRemoveStartingWindow(startingToken); + } + + void removeStartingWindowTimeout(AppWindowToken wtoken) { + if (wtoken != null) { + if (DEBUG_STARTING_WINDOW) Slog.v(TAG, Debug.getCallers(1) + + ": Remove starting window timeout " + wtoken + (wtoken != null ? + " startingWindow=" + wtoken.startingWindow : "")); + mH.removeMessages(H.REMOVE_STARTING_TIMEOUT, wtoken); } } + void scheduleRemoveStartingWindow(AppWindowToken wtoken) { + if (wtoken != null && wtoken.startingWindow != null) { + if (DEBUG_STARTING_WINDOW) Slog.v(TAG, Debug.getCallers(1) + + ": Schedule remove starting " + wtoken + (wtoken != null ? + " startingWindow=" + wtoken.startingWindow : "")); + removeStartingWindowTimeout(wtoken); + Message m = mH.obtainMessage(H.REMOVE_STARTING, wtoken); + mH.sendMessage(m); + } + } private boolean tmpRemoveAppWindowsLocked(WindowToken token) { final int NW = token.windows.size(); if (NW > 0) { @@ -7053,6 +7074,8 @@ public class WindowManagerService extends IWindowManager.Stub public static final int TAP_OUTSIDE_STACK = 31; public static final int NOTIFY_ACTIVITY_DRAWN = 32; + public static final int REMOVE_STARTING_TIMEOUT = 33; + @Override public void handleMessage(Message msg) { if (DEBUG_WINDOW_TRACE) { @@ -7151,6 +7174,7 @@ public class WindowManagerService extends IWindowManager.Stub "Aborted starting " + wtoken + ": removed=" + wtoken.removed + " startingData=" + wtoken.startingData); + removeStartingWindowTimeout(wtoken); wtoken.startingWindow = null; wtoken.startingData = null; abort = true; @@ -7175,6 +7199,11 @@ public class WindowManagerService extends IWindowManager.Stub } } break; + case REMOVE_STARTING_TIMEOUT: { + final AppWindowToken wtoken = (AppWindowToken)msg.obj; + Slog.e(TAG, "Starting window " + wtoken + " timed out"); + // Fall through. + } case REMOVE_STARTING: { final AppWindowToken wtoken = (AppWindowToken)msg.obj; IBinder token = null; @@ -9676,6 +9705,7 @@ public class WindowManagerService extends IWindowManager.Stub winAnimator.mSurfaceShown = false; winAnimator.mSurfaceControl = null; winAnimator.mWin.mHasSurface = false; + scheduleRemoveStartingWindow(winAnimator.mWin.mAppToken); } try { |