summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tiger <tigerhuang@google.com> 2023-10-24 18:50:14 +0800
committer Tiger <tigerhuang@google.com> 2023-10-24 18:56:53 +0800
commitda44ac7f07bc4f2ec2f4be30b012b2b6aade3ba4 (patch)
tree4e586a0bdaf16cece75c09ea968bfa29761c6886
parentfb34923b35e29402301b64ddb76bdb089fec8d53 (diff)
Use mAnimationType to decide if the insets of the first frame is visible
Previously, we used the visibility of the source from mInitialInsetsState to decide if the insets of the first frame is visible. However, the visibilities of sources in mInitialInsetsState might have already been overridden by the control target, which might be the state after the animation, not before. This CL uses mAnimationType to decide if the insets of the first frame is visible. Fix: 307488639 Test: atest WindowInsetsAnimationTests WindowInsetsAnimationImeTests Change-Id: I707259d977af1d4430e007bf73a4b3c1b148a4a7
-rw-r--r--core/java/android/view/InsetsAnimationControlImpl.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/java/android/view/InsetsAnimationControlImpl.java b/core/java/android/view/InsetsAnimationControlImpl.java
index 1ec7c41e4395..17a3a12d3b79 100644
--- a/core/java/android/view/InsetsAnimationControlImpl.java
+++ b/core/java/android/view/InsetsAnimationControlImpl.java
@@ -28,6 +28,7 @@ import static android.view.InsetsAnimationControlImplProto.PENDING_FRACTION;
import static android.view.InsetsAnimationControlImplProto.PENDING_INSETS;
import static android.view.InsetsAnimationControlImplProto.SHOWN_ON_FINISH;
import static android.view.InsetsAnimationControlImplProto.TMP_MATRIX;
+import static android.view.InsetsController.ANIMATION_TYPE_SHOW;
import static android.view.InsetsController.AnimationType;
import static android.view.InsetsController.DEBUG;
import static android.view.InsetsController.LAYOUT_INSETS_DURING_ANIMATION_SHOWN;
@@ -469,8 +470,10 @@ public class InsetsAnimationControlImpl implements InternalInsetsAnimationContro
}
addTranslationToMatrix(side, offset, mTmpMatrix, mTmpFrame);
- final boolean visible = mPendingFraction == 0 && source != null
- ? source.isVisible()
+ // The first frame of ANIMATION_TYPE_SHOW should be invisible since it is animated from
+ // the hidden state.
+ final boolean visible = mPendingFraction == 0
+ ? mAnimationType != ANIMATION_TYPE_SHOW
: !mFinished || mShownOnFinish;
if (outState != null && source != null) {