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

Commit 3c230f6f authored by Kazuki Takise's avatar Kazuki Takise
Browse files

Use latest display ID in DesktopModeWindowDecorViewModel

DesktopModeWindowDecorViewModel#mDisplayId is never updated after
it's initialized, thus once an app moves between displays and this
is used, the desktop mode state gets broken.

This bug was found as part of restart mene developement but not
directly relevant to the feature.

Flag: EXEMPT trivial bug fix
Bug: 421048151
Test: DesktopModeWindowDecorViewModelTests
Change-Id: I58ea1c398fd1478040f279126dd9fdd2806fa78a
parent 4b3c5110
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -1047,7 +1047,6 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
        private final DragDetector mHandleDragDetector;
        private final DragDetector mHeaderDragDetector;
        private final GestureDetector mGestureDetector;
        private final int mDisplayId;
        private final Rect mOnDragStartInitialBounds = new Rect();
        private final Rect mCurrentBounds = new Rect();

@@ -1083,7 +1082,6 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
            mHeaderDragDetector = new DragDetector(this, APP_HEADER_HOLD_TO_DRAG_DURATION_MS,
                    touchSlop);
            mGestureDetector = new GestureDetector(mContext, this);
            mDisplayId = taskInfo.displayId;
        }

        @Override
@@ -1102,14 +1100,14 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
                    WindowContainerTransaction wct = new WindowContainerTransaction();
                    final Function1<IBinder, Unit> runOnTransitionStart =
                            mDesktopTasksController.onDesktopWindowClose(
                                    wct, mDisplayId, decoration.mTaskInfo);
                                    wct, decoration.mTaskInfo.displayId, decoration.mTaskInfo);
                    final IBinder transition = mTaskOperations.closeTask(mTaskToken, wct);
                    if (transition != null) {
                        runOnTransitionStart.invoke(transition);
                    }
                }
            } else if (id == R.id.back_button) {
                mTaskOperations.injectBackKey(mDisplayId);
                mTaskOperations.injectBackKey(decoration.mTaskInfo.displayId);
            } else if (id == R.id.caption_handle || id == R.id.open_menu_button) {
                if (id == R.id.caption_handle && !decoration.mTaskInfo.isFreeform()) {
                    // Clicking the App Handle.