summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yohei Yukawa <yukawa@google.com> 2024-07-12 06:09:18 +0000
committer Yohei Yukawa <yukawa@google.com> 2024-07-12 06:09:18 +0000
commit05b5e0e29ec54feed2c02edf7a62ea3fe6a4e2e9 (patch)
treed9876703533936cfe2b112ef0c4ae2b1f8799917
parent626a053f154456d53de2f04654df4f6d1682fbc7 (diff)
Make sure to not block SystemService#onUserStarting() in IMMS
As part of our on-going effort to make sure that slow I/O operations will not block the system in InputMethodManagerService, we start dispatching InputMethodManagerService#initializeVisibleBackgroundUserLocked() into an I/O thread. The observable semantics should remain unchanged in general. Bug: 343601565 Test: presubmit Flag: EXEMPT refactor Change-Id: Iee0b1c7276f88e4b179b0eb8fb978503bc45760c
-rw-r--r--services/core/java/com/android/server/inputmethod/InputMethodManagerService.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
index f84d55f9b20b..7daf9582cdd6 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
@@ -1038,13 +1038,15 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
// Called on ActivityManager thread.
final int userId = user.getUserIdentifier();
SecureSettingsWrapper.onUserStarting(userId);
- synchronized (ImfLock.class) {
- if (mService.mConcurrentMultiUserModeEnabled) {
- if (mService.mCurrentUserId != userId && mService.mSystemReady) {
- mService.initializeVisibleBackgroundUserLocked(userId);
+ mService.mIoHandler.post(() -> {
+ synchronized (ImfLock.class) {
+ if (mService.mConcurrentMultiUserModeEnabled) {
+ if (mService.mCurrentUserId != userId && mService.mSystemReady) {
+ mService.initializeVisibleBackgroundUserLocked(userId);
+ }
}
}
- }
+ });
}
}