Merge "Refine output of "dumpsys window displays/windows"" into sc-dev

This commit is contained in:
Tiger Huang
2021-04-06 08:19:38 +00:00
committed by Android (Google) Code Review
5 changed files with 46 additions and 34 deletions

View File

@@ -34,6 +34,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import android.annotation.IntDef; import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.app.WindowConfiguration; import android.app.WindowConfiguration;
import android.graphics.Insets; import android.graphics.Insets;
@@ -808,7 +809,7 @@ public class InsetsState implements Parcelable {
dest.writeTypedObject(mRoundedCorners, flags); dest.writeTypedObject(mRoundedCorners, flags);
} }
public static final @android.annotation.NonNull Creator<InsetsState> CREATOR = new Creator<InsetsState>() { public static final @NonNull Creator<InsetsState> CREATOR = new Creator<InsetsState>() {
public InsetsState createFromParcel(Parcel in) { public InsetsState createFromParcel(Parcel in) {
return new InsetsState(in); return new InsetsState(in);
@@ -842,5 +843,16 @@ public class InsetsState implements Parcelable {
+ ", mSources= { " + joiner + ", mSources= { " + joiner
+ " }"; + " }";
} }
public @NonNull String toSourceVisibilityString() {
StringJoiner joiner = new StringJoiner(", ");
for (int i = 0; i < SIZE; i++) {
InsetsSource source = mSources[i];
if (source != null) {
joiner.add(typeToString(i) + ": " + (source.isVisible() ? "visible" : "invisible"));
}
}
return joiner.toString();
}
} }

View File

@@ -240,6 +240,7 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider {
@Override @Override
public void dump(PrintWriter pw, String prefix) { public void dump(PrintWriter pw, String prefix) {
super.dump(pw, prefix); super.dump(pw, prefix);
prefix = prefix + " ";
pw.print(prefix); pw.print(prefix);
pw.print("mImeShowing="); pw.print("mImeShowing=");
pw.print(mImeShowing); pw.print(mImeShowing);

View File

@@ -63,7 +63,7 @@ import java.util.function.Consumer;
/** /**
* Controller for a specific inset source on the server. It's called provider as it provides the * Controller for a specific inset source on the server. It's called provider as it provides the
* {@link InsetsSource} to the client that uses it in {@link InsetsSourceConsumer}. * {@link InsetsSource} to the client that uses it in {@link android.view.InsetsSourceConsumer}.
*/ */
class InsetsSourceProvider { class InsetsSourceProvider {
@@ -452,40 +452,36 @@ class InsetsSourceProvider {
} }
public void dump(PrintWriter pw, String prefix) { public void dump(PrintWriter pw, String prefix) {
pw.println(prefix + "InsetsSourceProvider"); pw.println(prefix + getClass().getSimpleName());
pw.print(prefix + " mSource="); mSource.dump(prefix + " ", pw); prefix = prefix + " ";
pw.print(prefix + "mSource="); mSource.dump("", pw);
if (mControl != null) { if (mControl != null) {
pw.print(prefix + " mControl="); pw.print(prefix + "mControl=");
mControl.dump(prefix + " ", pw); mControl.dump("", pw);
} }
pw.print(prefix + " mFakeControl="); mFakeControl.dump(prefix + " ", pw); pw.print(prefix);
pw.print(" mIsLeashReadyForDispatching="); pw.print(mIsLeashReadyForDispatching); pw.print("mIsLeashReadyForDispatching="); pw.print(mIsLeashReadyForDispatching);
pw.print(" mImeOverrideFrame="); pw.print(mImeOverrideFrame.toString()); pw.print(" mImeOverrideFrame="); pw.print(mImeOverrideFrame.toShortString());
pw.println();
if (mWin != null) { if (mWin != null) {
pw.print(prefix + " mWin="); pw.print(prefix + "mWin=");
mWin.dump(pw, prefix + " ", false /* dumpAll */); pw.println(mWin);
} }
if (mAdapter != null) { if (mAdapter != null) {
pw.print(prefix + " mAdapter="); pw.print(prefix + "mAdapter=");
mAdapter.dump(pw, prefix + " "); mAdapter.dump(pw, "");
} }
if (mControlTarget != null) { if (mControlTarget != null) {
pw.print(prefix + " mControlTarget="); pw.print(prefix + "mControlTarget=");
if (mControlTarget.getWindow() != null) { pw.println(mControlTarget.getWindow());
mControlTarget.getWindow().dump(pw, prefix + " ", false /* dumpAll */);
}
} }
if (mPendingControlTarget != null) { if (mPendingControlTarget != null) {
pw.print(prefix + " mPendingControlTarget="); pw.print(prefix + "mPendingControlTarget=");
if (mPendingControlTarget.getWindow() != null) { pw.println(mPendingControlTarget.getWindow());
mPendingControlTarget.getWindow().dump(pw, prefix + " ", false /* dumpAll */);
}
} }
if (mFakeControlTarget != null) { if (mFakeControlTarget != null) {
pw.print(prefix + " mFakeControlTarget="); pw.print(prefix + "mFakeControlTarget=");
if (mFakeControlTarget.getWindow() != null) { pw.println(mFakeControlTarget.getWindow());
mFakeControlTarget.getWindow().dump(pw, prefix + " ", false /* dumpAll */);
}
} }
} }
@@ -575,8 +571,9 @@ class InsetsSourceProvider {
@Override @Override
public void dump(PrintWriter pw, String prefix) { public void dump(PrintWriter pw, String prefix) {
pw.println(prefix + "ControlAdapter"); pw.print(prefix + "ControlAdapter mCapturedLeash=");
pw.print(prefix + " mCapturedLeash="); pw.print(mCapturedLeash); pw.print(mCapturedLeash);
pw.println();
} }
@Override @Override

View File

@@ -573,18 +573,17 @@ class InsetsStateController {
void dump(String prefix, PrintWriter pw) { void dump(String prefix, PrintWriter pw) {
pw.println(prefix + "WindowInsetsStateController"); pw.println(prefix + "WindowInsetsStateController");
mState.dump(prefix + " ", pw); prefix = prefix + " ";
pw.println(prefix + " " + "Control map:"); mState.dump(prefix, pw);
pw.println(prefix + "Control map:");
for (int i = mTypeControlTargetMap.size() - 1; i >= 0; i--) { for (int i = mTypeControlTargetMap.size() - 1; i >= 0; i--) {
pw.print(prefix + " "); pw.print(prefix + " ");
pw.println(InsetsState.typeToString(mTypeControlTargetMap.keyAt(i)) + " -> " pw.println(InsetsState.typeToString(mTypeControlTargetMap.keyAt(i)) + " -> "
+ mTypeControlTargetMap.valueAt(i)); + mTypeControlTargetMap.valueAt(i));
} }
pw.println(prefix + " " + "InsetsSourceProviders map:"); pw.println(prefix + "InsetsSourceProviders:");
for (int i = mProviders.size() - 1; i >= 0; i--) { for (int i = mProviders.size() - 1; i >= 0; i--) {
pw.print(prefix + " "); mProviders.valueAt(i).dump(pw, prefix + " ");
pw.println(InsetsState.typeToString(mProviders.keyAt(i)) + " -> ");
mProviders.valueAt(i).dump(pw, prefix);
} }
} }
} }

View File

@@ -4288,7 +4288,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
pw.println(prefix + "mEmbeddedDisplayContents=" + mEmbeddedDisplayContents); pw.println(prefix + "mEmbeddedDisplayContents=" + mEmbeddedDisplayContents);
} }
if (dumpAll) { if (dumpAll) {
pw.println(prefix + "mRequestedInsetsState: " + mRequestedInsetsState); final String visibilityString = mRequestedInsetsState.toSourceVisibilityString();
if (!visibilityString.isEmpty()) {
pw.println(prefix + "Requested visibility: " + visibilityString);
}
} }
} }