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

Commit 488acaca authored by Maryam Dehaini's avatar Maryam Dehaini
Browse files

Do not respond to long click when using mouse

Bug: 326093013
Test: Long click maximize window button. Maximize menu should not open.
Change-Id: Ie65ec9ab949d8036c6ed3ba5406457545e3ce89e
parent 848934ea
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.view.InputDevice.SOURCE_TOUCHSCREEN;
import static android.view.WindowInsets.Type.statusBars;

import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT;
@@ -429,8 +430,11 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
            }

            final long eventDuration = e.getEventTime() - e.getDownTime();
            final boolean shouldLongClick = id == R.id.maximize_window && !mIsDragging
                    && !mHasLongClicked && eventDuration >= ViewConfiguration.getLongPressTimeout();
            final boolean isTouchScreen =
                    (e.getSource() & SOURCE_TOUCHSCREEN) == SOURCE_TOUCHSCREEN;
            final boolean shouldLongClick = isTouchScreen && id == R.id.maximize_window
                    && !mIsDragging && !mHasLongClicked
                    && eventDuration >= ViewConfiguration.getLongPressTimeout();
            if (shouldLongClick) {
                v.performLongClick();
                mHasLongClicked = true;