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

Commit 46fad432 authored by Automerger Merge Worker's avatar Automerger Merge Worker Committed by Android (Google) Code Review
Browse files

Merge "Merge "Use the layout frame to decide whether to do a server sync" into...

Merge "Merge "Use the layout frame to decide whether to do a server sync" into tm-qpr-dev am: ea79cc51 am: 9facea99"
parents 4cd1282d 2974162e
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -712,6 +712,7 @@ public final class ViewRootImpl implements ViewParent,

    // These are accessed by multiple threads.
    final Rect mWinFrame; // frame given by window manager.
    private final Rect mLastLayoutFrame;
    Rect mOverrideInsetsFrame;

    final Rect mPendingBackDropFrame = new Rect();
@@ -963,6 +964,7 @@ public final class ViewRootImpl implements ViewParent,
        mHeight = -1;
        mDirty = new Rect();
        mWinFrame = new Rect();
        mLastLayoutFrame = new Rect();
        mWindow = new W(this);
        mLeashToken = new Binder();
        mTargetSdkVersion = context.getApplicationInfo().targetSdkVersion;
@@ -1329,7 +1331,7 @@ public final class ViewRootImpl implements ViewParent,
                        UNSPECIFIED_LENGTH, UNSPECIFIED_LENGTH,
                        mInsetsController.getRequestedVisibleTypes(), 1f /* compactScale */,
                        mTmpFrames);
                setFrame(mTmpFrames.frame);
                setFrame(mTmpFrames.frame, true /* withinRelayout */);
                registerBackCallbackOnWindow();
                if (DEBUG_LAYOUT) Log.v(mTag, "Added window " + mWindow);
                if (res < WindowManagerGlobal.ADD_OKAY) {
@@ -1856,7 +1858,7 @@ public final class ViewRootImpl implements ViewParent,
            onMovedToDisplay(displayId, mLastConfigurationFromResources);
        }

        setFrame(frame);
        setFrame(frame, false /* withinRelayout */);
        mTmpFrames.displayFrame.set(displayFrame);
        if (mTmpFrames.attachedFrame != null && attachedFrame != null) {
            mTmpFrames.attachedFrame.set(attachedFrame);
@@ -5850,7 +5852,7 @@ public final class ViewRootImpl implements ViewParent,
                        mTmpFrames.frame.right = l + w;
                        mTmpFrames.frame.top = t;
                        mTmpFrames.frame.bottom = t + h;
                        setFrame(mTmpFrames.frame);
                        setFrame(mTmpFrames.frame, false /* withinRelayout */);
                        maybeHandleWindowMove(mWinFrame);
                    }
                    break;
@@ -8357,7 +8359,7 @@ public final class ViewRootImpl implements ViewParent,
            // If the position and the size of the frame are both changed, it will trigger a BLAST
            // sync, and we still need to call relayout to obtain the syncSeqId. Otherwise, we just
            // need to send attributes via relayoutAsync.
            final Rect oldFrame = mWinFrame;
            final Rect oldFrame = mLastLayoutFrame;
            final Rect newFrame = mTmpFrames.frame;
            final boolean positionChanged =
                    newFrame.top != oldFrame.top || newFrame.left != oldFrame.left;
@@ -8487,7 +8489,7 @@ public final class ViewRootImpl implements ViewParent,
            params.restore();
        }

        setFrame(mTmpFrames.frame);
        setFrame(mTmpFrames.frame, true /* withinRelayout */);
        return relayoutResult;
    }

@@ -8522,8 +8524,18 @@ public final class ViewRootImpl implements ViewParent,
        mIsSurfaceOpaque = opaque;
    }

    private void setFrame(Rect frame) {
    /**
     * Set the mWinFrame of this window.
     * @param frame the new frame of this window.
     * @param withinRelayout {@code true} if this setting is within the relayout, or is the initial
     *                       setting. That will make sure in the relayout process, we always compare
     *                       the window frame with the last processed window frame.
     */
    private void setFrame(Rect frame, boolean withinRelayout) {
        mWinFrame.set(frame);
        if (withinRelayout) {
            mLastLayoutFrame.set(frame);
        }

        final WindowConfiguration winConfig = getCompatWindowConfiguration();
        mPendingBackDropFrame.set(mPendingDragResizing && !winConfig.useWindowFrameForBackdrop()