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

Commit eb0db5b0 authored by Taran Singh's avatar Taran Singh
Browse files

Fix order of binding result when using zeroJankProxy

When a new client gets bound to IME, the order of bind events are out of
order: MSG_BIND arrives before MSG_START_INPUT_RESULT (with
InputBindResult.result SUCCESS_WAITING_IME_SESSION). The order needs to
be flipped so that sequence check doesn't mismatch in MSG_BIND.

Fix: 330486656
Test: atest FlickerTestsIme
Change-Id: I7ed08ed84217478f148cbaf89f1afcaa410c6bfe
parent 70a4f7e5
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -2295,10 +2295,12 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
            @NonNull InputMethodBindingController bindingController, @NonNull ClientState cs) {
        if (bindingController.hasMainConnection()) {
            if (getCurMethodLocked() != null) {
                if (!Flags.useZeroJankProxy()) {
                    // Return to client, and we will get back with it when
                    // we have had a session made for it.
                    requestClientSessionLocked(cs);
                    requestClientSessionForAccessibilityLocked(cs);
                }
                return new InputBindResult(
                        InputBindResult.ResultCode.SUCCESS_WAITING_IME_SESSION,
                        null, null, null,
+11 −0
Original line number Diff line number Diff line
@@ -248,6 +248,17 @@ final class ZeroJankProxy implements IInputMethodManagerImpl.Callback {
                    unverifiedTargetSdkVersion,
                    userId, imeDispatcher);
            sendOnStartInputResult(client, result, startInputSeq);
            // For first-time client bind, MSG_BIND should arrive after MSG_START_INPUT_RESULT.
            if (result.result == InputBindResult.ResultCode.SUCCESS_WAITING_IME_SESSION) {
                InputMethodManagerService imms = ((InputMethodManagerService) mInner);
                synchronized (ImfLock.class) {
                    ClientState cs = imms.getClientStateLocked(client);
                    if (cs != null) {
                        imms.requestClientSessionLocked(cs);
                        imms.requestClientSessionForAccessibilityLocked(cs);
                    }
                }
            }
        });
    }