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

Commit f313caf8 authored by Steve Elliott's avatar Steve Elliott
Browse files

PipelineEntry sealed class

Bug: 399736937
Test: make
Test: atest SystemUITests
Flag: com.android.systemui.notification_bundle_ui
Change-Id: Ie1e07c136026129fca9d47314ad786e097f9d262
parent a547cf76
Loading
Loading
Loading
Loading
+17 −21
Original line number Diff line number Diff line
@@ -29,11 +29,8 @@ import com.android.systemui.statusbar.notification.collection.provider.HighPrior
import com.android.systemui.statusbar.notification.collection.provider.SectionStyleProvider
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.stack.BUCKET_ALERTING
import com.android.systemui.statusbar.notification.stack.BUCKET_FOREGROUND_SERVICE
import com.android.systemui.statusbar.notification.stack.BUCKET_PEOPLE
import com.android.systemui.statusbar.notification.stack.BUCKET_SILENT
import com.android.systemui.statusbar.notification.stack.BUCKET_UNKNOWN
import com.android.systemui.util.mockito.any
import com.android.systemui.util.mockito.mock
import com.google.common.collect.ImmutableList
import com.google.common.truth.Truth.assertThat
@@ -42,9 +39,8 @@ import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock
import org.mockito.Mockito.verify
import org.mockito.MockitoAnnotations
import org.mockito.Mockito.`when` as whenever
import org.mockito.MockitoAnnotations

@SmallTest
@RunWith(AndroidJUnit4::class)
@@ -65,9 +61,9 @@ class SectionStyleProviderTest : SysuiTestCase() {
        MockitoAnnotations.initMocks(this)
        sectionStyleProvider = SectionStyleProvider(highPriorityProvider)

        whenever(peopleMixedSectioner.bucket).thenReturn(BUCKET_PEOPLE);
        whenever(allSilentSectioner.bucket).thenReturn(BUCKET_SILENT);
        whenever(allAlertingSectioner.bucket).thenReturn(BUCKET_ALERTING);
        whenever(peopleMixedSectioner.bucket).thenReturn(BUCKET_PEOPLE)
        whenever(allSilentSectioner.bucket).thenReturn(BUCKET_SILENT)
        whenever(allAlertingSectioner.bucket).thenReturn(BUCKET_ALERTING)

        sectionStyleProvider.setSilentSections(ImmutableList.of(allSilentSectioner))
    }
@@ -103,19 +99,19 @@ class SectionStyleProviderTest : SysuiTestCase() {
    }

    private fun fakeNotification(inputSectioner: NotifSectioner): ListEntry {
        val mockUserHandle =
                mock<UserHandle>().apply { whenever(identifier).thenReturn(0) }
        val mockUserHandle = mock<UserHandle>().apply { whenever(identifier).thenReturn(0) }
        val mockSbn: StatusBarNotification =
            mock<StatusBarNotification>().apply { whenever(user).thenReturn(mockUserHandle) }
        val mockRow: ExpandableNotificationRow = mock<ExpandableNotificationRow>()
        val mockEntry = mock<NotificationEntry>().apply {
        val mockEntry =
            mock<NotificationEntry>().apply {
                whenever(sbn).thenReturn(mockSbn)
                whenever(row).thenReturn(mockRow)
            }
        whenever(mockEntry.rowExists()).thenReturn(true)
        return object : ListEntry("key", 0) {
            override fun getRepresentativeEntry(): NotificationEntry = mockEntry
            override fun getSection(): NotifSection? = NotifSection(inputSectioner, 1)
                override val representativeEntry: NotificationEntry = mockEntry
            }
            .apply { attachState.section = NotifSection(inputSectioner, 1) }
    }
}
+8 −8
Original line number Diff line number Diff line
@@ -312,7 +312,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC
            val entry = fakeNotification(1, false)
            whenever(
                    sensitiveNotificationProtectionController.shouldProtectNotification(
                        entry.getRepresentativeEntry()
                        entry.representativeEntry
                    )
                )
                .thenReturn(true)
@@ -387,7 +387,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC
            val entry = fakeNotification(1, true)
            whenever(
                    sensitiveNotificationProtectionController.shouldProtectNotification(
                        entry.getRepresentativeEntry()
                        entry.representativeEntry
                    )
                )
                .thenReturn(true)
@@ -462,7 +462,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC
            val entry = fakeNotification(1, false)
            whenever(
                    sensitiveNotificationProtectionController.shouldProtectNotification(
                        entry.getRepresentativeEntry()
                        entry.representativeEntry
                    )
                )
                .thenReturn(true)
@@ -539,7 +539,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC
            val entry = fakeNotification(1, false)
            whenever(
                    sensitiveNotificationProtectionController.shouldProtectNotification(
                        entry.getRepresentativeEntry()
                        entry.representativeEntry
                    )
                )
                .thenReturn(true)
@@ -614,7 +614,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC
            val entry = fakeNotification(1, true)
            whenever(
                    sensitiveNotificationProtectionController.shouldProtectNotification(
                        entry.getRepresentativeEntry()
                        entry.representativeEntry
                    )
                )
                .thenReturn(true)
@@ -690,7 +690,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC
            val entry = fakeNotification(1, true)
            whenever(
                    sensitiveNotificationProtectionController.shouldProtectNotification(
                        entry.getRepresentativeEntry()
                        entry.representativeEntry
                    )
                )
                .thenReturn(true)
@@ -769,7 +769,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC
            val entry = fakeNotification(2, true)
            whenever(
                    sensitiveNotificationProtectionController.shouldProtectNotification(
                        entry.getRepresentativeEntry()
                        entry.representativeEntry
                    )
                )
                .thenReturn(true)
@@ -848,7 +848,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC
        whenever(lockscreenUserManager.getRedactionType(mockEntry)).thenReturn(redactionType)
        whenever(mockEntry.rowExists()).thenReturn(true)
        return object : ListEntry("key", 0) {
            override fun getRepresentativeEntry(): NotificationEntry = mockEntry
            override val representativeEntry: NotificationEntry = mockEntry
        }
    }

+0 −4
Original line number Diff line number Diff line
@@ -54,10 +54,6 @@ class BundleEntry(spec: BundleSpec) : PipelineEntry(spec.key) {
        return null
    }

    override fun getParent(): PipelineEntry? {
        return null
    }

    override fun wasAttachedInPreviousPass(): Boolean {
        return false
    }
+2 −2
Original line number Diff line number Diff line
@@ -205,13 +205,13 @@ class BundleEntryAdapter(
    }

    override fun addOnSensitivityChangedListener(
        listener: PipelineEntry.OnSensitivityChangedListener?
        listener: PipelineEntry.OnSensitivityChangedListener
    ) {
        entry.addOnSensitivityChangedListener(listener)
    }

    override fun removeOnSensitivityChangedListener(
        listener: PipelineEntry.OnSensitivityChangedListener?
        listener: PipelineEntry.OnSensitivityChangedListener
    ) {
        entry.removeOnSensitivityChangedListener(listener)
    }
+2 −2
Original line number Diff line number Diff line
@@ -208,11 +208,11 @@ public interface EntryAdapter {

    /** Add a listener to be notified when the entry's sensitivity changes. */
    void addOnSensitivityChangedListener(
            PipelineEntry.OnSensitivityChangedListener listener);
            @NonNull PipelineEntry.OnSensitivityChangedListener listener);

    /** Remove a listener that was registered above. */
    void removeOnSensitivityChangedListener(
            PipelineEntry.OnSensitivityChangedListener listener);
            @NonNull PipelineEntry.OnSensitivityChangedListener listener);

    void setSeenInShade(boolean seen);

Loading