Optimize scheduleShowImePostLayout

This adds various small improvements to the logic in
ImeInsetsSourceProvider for scheduleShowImePostLayout.

The mShowImeRunner is inlined, as there is no need for a runnable for
this code. This allows removing the duplicated isReadyToShowIme check.
The order of the checks in isReadyToShowIme is slightly tweaked to early
return in the most common cases (when no request is scheduled), as well
as now including the WindowContainer checks. This method is now renamed
to isScheduledAndReadyToShowIme, and checkShowImePostLayout is renamed
to checkAndStartShowImePostLayout, to reflect the actual behaviour.

The mIsImeLayoutDrawn property is removed, as this didn't actually allow
skipping the isReadyToShowIme check, nor protect agains re-entry.

The abortShowImePostLayout is called only when we actually abort (hide
while we have a scheduled and unhandled show), and no longer after
handling a show. The trace for showImePostLayout is also marked ended in
the abort, to avoid unfinished traces.

Bug: 332898042
Test: atest ImeInsetsSourceProviderTest
Change-Id: Id8e8560f961339574f53c95e81e41147eef276d8
5 files changed