Merge "Fix trackpad gesture not able to pull down notification"
This commit is contained in:
@@ -232,9 +232,9 @@ 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) {
|
||||
public boolean isInSwipeUpTouchRegion(MotionEvent event, BaseActivityInterface activity) {
|
||||
if (isTrackpadMotionEvent(event)) {
|
||||
return true;
|
||||
return !activity.isResumed();
|
||||
}
|
||||
return mOrientationTouchTransformer.touchInValidSwipeRegions(event.getX(), event.getY());
|
||||
}
|
||||
@@ -243,9 +243,10 @@ public class RotationTouchHelper implements DisplayInfoChangeListener {
|
||||
* @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) {
|
||||
public boolean isInSwipeUpTouchRegion(MotionEvent event, int pointerIndex,
|
||||
BaseActivityInterface activity) {
|
||||
if (isTrackpadMotionEvent(event)) {
|
||||
return true;
|
||||
return !activity.isResumed();
|
||||
}
|
||||
return mOrientationTouchTransformer.touchInValidSwipeRegions(event.getX(pointerIndex),
|
||||
event.getY(pointerIndex));
|
||||
|
||||
@@ -20,6 +20,7 @@ import static android.view.MotionEvent.ACTION_CANCEL;
|
||||
import static android.view.MotionEvent.ACTION_DOWN;
|
||||
import static android.view.MotionEvent.ACTION_UP;
|
||||
|
||||
import static com.android.launcher3.Utilities.isTrackpadMotionEvent;
|
||||
import static com.android.launcher3.config.FeatureFlags.ASSISTANT_GIVES_LAUNCHER_FOCUS;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.quickstep.GestureState.DEFAULT_STATE;
|
||||
@@ -619,7 +620,8 @@ public class TouchInteractionService extends Service
|
||||
mRotationTouchHelper.setOrientationTransformIfNeeded(event);
|
||||
|
||||
if (!mDeviceState.isOneHandedModeActive()
|
||||
&& mRotationTouchHelper.isInSwipeUpTouchRegion(event)) {
|
||||
&& mRotationTouchHelper.isInSwipeUpTouchRegion(event,
|
||||
mOverviewComponentObserver.getActivityInterface())) {
|
||||
// Clone the previous gesture state since onConsumerAboutToBeSwitched might trigger
|
||||
// onConsumerInactive and wipe the previous gesture state
|
||||
GestureState prevGestureState = new GestureState(mGestureState);
|
||||
@@ -850,7 +852,7 @@ public class TouchInteractionService extends Service
|
||||
.append("accessibility menu is available")
|
||||
.append(", using AccessibilityInputConsumer");
|
||||
base = new AccessibilityInputConsumer(
|
||||
this, mDeviceState, base, mInputMonitorCompat);
|
||||
this, mDeviceState, mGestureState, base, mInputMonitorCompat);
|
||||
}
|
||||
} else {
|
||||
String reasonPrefix = "device is not in gesture navigation mode";
|
||||
|
||||
@@ -29,6 +29,7 @@ import android.view.VelocityTracker;
|
||||
import android.view.ViewConfiguration;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.quickstep.GestureState;
|
||||
import com.android.quickstep.InputConsumer;
|
||||
import com.android.quickstep.RecentsAnimationDeviceState;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
@@ -46,6 +47,7 @@ public class AccessibilityInputConsumer extends DelegateInputConsumer {
|
||||
private final VelocityTracker mVelocityTracker;
|
||||
private final MotionPauseDetector mMotionPauseDetector;
|
||||
private final RecentsAnimationDeviceState mDeviceState;
|
||||
private final GestureState mGestureState;
|
||||
|
||||
private final float mMinGestureDistance;
|
||||
private final float mMinFlingVelocity;
|
||||
@@ -55,7 +57,7 @@ public class AccessibilityInputConsumer extends DelegateInputConsumer {
|
||||
private float mTotalY;
|
||||
|
||||
public AccessibilityInputConsumer(Context context, RecentsAnimationDeviceState deviceState,
|
||||
InputConsumer delegate, InputMonitorCompat inputMonitor) {
|
||||
GestureState gestureState, InputConsumer delegate, InputMonitorCompat inputMonitor) {
|
||||
super(delegate, inputMonitor);
|
||||
mContext = context;
|
||||
mVelocityTracker = VelocityTracker.obtain();
|
||||
@@ -63,6 +65,7 @@ public class AccessibilityInputConsumer extends DelegateInputConsumer {
|
||||
.getDimension(R.dimen.accessibility_gesture_min_swipe_distance);
|
||||
mMinFlingVelocity = ViewConfiguration.get(context).getScaledMinimumFlingVelocity();
|
||||
mDeviceState = deviceState;
|
||||
mGestureState = gestureState;
|
||||
|
||||
mMotionPauseDetector = new MotionPauseDetector(context);
|
||||
}
|
||||
@@ -99,8 +102,8 @@ public class AccessibilityInputConsumer extends DelegateInputConsumer {
|
||||
case ACTION_POINTER_DOWN: {
|
||||
if (mState == STATE_INACTIVE) {
|
||||
int pointerIndex = ev.getActionIndex();
|
||||
if (mDeviceState.getRotationTouchHelper()
|
||||
.isInSwipeUpTouchRegion(ev, pointerIndex)
|
||||
if (mDeviceState.getRotationTouchHelper().isInSwipeUpTouchRegion(ev,
|
||||
pointerIndex, mGestureState.getActivityInterface())
|
||||
&& mDelegate.allowInterceptByParent()) {
|
||||
setActive(ev);
|
||||
|
||||
|
||||
@@ -154,7 +154,8 @@ 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)) {
|
||||
if (!mDeviceState.getRotationTouchHelper().isInSwipeUpTouchRegion(ev, ptrIdx,
|
||||
mGestureState.getActivityInterface())) {
|
||||
int action = ev.getAction();
|
||||
ev.setAction(ACTION_CANCEL);
|
||||
finishTouchTracking(ev);
|
||||
|
||||
@@ -236,7 +236,8 @@ 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)) {
|
||||
if (!mRotationTouchHelper.isInSwipeUpTouchRegion(ev, ptrIdx,
|
||||
mActivityInterface)) {
|
||||
forceCancelGesture(ev);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user