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

Commit 57f5ea9e authored by Taran Singh's avatar Taran Singh
Browse files

ZeroJankProxy: Synchronize startInputResult

Hold a lock before sending startInputResult() over binder to client. Otherwise, it can be racy with onBind()

Bug: 329357734
Test: atest ExtractViewTest --iteration xx

Change-Id: I325fd7268ff303c6e15ad59a33a33e3b0d51483d
parent c7ef3af1
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -421,6 +421,7 @@ public class ZeroJankProxy extends IInputMethodManager.Stub {

    private void sendOnStartInputResult(
            IInputMethodClient client, InputBindResult res, int startInputSeq) {
        synchronized (ImfLock.class) {
            InputMethodManagerService service = (InputMethodManagerService) mInner;
            final ClientState cs = service.getClientState(client);
            if (cs != null && cs.mClient != null) {
@@ -428,7 +429,9 @@ public class ZeroJankProxy extends IInputMethodManager.Stub {
            } else {
                // client is unbound.
                Slog.i(TAG, "Client that requested startInputOrWindowGainedFocus is no longer"
                    + " bound. InputBindResult: " + res + " for startInputSeq: " + startInputSeq);
                        + " bound. InputBindResult: " + res + " for startInputSeq: "
                        + startInputSeq);
            }
        }
    }
}