Loading services/core/java/com/android/server/wm/DisplayContent.java +9 −5 Original line number Diff line number Diff line Loading @@ -379,12 +379,16 @@ class DisplayContent { pw.println(" Application tokens in top down Z order:"); int ndx = 0; for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) { ArrayList<Task> tasks = mStacks.get(stackNdx).getTasks(); final TaskStack stack = mStacks.get(stackNdx); pw.print(" mStackId="); pw.println(stack.mStackId); ArrayList<Task> tasks = stack.getTasks(); for (int taskNdx = tasks.size() - 1; taskNdx >= 0; --taskNdx) { AppTokenList tokens = tasks.get(taskNdx).mAppTokens; for (int tokenNdx = tokens.size() - 1; tokenNdx >= 0; --tokenNdx) { final Task task = tasks.get(taskNdx); pw.print(" mTaskId="); pw.println(task.taskId); AppTokenList tokens = task.mAppTokens; for (int tokenNdx = tokens.size() - 1; tokenNdx >= 0; --tokenNdx, ++ndx) { final AppWindowToken wtoken = tokens.get(tokenNdx); pw.print(" App #"); pw.print(ndx++); pw.print(" Activity #"); pw.print(tokenNdx); pw.print(' '); pw.print(wtoken); pw.println(":"); wtoken.dump(pw, " "); } Loading services/core/java/com/android/server/wm/WindowManagerService.java +20 −5 Original line number Diff line number Diff line Loading @@ -262,6 +262,8 @@ 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 to allow a last ANR message to exist before freeing the memory. */ static final int LAST_ANR_LIFETIME_DURATION_MSECS = 2 * 60 * 60 * 1000; // Two hours /** * If true, the window manager will do its own custom freezing and general * management of the screen during rotation. Loading Loading @@ -940,7 +942,7 @@ public class WindowManagerService extends IWindowManager.Stub private void placeWindowAfter(WindowState pos, WindowState window) { final WindowList windows = pos.getWindowList(); final int i = windows.indexOf(pos); if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v( if (true || DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v( TAG, "Adding window " + window + " at " + (i+1) + " of " + windows.size() + " (after " + pos + ")"); windows.add(i+1, window); Loading @@ -950,7 +952,7 @@ public class WindowManagerService extends IWindowManager.Stub private void placeWindowBefore(WindowState pos, WindowState window) { final WindowList windows = pos.getWindowList(); int i = windows.indexOf(pos); if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v( if (true || DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v( TAG, "Adding window " + window + " at " + i + " of " + windows.size() + " (before " + pos + ")"); if (i < 0) { Loading Loading @@ -1048,7 +1050,7 @@ public class WindowManagerService extends IWindowManager.Stub //apptoken note that the window could be a floating window //that was created later or a window at the top of the list of //windows associated with this token. if (DEBUG_FOCUS_LIGHT || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(TAG, if (true || DEBUG_FOCUS_LIGHT || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(TAG, "not Base app: Adding window " + win + " at " + (newIdx + 1) + " of " + N); windows.add(newIdx + 1, win); Loading Loading @@ -1170,7 +1172,7 @@ public class WindowManagerService extends IWindowManager.Stub break; } } if (DEBUG_FOCUS_LIGHT || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(TAG, if (true || DEBUG_FOCUS_LIGHT || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(TAG, "Based on layer: Adding window " + win + " at " + i + " of " + N); windows.add(i, win); mWindowsChanged = true; Loading Loading @@ -3657,7 +3659,7 @@ public class WindowManagerService extends IWindowManager.Stub atoken.layoutConfigChanges = (configChanges & (ActivityInfo.CONFIG_SCREEN_SIZE | ActivityInfo.CONFIG_ORIENTATION)) != 0; atoken.mLaunchTaskBehind = launchTaskBehind; if (DEBUG_TOKEN_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(TAG, "addAppToken: " + atoken if (true || DEBUG_TOKEN_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(TAG, "addAppToken: " + atoken + " to stack=" + stackId + " task=" + taskId + " at " + addPos); Task task = mTaskIdToTask.get(taskId); Loading Loading @@ -7608,6 +7610,7 @@ public class WindowManagerService extends IWindowManager.Stub public static final int SHOW_EMULATOR_DISPLAY_OVERLAY = 36; public static final int CHECK_IF_BOOT_ANIMATION_FINISHED = 37; public static final int RESET_ANR_MESSAGE = 38; @Override public void handleMessage(Message msg) { Loading Loading @@ -8118,6 +8121,12 @@ public class WindowManagerService extends IWindowManager.Stub } } break; case RESET_ANR_MESSAGE: { synchronized (mWindowMap) { mLastANRState = null; } } break; } if (DEBUG_WINDOW_TRACE) { Slog.v(TAG, "handleMessage: exit"); Loading Loading @@ -11299,8 +11308,14 @@ public class WindowManagerService extends IWindowManager.Stub } pw.println(); dumpWindowsNoHeaderLocked(pw, true, null); pw.println(); pw.println("Last ANR continued"); dumpDisplayContentsLocked(pw, true); pw.close(); mLastANRState = sw.toString(); mH.removeMessages(H.RESET_ANR_MESSAGE); mH.sendEmptyMessageDelayed(H.RESET_ANR_MESSAGE, LAST_ANR_LIFETIME_DURATION_MSECS); } @Override Loading Loading
services/core/java/com/android/server/wm/DisplayContent.java +9 −5 Original line number Diff line number Diff line Loading @@ -379,12 +379,16 @@ class DisplayContent { pw.println(" Application tokens in top down Z order:"); int ndx = 0; for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) { ArrayList<Task> tasks = mStacks.get(stackNdx).getTasks(); final TaskStack stack = mStacks.get(stackNdx); pw.print(" mStackId="); pw.println(stack.mStackId); ArrayList<Task> tasks = stack.getTasks(); for (int taskNdx = tasks.size() - 1; taskNdx >= 0; --taskNdx) { AppTokenList tokens = tasks.get(taskNdx).mAppTokens; for (int tokenNdx = tokens.size() - 1; tokenNdx >= 0; --tokenNdx) { final Task task = tasks.get(taskNdx); pw.print(" mTaskId="); pw.println(task.taskId); AppTokenList tokens = task.mAppTokens; for (int tokenNdx = tokens.size() - 1; tokenNdx >= 0; --tokenNdx, ++ndx) { final AppWindowToken wtoken = tokens.get(tokenNdx); pw.print(" App #"); pw.print(ndx++); pw.print(" Activity #"); pw.print(tokenNdx); pw.print(' '); pw.print(wtoken); pw.println(":"); wtoken.dump(pw, " "); } Loading
services/core/java/com/android/server/wm/WindowManagerService.java +20 −5 Original line number Diff line number Diff line Loading @@ -262,6 +262,8 @@ 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 to allow a last ANR message to exist before freeing the memory. */ static final int LAST_ANR_LIFETIME_DURATION_MSECS = 2 * 60 * 60 * 1000; // Two hours /** * If true, the window manager will do its own custom freezing and general * management of the screen during rotation. Loading Loading @@ -940,7 +942,7 @@ public class WindowManagerService extends IWindowManager.Stub private void placeWindowAfter(WindowState pos, WindowState window) { final WindowList windows = pos.getWindowList(); final int i = windows.indexOf(pos); if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v( if (true || DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v( TAG, "Adding window " + window + " at " + (i+1) + " of " + windows.size() + " (after " + pos + ")"); windows.add(i+1, window); Loading @@ -950,7 +952,7 @@ public class WindowManagerService extends IWindowManager.Stub private void placeWindowBefore(WindowState pos, WindowState window) { final WindowList windows = pos.getWindowList(); int i = windows.indexOf(pos); if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v( if (true || DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v( TAG, "Adding window " + window + " at " + i + " of " + windows.size() + " (before " + pos + ")"); if (i < 0) { Loading Loading @@ -1048,7 +1050,7 @@ public class WindowManagerService extends IWindowManager.Stub //apptoken note that the window could be a floating window //that was created later or a window at the top of the list of //windows associated with this token. if (DEBUG_FOCUS_LIGHT || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(TAG, if (true || DEBUG_FOCUS_LIGHT || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(TAG, "not Base app: Adding window " + win + " at " + (newIdx + 1) + " of " + N); windows.add(newIdx + 1, win); Loading Loading @@ -1170,7 +1172,7 @@ public class WindowManagerService extends IWindowManager.Stub break; } } if (DEBUG_FOCUS_LIGHT || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(TAG, if (true || DEBUG_FOCUS_LIGHT || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(TAG, "Based on layer: Adding window " + win + " at " + i + " of " + N); windows.add(i, win); mWindowsChanged = true; Loading Loading @@ -3657,7 +3659,7 @@ public class WindowManagerService extends IWindowManager.Stub atoken.layoutConfigChanges = (configChanges & (ActivityInfo.CONFIG_SCREEN_SIZE | ActivityInfo.CONFIG_ORIENTATION)) != 0; atoken.mLaunchTaskBehind = launchTaskBehind; if (DEBUG_TOKEN_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(TAG, "addAppToken: " + atoken if (true || DEBUG_TOKEN_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(TAG, "addAppToken: " + atoken + " to stack=" + stackId + " task=" + taskId + " at " + addPos); Task task = mTaskIdToTask.get(taskId); Loading Loading @@ -7608,6 +7610,7 @@ public class WindowManagerService extends IWindowManager.Stub public static final int SHOW_EMULATOR_DISPLAY_OVERLAY = 36; public static final int CHECK_IF_BOOT_ANIMATION_FINISHED = 37; public static final int RESET_ANR_MESSAGE = 38; @Override public void handleMessage(Message msg) { Loading Loading @@ -8118,6 +8121,12 @@ public class WindowManagerService extends IWindowManager.Stub } } break; case RESET_ANR_MESSAGE: { synchronized (mWindowMap) { mLastANRState = null; } } break; } if (DEBUG_WINDOW_TRACE) { Slog.v(TAG, "handleMessage: exit"); Loading Loading @@ -11299,8 +11308,14 @@ public class WindowManagerService extends IWindowManager.Stub } pw.println(); dumpWindowsNoHeaderLocked(pw, true, null); pw.println(); pw.println("Last ANR continued"); dumpDisplayContentsLocked(pw, true); pw.close(); mLastANRState = sw.toString(); mH.removeMessages(H.RESET_ANR_MESSAGE); mH.sendEmptyMessageDelayed(H.RESET_ANR_MESSAGE, LAST_ANR_LIFETIME_DURATION_MSECS); } @Override Loading