Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d4bf2b8 authored by Antonio Kantek's avatar Antonio Kantek
Browse files

Skip headless user when reset all IME users

Command `adb shell ime reset --user all` crashes with NPE when running
on HSUM surfaces. This fix will prevent IMMS to list IMEs for headless
users.

Fix: 295476022
Test: manual (ran `adb shell ime reset --user all`)
Test: atest CtsInputMethodTestCases
Change-Id: I22b71ff0482cf18c10716b52504c95ffb991796f
parent 847aad3e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_CRITICAL;
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_NORMAL;
import static android.os.IServiceManager.DUMP_FLAG_PROTO;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.os.UserManager.USER_TYPE_SYSTEM_HEADLESS;
import static android.provider.Settings.Secure.STYLUS_HANDWRITING_DEFAULT_VALUE;
import static android.provider.Settings.Secure.STYLUS_HANDWRITING_ENABLED;
import static android.server.inputmethod.InputMethodManagerServiceProto.BACK_DISPOSITION;
@@ -6453,6 +6454,11 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                    if (!userHasDebugPriv(userId, shellCommand)) {
                        continue;
                    }
                    // Skip on headless user
                    if (USER_TYPE_SYSTEM_HEADLESS.equals(
                            mUserManagerInternal.getUserInfo(userId).userType)) {
                        continue;
                    }
                    final String nextIme;
                    final List<InputMethodInfo> nextEnabledImes;
                    if (userId == mSettings.getCurrentUserId()) {