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

Commit 2c3d0b55 authored by Tiger Huang's avatar Tiger Huang Committed by Automerger Merge Worker
Browse files

Merge "Let setFrames can take frames passed from the client" into tm-dev am: d513c66b

parents 1f3d6a1e d513c66b
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -848,10 +848,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
                w.onResizeHandled();
            }

            if (w.mActivityRecord != null) {
                w.mActivityRecord.layoutLetterbox(w);
            }

            if (DEBUG_LAYOUT) Slog.v(TAG, "  LAYOUT: mFrame=" + w.getFrame()
                    + " mParentFrame=" + w.getParentFrame()
                    + " mDisplayFrame=" + w.getDisplayFrame());
+1 −1
Original line number Diff line number Diff line
@@ -1548,7 +1548,7 @@ public class DisplayPolicy {
                win.getRequestedVisibilities(), attachedWindowFrame, win.mGlobalScale,
                sTmpClientFrames);

        win.setFrames(sTmpClientFrames);
        win.setFrames(sTmpClientFrames, win.mRequestedWidth, win.mRequestedHeight);
    }

    WindowState getTopFullscreenOpaqueWindow() {
+11 −3
Original line number Diff line number Diff line
@@ -2639,8 +2639,18 @@ public class WindowManagerService extends IWindowManager.Stub

    void updateWindowLayout(Session session, IWindow client, LayoutParams attrs, int flags,
            ClientWindowFrames clientWindowFrames, int requestedWidth, int requestedHeight) {
        final long origId = Binder.clearCallingIdentity();
        synchronized (mGlobalLock) {
            final WindowState win = windowForClientLocked(session, client, false);
            if (win == null) {
                return;
            }
            win.setFrames(clientWindowFrames, requestedWidth, requestedHeight);

            // TODO(b/161810301): Finish the implementation.
        }
        Binder.restoreCallingIdentity(origId);
    }

    public boolean outOfMemoryWindow(Session session, IWindow client) {
        final long origId = Binder.clearCallingIdentity();
@@ -6305,8 +6315,6 @@ public class WindowManagerService extends IWindowManager.Stub
                        + " callers=" + Debug.getCallers(3));
                return NAV_BAR_INVALID;
            }
            displayContent.performLayout(false /* initial */,
                    false /* updateInputWindows */);
            return displayContent.getDisplayPolicy().getNavBarPosition();
        }
    }
+47 −21
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import static android.view.InsetsState.ITYPE_INVALID;
import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
import static android.view.SurfaceControl.Transaction;
import static android.view.SurfaceControl.getGlobalTransaction;
import static android.view.ViewRootImpl.LOCAL_LAYOUT;
import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_CONTENT;
import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME;
import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION;
@@ -1357,31 +1358,36 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        return mActivityRecord != null && mActivityRecord.mWaitForEnteringPinnedMode;
    }

    // TODO(b/161810301): Make the frame be passed from the client side.
    void setFrames(ClientWindowFrames clientWindowFrames) {
        mHaveFrame = true;

    void setFrames(ClientWindowFrames clientWindowFrames, int requestedWidth, int requestedHeight) {
        final WindowFrames windowFrames = mWindowFrames;
        mTmpRect.set(windowFrames.mParentFrame);

        if (LOCAL_LAYOUT) {
            windowFrames.mCompatFrame.set(clientWindowFrames.frame);

            windowFrames.mFrame.set(clientWindowFrames.frame);
            windowFrames.mDisplayFrame.set(clientWindowFrames.displayFrame);
            windowFrames.mParentFrame.set(clientWindowFrames.parentFrame);
        windowFrames.mFrame.set(clientWindowFrames.frame);
        windowFrames.setParentFrameWasClippedByDisplayCutout(
                clientWindowFrames.isParentFrameClippedByDisplayCutout);

        if (mRequestedWidth != mLastRequestedWidth || mRequestedHeight != mLastRequestedHeight
                || !mTmpRect.equals(windowFrames.mParentFrame)) {
            mLastRequestedWidth = mRequestedWidth;
            mLastRequestedHeight = mRequestedHeight;
            windowFrames.setContentChanged(true);
            if (hasCompatScale()) {
                // The frames sent from the client need to be adjusted to the real coordinate space.
                windowFrames.mFrame.scale(mGlobalScale);
                windowFrames.mDisplayFrame.scale(mGlobalScale);
                windowFrames.mParentFrame.scale(mGlobalScale);
            }
        } else {
            windowFrames.mDisplayFrame.set(clientWindowFrames.displayFrame);
            windowFrames.mParentFrame.set(clientWindowFrames.parentFrame);
            windowFrames.mFrame.set(clientWindowFrames.frame);

            windowFrames.mCompatFrame.set(windowFrames.mFrame);
            if (hasCompatScale()) {
            // Also the scaled frame that we report to the app needs to be
            // adjusted to be in its coordinate space.
                // Also, the scaled frame that we report to the app needs to be adjusted to be in
                // its coordinate space.
                windowFrames.mCompatFrame.scale(mInvGlobalScale);
            }
        }
        windowFrames.setParentFrameWasClippedByDisplayCutout(
                clientWindowFrames.isParentFrameClippedByDisplayCutout);

        // Calculate relative frame
        windowFrames.mRelFrame.set(windowFrames.mFrame);
@@ -1399,6 +1405,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        windowFrames.mRelFrame.offsetTo(windowFrames.mFrame.left - parentLeft,
                windowFrames.mFrame.top - parentTop);

        if (requestedWidth != mLastRequestedWidth || requestedHeight != mLastRequestedHeight
                || !mTmpRect.equals(windowFrames.mParentFrame)) {
            mLastRequestedWidth = requestedWidth;
            mLastRequestedHeight = requestedHeight;
            windowFrames.setContentChanged(true);
        }

        if (mAttrs.type == TYPE_DOCK_DIVIDER) {
            if (!windowFrames.mFrame.equals(windowFrames.mLastFrame)) {
                mMovedByResize = true;
@@ -1414,6 +1427,19 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        }

        updateSourceFrame(windowFrames.mFrame);

        if (LOCAL_LAYOUT) {
            if (!mHaveFrame) {
                // The first frame should not be considered as moved.
                updateLastFrames();
            }
        }

        if (mActivityRecord != null && !mIsChildWindow) {
            mActivityRecord.layoutLetterbox(this);
        }
        mSurfacePlacementNeeded = true;
        mHaveFrame = true;
    }

    void updateSourceFrame(Rect winFrame) {