Scribe in View: disable cursor drag when handwriting is enabled
Bug: 224587325
Test: manually tested
Change-Id: I607c0d9b71cb6cfd69704d850a2d3e00745c3fb4
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index 7f8a68d..67f284b 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -6309,7 +6309,8 @@
}
switch (event.getActionMasked()) {
case MotionEvent.ACTION_MOVE:
- if (event.isFromSource(InputDevice.SOURCE_MOUSE)) {
+ if (event.isFromSource(InputDevice.SOURCE_MOUSE)
+ || (mTextView.isAutoHandwritingEnabled() && isFromStylus(event))) {
break;
}
if (mIsDraggingCursor) {
@@ -6332,6 +6333,11 @@
}
}
+ private boolean isFromStylus(MotionEvent motionEvent) {
+ final int pointerIndex = motionEvent.getActionIndex();
+ return motionEvent.getToolType(pointerIndex) == MotionEvent.TOOL_TYPE_STYLUS;
+ }
+
private void positionCursorDuringDrag(MotionEvent event) {
mPrevLineDuringDrag = getLineDuringDrag(event);
int offset = mTextView.getOffsetAtCoordinate(mPrevLineDuringDrag, event.getX());