diff options
| author | 2024-01-08 11:22:03 +0100 | |
|---|---|---|
| committer | 2024-01-08 11:22:03 +0100 | |
| commit | a4b957015697b6ade58291245a076c96e0c3cb4c (patch) | |
| tree | fb12b240e8fb1ea20741b1dae49e76faa0b1770b | |
| parent | 970067a4be937cd89c4664d1faf5c1d7c611b935 (diff) | |
Skip IMM#ensureDefaultInstance in system_server
The system code should not rely on/use the static instance of
InputMethodManager, so we should skip this call entirely when running in
system_server.
Bug: 318819032
Test: n/a
Change-Id: Ie7d409cb32b577e788ef8870677576955d615efd
| -rw-r--r-- | core/java/android/view/inputmethod/InputMethodManager.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index feccc6bef7a4..3bc02a6c8fd1 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -354,7 +354,11 @@ public final class InputMethodManager { * @hide */ public static void ensureDefaultInstanceForDefaultDisplayIfNecessary() { - forContextInternal(Display.DEFAULT_DISPLAY, Looper.getMainLooper()); + // Skip this call if we are in system_server, as the system code should not use this + // deprecated instance. + if (!ActivityThread.isSystem()) { + forContextInternal(Display.DEFAULT_DISPLAY, Looper.getMainLooper()); + } } private static final Object sLock = new Object(); |