Merge "Add debug for ANR" into lmp-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
31ae17309e
@@ -379,12 +379,16 @@ class DisplayContent {
|
|||||||
pw.println(" Application tokens in top down Z order:");
|
pw.println(" Application tokens in top down Z order:");
|
||||||
int ndx = 0;
|
int ndx = 0;
|
||||||
for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
|
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) {
|
for (int taskNdx = tasks.size() - 1; taskNdx >= 0; --taskNdx) {
|
||||||
AppTokenList tokens = tasks.get(taskNdx).mAppTokens;
|
final Task task = tasks.get(taskNdx);
|
||||||
for (int tokenNdx = tokens.size() - 1; tokenNdx >= 0; --tokenNdx) {
|
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);
|
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(":");
|
pw.print(' '); pw.print(wtoken); pw.println(":");
|
||||||
wtoken.dump(pw, " ");
|
wtoken.dump(pw, " ");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,6 +262,8 @@ 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 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
|
* 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.
|
||||||
@@ -940,7 +942,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
private void placeWindowAfter(WindowState pos, WindowState window) {
|
private void placeWindowAfter(WindowState pos, WindowState window) {
|
||||||
final WindowList windows = pos.getWindowList();
|
final WindowList windows = pos.getWindowList();
|
||||||
final int i = windows.indexOf(pos);
|
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 "
|
TAG, "Adding window " + window + " at "
|
||||||
+ (i+1) + " of " + windows.size() + " (after " + pos + ")");
|
+ (i+1) + " of " + windows.size() + " (after " + pos + ")");
|
||||||
windows.add(i+1, window);
|
windows.add(i+1, window);
|
||||||
@@ -950,7 +952,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
private void placeWindowBefore(WindowState pos, WindowState window) {
|
private void placeWindowBefore(WindowState pos, WindowState window) {
|
||||||
final WindowList windows = pos.getWindowList();
|
final WindowList windows = pos.getWindowList();
|
||||||
int i = windows.indexOf(pos);
|
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 "
|
TAG, "Adding window " + window + " at "
|
||||||
+ i + " of " + windows.size() + " (before " + pos + ")");
|
+ i + " of " + windows.size() + " (before " + pos + ")");
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
@@ -1048,7 +1050,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
//apptoken note that the window could be a floating window
|
//apptoken note that the window could be a floating window
|
||||||
//that was created later or a window at the top of the list of
|
//that was created later or a window at the top of the list of
|
||||||
//windows associated with this token.
|
//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 " +
|
"not Base app: Adding window " + win + " at " + (newIdx + 1) + " of " +
|
||||||
N);
|
N);
|
||||||
windows.add(newIdx + 1, win);
|
windows.add(newIdx + 1, win);
|
||||||
@@ -1170,7 +1172,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
break;
|
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);
|
"Based on layer: Adding window " + win + " at " + i + " of " + N);
|
||||||
windows.add(i, win);
|
windows.add(i, win);
|
||||||
mWindowsChanged = true;
|
mWindowsChanged = true;
|
||||||
@@ -3657,7 +3659,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
atoken.layoutConfigChanges = (configChanges &
|
atoken.layoutConfigChanges = (configChanges &
|
||||||
(ActivityInfo.CONFIG_SCREEN_SIZE | ActivityInfo.CONFIG_ORIENTATION)) != 0;
|
(ActivityInfo.CONFIG_SCREEN_SIZE | ActivityInfo.CONFIG_ORIENTATION)) != 0;
|
||||||
atoken.mLaunchTaskBehind = launchTaskBehind;
|
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);
|
+ " to stack=" + stackId + " task=" + taskId + " at " + addPos);
|
||||||
|
|
||||||
Task task = mTaskIdToTask.get(taskId);
|
Task task = mTaskIdToTask.get(taskId);
|
||||||
@@ -7608,6 +7610,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
public static final int SHOW_EMULATOR_DISPLAY_OVERLAY = 36;
|
public static final int SHOW_EMULATOR_DISPLAY_OVERLAY = 36;
|
||||||
|
|
||||||
public static final int CHECK_IF_BOOT_ANIMATION_FINISHED = 37;
|
public static final int CHECK_IF_BOOT_ANIMATION_FINISHED = 37;
|
||||||
|
public static final int RESET_ANR_MESSAGE = 38;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(Message msg) {
|
public void handleMessage(Message msg) {
|
||||||
@@ -8118,6 +8121,12 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case RESET_ANR_MESSAGE: {
|
||||||
|
synchronized (mWindowMap) {
|
||||||
|
mLastANRState = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (DEBUG_WINDOW_TRACE) {
|
if (DEBUG_WINDOW_TRACE) {
|
||||||
Slog.v(TAG, "handleMessage: exit");
|
Slog.v(TAG, "handleMessage: exit");
|
||||||
@@ -11299,8 +11308,14 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
pw.println();
|
pw.println();
|
||||||
dumpWindowsNoHeaderLocked(pw, true, null);
|
dumpWindowsNoHeaderLocked(pw, true, null);
|
||||||
|
pw.println();
|
||||||
|
pw.println("Last ANR continued");
|
||||||
|
dumpDisplayContentsLocked(pw, true);
|
||||||
pw.close();
|
pw.close();
|
||||||
mLastANRState = sw.toString();
|
mLastANRState = sw.toString();
|
||||||
|
|
||||||
|
mH.removeMessages(H.RESET_ANR_MESSAGE);
|
||||||
|
mH.sendEmptyMessageDelayed(H.RESET_ANR_MESSAGE, LAST_ANR_LIFETIME_DURATION_MSECS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user