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

Commit be43ac86 authored by chaviw's avatar chaviw
Browse files

Synchronize stack position and size update for split screen

When entering split screen, the secondary window changes position so
it's below the primary split screen when minimized. The WSA at the same
time is also changing size to fit the area. However, the size doesn't
change until the client requests a new size and a frame with the correct
size comes in. This causes the stack to update position before the
resize which causes content to get cut off and then a jump when the resize
completes.

This change updates the WSA position as soon as it recognizes that the
stack changed position due to entering split screen secondary. The WSA
sets its position as the negative of the stack position, making the
calculated window position at (0,0). When a relayout is requested, the
WSA's position is requested back to (0,0), deferring until the new frame.
This will put the WSA position at (0,0) when a frame with the correct size
is drawn. This places the window position at the stack's new position in
the same transaction that a WSA frame with the new size is drawn.

Change-Id: I8c88d7784f827d66926fb5c382af2346028dc48f
Fixes: 74354855
Test: Entering split screen with quick step is smooth
Test: Entering split screen with old launcher still works
parent 6f99da88
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -32326,7 +32326,7 @@ HSPLandroid/view/IWindowSession$Stub$Proxy;->finishDrawing(Landroid/view/IWindow
HSPLandroid/view/IWindowSession$Stub$Proxy;->getDisplayFrame(Landroid/view/IWindow;Landroid/graphics/Rect;)V
HSPLandroid/view/IWindowSession$Stub$Proxy;->getDisplayFrame(Landroid/view/IWindow;Landroid/graphics/Rect;)V
HSPLandroid/view/IWindowSession$Stub$Proxy;->getInTouchMode()Z
HSPLandroid/view/IWindowSession$Stub$Proxy;->getInTouchMode()Z
HSPLandroid/view/IWindowSession$Stub$Proxy;->onRectangleOnScreenRequested(Landroid/os/IBinder;Landroid/graphics/Rect;)V
HSPLandroid/view/IWindowSession$Stub$Proxy;->onRectangleOnScreenRequested(Landroid/os/IBinder;Landroid/graphics/Rect;)V
HSPLandroid/view/IWindowSession$Stub$Proxy;->relayout(Landroid/view/IWindow;ILandroid/view/WindowManager$LayoutParams;IIIILandroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/util/MergedConfiguration;Landroid/view/Surface;)I
HSPLandroid/view/IWindowSession$Stub$Proxy;->relayout(Landroid/view/IWindow;ILandroid/view/WindowManager$LayoutParams;IIIIJLandroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/util/MergedConfiguration;Landroid/view/Surface;)I
HSPLandroid/view/IWindowSession$Stub$Proxy;->setInsets(Landroid/view/IWindow;ILandroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Region;)V
HSPLandroid/view/IWindowSession$Stub$Proxy;->setInsets(Landroid/view/IWindow;ILandroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Region;)V
HSPLandroid/view/IWindowSession$Stub$Proxy;->setTransparentRegion(Landroid/view/IWindow;Landroid/graphics/Region;)V
HSPLandroid/view/IWindowSession$Stub$Proxy;->setTransparentRegion(Landroid/view/IWindow;Landroid/graphics/Region;)V
HSPLandroid/view/IWindowSession$Stub$Proxy;->setWallpaperPosition(Landroid/os/IBinder;FFFF)V
HSPLandroid/view/IWindowSession$Stub$Proxy;->setWallpaperPosition(Landroid/os/IBinder;FFFF)V
@@ -32349,7 +32349,7 @@ HSPLandroid/view/IWindowSession;->performHapticFeedback(Landroid/view/IWindow;IZ
HSPLandroid/view/IWindowSession;->pokeDrawLock(Landroid/os/IBinder;)V
HSPLandroid/view/IWindowSession;->pokeDrawLock(Landroid/os/IBinder;)V
HSPLandroid/view/IWindowSession;->prepareDrag(Landroid/view/IWindow;IIILandroid/view/Surface;)Landroid/os/IBinder;
HSPLandroid/view/IWindowSession;->prepareDrag(Landroid/view/IWindow;IIILandroid/view/Surface;)Landroid/os/IBinder;
HSPLandroid/view/IWindowSession;->prepareToReplaceWindows(Landroid/os/IBinder;Z)V
HSPLandroid/view/IWindowSession;->prepareToReplaceWindows(Landroid/os/IBinder;Z)V
HSPLandroid/view/IWindowSession;->relayout(Landroid/view/IWindow;ILandroid/view/WindowManager$LayoutParams;IIIILandroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/util/MergedConfiguration;Landroid/view/Surface;)I
HSPLandroid/view/IWindowSession;->relayout(Landroid/view/IWindow;ILandroid/view/WindowManager$LayoutParams;IIIIJLandroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/util/MergedConfiguration;Landroid/view/Surface;)I
HSPLandroid/view/IWindowSession;->remove(Landroid/view/IWindow;)V
HSPLandroid/view/IWindowSession;->remove(Landroid/view/IWindow;)V
HSPLandroid/view/IWindowSession;->reportDropResult(Landroid/view/IWindow;Z)V
HSPLandroid/view/IWindowSession;->reportDropResult(Landroid/view/IWindow;Z)V
HSPLandroid/view/IWindowSession;->sendWallpaperCommand(Landroid/os/IBinder;Ljava/lang/String;IIILandroid/os/Bundle;Z)Landroid/os/Bundle;
HSPLandroid/view/IWindowSession;->sendWallpaperCommand(Landroid/os/IBinder;Ljava/lang/String;IIILandroid/os/Bundle;Z)Landroid/os/Bundle;
+1 −1
Original line number Original line Diff line number Diff line
@@ -2164,7 +2164,7 @@ Landroid/view/IWindowManager$Stub$Proxy;->getDockedStackSide()I
Landroid/view/IWindowManager$Stub$Proxy;->getInitialDisplayDensity(I)I
Landroid/view/IWindowManager$Stub$Proxy;->getInitialDisplayDensity(I)I
Landroid/view/IWindowManager$Stub$Proxy;->hasNavigationBar()Z
Landroid/view/IWindowManager$Stub$Proxy;->hasNavigationBar()Z
Landroid/view/IWindowManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/view/IWindowManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/view/IWindowSession$Stub$Proxy;->relayout(Landroid/view/IWindow;ILandroid/view/WindowManager$LayoutParams;IIIILandroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/view/DisplayCutout$ParcelableWrapper;Landroid/util/MergedConfiguration;Landroid/view/Surface;)I
Landroid/view/IWindowSession$Stub$Proxy;->relayout(Landroid/view/IWindow;ILandroid/view/WindowManager$LayoutParams;IIIIJLandroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/view/DisplayCutout$ParcelableWrapper;Landroid/util/MergedConfiguration;Landroid/view/Surface;)I
Landroid/view/KeyCharacterMap$FallbackAction;->keyCode:I
Landroid/view/KeyCharacterMap$FallbackAction;->keyCode:I
Landroid/view/KeyCharacterMap$FallbackAction;->metaState:I
Landroid/view/KeyCharacterMap$FallbackAction;->metaState:I
Landroid/view/KeyCharacterMap;-><init>(J)V
Landroid/view/KeyCharacterMap;-><init>(J)V
+1 −1
Original line number Original line Diff line number Diff line
@@ -813,7 +813,7 @@ public abstract class WallpaperService extends Service {
                    }
                    }
                    final int relayoutResult = mSession.relayout(
                    final int relayoutResult = mSession.relayout(
                        mWindow, mWindow.mSeq, mLayout, mWidth, mHeight,
                        mWindow, mWindow.mSeq, mLayout, mWidth, mHeight,
                            View.VISIBLE, 0, mWinFrame, mOverscanInsets, mContentInsets,
                            View.VISIBLE, 0, -1, mWinFrame, mOverscanInsets, mContentInsets,
                            mVisibleInsets, mStableInsets, mOutsets, mBackdropFrame,
                            mVisibleInsets, mStableInsets, mOutsets, mBackdropFrame,
                            mDisplayCutout, mMergedConfiguration, mSurfaceHolder.mSurface);
                            mDisplayCutout, mMergedConfiguration, mSurfaceHolder.mSurface);


+2 −1
Original line number Original line Diff line number Diff line
@@ -66,6 +66,7 @@ interface IWindowSession {
     * @param viewVisibility Window root view's visibility.
     * @param viewVisibility Window root view's visibility.
     * @param flags Request flags: {@link WindowManagerGlobal#RELAYOUT_INSETS_PENDING},
     * @param flags Request flags: {@link WindowManagerGlobal#RELAYOUT_INSETS_PENDING},
     * {@link WindowManagerGlobal#RELAYOUT_DEFER_SURFACE_DESTROY}.
     * {@link WindowManagerGlobal#RELAYOUT_DEFER_SURFACE_DESTROY}.
     * @param frameNumber A frame number in which changes requested in this layout will be rendered.
     * @param outFrame Rect in which is placed the new position/size on
     * @param outFrame Rect in which is placed the new position/size on
     * screen.
     * screen.
     * @param outOverscanInsets Rect in which is placed the offsets from
     * @param outOverscanInsets Rect in which is placed the offsets from
@@ -96,7 +97,7 @@ interface IWindowSession {
     */
     */
    int relayout(IWindow window, int seq, in WindowManager.LayoutParams attrs,
    int relayout(IWindow window, int seq, in WindowManager.LayoutParams attrs,
            int requestedWidth, int requestedHeight, int viewVisibility,
            int requestedWidth, int requestedHeight, int viewVisibility,
            int flags, out Rect outFrame, out Rect outOverscanInsets,
            int flags, long frameNumber, out Rect outFrame, out Rect outOverscanInsets,
            out Rect outContentInsets, out Rect outVisibleInsets, out Rect outStableInsets,
            out Rect outContentInsets, out Rect outVisibleInsets, out Rect outStableInsets,
            out Rect outOutsets, out Rect outBackdropFrame,
            out Rect outOutsets, out Rect outBackdropFrame,
            out DisplayCutout.ParcelableWrapper displayCutout,
            out DisplayCutout.ParcelableWrapper displayCutout,
+7 −7
Original line number Original line Diff line number Diff line
@@ -6482,17 +6482,17 @@ public final class ViewRootImpl implements ViewParent,
                    params.type = mOrigWindowType;
                    params.type = mOrigWindowType;
                }
                }
            }
            }
        }


        long frameNumber = -1;
        if (mSurface.isValid()) {
        if (mSurface.isValid()) {
                params.frameNumber = mSurface.getNextFrameNumber();
            frameNumber = mSurface.getNextFrameNumber();
            }
        }
        }


        int relayoutResult = mWindowSession.relayout(
        int relayoutResult = mWindowSession.relayout(mWindow, mSeq, params,
                mWindow, mSeq, params,
                (int) (mView.getMeasuredWidth() * appScale + 0.5f),
                (int) (mView.getMeasuredWidth() * appScale + 0.5f),
                (int) (mView.getMeasuredHeight() * appScale + 0.5f),
                (int) (mView.getMeasuredHeight() * appScale + 0.5f), viewVisibility,
                viewVisibility, insetsPending ? WindowManagerGlobal.RELAYOUT_INSETS_PENDING : 0,
                insetsPending ? WindowManagerGlobal.RELAYOUT_INSETS_PENDING : 0, frameNumber,
                mWinFrame, mPendingOverscanInsets, mPendingContentInsets, mPendingVisibleInsets,
                mWinFrame, mPendingOverscanInsets, mPendingContentInsets, mPendingVisibleInsets,
                mPendingStableInsets, mPendingOutsets, mPendingBackDropFrame, mPendingDisplayCutout,
                mPendingStableInsets, mPendingOutsets, mPendingBackDropFrame, mPendingDisplayCutout,
                mPendingMergedConfiguration, mSurface);
                mPendingMergedConfiguration, mSurface);
Loading