From e4244a4f215151b9a406be03dd38efb66900c36b Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Tue, 21 Feb 2023 14:22:35 +0800 Subject: [PATCH] Uses equals to compare the old/new subtypes. In case of additional subtypes, which are provided by IME app at runtime, the subtype instances may be re-created but remains the identical hash codes. So when an IME provided subtypes {A,B} with current subtype A and then provides {A,B,C} later, the IME don't expect to be notified by InputMethodService#onCurrentInputMethodSubtypeChanged. Bug: 269546663 Test: locally verify the bug. Change-Id: Ib23e5883af4b99845e80b370c245999fa10d7f57 --- .../android/server/inputmethod/InputMethodManagerService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index c7e4cd22fc08a..e446c42995a3a 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -3235,7 +3235,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub notifyInputMethodSubtypeChangedLocked(userId, info, null); return; } - if (newSubtype != oldSubtype) { + if (!newSubtype.equals(oldSubtype)) { setSelectedInputMethodAndSubtypeLocked(info, subtypeId, true); IInputMethodInvoker curMethod = getCurMethodLocked(); if (curMethod != null) {