Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa13f097 authored by Johannes Gallmann's avatar Johannes Gallmann Committed by Automerger Merge Worker
Browse files

Merge "Prevent NotificationShelf from jump cutting notifications when...

Merge "Prevent NotificationShelf from jump cutting notifications when appearing" into udc-dev am: 64cc3cbf

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22224686



Change-Id: Id9230c899bb47809dfc5fe9c8cdd9d4522c8a59e
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 8ff87eb8 64cc3cbf
Loading
Loading
Loading
Loading
+22 −6
Original line number Diff line number Diff line
@@ -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();
            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);
            }
        }
@@ -993,6 +1001,14 @@ public class NotificationShelf extends ActivatableNotificationView implements
        mIndexOfFirstViewInShelf = mHostLayoutController.indexOfChild(firstViewInShelf);
    }

    /**
     * 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>
+1 −0
Original line number Diff line number Diff line
@@ -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) {