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

Commit d7e06cff authored by Tiger Huang's avatar Tiger Huang Committed by Android (Google) Code Review
Browse files

Merge "Make sure to update last frames after handling moving and resizing" into main

parents b416db5e 3c62c008
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -937,6 +937,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
                // so we still request the window to resize if the current frame is empty.
                if (!w.getFrame().isEmpty()) {
                    w.updateLastFrames();
                    mWmService.mFrameChangingWindows.remove(w);
                }
                w.onResizeHandled();
            }
+12 −0
Original line number Diff line number Diff line
@@ -847,6 +847,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
        }

        handleResizingWindows();
        clearFrameChangingWindows();

        if (mWmService.mDisplayFrozen) {
            ProtoLog.v(WM_DEBUG_ORIENTATION,
@@ -1014,6 +1015,17 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
        }
    }

    /**
     * Clears frame changing windows after handling moving and resizing windows.
     */
    private void clearFrameChangingWindows() {
        final ArrayList<WindowState> frameChangingWindows = mWmService.mFrameChangingWindows;
        for (int i = frameChangingWindows.size() - 1; i >= 0; i--) {
            frameChangingWindows.get(i).updateLastFrames();
        }
        frameChangingWindows.clear();
    }

    /**
     * @param w        WindowState this method is applied to.
     * @param obscured True if there is a window on top of this obscuring the display.
+2 −1
Original line number Diff line number Diff line
@@ -51,7 +51,8 @@ public class WindowFrames {
    final Rect mFrame = new Rect();

    /**
     * The last real frame that was reported to the client.
     * The frame used to check if mFrame is changed, e.g., moved or resized.  It will be committed
     * after handling the moving or resizing windows.
     */
    final Rect mLastFrame = new Rect();

+6 −0
Original line number Diff line number Diff line
@@ -587,6 +587,12 @@ public class WindowManagerService extends IWindowManager.Stub
     */
    final ArrayList<WindowState> mResizingWindows = new ArrayList<>();

    /**
     * Windows that their frames are being changed.  Used so we can clear the frame-changing states
     * after handling the moved or resized windows.
     */
    final ArrayList<WindowState> mFrameChangingWindows = new ArrayList<>();

    /**
     * Mapping of displayId to {@link DisplayImePolicy}.
     * Note that this can be accessed without holding the lock.
+5 −4
Original line number Diff line number Diff line
@@ -1347,6 +1347,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            windowFrames.setContentChanged(true);
        }

        if (!windowFrames.mFrame.equals(windowFrames.mLastFrame)
                || !windowFrames.mRelFrame.equals(windowFrames.mLastRelFrame)) {
            mWmService.mFrameChangingWindows.add(this);
        }

        if (mAttrs.type == TYPE_DOCK_DIVIDER) {
            if (!windowFrames.mFrame.equals(windowFrames.mLastFrame)) {
                mMovedByResize = true;
@@ -3717,10 +3722,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        mDragResizingChangeReported = true;
        mWindowFrames.clearReportResizeHints();

        // We update mLastFrame always rather than in the conditional with the last inset
        // variables, because mFrameSizeChanged only tracks the width and height changing.
        updateLastFrames();

        final int prevRotation = mLastReportedConfiguration
                .getMergedConfiguration().windowConfiguration.getRotation();
        fillClientWindowFramesAndConfiguration(mClientWindowFrames, mLastReportedConfiguration,