diff --git a/core/java/android/view/InsetsState.java b/core/java/android/view/InsetsState.java index 3d1c8ff515c77..f487c6c619739 100644 --- a/core/java/android/view/InsetsState.java +++ b/core/java/android/view/InsetsState.java @@ -34,6 +34,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; import android.annotation.IntDef; +import android.annotation.NonNull; import android.annotation.Nullable; import android.app.WindowConfiguration; import android.graphics.Insets; @@ -808,7 +809,7 @@ public class InsetsState implements Parcelable { dest.writeTypedObject(mRoundedCorners, flags); } - public static final @android.annotation.NonNull Creator CREATOR = new Creator() { + public static final @NonNull Creator CREATOR = new Creator() { public InsetsState createFromParcel(Parcel in) { return new InsetsState(in); @@ -842,5 +843,16 @@ public class InsetsState implements Parcelable { + ", 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(); + } } diff --git a/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java b/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java index f31a64355aa01..510c62d9029f4 100644 --- a/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java +++ b/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java @@ -240,6 +240,7 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider { @Override public void dump(PrintWriter pw, String prefix) { super.dump(pw, prefix); + prefix = prefix + " "; pw.print(prefix); pw.print("mImeShowing="); pw.print(mImeShowing); diff --git a/services/core/java/com/android/server/wm/InsetsSourceProvider.java b/services/core/java/com/android/server/wm/InsetsSourceProvider.java index 7b0fb0146bc2b..073231401715f 100644 --- a/services/core/java/com/android/server/wm/InsetsSourceProvider.java +++ b/services/core/java/com/android/server/wm/InsetsSourceProvider.java @@ -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 - * {@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 { @@ -452,40 +452,36 @@ class InsetsSourceProvider { } public void dump(PrintWriter pw, String prefix) { - pw.println(prefix + "InsetsSourceProvider"); - pw.print(prefix + " mSource="); mSource.dump(prefix + " ", pw); + pw.println(prefix + getClass().getSimpleName()); + prefix = prefix + " "; + pw.print(prefix + "mSource="); mSource.dump("", pw); if (mControl != null) { - pw.print(prefix + " mControl="); - mControl.dump(prefix + " ", pw); + pw.print(prefix + "mControl="); + mControl.dump("", pw); } - pw.print(prefix + " mFakeControl="); mFakeControl.dump(prefix + " ", pw); - pw.print(" mIsLeashReadyForDispatching="); pw.print(mIsLeashReadyForDispatching); - pw.print(" mImeOverrideFrame="); pw.print(mImeOverrideFrame.toString()); + pw.print(prefix); + pw.print("mIsLeashReadyForDispatching="); pw.print(mIsLeashReadyForDispatching); + pw.print(" mImeOverrideFrame="); pw.print(mImeOverrideFrame.toShortString()); + pw.println(); if (mWin != null) { - pw.print(prefix + " mWin="); - mWin.dump(pw, prefix + " ", false /* dumpAll */); + pw.print(prefix + "mWin="); + pw.println(mWin); } if (mAdapter != null) { - pw.print(prefix + " mAdapter="); - mAdapter.dump(pw, prefix + " "); + pw.print(prefix + "mAdapter="); + mAdapter.dump(pw, ""); } if (mControlTarget != null) { - pw.print(prefix + " mControlTarget="); - if (mControlTarget.getWindow() != null) { - mControlTarget.getWindow().dump(pw, prefix + " ", false /* dumpAll */); - } + pw.print(prefix + "mControlTarget="); + pw.println(mControlTarget.getWindow()); } if (mPendingControlTarget != null) { - pw.print(prefix + " mPendingControlTarget="); - if (mPendingControlTarget.getWindow() != null) { - mPendingControlTarget.getWindow().dump(pw, prefix + " ", false /* dumpAll */); - } + pw.print(prefix + "mPendingControlTarget="); + pw.println(mPendingControlTarget.getWindow()); } if (mFakeControlTarget != null) { - pw.print(prefix + " mFakeControlTarget="); - if (mFakeControlTarget.getWindow() != null) { - mFakeControlTarget.getWindow().dump(pw, prefix + " ", false /* dumpAll */); - } + pw.print(prefix + "mFakeControlTarget="); + pw.println(mFakeControlTarget.getWindow()); } } @@ -575,8 +571,9 @@ class InsetsSourceProvider { @Override public void dump(PrintWriter pw, String prefix) { - pw.println(prefix + "ControlAdapter"); - pw.print(prefix + " mCapturedLeash="); pw.print(mCapturedLeash); + pw.print(prefix + "ControlAdapter mCapturedLeash="); + pw.print(mCapturedLeash); + pw.println(); } @Override diff --git a/services/core/java/com/android/server/wm/InsetsStateController.java b/services/core/java/com/android/server/wm/InsetsStateController.java index b6057c610277d..655007cf3cd1a 100644 --- a/services/core/java/com/android/server/wm/InsetsStateController.java +++ b/services/core/java/com/android/server/wm/InsetsStateController.java @@ -573,18 +573,17 @@ class InsetsStateController { void dump(String prefix, PrintWriter pw) { pw.println(prefix + "WindowInsetsStateController"); - mState.dump(prefix + " ", pw); - pw.println(prefix + " " + "Control map:"); + prefix = prefix + " "; + mState.dump(prefix, pw); + pw.println(prefix + "Control map:"); for (int i = mTypeControlTargetMap.size() - 1; i >= 0; i--) { pw.print(prefix + " "); pw.println(InsetsState.typeToString(mTypeControlTargetMap.keyAt(i)) + " -> " + mTypeControlTargetMap.valueAt(i)); } - pw.println(prefix + " " + "InsetsSourceProviders map:"); + pw.println(prefix + "InsetsSourceProviders:"); for (int i = mProviders.size() - 1; i >= 0; i--) { - pw.print(prefix + " "); - pw.println(InsetsState.typeToString(mProviders.keyAt(i)) + " -> "); - mProviders.valueAt(i).dump(pw, prefix); + mProviders.valueAt(i).dump(pw, prefix + " "); } } } diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 95f3c3711136e..09a30e460dee8 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -4281,7 +4281,10 @@ class WindowState extends WindowContainer implements WindowManagerP pw.println(prefix + "mEmbeddedDisplayContents=" + mEmbeddedDisplayContents); } if (dumpAll) { - pw.println(prefix + "mRequestedInsetsState: " + mRequestedInsetsState); + final String visibilityString = mRequestedInsetsState.toSourceVisibilityString(); + if (!visibilityString.isEmpty()) { + pw.println(prefix + "Requested visibility: " + visibilityString); + } } }