Loading core/java/android/text/flags/flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -82,3 +82,10 @@ flag { description: "A feature flag that implement inter character justification." bug: "283193133" } flag { name: "escape_clears_focus" namespace: "text" description: "Feature flag for clearing focus when the escape key is pressed." bug: "312921137" } core/java/android/widget/TextView.java +17 −0 Original line number Diff line number Diff line Loading @@ -9589,6 +9589,23 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } break; case KeyEvent.KEYCODE_ESCAPE: if (com.android.text.flags.Flags.escapeClearsFocus() && event.hasNoModifiers()) { if (mEditor != null && mEditor.getTextActionMode() != null) { stopTextActionMode(); return KEY_EVENT_HANDLED; } if (hasFocus()) { clearFocus(); InputMethodManager imm = getInputMethodManager(); if (imm != null) { imm.hideSoftInputFromView(this, 0); } return KEY_EVENT_HANDLED; } } break; case KeyEvent.KEYCODE_CUT: if (event.hasNoModifiers() && canCut()) { if (onTextContextMenuItem(ID_CUT)) { Loading Loading
core/java/android/text/flags/flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -82,3 +82,10 @@ flag { description: "A feature flag that implement inter character justification." bug: "283193133" } flag { name: "escape_clears_focus" namespace: "text" description: "Feature flag for clearing focus when the escape key is pressed." bug: "312921137" }
core/java/android/widget/TextView.java +17 −0 Original line number Diff line number Diff line Loading @@ -9589,6 +9589,23 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } break; case KeyEvent.KEYCODE_ESCAPE: if (com.android.text.flags.Flags.escapeClearsFocus() && event.hasNoModifiers()) { if (mEditor != null && mEditor.getTextActionMode() != null) { stopTextActionMode(); return KEY_EVENT_HANDLED; } if (hasFocus()) { clearFocus(); InputMethodManager imm = getInputMethodManager(); if (imm != null) { imm.hideSoftInputFromView(this, 0); } return KEY_EVENT_HANDLED; } } break; case KeyEvent.KEYCODE_CUT: if (event.hasNoModifiers() && canCut()) { if (onTextContextMenuItem(ID_CUT)) { Loading