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

Commit f312425a authored by Cosmin Băieș's avatar Cosmin Băieș Committed by Adrian Roos
Browse files

Set the IME control's initiallyVisible to false

We create the insets source control on the server side in
InsetsSourceProvider#updateControlForTarget, setting the
control's initiallyVisible to the clientVisible. For the IME provider,
we update the clientVisible to match the target's requestedVisibleTypes,
added in [1]. We also reset the IME target's requestedVisibleTypes
when we lose control in the ImeInsetsSourceConsumer on the client side.

There is a race condition between resetting the requestedVisibleTypes
in the consumer (client side) and reading the value in the provider
(server side), which leads to the IME control having initiallyVisible
set to true. However, this breaks some assumptions, as we expect the
IME control's initiallyVisible to always be false. One example is
triggering a hide request that would cancel an explicit show request.

This replaces the logic for updating the IME controls's initiallyVisible
based on the providers's clientVisible, to always set it to false,
matching the IME expectations.

This could only lead to an inconsistency between the actual visibility
of the IME, and the visibility tracked by IMMS, which was already an
issue, and is going to be fixed by the refactor in b/298172246.

  [1]: I1f140af6bcccbcbe6efb2fde9a789ac4c7bd127f

Test: atest ImeSwitchingTest#testImeRemainsVisibleAfterSwitchingIme
Bug: 328994329
Bug: 337122357
Change-Id: I459debedb243b4345b9981b88adf6e4a0ea9b44a
(cherry picked from commit c8a1fbb5)
parent 0e2a0877
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -518,8 +518,17 @@ class InsetsSourceProvider {
        final SurfaceControl leash = mAdapter.mCapturedLeash;
        mControlTarget = target;
        updateVisibility();
        boolean initiallyVisible = mClientVisible;
        if (mSource.getType() == WindowInsets.Type.ime()) {
            // The IME cannot be initially visible, see ControlAdapter#startAnimation below.
            // Also, the ImeInsetsSourceConsumer clears the client visibility upon losing control,
            // but this won't have reached here yet by the time the new control is created.
            // Note: The DisplayImeController needs the correct previous client's visibility, so we
            // only override the initiallyVisible here.
            initiallyVisible = false;
        }
        mControl = new InsetsSourceControl(mSource.getId(), mSource.getType(), leash,
                mClientVisible, surfacePosition, getInsetsHint());
                initiallyVisible, surfacePosition, getInsetsHint());

        ProtoLog.d(WM_DEBUG_WINDOW_INSETS,
                "InsetsSource Control %s for target %s", mControl, mControlTarget);