From 5778eb044386ac5f9c94ddf749089a62d7474528 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Wed, 5 Jun 2019 17:50:48 -0700 Subject: [PATCH] Hide keyguard bottom area when SHADE_LOCKED Fixes: 133308946 Test: manual Change-Id: I1e855f204cf43672cd0bb95c137b48be333c821c --- .../phone/NotificationPanelView.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 92aa884b14d25..f89873c39f7c9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -303,6 +303,8 @@ public class NotificationPanelView extends PanelView implements private int mCurrentPanelAlpha; private final Paint mAlphaPaint = new Paint(); private Runnable mPanelAlphaEndAction; + private float mBottomAreaShadeAlpha; + private final ValueAnimator mBottomAreaShadeAlphaAnimator; private AnimatorListenerAdapter mAnimatorListenerAdapter = new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { @@ -366,6 +368,14 @@ public class NotificationPanelView extends PanelView implements mPulseExpansionHandler = pulseExpansionHandler; mThemeResId = context.getThemeResId(); dynamicPrivacyController.addListener(this); + + mBottomAreaShadeAlphaAnimator = ValueAnimator.ofFloat(1f, 0); + mBottomAreaShadeAlphaAnimator.addUpdateListener(animation -> { + mBottomAreaShadeAlpha = (float) animation.getAnimatedValue(); + updateKeyguardBottomAreaAlpha(); + }); + mBottomAreaShadeAlphaAnimator.setDuration(160); + mBottomAreaShadeAlphaAnimator.setInterpolator(Interpolators.ALPHA_OUT); } /** @@ -1367,10 +1377,20 @@ public class NotificationPanelView extends PanelView implements updateDozingVisibilities(false /* animate */); } + maybeAnimateBottomAreaAlpha(); resetHorizontalPanelPosition(); updateQsState(); } + private void maybeAnimateBottomAreaAlpha() { + mBottomAreaShadeAlphaAnimator.cancel(); + if (mBarState == StatusBarState.SHADE_LOCKED) { + mBottomAreaShadeAlphaAnimator.start(); + } else { + mBottomAreaShadeAlpha = 1f; + } + } + private final Runnable mAnimateKeyguardStatusViewInvisibleEndRunnable = new Runnable() { @Override public void run() { @@ -1979,6 +1999,7 @@ public class NotificationPanelView extends PanelView implements ? 0 : KeyguardBouncer.ALPHA_EXPANSION_THRESHOLD, 1f, 0f, 1f, getExpandedFraction()); float alpha = Math.min(expansionAlpha, 1 - getQsExpansionFraction()); + alpha *= mBottomAreaShadeAlpha; mKeyguardBottomArea.setAffordanceAlpha(alpha); mKeyguardBottomArea.setImportantForAccessibility(alpha == 0f ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS @@ -2889,6 +2910,10 @@ public class NotificationPanelView extends PanelView implements mNotificationStackScroller.setDark(mDozing, animate, wakeUpTouchLocation); mKeyguardBottomArea.setDozing(mDozing, animate); + if (dozing) { + mBottomAreaShadeAlphaAnimator.cancel(); + } + if (mBarState == StatusBarState.KEYGUARD || mBarState == StatusBarState.SHADE_LOCKED) { updateDozingVisibilities(animate);