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

Commit a4a58efe authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Fix app staying in drag resizing when undocking

When dismissing the docked stack, the fullscreen stack stayed in drag
resize mode because it got a relayout, but because the bounds didn't
change (it switches to the fullscreen layout a bit earlier) it never
called WM.relayoutWindow, so it stayed in drag resize mode indefinitely.

To fix this, introduce forceRelayout in Window.resized(), which makes
sure the client always calls relayoutWindow. Set this to true whenever
drag resizing is changing.

For some very weird reason this also broke that home button was not
responding anymore.

Bug: 26806532
Change-Id: I4b39c1c419a166aa7093c31226f2a4915f642328
parent 08b372f7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -271,7 +271,7 @@ public abstract class WallpaperService extends Service {
            @Override
            public void resized(Rect frame, Rect overscanInsets, Rect contentInsets,
                    Rect visibleInsets, Rect stableInsets, Rect outsets, boolean reportDraw,
                    Configuration newConfig, Rect backDropRect) {
                    Configuration newConfig, Rect backDropRect, boolean forceLayout) {
                Message msg = mCaller.obtainMessageIO(MSG_WINDOW_RESIZED,
                        reportDraw ? 1 : 0, outsets);
                mCaller.sendMessage(msg);
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ oneway interface IWindow {

    void resized(in Rect frame, in Rect overscanInsets, in Rect contentInsets,
            in Rect visibleInsets, in Rect stableInsets, in Rect outsets, boolean reportDraw,
            in Configuration newConfig, in Rect backDropFrame);
            in Configuration newConfig, in Rect backDropFrame, boolean forceLayout);
    void moved(int newX, int newY);
    void dispatchAppVisibility(boolean visible);
    void dispatchGetNewSurface();
+3 −2
Original line number Diff line number Diff line
@@ -698,7 +698,7 @@ public class SurfaceView extends View {
        @Override
        public void resized(Rect frame, Rect overscanInsets, Rect contentInsets,
                Rect visibleInsets, Rect stableInsets, Rect outsets, boolean reportDraw,
                Configuration newConfig, Rect backDropRect) {
                Configuration newConfig, Rect backDropRect, boolean forceLayout) {
            SurfaceView surfaceView = mSurfaceView.get();
            if (surfaceView != null) {
                if (DEBUG) Log.v(
@@ -711,7 +711,8 @@ public class SurfaceView extends View {
                        surfaceView.mReportDrawNeeded = true;
                        surfaceView.mHandler.sendEmptyMessage(UPDATE_WINDOW_MSG);
                    } else if (surfaceView.mWinFrame.width() != frame.width()
                            || surfaceView.mWinFrame.height() != frame.height()) {
                            || surfaceView.mWinFrame.height() != frame.height()
                            || forceLayout) {
                        surfaceView.mUpdateWindowNeeded = true;
                        surfaceView.mHandler.sendEmptyMessage(UPDATE_WINDOW_MSG);
                    }
+12 −5
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.view;

import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
@@ -263,6 +264,7 @@ public final class ViewRootImpl implements ViewParent,
    boolean mNewSurfaceNeeded;
    boolean mHasHadWindowFocus;
    boolean mLastWasImTarget;
    boolean mForceNextWindowRelayout;
    CountDownLatch mWindowDrawCountDown;

    boolean mIsDrawing;
@@ -1625,7 +1627,8 @@ public final class ViewRootImpl implements ViewParent,

        final boolean isViewVisible = viewVisibility == View.VISIBLE;
        if (mFirst || windowShouldResize || insetsChanged ||
                viewVisibilityChanged || params != null) {
                viewVisibilityChanged || params != null || mForceNextWindowRelayout) {
            mForceNextWindowRelayout = false;

            if (isViewVisible) {
                // If this window is giving internal insets to the window
@@ -3366,7 +3369,8 @@ public final class ViewRootImpl implements ViewParent,
                        && mPendingVisibleInsets.equals(args.arg3)
                        && mPendingOutsets.equals(args.arg7)
                        && mPendingBackDropFrame.equals(args.arg8)
                        && args.arg4 == null) {
                        && args.arg4 == null
                        && args.argi1 == 0) {
                    break;
                }
                } // fall through...
@@ -3386,6 +3390,7 @@ public final class ViewRootImpl implements ViewParent,
                    mPendingVisibleInsets.set((Rect) args.arg3);
                    mPendingOutsets.set((Rect) args.arg7);
                    mPendingBackDropFrame.set((Rect) args.arg8);
                    mForceNextWindowRelayout = args.argi1 != 0;

                    args.recycle();

@@ -5830,7 +5835,7 @@ public final class ViewRootImpl implements ViewParent,

    public void dispatchResized(Rect frame, Rect overscanInsets, Rect contentInsets,
            Rect visibleInsets, Rect stableInsets, Rect outsets, boolean reportDraw,
            Configuration newConfig, Rect backDropFrame) {
            Configuration newConfig, Rect backDropFrame, boolean forceLayout) {
        if (DEBUG_LAYOUT) Log.v(mTag, "Resizing " + this + ": frame=" + frame.toShortString()
                + " contentInsets=" + contentInsets.toShortString()
                + " visibleInsets=" + visibleInsets.toShortString()
@@ -5864,6 +5869,7 @@ public final class ViewRootImpl implements ViewParent,
        args.arg6 = sameProcessCall ? new Rect(stableInsets) : stableInsets;
        args.arg7 = sameProcessCall ? new Rect(outsets) : outsets;
        args.arg8 = sameProcessCall ? new Rect(backDropFrame) : backDropFrame;
        args.argi1 = forceLayout ? 1 : 0;
        msg.obj = args;
        mHandler.sendMessage(msg);
    }
@@ -6879,11 +6885,12 @@ public final class ViewRootImpl implements ViewParent,
        @Override
        public void resized(Rect frame, Rect overscanInsets, Rect contentInsets,
                Rect visibleInsets, Rect stableInsets, Rect outsets, boolean reportDraw,
                Configuration newConfig, Rect backDropFrame) {
                Configuration newConfig, Rect backDropFrame, boolean forceLayout) {
            final ViewRootImpl viewAncestor = mViewAncestor.get();
            if (viewAncestor != null) {
                viewAncestor.dispatchResized(frame, overscanInsets, contentInsets,
                        visibleInsets, stableInsets, outsets, reportDraw, newConfig, backDropFrame);
                        visibleInsets, stableInsets, outsets, reportDraw, newConfig, backDropFrame,
                        forceLayout);
            }
        }

+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ public class BaseIWindow extends IWindow.Stub {
    @Override
    public void resized(Rect frame, Rect overscanInsets, Rect contentInsets, Rect visibleInsets,
            Rect stableInsets, Rect outsets, boolean reportDraw, Configuration newConfig,
            Rect backDropFrame) {
            Rect backDropFrame, boolean forceLayout) {
        if (reportDraw) {
            try {
                mSession.finishDrawing(this);
Loading