Commit e8e5d60b authored by bcwhite's avatar bcwhite Committed by Commit bot

Remember previous keyboard type and use that when switching to "none" type.

BUG=484139

Review URL: https://codereview.chromium.org/1138103003

Cr-Commit-Position: refs/heads/master@{#330551}
parent e152cdb1
......@@ -100,6 +100,7 @@ public class ImeAdapter {
static char[] sSingleCharArray = new char[1];
static KeyCharacterMap sKeyCharacterMap;
private static EditorInfo sPreviousOutAttrs;
private long mNativeImeAdapterAndroid;
private InputMethodManagerWrapper mInputMethodManagerWrapper;
......@@ -133,7 +134,20 @@ public class ImeAdapter {
public static class AdapterInputConnectionFactory {
public AdapterInputConnection get(View view, ImeAdapter imeAdapter,
Editable editable, EditorInfo outAttrs) {
return new AdapterInputConnection(view, imeAdapter, editable, outAttrs);
AdapterInputConnection conn = new AdapterInputConnection(
view, imeAdapter, editable, outAttrs);
// When switching between fields, the keyboard first reverts to a "none" type
// before changing to the type of the new field. This can cause the keyboard
// layout to flicker back to the default layout on older Android versions (<5.0).
// To avoid this, we remember the previous settings and return those instead.
// http://crbug.com/484139
if (imeAdapter.getTextInputType() == TextInputType.NONE && sPreviousOutAttrs != null) {
outAttrs.inputType = sPreviousOutAttrs.inputType;
outAttrs.imeOptions = sPreviousOutAttrs.imeOptions;
} else {
sPreviousOutAttrs = outAttrs;
}
return conn;
}
}
......@@ -287,6 +301,7 @@ public class ImeAdapter {
unzoomIfNeeded ? mViewEmbedder.getNewShowKeyboardReceiver() : null);
}
mViewEmbedder.onDismissInput();
sPreviousOutAttrs = null;
}
private boolean hasInputType() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment