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

Commit 60d96ddb authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Remove dependence on entry for app launch animations" into main

parents bb90f480 7858c42c
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ class NotificationTransitionAnimatorControllerTest : SysuiTestCase() {
        controller.onIntentStarted(willAnimate = false)

        assertTrue(HeadsUpUtil.isClickedHeadsUpNotification(notification))
        assertFalse(notification.entry.isExpandAnimationRunning)
        assertFalse(notification.isLaunchAnimationRunning)
        val isExpandAnimationRunning by
            testScope.collectLastValue(
                notificationLaunchAnimationInteractor.isLaunchAnimationRunning
@@ -107,7 +107,7 @@ class NotificationTransitionAnimatorControllerTest : SysuiTestCase() {
        controller.onTransitionAnimationCancelled()

        assertTrue(HeadsUpUtil.isClickedHeadsUpNotification(notification))
        assertFalse(notification.entry.isExpandAnimationRunning)
        assertFalse(notification.isLaunchAnimationRunning)
        val isExpandAnimationRunning by
            testScope.collectLastValue(
                notificationLaunchAnimationInteractor.isLaunchAnimationRunning
@@ -130,7 +130,7 @@ class NotificationTransitionAnimatorControllerTest : SysuiTestCase() {
        controller.onTransitionAnimationEnd(isExpandingFullyAbove = true)

        assertFalse(HeadsUpUtil.isClickedHeadsUpNotification(notification))
        assertFalse(notification.entry.isExpandAnimationRunning)
        assertFalse(notification.isLaunchAnimationRunning)
        val isExpandAnimationRunning by
            testScope.collectLastValue(
                notificationLaunchAnimationInteractor.isLaunchAnimationRunning
@@ -199,7 +199,7 @@ class NotificationTransitionAnimatorControllerTest : SysuiTestCase() {
    fun testNotificationIsExpandingDuringAnimation() {
        controller.onIntentStarted(willAnimate = true)

        assertTrue(notification.entry.isExpandAnimationRunning)
        assertTrue(notification.isLaunchAnimationRunning)
        val isExpandAnimationRunning by
            testScope.collectLastValue(
                notificationLaunchAnimationInteractor.isLaunchAnimationRunning
+7 −5
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import com.android.systemui.statusbar.notification.domain.interactor.Notificatio
import com.android.systemui.statusbar.notification.headsup.HeadsUpManager
import com.android.systemui.statusbar.notification.headsup.HeadsUpUtil
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.shared.NotificationBundleUi
import com.android.systemui.statusbar.notification.stack.NotificationListContainer
import kotlin.math.ceil
import kotlin.math.max
@@ -117,7 +118,7 @@ class NotificationTransitionAnimatorController(
        params.startNotificationTop = location[1]
        params.notificationParentTop =
            notificationListContainer
                .getViewParentForNotification(notificationEntry)
                .getViewParentForNotification()
                .locationOnScreen[1]
        params.startRoundedTopClipping = roundedTopClipping
        params.startClipTopAmount = notification.clipTopAmount
@@ -148,7 +149,7 @@ class NotificationTransitionAnimatorController(
            Log.d(TAG, reason)
        }
        notificationLaunchAnimationInteractor.setIsLaunchAnimationRunning(willAnimate)
        notificationEntry.isExpandAnimationRunning = willAnimate
        notification.isLaunchAnimationRunning = willAnimate

        if (!willAnimate) {
            removeHun(animate = true, reason)
@@ -158,7 +159,8 @@ class NotificationTransitionAnimatorController(

    private val headsUpNotificationRow: ExpandableNotificationRow?
        get() {
            val pipelineParent = notificationEntry.parent
            val pipelineParent = if (NotificationBundleUi.isEnabled)
                notification.entryAdapter?.parent else notificationEntry.parent
            val summaryEntry = (pipelineParent as? GroupEntry)?.summary
            return when {
                headsUpManager.isHeadsUpEntry(notificationKey) -> notification
@@ -190,7 +192,7 @@ class NotificationTransitionAnimatorController(
        // TODO(b/184121838): Should we call InteractionJankMonitor.cancel if the animation started
        // here?
        notificationLaunchAnimationInteractor.setIsLaunchAnimationRunning(false)
        notificationEntry.isExpandAnimationRunning = false
        notification.isLaunchAnimationRunning = false
        removeHun(animate = true, "onLaunchAnimationCancelled()")
        onFinishAnimationCallback?.run()
    }
@@ -210,7 +212,7 @@ class NotificationTransitionAnimatorController(

        notification.isExpandAnimationRunning = false
        notificationLaunchAnimationInteractor.setIsLaunchAnimationRunning(false)
        notificationEntry.isExpandAnimationRunning = false
        notification.isLaunchAnimationRunning = false
        notificationListContainer.setExpandingNotification(null)
        applyParams(null)
        removeHun(animate = false, "onLaunchAnimationEnd()")
+1 −3
Original line number Diff line number Diff line
@@ -136,9 +136,7 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
            @NonNull NotifInflater.Params params,
            NotificationRowContentBinder.InflationCallback callback)
            throws InflationException {
        //TODO(b/217799515): Remove the entry parameter from getViewParentForNotification(), this
        // function returns the NotificationStackScrollLayout regardless of the entry.
        ViewGroup parent = mListContainer.getViewParentForNotification(entry);
        ViewGroup parent = mListContainer.getViewParentForNotification();

        if (entry.rowExists()) {
            mLogger.logUpdatingRow(entry, params);
+19 −0
Original line number Diff line number Diff line
@@ -300,6 +300,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    private boolean mIsSystemChildExpanded;
    private PinnedStatus mPinnedStatus = PinnedStatus.NotPinned;
    private boolean mExpandAnimationRunning;
    private boolean mLaunchAnimationRunning;
    private AboveShelfChangedListener mAboveShelfChangedListener;
    private HeadsUpManager mHeadsUpManager;
    private Consumer<Boolean> mHeadsUpAnimatingAwayListener;
@@ -4487,4 +4488,22 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        }
        mLogger.logRemoveTransientRow(row.getLoggingKey(), mLoggingKey);
    }

    /** Set whether this notification is currently used to animate a launch. */
    public void setLaunchAnimationRunning(boolean launchAnimationRunning) {
        if (NotificationBundleUi.isEnabled()) {
            mLaunchAnimationRunning = launchAnimationRunning;
        } else {
            getEntry().setExpandAnimationRunning(launchAnimationRunning);
        }
    }

    /** Whether this notification is currently used to animate a launch. */
    public boolean isLaunchAnimationRunning() {
        if (NotificationBundleUi.isEnabled()) {
            return mLaunchAnimationRunning;
        } else {
            return getEntry().isExpandAnimationRunning();
        }
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -113,10 +113,9 @@ public interface NotificationListContainer extends
    /**
     * Get the view parent for a notification entry. For example, NotificationStackScrollLayout.
     *
     * @param entry entry to get the view parent for
     * @return the view parent for entry
     */
    ViewGroup getViewParentForNotification(NotificationEntry entry);
    ViewGroup getViewParentForNotification();

    /**
     * Resets the currently exposed menu view.
Loading