Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 549ceb04 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update dump in WindowState and WindowFrames to be formatted correctly"

parents 4a64b032 c65fa589
Loading
Loading
Loading
Loading
+16 −26
Original line number Original line Diff line number Diff line
@@ -30,18 +30,19 @@ import static com.android.server.wm.WindowFramesProto.VISIBLE_FRAME;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.graphics.Rect;
import android.graphics.Rect;
import android.util.proto.ProtoOutputStream;
import android.util.proto.ProtoOutputStream;

import java.io.PrintWriter;
import android.view.DisplayCutout;
import android.view.DisplayCutout;


import com.android.server.wm.utils.WmDisplayCutout;
import com.android.server.wm.utils.WmDisplayCutout;


import java.io.PrintWriter;

/**
/**
 * Container class for all the window frames that affect how windows are laid out.
 * Container class for all the window frames that affect how windows are laid out.
 *
 *
 * TODO(b/111611553): Investigate which frames are still needed and which are duplicates
 * TODO(b/111611553): Investigate which frames are still needed and which are duplicates
 */
 */
public class WindowFrames {
public class WindowFrames {
    private static final StringBuilder sTmpSB = new StringBuilder();


    /**
    /**
     * In most cases, this is the area of the entire screen.
     * In most cases, this is the area of the entire screen.
@@ -197,29 +198,18 @@ public class WindowFrames {
    }
    }


    public void dump(PrintWriter pw, String prefix) {
    public void dump(PrintWriter pw, String prefix) {
        pw.print(prefix); pw.print("Frames: containing=");
        pw.println(prefix + "Frames: containing="
                mContainingFrame.printShortString(pw);
                + mContainingFrame.toShortString(sTmpSB)
                pw.print(" parent="); mParentFrame.printShortString(pw);
                + " parent=" + mParentFrame.toShortString(sTmpSB));
                pw.println();
        pw.println(prefix + "    display=" + mDisplayFrame.toShortString(sTmpSB)
        pw.print(prefix); pw.print("    display=");
                + " overscan=" + mOverscanFrame.toShortString(sTmpSB));
                mDisplayFrame.printShortString(pw);
        pw.println(prefix + "    content=" + mContentFrame.toShortString(sTmpSB)
                pw.print(" overscan="); mOverscanFrame.printShortString(pw);
                + " visible=" + mVisibleFrame.toShortString(sTmpSB));
                pw.println();
        pw.println(prefix + "    decor=" + mDecorFrame.toShortString(sTmpSB));
        pw.print(prefix); pw.print("    content=");
        pw.println(prefix + "    outset=" + mOutsetFrame.toShortString(sTmpSB));
                mContentFrame.printShortString(pw);
        pw.println(prefix + "mFrame=" + mFrame.toShortString(sTmpSB)
                pw.print(" visible="); mVisibleFrame.printShortString(pw);
                + " last=" + mLastFrame.toShortString(sTmpSB));
                pw.println();
        pw.println(prefix + " cutout=" + mDisplayCutout.getDisplayCutout()
        pw.print(prefix); pw.print("    decor=");
                + " last=" + mLastDisplayCutout.getDisplayCutout());
                mDecorFrame.printShortString(pw);
                pw.println();
        pw.print(prefix); pw.print("    outset=");
                mOutsetFrame.printShortString(pw);
                pw.println();
        pw.print(prefix); pw.print("mFrame="); mFrame.printShortString(pw);
                pw.print(" last="); mLastFrame.printShortString(pw);
                pw.println();
        pw.print(prefix); pw.print(" cutout=" + mDisplayCutout.getDisplayCutout());
                pw.print(" last=" + mLastDisplayCutout.getDisplayCutout());
                pw.println();
    }
    }
}
}
+102 −123
Original line number Original line Diff line number Diff line
@@ -602,6 +602,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
     */
     */
    private long mFrameNumber = -1;
    private long mFrameNumber = -1;


    private static final StringBuilder sTmpSB = new StringBuilder();

    /**
    /**
     * Compares two window sub-layers and returns -1 if the first is lesser than the second in terms
     * Compares two window sub-layers and returns -1 if the first is lesser than the second in terms
     * of z-order and 1 otherwise.
     * of z-order and 1 otherwise.
@@ -3335,183 +3337,160 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
    @Override
    @Override
    void dump(PrintWriter pw, String prefix, boolean dumpAll) {
    void dump(PrintWriter pw, String prefix, boolean dumpAll) {
        final TaskStack stack = getStack();
        final TaskStack stack = getStack();
        pw.print(prefix); pw.print("mDisplayId="); pw.print(getDisplayId());
        pw.print(prefix + "mDisplayId=" + getDisplayId());
        if (stack != null) {
        if (stack != null) {
                    pw.print(" stackId="); pw.print(stack.mStackId);
            pw.print(" stackId=" + stack.mStackId);
                }
        }
                pw.print(" mSession="); pw.print(mSession);
        pw.println(" mSession=" + mSession
                pw.print(" mClient="); pw.println(mClient.asBinder());
                + " mClient=" + mClient.asBinder());
        pw.print(prefix); pw.print("mOwnerUid="); pw.print(mOwnerUid);
        pw.println(prefix + "mOwnerUid=" + mOwnerUid
                pw.print(" mShowToOwnerOnly="); pw.print(mShowToOwnerOnly);
                + " mShowToOwnerOnly=" + mShowToOwnerOnly
                pw.print(" package="); pw.print(mAttrs.packageName);
                + " package=" + mAttrs.packageName
                pw.print(" appop="); pw.println(AppOpsManager.opToName(mAppOp));
                + " appop=" + AppOpsManager.opToName(mAppOp));
        pw.print(prefix); pw.print("mAttrs="); pw.println(mAttrs.toString(prefix));
        pw.println(prefix + "mAttrs=" + mAttrs.toString(prefix));
        pw.print(prefix); pw.print("Requested w="); pw.print(mRequestedWidth);
        pw.println(prefix + "Requested w=" + mRequestedWidth
                pw.print(" h="); pw.print(mRequestedHeight);
                + " h=" + mRequestedHeight
                pw.print(" mLayoutSeq="); pw.println(mLayoutSeq);
                + " mLayoutSeq=" + mLayoutSeq);
        if (mRequestedWidth != mLastRequestedWidth || mRequestedHeight != mLastRequestedHeight) {
        if (mRequestedWidth != mLastRequestedWidth || mRequestedHeight != mLastRequestedHeight) {
            pw.print(prefix); pw.print("LastRequested w="); pw.print(mLastRequestedWidth);
            pw.println(prefix + "LastRequested w=" + mLastRequestedWidth
                    pw.print(" h="); pw.println(mLastRequestedHeight);
                    + " h=" + mLastRequestedHeight);
        }
        }
        if (mIsChildWindow || mLayoutAttached) {
        if (mIsChildWindow || mLayoutAttached) {
            pw.print(prefix); pw.print("mParentWindow="); pw.print(getParentWindow());
            pw.println(prefix + "mParentWindow=" + getParentWindow()
                    pw.print(" mLayoutAttached="); pw.println(mLayoutAttached);
                    + " mLayoutAttached=" + mLayoutAttached);
        }
        }
        if (mIsImWindow || mIsWallpaper || mIsFloatingLayer) {
        if (mIsImWindow || mIsWallpaper || mIsFloatingLayer) {
            pw.print(prefix); pw.print("mIsImWindow="); pw.print(mIsImWindow);
            pw.println(prefix + "mIsImWindow=" + mIsImWindow
                    pw.print(" mIsWallpaper="); pw.print(mIsWallpaper);
                    + " mIsWallpaper=" + mIsWallpaper
                    pw.print(" mIsFloatingLayer="); pw.print(mIsFloatingLayer);
                    + " mIsFloatingLayer=" + mIsFloatingLayer
                    pw.print(" mWallpaperVisible="); pw.println(mWallpaperVisible);
                    + " mWallpaperVisible=" + mWallpaperVisible);
        }
        }
        if (dumpAll) {
        if (dumpAll) {
            pw.print(prefix); pw.print("mBaseLayer="); pw.print(mBaseLayer);
            pw.println(prefix + "mBaseLayer=" + mBaseLayer
                    pw.print(" mSubLayer="); pw.print(mSubLayer);
                    + " mSubLayer=" + mSubLayer
                    pw.print(" mAnimLayer="); pw.print(mLayer); pw.print("+");
                    + " mAnimLayer=" + mLayer + "=" + mWinAnimator.mAnimLayer
                    pw.print("="); pw.print(mWinAnimator.mAnimLayer);
                    + " mLastLayer=" + mWinAnimator.mLastLayer);
                    pw.print(" mLastLayer="); pw.println(mWinAnimator.mLastLayer);
        }
        }
        if (dumpAll) {
        if (dumpAll) {
            pw.print(prefix); pw.print("mToken="); pw.println(mToken);
            pw.println(prefix + "mToken=" + mToken);
            if (mAppToken != null) {
            if (mAppToken != null) {
                pw.print(prefix); pw.print("mAppToken="); pw.println(mAppToken);
                pw.println(prefix + "mAppToken=" + mAppToken);
                pw.print(prefix); pw.print(" isAnimatingWithSavedSurface()=");
                pw.print(prefix + "mAppDied=" + mAppDied);
                pw.print(" mAppDied=");pw.print(mAppDied);
                pw.print(prefix + "drawnStateEvaluated=" + getDrawnStateEvaluated());
                pw.print(prefix); pw.print("drawnStateEvaluated=");
                pw.println(prefix + "mightAffectAllDrawn=" + mightAffectAllDrawn());
                        pw.print(getDrawnStateEvaluated());
            }
                pw.print(prefix); pw.print("mightAffectAllDrawn=");
            pw.println(prefix + "mViewVisibility=0x" + Integer.toHexString(mViewVisibility)
                        pw.println(mightAffectAllDrawn());
                    + " mHaveFrame=" + mHaveFrame
            }
                    + " mObscured=" + mObscured);
            pw.print(prefix); pw.print("mViewVisibility=0x");
            pw.println(prefix + "mSeq=" + mSeq
            pw.print(Integer.toHexString(mViewVisibility));
                    + " mSystemUiVisibility=0x" + Integer.toHexString(mSystemUiVisibility));
            pw.print(" mHaveFrame="); pw.print(mHaveFrame);
            pw.print(" mObscured="); pw.println(mObscured);
            pw.print(prefix); pw.print("mSeq="); pw.print(mSeq);
            pw.print(" mSystemUiVisibility=0x");
            pw.println(Integer.toHexString(mSystemUiVisibility));
        }
        }
        if (!mPolicyVisibility || !mPolicyVisibilityAfterAnim || !mAppOpVisibility
        if (!mPolicyVisibility || !mPolicyVisibilityAfterAnim || !mAppOpVisibility
                || isParentWindowHidden() || mPermanentlyHidden || mForceHideNonSystemOverlayWindow
                || isParentWindowHidden() || mPermanentlyHidden || mForceHideNonSystemOverlayWindow
                || mHiddenWhileSuspended) {
                || mHiddenWhileSuspended) {
            pw.print(prefix); pw.print("mPolicyVisibility=");
            pw.println(prefix + "mPolicyVisibility=" + mPolicyVisibility
                    pw.print(mPolicyVisibility);
                    + " mPolicyVisibilityAfterAnim=" + mPolicyVisibilityAfterAnim
                    pw.print(" mPolicyVisibilityAfterAnim=");
                    + " mAppOpVisibility=" + mAppOpVisibility
                    pw.print(mPolicyVisibilityAfterAnim);
                    + " parentHidden=" + isParentWindowHidden()
                    pw.print(" mAppOpVisibility=");
                    + " mPermanentlyHidden=" + mPermanentlyHidden
                    pw.print(mAppOpVisibility);
                    + " mHiddenWhileSuspended=" + mHiddenWhileSuspended
                    pw.print(" parentHidden="); pw.print(isParentWindowHidden());
                    + " mForceHideNonSystemOverlayWindow=" + mForceHideNonSystemOverlayWindow);
                    pw.print(" mPermanentlyHidden="); pw.print(mPermanentlyHidden);
                    pw.print(" mHiddenWhileSuspended="); pw.print(mHiddenWhileSuspended);
                    pw.print(" mForceHideNonSystemOverlayWindow="); pw.println(
                    mForceHideNonSystemOverlayWindow);
        }
        }
        if (!mRelayoutCalled || mLayoutNeeded) {
        if (!mRelayoutCalled || mLayoutNeeded) {
            pw.print(prefix); pw.print("mRelayoutCalled="); pw.print(mRelayoutCalled);
            pw.println(prefix + "mRelayoutCalled=" + mRelayoutCalled
                    pw.print(" mLayoutNeeded="); pw.println(mLayoutNeeded);
                    + " mLayoutNeeded=" + mLayoutNeeded);
        }
        }
        if (dumpAll) {
        if (dumpAll) {
            pw.print(prefix); pw.print("mGivenContentInsets=");
            pw.println(prefix + "mGivenContentInsets=" + mGivenContentInsets.toShortString(sTmpSB)
                    mGivenContentInsets.printShortString(pw);
                    + " mGivenVisibleInsets=" + mGivenVisibleInsets.toShortString(sTmpSB));
                    pw.print(" mGivenVisibleInsets=");
                    mGivenVisibleInsets.printShortString(pw);
                    pw.println();
            if (mTouchableInsets != 0 || mGivenInsetsPending) {
            if (mTouchableInsets != 0 || mGivenInsetsPending) {
                pw.print(prefix); pw.print("mTouchableInsets="); pw.print(mTouchableInsets);
                pw.println(prefix + "mTouchableInsets=" + mTouchableInsets
                        pw.print(" mGivenInsetsPending="); pw.println(mGivenInsetsPending);
                        + " mGivenInsetsPending=" + mGivenInsetsPending);
                Region region = new Region();
                Region region = new Region();
                getTouchableRegion(region);
                getTouchableRegion(region);
                pw.print(prefix); pw.print("touchable region="); pw.println(region);
                pw.println(prefix + "touchable region=" + region);
            }
            }
            pw.print(prefix); pw.print("mFullConfiguration="); pw.println(getConfiguration());
            pw.println(prefix + "mFullConfiguration=" + getConfiguration());
            pw.print(prefix); pw.print("mLastReportedConfiguration=");
            pw.println(prefix + "mLastReportedConfiguration=" + getLastReportedConfiguration());
                    pw.println(getLastReportedConfiguration());
        }
        }
        pw.print(prefix); pw.print("mHasSurface="); pw.print(mHasSurface);
        pw.println(prefix + "mHasSurface=" + mHasSurface
                pw.print(" isReadyForDisplay()="); pw.print(isReadyForDisplay());
                + " isReadyForDisplay()=" + isReadyForDisplay()
                pw.print(" mWindowRemovalAllowed="); pw.println(mWindowRemovalAllowed);
                + " mWindowRemovalAllowed=" + mWindowRemovalAllowed);
        if (mEnforceSizeCompat) {
        if (mEnforceSizeCompat) {
            pw.print(prefix); pw.print("mCompatFrame="); mCompatFrame.printShortString(pw);
            pw.println(prefix + "mCompatFrame=" + mCompatFrame.toShortString(sTmpSB));
                    pw.println();
        }
        }
        if (dumpAll) {
        if (dumpAll) {
            mWindowFrames.dump(pw, prefix);
            mWindowFrames.dump(pw, prefix);
            pw.print(prefix); pw.print("Cur insets: overscan=");
            pw.print(prefix + "Cur insets: overscan=" + mOverscanInsets.toShortString(sTmpSB)
                    mOverscanInsets.printShortString(pw);
                    + " content=" + mContentInsets.toShortString(sTmpSB)
                    pw.print(" content="); mContentInsets.printShortString(pw);
                    + " visible=" + mVisibleInsets.toShortString(sTmpSB)
                    pw.print(" visible="); mVisibleInsets.printShortString(pw);
                    + " stable=" + mStableInsets.toShortString(sTmpSB)
                    pw.print(" stable="); mStableInsets.printShortString(pw);
                    + " surface=" + mAttrs.surfaceInsets.toShortString(sTmpSB)
                    pw.print(" surface="); mAttrs.surfaceInsets.printShortString(pw);
                    + " outsets=" + mOutsets.toShortString(sTmpSB));
                    pw.print(" outsets="); mOutsets.printShortString(pw);
            pw.println(prefix + "Lst insets: overscan=" + mLastOverscanInsets.toShortString(sTmpSB)
            pw.print(prefix); pw.print("Lst insets: overscan=");
                    + " content=" + mLastContentInsets.toShortString(sTmpSB)
                    mLastOverscanInsets.printShortString(pw);
                    + " visible=" + mLastVisibleInsets.toShortString(sTmpSB)
                    pw.print(" content="); mLastContentInsets.printShortString(pw);
                    + " stable=" + mLastStableInsets.toShortString(sTmpSB)
                    pw.print(" visible="); mLastVisibleInsets.printShortString(pw);
                    + " outset=" + mLastOutsets.toShortString(sTmpSB));
                    pw.print(" stable="); mLastStableInsets.printShortString(pw);
                    pw.print(" physical="); mLastOutsets.printShortString(pw);
                    pw.print(" outset="); mLastOutsets.printShortString(pw);
                    pw.println();
        }
        }
        super.dump(pw, prefix, dumpAll);
        super.dump(pw, prefix, dumpAll);
        pw.print(prefix); pw.print(mWinAnimator); pw.println(":");
        pw.println(prefix + mWinAnimator + ":");
        mWinAnimator.dump(pw, prefix + "  ", dumpAll);
        mWinAnimator.dump(pw, prefix + "  ", dumpAll);
        if (mAnimatingExit || mRemoveOnExit || mDestroying || mRemoved) {
        if (mAnimatingExit || mRemoveOnExit || mDestroying || mRemoved) {
            pw.print(prefix); pw.print("mAnimatingExit="); pw.print(mAnimatingExit);
            pw.println(prefix + "mAnimatingExit=" + mAnimatingExit
                    pw.print(" mRemoveOnExit="); pw.print(mRemoveOnExit);
                    + " mRemoveOnExit=" + mRemoveOnExit
                    pw.print(" mDestroying="); pw.print(mDestroying);
                    + " mDestroying=" + mDestroying
                    pw.print(" mRemoved="); pw.println(mRemoved);
                    + " mRemoved=" + mRemoved);
        }
        }
        if (getOrientationChanging() || mAppFreezing || mReportOrientationChanged) {
        if (getOrientationChanging() || mAppFreezing || mReportOrientationChanged) {
            pw.print(prefix); pw.print("mOrientationChanging=");
            pw.println(prefix + "mOrientationChanging=" + mOrientationChanging
                    pw.print(mOrientationChanging);
                    + " configOrientationChanging="
                    pw.print(" configOrientationChanging=");
                    + (getLastReportedConfiguration().orientation != getConfiguration().orientation)
                    pw.print(getLastReportedConfiguration().orientation
                    + " mAppFreezing=" + mAppFreezing
                            != getConfiguration().orientation);
                    + " mReportOrientationChanged=" + mReportOrientationChanged);
                    pw.print(" mAppFreezing="); pw.print(mAppFreezing);
                    pw.print(" mReportOrientationChanged="); pw.println(mReportOrientationChanged);
        }
        }
        if (mLastFreezeDuration != 0) {
        if (mLastFreezeDuration != 0) {
            pw.print(prefix); pw.print("mLastFreezeDuration=");
            pw.print(prefix + "mLastFreezeDuration=");
                    TimeUtils.formatDuration(mLastFreezeDuration, pw); pw.println();
            TimeUtils.formatDuration(mLastFreezeDuration, pw);
            pw.println();
        }
        }
        pw.print(prefix); pw.print("mForceSeamlesslyRotate="); pw.print(mForceSeamlesslyRotate);
        pw.print(prefix + "mForceSeamlesslyRotate=" + mForceSeamlesslyRotate
        pw.print(" seamlesslyRotate: pending=");
                + " seamlesslyRotate: pending=");
        if (mPendingSeamlessRotate != null) {
        if (mPendingSeamlessRotate != null) {
            mPendingSeamlessRotate.dump(pw);
            mPendingSeamlessRotate.dump(pw);
        } else {
        } else {
            pw.print("null");
            pw.print("null");
        }
        }
        pw.print(" finishedFrameNumber="); pw.print(mFinishSeamlessRotateFrameNumber);
        pw.println(" finishedFrameNumber=" + mFinishSeamlessRotateFrameNumber);
        pw.println();


        if (mHScale != 1 || mVScale != 1) {
        if (mHScale != 1 || mVScale != 1) {
            pw.print(prefix); pw.print("mHScale="); pw.print(mHScale);
            pw.println(prefix + "mHScale=" + mHScale
                    pw.print(" mVScale="); pw.println(mVScale);
                    + " mVScale=" + mVScale);
        }
        }
        if (mWallpaperX != -1 || mWallpaperY != -1) {
        if (mWallpaperX != -1 || mWallpaperY != -1) {
            pw.print(prefix); pw.print("mWallpaperX="); pw.print(mWallpaperX);
            pw.println(prefix + "mWallpaperX=" + mWallpaperX
                    pw.print(" mWallpaperY="); pw.println(mWallpaperY);
                    + " mWallpaperY=" + mWallpaperY);
        }
        }
        if (mWallpaperXStep != -1 || mWallpaperYStep != -1) {
        if (mWallpaperXStep != -1 || mWallpaperYStep != -1) {
            pw.print(prefix); pw.print("mWallpaperXStep="); pw.print(mWallpaperXStep);
            pw.println(prefix + "mWallpaperXStep=" + mWallpaperXStep
                    pw.print(" mWallpaperYStep="); pw.println(mWallpaperYStep);
                    + " mWallpaperYStep=" + mWallpaperYStep);
        }
        }
        if (mWallpaperDisplayOffsetX != Integer.MIN_VALUE
        if (mWallpaperDisplayOffsetX != Integer.MIN_VALUE
                || mWallpaperDisplayOffsetY != Integer.MIN_VALUE) {
                || mWallpaperDisplayOffsetY != Integer.MIN_VALUE) {
            pw.print(prefix); pw.print("mWallpaperDisplayOffsetX=");
            pw.println(prefix + "mWallpaperDisplayOffsetX=" + mWallpaperDisplayOffsetX
                    pw.print(mWallpaperDisplayOffsetX);
                    + " mWallpaperDisplayOffsetY=" + mWallpaperDisplayOffsetY);
                    pw.print(" mWallpaperDisplayOffsetY=");
                    pw.println(mWallpaperDisplayOffsetY);
        }
        }
        if (mDrawLock != null) {
        if (mDrawLock != null) {
            pw.print(prefix); pw.println("mDrawLock=" + mDrawLock);
            pw.println(prefix + "mDrawLock=" + mDrawLock);
        }
        }
        if (isDragResizing()) {
        if (isDragResizing()) {
            pw.print(prefix); pw.println("isDragResizing=" + isDragResizing());
            pw.println(prefix + "isDragResizing=" + isDragResizing());
        }
        }
        if (computeDragResizing()) {
        if (computeDragResizing()) {
            pw.print(prefix); pw.println("computeDragResizing=" + computeDragResizing());
            pw.println(prefix + "computeDragResizing=" + computeDragResizing());
        }
        }
        pw.print(prefix); pw.println("isOnScreen=" + isOnScreen());
        pw.println(prefix + "isOnScreen=" + isOnScreen());
        pw.print(prefix); pw.println("isVisible=" + isVisible());
        pw.println(prefix + "isVisible=" + isVisible());
    }
    }


    @Override
    @Override
@@ -4933,9 +4912,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP


        @Override
        @Override
        public void dump(PrintWriter pw, String prefix) {
        public void dump(PrintWriter pw, String prefix) {
            pw.print(prefix); pw.print("from="); pw.print(mFrom);
            pw.println(prefix + "from=" + mFrom
            pw.print(" to="); pw.print(mTo);
                    + " to=" + mTo
            pw.print(" duration="); pw.println(mDuration);
                    + " duration=" + mDuration);
        }
        }


        @Override
        @Override