Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 502350b9 authored by Jeff DeCew's avatar Jeff DeCew
Browse files

Remove FILTER_UNSEEN_NOTIFS_ON_KEYGUARD flag

Test: atest SystemUITests
Fixes: 276962801
Change-Id: Id451d0adddf20a7f84793ca8ea62e9b9667bc3d0
parent c9b63089
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -93,9 +93,6 @@ object Flags {
    val NOTIFICATION_INLINE_REPLY_ANIMATION =
    val NOTIFICATION_INLINE_REPLY_ANIMATION =
        releasedFlag(174148361, "notification_inline_reply_animation")
        releasedFlag(174148361, "notification_inline_reply_animation")


    val FILTER_UNSEEN_NOTIFS_ON_KEYGUARD =
        releasedFlag(254647461, "filter_unseen_notifs_on_keyguard")

    // TODO(b/277338665): Tracking Bug
    // TODO(b/277338665): Tracking Bug
    @JvmField
    @JvmField
    val NOTIFICATION_SHELF_REFACTOR =
    val NOTIFICATION_SHELF_REFACTOR =
+0 −9
Original line number Original line Diff line number Diff line
@@ -33,21 +33,12 @@ class NotifPipelineFlags @Inject constructor(


    fun fsiOnDNDUpdate(): Boolean = featureFlags.isEnabled(Flags.FSI_ON_DND_UPDATE)
    fun fsiOnDNDUpdate(): Boolean = featureFlags.isEnabled(Flags.FSI_ON_DND_UPDATE)


    fun forceDemoteFsi(): Boolean =
            sysPropFlags.isEnabled(NotificationFlags.FSI_FORCE_DEMOTE)

    fun showStickyHunForDeniedFsi(): Boolean =
            sysPropFlags.isEnabled(NotificationFlags.SHOW_STICKY_HUN_FOR_DENIED_FSI)

    fun allowDismissOngoing(): Boolean =
    fun allowDismissOngoing(): Boolean =
            sysPropFlags.isEnabled(NotificationFlags.ALLOW_DISMISS_ONGOING)
            sysPropFlags.isEnabled(NotificationFlags.ALLOW_DISMISS_ONGOING)


    fun isOtpRedactionEnabled(): Boolean =
    fun isOtpRedactionEnabled(): Boolean =
            sysPropFlags.isEnabled(NotificationFlags.OTP_REDACTION)
            sysPropFlags.isEnabled(NotificationFlags.OTP_REDACTION)


    val shouldFilterUnseenNotifsOnKeyguard: Boolean
        get() = featureFlags.isEnabled(Flags.FILTER_UNSEEN_NOTIFS_ON_KEYGUARD)

    val isNoHunForOldWhenEnabled: Boolean
    val isNoHunForOldWhenEnabled: Boolean
        get() = featureFlags.isEnabled(Flags.NO_HUN_FOR_OLD_WHEN)
        get() = featureFlags.isEnabled(Flags.NO_HUN_FOR_OLD_WHEN)
}
}
+1 −3
Original line number Original line Diff line number Diff line
@@ -95,10 +95,8 @@ constructor(
        pipeline.addFinalizeFilter(notifFilter)
        pipeline.addFinalizeFilter(notifFilter)
        keyguardNotificationVisibilityProvider.addOnStateChangedListener(::invalidateListFromFilter)
        keyguardNotificationVisibilityProvider.addOnStateChangedListener(::invalidateListFromFilter)
        updateSectionHeadersVisibility()
        updateSectionHeadersVisibility()
        if (notifPipelineFlags.shouldFilterUnseenNotifsOnKeyguard) {
        attachUnseenFilter(pipeline)
        attachUnseenFilter(pipeline)
    }
    }
    }


    private fun attachUnseenFilter(pipeline: NotifPipeline) {
    private fun attachUnseenFilter(pipeline: NotifPipeline) {
        pipeline.addFinalizeFilter(unseenNotifFilter)
        pipeline.addFinalizeFilter(unseenNotifFilter)
+1 −2
Original line number Original line Diff line number Diff line
@@ -1942,8 +1942,7 @@ public class NotificationStackScrollLayoutController {
        public void setNotifStats(@NonNull NotifStats notifStats) {
        public void setNotifStats(@NonNull NotifStats notifStats) {
            mNotifStats = notifStats;
            mNotifStats = notifStats;
            mView.setHasFilteredOutSeenNotifications(
            mView.setHasFilteredOutSeenNotifications(
                    mNotifPipelineFlags.getShouldFilterUnseenNotifsOnKeyguard()
                    mSeenNotificationsProvider.getHasFilteredOutSeenNotifications());
                            && mSeenNotificationsProvider.getHasFilteredOutSeenNotifications());
            updateFooter();
            updateFooter();
            updateShowEmptyShadeView();
            updateShowEmptyShadeView();
        }
        }
+5 −32
Original line number Original line Diff line number Diff line
@@ -97,8 +97,6 @@ class KeyguardCoordinatorTest : SysuiTestCase() {


    @Test
    @Test
    fun unseenFilterSuppressesSeenNotifWhileKeyguardShowing() {
    fun unseenFilterSuppressesSeenNotifWhileKeyguardShowing() {
        whenever(notifPipelineFlags.shouldFilterUnseenNotifsOnKeyguard).thenReturn(true)

        // GIVEN: Keyguard is not showing, shade is expanded, and a notification is present
        // GIVEN: Keyguard is not showing, shade is expanded, and a notification is present
        keyguardRepository.setKeyguardShowing(false)
        keyguardRepository.setKeyguardShowing(false)
        whenever(statusBarStateController.isExpanded).thenReturn(true)
        whenever(statusBarStateController.isExpanded).thenReturn(true)
@@ -124,8 +122,6 @@ class KeyguardCoordinatorTest : SysuiTestCase() {


    @Test
    @Test
    fun unseenFilterStopsMarkingSeenNotifWhenTransitionToAod() {
    fun unseenFilterStopsMarkingSeenNotifWhenTransitionToAod() {
        whenever(notifPipelineFlags.shouldFilterUnseenNotifsOnKeyguard).thenReturn(true)

        // GIVEN: Keyguard is not showing, shade is not expanded, and a notification is present
        // GIVEN: Keyguard is not showing, shade is not expanded, and a notification is present
        keyguardRepository.setKeyguardShowing(false)
        keyguardRepository.setKeyguardShowing(false)
        whenever(statusBarStateController.isExpanded).thenReturn(false)
        whenever(statusBarStateController.isExpanded).thenReturn(false)
@@ -151,8 +147,6 @@ class KeyguardCoordinatorTest : SysuiTestCase() {


    @Test
    @Test
    fun unseenFilter_headsUpMarkedAsSeen() {
    fun unseenFilter_headsUpMarkedAsSeen() {
        whenever(notifPipelineFlags.shouldFilterUnseenNotifsOnKeyguard).thenReturn(true)

        // GIVEN: Keyguard is not showing, shade is not expanded
        // GIVEN: Keyguard is not showing, shade is not expanded
        keyguardRepository.setKeyguardShowing(false)
        keyguardRepository.setKeyguardShowing(false)
        whenever(statusBarStateController.isExpanded).thenReturn(false)
        whenever(statusBarStateController.isExpanded).thenReturn(false)
@@ -183,14 +177,12 @@ class KeyguardCoordinatorTest : SysuiTestCase() {


    @Test
    @Test
    fun unseenFilterDoesNotSuppressSeenOngoingNotifWhileKeyguardShowing() {
    fun unseenFilterDoesNotSuppressSeenOngoingNotifWhileKeyguardShowing() {
        whenever(notifPipelineFlags.shouldFilterUnseenNotifsOnKeyguard).thenReturn(true)

        // GIVEN: Keyguard is not showing, shade is expanded, and an ongoing notification is present
        // GIVEN: Keyguard is not showing, shade is expanded, and an ongoing notification is present
        keyguardRepository.setKeyguardShowing(false)
        keyguardRepository.setKeyguardShowing(false)
        whenever(statusBarStateController.isExpanded).thenReturn(true)
        whenever(statusBarStateController.isExpanded).thenReturn(true)
        runKeyguardCoordinatorTest {
        runKeyguardCoordinatorTest {
            val fakeEntry = NotificationEntryBuilder()
            val fakeEntry = NotificationEntryBuilder()
                .setNotification(Notification.Builder(mContext).setOngoing(true).build())
                    .setNotification(Notification.Builder(mContext, "id").setOngoing(true).build())
                .build()
                .build()
            collectionListener.onEntryAdded(fakeEntry)
            collectionListener.onEntryAdded(fakeEntry)


@@ -205,8 +197,6 @@ class KeyguardCoordinatorTest : SysuiTestCase() {


    @Test
    @Test
    fun unseenFilterDoesNotSuppressSeenMediaNotifWhileKeyguardShowing() {
    fun unseenFilterDoesNotSuppressSeenMediaNotifWhileKeyguardShowing() {
        whenever(notifPipelineFlags.shouldFilterUnseenNotifsOnKeyguard).thenReturn(true)

        // GIVEN: Keyguard is not showing, shade is expanded, and a media notification is present
        // GIVEN: Keyguard is not showing, shade is expanded, and a media notification is present
        keyguardRepository.setKeyguardShowing(false)
        keyguardRepository.setKeyguardShowing(false)
        whenever(statusBarStateController.isExpanded).thenReturn(true)
        whenever(statusBarStateController.isExpanded).thenReturn(true)
@@ -229,8 +219,6 @@ class KeyguardCoordinatorTest : SysuiTestCase() {


    @Test
    @Test
    fun unseenFilterUpdatesSeenProviderWhenSuppressing() {
    fun unseenFilterUpdatesSeenProviderWhenSuppressing() {
        whenever(notifPipelineFlags.shouldFilterUnseenNotifsOnKeyguard).thenReturn(true)

        // GIVEN: Keyguard is not showing, shade is expanded, and a notification is present
        // GIVEN: Keyguard is not showing, shade is expanded, and a notification is present
        keyguardRepository.setKeyguardShowing(false)
        keyguardRepository.setKeyguardShowing(false)
        whenever(statusBarStateController.isExpanded).thenReturn(true)
        whenever(statusBarStateController.isExpanded).thenReturn(true)
@@ -255,8 +243,6 @@ class KeyguardCoordinatorTest : SysuiTestCase() {


    @Test
    @Test
    fun unseenFilterInvalidatesWhenSettingChanges() {
    fun unseenFilterInvalidatesWhenSettingChanges() {
        whenever(notifPipelineFlags.shouldFilterUnseenNotifsOnKeyguard).thenReturn(true)

        // GIVEN: Keyguard is not showing, and shade is expanded
        // GIVEN: Keyguard is not showing, and shade is expanded
        keyguardRepository.setKeyguardShowing(false)
        keyguardRepository.setKeyguardShowing(false)
        whenever(statusBarStateController.isExpanded).thenReturn(true)
        whenever(statusBarStateController.isExpanded).thenReturn(true)
@@ -292,8 +278,6 @@ class KeyguardCoordinatorTest : SysuiTestCase() {


    @Test
    @Test
    fun unseenFilterAllowsNewNotif() {
    fun unseenFilterAllowsNewNotif() {
        whenever(notifPipelineFlags.shouldFilterUnseenNotifsOnKeyguard).thenReturn(true)

        // GIVEN: Keyguard is showing, no notifications present
        // GIVEN: Keyguard is showing, no notifications present
        keyguardRepository.setKeyguardShowing(true)
        keyguardRepository.setKeyguardShowing(true)
        runKeyguardCoordinatorTest {
        runKeyguardCoordinatorTest {
@@ -308,8 +292,6 @@ class KeyguardCoordinatorTest : SysuiTestCase() {


    @Test
    @Test
    fun unseenFilterSeenGroupSummaryWithUnseenChild() {
    fun unseenFilterSeenGroupSummaryWithUnseenChild() {
        whenever(notifPipelineFlags.shouldFilterUnseenNotifsOnKeyguard).thenReturn(true)

        // GIVEN: Keyguard is not showing, shade is expanded, and a notification is present
        // GIVEN: Keyguard is not showing, shade is expanded, and a notification is present
        keyguardRepository.setKeyguardShowing(false)
        keyguardRepository.setKeyguardShowing(false)
        whenever(statusBarStateController.isExpanded).thenReturn(true)
        whenever(statusBarStateController.isExpanded).thenReturn(true)
@@ -342,8 +324,6 @@ class KeyguardCoordinatorTest : SysuiTestCase() {


    @Test
    @Test
    fun unseenNotificationIsMarkedAsSeenWhenKeyguardGoesAway() {
    fun unseenNotificationIsMarkedAsSeenWhenKeyguardGoesAway() {
        whenever(notifPipelineFlags.shouldFilterUnseenNotifsOnKeyguard).thenReturn(true)

        // GIVEN: Keyguard is showing, not dozing, unseen notification is present
        // GIVEN: Keyguard is showing, not dozing, unseen notification is present
        keyguardRepository.setKeyguardShowing(true)
        keyguardRepository.setKeyguardShowing(true)
        keyguardRepository.setDozing(false)
        keyguardRepository.setDozing(false)
@@ -370,8 +350,6 @@ class KeyguardCoordinatorTest : SysuiTestCase() {


    @Test
    @Test
    fun unseenNotificationIsNotMarkedAsSeenIfShadeNotExpanded() {
    fun unseenNotificationIsNotMarkedAsSeenIfShadeNotExpanded() {
        whenever(notifPipelineFlags.shouldFilterUnseenNotifsOnKeyguard).thenReturn(true)

        // GIVEN: Keyguard is showing, unseen notification is present
        // GIVEN: Keyguard is showing, unseen notification is present
        keyguardRepository.setKeyguardShowing(true)
        keyguardRepository.setKeyguardShowing(true)
        runKeyguardCoordinatorTest {
        runKeyguardCoordinatorTest {
@@ -441,20 +419,15 @@ class KeyguardCoordinatorTest : SysuiTestCase() {
        val unseenFilter: NotifFilter
        val unseenFilter: NotifFilter
            get() = keyguardCoordinator.unseenNotifFilter
            get() = keyguardCoordinator.unseenNotifFilter


        // TODO(254647461): Remove lazy from these properties once
        val collectionListener: NotifCollectionListener = withArgCaptor {
        //    Flags.FILTER_UNSEEN_NOTIFS_ON_KEYGUARD is enabled and removed
            verify(notifPipeline).addCollectionListener(capture())

        val collectionListener: NotifCollectionListener by lazy {
            withArgCaptor { verify(notifPipeline).addCollectionListener(capture()) }
        }
        }


        val onHeadsUpChangedListener: OnHeadsUpChangedListener by lazy {
        val onHeadsUpChangedListener: OnHeadsUpChangedListener get() =
            withArgCaptor { verify(headsUpManager).addListener(capture()) }
            withArgCaptor { verify(headsUpManager).addListener(capture()) }
        }


        val statusBarStateListener: StatusBarStateController.StateListener by lazy {
        val statusBarStateListener: StatusBarStateController.StateListener get() =
            withArgCaptor { verify(statusBarStateController).addCallback(capture()) }
            withArgCaptor { verify(statusBarStateController).addCallback(capture()) }
        }


        var showOnlyUnseenNotifsOnKeyguardSetting: Boolean
        var showOnlyUnseenNotifsOnKeyguardSetting: Boolean
            get() =
            get() =
Loading