Bug 1211848 - GeckoInputConnection: Re-request focus if GeckoView is not active view for the input method. r=jchen, a=sylvestre
authorSebastian Kaspari <s.kaspari@gmail.com>
Tue, 13 Oct 2015 13:57:43 +0200
changeset 289555 66c365b5fff5
parent 289554 331b9e49f805
child 289556 d162e49132eb
push id5185
push usercbook@mozilla.com
push date2015-10-15 14:12 +0000
treeherdermozilla-beta@d162e49132eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen, sylvestre
bugs1211848
milestone42.0
Bug 1211848 - GeckoInputConnection: Re-request focus if GeckoView is not active view for the input method. r=jchen, a=sylvestre On (at least) Android 6.0 it can happen that GeckoView has focus but is not the active view for the input method. As a consequence InputMethodManager will ignore the call to showSoftInput().
mobile/android/base/GeckoInputConnection.java
--- a/mobile/android/base/GeckoInputConnection.java
+++ b/mobile/android/base/GeckoInputConnection.java
@@ -364,16 +364,23 @@ class GeckoInputConnection
         Context context = view.getContext();
         return InputMethods.getInputMethodManager(context);
     }
 
     private static void showSoftInput() {
         final InputMethodManager imm = getInputMethodManager();
         if (imm != null) {
             final View v = getView();
+
+            if (v.hasFocus() && !imm.isActive(v)) {
+                // Workaround: The view has focus but it is not the active view for the input method. (Bug 1211848)
+                v.clearFocus();
+                v.requestFocus();
+            }
+
             imm.showSoftInput(v, 0);
         }
     }
 
     private static void hideSoftInput() {
         final InputMethodManager imm = getInputMethodManager();
         if (imm != null) {
             final View v = getView();