Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/SectionStyleProviderTest.kt +17 −21 Original line number Original line Diff line number Diff line Loading @@ -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.collection.provider.SectionStyleProvider import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow 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_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_PEOPLE import com.android.systemui.statusbar.notification.stack.BUCKET_SILENT 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.android.systemui.util.mockito.mock import com.google.common.collect.ImmutableList import com.google.common.collect.ImmutableList import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertThat Loading @@ -42,9 +39,8 @@ import org.junit.Rule import org.junit.Test import org.junit.Test import org.junit.runner.RunWith import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations import org.mockito.Mockito.`when` as whenever import org.mockito.Mockito.`when` as whenever import org.mockito.MockitoAnnotations @SmallTest @SmallTest @RunWith(AndroidJUnit4::class) @RunWith(AndroidJUnit4::class) Loading @@ -65,9 +61,9 @@ class SectionStyleProviderTest : SysuiTestCase() { MockitoAnnotations.initMocks(this) MockitoAnnotations.initMocks(this) sectionStyleProvider = SectionStyleProvider(highPriorityProvider) sectionStyleProvider = SectionStyleProvider(highPriorityProvider) whenever(peopleMixedSectioner.bucket).thenReturn(BUCKET_PEOPLE); whenever(peopleMixedSectioner.bucket).thenReturn(BUCKET_PEOPLE) whenever(allSilentSectioner.bucket).thenReturn(BUCKET_SILENT); whenever(allSilentSectioner.bucket).thenReturn(BUCKET_SILENT) whenever(allAlertingSectioner.bucket).thenReturn(BUCKET_ALERTING); whenever(allAlertingSectioner.bucket).thenReturn(BUCKET_ALERTING) sectionStyleProvider.setSilentSections(ImmutableList.of(allSilentSectioner)) sectionStyleProvider.setSilentSections(ImmutableList.of(allSilentSectioner)) } } Loading Loading @@ -103,19 +99,19 @@ class SectionStyleProviderTest : SysuiTestCase() { } } private fun fakeNotification(inputSectioner: NotifSectioner): ListEntry { private fun fakeNotification(inputSectioner: NotifSectioner): ListEntry { val mockUserHandle = val mockUserHandle = mock<UserHandle>().apply { whenever(identifier).thenReturn(0) } mock<UserHandle>().apply { whenever(identifier).thenReturn(0) } val mockSbn: StatusBarNotification = val mockSbn: StatusBarNotification = mock<StatusBarNotification>().apply { whenever(user).thenReturn(mockUserHandle) } mock<StatusBarNotification>().apply { whenever(user).thenReturn(mockUserHandle) } val mockRow: ExpandableNotificationRow = mock<ExpandableNotificationRow>() val mockRow: ExpandableNotificationRow = mock<ExpandableNotificationRow>() val mockEntry = mock<NotificationEntry>().apply { val mockEntry = mock<NotificationEntry>().apply { whenever(sbn).thenReturn(mockSbn) whenever(sbn).thenReturn(mockSbn) whenever(row).thenReturn(mockRow) whenever(row).thenReturn(mockRow) } } whenever(mockEntry.rowExists()).thenReturn(true) whenever(mockEntry.rowExists()).thenReturn(true) return object : ListEntry("key", 0) { return object : ListEntry("key", 0) { override fun getRepresentativeEntry(): NotificationEntry = mockEntry override val representativeEntry: NotificationEntry = mockEntry override fun getSection(): NotifSection? = NotifSection(inputSectioner, 1) } } .apply { attachState.section = NotifSection(inputSectioner, 1) } } } } } packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt +8 −8 Original line number Original line Diff line number Diff line Loading @@ -312,7 +312,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC val entry = fakeNotification(1, false) val entry = fakeNotification(1, false) whenever( whenever( sensitiveNotificationProtectionController.shouldProtectNotification( sensitiveNotificationProtectionController.shouldProtectNotification( entry.getRepresentativeEntry() entry.representativeEntry ) ) ) ) .thenReturn(true) .thenReturn(true) Loading Loading @@ -387,7 +387,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC val entry = fakeNotification(1, true) val entry = fakeNotification(1, true) whenever( whenever( sensitiveNotificationProtectionController.shouldProtectNotification( sensitiveNotificationProtectionController.shouldProtectNotification( entry.getRepresentativeEntry() entry.representativeEntry ) ) ) ) .thenReturn(true) .thenReturn(true) Loading Loading @@ -462,7 +462,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC val entry = fakeNotification(1, false) val entry = fakeNotification(1, false) whenever( whenever( sensitiveNotificationProtectionController.shouldProtectNotification( sensitiveNotificationProtectionController.shouldProtectNotification( entry.getRepresentativeEntry() entry.representativeEntry ) ) ) ) .thenReturn(true) .thenReturn(true) Loading Loading @@ -539,7 +539,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC val entry = fakeNotification(1, false) val entry = fakeNotification(1, false) whenever( whenever( sensitiveNotificationProtectionController.shouldProtectNotification( sensitiveNotificationProtectionController.shouldProtectNotification( entry.getRepresentativeEntry() entry.representativeEntry ) ) ) ) .thenReturn(true) .thenReturn(true) Loading Loading @@ -614,7 +614,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC val entry = fakeNotification(1, true) val entry = fakeNotification(1, true) whenever( whenever( sensitiveNotificationProtectionController.shouldProtectNotification( sensitiveNotificationProtectionController.shouldProtectNotification( entry.getRepresentativeEntry() entry.representativeEntry ) ) ) ) .thenReturn(true) .thenReturn(true) Loading Loading @@ -690,7 +690,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC val entry = fakeNotification(1, true) val entry = fakeNotification(1, true) whenever( whenever( sensitiveNotificationProtectionController.shouldProtectNotification( sensitiveNotificationProtectionController.shouldProtectNotification( entry.getRepresentativeEntry() entry.representativeEntry ) ) ) ) .thenReturn(true) .thenReturn(true) Loading Loading @@ -769,7 +769,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC val entry = fakeNotification(2, true) val entry = fakeNotification(2, true) whenever( whenever( sensitiveNotificationProtectionController.shouldProtectNotification( sensitiveNotificationProtectionController.shouldProtectNotification( entry.getRepresentativeEntry() entry.representativeEntry ) ) ) ) .thenReturn(true) .thenReturn(true) Loading Loading @@ -848,7 +848,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC whenever(lockscreenUserManager.getRedactionType(mockEntry)).thenReturn(redactionType) whenever(lockscreenUserManager.getRedactionType(mockEntry)).thenReturn(redactionType) whenever(mockEntry.rowExists()).thenReturn(true) whenever(mockEntry.rowExists()).thenReturn(true) return object : ListEntry("key", 0) { return object : ListEntry("key", 0) { override fun getRepresentativeEntry(): NotificationEntry = mockEntry override val representativeEntry: NotificationEntry = mockEntry } } } } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.kt +9 −4 Original line number Original line Diff line number Diff line Loading @@ -23,6 +23,11 @@ import com.android.systemui.statusbar.notification.collection.PipelineEntry val PipelineEntry?.logKey: String? val PipelineEntry?.logKey: String? get() = this?.let { NotificationUtils.logKey(it) } get() = this?.let { NotificationUtils.logKey(it) } /** Get the notification key, reformatted for logging, for the entry */ @get:JvmName("getLogKeyNonNull") val PipelineEntry.logKey: String get() = NotificationUtils.logKey(this) /** Get the notification key, reformatted for logging, for the (optional) sbn */ /** Get the notification key, reformatted for logging, for the (optional) sbn */ val StatusBarNotification?.logKey: String? val StatusBarNotification?.logKey: String? get() = this?.key?.let { NotificationUtils.logKey(it) } get() = this?.key?.let { NotificationUtils.logKey(it) } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntry.kt +0 −4 Original line number Original line Diff line number Diff line Loading @@ -54,10 +54,6 @@ class BundleEntry(spec: BundleSpec) : PipelineEntry(spec.key) { return null return null } } override fun getParent(): PipelineEntry? { return null } override fun wasAttachedInPreviousPass(): Boolean { override fun wasAttachedInPreviousPass(): Boolean { return false return false } } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapter.kt +2 −2 Original line number Original line Diff line number Diff line Loading @@ -205,13 +205,13 @@ class BundleEntryAdapter( } } override fun addOnSensitivityChangedListener( override fun addOnSensitivityChangedListener( listener: PipelineEntry.OnSensitivityChangedListener? listener: PipelineEntry.OnSensitivityChangedListener ) { ) { entry.addOnSensitivityChangedListener(listener) entry.addOnSensitivityChangedListener(listener) } } override fun removeOnSensitivityChangedListener( override fun removeOnSensitivityChangedListener( listener: PipelineEntry.OnSensitivityChangedListener? listener: PipelineEntry.OnSensitivityChangedListener ) { ) { entry.removeOnSensitivityChangedListener(listener) entry.removeOnSensitivityChangedListener(listener) } } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/SectionStyleProviderTest.kt +17 −21 Original line number Original line Diff line number Diff line Loading @@ -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.collection.provider.SectionStyleProvider import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow 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_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_PEOPLE import com.android.systemui.statusbar.notification.stack.BUCKET_SILENT 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.android.systemui.util.mockito.mock import com.google.common.collect.ImmutableList import com.google.common.collect.ImmutableList import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertThat Loading @@ -42,9 +39,8 @@ import org.junit.Rule import org.junit.Test import org.junit.Test import org.junit.runner.RunWith import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mock import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations import org.mockito.Mockito.`when` as whenever import org.mockito.Mockito.`when` as whenever import org.mockito.MockitoAnnotations @SmallTest @SmallTest @RunWith(AndroidJUnit4::class) @RunWith(AndroidJUnit4::class) Loading @@ -65,9 +61,9 @@ class SectionStyleProviderTest : SysuiTestCase() { MockitoAnnotations.initMocks(this) MockitoAnnotations.initMocks(this) sectionStyleProvider = SectionStyleProvider(highPriorityProvider) sectionStyleProvider = SectionStyleProvider(highPriorityProvider) whenever(peopleMixedSectioner.bucket).thenReturn(BUCKET_PEOPLE); whenever(peopleMixedSectioner.bucket).thenReturn(BUCKET_PEOPLE) whenever(allSilentSectioner.bucket).thenReturn(BUCKET_SILENT); whenever(allSilentSectioner.bucket).thenReturn(BUCKET_SILENT) whenever(allAlertingSectioner.bucket).thenReturn(BUCKET_ALERTING); whenever(allAlertingSectioner.bucket).thenReturn(BUCKET_ALERTING) sectionStyleProvider.setSilentSections(ImmutableList.of(allSilentSectioner)) sectionStyleProvider.setSilentSections(ImmutableList.of(allSilentSectioner)) } } Loading Loading @@ -103,19 +99,19 @@ class SectionStyleProviderTest : SysuiTestCase() { } } private fun fakeNotification(inputSectioner: NotifSectioner): ListEntry { private fun fakeNotification(inputSectioner: NotifSectioner): ListEntry { val mockUserHandle = val mockUserHandle = mock<UserHandle>().apply { whenever(identifier).thenReturn(0) } mock<UserHandle>().apply { whenever(identifier).thenReturn(0) } val mockSbn: StatusBarNotification = val mockSbn: StatusBarNotification = mock<StatusBarNotification>().apply { whenever(user).thenReturn(mockUserHandle) } mock<StatusBarNotification>().apply { whenever(user).thenReturn(mockUserHandle) } val mockRow: ExpandableNotificationRow = mock<ExpandableNotificationRow>() val mockRow: ExpandableNotificationRow = mock<ExpandableNotificationRow>() val mockEntry = mock<NotificationEntry>().apply { val mockEntry = mock<NotificationEntry>().apply { whenever(sbn).thenReturn(mockSbn) whenever(sbn).thenReturn(mockSbn) whenever(row).thenReturn(mockRow) whenever(row).thenReturn(mockRow) } } whenever(mockEntry.rowExists()).thenReturn(true) whenever(mockEntry.rowExists()).thenReturn(true) return object : ListEntry("key", 0) { return object : ListEntry("key", 0) { override fun getRepresentativeEntry(): NotificationEntry = mockEntry override val representativeEntry: NotificationEntry = mockEntry override fun getSection(): NotifSection? = NotifSection(inputSectioner, 1) } } .apply { attachState.section = NotifSection(inputSectioner, 1) } } } } }
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt +8 −8 Original line number Original line Diff line number Diff line Loading @@ -312,7 +312,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC val entry = fakeNotification(1, false) val entry = fakeNotification(1, false) whenever( whenever( sensitiveNotificationProtectionController.shouldProtectNotification( sensitiveNotificationProtectionController.shouldProtectNotification( entry.getRepresentativeEntry() entry.representativeEntry ) ) ) ) .thenReturn(true) .thenReturn(true) Loading Loading @@ -387,7 +387,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC val entry = fakeNotification(1, true) val entry = fakeNotification(1, true) whenever( whenever( sensitiveNotificationProtectionController.shouldProtectNotification( sensitiveNotificationProtectionController.shouldProtectNotification( entry.getRepresentativeEntry() entry.representativeEntry ) ) ) ) .thenReturn(true) .thenReturn(true) Loading Loading @@ -462,7 +462,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC val entry = fakeNotification(1, false) val entry = fakeNotification(1, false) whenever( whenever( sensitiveNotificationProtectionController.shouldProtectNotification( sensitiveNotificationProtectionController.shouldProtectNotification( entry.getRepresentativeEntry() entry.representativeEntry ) ) ) ) .thenReturn(true) .thenReturn(true) Loading Loading @@ -539,7 +539,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC val entry = fakeNotification(1, false) val entry = fakeNotification(1, false) whenever( whenever( sensitiveNotificationProtectionController.shouldProtectNotification( sensitiveNotificationProtectionController.shouldProtectNotification( entry.getRepresentativeEntry() entry.representativeEntry ) ) ) ) .thenReturn(true) .thenReturn(true) Loading Loading @@ -614,7 +614,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC val entry = fakeNotification(1, true) val entry = fakeNotification(1, true) whenever( whenever( sensitiveNotificationProtectionController.shouldProtectNotification( sensitiveNotificationProtectionController.shouldProtectNotification( entry.getRepresentativeEntry() entry.representativeEntry ) ) ) ) .thenReturn(true) .thenReturn(true) Loading Loading @@ -690,7 +690,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC val entry = fakeNotification(1, true) val entry = fakeNotification(1, true) whenever( whenever( sensitiveNotificationProtectionController.shouldProtectNotification( sensitiveNotificationProtectionController.shouldProtectNotification( entry.getRepresentativeEntry() entry.representativeEntry ) ) ) ) .thenReturn(true) .thenReturn(true) Loading Loading @@ -769,7 +769,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC val entry = fakeNotification(2, true) val entry = fakeNotification(2, true) whenever( whenever( sensitiveNotificationProtectionController.shouldProtectNotification( sensitiveNotificationProtectionController.shouldProtectNotification( entry.getRepresentativeEntry() entry.representativeEntry ) ) ) ) .thenReturn(true) .thenReturn(true) Loading Loading @@ -848,7 +848,7 @@ class SensitiveContentCoordinatorTest(flags: FlagsParameterization) : SysuiTestC whenever(lockscreenUserManager.getRedactionType(mockEntry)).thenReturn(redactionType) whenever(lockscreenUserManager.getRedactionType(mockEntry)).thenReturn(redactionType) whenever(mockEntry.rowExists()).thenReturn(true) whenever(mockEntry.rowExists()).thenReturn(true) return object : ListEntry("key", 0) { return object : ListEntry("key", 0) { override fun getRepresentativeEntry(): NotificationEntry = mockEntry override val representativeEntry: NotificationEntry = mockEntry } } } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.kt +9 −4 Original line number Original line Diff line number Diff line Loading @@ -23,6 +23,11 @@ import com.android.systemui.statusbar.notification.collection.PipelineEntry val PipelineEntry?.logKey: String? val PipelineEntry?.logKey: String? get() = this?.let { NotificationUtils.logKey(it) } get() = this?.let { NotificationUtils.logKey(it) } /** Get the notification key, reformatted for logging, for the entry */ @get:JvmName("getLogKeyNonNull") val PipelineEntry.logKey: String get() = NotificationUtils.logKey(this) /** Get the notification key, reformatted for logging, for the (optional) sbn */ /** Get the notification key, reformatted for logging, for the (optional) sbn */ val StatusBarNotification?.logKey: String? val StatusBarNotification?.logKey: String? get() = this?.key?.let { NotificationUtils.logKey(it) } get() = this?.key?.let { NotificationUtils.logKey(it) } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntry.kt +0 −4 Original line number Original line Diff line number Diff line Loading @@ -54,10 +54,6 @@ class BundleEntry(spec: BundleSpec) : PipelineEntry(spec.key) { return null return null } } override fun getParent(): PipelineEntry? { return null } override fun wasAttachedInPreviousPass(): Boolean { override fun wasAttachedInPreviousPass(): Boolean { return false return false } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapter.kt +2 −2 Original line number Original line Diff line number Diff line Loading @@ -205,13 +205,13 @@ class BundleEntryAdapter( } } override fun addOnSensitivityChangedListener( override fun addOnSensitivityChangedListener( listener: PipelineEntry.OnSensitivityChangedListener? listener: PipelineEntry.OnSensitivityChangedListener ) { ) { entry.addOnSensitivityChangedListener(listener) entry.addOnSensitivityChangedListener(listener) } } override fun removeOnSensitivityChangedListener( override fun removeOnSensitivityChangedListener( listener: PipelineEntry.OnSensitivityChangedListener? listener: PipelineEntry.OnSensitivityChangedListener ) { ) { entry.removeOnSensitivityChangedListener(listener) entry.removeOnSensitivityChangedListener(listener) } } Loading