Loading services/core/java/com/android/server/inputmethod/AutofillSuggestionsController.java +2 −2 Original line number Diff line number Diff line Loading @@ -103,8 +103,8 @@ final class AutofillSuggestionsController { // Note that current user ID is guaranteed to be userId. final var imeId = mBindingController.getSelectedMethodId(); final InputMethodInfo imi = InputMethodSettingsRepository.get(mBindingController.mUserId) .getMethodMap().get(imeId); final InputMethodInfo imi = InputMethodSettingsRepository.get( mBindingController.getUserId()).getMethodMap().get(imeId); if (imi == null || !isInlineSuggestionsEnabled(imi, touchExplorationEnabled)) { callback.onInlineSuggestionsUnsupported(); return; Loading services/core/java/com/android/server/inputmethod/InputMethodBindingController.java +6 −1 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ final class InputMethodBindingController { /** Time in milliseconds that the IME service has to bind before it is reconnected. */ static final long TIME_TO_RECONNECT = 3 * 1000; @UserIdInt final int mUserId; @UserIdInt private final int mUserId; @NonNull private final InputMethodManagerService mService; @NonNull private final Context mContext; @NonNull private final AutofillSuggestionsController mAutofillController; Loading Loading @@ -657,4 +657,9 @@ final class InputMethodBindingController { int getDeviceIdToShowIme() { return mDeviceIdToShowIme; } @UserIdInt int getUserId() { return mUserId; } } services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +6 −6 Original line number Diff line number Diff line Loading @@ -2041,7 +2041,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. @NonNull ImeOnBackInvokedDispatcher imeDispatcher, @NonNull InputMethodBindingController bindingController) { final int userId = bindingController.mUserId; final int userId = bindingController.getUserId(); final var userData = getUserData(userId); // Compute the final shown display ID with validated cs.selfReportedDisplayId for this Loading @@ -2058,8 +2058,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. // Potentially override the selected input method if the new display belongs to a virtual // device with a custom IME. String selectedMethodId = bindingController.getSelectedMethodId(); final String deviceMethodId = computeCurrentDeviceMethodIdLocked(bindingController.mUserId, selectedMethodId); final String deviceMethodId = computeCurrentDeviceMethodIdLocked( bindingController.getUserId(), selectedMethodId); if (deviceMethodId == null) { mVisibilityStateComputer.getImePolicy().setImeHiddenByDisplayPolicy(true); } else if (!Objects.equals(deviceMethodId, selectedMethodId)) { Loading Loading @@ -2557,7 +2557,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. @GuardedBy("ImfLock.class") void clearClientSessionsLocked(@NonNull InputMethodBindingController bindingController) { final int userId = bindingController.mUserId; final int userId = bindingController.getUserId(); final var userData = getUserData(userId); if (bindingController.getCurMethod() != null) { // TODO(b/324907325): Remove the suppress warnings once b/324907325 is fixed. Loading Loading @@ -3849,7 +3849,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. + " cs=" + cs); } final int userId = bindingController.mUserId; final int userId = bindingController.getUserId(); final var userData = getUserData(userId); final boolean sameWindowFocused = userData.mImeBindingState.mFocusedWindow == windowToken; final boolean isTextEditor = (startInputFlags & StartInputFlags.IS_TEXT_EDITOR) != 0; Loading Loading @@ -3883,7 +3883,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. null, null, null, null, -1, false); } userData.mImeBindingState = new ImeBindingState(bindingController.mUserId, windowToken, userData.mImeBindingState = new ImeBindingState(bindingController.getUserId(), windowToken, softInputMode, cs, editorInfo); mFocusedWindowPerceptible.put(windowToken, true); Loading services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodManagerServiceTestBase.java +1 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,7 @@ public class InputMethodManagerServiceTestBase { // Injecting and mocked InputMethodBindingController and InputMethod. mMockInputMethodInvoker = IInputMethodInvoker.create(mMockInputMethod); mInputManagerGlobalSession = InputManagerGlobal.createTestSession(mMockIInputManager); when(mMockInputMethodBindingController.getUserId()).thenReturn(mCallingUserId); synchronized (ImfLock.class) { when(mMockInputMethodBindingController.getCurMethod()) .thenReturn(mMockInputMethodInvoker); Loading services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/UserDataRepositoryTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ public final class UserDataRepositoryTest { // Assert UserDataRepository called the InputMethodBindingController creator function. verify(bindingControllerFactorySpy).apply(ANY_USER_ID); assertThat(allUserData.get(0).mBindingController.mUserId).isEqualTo(ANY_USER_ID); assertThat(allUserData.get(0).mBindingController.getUserId()).isEqualTo(ANY_USER_ID); } @Test Loading Loading @@ -149,7 +149,7 @@ public final class UserDataRepositoryTest { assertThat(allUserData.get(0).mUserId).isEqualTo(ANY_USER_ID); // Assert UserDataRepository called the InputMethodBindingController creator function. assertThat(allUserData.get(0).mBindingController.mUserId).isEqualTo(ANY_USER_ID); assertThat(allUserData.get(0).mBindingController.getUserId()).isEqualTo(ANY_USER_ID); } private List<UserDataRepository.UserData> collectUserData(UserDataRepository repository) { Loading Loading
services/core/java/com/android/server/inputmethod/AutofillSuggestionsController.java +2 −2 Original line number Diff line number Diff line Loading @@ -103,8 +103,8 @@ final class AutofillSuggestionsController { // Note that current user ID is guaranteed to be userId. final var imeId = mBindingController.getSelectedMethodId(); final InputMethodInfo imi = InputMethodSettingsRepository.get(mBindingController.mUserId) .getMethodMap().get(imeId); final InputMethodInfo imi = InputMethodSettingsRepository.get( mBindingController.getUserId()).getMethodMap().get(imeId); if (imi == null || !isInlineSuggestionsEnabled(imi, touchExplorationEnabled)) { callback.onInlineSuggestionsUnsupported(); return; Loading
services/core/java/com/android/server/inputmethod/InputMethodBindingController.java +6 −1 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ final class InputMethodBindingController { /** Time in milliseconds that the IME service has to bind before it is reconnected. */ static final long TIME_TO_RECONNECT = 3 * 1000; @UserIdInt final int mUserId; @UserIdInt private final int mUserId; @NonNull private final InputMethodManagerService mService; @NonNull private final Context mContext; @NonNull private final AutofillSuggestionsController mAutofillController; Loading Loading @@ -657,4 +657,9 @@ final class InputMethodBindingController { int getDeviceIdToShowIme() { return mDeviceIdToShowIme; } @UserIdInt int getUserId() { return mUserId; } }
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +6 −6 Original line number Diff line number Diff line Loading @@ -2041,7 +2041,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. @NonNull ImeOnBackInvokedDispatcher imeDispatcher, @NonNull InputMethodBindingController bindingController) { final int userId = bindingController.mUserId; final int userId = bindingController.getUserId(); final var userData = getUserData(userId); // Compute the final shown display ID with validated cs.selfReportedDisplayId for this Loading @@ -2058,8 +2058,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. // Potentially override the selected input method if the new display belongs to a virtual // device with a custom IME. String selectedMethodId = bindingController.getSelectedMethodId(); final String deviceMethodId = computeCurrentDeviceMethodIdLocked(bindingController.mUserId, selectedMethodId); final String deviceMethodId = computeCurrentDeviceMethodIdLocked( bindingController.getUserId(), selectedMethodId); if (deviceMethodId == null) { mVisibilityStateComputer.getImePolicy().setImeHiddenByDisplayPolicy(true); } else if (!Objects.equals(deviceMethodId, selectedMethodId)) { Loading Loading @@ -2557,7 +2557,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. @GuardedBy("ImfLock.class") void clearClientSessionsLocked(@NonNull InputMethodBindingController bindingController) { final int userId = bindingController.mUserId; final int userId = bindingController.getUserId(); final var userData = getUserData(userId); if (bindingController.getCurMethod() != null) { // TODO(b/324907325): Remove the suppress warnings once b/324907325 is fixed. Loading Loading @@ -3849,7 +3849,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. + " cs=" + cs); } final int userId = bindingController.mUserId; final int userId = bindingController.getUserId(); final var userData = getUserData(userId); final boolean sameWindowFocused = userData.mImeBindingState.mFocusedWindow == windowToken; final boolean isTextEditor = (startInputFlags & StartInputFlags.IS_TEXT_EDITOR) != 0; Loading Loading @@ -3883,7 +3883,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. null, null, null, null, -1, false); } userData.mImeBindingState = new ImeBindingState(bindingController.mUserId, windowToken, userData.mImeBindingState = new ImeBindingState(bindingController.getUserId(), windowToken, softInputMode, cs, editorInfo); mFocusedWindowPerceptible.put(windowToken, true); Loading
services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodManagerServiceTestBase.java +1 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,7 @@ public class InputMethodManagerServiceTestBase { // Injecting and mocked InputMethodBindingController and InputMethod. mMockInputMethodInvoker = IInputMethodInvoker.create(mMockInputMethod); mInputManagerGlobalSession = InputManagerGlobal.createTestSession(mMockIInputManager); when(mMockInputMethodBindingController.getUserId()).thenReturn(mCallingUserId); synchronized (ImfLock.class) { when(mMockInputMethodBindingController.getCurMethod()) .thenReturn(mMockInputMethodInvoker); Loading
services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/UserDataRepositoryTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -106,7 +106,7 @@ public final class UserDataRepositoryTest { // Assert UserDataRepository called the InputMethodBindingController creator function. verify(bindingControllerFactorySpy).apply(ANY_USER_ID); assertThat(allUserData.get(0).mBindingController.mUserId).isEqualTo(ANY_USER_ID); assertThat(allUserData.get(0).mBindingController.getUserId()).isEqualTo(ANY_USER_ID); } @Test Loading Loading @@ -149,7 +149,7 @@ public final class UserDataRepositoryTest { assertThat(allUserData.get(0).mUserId).isEqualTo(ANY_USER_ID); // Assert UserDataRepository called the InputMethodBindingController creator function. assertThat(allUserData.get(0).mBindingController.mUserId).isEqualTo(ANY_USER_ID); assertThat(allUserData.get(0).mBindingController.getUserId()).isEqualTo(ANY_USER_ID); } private List<UserDataRepository.UserData> collectUserData(UserDataRepository repository) { Loading