Improve readability of the insets related dump

This change improves the readability of the toString for the insets
related information, including:
1. Use understandable window type name, instead of the int value;
2. fix the indent issue of providedInsets and paramsForRotation;
3. When output InsetsFrameProvider, makes it one per line.

Besides, this also fixed the wrong indent of waitingForConfig and fix
several inconsistency in the output.

Bug: 238151390
Test: adb shell dumpsys window all
Change-Id: I6d3aa161a3185b72767bee00081e2db43d4aa181
This commit is contained in:
Yunfan Chen
2022-12-16 09:27:08 +00:00
parent 7d7325f8c4
commit 054dd0836e
3 changed files with 13 additions and 10 deletions

View File

@@ -323,7 +323,8 @@ public class InsetsFrameProvider implements Parcelable {
public String toString() {
StringBuilder sb = new StringBuilder(32);
sb.append("TypedInsetsSize: {");
sb.append("windowType=").append(windowType);
sb.append("windowType=").append(ViewDebug.intToString(
WindowManager.LayoutParams.class, "type", windowType));
sb.append(", insetsSize=").append(insetsSize);
sb.append("}");
return sb.toString();

View File

@@ -4737,10 +4737,10 @@ public interface WindowManager extends ViewManager {
}
if (providedInsets != null) {
sb.append(System.lineSeparator());
sb.append(" providedInsets=");
sb.append(prefix).append(" providedInsets:");
for (int i = 0; i < providedInsets.length; ++i) {
if (i > 0) sb.append(' ');
sb.append((providedInsets[i]));
sb.append(System.lineSeparator());
sb.append(prefix).append(" ").append(providedInsets[i]);
}
}
if (insetsRoundedCornerFrame) {
@@ -4749,10 +4749,12 @@ public interface WindowManager extends ViewManager {
}
if (paramsForRotation != null && paramsForRotation.length != 0) {
sb.append(System.lineSeparator());
sb.append(prefix).append(" paramsForRotation=");
sb.append(prefix).append(" paramsForRotation:");
for (int i = 0; i < paramsForRotation.length; ++i) {
if (i > 0) sb.append(' ');
sb.append(paramsForRotation[i].toString());
// Additional prefix needed for the beginning of the params of the new rotation.
sb.append(System.lineSeparator()).append(prefix).append(" ");
sb.append(Surface.rotationToString(i)).append("=");
sb.append(paramsForRotation[i].toString(prefix + " "));
}
}

View File

@@ -6700,12 +6700,12 @@ public class WindowManagerService extends IWindowManager.Stub
pw.print(" mDisplayFrozen="); pw.print(mDisplayFrozen);
pw.print(" windows="); pw.print(mWindowsFreezingScreen);
pw.print(" client="); pw.print(mClientFreezingScreen);
pw.print(" apps="); pw.print(mAppsFreezingScreen);
pw.print(" apps="); pw.println(mAppsFreezingScreen);
final DisplayContent defaultDisplayContent = getDefaultDisplayContentLocked();
pw.print(" mRotation="); pw.print(defaultDisplayContent.getRotation());
pw.print(" mRotation="); pw.println(defaultDisplayContent.getRotation());
pw.print(" mLastOrientation=");
pw.println(defaultDisplayContent.getLastOrientation());
pw.print(" waitingForConfig=");
pw.print(" mWaitingForConfig=");
pw.println(defaultDisplayContent.mWaitingForConfig);
pw.print(" Animation settings: disabled="); pw.print(mAnimationsDisabled);