| Index: content/public/android/java/src/org/chromium/content/browser/input/InputMethodManagerWrapper.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/input/InputMethodManagerWrapper.java b/content/public/android/java/src/org/chromium/content/browser/input/InputMethodManagerWrapper.java
|
| index 6a26dbc9c6c65082496000c280bbe6bbbf5e5713..673a3740925a1196b1510e37e49277531ec95aec 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/input/InputMethodManagerWrapper.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/input/InputMethodManagerWrapper.java
|
| @@ -15,6 +15,9 @@ import android.view.inputmethod.InputMethodManager;
|
|
|
| import org.chromium.base.Log;
|
|
|
| +import java.lang.reflect.InvocationTargetException;
|
| +import java.lang.reflect.Method;
|
| +
|
| /**
|
| * Wrapper around Android's InputMethodManager
|
| */
|
| @@ -88,4 +91,23 @@ public class InputMethodManagerWrapper {
|
| getInputMethodManager().updateCursorAnchorInfo(view, cursorAnchorInfo);
|
| }
|
| }
|
| +
|
| + /**
|
| + * Notify that a user took some action with the current input method. Without this call
|
| + * an input method app may wait longer when the user switches methods within the app.
|
| + */
|
| + public void notifyUserAction() {
|
| + // On N and above, this is not needed.
|
| + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) return;
|
| + Log.d(TAG, "notifyUserAction");
|
| + InputMethodManager manager = getInputMethodManager();
|
| + try {
|
| + Method method = InputMethodManager.class.getMethod("notifyUserAction");
|
| + method.invoke(manager);
|
| + } catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException
|
| + | InvocationTargetException e) {
|
| + Log.d(TAG, "notifyUserAction failed");
|
| + return;
|
| + }
|
| + }
|
| }
|
|
|