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

Commit 26f96a62 authored by Justin Ghan's avatar Justin Ghan
Browse files

Check getShowSoftInputOnFocus() for stylus input

When there is stylus input on a text editor which doesn't support
handwriting, a toast error message is displayed and the soft keyboard is
shown. However, if the text editor has setShowSoftInputOnFocus(false),
then this should be respected by not showing the soft keyboard.

Bug: 363180475
Test: atest StylusHandwritingTest
Flag: com.android.text.flags.handwriting_unsupported_show_soft_input_fix
Change-Id: I906fe51586d173dee37395b63c33632e94af6af4
parent 5db396ab
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -178,3 +178,13 @@ flag {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "handwriting_unsupported_show_soft_input_fix"
  namespace: "text"
  description: "Don't show soft keyboard on stylus input if text field doesn't support handwriting and getShowSoftInputOnFocus() returns false."
  bug: "363180475"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}
+6 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.view;
import static com.android.text.flags.Flags.handwritingCursorPosition;
import static com.android.text.flags.Flags.handwritingTrackDisabled;
import static com.android.text.flags.Flags.handwritingUnsupportedMessage;
import static com.android.text.flags.Flags.handwritingUnsupportedShowSoftInputFix;

import android.annotation.FlaggedApi;
import android.annotation.NonNull;
@@ -241,7 +242,11 @@ public class HandwritingInitiator {
                            if (!candidateView.hasFocus()) {
                                requestFocusWithoutReveal(candidateView);
                            }
                            if (!handwritingUnsupportedShowSoftInputFix()
                                    || (candidateView instanceof TextView tv
                                            && tv.getShowSoftInputOnFocus())) {
                                mImm.showSoftInput(candidateView, 0);
                            }
                            mState.mHandled = true;
                            mState.mShouldInitHandwriting = false;
                            motionEvent.setAction((motionEvent.getAction()