From a87560303263c70ae7d4283c7d08733e1d82eb57 Mon Sep 17 00:00:00 2001 From: Taran Singh Date: Tue, 23 May 2023 06:40:35 +0000 Subject: [PATCH] Report toolType on handwriting start We update last click toolType onStartInput. However, when stylus is used to start handwriting, it is a click euqivalent operation for which ViewRootImpl never receives ACTION_UP event. For a successful intiation, we should update toolType so that next startInput has that available in EditorInfo. Bug: 283701472 Test: atest StylusHandwritingTest Change-Id: Id5f08e43c24cd42b416456a6c14fed0c130554c9 --- core/java/android/view/ViewRootImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 4cbb0409dafcf..4eb436e784ed1 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -7017,6 +7017,10 @@ public final class ViewRootImpl implements ViewParent, private int processPointerEvent(QueuedInputEvent q) { final MotionEvent event = (MotionEvent)q.mEvent; boolean handled = mHandwritingInitiator.onTouchEvent(event); + if (handled) { + // If handwriting is started, toolkit doesn't receive ACTION_UP. + mLastClickToolType = event.getToolType(event.getActionIndex()); + } mAttachInfo.mUnbufferedDispatchRequested = false; mAttachInfo.mHandlingPointerEvent = true;