Merge "Consistently multiply touch slop for InputConsumers" into udc-dev am: 8d402efac2
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23122637 Change-Id: I16f2310feec73c677ae603649205bdeb233388d5 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -58,6 +58,7 @@ import android.os.SystemProperties;
|
|||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
import android.view.ViewConfiguration;
|
||||||
|
|
||||||
import androidx.annotation.BinderThread;
|
import androidx.annotation.BinderThread;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -87,6 +88,10 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener {
|
|||||||
|
|
||||||
static final String SUPPORT_ONE_HANDED_MODE = "ro.support_one_handed_mode";
|
static final String SUPPORT_ONE_HANDED_MODE = "ro.support_one_handed_mode";
|
||||||
|
|
||||||
|
// TODO: Move to quickstep contract
|
||||||
|
private static final float QUICKSTEP_TOUCH_SLOP_RATIO_TWO_BUTTON = 9;
|
||||||
|
private static final float QUICKSTEP_TOUCH_SLOP_RATIO_GESTURAL = 2;
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final DisplayController mDisplayController;
|
private final DisplayController mDisplayController;
|
||||||
private final int mDisplayId;
|
private final int mDisplayId;
|
||||||
@@ -577,6 +582,19 @@ public class RecentsAnimationDeviceState implements DisplayInfoChangeListener {
|
|||||||
&& ((mSystemUiStateFlags & SYSUI_STATE_IME_SHOWING) != 0);
|
&& ((mSystemUiStateFlags & SYSUI_STATE_IME_SHOWING) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the touch slop for {@link InputConsumer}s to compare against before pilfering
|
||||||
|
* pointers. Note that this is squared because it expects to be compared against
|
||||||
|
* {@link com.android.launcher3.Utilities#squaredHypot} (to avoid square root on each event).
|
||||||
|
*/
|
||||||
|
public float getSquaredTouchSlop() {
|
||||||
|
float slopMultiplier = isFullyGesturalNavMode()
|
||||||
|
? QUICKSTEP_TOUCH_SLOP_RATIO_GESTURAL
|
||||||
|
: QUICKSTEP_TOUCH_SLOP_RATIO_TWO_BUTTON;
|
||||||
|
float touchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop();
|
||||||
|
return slopMultiplier * touchSlop * touchSlop;
|
||||||
|
}
|
||||||
|
|
||||||
public String getSystemUiStateString() {
|
public String getSystemUiStateString() {
|
||||||
return QuickStepContract.getSystemUiStateString(mSystemUiStateFlags);
|
return QuickStepContract.getSystemUiStateString(mSystemUiStateFlags);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import static android.view.MotionEvent.ACTION_POINTER_DOWN;
|
|||||||
import static android.view.MotionEvent.ACTION_UP;
|
import static android.view.MotionEvent.ACTION_UP;
|
||||||
|
|
||||||
import static com.android.launcher3.Utilities.squaredHypot;
|
import static com.android.launcher3.Utilities.squaredHypot;
|
||||||
import static com.android.launcher3.Utilities.squaredTouchSlop;
|
|
||||||
import static com.android.launcher3.util.VelocityUtils.PX_PER_MS;
|
import static com.android.launcher3.util.VelocityUtils.PX_PER_MS;
|
||||||
import static com.android.quickstep.AbsSwipeUpHandler.MIN_PROGRESS_FOR_OVERVIEW;
|
import static com.android.quickstep.AbsSwipeUpHandler.MIN_PROGRESS_FOR_OVERVIEW;
|
||||||
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
|
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
|
||||||
@@ -115,7 +114,7 @@ public class DeviceLockedInputConsumer implements InputConsumer,
|
|||||||
mDeviceState = deviceState;
|
mDeviceState = deviceState;
|
||||||
mTaskAnimationManager = taskAnimationManager;
|
mTaskAnimationManager = taskAnimationManager;
|
||||||
mGestureState = gestureState;
|
mGestureState = gestureState;
|
||||||
mTouchSlopSquared = squaredTouchSlop(context);
|
mTouchSlopSquared = mDeviceState.getSquaredTouchSlop();
|
||||||
mTransformParams = new TransformParams();
|
mTransformParams = new TransformParams();
|
||||||
mInputMonitorCompat = inputMonitorCompat;
|
mInputMonitorCompat = inputMonitorCompat;
|
||||||
mMaxTranslationY = context.getResources().getDimensionPixelSize(
|
mMaxTranslationY = context.getResources().getDimensionPixelSize(
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ import static android.view.MotionEvent.ACTION_DOWN;
|
|||||||
import static android.view.MotionEvent.ACTION_MOVE;
|
import static android.view.MotionEvent.ACTION_MOVE;
|
||||||
import static android.view.MotionEvent.ACTION_UP;
|
import static android.view.MotionEvent.ACTION_UP;
|
||||||
|
|
||||||
import static com.android.launcher3.testing.shared.ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE;
|
|
||||||
import static com.android.launcher3.Utilities.squaredHypot;
|
import static com.android.launcher3.Utilities.squaredHypot;
|
||||||
|
import static com.android.launcher3.testing.shared.ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
||||||
@@ -31,7 +31,6 @@ import android.view.MotionEvent;
|
|||||||
|
|
||||||
import com.android.launcher3.R;
|
import com.android.launcher3.R;
|
||||||
import com.android.launcher3.testing.shared.ResourceUtils;
|
import com.android.launcher3.testing.shared.ResourceUtils;
|
||||||
import com.android.launcher3.Utilities;
|
|
||||||
import com.android.launcher3.util.DisplayController;
|
import com.android.launcher3.util.DisplayController;
|
||||||
import com.android.quickstep.InputConsumer;
|
import com.android.quickstep.InputConsumer;
|
||||||
import com.android.quickstep.RecentsAnimationDeviceState;
|
import com.android.quickstep.RecentsAnimationDeviceState;
|
||||||
@@ -69,7 +68,7 @@ public class OneHandedModeInputConsumer extends DelegateInputConsumer {
|
|||||||
mDeviceState = deviceState;
|
mDeviceState = deviceState;
|
||||||
mDragDistThreshold = context.getResources().getDimensionPixelSize(
|
mDragDistThreshold = context.getResources().getDimensionPixelSize(
|
||||||
R.dimen.gestures_onehanded_drag_threshold);
|
R.dimen.gestures_onehanded_drag_threshold);
|
||||||
mSquaredSlop = Utilities.squaredTouchSlop(context);
|
mSquaredSlop = mDeviceState.getSquaredTouchSlop();
|
||||||
mDisplaySize = DisplayController.INSTANCE.get(mContext).getInfo().currentSize;
|
mDisplaySize = DisplayController.INSTANCE.get(mContext).getInfo().currentSize;
|
||||||
mNavBarSize = ResourceUtils.getNavbarSize(NAVBAR_BOTTOM_GESTURE_SIZE,
|
mNavBarSize = ResourceUtils.getNavbarSize(NAVBAR_BOTTOM_GESTURE_SIZE,
|
||||||
mContext.getResources());
|
mContext.getResources());
|
||||||
|
|||||||
@@ -80,10 +80,6 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
|
|||||||
public static final String DOWN_EVT = "OtherActivityInputConsumer.DOWN";
|
public static final String DOWN_EVT = "OtherActivityInputConsumer.DOWN";
|
||||||
private static final String UP_EVT = "OtherActivityInputConsumer.UP";
|
private static final String UP_EVT = "OtherActivityInputConsumer.UP";
|
||||||
|
|
||||||
// TODO: Move to quickstep contract
|
|
||||||
public static final float QUICKSTEP_TOUCH_SLOP_RATIO_TWO_BUTTON = 9;
|
|
||||||
public static final float QUICKSTEP_TOUCH_SLOP_RATIO_GESTURAL = 2;
|
|
||||||
|
|
||||||
// Minimum angle of a gesture's coordinate where a release goes to overview.
|
// Minimum angle of a gesture's coordinate where a release goes to overview.
|
||||||
public static final int OVERVIEW_MIN_DEGREES = 15;
|
public static final int OVERVIEW_MIN_DEGREES = 15;
|
||||||
|
|
||||||
@@ -157,11 +153,8 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
|
|||||||
boolean continuingPreviousGesture = mTaskAnimationManager.isRecentsAnimationRunning();
|
boolean continuingPreviousGesture = mTaskAnimationManager.isRecentsAnimationRunning();
|
||||||
mIsDeferredDownTarget = !continuingPreviousGesture && isDeferredDownTarget;
|
mIsDeferredDownTarget = !continuingPreviousGesture && isDeferredDownTarget;
|
||||||
|
|
||||||
float slopMultiplier = mDeviceState.isFullyGesturalNavMode()
|
|
||||||
? QUICKSTEP_TOUCH_SLOP_RATIO_GESTURAL
|
|
||||||
: QUICKSTEP_TOUCH_SLOP_RATIO_TWO_BUTTON;
|
|
||||||
mTouchSlop = ViewConfiguration.get(this).getScaledTouchSlop();
|
mTouchSlop = ViewConfiguration.get(this).getScaledTouchSlop();
|
||||||
mSquaredTouchSlop = slopMultiplier * mTouchSlop * mTouchSlop;
|
mSquaredTouchSlop = mDeviceState.getSquaredTouchSlop();
|
||||||
|
|
||||||
mPassedPilferInputSlop = mPassedWindowMoveSlop = continuingPreviousGesture;
|
mPassedPilferInputSlop = mPassedWindowMoveSlop = continuingPreviousGesture;
|
||||||
mDisableHorizontalSwipe = !mPassedPilferInputSlop && disableHorizontalSwipe;
|
mDisableHorizontalSwipe = !mPassedPilferInputSlop && disableHorizontalSwipe;
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ public class TaskbarUnstashInputConsumer extends DelegateInputConsumer {
|
|||||||
InputMonitorCompat inputMonitor, TaskbarActivityContext taskbarActivityContext) {
|
InputMonitorCompat inputMonitor, TaskbarActivityContext taskbarActivityContext) {
|
||||||
super(delegate, inputMonitor);
|
super(delegate, inputMonitor);
|
||||||
mTaskbarActivityContext = taskbarActivityContext;
|
mTaskbarActivityContext = taskbarActivityContext;
|
||||||
|
// TODO(b/270395798): remove this when cleaning up old Persistent Taskbar code.
|
||||||
mSquaredTouchSlop = Utilities.squaredTouchSlop(context);
|
mSquaredTouchSlop = Utilities.squaredTouchSlop(context);
|
||||||
mScreenWidth = taskbarActivityContext.getDeviceProfile().widthPx;
|
mScreenWidth = taskbarActivityContext.getDeviceProfile().widthPx;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user