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

Commit 9be7fc11 authored by Vania Desmonda's avatar Vania Desmonda
Browse files

Pass in InputMethod.KEYBOARD when toggling maximize window using

keyboard shortcuts.

Fixes: 375356876
Test: atest DesktopModeEventLogger
Flag: com.android.window.flags.enable_resizing_metrics
Change-Id: Ief6960bb99fd007816fd1870b35c04051a1f8449
parent 999166cd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -446,6 +446,7 @@ class DesktopModeEventLogger {
            val displayArea: Int?,
        )

        @JvmStatic
        fun getInputMethodFromMotionEvent(e: MotionEvent?): InputMethod {
            if (e == null) return InputMethod.UNKNOWN_INPUT_METHOD

+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ class DesktopModeKeyGestureHandler(
                    desktopTasksController.get().toggleDesktopTaskSize(
                        it,
                        ResizeTrigger.MAXIMIZE_MENU,
                        null,
                        DesktopModeEventLogger.Companion.InputMethod.KEYBOARD,
                    )
                }
                return true
+8 −4
Original line number Diff line number Diff line
@@ -821,12 +821,12 @@ class DesktopTasksController(
    fun toggleDesktopTaskSize(
        taskInfo: RunningTaskInfo,
        resizeTrigger: ResizeTrigger,
        motionEvent: MotionEvent?,
        inputMethod: InputMethod,
    ) {
        val currentTaskBounds = taskInfo.configuration.windowConfiguration.bounds
        desktopModeEventLogger.logTaskResizingStarted(
            resizeTrigger,
            DesktopModeEventLogger.getInputMethodFromMotionEvent(motionEvent),
            inputMethod,
            taskInfo,
            currentTaskBounds.width(),
            currentTaskBounds.height(),
@@ -879,7 +879,7 @@ class DesktopTasksController(
        taskbarDesktopTaskListener?.onTaskbarCornerRoundingUpdate(doesAnyTaskRequireTaskbarRounding)
        val wct = WindowContainerTransaction().setBounds(taskInfo.token, destinationBounds)
        desktopModeEventLogger.logTaskResizingEnded(
            resizeTrigger, DesktopModeEventLogger.getInputMethodFromMotionEvent(motionEvent),
            resizeTrigger, inputMethod,
            taskInfo, destinationBounds.width(),
            destinationBounds.height(), displayController
        )
@@ -911,7 +911,11 @@ class DesktopTasksController(
            return
        }

        toggleDesktopTaskSize(taskInfo, ResizeTrigger.DRAG_TO_TOP_RESIZE_TRIGGER, motionEvent)
        toggleDesktopTaskSize(
            taskInfo,
            ResizeTrigger.DRAG_TO_TOP_RESIZE_TRIGGER,
            DesktopModeEventLogger.getInputMethodFromMotionEvent(motionEvent)
        )
    }

    private fun getMaximizeBounds(taskInfo: RunningTaskInfo, stableBounds: Rect): Rect {
+2 −2
Original line number Diff line number Diff line
@@ -584,7 +584,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
                decoration.mTaskSurface, mContext, mMainHandler,
                Cuj.CUJ_DESKTOP_MODE_MAXIMIZE_WINDOW, source);
        mDesktopTasksController.toggleDesktopTaskSize(decoration.mTaskInfo, resizeTrigger,
                motionEvent);
                DesktopModeEventLogger.getInputMethodFromMotionEvent(motionEvent));
        decoration.closeHandleMenu();
        decoration.closeMaximizeMenu();
    }
@@ -1575,7 +1575,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,

        final DesktopModeTouchEventListener touchEventListener =
                new DesktopModeTouchEventListener(taskInfo, taskPositioner);
        InputMethod inputMethod = DesktopModeEventLogger.Companion.getInputMethodFromMotionEvent(
        InputMethod inputMethod = DesktopModeEventLogger.getInputMethodFromMotionEvent(
                touchEventListener.mMotionEvent);
        windowDecoration.setOnMaximizeOrRestoreClickListener(() -> {
            onMaximizeOrRestore(taskInfo.taskId, "maximize_menu", ResizeTrigger.MAXIMIZE_MENU,
+2 −2
Original line number Diff line number Diff line
@@ -460,7 +460,7 @@ class DragResizeInputListener implements AutoCloseable {
                                || ctrlType == CTRL_TYPE_RIGHT || ctrlType == CTRL_TYPE_LEFT)
                                ? ResizeTrigger.EDGE : ResizeTrigger.CORNER;
                        mDesktopModeEventLogger.logTaskResizingStarted(mResizeTrigger,
                                DesktopModeEventLogger.Companion.getInputMethodFromMotionEvent(e),
                                DesktopModeEventLogger.getInputMethodFromMotionEvent(e),
                                mTaskInfo, mDragStartTaskBounds.width(),
                                mDragStartTaskBounds.height(), /* displayController= */ null,
                                /* displayLayoutSize= */ mDisplayLayoutSizeSupplier.get());
@@ -514,7 +514,7 @@ class DragResizeInputListener implements AutoCloseable {
                        }

                        mDesktopModeEventLogger.logTaskResizingEnded(mResizeTrigger,
                                DesktopModeEventLogger.Companion.getInputMethodFromMotionEvent(
                                DesktopModeEventLogger.getInputMethodFromMotionEvent(
                                        mLastMotionEventOnDown), mTaskInfo, taskBounds.width(),
                                taskBounds.height(),
                                /* displayController= */ null,
Loading