Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +16 −0 Original line number Diff line number Diff line Loading @@ -4990,17 +4990,29 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable public void removeContainerView(View v) { Assert.isMainThread(); removeView(v); if (v instanceof ExpandableNotificationRow && !mController.isShowingEmptyShadeView()) { mController.updateShowEmptyShadeView(); updateFooter(); } } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void addContainerView(View v) { Assert.isMainThread(); addView(v); if (v instanceof ExpandableNotificationRow && mController.isShowingEmptyShadeView()) { mController.updateShowEmptyShadeView(); updateFooter(); } } public void addContainerViewAt(View v, int index) { Assert.isMainThread(); addView(v, index); if (v instanceof ExpandableNotificationRow && mController.isShowingEmptyShadeView()) { mController.updateShowEmptyShadeView(); updateFooter(); } } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) Loading Loading @@ -5101,6 +5113,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable updateScrollability(); } boolean isQsExpanded() { return mQsExpanded; } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void setQsExpansionFraction(float qsExpansionFraction) { mQsExpansionFraction = qsExpansionFraction; Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +35 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.statusbar.notification.stack; import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME; import static com.android.systemui.statusbar.StatusBarState.KEYGUARD; import android.content.res.Resources; import android.graphics.Point; Loading Loading @@ -117,6 +118,8 @@ public class NotificationStackScrollLayoutController { private NotificationStackScrollLayout mView; private boolean mFadeNotificationsOnDismiss; private NotificationSwipeHelper mSwipeHelper; private boolean mShowEmptyShadeView; private int mBarState; private final NotificationListContainerImpl mNotificationListContainer = new NotificationListContainerImpl(); Loading @@ -127,6 +130,8 @@ public class NotificationStackScrollLayoutController { @Override public void onViewAttachedToWindow(View v) { mConfigurationController.addCallback(mConfigurationListener); mZenModeController.addCallback(mZenModeControllerCallback); mBarState = mStatusBarStateController.getState(); mStatusBarStateController.addCallback( mStateListener, SysuiStatusBarStateController.RANK_STACK_SCROLLER); } Loading @@ -134,6 +139,7 @@ public class NotificationStackScrollLayoutController { @Override public void onViewDetachedFromWindow(View v) { mConfigurationController.removeCallback(mConfigurationListener); mZenModeController.removeCallback(mZenModeControllerCallback); mStatusBarStateController.removeCallback(mStateListener); } }; Loading @@ -154,11 +160,13 @@ public class NotificationStackScrollLayoutController { final ConfigurationListener mConfigurationListener = new ConfigurationListener() { @Override public void onDensityOrFontScaleChanged() { updateShowEmptyShadeView(); mView.reinflateViews(); } @Override public void onOverlayChanged() { updateShowEmptyShadeView(); mView.updateCornerRadius(); mView.reinflateViews(); } Loading @@ -179,14 +187,15 @@ public class NotificationStackScrollLayoutController { @Override public void onStatePreChange(int oldState, int newState) { if (oldState == StatusBarState.SHADE_LOCKED && newState == StatusBarState.KEYGUARD) { && newState == KEYGUARD) { mView.requestAnimateEverything(); } } @Override public void onStateChanged(int newState) { mView.setStatusBarState(newState); mBarState = newState; mView.setStatusBarState(mBarState); } @Override Loading Loading @@ -480,6 +489,14 @@ public class NotificationStackScrollLayoutController { } }; private final ZenModeController.Callback mZenModeControllerCallback = new ZenModeController.Callback() { @Override public void onZenChanged(int zen) { updateShowEmptyShadeView(); } }; @Inject public NotificationStackScrollLayoutController( @Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME) boolean allowLongPress, Loading Loading @@ -795,6 +812,7 @@ public class NotificationStackScrollLayoutController { public void setQsExpanded(boolean expanded) { mView.setQsExpanded(expanded); updateShowEmptyShadeView(); } public void setScrollingEnabled(boolean enabled) { Loading Loading @@ -903,8 +921,21 @@ public class NotificationStackScrollLayoutController { return mView.getFooterViewHeightWithPadding(); } public void updateEmptyShadeView(boolean visible) { mView.updateEmptyShadeView(visible, mZenModeController.areNotificationsHiddenInShade()); /** * Update whether we should show the empty shade view (no notifications in the shade). * If so, send the update to our view. */ public void updateShowEmptyShadeView() { mShowEmptyShadeView = mBarState != KEYGUARD && !mView.isQsExpanded() && mView.getVisibleNotificationCount() == 0; mView.updateEmptyShadeView( mShowEmptyShadeView, mZenModeController.areNotificationsHiddenInShade()); } public boolean isShowingEmptyShadeView() { return mShowEmptyShadeView; } public void setHeadsUpAnimatingAway(boolean headsUpAnimatingAway) { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +11 −48 Original line number Diff line number Diff line Loading @@ -107,6 +107,7 @@ import com.android.systemui.statusbar.notification.PropertyAnimator; import com.android.systemui.statusbar.notification.ViewGroupFadeHelper; import com.android.systemui.statusbar.notification.collection.ListEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.render.ShadeViewManager; import com.android.systemui.statusbar.notification.row.ActivatableNotificationView; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableView; Loading @@ -120,7 +121,6 @@ import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.KeyguardUserSwitcher; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.util.InjectionInflationController; import java.io.FileDescriptor; Loading Loading @@ -168,9 +168,6 @@ public class NotificationPanelViewController extends PanelViewController { mOnHeadsUpChangedListener = new MyOnHeadsUpChangedListener(); private final HeightListener mHeightListener = new HeightListener(); private final ZenModeControllerCallback mZenModeControllerCallback = new ZenModeControllerCallback(); private final ConfigurationListener mConfigurationListener = new ConfigurationListener(); private final StatusBarStateListener mStatusBarStateListener = new StatusBarStateListener(); private final ExpansionCallback mExpansionCallback = new ExpansionCallback(); Loading @@ -178,7 +175,6 @@ public class NotificationPanelViewController extends PanelViewController { private final NotificationPanelView mView; private final MetricsLogger mMetricsLogger; private final ActivityManager mActivityManager; private final ZenModeController mZenModeController; private final ConfigurationController mConfigurationController; private final FlingAnimationUtils.Builder mFlingAnimationUtilsBuilder; private final NotificationStackScrollLayoutController mNotificationStackScrollLayoutController; Loading Loading @@ -342,8 +338,6 @@ public class NotificationPanelViewController extends PanelViewController { private boolean mKeyguardStatusViewAnimating; private ValueAnimator mQsSizeChangeAnimator; private boolean mShowEmptyShadeView; private boolean mQsScrimEnabled = true; private boolean mQsTouchAboveFalsingThreshold; private int mQsFalsingThreshold; Loading Loading @@ -505,7 +499,7 @@ public class NotificationPanelViewController extends PanelViewController { LatencyTracker latencyTracker, PowerManager powerManager, AccessibilityManager accessibilityManager, @DisplayId int displayId, KeyguardUpdateMonitor keyguardUpdateMonitor, MetricsLogger metricsLogger, ActivityManager activityManager, ZenModeController zenModeController, ActivityManager activityManager, ConfigurationController configurationController, FlingAnimationUtils.Builder flingAnimationUtilsBuilder, StatusBarTouchableRegionManager statusBarTouchableRegionManager, Loading @@ -522,7 +516,6 @@ public class NotificationPanelViewController extends PanelViewController { mView = view; mMetricsLogger = metricsLogger; mActivityManager = activityManager; mZenModeController = zenModeController; mConfigurationController = configurationController; mFlingAnimationUtilsBuilder = flingAnimationUtilsBuilder; mMediaHierarchyManager = mediaHierarchyManager; Loading Loading @@ -724,8 +717,6 @@ public class NotificationPanelViewController extends PanelViewController { } private void reInflateViews() { updateShowEmptyShadeView(); // Re-inflate the status view group. int index = mView.indexOfChild(mKeyguardStatusView); mView.removeView(mKeyguardStatusView); Loading Loading @@ -1727,7 +1718,6 @@ public class NotificationPanelViewController extends PanelViewController { mNotificationStackScrollLayoutController.setScrollingEnabled( mBarState != KEYGUARD && (!mQsExpanded || mQsExpansionFromOverscroll)); updateEmptyShadeView(); mQsNavbarScrim.setVisibility( mBarState == StatusBarState.SHADE && mQsExpanded && !mStackScrollerOverscrolling Loading Loading @@ -2145,7 +2135,7 @@ public class NotificationPanelViewController extends PanelViewController { // it in expanded QS state as well so we don't run into troubles when fading the view in/out // and expanding/collapsing the whole panel from/to quick settings. if (mNotificationStackScrollLayoutController.getNotGoneChildCount() == 0 && mShowEmptyShadeView) { && mNotificationStackScrollLayoutController.isShowingEmptyShadeView()) { notificationHeight = mNotificationStackScrollLayoutController.getEmptyShadeViewHeight(); } int maxQsHeight = mQsMaxExpansionHeight; Loading Loading @@ -2561,17 +2551,6 @@ public class NotificationPanelViewController extends PanelViewController { return mDozing; } public void showEmptyShadeView(boolean emptyShadeViewVisible) { mShowEmptyShadeView = emptyShadeViewVisible; updateEmptyShadeView(); } private void updateEmptyShadeView() { // Hide "No notifications" in QS. mNotificationStackScrollLayoutController.updateEmptyShadeView( mShowEmptyShadeView && !mQsExpanded); } public void setQsScrimEnabled(boolean qsScrimEnabled) { boolean changed = mQsScrimEnabled != qsScrimEnabled; mQsScrimEnabled = qsScrimEnabled; Loading Loading @@ -3078,22 +3057,21 @@ public class NotificationPanelViewController extends PanelViewController { return mNotificationStackScrollLayoutController.hasActiveClearableNotifications(ROWS_ALL); } private void updateShowEmptyShadeView() { boolean showEmptyShadeView = mBarState != KEYGUARD && !mEntryManager.hasActiveNotifications(); showEmptyShadeView(showEmptyShadeView); } public RemoteInputController.Delegate createRemoteInputDelegate() { return mNotificationStackScrollLayoutController.createDelegate(); } void updateNotificationViews(String reason) { /** * Updates the notification views' sections and status bar icons. This is * triggered by the NotificationPresenter whenever there are changes to the underlying * notification data being displayed. In the new notification pipeline, this is handled in * {@link ShadeViewManager}. */ public void updateNotificationViews(String reason) { mNotificationStackScrollLayoutController.updateSectionBoundaries(reason); mNotificationStackScrollLayoutController.updateSpeedBumpIndex(); mNotificationStackScrollLayoutController.updateFooter(); updateShowEmptyShadeView(); mNotificationIconAreaController.updateNotificationIcons(createVisibleEntriesList()); } Loading Loading @@ -3147,7 +3125,6 @@ public class NotificationPanelViewController extends PanelViewController { mNotificationStackScrollLayoutController.setStatusBar(statusBar); mNotificationStackScrollLayoutController.setGroupManager(groupManager); mNotificationStackScrollLayoutController.setShelfController(notificationShelfController); updateShowEmptyShadeView(); mNotificationShelfController = notificationShelfController; updateMaxDisplayedNotifications(true); } Loading Loading @@ -3602,19 +3579,7 @@ public class NotificationPanelViewController extends PanelViewController { } } private class ZenModeControllerCallback implements ZenModeController.Callback { @Override public void onZenChanged(int zen) { updateShowEmptyShadeView(); } } private class ConfigurationListener implements ConfigurationController.ConfigurationListener { @Override public void onDensityOrFontScaleChanged() { updateShowEmptyShadeView(); } @Override public void onThemeChanged() { final int themeResId = mView.getContext().getThemeResId(); Loading Loading @@ -3712,7 +3677,6 @@ public class NotificationPanelViewController extends PanelViewController { public void onViewAttachedToWindow(View v) { FragmentHostManager.get(mView).addTagListener(QS.TAG, mFragmentListener); mStatusBarStateController.addCallback(mStatusBarStateListener); mZenModeController.addCallback(mZenModeControllerCallback); mConfigurationController.addCallback(mConfigurationListener); mUpdateMonitor.registerCallback(mKeyguardUpdateCallback); // Theme might have changed between inflating this view and attaching it to the Loading @@ -3725,7 +3689,6 @@ public class NotificationPanelViewController extends PanelViewController { public void onViewDetachedFromWindow(View v) { FragmentHostManager.get(mView).removeTagListener(QS.TAG, mFragmentListener); mStatusBarStateController.removeCallback(mStatusBarStateListener); mZenModeController.removeCallback(mZenModeControllerCallback); mConfigurationController.removeCallback(mConfigurationListener); mUpdateMonitor.removeCallback(mKeyguardUpdateCallback); } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -47,9 +47,6 @@ import com.android.internal.statusbar.IStatusBarService; import com.android.systemui.ExpandHelper; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.classifier.FalsingManagerFake; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.FeatureFlags; import com.android.systemui.statusbar.NotificationMediaManager; Loading Loading @@ -81,7 +78,6 @@ import com.android.systemui.statusbar.notification.row.NotificationBlockingHelpe import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.KeyguardBypassEnabledProvider; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.NotificationGroupManager; import com.android.systemui.statusbar.phone.NotificationIconAreaController; import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.util.leak.LeakDetector; Loading Loading @@ -128,6 +124,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Mock private FeatureFlags mFeatureFlags; @Mock private SysuiStatusBarStateController mStatusBarStateController; @Mock private NotificationSwipeHelper mNotificationSwipeHelper; @Mock NotificationStackScrollLayoutController mStackScrollLayoutController; private NotificationEntryManager mEntryManager; private int mOriginalInterruptionModelSetting; private UiEventLoggerFake mUiEventLoggerFake = new UiEventLoggerFake(); Loading Loading @@ -216,6 +213,9 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { mStackScroller.setStatusBar(mBar); mStackScroller.setGroupManager(mGroupManager); mStackScroller.setEmptyShadeView(mEmptyShadeView); when(mStackScrollLayoutController.getNoticationRoundessManager()) .thenReturn(mock(NotificationRoundnessManager.class)); mStackScroller.setController(mStackScrollLayoutController); // Stub out functionality that isn't necessary to test. doNothing().when(mBar) Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollerControllerTest.java +46 −12 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.systemui.statusbar.notification.stack; import static com.android.systemui.statusbar.StatusBarState.KEYGUARD; import static com.android.systemui.statusbar.StatusBarState.SHADE; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.argThat; Loading Loading @@ -49,7 +52,6 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.LockscreenGestureLogger; import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.ConfigurationController; Loading @@ -62,6 +64,7 @@ import org.junit.runner.RunWith; import org.mockito.Answers; import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatcher; import org.mockito.Captor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; Loading Loading @@ -115,6 +118,9 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase { @Mock private ScrimController mScrimController; @Captor ArgumentCaptor<StatusBarStateController.StateListener> mStateListenerArgumentCaptor; private NotificationStackScrollLayoutController mController; @Before Loading Loading @@ -181,32 +187,49 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase { } @Test public void testUpdateEmptyShadeView_notificationsVisible() { public void testUpdateEmptyShadeView_notificationsVisible_zenHiding() { when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(true); mController.attach(mNotificationStackScrollLayout); verify(mSysuiStatusBarStateController).addCallback( mStateListenerArgumentCaptor.capture(), anyInt()); StatusBarStateController.StateListener stateListener = mStateListenerArgumentCaptor.getValue(); mController.updateEmptyShadeView(true /* visible */); setupShowEmptyShadeViewState(stateListener, true); reset(mNotificationStackScrollLayout); mController.updateShowEmptyShadeView(); verify(mNotificationStackScrollLayout).updateEmptyShadeView( true /* visible */, true /* notifVisibleInShade */); setupShowEmptyShadeViewState(stateListener, false); reset(mNotificationStackScrollLayout); mController.updateEmptyShadeView(false /* visible */); mController.updateShowEmptyShadeView(); verify(mNotificationStackScrollLayout).updateEmptyShadeView( false /* visible */, true /* notifVisibleInShade */); } @Test public void testUpdateEmptyShadeView_notificationsHidden() { public void testUpdateEmptyShadeView_notificationsHidden_zenNotHiding() { when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false); mController.attach(mNotificationStackScrollLayout); verify(mSysuiStatusBarStateController).addCallback( mStateListenerArgumentCaptor.capture(), anyInt()); StatusBarStateController.StateListener stateListener = mStateListenerArgumentCaptor.getValue(); mController.updateEmptyShadeView(true /* visible */); setupShowEmptyShadeViewState(stateListener, true); reset(mNotificationStackScrollLayout); mController.updateShowEmptyShadeView(); verify(mNotificationStackScrollLayout).updateEmptyShadeView( true /* visible */, false /* notifVisibleInShade */); setupShowEmptyShadeViewState(stateListener, false); reset(mNotificationStackScrollLayout); mController.updateEmptyShadeView(false /* visible */); mController.updateShowEmptyShadeView(); verify(mNotificationStackScrollLayout).updateEmptyShadeView( false /* visible */, false /* notifVisibleInShade */); Loading Loading @@ -234,15 +257,12 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase { public void testOnStatePostChange_verifyIfProfileIsPublic() { when(mNotificationLockscreenUserManager.isAnyProfilePublicMode()).thenReturn(true); ArgumentCaptor<StatusBarStateController.StateListener> stateListenerArgumentCaptor = ArgumentCaptor.forClass(StatusBarStateController.StateListener.class); mController.attach(mNotificationStackScrollLayout); verify(mSysuiStatusBarStateController).addCallback( stateListenerArgumentCaptor.capture(), anyInt()); mStateListenerArgumentCaptor.capture(), anyInt()); StatusBarStateController.StateListener stateListener = stateListenerArgumentCaptor.getValue(); mStateListenerArgumentCaptor.getValue(); stateListener.onStatePostChange(); verify(mNotificationStackScrollLayout).updateSensitiveness(false, true); Loading Loading @@ -299,6 +319,20 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase { return argThat(new LogMatcher(category, type)); } private void setupShowEmptyShadeViewState( StatusBarStateController.StateListener statusBarStateListener, boolean toShow) { if (toShow) { statusBarStateListener.onStateChanged(SHADE); mController.setQsExpanded(false); mController.getView().removeAllViews(); } else { statusBarStateListener.onStateChanged(KEYGUARD); mController.setQsExpanded(true); mController.getView().addContainerView(mock(ExpandableNotificationRow.class)); } } static class LogMatcher implements ArgumentMatcher<LogMaker> { private int mCategory, mType; Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +16 −0 Original line number Diff line number Diff line Loading @@ -4990,17 +4990,29 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable public void removeContainerView(View v) { Assert.isMainThread(); removeView(v); if (v instanceof ExpandableNotificationRow && !mController.isShowingEmptyShadeView()) { mController.updateShowEmptyShadeView(); updateFooter(); } } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void addContainerView(View v) { Assert.isMainThread(); addView(v); if (v instanceof ExpandableNotificationRow && mController.isShowingEmptyShadeView()) { mController.updateShowEmptyShadeView(); updateFooter(); } } public void addContainerViewAt(View v, int index) { Assert.isMainThread(); addView(v, index); if (v instanceof ExpandableNotificationRow && mController.isShowingEmptyShadeView()) { mController.updateShowEmptyShadeView(); updateFooter(); } } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) Loading Loading @@ -5101,6 +5113,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable updateScrollability(); } boolean isQsExpanded() { return mQsExpanded; } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void setQsExpansionFraction(float qsExpansionFraction) { mQsExpansionFraction = qsExpansionFraction; Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +35 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.statusbar.notification.stack; import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME; import static com.android.systemui.statusbar.StatusBarState.KEYGUARD; import android.content.res.Resources; import android.graphics.Point; Loading Loading @@ -117,6 +118,8 @@ public class NotificationStackScrollLayoutController { private NotificationStackScrollLayout mView; private boolean mFadeNotificationsOnDismiss; private NotificationSwipeHelper mSwipeHelper; private boolean mShowEmptyShadeView; private int mBarState; private final NotificationListContainerImpl mNotificationListContainer = new NotificationListContainerImpl(); Loading @@ -127,6 +130,8 @@ public class NotificationStackScrollLayoutController { @Override public void onViewAttachedToWindow(View v) { mConfigurationController.addCallback(mConfigurationListener); mZenModeController.addCallback(mZenModeControllerCallback); mBarState = mStatusBarStateController.getState(); mStatusBarStateController.addCallback( mStateListener, SysuiStatusBarStateController.RANK_STACK_SCROLLER); } Loading @@ -134,6 +139,7 @@ public class NotificationStackScrollLayoutController { @Override public void onViewDetachedFromWindow(View v) { mConfigurationController.removeCallback(mConfigurationListener); mZenModeController.removeCallback(mZenModeControllerCallback); mStatusBarStateController.removeCallback(mStateListener); } }; Loading @@ -154,11 +160,13 @@ public class NotificationStackScrollLayoutController { final ConfigurationListener mConfigurationListener = new ConfigurationListener() { @Override public void onDensityOrFontScaleChanged() { updateShowEmptyShadeView(); mView.reinflateViews(); } @Override public void onOverlayChanged() { updateShowEmptyShadeView(); mView.updateCornerRadius(); mView.reinflateViews(); } Loading @@ -179,14 +187,15 @@ public class NotificationStackScrollLayoutController { @Override public void onStatePreChange(int oldState, int newState) { if (oldState == StatusBarState.SHADE_LOCKED && newState == StatusBarState.KEYGUARD) { && newState == KEYGUARD) { mView.requestAnimateEverything(); } } @Override public void onStateChanged(int newState) { mView.setStatusBarState(newState); mBarState = newState; mView.setStatusBarState(mBarState); } @Override Loading Loading @@ -480,6 +489,14 @@ public class NotificationStackScrollLayoutController { } }; private final ZenModeController.Callback mZenModeControllerCallback = new ZenModeController.Callback() { @Override public void onZenChanged(int zen) { updateShowEmptyShadeView(); } }; @Inject public NotificationStackScrollLayoutController( @Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME) boolean allowLongPress, Loading Loading @@ -795,6 +812,7 @@ public class NotificationStackScrollLayoutController { public void setQsExpanded(boolean expanded) { mView.setQsExpanded(expanded); updateShowEmptyShadeView(); } public void setScrollingEnabled(boolean enabled) { Loading Loading @@ -903,8 +921,21 @@ public class NotificationStackScrollLayoutController { return mView.getFooterViewHeightWithPadding(); } public void updateEmptyShadeView(boolean visible) { mView.updateEmptyShadeView(visible, mZenModeController.areNotificationsHiddenInShade()); /** * Update whether we should show the empty shade view (no notifications in the shade). * If so, send the update to our view. */ public void updateShowEmptyShadeView() { mShowEmptyShadeView = mBarState != KEYGUARD && !mView.isQsExpanded() && mView.getVisibleNotificationCount() == 0; mView.updateEmptyShadeView( mShowEmptyShadeView, mZenModeController.areNotificationsHiddenInShade()); } public boolean isShowingEmptyShadeView() { return mShowEmptyShadeView; } public void setHeadsUpAnimatingAway(boolean headsUpAnimatingAway) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +11 −48 Original line number Diff line number Diff line Loading @@ -107,6 +107,7 @@ import com.android.systemui.statusbar.notification.PropertyAnimator; import com.android.systemui.statusbar.notification.ViewGroupFadeHelper; import com.android.systemui.statusbar.notification.collection.ListEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.render.ShadeViewManager; import com.android.systemui.statusbar.notification.row.ActivatableNotificationView; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.ExpandableView; Loading @@ -120,7 +121,6 @@ import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.KeyguardUserSwitcher; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.util.InjectionInflationController; import java.io.FileDescriptor; Loading Loading @@ -168,9 +168,6 @@ public class NotificationPanelViewController extends PanelViewController { mOnHeadsUpChangedListener = new MyOnHeadsUpChangedListener(); private final HeightListener mHeightListener = new HeightListener(); private final ZenModeControllerCallback mZenModeControllerCallback = new ZenModeControllerCallback(); private final ConfigurationListener mConfigurationListener = new ConfigurationListener(); private final StatusBarStateListener mStatusBarStateListener = new StatusBarStateListener(); private final ExpansionCallback mExpansionCallback = new ExpansionCallback(); Loading @@ -178,7 +175,6 @@ public class NotificationPanelViewController extends PanelViewController { private final NotificationPanelView mView; private final MetricsLogger mMetricsLogger; private final ActivityManager mActivityManager; private final ZenModeController mZenModeController; private final ConfigurationController mConfigurationController; private final FlingAnimationUtils.Builder mFlingAnimationUtilsBuilder; private final NotificationStackScrollLayoutController mNotificationStackScrollLayoutController; Loading Loading @@ -342,8 +338,6 @@ public class NotificationPanelViewController extends PanelViewController { private boolean mKeyguardStatusViewAnimating; private ValueAnimator mQsSizeChangeAnimator; private boolean mShowEmptyShadeView; private boolean mQsScrimEnabled = true; private boolean mQsTouchAboveFalsingThreshold; private int mQsFalsingThreshold; Loading Loading @@ -505,7 +499,7 @@ public class NotificationPanelViewController extends PanelViewController { LatencyTracker latencyTracker, PowerManager powerManager, AccessibilityManager accessibilityManager, @DisplayId int displayId, KeyguardUpdateMonitor keyguardUpdateMonitor, MetricsLogger metricsLogger, ActivityManager activityManager, ZenModeController zenModeController, ActivityManager activityManager, ConfigurationController configurationController, FlingAnimationUtils.Builder flingAnimationUtilsBuilder, StatusBarTouchableRegionManager statusBarTouchableRegionManager, Loading @@ -522,7 +516,6 @@ public class NotificationPanelViewController extends PanelViewController { mView = view; mMetricsLogger = metricsLogger; mActivityManager = activityManager; mZenModeController = zenModeController; mConfigurationController = configurationController; mFlingAnimationUtilsBuilder = flingAnimationUtilsBuilder; mMediaHierarchyManager = mediaHierarchyManager; Loading Loading @@ -724,8 +717,6 @@ public class NotificationPanelViewController extends PanelViewController { } private void reInflateViews() { updateShowEmptyShadeView(); // Re-inflate the status view group. int index = mView.indexOfChild(mKeyguardStatusView); mView.removeView(mKeyguardStatusView); Loading Loading @@ -1727,7 +1718,6 @@ public class NotificationPanelViewController extends PanelViewController { mNotificationStackScrollLayoutController.setScrollingEnabled( mBarState != KEYGUARD && (!mQsExpanded || mQsExpansionFromOverscroll)); updateEmptyShadeView(); mQsNavbarScrim.setVisibility( mBarState == StatusBarState.SHADE && mQsExpanded && !mStackScrollerOverscrolling Loading Loading @@ -2145,7 +2135,7 @@ public class NotificationPanelViewController extends PanelViewController { // it in expanded QS state as well so we don't run into troubles when fading the view in/out // and expanding/collapsing the whole panel from/to quick settings. if (mNotificationStackScrollLayoutController.getNotGoneChildCount() == 0 && mShowEmptyShadeView) { && mNotificationStackScrollLayoutController.isShowingEmptyShadeView()) { notificationHeight = mNotificationStackScrollLayoutController.getEmptyShadeViewHeight(); } int maxQsHeight = mQsMaxExpansionHeight; Loading Loading @@ -2561,17 +2551,6 @@ public class NotificationPanelViewController extends PanelViewController { return mDozing; } public void showEmptyShadeView(boolean emptyShadeViewVisible) { mShowEmptyShadeView = emptyShadeViewVisible; updateEmptyShadeView(); } private void updateEmptyShadeView() { // Hide "No notifications" in QS. mNotificationStackScrollLayoutController.updateEmptyShadeView( mShowEmptyShadeView && !mQsExpanded); } public void setQsScrimEnabled(boolean qsScrimEnabled) { boolean changed = mQsScrimEnabled != qsScrimEnabled; mQsScrimEnabled = qsScrimEnabled; Loading Loading @@ -3078,22 +3057,21 @@ public class NotificationPanelViewController extends PanelViewController { return mNotificationStackScrollLayoutController.hasActiveClearableNotifications(ROWS_ALL); } private void updateShowEmptyShadeView() { boolean showEmptyShadeView = mBarState != KEYGUARD && !mEntryManager.hasActiveNotifications(); showEmptyShadeView(showEmptyShadeView); } public RemoteInputController.Delegate createRemoteInputDelegate() { return mNotificationStackScrollLayoutController.createDelegate(); } void updateNotificationViews(String reason) { /** * Updates the notification views' sections and status bar icons. This is * triggered by the NotificationPresenter whenever there are changes to the underlying * notification data being displayed. In the new notification pipeline, this is handled in * {@link ShadeViewManager}. */ public void updateNotificationViews(String reason) { mNotificationStackScrollLayoutController.updateSectionBoundaries(reason); mNotificationStackScrollLayoutController.updateSpeedBumpIndex(); mNotificationStackScrollLayoutController.updateFooter(); updateShowEmptyShadeView(); mNotificationIconAreaController.updateNotificationIcons(createVisibleEntriesList()); } Loading Loading @@ -3147,7 +3125,6 @@ public class NotificationPanelViewController extends PanelViewController { mNotificationStackScrollLayoutController.setStatusBar(statusBar); mNotificationStackScrollLayoutController.setGroupManager(groupManager); mNotificationStackScrollLayoutController.setShelfController(notificationShelfController); updateShowEmptyShadeView(); mNotificationShelfController = notificationShelfController; updateMaxDisplayedNotifications(true); } Loading Loading @@ -3602,19 +3579,7 @@ public class NotificationPanelViewController extends PanelViewController { } } private class ZenModeControllerCallback implements ZenModeController.Callback { @Override public void onZenChanged(int zen) { updateShowEmptyShadeView(); } } private class ConfigurationListener implements ConfigurationController.ConfigurationListener { @Override public void onDensityOrFontScaleChanged() { updateShowEmptyShadeView(); } @Override public void onThemeChanged() { final int themeResId = mView.getContext().getThemeResId(); Loading Loading @@ -3712,7 +3677,6 @@ public class NotificationPanelViewController extends PanelViewController { public void onViewAttachedToWindow(View v) { FragmentHostManager.get(mView).addTagListener(QS.TAG, mFragmentListener); mStatusBarStateController.addCallback(mStatusBarStateListener); mZenModeController.addCallback(mZenModeControllerCallback); mConfigurationController.addCallback(mConfigurationListener); mUpdateMonitor.registerCallback(mKeyguardUpdateCallback); // Theme might have changed between inflating this view and attaching it to the Loading @@ -3725,7 +3689,6 @@ public class NotificationPanelViewController extends PanelViewController { public void onViewDetachedFromWindow(View v) { FragmentHostManager.get(mView).removeTagListener(QS.TAG, mFragmentListener); mStatusBarStateController.removeCallback(mStatusBarStateListener); mZenModeController.removeCallback(mZenModeControllerCallback); mConfigurationController.removeCallback(mConfigurationListener); mUpdateMonitor.removeCallback(mKeyguardUpdateCallback); } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -47,9 +47,6 @@ import com.android.internal.statusbar.IStatusBarService; import com.android.systemui.ExpandHelper; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.classifier.FalsingManagerFake; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.FeatureFlags; import com.android.systemui.statusbar.NotificationMediaManager; Loading Loading @@ -81,7 +78,6 @@ import com.android.systemui.statusbar.notification.row.NotificationBlockingHelpe import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.KeyguardBypassEnabledProvider; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.NotificationGroupManager; import com.android.systemui.statusbar.phone.NotificationIconAreaController; import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.util.leak.LeakDetector; Loading Loading @@ -128,6 +124,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Mock private FeatureFlags mFeatureFlags; @Mock private SysuiStatusBarStateController mStatusBarStateController; @Mock private NotificationSwipeHelper mNotificationSwipeHelper; @Mock NotificationStackScrollLayoutController mStackScrollLayoutController; private NotificationEntryManager mEntryManager; private int mOriginalInterruptionModelSetting; private UiEventLoggerFake mUiEventLoggerFake = new UiEventLoggerFake(); Loading Loading @@ -216,6 +213,9 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { mStackScroller.setStatusBar(mBar); mStackScroller.setGroupManager(mGroupManager); mStackScroller.setEmptyShadeView(mEmptyShadeView); when(mStackScrollLayoutController.getNoticationRoundessManager()) .thenReturn(mock(NotificationRoundnessManager.class)); mStackScroller.setController(mStackScrollLayoutController); // Stub out functionality that isn't necessary to test. doNothing().when(mBar) Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollerControllerTest.java +46 −12 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.systemui.statusbar.notification.stack; import static com.android.systemui.statusbar.StatusBarState.KEYGUARD; import static com.android.systemui.statusbar.StatusBarState.SHADE; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.argThat; Loading Loading @@ -49,7 +52,6 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.NotificationGutsManager; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.LockscreenGestureLogger; import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.ConfigurationController; Loading @@ -62,6 +64,7 @@ import org.junit.runner.RunWith; import org.mockito.Answers; import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatcher; import org.mockito.Captor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; Loading Loading @@ -115,6 +118,9 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase { @Mock private ScrimController mScrimController; @Captor ArgumentCaptor<StatusBarStateController.StateListener> mStateListenerArgumentCaptor; private NotificationStackScrollLayoutController mController; @Before Loading Loading @@ -181,32 +187,49 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase { } @Test public void testUpdateEmptyShadeView_notificationsVisible() { public void testUpdateEmptyShadeView_notificationsVisible_zenHiding() { when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(true); mController.attach(mNotificationStackScrollLayout); verify(mSysuiStatusBarStateController).addCallback( mStateListenerArgumentCaptor.capture(), anyInt()); StatusBarStateController.StateListener stateListener = mStateListenerArgumentCaptor.getValue(); mController.updateEmptyShadeView(true /* visible */); setupShowEmptyShadeViewState(stateListener, true); reset(mNotificationStackScrollLayout); mController.updateShowEmptyShadeView(); verify(mNotificationStackScrollLayout).updateEmptyShadeView( true /* visible */, true /* notifVisibleInShade */); setupShowEmptyShadeViewState(stateListener, false); reset(mNotificationStackScrollLayout); mController.updateEmptyShadeView(false /* visible */); mController.updateShowEmptyShadeView(); verify(mNotificationStackScrollLayout).updateEmptyShadeView( false /* visible */, true /* notifVisibleInShade */); } @Test public void testUpdateEmptyShadeView_notificationsHidden() { public void testUpdateEmptyShadeView_notificationsHidden_zenNotHiding() { when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false); mController.attach(mNotificationStackScrollLayout); verify(mSysuiStatusBarStateController).addCallback( mStateListenerArgumentCaptor.capture(), anyInt()); StatusBarStateController.StateListener stateListener = mStateListenerArgumentCaptor.getValue(); mController.updateEmptyShadeView(true /* visible */); setupShowEmptyShadeViewState(stateListener, true); reset(mNotificationStackScrollLayout); mController.updateShowEmptyShadeView(); verify(mNotificationStackScrollLayout).updateEmptyShadeView( true /* visible */, false /* notifVisibleInShade */); setupShowEmptyShadeViewState(stateListener, false); reset(mNotificationStackScrollLayout); mController.updateEmptyShadeView(false /* visible */); mController.updateShowEmptyShadeView(); verify(mNotificationStackScrollLayout).updateEmptyShadeView( false /* visible */, false /* notifVisibleInShade */); Loading Loading @@ -234,15 +257,12 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase { public void testOnStatePostChange_verifyIfProfileIsPublic() { when(mNotificationLockscreenUserManager.isAnyProfilePublicMode()).thenReturn(true); ArgumentCaptor<StatusBarStateController.StateListener> stateListenerArgumentCaptor = ArgumentCaptor.forClass(StatusBarStateController.StateListener.class); mController.attach(mNotificationStackScrollLayout); verify(mSysuiStatusBarStateController).addCallback( stateListenerArgumentCaptor.capture(), anyInt()); mStateListenerArgumentCaptor.capture(), anyInt()); StatusBarStateController.StateListener stateListener = stateListenerArgumentCaptor.getValue(); mStateListenerArgumentCaptor.getValue(); stateListener.onStatePostChange(); verify(mNotificationStackScrollLayout).updateSensitiveness(false, true); Loading Loading @@ -299,6 +319,20 @@ public class NotificationStackScrollerControllerTest extends SysuiTestCase { return argThat(new LogMatcher(category, type)); } private void setupShowEmptyShadeViewState( StatusBarStateController.StateListener statusBarStateListener, boolean toShow) { if (toShow) { statusBarStateListener.onStateChanged(SHADE); mController.setQsExpanded(false); mController.getView().removeAllViews(); } else { statusBarStateListener.onStateChanged(KEYGUARD); mController.setQsExpanded(true); mController.getView().addContainerView(mock(ExpandableNotificationRow.class)); } } static class LogMatcher implements ArgumentMatcher<LogMaker> { private int mCategory, mType; Loading