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

Commit f772e456 authored by Cosmin Băieș's avatar Cosmin Băieș Committed by Bharath
Browse files

Register IME back callback on new dispatcher

In [1] we started registering the IME back callback also when starting a
new input connection, as it could be unregistered from finishing the
previous connection, without having a subsequent showWindow call. This
was intended to mirror [2], where we unregister the callback when
finishing an input connection, to handle cases without a hideWindow
call.

However, this lead to a race condition with the new IME show/hide flow
in [3]. In the previous flow, when going from an Activity A that
requested the IME, to an Activity B that did not request the IME, we
would first let the IME know it was hidden, then report this to the IME
client (Activity B), and only then start the input connection on B.

With the new flow, we first report this to the IME client (Activity B),
which is a no-op as it did not request the IME, then start the input
connection on B, and only then let the IME know it was hidden.

While this is part of the problem, the other issue is that we both
unregister and register the callback on the previous client (Activity A)
instead of unregistering on A and registering on B. This fixes the issue
by registering only after the callback client is updated.

  [1]: I0d0f823a2998a08b8dfc2b0d6e39a0a9de521b14
  [2]: I8dc1425aa9338b37128d308bf58fd15c39d04a88
  [3]: I8e3a74ee579f085cb582040fdba725e7a63d6b85

Flag: EXEMPT bugfix
Test: atest KeyboardVisibilityControlTest#testHideImeAfterBackPressed_inSecondActivityAfterProcessSwitch
Bug: 407224281
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a3fc0f233c7fec3a085caf618297cef7aadc8a4e)
Merged-In: Ida3c969789d8e04b002cb87338b0f8ddc893810f
Change-Id: Ida3c969789d8e04b002cb87338b0f8ddc893810f
parent ca17c13d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment