Fixed an issue where media could flicker during bypass

When turning off the phone, media could sometimes
flicker in during bypass, because the qs expansion
would become larger than 0.0f. We now keep the
expansion at 0 during screen off

Bug: 189318793
Test: enable bypass, turn off screen.
Change-Id: Ib2b30fb1c96e4b078978b1958747473aa5fc9cfc
This commit is contained in:
Selim Cinek
2021-05-25 18:42:11 +02:00
parent 48f518618e
commit e4dbcf927d

View File

@@ -572,6 +572,7 @@ public class NotificationPanelViewController extends PanelViewController {
private int mScrimCornerRadius;
private int mScreenCornerRadius;
private int mNotificationScrimPadding;
private boolean mQSAnimatingHiddenFromCollapsed;
private final QuickAccessWalletClient mQuickAccessWalletClient;
private final Executor mUiExecutor;
@@ -1419,7 +1420,7 @@ public class NotificationPanelViewController extends PanelViewController {
}
mStatusBar.getGutsManager().closeAndSaveGuts(true /* leavebehind */, true /* force */,
true /* controls */, -1 /* x */, -1 /* y */, true /* resetMenu */);
if (animate) {
if (animate && !isFullyCollapsed()) {
animateCloseQs(true /* animateAway */);
} else {
closeQs();
@@ -1703,6 +1704,11 @@ public class NotificationPanelViewController extends PanelViewController {
}
private float computeQsExpansionFraction() {
if (mQSAnimatingHiddenFromCollapsed) {
// When hiding QS from collapsed state, the expansion can sometimes temporarily
// be larger than 0 because of the timing, leading to flickers.
return 0.0f;
}
return Math.min(
1f, (mQsExpansionHeight - mQsMinExpansionHeight) / (mQsMaxExpansionHeight
- mQsMinExpansionHeight));
@@ -2505,6 +2511,7 @@ public class NotificationPanelViewController extends PanelViewController {
@Override
public void onAnimationEnd(Animator animation) {
mQSAnimatingHiddenFromCollapsed = false;
mAnimatingQS = false;
notifyExpandingFinished();
mNotificationStackScrollLayoutController.resetCheckSnoozeLeavebehind();
@@ -2521,6 +2528,7 @@ public class NotificationPanelViewController extends PanelViewController {
animator.start();
mQsExpansionAnimator = animator;
mQsAnimatorExpand = expanding;
mQSAnimatingHiddenFromCollapsed = computeQsExpansionFraction() == 0.0f && target == 0;
}
/**