Loading services/core/java/com/android/server/inputmethod/AdditionalSubtypeMapRepository.java +4 −4 Original line number Diff line number Diff line Loading @@ -225,17 +225,17 @@ final class AdditionalSubtypeMapRepository { sWriter.startThread(); } static void initialize(@NonNull Handler handler, @NonNull Context context) { static void initialize(@NonNull Handler ioHandler, @NonNull Context context) { final UserManagerInternal userManagerInternal = LocalServices.getService(UserManagerInternal.class); handler.post(() -> { ioHandler.post(() -> { userManagerInternal.addUserLifecycleListener( new UserManagerInternal.UserLifecycleListener() { @Override public void onUserCreated(UserInfo user, @Nullable Object token) { final int userId = user.id; sWriter.onUserCreated(userId); handler.post(() -> { ioHandler.post(() -> { synchronized (ImfLock.class) { if (!sPerUserMap.contains(userId)) { final AdditionalSubtypeMap additionalSubtypeMap = Loading @@ -257,7 +257,7 @@ final class AdditionalSubtypeMapRepository { public void onUserRemoved(UserInfo user) { final int userId = user.id; sWriter.onUserRemoved(userId); handler.post(() -> { ioHandler.post(() -> { synchronized (ImfLock.class) { sPerUserMap.remove(userId); } Loading services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -1124,8 +1124,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. // Search for InputMethodSettingsRepository.put() to find where and when it's actually // being updated. In general IMMS should refrain from exposing the existence of IMEs // until systemReady(). InputMethodSettingsRepository.initialize(mHandler, mContext); AdditionalSubtypeMapRepository.initialize(mHandler, mContext); InputMethodSettingsRepository.initialize(mIoHandler, mContext); AdditionalSubtypeMapRepository.initialize(mIoHandler, mContext); mCurrentUserId = mActivityManagerInternal.getCurrentUserId(); @SuppressWarnings("GuardedBy") final IntFunction<InputMethodBindingController> Loading services/core/java/com/android/server/inputmethod/InputMethodSettingsRepository.java +3 −3 Original line number Diff line number Diff line Loading @@ -54,16 +54,16 @@ final class InputMethodSettingsRepository { sPerUserMap.put(userId, obj); } static void initialize(@NonNull Handler handler, @NonNull Context context) { static void initialize(@NonNull Handler ioHandler, @NonNull Context context) { final UserManagerInternal userManagerInternal = LocalServices.getService(UserManagerInternal.class); handler.post(() -> { ioHandler.post(() -> { userManagerInternal.addUserLifecycleListener( new UserManagerInternal.UserLifecycleListener() { @Override public void onUserRemoved(UserInfo user) { final int userId = user.id; handler.post(() -> { ioHandler.post(() -> { synchronized (ImfLock.class) { sPerUserMap.remove(userId); } Loading services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodManagerServiceTestBase.java +5 −1 Original line number Diff line number Diff line Loading @@ -243,9 +243,13 @@ public class InputMethodManagerServiceTestBase { Process.THREAD_PRIORITY_FOREGROUND, true /* allowIo */); mIoThread.start(); final var ioHandler = spy(Handler.createAsync(mIoThread.getLooper())); doReturn(true).when(ioHandler).post(any()); mInputMethodManagerService = new InputMethodManagerService(mContext, InputMethodManagerService.shouldEnableConcurrentMultiUserMode(mContext), mServiceThread.getLooper(), Handler.createAsync(mIoThread.getLooper()), mServiceThread.getLooper(), ioHandler, unusedUserId -> mMockInputMethodBindingController); spyOn(mInputMethodManagerService); Loading Loading
services/core/java/com/android/server/inputmethod/AdditionalSubtypeMapRepository.java +4 −4 Original line number Diff line number Diff line Loading @@ -225,17 +225,17 @@ final class AdditionalSubtypeMapRepository { sWriter.startThread(); } static void initialize(@NonNull Handler handler, @NonNull Context context) { static void initialize(@NonNull Handler ioHandler, @NonNull Context context) { final UserManagerInternal userManagerInternal = LocalServices.getService(UserManagerInternal.class); handler.post(() -> { ioHandler.post(() -> { userManagerInternal.addUserLifecycleListener( new UserManagerInternal.UserLifecycleListener() { @Override public void onUserCreated(UserInfo user, @Nullable Object token) { final int userId = user.id; sWriter.onUserCreated(userId); handler.post(() -> { ioHandler.post(() -> { synchronized (ImfLock.class) { if (!sPerUserMap.contains(userId)) { final AdditionalSubtypeMap additionalSubtypeMap = Loading @@ -257,7 +257,7 @@ final class AdditionalSubtypeMapRepository { public void onUserRemoved(UserInfo user) { final int userId = user.id; sWriter.onUserRemoved(userId); handler.post(() -> { ioHandler.post(() -> { synchronized (ImfLock.class) { sPerUserMap.remove(userId); } Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +2 −2 Original line number Diff line number Diff line Loading @@ -1124,8 +1124,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. // Search for InputMethodSettingsRepository.put() to find where and when it's actually // being updated. In general IMMS should refrain from exposing the existence of IMEs // until systemReady(). InputMethodSettingsRepository.initialize(mHandler, mContext); AdditionalSubtypeMapRepository.initialize(mHandler, mContext); InputMethodSettingsRepository.initialize(mIoHandler, mContext); AdditionalSubtypeMapRepository.initialize(mIoHandler, mContext); mCurrentUserId = mActivityManagerInternal.getCurrentUserId(); @SuppressWarnings("GuardedBy") final IntFunction<InputMethodBindingController> Loading
services/core/java/com/android/server/inputmethod/InputMethodSettingsRepository.java +3 −3 Original line number Diff line number Diff line Loading @@ -54,16 +54,16 @@ final class InputMethodSettingsRepository { sPerUserMap.put(userId, obj); } static void initialize(@NonNull Handler handler, @NonNull Context context) { static void initialize(@NonNull Handler ioHandler, @NonNull Context context) { final UserManagerInternal userManagerInternal = LocalServices.getService(UserManagerInternal.class); handler.post(() -> { ioHandler.post(() -> { userManagerInternal.addUserLifecycleListener( new UserManagerInternal.UserLifecycleListener() { @Override public void onUserRemoved(UserInfo user) { final int userId = user.id; handler.post(() -> { ioHandler.post(() -> { synchronized (ImfLock.class) { sPerUserMap.remove(userId); } Loading
services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodManagerServiceTestBase.java +5 −1 Original line number Diff line number Diff line Loading @@ -243,9 +243,13 @@ public class InputMethodManagerServiceTestBase { Process.THREAD_PRIORITY_FOREGROUND, true /* allowIo */); mIoThread.start(); final var ioHandler = spy(Handler.createAsync(mIoThread.getLooper())); doReturn(true).when(ioHandler).post(any()); mInputMethodManagerService = new InputMethodManagerService(mContext, InputMethodManagerService.shouldEnableConcurrentMultiUserMode(mContext), mServiceThread.getLooper(), Handler.createAsync(mIoThread.getLooper()), mServiceThread.getLooper(), ioHandler, unusedUserId -> mMockInputMethodBindingController); spyOn(mInputMethodManagerService); Loading