Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8413ac0d authored by Justin Ghan's avatar Justin Ghan
Browse files

Don't initiate handwriting for IME views

IME views cannot create an InputConnection, so the framework cannot
initiate a handwriting session for them. The handwriting initiator
should be disabled so that it doesn't consume motion events and prevent
the IME from handling them.

Bug: 343304685
Test: atest StylusHandwritingTest
Flag: com.android.text.flags.disable_handwriting_initiator_for_ime
Change-Id: I05aa93ba5735cccfc1bf8b3a8d539613f553a18a
parent 3f11f937
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -191,3 +191,13 @@ flag {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "disable_handwriting_initiator_for_ime"
  namespace: "text"
  description: "Don't initiate handwriting for IME views."
  bug: "343304685"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}
+9 −2
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ import static com.android.window.flags.Flags.activityWindowInfoFlag;
import static com.android.window.flags.Flags.enableBufferTransformHintFromDisplay;
import static com.android.window.flags.Flags.setScPropertiesInClient;
import static com.android.window.flags.Flags.windowSessionRelayoutInfo;
import static com.android.text.flags.Flags.disableHandwritingInitiatorForIme;
import android.Manifest;
import android.accessibilityservice.AccessibilityService;
@@ -7821,7 +7822,11 @@ public final class ViewRootImpl implements ViewParent,
        private int processPointerEvent(QueuedInputEvent q) {
            final MotionEvent event = (MotionEvent)q.mEvent;
            final int action = event.getAction();
            boolean handled = mHandwritingInitiator.onTouchEvent(event);
            boolean handled = false;
            if (!disableHandwritingInitiatorForIme()
                    || mWindowAttributes.type != TYPE_INPUT_METHOD) {
                handled = mHandwritingInitiator.onTouchEvent(event);
            }
            if (handled) {
                // If handwriting is started, toolkit doesn't receive ACTION_UP.
                mLastClickToolType = event.getToolType(event.getActionIndex());
@@ -7973,7 +7978,9 @@ public final class ViewRootImpl implements ViewParent,
        }
        PointerIcon pointerIcon = null;
        if (event.isStylusPointer() && mIsStylusPointerIconEnabled) {
        if (event.isStylusPointer() && mIsStylusPointerIconEnabled
                && (!disableHandwritingInitiatorForIme()
                        || mWindowAttributes.type != TYPE_INPUT_METHOD)) {
            pointerIcon = mHandwritingInitiator.onResolvePointerIcon(mContext, event);
        }
        if (pointerIcon == null) {