From 4e28668a152fb5fc1b28e0e953db27febaab485b Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Thu, 16 Feb 2017 17:19:00 -0800 Subject: [PATCH] Fix duplicate calls of IMS#doStartInput() This is another follow up CL to my previous CL [1], which had a bug that InputMethodService#doStartInput() is now always called back twice. There was a careless mistake when rebasing the CL [1] onto the previous CL [2], which ended up with dispatching startInput() twice in IInputMethodWrapper. In short, InputMethod#dispatchStartInputWithToken() is the new way to dispatch startInput()/restartInput(). We do not need to call both of them. [1]: I9921b381e02106dbffff5e0b3d13f0a1245ce807 6db3bfe33d92127d203ec872a0b353585a99f256 [2]: I476d0cf8cbb0a0134941854f9337d9ad15e66a71 f7526b58960608887b064670bb42f41aa28b8f41 Test: Set true to InputMethodService#DEBUG and make sure startInput() and restartInput() are called in the following scenario. 1. Complete the setup wizard. 2. adb shell am start -a android.app.action.SET_NEW_PASSWORD 3. Proceed to "Choose your password" page 4. Make sure startInput() gets called only once. 5. Type "aaaa" then hit "CONTINUE" button. 6. Make sure restartInput() gets called only once. Bug: 35079353 Fixes: 35442939 Change-Id: Ifde16c3fad5b787d4c9a11bd886943dfe96f9eb9 --- .../android/inputmethodservice/IInputMethodWrapper.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/core/java/android/inputmethodservice/IInputMethodWrapper.java b/core/java/android/inputmethodservice/IInputMethodWrapper.java index 562f40bc7513a..765aff96c704b 100644 --- a/core/java/android/inputmethodservice/IInputMethodWrapper.java +++ b/core/java/android/inputmethodservice/IInputMethodWrapper.java @@ -172,12 +172,7 @@ class IInputMethodWrapper extends IInputMethod.Stub final InputConnection ic = inputContext != null ? new InputConnectionWrapper(mTarget, inputContext, missingMethods) : null; info.makeCompatible(mTargetSdkVersion); - if (restarting) { - inputMethod.restartInput(ic, info); - } else { - inputMethod.startInput(ic, info); - } - inputMethod.dispatchStartInputWithToken(ic, info, true /* initial */, + inputMethod.dispatchStartInputWithToken(ic, info, restarting /* restarting */, startInputToken); args.recycle(); return;