diff options
| author | Yohei Yukawa <yukawa@google.com> | 2016-04-03 22:50:18 -0700 |
|---|---|---|
| committer | Yohei Yukawa <yukawa@google.com> | 2016-04-06 05:47:14 +0000 |
| commit | 2dbc53242927a796117a0b70d856021c0d4918a5 (patch) | |
| tree | 0f4db4698e3c5ec444072ee473fea9c62bafc98f /core/java/android/inputmethodservice/InputMethodService.java | |
| parent | ef5b4657a8b03b33d6c4087e0ced33606fcf05f3 (diff) | |
Fix a regression in SHOW_IME_WITH_HARD_KEYBOARD handling.
This is a follow up CL to my previous CL [1], which caused a regression
that LatinIME does not correctly initialize its UI when:
1. Make sure SHOW_IME_WITH_HARD_KEYBOARD is off.
2. Pair a hardware keyboard.
3. Reboot.
4. Make sure the hardware keyboard is paird.
5. Focus in a text box.
6. Make sure that LatinIME does not show software keyboard.
7. Tap the IME switcher and turn of "Show Input Method" toggle.
Previously IMS had called many methods from
IMS#onConfigurationChanged(), which was just replaced with
IMS#restartInput() by my CL [1] then broke some assumptions in LatinIME.
This could also break other IMEs' assumptions as well.
To avoid unexpected regressions between M and N like this, this CL
ensures that those methods are called as we have done until [1].
[1]: Id4d332e3909590c68345e10e1f2e18650efb2eb7
7b739a802cb7d97460a0bf8a1e9774efe96fa552
Bug: 26985193
Change-Id: Iebd98f26d388b64cb318ac202b3bcdd956bd3a27
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
| -rw-r--r-- | core/java/android/inputmethodservice/InputMethodService.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index 9d53a0001a84..cc201bc78bb5 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -717,7 +717,11 @@ public class InputMethodService extends AbstractInputMethodService { mShowImeWithHardKeyboard = Settings.Secure.getInt(mService.getContentResolver(), Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD, 0) != 0 ? ShowImeWithHardKeyboardType.TRUE : ShowImeWithHardKeyboardType.FALSE; - mService.updateInputViewShown(); + // In Android M and prior, state change of + // Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD has triggered + // #onConfigurationChanged(). For compatibility reasons, we reset the internal + // state as if configuration was changed. + mService.resetStateForNewConfiguration(); } } @@ -884,7 +888,10 @@ public class InputMethodService extends AbstractInputMethodService { */ @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); + resetStateForNewConfiguration(); + } + private void resetStateForNewConfiguration() { boolean visible = mWindowVisible; int showFlags = mShowInputFlags; boolean showingInput = mShowInputRequested; |
