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

Commit d4121588 authored by Cosmin Băieș's avatar Cosmin Băieș
Browse files

Handle ImeTracker timeout in collectSourceControl

If we have fromIme=true but either no control or a control without a
leash, the IME request will fail (as the IME inset type wont be added
in typesReady), but we don't cancel the statsToken in that case.

This adds handling for this case and also logs it to surface the cause.

Bug: 317909682
Test: n/a
Change-Id: Ief2b929680cde1f81544c4e7f845a1fe39a7414c
parent a60c144b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1498,6 +1498,14 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
                    && (control.getLeash() != null || control.getId() == ID_IME_CAPTION_BAR)) {
                controls.put(control.getId(), new InsetsSourceControl(control));
                typesReady |= consumer.getType();
            } else if (fromIme) {
                Log.w(TAG, "collectSourceControls can't continue for type: ime,"
                        + " fromIme: true requires a control with a leash but we have "
                        + ((control == null)
                            ? "control: null"
                            : "control: non-null and control.getLeash(): null"));
                ImeTracker.forLogging().onFailed(statsToken,
                        ImeTracker.PHASE_CLIENT_COLLECT_SOURCE_CONTROLS);
            }
        }
        return new Pair<>(typesReady, imeReady);