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 296449 d56873313019cffc7b6dec452b779f4e5cda55f9
parent 296448 bcb91e1b40975ef1243dd75ae1af8a62b38eb8b2
child 296450 d66734390235d9662a69546723822c2a1e438e88
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen, sylvestre
bugs1211848
milestone43.0a2
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();