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

Commit 5040f2e6 authored by Selim Cinek's avatar Selim Cinek
Browse files

Changed the contentheight while pulsing

While pulsing, the contentHeight was limited to the pulsing view,
which is not working well when we want to dynamically expand
notifications from the pulsing state. This also fixes that
multiple pulsing views could be visible at the same time.

Test: atest SystemUITests
Bug: 125942236
Change-Id: Ia1dd51e3ef18cebc16da3c3245ebf10dd1dd9759
parent 3d6ae232
Loading
Loading
Loading
Loading
+20 −7
Original line number Diff line number Diff line
@@ -290,6 +290,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
                && !mAmbientState.isPanelTracking();
        int baseZHeight = mAmbientState.getBaseZHeight();
        int backgroundTop = 0;
        int clipTopAmount = 0;
        float firstElementRoundness = 0.0f;
        ExpandableNotificationRow previousRow = null;

@@ -319,7 +320,8 @@ public class NotificationShelf extends ActivatableNotificationView implements
                            rowTranslationY + getNotificationMergeSize());
                }
            }
            updateNotificationClipHeight(row, notificationClipEnd);
            int clipTop = updateNotificationClipHeight(row, notificationClipEnd, notGoneIndex);
            clipTopAmount = Math.max(clipTop, clipTopAmount);
            float inShelfAmount = updateIconAppearance(row, expandAmount, scrolling, scrollingFast,
                    expandingAnimated, isLastChild);
            numViewsInShelf += inShelfAmount;
@@ -379,9 +381,9 @@ public class NotificationShelf extends ActivatableNotificationView implements
            previousColor = ownColorUntinted;
            previousRow = row;
        }

        clipTransientViews();

        setClipTopAmount(clipTopAmount);
        setBackgroundTop(backgroundTop);
        setFirstElementRoundness(firstElementRoundness);
        mShelfIcons.setSpeedBumpIndex(mAmbientState.getSpeedBumpIndex());
@@ -415,7 +417,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
            View transientView = mHostLayout.getTransientView(i);
            if (transientView instanceof ExpandableNotificationRow) {
                ExpandableNotificationRow transientRow = (ExpandableNotificationRow) transientView;
                updateNotificationClipHeight(transientRow, getTranslationY());
                updateNotificationClipHeight(transientRow, getTranslationY(), -1);
            } else {
                Log.e(TAG, "NotificationShelf.clipTransientViews(): "
                        + "Trying to clip non-row transient view");
@@ -432,9 +434,13 @@ public class NotificationShelf extends ActivatableNotificationView implements

    private void updateIconClipAmount(ExpandableNotificationRow row) {
        float maxTop = row.getTranslationY();
        if (getClipTopAmount() != 0) {
            // if the shelf is clipped, lets make sure we also clip the icon
            maxTop = Math.max(maxTop, getTranslationY() + getClipTopAmount());
        }
        StatusBarIconView icon = row.getEntry().expandedIcon;
        float shelfIconPosition = getTranslationY() + icon.getTop() + icon.getTranslationY();
        if (shelfIconPosition < maxTop && !mAmbientState.isDark()) {
        if (shelfIconPosition < maxTop && !mAmbientState.isFullyDark()) {
            int top = (int) (maxTop - shelfIconPosition);
            Rect clipRect = new Rect(0, top, icon.getWidth(), Math.max(top, icon.getHeight()));
            icon.setClipBounds(clipRect);
@@ -485,8 +491,8 @@ public class NotificationShelf extends ActivatableNotificationView implements
        }
    }

    private void updateNotificationClipHeight(ExpandableNotificationRow row,
            float notificationClipEnd) {
    private int updateNotificationClipHeight(ExpandableNotificationRow row,
            float notificationClipEnd, int childIndex) {
        float viewEnd = row.getTranslationY() + row.getActualHeight();
        boolean isPinned = (row.isPinned() || row.isHeadsUpAnimatingAway())
                && !mAmbientState.isDozingAndNotPulsing(row);
@@ -497,10 +503,17 @@ public class NotificationShelf extends ActivatableNotificationView implements
                clipBottomAmount = Math.min(row.getIntrinsicHeight() - row.getCollapsedHeight(),
                        clipBottomAmount);
            }
            if (!row.isAmbientPulsing()
                    && (!mAmbientState.isPulseExpanding() || childIndex != 0)) {
                row.setClipBottomAmount(clipBottomAmount);
            } else {
                row.setClipBottomAmount(0);
                return clipBottomAmount;
            }
        } else {
            row.setClipBottomAmount(0);
        }
        return 0;
    }

    @Override
+2 −12
Original line number Diff line number Diff line
@@ -168,14 +168,13 @@ constructor(context: Context,
        } else {
            if (!mAmbientPulseManager.hasNotifications()) {
                // No pulsing notifications, we need to make notifications visible
                val target = if (mReachedWakeUpHeight) (mWakeUpHeight / 2.0f) else 0.0f

                val target = if (mReachedWakeUpHeight) mWakeUpHeight else 0.0f
                mWakeUpCoordinator.setNotificationsVisible(height > target, true /* animate */,
                        true /* increaseSpeed */)
            }
            expansionHeight = max(mWakeUpHeight, expansionHeight)
        }
        val emptyDragAmount = mWakeUpCoordinator.setPulseWakeUpHeight(expansionHeight)
        val emptyDragAmount = mWakeUpCoordinator.setPulseHeight(expansionHeight)
        setEmptyDragAmount(emptyDragAmount * RUBBERBAND_FACTOR_STATIC)
    }

@@ -261,15 +260,6 @@ constructor(context: Context,

    fun setPulsing(pulsing: Boolean) {
        mPulsing = pulsing
        val hasAmbientNotifications = mAmbientPulseManager.hasNotifications();
        if (pulsing && hasAmbientNotifications) {
            mWakeUpCoordinator.setNotificationsVisible(true /* visible */, true /* animate */,
                    false /* increaseSpeed */)
        } else if (!pulsing && !hasAmbientNotifications) {
            // TODO: figure out the optimal UX for this, should we extend the pulse instead?
            mWakeUpCoordinator.setNotificationsVisible(false /* visible */, true /* animate */,
                    false /* increaseSpeed */)
        }
    }

    fun onStartedWakingUp() {
+16 −3
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.animation.ObjectAnimator
import android.util.FloatProperty
import android.view.animation.Interpolator
import com.android.systemui.Interpolators
import com.android.systemui.statusbar.AmbientPulseManager
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
import com.android.systemui.statusbar.notification.stack.StackStateAnimator

@@ -27,7 +28,8 @@ import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class NotificationWakeUpCoordinator @Inject constructor() {
class NotificationWakeUpCoordinator @Inject constructor(
        private val mAmbientPulseManager: AmbientPulseManager) {

    private val mNotificationVisibility
            = object : FloatProperty<NotificationWakeUpCoordinator>("notificationVisibility") {
@@ -130,7 +132,18 @@ class NotificationWakeUpCoordinator @Inject constructor() {
        }
    }

    fun setPulseWakeUpHeight(height: Float): Float {
        return mStackScroller.setPulseWakeUpHeight(height)
    fun setPulseHeight(height: Float): Float {
        return mStackScroller.setPulseHeight(height)
    }

    fun setPulsing(pulsing: Boolean) {
        val hasAmbientNotifications = mAmbientPulseManager.hasNotifications();
        if (pulsing && hasAmbientNotifications) {
            setNotificationsVisible(true /* visible */, true /* animate */,
                    false /* increaseSpeed */)
        } else if (!pulsing && !hasAmbientNotifications) {
            setNotificationsVisible(false /* visible */, true /* animate */,
                    false /* increaseSpeed */)
        }
    }
}
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
@@ -721,6 +721,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        }
    }

    @Override
    public boolean isAmbientPulsing() {
        return mIsAmbientPulsing;
    }
@@ -3004,9 +3005,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView

    @Override
    public boolean isAboveShelf() {
        return !isOnKeyguard()
        return isAmbientPulsing() || (!isOnKeyguard()
                && (mIsPinned || mHeadsupDisappearRunning || (mIsHeadsUp && mAboveShelf)
                || mExpandAnimationRunning || mChildIsExpanding);
                || mExpandAnimationRunning || mChildIsExpanding));
    }

    public void setOnAmbient(boolean onAmbient) {
+4 −0
Original line number Diff line number Diff line
@@ -527,6 +527,10 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable {
    public void setHeadsUpIsVisible() {
    }

    public boolean isAmbientPulsing() {
        return false;
    }

    public boolean isChildInGroup() {
        return false;
    }
Loading