Use long click timeout for handwriting
We've received several feedbacks that the current tapTimeout is too short, making it very hard to initiate handwriting. To unblock us from bug bash, this CL temporarily use long lick timeout for handwriting timeout. Once UX decided the final value for handwriting timeout, we will create another CL. Bug: 217603538 Test: atest FrameworksCoreTests:android.view.stylus.HandwritingInitiatorTest Change-Id: Icb9f49b8b2a49c6c2a13fa377c20a3d1b3bd782c
This commit is contained in:
@@ -55,10 +55,10 @@ public class HandwritingInitiator {
|
||||
*/
|
||||
private final int mTouchSlop;
|
||||
/**
|
||||
* The timeout used to distinguish tap from handwriting. If the stylus doesn't move before this
|
||||
* timeout, it's not considered as handwriting.
|
||||
* The timeout used to distinguish tap or long click from handwriting. If the stylus doesn't
|
||||
* move before this timeout, it's not considered as handwriting.
|
||||
*/
|
||||
private final long mTapTimeoutInMillis;
|
||||
private final long mHandwritingTimeoutInMillis;
|
||||
|
||||
private State mState = new State();
|
||||
private final HandwritingAreaTracker mHandwritingAreasTracker = new HandwritingAreaTracker();
|
||||
@@ -90,7 +90,7 @@ public class HandwritingInitiator {
|
||||
public HandwritingInitiator(@NonNull ViewConfiguration viewConfiguration,
|
||||
@NonNull InputMethodManager inputMethodManager) {
|
||||
mTouchSlop = viewConfiguration.getScaledTouchSlop();
|
||||
mTapTimeoutInMillis = ViewConfiguration.getTapTimeout();
|
||||
mHandwritingTimeoutInMillis = ViewConfiguration.getLongPressTimeout();
|
||||
mImm = inputMethodManager;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public class HandwritingInitiator {
|
||||
|
||||
final long timeElapsed =
|
||||
motionEvent.getEventTime() - mState.mStylusDownTimeInMillis;
|
||||
if (timeElapsed > mTapTimeoutInMillis) {
|
||||
if (timeElapsed > mHandwritingTimeoutInMillis) {
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ import org.junit.runner.RunWith;
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class HandwritingInitiatorTest {
|
||||
private static final int TOUCH_SLOP = 8;
|
||||
private static final long TAP_TIMEOUT = ViewConfiguration.getTapTimeout();
|
||||
private static final long TIMEOUT = ViewConfiguration.getLongPressTimeout();
|
||||
private static final Rect sHwArea = new Rect(100, 200, 500, 500);
|
||||
|
||||
private HandwritingInitiator mHandwritingInitiator;
|
||||
@@ -177,7 +177,7 @@ public class HandwritingInitiatorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onTouchEvent_notStartHandwriting_when_stylusMove_afterTapTimeOut() {
|
||||
public void onTouchEvent_notStartHandwriting_when_stylusMove_afterTimeOut() {
|
||||
mHandwritingInitiator.onInputConnectionCreated(mTestView);
|
||||
final int x1 = 10;
|
||||
final int y1 = 10;
|
||||
@@ -187,7 +187,7 @@ public class HandwritingInitiatorTest {
|
||||
|
||||
final int x2 = x1 + TOUCH_SLOP * 2;
|
||||
final int y2 = y1;
|
||||
final long time2 = time1 + TAP_TIMEOUT + 10L;
|
||||
final long time2 = time1 + TIMEOUT + 10L;
|
||||
MotionEvent stylusEvent2 = createStylusEvent(ACTION_MOVE, x2, y2, time2);
|
||||
mHandwritingInitiator.onTouchEvent(stylusEvent2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user