notifyFinished: Send requestedVisibleTypes before update animatingTypes

This CL changes the order of sending the requestedVisibleTypes when an
animation is finished (sending it before changing the animatingTypes).

When a controlled animation was finished without change (e.g. IME was
shown before and is still showing), the requestedVisibleTypes were sent
too late (after the animatingTypes were reset), which triggered a hide
request first, and then a show request just after the
requestedVisibleTypes were sent to the server.

When the controlled animation started, the insetsTypes were removed from
the requestedVisibleTypes, and added to the animatingTypes. Then the
animation finished, we first added the insetsTypes back to the
requestedVisibleTypes, but did not send it yet.

Without this change, there is a hide request sent to the IME,
immediately followed by a show request (after sending the updated
requestedVisibleTypes to the server).

Fix: 430515058
Flag: android.view.inputmethod.report_animating_insets_types
Test: atest CtsInputMethodTestCases
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:a4841ba743b183ca28f89d12fa22e14a29071575
Merged-In: I4834a29e85729a5e3e06bd2dc0f2c5ca5a2b7d67
Change-Id: I4834a29e85729a5e3e06bd2dc0f2c5ca5a2b7d67
1 file changed