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

Commit 13d5dce5 authored by Felix Stern's avatar Felix Stern
Browse files

Remove invokeOnImeRequestedChangedListener call if input target != control target

In case when the input target was different to the control target, we already invoked IME listener (in ImeInsetsSourceProvider#reportImeInputTargetStateToControlTarget). However, this should only happen, when the caller of updateClientVisibility is the control target.
In split screen, this will happen (through a call to WindowManager#updateDisplayWindowRequestedVisibleTypes). Therefore, we don't need to trigger the listener too early.
The virtual display is an exemption, as is not guaranteed that it has an ImeInsetsSourceProvider.

Test: CtsInputMethodTestCases
Bug: 298172246
Flag: android.view.inputmethod.refactor_insets_controller
Change-Id: I6fe7e2e1f972be264796e8880c006f15aa18f408
parent 56b5042c
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -346,12 +346,15 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider {
                ImeTracker.forLogging().onProgress(statsToken,
                        ImeTracker.PHASE_WM_SET_REMOTE_TARGET_IME_VISIBILITY);
                controlTarget.setImeInputTargetRequestedVisibility(imeVisible);
                // not all virtual displays have an ImeInsetsSourceProvider, so it is not
                // guaranteed that the IME will be started when the control target reports its
                // requested visibility back. Thus, invoking the listener here.
                invokeOnImeRequestedChangedListener(imeInsetsTarget, statsToken);
            } else {
                ImeTracker.forLogging().onFailed(statsToken,
                        ImeTracker.PHASE_WM_SET_REMOTE_TARGET_IME_VISIBILITY);
            }
        }
        invokeOnImeRequestedChangedListener(imeInsetsTarget, statsToken);
    }

    // TODO(b/353463205) check callers to see if we can make statsToken @NonNull