Let token animation notify removing starting window
AsyncRotationController may have executed all operations then it
becomes null, but the fade-in animation can still be running.
So if the specified type is animating, let the callback which]
is set by case Operation.ACTION_TOGGLE_IME in
AsyncRotationController#finishOp to call reportImeDrawnForOrganizer.
Otherwise if it reports ime drawn too early, the snapshot starting
window will be removed before the fade-in animation is completed,
which cause flickering.
Bug: 329781040
Test: ShowImeOnAppStartWhenLaunchingAppFromFixedOrientationTest
Change-Id: I23474f6e369ef390f46d5cdd95867e8a3070dbb7
diff --git a/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java b/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java
index 2dbb370..092ff3d 100644
--- a/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java
+++ b/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java
@@ -181,8 +181,10 @@
}
WindowToken imeToken = mWindowContainer.asWindowState() != null
? mWindowContainer.asWindowState().mToken : null;
- if (mDisplayContent.getAsyncRotationController() != null
- && mDisplayContent.getAsyncRotationController().isTargetToken(imeToken)) {
+ final var rotationController = mDisplayContent.getAsyncRotationController();
+ if ((rotationController != null && rotationController.isTargetToken(imeToken))
+ || (imeToken != null && imeToken.isSelfAnimating(
+ 0 /* flags */, SurfaceAnimator.ANIMATION_TYPE_TOKEN_TRANSFORM))) {
// Skip reporting IME drawn state when the control target is in fixed
// rotation, AsyncRotationController will report after the animation finished.
return;