Merge "PIP: Ensure we move some slop before pilfering for touches for resize." into rvc-dev

This commit is contained in:
Ben Lin
2020-05-26 22:18:35 +00:00
committed by Android (Google) Code Review

View File

@@ -37,6 +37,7 @@ import android.view.InputEvent;
import android.view.InputEventReceiver;
import android.view.InputMonitor;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
import com.android.internal.policy.TaskResizingAlgorithm;
import com.android.systemui.R;
@@ -77,10 +78,12 @@ public class PipResizeGestureHandler {
private final Runnable mUpdateMovementBoundsRunnable;
private int mDelta;
private float mTouchSlop;
private boolean mAllowGesture;
private boolean mIsAttached;
private boolean mIsEnabled;
private boolean mEnableUserResize;
private boolean mThresholdCrossed;
private InputMonitor mInputMonitor;
private InputEventReceiver mInputEventReceiver;
@@ -100,6 +103,7 @@ public class PipResizeGestureHandler {
mPipTaskOrganizer = pipTaskOrganizer;
mMovementBoundsSupplier = movementBoundsSupplier;
mUpdateMovementBoundsRunnable = updateMovementBoundsRunnable;
context.getDisplay().getRealSize(mMaxSize);
reloadResources();
@@ -126,6 +130,7 @@ public class PipResizeGestureHandler {
private void reloadResources() {
final Resources res = mContext.getResources();
mDelta = res.getDimensionPixelSize(R.dimen.pip_resize_edge_size);
mTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop();
}
private void resetDragCorners() {
@@ -270,7 +275,12 @@ public class PipResizeGestureHandler {
break;
case MotionEvent.ACTION_MOVE:
// Capture inputs
mInputMonitor.pilferPointers();
float dx = Math.abs(ev.getX() - mDownPoint.x);
float dy = Math.abs(ev.getY() - mDownPoint.y);
if (!mThresholdCrossed && dx > mTouchSlop && dy > mTouchSlop) {
mThresholdCrossed = true;
mInputMonitor.pilferPointers();
}
final Rect currentPipBounds = mMotionHelper.getBounds();
mLastResizeBounds.set(TaskResizingAlgorithm.resizeDrag(ev.getX(), ev.getY(),
mDownPoint.x, mDownPoint.y, currentPipBounds, mCtrlType, mMinSize.x,
@@ -288,6 +298,7 @@ public class PipResizeGestureHandler {
mUpdateMovementBoundsRunnable.run();
mCtrlType = CTRL_NONE;
mAllowGesture = false;
mThresholdCrossed = false;
});
});
break;