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

Commit 01701146 authored by Nikolas Havrikov's avatar Nikolas Havrikov
Browse files

Extract part of the client switch logic

Bug: 205676419
Test: make
Change-Id: If387b0f0d007ca468f3a038693ca2014d8e671d6
parent 8bdeee1a
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -2447,14 +2447,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        mImeHiddenByDisplayPolicy = false;

        if (mCurClient != cs) {
            // If the client is changing, we need to switch over to the new
            // one.
            unbindCurrentClientLocked(UnbindReason.SWITCH_CLIENT);
            // If the screen is on, inform the new client it is active
            if (mIsInteractive) {
                scheduleSetActiveToClient(cs, true /* active */, false /* fullscreen */,
                        false /* reportToImeController */);
            }
            prepareClientSwitchLocked(cs);
        }

        // Bump up the sequence for this client and attach it.
@@ -2523,6 +2516,18 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        return InputBindResult.IME_NOT_CONNECTED;
    }

    @GuardedBy("mMethodMap")
    private void prepareClientSwitchLocked(ClientState cs) {
        // If the client is changing, we need to switch over to the new
        // one.
        unbindCurrentClientLocked(UnbindReason.SWITCH_CLIENT);
        // If the screen is on, inform the new client it is active
        if (mIsInteractive) {
            scheduleSetActiveToClient(cs, true /* active */, false /* fullscreen */,
                    false /* reportToImeController */);
        }
    }

    @NonNull
    private Intent createImeBindingIntent(ComponentName component) {
        Intent intent = new Intent(InputMethod.SERVICE_INTERFACE);