diff options
4 files changed, 37 insertions, 6 deletions
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 0f640c9c2608..805b44cc0673 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 @@ -4455,9 +4455,13 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mSectionsManager.setHeaderForegroundColors(onSurface, onSurfaceVariant); - mFooterView.updateColors(); + if (mFooterView != null) { + mFooterView.updateColors(); + } - mEmptyShadeView.setTextColors(onSurface, onSurfaceVariant); + if (mEmptyShadeView != null) { + mEmptyShadeView.setTextColors(onSurface, onSurfaceVariant); + } } void goToFullShade(long delay) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java index e572dcca5a34..30c0530266ff 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java @@ -23,8 +23,6 @@ import static com.android.systemui.dump.LogBufferHelperKt.logcatLogBuffer; import static com.google.common.truth.Truth.assertThat; -import static kotlinx.coroutines.flow.FlowKt.emptyFlow; - import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyFloat; @@ -39,6 +37,8 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import static kotlinx.coroutines.flow.FlowKt.emptyFlow; + import android.annotation.IdRes; import android.content.ContentResolver; import android.content.res.Configuration; @@ -341,7 +341,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { @Mock private JavaAdapter mJavaAdapter; @Mock private CastController mCastController; @Mock private SharedNotificationContainerInteractor mSharedNotificationContainerInteractor; - @Mock private ActiveNotificationsInteractor mActiveNotificationsInteractor; + @Mock protected ActiveNotificationsInteractor mActiveNotificationsInteractor; @Mock private KeyguardClockPositionAlgorithm mKeyguardClockPositionAlgorithm; @Mock private NaturalScrollingSettingObserver mNaturalScrollingSettingObserver; diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java index 28fe8e4e8d3a..3cbb9bb2df97 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java @@ -456,11 +456,13 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo enableSplitShade(/* enabled= */ true); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); mNotificationPanelViewController.updateResources(); assertThat(getConstraintSetLayout(R.id.keyguard_status_view).endToEnd) .isEqualTo(R.id.qs_edge_guideline); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(false); mNotificationPanelViewController.updateResources(); assertThat(getConstraintSetLayout(R.id.keyguard_status_view).endToEnd) .isEqualTo(ConstraintSet.PARENT_ID); @@ -469,6 +471,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo @Test public void keyguardStatusView_splitShade_dozing_alwaysDozingOn_isCentered() { when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); @@ -480,6 +483,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo @Test public void keyguardStatusView_splitShade_dozing_alwaysDozingOff_isNotCentered() { when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); @@ -491,6 +495,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo @Test public void keyguardStatusView_splitShade_notDozing_alwaysDozingOn_isNotCentered() { when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); @@ -502,6 +507,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo @Test public void keyguardStatusView_splitShade_pulsing_isNotCentered() { when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); when(mNotificationListContainer.hasPulsingNotifications()).thenReturn(true); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); @@ -514,6 +520,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo @Test public void keyguardStatusView_splitShade_notPulsing_isNotCentered() { when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); when(mNotificationListContainer.hasPulsingNotifications()).thenReturn(false); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); @@ -529,6 +536,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo // The conditions below would make the clock NOT be centered on split shade. // On single shade it should always be centered though. when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); when(mNotificationListContainer.hasPulsingNotifications()).thenReturn(false); mStatusBarStateController.setState(KEYGUARD); setDozing(/* dozing= */ false, /* dozingAlwaysOn= */ false); @@ -539,6 +547,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo @Test public void keyguardStatusView_willPlayDelayedDoze_isCentered_thenNot() { when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); @@ -553,6 +562,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo @Test public void keyguardStatusView_willPlayDelayedDoze_notifiesKeyguardMediaController() { when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); @@ -564,6 +574,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo @Test public void keyguardStatusView_willPlayDelayedDoze_isCentered_thenStillCenteredIfNoNotifs() { when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(false); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ true); @@ -700,10 +711,12 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo mStatusBarStateController.setState(KEYGUARD); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(false); triggerPositionClockAndNotifications(); verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate */ true); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(1); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); triggerPositionClockAndNotifications(); verify(mKeyguardStatusViewController).displayClock(SMALL, /* animate */ true); } @@ -715,10 +728,12 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo clearInvocations(mKeyguardStatusViewController); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(false); triggerPositionClockAndNotifications(); verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate */ true); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(1); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); triggerPositionClockAndNotifications(); verify(mKeyguardStatusViewController, times(2)) .displayClock(LARGE, /* animate */ true); @@ -730,6 +745,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo public void testHasNotifications_switchesToLargeClockWhenEnteringSplitShade() { mStatusBarStateController.setState(KEYGUARD); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(1); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); enableSplitShade(/* enabled= */ true); @@ -740,6 +756,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo public void testNoNotifications_switchesToLargeClockWhenEnteringSplitShade() { mStatusBarStateController.setState(KEYGUARD); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(false); enableSplitShade(/* enabled= */ true); @@ -752,6 +769,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo enableSplitShade(/* enabled= */ true); clearInvocations(mKeyguardStatusViewController); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(1); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); enableSplitShade(/* enabled= */ false); @@ -764,6 +782,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo enableSplitShade(/* enabled= */ true); clearInvocations(mKeyguardStatusViewController); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(false); enableSplitShade(/* enabled= */ false); @@ -777,6 +796,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo enableSplitShade(/* enabled= */ true); when(mMediaDataManager.hasActiveMediaOrRecommendation()).thenReturn(true); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); clearInvocations(mKeyguardStatusViewController); mNotificationPanelViewController.setDozing(/* dozing= */ true, /* animate= */ false); @@ -791,6 +811,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo enableSplitShade(/* enabled= */ true); when(mMediaDataManager.hasActiveMediaOrRecommendation()).thenReturn(true); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); clearInvocations(mKeyguardStatusViewController); mNotificationPanelViewController.setDozing(/* dozing= */ true, /* animate= */ false); @@ -847,6 +868,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo clearInvocations(mKeyguardStatusViewController); when(mMediaDataManager.hasActiveMedia()).thenReturn(true); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); mNotificationPanelViewController.setDozing(true, false); @@ -863,6 +885,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo when(mResources.getBoolean(R.bool.force_small_clock_on_lockscreen)).thenReturn(true); when(mMediaDataManager.hasActiveMedia()).thenReturn(false); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(false); clearInvocations(mKeyguardStatusViewController); enableSplitShade(/* enabled= */ true); @@ -881,6 +904,7 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo when(mResources.getBoolean(R.bool.force_small_clock_on_lockscreen)).thenReturn(true); when(mMediaDataManager.hasActiveMedia()).thenReturn(false); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(false); clearInvocations(mKeyguardStatusViewController); enableSplitShade(/* enabled= */ true); @@ -898,11 +922,13 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo // one notification + media player visible when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(1); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(true); triggerPositionClockAndNotifications(); verify(mKeyguardStatusViewController).displayClock(SMALL, /* animate */ true); // only media player visible when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); + when(mActiveNotificationsInteractor.getAreAnyNotificationsPresentValue()).thenReturn(false); triggerPositionClockAndNotifications(); verify(mKeyguardStatusViewController, times(2)).displayClock(SMALL, true); verify(mKeyguardStatusViewController, never()).displayClock(LARGE, /* animate */ true); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/StackCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/StackCoordinatorTest.kt index 255cf6fbed63..9b4a100a1d64 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/StackCoordinatorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/StackCoordinatorTest.kt @@ -31,6 +31,7 @@ import com.android.systemui.statusbar.notification.collection.render.NotifStackC import com.android.systemui.statusbar.notification.collection.render.NotifStats import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor import com.android.systemui.statusbar.notification.domain.interactor.RenderNotificationListInteractor +import com.android.systemui.statusbar.notification.footer.shared.FooterViewRefactor import com.android.systemui.statusbar.notification.shared.NotificationIconContainerRefactor import com.android.systemui.statusbar.notification.stack.BUCKET_ALERTING import com.android.systemui.statusbar.notification.stack.BUCKET_SILENT @@ -80,7 +81,7 @@ class StackCoordinatorTest : SysuiTestCase() { } @Test - @DisableFlags(NotificationIconContainerRefactor.FLAG_NAME) + @DisableFlags(NotificationIconContainerRefactor.FLAG_NAME, FooterViewRefactor.FLAG_NAME) fun testUpdateNotificationIcons() { afterRenderListListener.onAfterRenderList(listOf(entry), stackController) verify(notificationIconAreaController).updateNotificationIcons(eq(listOf(entry))) |