Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +4 −8 Original line number Original line Diff line number Diff line Loading @@ -156,7 +156,6 @@ import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.HeadsUpUtil; import com.android.systemui.statusbar.policy.HeadsUpUtil; import com.android.systemui.statusbar.policy.ScrollAdapter; import com.android.systemui.statusbar.policy.ScrollAdapter; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService; import com.android.systemui.util.Assert; import com.android.systemui.util.Assert; Loading Loading @@ -366,7 +365,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private boolean mForceNoOverlappingRendering; private boolean mForceNoOverlappingRendering; private final ArrayList<Pair<ExpandableNotificationRow, Boolean>> mTmpList = new ArrayList<>(); private final ArrayList<Pair<ExpandableNotificationRow, Boolean>> mTmpList = new ArrayList<>(); private FalsingManager mFalsingManager; private FalsingManager mFalsingManager; private final ZenModeController mZenController; private boolean mAnimationRunning; private boolean mAnimationRunning; private ViewTreeObserver.OnPreDrawListener mRunningAnimationUpdater private ViewTreeObserver.OnPreDrawListener mRunningAnimationUpdater = new ViewTreeObserver.OnPreDrawListener() { = new ViewTreeObserver.OnPreDrawListener() { Loading Loading @@ -587,14 +585,13 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable AttributeSet attrs, AttributeSet attrs, NotificationRoundnessManager notificationRoundnessManager, NotificationRoundnessManager notificationRoundnessManager, DynamicPrivacyController dynamicPrivacyController, DynamicPrivacyController dynamicPrivacyController, SysuiStatusBarStateController statusBarStateController, SysuiStatusBarStateController statusbarStateController, HeadsUpManagerPhone headsUpManager, HeadsUpManagerPhone headsUpManager, KeyguardBypassController keyguardBypassController, KeyguardBypassController keyguardBypassController, KeyguardMediaController keyguardMediaController, KeyguardMediaController keyguardMediaController, FalsingManager falsingManager, FalsingManager falsingManager, NotificationLockscreenUserManager notificationLockscreenUserManager, NotificationLockscreenUserManager notificationLockscreenUserManager, NotificationGutsManager notificationGutsManager, NotificationGutsManager notificationGutsManager, ZenModeController zenController, NotificationSectionsManager notificationSectionsManager, NotificationSectionsManager notificationSectionsManager, ForegroundServiceSectionController fgsSectionController, ForegroundServiceSectionController fgsSectionController, ForegroundServiceDismissalFeatureController fgsFeatureController, ForegroundServiceDismissalFeatureController fgsFeatureController, Loading @@ -615,7 +612,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mHeadsUpManager.setAnimationStateHandler(this::setHeadsUpGoingAwayAnimationsAllowed); mHeadsUpManager.setAnimationStateHandler(this::setHeadsUpGoingAwayAnimationsAllowed); mKeyguardBypassController = keyguardBypassController; mKeyguardBypassController = keyguardBypassController; mFalsingManager = falsingManager; mFalsingManager = falsingManager; mZenController = zenController; mFgsSectionController = fgsSectionController; mFgsSectionController = fgsSectionController; mSectionsManager = notificationSectionsManager; mSectionsManager = notificationSectionsManager; Loading Loading @@ -693,7 +689,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } } mDynamicPrivacyController = dynamicPrivacyController; mDynamicPrivacyController = dynamicPrivacyController; mStatusbarStateController = statusBarStateController; mStatusbarStateController = statusbarStateController; initializeForegroundServiceSection(fgsFeatureController); initializeForegroundServiceSection(fgsFeatureController); mUiEventLogger = uiEventLogger; mUiEventLogger = uiEventLogger; mColorExtractor.addOnColorsChangedListener(mOnColorsChangedListener); mColorExtractor.addOnColorsChangedListener(mOnColorsChangedListener); Loading Loading @@ -4996,11 +4992,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) void updateEmptyShadeView(boolean visible) { void updateEmptyShadeView(boolean visible, boolean notifVisibleInShade) { mEmptyShadeView.setVisible(visible, mIsExpanded && mAnimationsEnabled); mEmptyShadeView.setVisible(visible, mIsExpanded && mAnimationsEnabled); int oldTextRes = mEmptyShadeView.getTextResource(); int oldTextRes = mEmptyShadeView.getTextResource(); int newTextRes = mZenController.areNotificationsHiddenInShade() int newTextRes = notifVisibleInShade ? R.string.dnd_suppressing_shade_text : R.string.empty_shade_text; ? R.string.dnd_suppressing_shade_text : R.string.empty_shade_text; if (oldTextRes != newTextRes) { if (oldTextRes != newTextRes) { mEmptyShadeView.setText(newTextRes); mEmptyShadeView.setText(newTextRes); Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +6 −2 Original line number Original line Diff line number Diff line Loading @@ -49,6 +49,7 @@ import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.dagger.StatusBarComponent; import com.android.systemui.statusbar.phone.dagger.StatusBarComponent; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService; import java.util.function.BiConsumer; import java.util.function.BiConsumer; Loading @@ -68,6 +69,7 @@ public class NotificationStackScrollLayoutController { private final TunerService mTunerService; private final TunerService mTunerService; private final DynamicPrivacyController mDynamicPrivacyController; private final DynamicPrivacyController mDynamicPrivacyController; private final ConfigurationController mConfigurationController; private final ConfigurationController mConfigurationController; private final ZenModeController mZenModeController; private final NotificationListContainerImpl mNotificationListContainer = private final NotificationListContainerImpl mNotificationListContainer = new NotificationListContainerImpl(); new NotificationListContainerImpl(); private NotificationStackScrollLayout mView; private NotificationStackScrollLayout mView; Loading Loading @@ -130,7 +132,8 @@ public class NotificationStackScrollLayoutController { NotificationRoundnessManager notificationRoundnessManager, NotificationRoundnessManager notificationRoundnessManager, TunerService tunerService, TunerService tunerService, DynamicPrivacyController dynamicPrivacyController, DynamicPrivacyController dynamicPrivacyController, ConfigurationController configurationController) { ConfigurationController configurationController, ZenModeController zenModeController) { mAllowLongPress = allowLongPress; mAllowLongPress = allowLongPress; mNotificationGutsManager = notificationGutsManager; mNotificationGutsManager = notificationGutsManager; mHeadsUpManager = headsUpManager; mHeadsUpManager = headsUpManager; Loading @@ -138,6 +141,7 @@ public class NotificationStackScrollLayoutController { mTunerService = tunerService; mTunerService = tunerService; mDynamicPrivacyController = dynamicPrivacyController; mDynamicPrivacyController = dynamicPrivacyController; mConfigurationController = configurationController; mConfigurationController = configurationController; mZenModeController = zenModeController; } } public void attach(NotificationStackScrollLayout view) { public void attach(NotificationStackScrollLayout view) { Loading Loading @@ -484,7 +488,7 @@ public class NotificationStackScrollLayoutController { } } public void updateEmptyShadeView(boolean visible) { public void updateEmptyShadeView(boolean visible) { mView.updateEmptyShadeView(visible); mView.updateEmptyShadeView(visible, mZenModeController.areNotificationsHiddenInShade()); } } public void setHeadsUpAnimatingAway(boolean headsUpAnimatingAway) { public void setHeadsUpAnimatingAway(boolean headsUpAnimatingAway) { Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +11 −13 Original line number Original line Diff line number Diff line Loading @@ -94,6 +94,7 @@ import com.android.systemui.statusbar.phone.NotificationIconAreaController; import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.util.leak.LeakDetector; import com.android.systemui.util.leak.LeakDetector; Loading Loading @@ -136,12 +137,12 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Mock private MetricsLogger mMetricsLogger; @Mock private MetricsLogger mMetricsLogger; @Mock private NotificationRoundnessManager mNotificationRoundnessManager; @Mock private NotificationRoundnessManager mNotificationRoundnessManager; @Mock private KeyguardBypassController mKeyguardBypassController; @Mock private KeyguardBypassController mKeyguardBypassController; @Mock private KeyguardMediaController mKeyguardMediaController; @Mock private ZenModeController mZenModeController; @Mock private NotificationSectionsManager mNotificationSectionsManager; @Mock private NotificationSectionsManager mNotificationSectionsManager; @Mock private NotificationSection mNotificationSection; @Mock private NotificationSection mNotificationSection; @Mock private NotificationLockscreenUserManager mLockscreenUserManager; @Mock private NotificationLockscreenUserManager mLockscreenUserManager; @Mock private FeatureFlags mFeatureFlags; @Mock private FeatureFlags mFeatureFlags; @Mock private KeyguardMediaController mKeyguardMediaController; @Mock private SysuiStatusBarStateController mStatusBarStateController; private UserChangedListener mUserChangedListener; private UserChangedListener mUserChangedListener; private NotificationEntryManager mEntryManager; private NotificationEntryManager mEntryManager; private int mOriginalInterruptionModelSetting; private int mOriginalInterruptionModelSetting; Loading Loading @@ -211,17 +212,18 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { // which refer to members of NotificationStackScrollLayout. The spy // which refer to members of NotificationStackScrollLayout. The spy // holds a copy of the CUT's instances of these KeyguardBypassController, so they still // holds a copy of the CUT's instances of these KeyguardBypassController, so they still // refer to the CUT's member variables, not the spy's member variables. // refer to the CUT's member variables, not the spy's member variables. mStackScrollerInternal = new NotificationStackScrollLayout(getContext(), null, mStackScrollerInternal = new NotificationStackScrollLayout( getContext(), null, mNotificationRoundnessManager, mNotificationRoundnessManager, mock(DynamicPrivacyController.class), mock(DynamicPrivacyController.class), mock(SysuiStatusBarStateController.class), mStatusBarStateController, mHeadsUpManager, mHeadsUpManager, mKeyguardBypassController, mKeyguardBypassController, mKeyguardMediaController, mKeyguardMediaController, new FalsingManagerFake(), new FalsingManagerFake(), mLockscreenUserManager, mLockscreenUserManager, mock(NotificationGutsManager.class), mock(NotificationGutsManager.class), mZenModeController, mNotificationSectionsManager, mNotificationSectionsManager, mock(ForegroundServiceSectionController.class), mock(ForegroundServiceSectionController.class), mock(ForegroundServiceDismissalFeatureController.class), mock(ForegroundServiceDismissalFeatureController.class), Loading Loading @@ -269,9 +271,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Test @Test public void updateEmptyView_dndSuppressing() { public void updateEmptyView_dndSuppressing() { when(mEmptyShadeView.willBeGone()).thenReturn(true); when(mEmptyShadeView.willBeGone()).thenReturn(true); when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(true); mStackScroller.updateEmptyShadeView(true); mStackScroller.updateEmptyShadeView(true, true); verify(mEmptyShadeView).setText(R.string.dnd_suppressing_shade_text); verify(mEmptyShadeView).setText(R.string.dnd_suppressing_shade_text); } } Loading @@ -280,9 +281,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { public void updateEmptyView_dndNotSuppressing() { public void updateEmptyView_dndNotSuppressing() { mStackScroller.setEmptyShadeView(mEmptyShadeView); mStackScroller.setEmptyShadeView(mEmptyShadeView); when(mEmptyShadeView.willBeGone()).thenReturn(true); when(mEmptyShadeView.willBeGone()).thenReturn(true); when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false); mStackScroller.updateEmptyShadeView(true); mStackScroller.updateEmptyShadeView(true, false); verify(mEmptyShadeView).setText(R.string.empty_shade_text); verify(mEmptyShadeView).setText(R.string.empty_shade_text); } } Loading @@ -291,12 +291,10 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { public void updateEmptyView_noNotificationsToDndSuppressing() { public void updateEmptyView_noNotificationsToDndSuppressing() { mStackScroller.setEmptyShadeView(mEmptyShadeView); mStackScroller.setEmptyShadeView(mEmptyShadeView); when(mEmptyShadeView.willBeGone()).thenReturn(true); when(mEmptyShadeView.willBeGone()).thenReturn(true); when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false); mStackScroller.updateEmptyShadeView(true, false); mStackScroller.updateEmptyShadeView(true); verify(mEmptyShadeView).setText(R.string.empty_shade_text); verify(mEmptyShadeView).setText(R.string.empty_shade_text); when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(true); mStackScroller.updateEmptyShadeView(true, true); mStackScroller.updateEmptyShadeView(true); verify(mEmptyShadeView).setText(R.string.dnd_suppressing_shade_text); verify(mEmptyShadeView).setText(R.string.dnd_suppressing_shade_text); } } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollerControllerTest.java +39 −4 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.notification.stack; package com.android.systemui.statusbar.notification.stack; import static com.android.systemui.statusbar.notification.ViewGroupFadeHelper.reset; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.never; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify; Loading @@ -26,11 +28,11 @@ import android.testing.AndroidTestingRunner; import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService; import org.junit.Before; import org.junit.Before; Loading @@ -55,13 +57,13 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase { @Mock @Mock private TunerService mTunerService; private TunerService mTunerService; @Mock @Mock private AmbientState mAmbientState; @Mock private DynamicPrivacyController mDynamicPrivacyController; private DynamicPrivacyController mDynamicPrivacyController; @Mock @Mock private ConfigurationController mConfigurationController; private ConfigurationController mConfigurationController; @Mock @Mock private NotificationStackScrollLayout mNotificationStackScrollLayout; private NotificationStackScrollLayout mNotificationStackScrollLayout; @Mock private ZenModeController mZenModeController; NotificationStackScrollLayoutController mController; NotificationStackScrollLayoutController mController; Loading @@ -76,7 +78,8 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase { mNotificationRoundnessManager, mNotificationRoundnessManager, mTunerService, mTunerService, mDynamicPrivacyController, mDynamicPrivacyController, mConfigurationController mConfigurationController, mZenModeController ); ); when(mNotificationStackScrollLayout.isAttachedToWindow()).thenReturn(true); when(mNotificationStackScrollLayout.isAttachedToWindow()).thenReturn(true); Loading Loading @@ -112,4 +115,36 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase { mController.mConfigurationListener.onDensityOrFontScaleChanged(); mController.mConfigurationListener.onDensityOrFontScaleChanged(); verify(mNotificationStackScrollLayout).reinflateViews(); verify(mNotificationStackScrollLayout).reinflateViews(); } } @Test public void testUpdateEmptyShadeView_notificationsVisible() { when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(true); mController.attach(mNotificationStackScrollLayout); mController.updateEmptyShadeView(true /* visible */); verify(mNotificationStackScrollLayout).updateEmptyShadeView( true /* visible */, true /* notifVisibleInShade */); reset(mNotificationStackScrollLayout); mController.updateEmptyShadeView(false /* visible */); verify(mNotificationStackScrollLayout).updateEmptyShadeView( false /* visible */, true /* notifVisibleInShade */); } @Test public void testUpdateEmptyShadeView_notificationsHidden() { when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false); mController.attach(mNotificationStackScrollLayout); mController.updateEmptyShadeView(true /* visible */); verify(mNotificationStackScrollLayout).updateEmptyShadeView( true /* visible */, false /* notifVisibleInShade */); reset(mNotificationStackScrollLayout); mController.updateEmptyShadeView(false /* visible */); verify(mNotificationStackScrollLayout).updateEmptyShadeView( false /* visible */, false /* notifVisibleInShade */); } } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +4 −8 Original line number Original line Diff line number Diff line Loading @@ -156,7 +156,6 @@ import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.HeadsUpUtil; import com.android.systemui.statusbar.policy.HeadsUpUtil; import com.android.systemui.statusbar.policy.ScrollAdapter; import com.android.systemui.statusbar.policy.ScrollAdapter; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService; import com.android.systemui.util.Assert; import com.android.systemui.util.Assert; Loading Loading @@ -366,7 +365,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private boolean mForceNoOverlappingRendering; private boolean mForceNoOverlappingRendering; private final ArrayList<Pair<ExpandableNotificationRow, Boolean>> mTmpList = new ArrayList<>(); private final ArrayList<Pair<ExpandableNotificationRow, Boolean>> mTmpList = new ArrayList<>(); private FalsingManager mFalsingManager; private FalsingManager mFalsingManager; private final ZenModeController mZenController; private boolean mAnimationRunning; private boolean mAnimationRunning; private ViewTreeObserver.OnPreDrawListener mRunningAnimationUpdater private ViewTreeObserver.OnPreDrawListener mRunningAnimationUpdater = new ViewTreeObserver.OnPreDrawListener() { = new ViewTreeObserver.OnPreDrawListener() { Loading Loading @@ -587,14 +585,13 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable AttributeSet attrs, AttributeSet attrs, NotificationRoundnessManager notificationRoundnessManager, NotificationRoundnessManager notificationRoundnessManager, DynamicPrivacyController dynamicPrivacyController, DynamicPrivacyController dynamicPrivacyController, SysuiStatusBarStateController statusBarStateController, SysuiStatusBarStateController statusbarStateController, HeadsUpManagerPhone headsUpManager, HeadsUpManagerPhone headsUpManager, KeyguardBypassController keyguardBypassController, KeyguardBypassController keyguardBypassController, KeyguardMediaController keyguardMediaController, KeyguardMediaController keyguardMediaController, FalsingManager falsingManager, FalsingManager falsingManager, NotificationLockscreenUserManager notificationLockscreenUserManager, NotificationLockscreenUserManager notificationLockscreenUserManager, NotificationGutsManager notificationGutsManager, NotificationGutsManager notificationGutsManager, ZenModeController zenController, NotificationSectionsManager notificationSectionsManager, NotificationSectionsManager notificationSectionsManager, ForegroundServiceSectionController fgsSectionController, ForegroundServiceSectionController fgsSectionController, ForegroundServiceDismissalFeatureController fgsFeatureController, ForegroundServiceDismissalFeatureController fgsFeatureController, Loading @@ -615,7 +612,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable mHeadsUpManager.setAnimationStateHandler(this::setHeadsUpGoingAwayAnimationsAllowed); mHeadsUpManager.setAnimationStateHandler(this::setHeadsUpGoingAwayAnimationsAllowed); mKeyguardBypassController = keyguardBypassController; mKeyguardBypassController = keyguardBypassController; mFalsingManager = falsingManager; mFalsingManager = falsingManager; mZenController = zenController; mFgsSectionController = fgsSectionController; mFgsSectionController = fgsSectionController; mSectionsManager = notificationSectionsManager; mSectionsManager = notificationSectionsManager; Loading Loading @@ -693,7 +689,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } } mDynamicPrivacyController = dynamicPrivacyController; mDynamicPrivacyController = dynamicPrivacyController; mStatusbarStateController = statusBarStateController; mStatusbarStateController = statusbarStateController; initializeForegroundServiceSection(fgsFeatureController); initializeForegroundServiceSection(fgsFeatureController); mUiEventLogger = uiEventLogger; mUiEventLogger = uiEventLogger; mColorExtractor.addOnColorsChangedListener(mOnColorsChangedListener); mColorExtractor.addOnColorsChangedListener(mOnColorsChangedListener); Loading Loading @@ -4996,11 +4992,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) void updateEmptyShadeView(boolean visible) { void updateEmptyShadeView(boolean visible, boolean notifVisibleInShade) { mEmptyShadeView.setVisible(visible, mIsExpanded && mAnimationsEnabled); mEmptyShadeView.setVisible(visible, mIsExpanded && mAnimationsEnabled); int oldTextRes = mEmptyShadeView.getTextResource(); int oldTextRes = mEmptyShadeView.getTextResource(); int newTextRes = mZenController.areNotificationsHiddenInShade() int newTextRes = notifVisibleInShade ? R.string.dnd_suppressing_shade_text : R.string.empty_shade_text; ? R.string.dnd_suppressing_shade_text : R.string.empty_shade_text; if (oldTextRes != newTextRes) { if (oldTextRes != newTextRes) { mEmptyShadeView.setText(newTextRes); mEmptyShadeView.setText(newTextRes); Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +6 −2 Original line number Original line Diff line number Diff line Loading @@ -49,6 +49,7 @@ import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.dagger.StatusBarComponent; import com.android.systemui.statusbar.phone.dagger.StatusBarComponent; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService; import java.util.function.BiConsumer; import java.util.function.BiConsumer; Loading @@ -68,6 +69,7 @@ public class NotificationStackScrollLayoutController { private final TunerService mTunerService; private final TunerService mTunerService; private final DynamicPrivacyController mDynamicPrivacyController; private final DynamicPrivacyController mDynamicPrivacyController; private final ConfigurationController mConfigurationController; private final ConfigurationController mConfigurationController; private final ZenModeController mZenModeController; private final NotificationListContainerImpl mNotificationListContainer = private final NotificationListContainerImpl mNotificationListContainer = new NotificationListContainerImpl(); new NotificationListContainerImpl(); private NotificationStackScrollLayout mView; private NotificationStackScrollLayout mView; Loading Loading @@ -130,7 +132,8 @@ public class NotificationStackScrollLayoutController { NotificationRoundnessManager notificationRoundnessManager, NotificationRoundnessManager notificationRoundnessManager, TunerService tunerService, TunerService tunerService, DynamicPrivacyController dynamicPrivacyController, DynamicPrivacyController dynamicPrivacyController, ConfigurationController configurationController) { ConfigurationController configurationController, ZenModeController zenModeController) { mAllowLongPress = allowLongPress; mAllowLongPress = allowLongPress; mNotificationGutsManager = notificationGutsManager; mNotificationGutsManager = notificationGutsManager; mHeadsUpManager = headsUpManager; mHeadsUpManager = headsUpManager; Loading @@ -138,6 +141,7 @@ public class NotificationStackScrollLayoutController { mTunerService = tunerService; mTunerService = tunerService; mDynamicPrivacyController = dynamicPrivacyController; mDynamicPrivacyController = dynamicPrivacyController; mConfigurationController = configurationController; mConfigurationController = configurationController; mZenModeController = zenModeController; } } public void attach(NotificationStackScrollLayout view) { public void attach(NotificationStackScrollLayout view) { Loading Loading @@ -484,7 +488,7 @@ public class NotificationStackScrollLayoutController { } } public void updateEmptyShadeView(boolean visible) { public void updateEmptyShadeView(boolean visible) { mView.updateEmptyShadeView(visible); mView.updateEmptyShadeView(visible, mZenModeController.areNotificationsHiddenInShade()); } } public void setHeadsUpAnimatingAway(boolean headsUpAnimatingAway) { public void setHeadsUpAnimatingAway(boolean headsUpAnimatingAway) { Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +11 −13 Original line number Original line Diff line number Diff line Loading @@ -94,6 +94,7 @@ import com.android.systemui.statusbar.phone.NotificationIconAreaController; import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.util.leak.LeakDetector; import com.android.systemui.util.leak.LeakDetector; Loading Loading @@ -136,12 +137,12 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Mock private MetricsLogger mMetricsLogger; @Mock private MetricsLogger mMetricsLogger; @Mock private NotificationRoundnessManager mNotificationRoundnessManager; @Mock private NotificationRoundnessManager mNotificationRoundnessManager; @Mock private KeyguardBypassController mKeyguardBypassController; @Mock private KeyguardBypassController mKeyguardBypassController; @Mock private KeyguardMediaController mKeyguardMediaController; @Mock private ZenModeController mZenModeController; @Mock private NotificationSectionsManager mNotificationSectionsManager; @Mock private NotificationSectionsManager mNotificationSectionsManager; @Mock private NotificationSection mNotificationSection; @Mock private NotificationSection mNotificationSection; @Mock private NotificationLockscreenUserManager mLockscreenUserManager; @Mock private NotificationLockscreenUserManager mLockscreenUserManager; @Mock private FeatureFlags mFeatureFlags; @Mock private FeatureFlags mFeatureFlags; @Mock private KeyguardMediaController mKeyguardMediaController; @Mock private SysuiStatusBarStateController mStatusBarStateController; private UserChangedListener mUserChangedListener; private UserChangedListener mUserChangedListener; private NotificationEntryManager mEntryManager; private NotificationEntryManager mEntryManager; private int mOriginalInterruptionModelSetting; private int mOriginalInterruptionModelSetting; Loading Loading @@ -211,17 +212,18 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { // which refer to members of NotificationStackScrollLayout. The spy // which refer to members of NotificationStackScrollLayout. The spy // holds a copy of the CUT's instances of these KeyguardBypassController, so they still // holds a copy of the CUT's instances of these KeyguardBypassController, so they still // refer to the CUT's member variables, not the spy's member variables. // refer to the CUT's member variables, not the spy's member variables. mStackScrollerInternal = new NotificationStackScrollLayout(getContext(), null, mStackScrollerInternal = new NotificationStackScrollLayout( getContext(), null, mNotificationRoundnessManager, mNotificationRoundnessManager, mock(DynamicPrivacyController.class), mock(DynamicPrivacyController.class), mock(SysuiStatusBarStateController.class), mStatusBarStateController, mHeadsUpManager, mHeadsUpManager, mKeyguardBypassController, mKeyguardBypassController, mKeyguardMediaController, mKeyguardMediaController, new FalsingManagerFake(), new FalsingManagerFake(), mLockscreenUserManager, mLockscreenUserManager, mock(NotificationGutsManager.class), mock(NotificationGutsManager.class), mZenModeController, mNotificationSectionsManager, mNotificationSectionsManager, mock(ForegroundServiceSectionController.class), mock(ForegroundServiceSectionController.class), mock(ForegroundServiceDismissalFeatureController.class), mock(ForegroundServiceDismissalFeatureController.class), Loading Loading @@ -269,9 +271,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Test @Test public void updateEmptyView_dndSuppressing() { public void updateEmptyView_dndSuppressing() { when(mEmptyShadeView.willBeGone()).thenReturn(true); when(mEmptyShadeView.willBeGone()).thenReturn(true); when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(true); mStackScroller.updateEmptyShadeView(true); mStackScroller.updateEmptyShadeView(true, true); verify(mEmptyShadeView).setText(R.string.dnd_suppressing_shade_text); verify(mEmptyShadeView).setText(R.string.dnd_suppressing_shade_text); } } Loading @@ -280,9 +281,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { public void updateEmptyView_dndNotSuppressing() { public void updateEmptyView_dndNotSuppressing() { mStackScroller.setEmptyShadeView(mEmptyShadeView); mStackScroller.setEmptyShadeView(mEmptyShadeView); when(mEmptyShadeView.willBeGone()).thenReturn(true); when(mEmptyShadeView.willBeGone()).thenReturn(true); when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false); mStackScroller.updateEmptyShadeView(true); mStackScroller.updateEmptyShadeView(true, false); verify(mEmptyShadeView).setText(R.string.empty_shade_text); verify(mEmptyShadeView).setText(R.string.empty_shade_text); } } Loading @@ -291,12 +291,10 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { public void updateEmptyView_noNotificationsToDndSuppressing() { public void updateEmptyView_noNotificationsToDndSuppressing() { mStackScroller.setEmptyShadeView(mEmptyShadeView); mStackScroller.setEmptyShadeView(mEmptyShadeView); when(mEmptyShadeView.willBeGone()).thenReturn(true); when(mEmptyShadeView.willBeGone()).thenReturn(true); when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false); mStackScroller.updateEmptyShadeView(true, false); mStackScroller.updateEmptyShadeView(true); verify(mEmptyShadeView).setText(R.string.empty_shade_text); verify(mEmptyShadeView).setText(R.string.empty_shade_text); when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(true); mStackScroller.updateEmptyShadeView(true, true); mStackScroller.updateEmptyShadeView(true); verify(mEmptyShadeView).setText(R.string.dnd_suppressing_shade_text); verify(mEmptyShadeView).setText(R.string.dnd_suppressing_shade_text); } } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollerControllerTest.java +39 −4 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.notification.stack; package com.android.systemui.statusbar.notification.stack; import static com.android.systemui.statusbar.notification.ViewGroupFadeHelper.reset; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.never; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify; Loading @@ -26,11 +28,11 @@ import android.testing.AndroidTestingRunner; import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase; import com.android.systemui.colorextraction.SysuiColorExtractor; import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.tuner.TunerService; import com.android.systemui.tuner.TunerService; import org.junit.Before; import org.junit.Before; Loading @@ -55,13 +57,13 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase { @Mock @Mock private TunerService mTunerService; private TunerService mTunerService; @Mock @Mock private AmbientState mAmbientState; @Mock private DynamicPrivacyController mDynamicPrivacyController; private DynamicPrivacyController mDynamicPrivacyController; @Mock @Mock private ConfigurationController mConfigurationController; private ConfigurationController mConfigurationController; @Mock @Mock private NotificationStackScrollLayout mNotificationStackScrollLayout; private NotificationStackScrollLayout mNotificationStackScrollLayout; @Mock private ZenModeController mZenModeController; NotificationStackScrollLayoutController mController; NotificationStackScrollLayoutController mController; Loading @@ -76,7 +78,8 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase { mNotificationRoundnessManager, mNotificationRoundnessManager, mTunerService, mTunerService, mDynamicPrivacyController, mDynamicPrivacyController, mConfigurationController mConfigurationController, mZenModeController ); ); when(mNotificationStackScrollLayout.isAttachedToWindow()).thenReturn(true); when(mNotificationStackScrollLayout.isAttachedToWindow()).thenReturn(true); Loading Loading @@ -112,4 +115,36 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase { mController.mConfigurationListener.onDensityOrFontScaleChanged(); mController.mConfigurationListener.onDensityOrFontScaleChanged(); verify(mNotificationStackScrollLayout).reinflateViews(); verify(mNotificationStackScrollLayout).reinflateViews(); } } @Test public void testUpdateEmptyShadeView_notificationsVisible() { when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(true); mController.attach(mNotificationStackScrollLayout); mController.updateEmptyShadeView(true /* visible */); verify(mNotificationStackScrollLayout).updateEmptyShadeView( true /* visible */, true /* notifVisibleInShade */); reset(mNotificationStackScrollLayout); mController.updateEmptyShadeView(false /* visible */); verify(mNotificationStackScrollLayout).updateEmptyShadeView( false /* visible */, true /* notifVisibleInShade */); } @Test public void testUpdateEmptyShadeView_notificationsHidden() { when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false); mController.attach(mNotificationStackScrollLayout); mController.updateEmptyShadeView(true /* visible */); verify(mNotificationStackScrollLayout).updateEmptyShadeView( true /* visible */, false /* notifVisibleInShade */); reset(mNotificationStackScrollLayout); mController.updateEmptyShadeView(false /* visible */); verify(mNotificationStackScrollLayout).updateEmptyShadeView( false /* visible */, false /* notifVisibleInShade */); } } }