diff options
| author | 2024-02-22 10:59:50 +0000 | |
|---|---|---|
| committer | 2024-02-22 10:59:50 +0000 | |
| commit | 922b058042c037057f681234b6b20aaaab05d91c (patch) | |
| tree | 01f0c9e3d7cd112e95cdf7de8cbc916075204fcb | |
| parent | 9fb2aa659ff0a759e73dd5e60c39bea4585354e1 (diff) | |
| parent | c49e68994b84775d3985b3a3fb243293c513878b (diff) | |
Merge "Always look for display-specific IME." into main
| -rw-r--r-- | services/core/java/com/android/server/inputmethod/InputMethodManagerService.java | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 624d760b1a40..76956c88695d 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -2436,20 +2436,17 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub return InputBindResult.NOT_IME_TARGET_WINDOW; } final int csDisplayId = cs.mSelfReportedDisplayId; - final int oldDisplayIdToShowIme = mDisplayIdToShowIme; mDisplayIdToShowIme = mVisibilityStateComputer.computeImeDisplayId(winState, csDisplayId); // Potentially override the selected input method if the new display belongs to a virtual // device with a custom IME. String selectedMethodId = getSelectedMethodIdLocked(); - if (oldDisplayIdToShowIme != mDisplayIdToShowIme) { - final String deviceMethodId = computeCurrentDeviceMethodIdLocked(selectedMethodId); - if (deviceMethodId == null) { - mVisibilityStateComputer.getImePolicy().setImeHiddenByDisplayPolicy(true); - } else if (!Objects.equals(deviceMethodId, selectedMethodId)) { - setInputMethodLocked(deviceMethodId, NOT_A_SUBTYPE_ID, mDeviceIdToShowIme); - selectedMethodId = deviceMethodId; - } + final String deviceMethodId = computeCurrentDeviceMethodIdLocked(selectedMethodId); + if (deviceMethodId == null) { + mVisibilityStateComputer.getImePolicy().setImeHiddenByDisplayPolicy(true); + } else if (!Objects.equals(deviceMethodId, selectedMethodId)) { + setInputMethodLocked(deviceMethodId, NOT_A_SUBTYPE_ID, mDeviceIdToShowIme); + selectedMethodId = deviceMethodId; } if (mVisibilityStateComputer.getImePolicy().isImeHiddenByDisplayPolicy()) { @@ -2549,10 +2546,10 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub final int oldDeviceId = mDeviceIdToShowIme; mDeviceIdToShowIme = mVdmInternal.getDeviceIdForDisplayId(mDisplayIdToShowIme); - if (mDeviceIdToShowIme == oldDeviceId) { - return currentMethodId; - } if (mDeviceIdToShowIme == DEVICE_ID_DEFAULT) { + if (oldDeviceId == DEVICE_ID_DEFAULT) { + return currentMethodId; + } final String defaultDeviceMethodId = mSettings.getSelectedDefaultDeviceInputMethod(); if (DEBUG) { Slog.v(TAG, "Restoring default device input method: " + defaultDeviceMethodId); |