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

Commit e0e8eecc authored by Adrian Roos's avatar Adrian Roos
Browse files

IMMS: defer showSoftInput until session is established

onStartInput is only dispatched once the session exists. To
avoid still showing the IME on the old window, we need to
defer showing the input until the session has been created
and the input attached.

Fixes: 337766845
Test: atest 'InputMethodStartInputLifecycleTest#testShowingImeDuringSessionChange_doesntShowOnPreviousSession'
Change-Id: I446fa22fbc259a3f3c94be97786a9ef100121ec3
parent fdc436fe
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -106,3 +106,13 @@ flag {
    }
}

flag {
  name: "defer_show_soft_input_until_session_creation"
  namespace: "input_method"
  description: "Defers showSoftInput until the IME session has been created."
  bug: "337766845"
  is_fixed_read_only: true
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}
+8 −1
Original line number Diff line number Diff line
@@ -3401,7 +3401,14 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        mBindingController.setCurrentMethodVisible();
        final IInputMethodInvoker curMethod = getCurMethodLocked();
        ImeTracker.forLogging().onCancelled(mCurStatsToken, ImeTracker.PHASE_SERVER_WAIT_IME);
        if (curMethod != null) {
        final boolean readyToDispatchToIme;
        if (Flags.deferShowSoftInputUntilSessionCreation()) {
            readyToDispatchToIme =
                    curMethod != null && mCurClient != null && mCurClient.mCurSession != null;
        } else {
            readyToDispatchToIme = curMethod != null;
        }
        if (readyToDispatchToIme) {
            ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_SERVER_HAS_IME);
            mCurStatsToken = null;