Improve the first frame latency of BP showing
Reduce the times of build layers, draw layers and flush layers
Bug: b/249295628
Test: 1. Atest AuthContainerViewTest
2. Check Prompt show/dismiss animation
Change-Id: I6c6ac1d9115dd8610dc3e9555a208c372e341a9e
(cherry picked from commit eb1b3a43ce)
This commit is contained in:
@@ -485,45 +485,18 @@ public class AuthContainerView extends LinearLayout
|
||||
mContainerState = STATE_SHOWING;
|
||||
} else {
|
||||
mContainerState = STATE_ANIMATING_IN;
|
||||
// The background panel and content are different views since we need to be able to
|
||||
// animate them separately in other places.
|
||||
mPanelView.setY(mTranslationY);
|
||||
mBiometricScrollView.setY(mTranslationY);
|
||||
|
||||
setY(mTranslationY);
|
||||
setAlpha(0f);
|
||||
final long animateDuration = mConfig.mSkipAnimation ? 0 : ANIMATION_DURATION_SHOW_MS;
|
||||
postOnAnimation(() -> {
|
||||
mPanelView.animate()
|
||||
.translationY(0)
|
||||
.setDuration(animateDuration)
|
||||
.setInterpolator(mLinearOutSlowIn)
|
||||
.setListener(getJankListener(mPanelView, SHOW, animateDuration))
|
||||
.withLayer()
|
||||
.withEndAction(this::onDialogAnimatedIn)
|
||||
.start();
|
||||
mBiometricScrollView.animate()
|
||||
.translationY(0)
|
||||
.setDuration(animateDuration)
|
||||
.setInterpolator(mLinearOutSlowIn)
|
||||
.setListener(getJankListener(mBiometricScrollView, SHOW, animateDuration))
|
||||
.withLayer()
|
||||
.start();
|
||||
if (mCredentialView != null && mCredentialView.isAttachedToWindow()) {
|
||||
mCredentialView.setY(mTranslationY);
|
||||
mCredentialView.animate()
|
||||
.translationY(0)
|
||||
.setDuration(animateDuration)
|
||||
.setInterpolator(mLinearOutSlowIn)
|
||||
.setListener(getJankListener(mCredentialView, SHOW, animateDuration))
|
||||
.withLayer()
|
||||
.start();
|
||||
}
|
||||
animate()
|
||||
.alpha(1f)
|
||||
.translationY(0)
|
||||
.setDuration(animateDuration)
|
||||
.setInterpolator(mLinearOutSlowIn)
|
||||
.withLayer()
|
||||
.setListener(getJankListener(this, SHOW, animateDuration))
|
||||
.withEndAction(this::onDialogAnimatedIn)
|
||||
.start();
|
||||
});
|
||||
}
|
||||
@@ -788,32 +761,9 @@ public class AuthContainerView extends LinearLayout
|
||||
|
||||
final long animateDuration = mConfig.mSkipAnimation ? 0 : ANIMATION_DURATION_AWAY_MS;
|
||||
postOnAnimation(() -> {
|
||||
mPanelView.animate()
|
||||
.translationY(mTranslationY)
|
||||
.setDuration(animateDuration)
|
||||
.setInterpolator(mLinearOutSlowIn)
|
||||
.setListener(getJankListener(mPanelView, DISMISS, animateDuration))
|
||||
.withLayer()
|
||||
.withEndAction(endActionRunnable)
|
||||
.start();
|
||||
mBiometricScrollView.animate()
|
||||
.translationY(mTranslationY)
|
||||
.setDuration(animateDuration)
|
||||
.setInterpolator(mLinearOutSlowIn)
|
||||
.setListener(getJankListener(mBiometricScrollView, DISMISS, animateDuration))
|
||||
.withLayer()
|
||||
.start();
|
||||
if (mCredentialView != null && mCredentialView.isAttachedToWindow()) {
|
||||
mCredentialView.animate()
|
||||
.translationY(mTranslationY)
|
||||
.setDuration(animateDuration)
|
||||
.setInterpolator(mLinearOutSlowIn)
|
||||
.setListener(getJankListener(mCredentialView, DISMISS, animateDuration))
|
||||
.withLayer()
|
||||
.start();
|
||||
}
|
||||
animate()
|
||||
.alpha(0f)
|
||||
.translationY(mTranslationY)
|
||||
.setDuration(animateDuration)
|
||||
.setInterpolator(mLinearOutSlowIn)
|
||||
.setListener(getJankListener(this, DISMISS, animateDuration))
|
||||
@@ -828,6 +778,7 @@ public class AuthContainerView extends LinearLayout
|
||||
mWindowManager.updateViewLayout(this, lp);
|
||||
})
|
||||
.withLayer()
|
||||
.withEndAction(endActionRunnable)
|
||||
.start();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user