Index: content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java b/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java |
index 56255655afa3fc708003461e24b7fc24b03284a5..fed38198817387d79e2910c421f39da90cb2536d 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java |
@@ -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() { |