diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java | 28 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelfController.java | 1 |
2 files changed, 23 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index 3709a139e57d..4873c9dae89a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -98,6 +98,7 @@ public class NotificationShelf extends ActivatableNotificationView implements private float mCornerAnimationDistance; private NotificationShelfController mController; private float mActualWidth = -1; + private boolean mSensitiveRevealAnimEndabled; public NotificationShelf(Context context, AttributeSet attrs) { super(context, attrs); @@ -260,7 +261,14 @@ public class NotificationShelf extends ActivatableNotificationView implements } final float stackEnd = ambientState.getStackY() + ambientState.getStackHeight(); - viewState.setYTranslation(stackEnd - viewState.height); + if (mSensitiveRevealAnimEndabled && viewState.hidden) { + // if the shelf is hidden, position it at the end of the stack (plus the clip + // padding), such that when it appears animated, it will smoothly move in from the + // bottom, without jump cutting any notifications + viewState.setYTranslation(stackEnd + mPaddingBetweenElements); + } else { + viewState.setYTranslation(stackEnd - viewState.height); + } } else { viewState.hidden = true; viewState.location = ExpandableViewState.LOCATION_GONE; @@ -395,7 +403,8 @@ public class NotificationShelf extends ActivatableNotificationView implements expandingAnimated, isLastChild, shelfClipStart); // TODO(b/172289889) scale mPaddingBetweenElements with expansion amount - if ((isLastChild && !child.isInShelf()) || aboveShelf || backgroundForceHidden) { + if ((!mSensitiveRevealAnimEndabled && ((isLastChild && !child.isInShelf()) + || backgroundForceHidden)) || aboveShelf) { notificationClipEnd = shelfStart + getIntrinsicHeight(); } else { notificationClipEnd = shelfStart - mPaddingBetweenElements; @@ -437,15 +446,14 @@ public class NotificationShelf extends ActivatableNotificationView implements } if (child instanceof ActivatableNotificationView) { - ActivatableNotificationView anv = - (ActivatableNotificationView) child; + ActivatableNotificationView anv = (ActivatableNotificationView) child; // Because we show whole notifications on the lockscreen, the bottom notification is // always "just about to enter the shelf" by normal scrolling rules. This is fine // if the shelf is visible, but if the shelf is hidden, it causes incorrect curling. // notificationClipEnd handles the discrepancy between a visible and hidden shelf, // so we use that when on the keyguard (and while animating away) to reduce curling. - final float keyguardSafeShelfStart = - mAmbientState.isOnKeyguard() ? notificationClipEnd : shelfStart; + final float keyguardSafeShelfStart = !mSensitiveRevealAnimEndabled + && mAmbientState.isOnKeyguard() ? notificationClipEnd : shelfStart; updateCornerRoundnessOnScroll(anv, viewStart, keyguardSafeShelfStart); } } @@ -994,6 +1002,14 @@ public class NotificationShelf extends ActivatableNotificationView implements } /** + * Set whether the sensitive reveal animation feature flag is enabled + * @param enabled true if enabled + */ + public void setSensitiveRevealAnimEndabled(boolean enabled) { + mSensitiveRevealAnimEndabled = enabled; + } + + /** * This method resets the OnScroll roundness of a view to 0f * <p> * Note: This should be the only class that handles roundness {@code SourceType.OnScroll} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelfController.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelfController.java index bb84c758d87d..cb4ae286d5c3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelfController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelfController.java @@ -55,6 +55,7 @@ public class NotificationShelfController { mKeyguardBypassController = keyguardBypassController; mStatusBarStateController = statusBarStateController; mView.useRoundnessSourceTypes(featureFlags.isEnabled(Flags.USE_ROUNDNESS_SOURCETYPES)); + mView.setSensitiveRevealAnimEndabled(featureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM)); mOnAttachStateChangeListener = new View.OnAttachStateChangeListener() { @Override public void onViewAttachedToWindow(View v) { |