Bug 1211848 - GeckoInputConnection: Re-request focus if GeckoView is not active view for the input method. r=jchen
authorSebastian Kaspari <s.kaspari@gmail.com>
Tue, 13 Oct 2015 13:57:43 +0200
changeset 267651 020fbe79449928ed6bf58718400d162af22b6cf0
parent 267650 5b1df16175512d9cf71b4c30e30454946a3e8477
child 267652 738e0c64591824dc87e8cc670a43f34b282f9423
push id66539
push usercbook@mozilla.com
push dateWed, 14 Oct 2015 14:21:32 +0000
treeherdermozilla-inbound@80a002a6244a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen
bugs1211848
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1211848 - GeckoInputConnection: Re-request focus if GeckoView is not active view for the input method. r=jchen 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
@@ -363,16 +363,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();