Loading services/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -235,7 +235,7 @@ public final class ActivityManagerService extends ActivityManagerNative static final boolean DEBUG_USER_LEAVING = localLOGV || false; static final boolean DEBUG_USER_LEAVING = localLOGV || false; static final boolean DEBUG_VISBILITY = localLOGV || false; static final boolean DEBUG_VISBILITY = localLOGV || false; static final boolean DEBUG_PSS = 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 VALIDATE_TOKENS = true; static final boolean SHOW_ACTIVITY_START_TIME = true; static final boolean SHOW_ACTIVITY_START_TIME = true; Loading services/java/com/android/server/wm/WindowManagerService.java +41 −11 Original line number Original line Diff line number Diff line Loading @@ -255,6 +255,9 @@ public class WindowManagerService extends IWindowManager.Stub /** Amount of time (in milliseconds) to delay before declaring a window freeze timeout. */ /** Amount of time (in milliseconds) to delay before declaring a window freeze timeout. */ static final int WINDOW_FREEZE_TIMEOUT_DURATION = 2000; 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 * If true, the window manager will do its own custom freezing and general * management of the screen during rotation. * management of the screen during rotation. Loading Loading @@ -2256,6 +2259,8 @@ public class WindowManagerService extends IWindowManager.Stub token.appWindowToken.startingWindow = win; token.appWindowToken.startingWindow = win; if (DEBUG_STARTING_WINDOW) Slog.v (TAG, "addWindow: " + token.appWindowToken if (DEBUG_STARTING_WINDOW) Slog.v (TAG, "addWindow: " + token.appWindowToken + " startingWindow=" + win); + " startingWindow=" + win); Message m = mH.obtainMessage(H.REMOVE_STARTING_TIMEOUT, token.appWindowToken); mH.sendMessageDelayed(m, STARTING_WINDOW_TIMEOUT_DURATION); } } boolean imMayMove = true; boolean imMayMove = true; Loading Loading @@ -2356,6 +2361,10 @@ public class WindowManagerService extends IWindowManager.Stub } } public void removeWindowLocked(Session session, WindowState win) { 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( if (localLOGV || DEBUG_FOCUS || DEBUG_FOCUS_LIGHT && win==mCurrentFocus) Slog.v( TAG, "Remove " + win + " client=" TAG, "Remove " + win + " client=" Loading Loading @@ -2498,6 +2507,7 @@ public class WindowManagerService extends IWindowManager.Stub if (atoken != null) { if (atoken != null) { if (atoken.startingWindow == win) { if (atoken.startingWindow == win) { if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Nulling startingWindow " + win); if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Nulling startingWindow " + win); removeStartingWindowTimeout(atoken); atoken.startingWindow = null; atoken.startingWindow = null; } else if (atoken.allAppWindows.size() == 0 && atoken.startingData != null) { } else if (atoken.allAppWindows.size() == 0 && atoken.startingData != null) { // If this is the last window and we had requested a starting // If this is the last window and we had requested a starting Loading @@ -2507,12 +2517,7 @@ public class WindowManagerService extends IWindowManager.Stub } else if (atoken.allAppWindows.size() == 1 && atoken.startingView != null) { } else if (atoken.allAppWindows.size() == 1 && atoken.startingView != null) { // If this is the last window except for a starting transition // If this is the last window except for a starting transition // window, we need to get rid of the starting transition. // window, we need to get rid of the starting transition. if (DEBUG_STARTING_WINDOW) { scheduleRemoveStartingWindow(atoken); Slog.v(TAG, "Schedule remove starting " + token + ": no more real windows"); } Message m = mH.obtainMessage(H.REMOVE_STARTING, atoken); mH.sendMessage(m); } } } } Loading Loading @@ -3964,6 +3969,7 @@ public class WindowManagerService extends IWindowManager.Stub if (DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE || DEBUG_STARTING_WINDOW) { if (DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE || DEBUG_STARTING_WINDOW) { Slog.v(TAG, "Removing starting window: " + startingWindow); Slog.v(TAG, "Removing starting window: " + startingWindow); } } removeStartingWindowTimeout(ttoken); startingWindow.getWindowList().remove(startingWindow); startingWindow.getWindowList().remove(startingWindow); mWindowsChanged = true; mWindowsChanged = true; if (DEBUG_ADD_REMOVE) Slog.v(TAG, if (DEBUG_ADD_REMOVE) Slog.v(TAG, Loading Loading @@ -4527,14 +4533,29 @@ public class WindowManagerService extends IWindowManager.Stub } } Binder.restoreCallingIdentity(origId); Binder.restoreCallingIdentity(origId); if (startingToken != null) { // Will only remove if startingToken non null. if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Schedule remove starting " scheduleRemoveStartingWindow(startingToken); + startingToken + ": app token removed"); } Message m = mH.obtainMessage(H.REMOVE_STARTING, startingToken); mH.sendMessage(m); 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) { private boolean tmpRemoveAppWindowsLocked(WindowToken token) { final int NW = token.windows.size(); final int NW = token.windows.size(); if (NW > 0) { if (NW > 0) { Loading Loading @@ -7053,6 +7074,8 @@ public class WindowManagerService extends IWindowManager.Stub public static final int TAP_OUTSIDE_STACK = 31; public static final int TAP_OUTSIDE_STACK = 31; public static final int NOTIFY_ACTIVITY_DRAWN = 32; public static final int NOTIFY_ACTIVITY_DRAWN = 32; public static final int REMOVE_STARTING_TIMEOUT = 33; @Override @Override public void handleMessage(Message msg) { public void handleMessage(Message msg) { if (DEBUG_WINDOW_TRACE) { if (DEBUG_WINDOW_TRACE) { Loading Loading @@ -7151,6 +7174,7 @@ public class WindowManagerService extends IWindowManager.Stub "Aborted starting " + wtoken "Aborted starting " + wtoken + ": removed=" + wtoken.removed + ": removed=" + wtoken.removed + " startingData=" + wtoken.startingData); + " startingData=" + wtoken.startingData); removeStartingWindowTimeout(wtoken); wtoken.startingWindow = null; wtoken.startingWindow = null; wtoken.startingData = null; wtoken.startingData = null; abort = true; abort = true; Loading @@ -7175,6 +7199,11 @@ public class WindowManagerService extends IWindowManager.Stub } } } break; } break; case REMOVE_STARTING_TIMEOUT: { final AppWindowToken wtoken = (AppWindowToken)msg.obj; Slog.e(TAG, "Starting window " + wtoken + " timed out"); // Fall through. } case REMOVE_STARTING: { case REMOVE_STARTING: { final AppWindowToken wtoken = (AppWindowToken)msg.obj; final AppWindowToken wtoken = (AppWindowToken)msg.obj; IBinder token = null; IBinder token = null; Loading Loading @@ -9676,6 +9705,7 @@ public class WindowManagerService extends IWindowManager.Stub winAnimator.mSurfaceShown = false; winAnimator.mSurfaceShown = false; winAnimator.mSurfaceControl = null; winAnimator.mSurfaceControl = null; winAnimator.mWin.mHasSurface = false; winAnimator.mWin.mHasSurface = false; scheduleRemoveStartingWindow(winAnimator.mWin.mAppToken); } } try { try { Loading Loading
services/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -235,7 +235,7 @@ public final class ActivityManagerService extends ActivityManagerNative static final boolean DEBUG_USER_LEAVING = localLOGV || false; static final boolean DEBUG_USER_LEAVING = localLOGV || false; static final boolean DEBUG_VISBILITY = localLOGV || false; static final boolean DEBUG_VISBILITY = localLOGV || false; static final boolean DEBUG_PSS = 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 VALIDATE_TOKENS = true; static final boolean SHOW_ACTIVITY_START_TIME = true; static final boolean SHOW_ACTIVITY_START_TIME = true; Loading
services/java/com/android/server/wm/WindowManagerService.java +41 −11 Original line number Original line Diff line number Diff line Loading @@ -255,6 +255,9 @@ public class WindowManagerService extends IWindowManager.Stub /** Amount of time (in milliseconds) to delay before declaring a window freeze timeout. */ /** Amount of time (in milliseconds) to delay before declaring a window freeze timeout. */ static final int WINDOW_FREEZE_TIMEOUT_DURATION = 2000; 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 * If true, the window manager will do its own custom freezing and general * management of the screen during rotation. * management of the screen during rotation. Loading Loading @@ -2256,6 +2259,8 @@ public class WindowManagerService extends IWindowManager.Stub token.appWindowToken.startingWindow = win; token.appWindowToken.startingWindow = win; if (DEBUG_STARTING_WINDOW) Slog.v (TAG, "addWindow: " + token.appWindowToken if (DEBUG_STARTING_WINDOW) Slog.v (TAG, "addWindow: " + token.appWindowToken + " startingWindow=" + win); + " startingWindow=" + win); Message m = mH.obtainMessage(H.REMOVE_STARTING_TIMEOUT, token.appWindowToken); mH.sendMessageDelayed(m, STARTING_WINDOW_TIMEOUT_DURATION); } } boolean imMayMove = true; boolean imMayMove = true; Loading Loading @@ -2356,6 +2361,10 @@ public class WindowManagerService extends IWindowManager.Stub } } public void removeWindowLocked(Session session, WindowState win) { 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( if (localLOGV || DEBUG_FOCUS || DEBUG_FOCUS_LIGHT && win==mCurrentFocus) Slog.v( TAG, "Remove " + win + " client=" TAG, "Remove " + win + " client=" Loading Loading @@ -2498,6 +2507,7 @@ public class WindowManagerService extends IWindowManager.Stub if (atoken != null) { if (atoken != null) { if (atoken.startingWindow == win) { if (atoken.startingWindow == win) { if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Nulling startingWindow " + win); if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Nulling startingWindow " + win); removeStartingWindowTimeout(atoken); atoken.startingWindow = null; atoken.startingWindow = null; } else if (atoken.allAppWindows.size() == 0 && atoken.startingData != null) { } else if (atoken.allAppWindows.size() == 0 && atoken.startingData != null) { // If this is the last window and we had requested a starting // If this is the last window and we had requested a starting Loading @@ -2507,12 +2517,7 @@ public class WindowManagerService extends IWindowManager.Stub } else if (atoken.allAppWindows.size() == 1 && atoken.startingView != null) { } else if (atoken.allAppWindows.size() == 1 && atoken.startingView != null) { // If this is the last window except for a starting transition // If this is the last window except for a starting transition // window, we need to get rid of the starting transition. // window, we need to get rid of the starting transition. if (DEBUG_STARTING_WINDOW) { scheduleRemoveStartingWindow(atoken); Slog.v(TAG, "Schedule remove starting " + token + ": no more real windows"); } Message m = mH.obtainMessage(H.REMOVE_STARTING, atoken); mH.sendMessage(m); } } } } Loading Loading @@ -3964,6 +3969,7 @@ public class WindowManagerService extends IWindowManager.Stub if (DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE || DEBUG_STARTING_WINDOW) { if (DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE || DEBUG_STARTING_WINDOW) { Slog.v(TAG, "Removing starting window: " + startingWindow); Slog.v(TAG, "Removing starting window: " + startingWindow); } } removeStartingWindowTimeout(ttoken); startingWindow.getWindowList().remove(startingWindow); startingWindow.getWindowList().remove(startingWindow); mWindowsChanged = true; mWindowsChanged = true; if (DEBUG_ADD_REMOVE) Slog.v(TAG, if (DEBUG_ADD_REMOVE) Slog.v(TAG, Loading Loading @@ -4527,14 +4533,29 @@ public class WindowManagerService extends IWindowManager.Stub } } Binder.restoreCallingIdentity(origId); Binder.restoreCallingIdentity(origId); if (startingToken != null) { // Will only remove if startingToken non null. if (DEBUG_STARTING_WINDOW) Slog.v(TAG, "Schedule remove starting " scheduleRemoveStartingWindow(startingToken); + startingToken + ": app token removed"); } Message m = mH.obtainMessage(H.REMOVE_STARTING, startingToken); mH.sendMessage(m); 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) { private boolean tmpRemoveAppWindowsLocked(WindowToken token) { final int NW = token.windows.size(); final int NW = token.windows.size(); if (NW > 0) { if (NW > 0) { Loading Loading @@ -7053,6 +7074,8 @@ public class WindowManagerService extends IWindowManager.Stub public static final int TAP_OUTSIDE_STACK = 31; public static final int TAP_OUTSIDE_STACK = 31; public static final int NOTIFY_ACTIVITY_DRAWN = 32; public static final int NOTIFY_ACTIVITY_DRAWN = 32; public static final int REMOVE_STARTING_TIMEOUT = 33; @Override @Override public void handleMessage(Message msg) { public void handleMessage(Message msg) { if (DEBUG_WINDOW_TRACE) { if (DEBUG_WINDOW_TRACE) { Loading Loading @@ -7151,6 +7174,7 @@ public class WindowManagerService extends IWindowManager.Stub "Aborted starting " + wtoken "Aborted starting " + wtoken + ": removed=" + wtoken.removed + ": removed=" + wtoken.removed + " startingData=" + wtoken.startingData); + " startingData=" + wtoken.startingData); removeStartingWindowTimeout(wtoken); wtoken.startingWindow = null; wtoken.startingWindow = null; wtoken.startingData = null; wtoken.startingData = null; abort = true; abort = true; Loading @@ -7175,6 +7199,11 @@ public class WindowManagerService extends IWindowManager.Stub } } } break; } break; case REMOVE_STARTING_TIMEOUT: { final AppWindowToken wtoken = (AppWindowToken)msg.obj; Slog.e(TAG, "Starting window " + wtoken + " timed out"); // Fall through. } case REMOVE_STARTING: { case REMOVE_STARTING: { final AppWindowToken wtoken = (AppWindowToken)msg.obj; final AppWindowToken wtoken = (AppWindowToken)msg.obj; IBinder token = null; IBinder token = null; Loading Loading @@ -9676,6 +9705,7 @@ public class WindowManagerService extends IWindowManager.Stub winAnimator.mSurfaceShown = false; winAnimator.mSurfaceShown = false; winAnimator.mSurfaceControl = null; winAnimator.mSurfaceControl = null; winAnimator.mWin.mHasSurface = false; winAnimator.mWin.mHasSurface = false; scheduleRemoveStartingWindow(winAnimator.mWin.mAppToken); } } try { try { Loading