Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +39 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,8 @@ import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener; import com.android.systemui.statusbar.policy.HeadsUpUtil; import com.android.systemui.statusbar.policy.ScrollAdapter; import com.android.systemui.statusbar.policy.ZenModeController; Loading Loading @@ -300,6 +302,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private boolean mExpandedInThisMotion; private boolean mShouldShowShelfOnly; protected boolean mScrollingEnabled; private boolean mIsCurrentUserSetup; protected FooterView mFooterView; protected EmptyShadeView mEmptyShadeView; private boolean mDismissAllInProgress; Loading Loading @@ -508,6 +511,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private final NotifPipeline mNotifPipeline; private final NotifCollection mNotifCollection; private final NotificationEntryManager mEntryManager; private final DeviceProvisionedController mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class); private final IStatusBarService mBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService(Context.STATUS_BAR_SERVICE)); @VisibleForTesting Loading Loading @@ -648,6 +653,29 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd }, HIGH_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL, Settings.Secure.NOTIFICATION_HISTORY_ENABLED); mDeviceProvisionedController.addCallback( new DeviceProvisionedListener() { @Override public void onDeviceProvisionedChanged() { updateCurrentUserIsSetup(); } @Override public void onUserSwitched() { updateCurrentUserIsSetup(); } @Override public void onUserSetupChanged() { updateCurrentUserIsSetup(); } private void updateCurrentUserIsSetup() { setCurrentUserSetup(mDeviceProvisionedController.isCurrentUserSetup()); } }); mFeatureFlags = featureFlags; mNotifPipeline = notifPipeline; mEntryManager = entryManager; Loading Loading @@ -772,6 +800,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } boolean showDismissView = mClearAllEnabled && hasActiveClearableNotifications(ROWS_ALL); boolean showFooterView = (showDismissView || hasActiveNotifications()) && mIsCurrentUserSetup // see: b/193149550 && mStatusBarState != StatusBarState.KEYGUARD && !mRemoteInputManager.getController().isRemoteInputActive(); boolean showHistory = Settings.Secure.getIntForUser(mContext.getContentResolver(), Loading Loading @@ -5923,6 +5952,16 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd return MathUtils.smoothStep(0, totalDistance, dragDownAmount); } /** * Sets whether the current user is set up, which is required to show the footer (b/193149550) */ public void setCurrentUserSetup(boolean isCurrentUserSetup) { if (mIsCurrentUserSetup != isCurrentUserSetup) { mIsCurrentUserSetup = isCurrentUserSetup; updateFooter(); } } /** * A listener that is notified when the empty space below the notifications is clicked on */ Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +29 −4 Original line number Diff line number Diff line Loading @@ -110,8 +110,6 @@ import org.mockito.junit.MockitoRule; import java.util.ArrayList; import java.util.List; import dagger.Lazy; /** * Tests for {@link NotificationStackScrollLayout}. */ Loading Loading @@ -143,7 +141,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Mock private NotificationSection mNotificationSection; @Mock private NotificationLockscreenUserManager mLockscreenUserManager; @Mock private FeatureFlags mFeatureFlags; @Mock private Lazy<BubbleController> mBubbleControllerLazy; @Mock private BubbleController mBubbleController; private UserChangedListener mUserChangedListener; private NotificationEntryManager mEntryManager; private int mOriginalInterruptionModelSetting; Loading Loading @@ -194,7 +192,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { () -> mock(NotificationRowBinder.class), () -> mRemoteInputManager, mock(LeakDetector.class), mBubbleControllerLazy, () -> mBubbleController, mock(ForegroundServiceDismissalFeatureController.class) ); mEntryManager.setUpWithPresenter(mock(NotificationPresenter.class)); Loading Loading @@ -354,6 +352,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Test public void testUpdateFooter_noNotifications() { setBarStateForTest(StatusBarState.SHADE); mStackScroller.setCurrentUserSetup(true); assertEquals(0, mEntryManager.getActiveNotificationsCount()); FooterView view = mock(FooterView.class); Loading @@ -365,6 +364,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Test public void testUpdateFooter_remoteInput() { setBarStateForTest(StatusBarState.SHADE); mStackScroller.setCurrentUserSetup(true); ArrayList<NotificationEntry> entries = new ArrayList<>(); entries.add(new NotificationEntryBuilder().build()); addEntriesToEntryManager(entries); Loading @@ -384,6 +385,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Test public void testUpdateFooter_oneClearableNotification() { setBarStateForTest(StatusBarState.SHADE); mStackScroller.setCurrentUserSetup(true); ArrayList<NotificationEntry> entries = new ArrayList<>(); entries.add(new NotificationEntryBuilder().build()); Loading @@ -400,9 +402,30 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { verify(mStackScroller).updateFooterView(true, true, true); } @Test public void testUpdateFooter_oneClearableNotification_beforeUserSetup() { setBarStateForTest(StatusBarState.SHADE); mStackScroller.setCurrentUserSetup(false); ArrayList<NotificationEntry> entries = new ArrayList<>(); entries.add(new NotificationEntryBuilder().build()); addEntriesToEntryManager(entries); ExpandableNotificationRow row = mock(ExpandableNotificationRow.class); when(row.canViewBeDismissed()).thenReturn(true); when(mStackScroller.getChildCount()).thenReturn(1); when(mStackScroller.getChildAt(anyInt())).thenReturn(row); FooterView view = mock(FooterView.class); mStackScroller.setFooterView(view); mStackScroller.updateFooter(); verify(mStackScroller).updateFooterView(false, true, true); } @Test public void testUpdateFooter_oneNonClearableNotification() { setBarStateForTest(StatusBarState.SHADE); mStackScroller.setCurrentUserSetup(true); ArrayList<NotificationEntry> entries = new ArrayList<>(); entries.add(new NotificationEntryBuilder().build()); Loading @@ -416,6 +439,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Test public void testUpdateFooter_atEnd() { mStackScroller.setCurrentUserSetup(true); // add footer mStackScroller.inflateFooterView(); Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +39 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,8 @@ import com.android.systemui.statusbar.phone.ShadeController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener; import com.android.systemui.statusbar.policy.HeadsUpUtil; import com.android.systemui.statusbar.policy.ScrollAdapter; import com.android.systemui.statusbar.policy.ZenModeController; Loading Loading @@ -300,6 +302,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private boolean mExpandedInThisMotion; private boolean mShouldShowShelfOnly; protected boolean mScrollingEnabled; private boolean mIsCurrentUserSetup; protected FooterView mFooterView; protected EmptyShadeView mEmptyShadeView; private boolean mDismissAllInProgress; Loading Loading @@ -508,6 +511,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private final NotifPipeline mNotifPipeline; private final NotifCollection mNotifCollection; private final NotificationEntryManager mEntryManager; private final DeviceProvisionedController mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class); private final IStatusBarService mBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService(Context.STATUS_BAR_SERVICE)); @VisibleForTesting Loading Loading @@ -648,6 +653,29 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd }, HIGH_PRIORITY, Settings.Secure.NOTIFICATION_DISMISS_RTL, Settings.Secure.NOTIFICATION_HISTORY_ENABLED); mDeviceProvisionedController.addCallback( new DeviceProvisionedListener() { @Override public void onDeviceProvisionedChanged() { updateCurrentUserIsSetup(); } @Override public void onUserSwitched() { updateCurrentUserIsSetup(); } @Override public void onUserSetupChanged() { updateCurrentUserIsSetup(); } private void updateCurrentUserIsSetup() { setCurrentUserSetup(mDeviceProvisionedController.isCurrentUserSetup()); } }); mFeatureFlags = featureFlags; mNotifPipeline = notifPipeline; mEntryManager = entryManager; Loading Loading @@ -772,6 +800,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } boolean showDismissView = mClearAllEnabled && hasActiveClearableNotifications(ROWS_ALL); boolean showFooterView = (showDismissView || hasActiveNotifications()) && mIsCurrentUserSetup // see: b/193149550 && mStatusBarState != StatusBarState.KEYGUARD && !mRemoteInputManager.getController().isRemoteInputActive(); boolean showHistory = Settings.Secure.getIntForUser(mContext.getContentResolver(), Loading Loading @@ -5923,6 +5952,16 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd return MathUtils.smoothStep(0, totalDistance, dragDownAmount); } /** * Sets whether the current user is set up, which is required to show the footer (b/193149550) */ public void setCurrentUserSetup(boolean isCurrentUserSetup) { if (mIsCurrentUserSetup != isCurrentUserSetup) { mIsCurrentUserSetup = isCurrentUserSetup; updateFooter(); } } /** * A listener that is notified when the empty space below the notifications is clicked on */ Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +29 −4 Original line number Diff line number Diff line Loading @@ -110,8 +110,6 @@ import org.mockito.junit.MockitoRule; import java.util.ArrayList; import java.util.List; import dagger.Lazy; /** * Tests for {@link NotificationStackScrollLayout}. */ Loading Loading @@ -143,7 +141,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Mock private NotificationSection mNotificationSection; @Mock private NotificationLockscreenUserManager mLockscreenUserManager; @Mock private FeatureFlags mFeatureFlags; @Mock private Lazy<BubbleController> mBubbleControllerLazy; @Mock private BubbleController mBubbleController; private UserChangedListener mUserChangedListener; private NotificationEntryManager mEntryManager; private int mOriginalInterruptionModelSetting; Loading Loading @@ -194,7 +192,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { () -> mock(NotificationRowBinder.class), () -> mRemoteInputManager, mock(LeakDetector.class), mBubbleControllerLazy, () -> mBubbleController, mock(ForegroundServiceDismissalFeatureController.class) ); mEntryManager.setUpWithPresenter(mock(NotificationPresenter.class)); Loading Loading @@ -354,6 +352,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Test public void testUpdateFooter_noNotifications() { setBarStateForTest(StatusBarState.SHADE); mStackScroller.setCurrentUserSetup(true); assertEquals(0, mEntryManager.getActiveNotificationsCount()); FooterView view = mock(FooterView.class); Loading @@ -365,6 +364,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Test public void testUpdateFooter_remoteInput() { setBarStateForTest(StatusBarState.SHADE); mStackScroller.setCurrentUserSetup(true); ArrayList<NotificationEntry> entries = new ArrayList<>(); entries.add(new NotificationEntryBuilder().build()); addEntriesToEntryManager(entries); Loading @@ -384,6 +385,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Test public void testUpdateFooter_oneClearableNotification() { setBarStateForTest(StatusBarState.SHADE); mStackScroller.setCurrentUserSetup(true); ArrayList<NotificationEntry> entries = new ArrayList<>(); entries.add(new NotificationEntryBuilder().build()); Loading @@ -400,9 +402,30 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { verify(mStackScroller).updateFooterView(true, true, true); } @Test public void testUpdateFooter_oneClearableNotification_beforeUserSetup() { setBarStateForTest(StatusBarState.SHADE); mStackScroller.setCurrentUserSetup(false); ArrayList<NotificationEntry> entries = new ArrayList<>(); entries.add(new NotificationEntryBuilder().build()); addEntriesToEntryManager(entries); ExpandableNotificationRow row = mock(ExpandableNotificationRow.class); when(row.canViewBeDismissed()).thenReturn(true); when(mStackScroller.getChildCount()).thenReturn(1); when(mStackScroller.getChildAt(anyInt())).thenReturn(row); FooterView view = mock(FooterView.class); mStackScroller.setFooterView(view); mStackScroller.updateFooter(); verify(mStackScroller).updateFooterView(false, true, true); } @Test public void testUpdateFooter_oneNonClearableNotification() { setBarStateForTest(StatusBarState.SHADE); mStackScroller.setCurrentUserSetup(true); ArrayList<NotificationEntry> entries = new ArrayList<>(); entries.add(new NotificationEntryBuilder().build()); Loading @@ -416,6 +439,8 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { @Test public void testUpdateFooter_atEnd() { mStackScroller.setCurrentUserSetup(true); // add footer mStackScroller.inflateFooterView(); Loading