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

This commit is contained in:
Tracy Zhou
2023-05-18 17:56:35 +00:00
committed by Android (Google) Code Review
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 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_ALL;
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.
*/
public boolean isInSwipeUpTouchRegion(MotionEvent event, BaseActivityInterface activity) {
return isInSwipeUpTouchRegion(event, 0, activity);
public boolean isInSwipeUpTouchRegion(MotionEvent event) {
return isInSwipeUpTouchRegion(event, 0);
}
/**
* @return whether the coordinates of the {@param event} with the given {@param pointerIndex}
* is in the swipe up gesture region.
*/
public boolean isInSwipeUpTouchRegion(MotionEvent event, int pointerIndex,
BaseActivityInterface activity) {
public boolean isInSwipeUpTouchRegion(MotionEvent event, int pointerIndex) {
if (isTrackpadScroll(event)) {
return false;
}
if (isTrackpadMultiFingerSwipe(event)) {
return true;
}
@@ -661,8 +661,7 @@ public class TouchInteractionService extends Service
mRotationTouchHelper.setOrientationTransformIfNeeded(event);
if ((!mDeviceState.isOneHandedModeActive()
&& mRotationTouchHelper.isInSwipeUpTouchRegion(event,
mOverviewComponentObserver.getActivityInterface()))
&& mRotationTouchHelper.isInSwipeUpTouchRegion(event))
|| isHoverActionWithoutConsumer) {
// Clone the previous gesture state since onConsumerAboutToBeSwitched might trigger
// onConsumerInactive and wipe the previous gesture state
@@ -103,8 +103,7 @@ public class AccessibilityInputConsumer extends DelegateInputConsumer {
if (mState == STATE_INACTIVE) {
int pointerIndex = ev.getActionIndex();
if (mDeviceState.getRotationTouchHelper().isInSwipeUpTouchRegion(ev,
pointerIndex, mGestureState.getActivityInterface())
&& mDelegate.allowInterceptByParent()) {
pointerIndex) && mDelegate.allowInterceptByParent()) {
setActive(ev);
mActivePointerId = ev.getPointerId(pointerIndex);
@@ -153,8 +153,7 @@ public class DeviceLockedInputConsumer implements InputConsumer,
if (!mThresholdCrossed) {
// Cancel interaction in case of multi-touch interaction
int ptrIdx = ev.getActionIndex();
if (!mDeviceState.getRotationTouchHelper().isInSwipeUpTouchRegion(ev, ptrIdx,
mGestureState.getActivityInterface())) {
if (!mDeviceState.getRotationTouchHelper().isInSwipeUpTouchRegion(ev, ptrIdx)) {
int action = ev.getAction();
ev.setAction(ACTION_CANCEL);
finishTouchTracking(ev);
@@ -248,8 +248,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
if (!mPassedPilferInputSlop) {
// Cancel interaction in case of multi-touch interaction
int ptrIdx = ev.getActionIndex();
if (!mRotationTouchHelper.isInSwipeUpTouchRegion(ev, ptrIdx,
mActivityInterface)) {
if (!mRotationTouchHelper.isInSwipeUpTouchRegion(ev, ptrIdx)) {
forceCancelGesture(ev);
}
}