Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapterTest.kt +10 −20 Original line number Diff line number Diff line Loading @@ -37,7 +37,10 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) @RunWithLooper @EnableFlags(NotificationBundleUi.FLAG_NAME) class BundleEntryAdapterTest : SysuiTestCase() { private lateinit var entry: BundleEntry private val kosmos = testKosmos() private lateinit var underTest: BundleEntryAdapter Loading @@ -46,120 +49,107 @@ class BundleEntryAdapterTest : SysuiTestCase() { @Before fun setUp() { underTest = factory.create(BundleEntry("key")) as BundleEntryAdapter entry = BundleEntry("key") underTest = factory.create(entry) as BundleEntryAdapter } @Test fun getBackingHashCode() { assertThat(underTest.backingHashCode).isEqualTo(entry.hashCode()) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getParent_adapter() { assertThat(underTest.parent).isEqualTo(GroupEntry.ROOT_ENTRY) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isTopLevelEntry_adapter() { assertThat(underTest.isTopLevelEntry).isTrue() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getRow_adapter() { assertThat(underTest.row).isNull() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_adapter() { assertThat(underTest.isGroupRoot).isTrue() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getKey_adapter() { assertThat(underTest.key).isEqualTo("key") } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isClearable_adapter() { assertThat(underTest.isClearable).isTrue() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getSummarization_adapter() { assertThat(underTest.summarization).isNull() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getContrastedColor_adapter() { assertThat(underTest.getContrastedColor(context, false, Color.WHITE)) .isEqualTo(Notification.COLOR_DEFAULT) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun canPeek_adapter() { assertThat(underTest.canPeek()).isFalse() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getWhen_adapter() { assertThat(underTest.`when`).isEqualTo(0) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isColorized() { assertThat(underTest.isColorized).isFalse() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getSbn() { assertThat(underTest.sbn).isNull() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun canDragAndDrop() { assertThat(underTest.canDragAndDrop()).isFalse() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isBubble() { assertThat(underTest.isBubble).isFalse() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getStyle() { assertThat(underTest.style).isNull() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getSectionBucket() { assertThat(underTest.sectionBucket).isEqualTo(underTest.entry.bucket) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isAmbient() { assertThat(underTest.isAmbient).isFalse() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun canShowFullScreen() { assertThat(underTest.isFullScreenCapable()).isFalse() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getPeopleNotificationType() { assertThat(underTest.getPeopleNotificationType()).isEqualTo(TYPE_NON_PERSON) } Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifCollectionTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -1804,7 +1804,8 @@ public class NotifCollectionTest extends SysuiTestCase { } private static EntryWithDismissStats entryWithDefaultStats(NotificationEntry entry) { return new EntryWithDismissStats(entry, defaultStats(entry)); return new EntryWithDismissStats( entry, defaultStats(entry), entry.getKey(), entry.hashCode()); } private CollectionEvent postNotif(NotificationEntryBuilder builder) { Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryAdapterTest.kt +11 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,17 @@ class NotificationEntryAdapterTest : SysuiTestCase() { @get:Rule val setFlagsRule = SetFlagsRule() @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getBackingHashCode() { val entry = NotificationEntryBuilder() .build() underTest = factory.create(entry) as NotificationEntryAdapter assertThat(underTest.backingHashCode).isEqualTo(entry.hashCode()) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getParent_adapter() { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapter.kt +5 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,11 @@ class BundleEntryAdapter( private val highPriorityProvider: HighPriorityProvider, val entry: BundleEntry, ) : EntryAdapter { override fun getBackingHashCode(): Int { return entry.hashCode() } /** TODO (b/394483200): convert to PipelineEntry.ROOT_ENTRY when pipeline is migrated? */ override fun getParent(): GroupEntry { return GroupEntry.ROOT_ENTRY Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/EntryAdapter.java +6 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,11 @@ import kotlinx.coroutines.flow.StateFlow; */ public interface EntryAdapter { /** * Returns the hash code of the backing entry */ int getBackingHashCode(); /** * Gets the parent of this entry, or null if the entry's view is not attached */ Loading Loading @@ -195,5 +200,6 @@ public interface EntryAdapter { NotificationEntry.DismissState getDismissState(); void onEntryClicked(ExpandableNotificationRow row); } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapterTest.kt +10 −20 Original line number Diff line number Diff line Loading @@ -37,7 +37,10 @@ import org.junit.runner.RunWith @SmallTest @RunWith(AndroidJUnit4::class) @RunWithLooper @EnableFlags(NotificationBundleUi.FLAG_NAME) class BundleEntryAdapterTest : SysuiTestCase() { private lateinit var entry: BundleEntry private val kosmos = testKosmos() private lateinit var underTest: BundleEntryAdapter Loading @@ -46,120 +49,107 @@ class BundleEntryAdapterTest : SysuiTestCase() { @Before fun setUp() { underTest = factory.create(BundleEntry("key")) as BundleEntryAdapter entry = BundleEntry("key") underTest = factory.create(entry) as BundleEntryAdapter } @Test fun getBackingHashCode() { assertThat(underTest.backingHashCode).isEqualTo(entry.hashCode()) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getParent_adapter() { assertThat(underTest.parent).isEqualTo(GroupEntry.ROOT_ENTRY) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isTopLevelEntry_adapter() { assertThat(underTest.isTopLevelEntry).isTrue() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getRow_adapter() { assertThat(underTest.row).isNull() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_adapter() { assertThat(underTest.isGroupRoot).isTrue() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getKey_adapter() { assertThat(underTest.key).isEqualTo("key") } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isClearable_adapter() { assertThat(underTest.isClearable).isTrue() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getSummarization_adapter() { assertThat(underTest.summarization).isNull() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getContrastedColor_adapter() { assertThat(underTest.getContrastedColor(context, false, Color.WHITE)) .isEqualTo(Notification.COLOR_DEFAULT) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun canPeek_adapter() { assertThat(underTest.canPeek()).isFalse() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getWhen_adapter() { assertThat(underTest.`when`).isEqualTo(0) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isColorized() { assertThat(underTest.isColorized).isFalse() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getSbn() { assertThat(underTest.sbn).isNull() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun canDragAndDrop() { assertThat(underTest.canDragAndDrop()).isFalse() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isBubble() { assertThat(underTest.isBubble).isFalse() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getStyle() { assertThat(underTest.style).isNull() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getSectionBucket() { assertThat(underTest.sectionBucket).isEqualTo(underTest.entry.bucket) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isAmbient() { assertThat(underTest.isAmbient).isFalse() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun canShowFullScreen() { assertThat(underTest.isFullScreenCapable()).isFalse() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getPeopleNotificationType() { assertThat(underTest.getPeopleNotificationType()).isEqualTo(TYPE_NON_PERSON) } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotifCollectionTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -1804,7 +1804,8 @@ public class NotifCollectionTest extends SysuiTestCase { } private static EntryWithDismissStats entryWithDefaultStats(NotificationEntry entry) { return new EntryWithDismissStats(entry, defaultStats(entry)); return new EntryWithDismissStats( entry, defaultStats(entry), entry.getKey(), entry.hashCode()); } private CollectionEvent postNotif(NotificationEntryBuilder builder) { Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryAdapterTest.kt +11 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,17 @@ class NotificationEntryAdapterTest : SysuiTestCase() { @get:Rule val setFlagsRule = SetFlagsRule() @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getBackingHashCode() { val entry = NotificationEntryBuilder() .build() underTest = factory.create(entry) as NotificationEntryAdapter assertThat(underTest.backingHashCode).isEqualTo(entry.hashCode()) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getParent_adapter() { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapter.kt +5 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,11 @@ class BundleEntryAdapter( private val highPriorityProvider: HighPriorityProvider, val entry: BundleEntry, ) : EntryAdapter { override fun getBackingHashCode(): Int { return entry.hashCode() } /** TODO (b/394483200): convert to PipelineEntry.ROOT_ENTRY when pipeline is migrated? */ override fun getParent(): GroupEntry { return GroupEntry.ROOT_ENTRY Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/EntryAdapter.java +6 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,11 @@ import kotlinx.coroutines.flow.StateFlow; */ public interface EntryAdapter { /** * Returns the hash code of the backing entry */ int getBackingHashCode(); /** * Gets the parent of this entry, or null if the entry's view is not attached */ Loading Loading @@ -195,5 +200,6 @@ public interface EntryAdapter { NotificationEntry.DismissState getDismissState(); void onEntryClicked(ExpandableNotificationRow row); }