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

Commit bd4e77cc authored by Pat Manning's avatar Pat Manning Committed by Android (Google) Code Review
Browse files

Merge "Check taskbar stash state for hover only on hover events." into udc-qpr-dev

parents 7f347e93 3447016c
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
 */
package com.android.quickstep.inputconsumers;

import static android.view.MotionEvent.ACTION_BUTTON_RELEASE;
import static android.view.MotionEvent.INVALID_POINTER_ID;

import static com.android.launcher3.MotionEventsUtils.isTrackpadMotionEvent;
@@ -29,6 +28,7 @@ import android.graphics.PointF;
import android.graphics.Rect;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.InputDevice;
import android.view.MotionEvent;

import androidx.annotation.Nullable;
@@ -130,8 +130,8 @@ public class TaskbarUnstashInputConsumer extends DelegateInputConsumer {
    public void onMotionEvent(MotionEvent ev) {
        mLongPressDetector.onTouchEvent(ev);
        if (mState != STATE_ACTIVE) {
            boolean isStashedTaskbarHovered =
                    isStashedTaskbarHovered((int) ev.getX(), (int) ev.getY());
            boolean isStashedTaskbarHovered = isMouseEvent(ev)
                    && isStashedTaskbarHovered((int) ev.getX(), (int) ev.getY());
            if (!isStashedTaskbarHovered) {
                mDelegate.onMotionEvent(ev);
            }
@@ -229,7 +229,7 @@ public class TaskbarUnstashInputConsumer extends DelegateInputConsumer {
                        mHasPassedTaskbarNavThreshold = false;
                        mIsInBubbleBarArea = false;
                        break;
                    case ACTION_BUTTON_RELEASE:
                    case MotionEvent.ACTION_BUTTON_RELEASE:
                        if (isStashedTaskbarHovered) {
                            mOverviewCommandHelper.addCommand(OverviewCommandHelper.TYPE_HOME);
                        }
@@ -342,4 +342,8 @@ public class TaskbarUnstashInputConsumer extends DelegateInputConsumer {
                dp.heightPx);
        return mStashedTaskbarHandleBounds.contains(x, y);
    }

    private boolean isMouseEvent(MotionEvent event) {
        return event.getSource() == InputDevice.SOURCE_MOUSE;
    }
}
+10 −6
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import static com.android.launcher3.testing.shared.TestProtocol.REQUEST_STASHED_
import android.graphics.Point;
import android.graphics.Rect;
import android.os.SystemClock;
import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.ViewConfiguration;

@@ -308,7 +309,8 @@ public final class LaunchedAppState extends Background {
            Point stashedTaskbarHintArea = new Point(mLauncher.getRealDisplaySize().x / 2,
                    mLauncher.getRealDisplaySize().y - stashedTaskbarBottomEdge - 1);
            mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_HOVER_ENTER,
                    new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y), null);
                    new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y), null,
                    InputDevice.SOURCE_MOUSE);

            mLauncher.getDevice().wait(mStashedTaskbarHintScaleCondition,
                    LauncherInstrumentation.WAIT_TIME_MS);
@@ -317,19 +319,21 @@ public final class LaunchedAppState extends Background {
                    "cursor clicking stashed taskbar to go home")) {
                mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_HOVER_EXIT,
                        new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y),
                        null);
                        null, InputDevice.SOURCE_MOUSE);
                mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN,
                        new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y),
                        LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER);
                        LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER,
                        InputDevice.SOURCE_MOUSE);
                mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_BUTTON_PRESS,
                        new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y),
                        null);
                        null, InputDevice.SOURCE_MOUSE);
                mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_BUTTON_RELEASE,
                        new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y),
                        null);
                        null, InputDevice.SOURCE_MOUSE);
                mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_UP,
                        new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y),
                        LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER);
                        LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER,
                        InputDevice.SOURCE_MOUSE);

                return mLauncher.getWorkspace();
            }
+11 −5
Original line number Diff line number Diff line
@@ -1728,11 +1728,11 @@ public final class LauncherInstrumentation {
    }

    private static MotionEvent getMotionEvent(long downTime, long eventTime, int action,
            float x, float y) {
            float x, float y, int source) {
        return MotionEvent.obtain(downTime, eventTime, action, 1,
                new MotionEvent.PointerProperties[]{getPointerProperties(0)},
                new MotionEvent.PointerCoords[]{getPointerCoords(x, y)},
                0, 0, 1.0f, 1.0f, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0);
                0, 0, 1.0f, 1.0f, 0, 0, source, 0);
    }

    private static MotionEvent.PointerProperties getPointerProperties(int pointerId) {
@@ -1768,6 +1768,12 @@ public final class LauncherInstrumentation {

    public void sendPointer(long downTime, long currentTime, int action, Point point,
            GestureScope gestureScope) {
        sendPointer(downTime, currentTime, action, point, gestureScope,
                InputDevice.SOURCE_TOUCHSCREEN);
    }

    public void sendPointer(long downTime, long currentTime, int action, Point point,
            GestureScope gestureScope, int source) {
        final boolean hasTIS = hasTIS();
        int pointerCount = mPointerCount;

@@ -1867,7 +1873,7 @@ public final class LauncherInstrumentation {
                ? getTrackpadMotionEvent(
                        downTime, currentTime, action, point.x, point.y, pointerCount,
                        mTrackpadGestureType)
                : getMotionEvent(downTime, currentTime, action, point.x, point.y);
                : getMotionEvent(downTime, currentTime, action, point.x, point.y, source);
        if (action == MotionEvent.ACTION_BUTTON_PRESS
                || action == MotionEvent.ACTION_BUTTON_RELEASE) {
            event.setActionButton(MotionEvent.BUTTON_PRIMARY);