diff options
| author | 2025-02-25 10:46:08 -0800 | |
|---|---|---|
| committer | 2025-02-25 10:46:08 -0800 | |
| commit | 60d96ddba1371b3f95b9eb41c8e5d7cde4f68f16 (patch) | |
| tree | 10047a30de2bc6b42df95b6b9c0c5b09941bd8a4 | |
| parent | bb90f480d835dfcf3bd92107bd8e6b7bba29e473 (diff) | |
| parent | 7858c42c4b29bf5d70a31cfe3a5cc75188ca5dfb (diff) | |
Merge "Remove dependence on entry for app launch animations" into main
7 files changed, 35 insertions, 17 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationTransitionAnimatorControllerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationTransitionAnimatorControllerTest.kt index 510167d10db4..d3cd24062ff8 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationTransitionAnimatorControllerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationTransitionAnimatorControllerTest.kt @@ -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 diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTransitionAnimatorController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTransitionAnimatorController.kt index 243a868bb7b5..874a059d2323 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTransitionAnimatorController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTransitionAnimatorController.kt @@ -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()") diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinderImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinderImpl.java index 9ed1632c8bc6..c2f0806a9cd6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinderImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinderImpl.java @@ -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); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index 6134d1d53338..185e7fab0e30 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -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(); + } + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationListContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationListContainer.java index f85545ef95f8..47fc2fb3d2dd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationListContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationListContainer.java @@ -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. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index 6313258b8b92..e7a77ebbb86b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -2134,7 +2134,7 @@ public class NotificationStackScrollLayout } } - public ViewGroup getViewParentForNotification(NotificationEntry entry) { + public ViewGroup getViewParentForNotification() { return this; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java index 5c9647005581..44594307d2db 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java @@ -1908,8 +1908,8 @@ public class NotificationStackScrollLayoutController implements Dumpable { } @Override - public ViewGroup getViewParentForNotification(NotificationEntry entry) { - return mView.getViewParentForNotification(entry); + public ViewGroup getViewParentForNotification() { + return mView.getViewParentForNotification(); } @Override |