Merge "Disallow two finger gesture nav behaviors when the cursor is in the zones" into udc-qpr-dev am: 6e40620f68

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23295794

Change-Id: I8737c2ff646f16aacdd0c263029524b89255142a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Tracy Zhou
2023-05-18 18:41:43 +00:00
committed by Automerger Merge Worker
5 changed files with 11 additions and 12 deletions
@@ -19,6 +19,7 @@ import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.Surface.ROTATION_0; import static android.view.Surface.ROTATION_0;
import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe; import static com.android.launcher3.MotionEventsUtils.isTrackpadMultiFingerSwipe;
import static com.android.launcher3.MotionEventsUtils.isTrackpadScroll;
import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN; import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN;
import static com.android.launcher3.util.DisplayController.CHANGE_ALL; import static com.android.launcher3.util.DisplayController.CHANGE_ALL;
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE; import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
@@ -232,16 +233,18 @@ public class RotationTouchHelper implements DisplayInfoChangeListener {
/** /**
* @return whether the coordinates of the {@param event} is in the swipe up gesture region. * @return whether the coordinates of the {@param event} is in the swipe up gesture region.
*/ */
public boolean isInSwipeUpTouchRegion(MotionEvent event, BaseActivityInterface activity) { public boolean isInSwipeUpTouchRegion(MotionEvent event) {
return isInSwipeUpTouchRegion(event, 0, activity); return isInSwipeUpTouchRegion(event, 0);
} }
/** /**
* @return whether the coordinates of the {@param event} with the given {@param pointerIndex} * @return whether the coordinates of the {@param event} with the given {@param pointerIndex}
* is in the swipe up gesture region. * is in the swipe up gesture region.
*/ */
public boolean isInSwipeUpTouchRegion(MotionEvent event, int pointerIndex, public boolean isInSwipeUpTouchRegion(MotionEvent event, int pointerIndex) {
BaseActivityInterface activity) { if (isTrackpadScroll(event)) {
return false;
}
if (isTrackpadMultiFingerSwipe(event)) { if (isTrackpadMultiFingerSwipe(event)) {
return true; return true;
} }
@@ -661,8 +661,7 @@ public class TouchInteractionService extends Service
mRotationTouchHelper.setOrientationTransformIfNeeded(event); mRotationTouchHelper.setOrientationTransformIfNeeded(event);
if ((!mDeviceState.isOneHandedModeActive() if ((!mDeviceState.isOneHandedModeActive()
&& mRotationTouchHelper.isInSwipeUpTouchRegion(event, && mRotationTouchHelper.isInSwipeUpTouchRegion(event))
mOverviewComponentObserver.getActivityInterface()))
|| isHoverActionWithoutConsumer) { || isHoverActionWithoutConsumer) {
// Clone the previous gesture state since onConsumerAboutToBeSwitched might trigger // Clone the previous gesture state since onConsumerAboutToBeSwitched might trigger
// onConsumerInactive and wipe the previous gesture state // onConsumerInactive and wipe the previous gesture state
@@ -103,8 +103,7 @@ public class AccessibilityInputConsumer extends DelegateInputConsumer {
if (mState == STATE_INACTIVE) { if (mState == STATE_INACTIVE) {
int pointerIndex = ev.getActionIndex(); int pointerIndex = ev.getActionIndex();
if (mDeviceState.getRotationTouchHelper().isInSwipeUpTouchRegion(ev, if (mDeviceState.getRotationTouchHelper().isInSwipeUpTouchRegion(ev,
pointerIndex, mGestureState.getActivityInterface()) pointerIndex) && mDelegate.allowInterceptByParent()) {
&& mDelegate.allowInterceptByParent()) {
setActive(ev); setActive(ev);
mActivePointerId = ev.getPointerId(pointerIndex); mActivePointerId = ev.getPointerId(pointerIndex);
@@ -153,8 +153,7 @@ public class DeviceLockedInputConsumer implements InputConsumer,
if (!mThresholdCrossed) { if (!mThresholdCrossed) {
// Cancel interaction in case of multi-touch interaction // Cancel interaction in case of multi-touch interaction
int ptrIdx = ev.getActionIndex(); int ptrIdx = ev.getActionIndex();
if (!mDeviceState.getRotationTouchHelper().isInSwipeUpTouchRegion(ev, ptrIdx, if (!mDeviceState.getRotationTouchHelper().isInSwipeUpTouchRegion(ev, ptrIdx)) {
mGestureState.getActivityInterface())) {
int action = ev.getAction(); int action = ev.getAction();
ev.setAction(ACTION_CANCEL); ev.setAction(ACTION_CANCEL);
finishTouchTracking(ev); finishTouchTracking(ev);
@@ -248,8 +248,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
if (!mPassedPilferInputSlop) { if (!mPassedPilferInputSlop) {
// Cancel interaction in case of multi-touch interaction // Cancel interaction in case of multi-touch interaction
int ptrIdx = ev.getActionIndex(); int ptrIdx = ev.getActionIndex();
if (!mRotationTouchHelper.isInSwipeUpTouchRegion(ev, ptrIdx, if (!mRotationTouchHelper.isInSwipeUpTouchRegion(ev, ptrIdx)) {
mActivityInterface)) {
forceCancelGesture(ev); forceCancelGesture(ev);
} }
} }