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

Commit f80d96ad authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Remove unused InputMethodManagerService#mLastSwitchUserId

A special shell command for CTS

  adb shell cmd input_method get-last-switch-user-id,

which was added as a temporary workaround for multi-user IME scenario
tests [1], has no longer been used after our migration from host-side
IME CTS tests to device-side tests [2].

Now we can safely remove this shell command.

 [1]: I07a0120d44bcb3e3d60d51c510e7e566ce424148
      a7babbbf
 [2]: Ic6ac9d440a95240973e6578459c82955de4d62df
      346afc790098c9c62decd4619c8681ae9f4de60e

Fix: 327495933
Test: atest CtsInputMethodServiceHostTestCases
Change-Id: Ia7d3cd218badc589566cdb04d719e523d5336ae4
parent 3a9e332a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ message InputMethodManagerServiceProto {
    optional string cur_token = 14;
    optional int32 cur_token_display_id = 15;
    optional bool system_ready = 16;
    optional int32 last_switch_user_id = 17;
    reserved 17; // deprecated last_switch_user_id
    optional bool have_connection = 18;
    optional bool bound_to_method = 19;
    optional bool is_interactive = 20;
+0 −19
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ import static android.server.inputmethod.InputMethodManagerServiceProto.IME_WIND
import static android.server.inputmethod.InputMethodManagerServiceProto.IN_FULLSCREEN_MODE;
import static android.server.inputmethod.InputMethodManagerServiceProto.IS_INTERACTIVE;
import static android.server.inputmethod.InputMethodManagerServiceProto.LAST_IME_TARGET_WINDOW_NAME;
import static android.server.inputmethod.InputMethodManagerServiceProto.LAST_SWITCH_USER_ID;
import static android.server.inputmethod.InputMethodManagerServiceProto.SHOW_IME_WITH_HARD_KEYBOARD;
import static android.server.inputmethod.InputMethodManagerServiceProto.SYSTEM_READY;
import static android.view.Display.DEFAULT_DISPLAY;
@@ -277,9 +276,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
    @NonNull
    private final String[] mNonPreemptibleInputMethods;

    @UserIdInt
    private int mLastSwitchUserId;

    final Context mContext;
    final Resources mRes;
    private final Handler mHandler;
@@ -1679,8 +1675,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub

        final int userId = mActivityManagerInternal.getCurrentUserId();

        mLastSwitchUserId = userId;

        // mSettings should be created before buildInputMethodListLocked
        mSettings = InputMethodSettings.createEmptyMap(userId);

@@ -1866,7 +1860,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                    + " selectedIme=" + mSettings.getSelectedInputMethod());
        }

        mLastSwitchUserId = newUserId;
        if (mIsInteractive && clientToBeReset != null) {
            final ClientState cs = mClientController.getClient(clientToBeReset.asBinder());
            if (cs == null) {
@@ -4743,7 +4736,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
            proto.write(CUR_TOKEN, Objects.toString(getCurTokenLocked()));
            proto.write(CUR_TOKEN_DISPLAY_ID, mCurTokenDisplayId);
            proto.write(SYSTEM_READY, mSystemReady);
            proto.write(LAST_SWITCH_USER_ID, mLastSwitchUserId);
            proto.write(HAVE_CONNECTION, hasConnectionLocked());
            proto.write(BOUND_TO_METHOD, mBoundToMethod);
            proto.write(IS_INTERACTIVE, mIsInteractive);
@@ -6324,8 +6316,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
        @ShellCommandResult
        private int onCommandWithSystemIdentity(@Nullable String cmd) {
            switch (TextUtils.emptyIfNull(cmd)) {
                case "get-last-switch-user-id":
                    return mService.getLastSwitchUserId(this);
                case "tracing":
                    return mService.handleShellCommandTraceInputMethod(this);
                case "ime": {  // For "adb shell ime <command>".
@@ -6439,15 +6429,6 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
    // ----------------------------------------------------------------------
    // Shell command handlers:

    @BinderThread
    @ShellCommandResult
    private int getLastSwitchUserId(@NonNull ShellCommand shellCommand) {
        synchronized (ImfLock.class) {
            shellCommand.getOutPrintWriter().println(mLastSwitchUserId);
            return ShellCommandResult.SUCCESS;
        }
    }

    /**
     * Handles {@code adb shell ime list}.
     * @param shellCommand {@link ShellCommand} object that is handling this command.