Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerTest.kt +50 −11 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ class GroupExpansionManagerTest : SysuiTestCase() { private val factory: EntryAdapterFactoryImpl = kosmos.entryAdapterFactory private lateinit var summary1: NotificationEntry private lateinit var summaryOfSummary1: NotificationEntry private lateinit var summary2: NotificationEntry private lateinit var entries: List<ListEntry> Loading @@ -80,13 +81,22 @@ class GroupExpansionManagerTest : SysuiTestCase() { @Before fun setUp() { summary1 = kosmos.buildNotificationEntry() { summary1 = kosmos.buildNotificationEntry() { modifyNotification(kosmos.applicationContext) .setGroup("groupId") .setGroup("groupId1") .setGroupSummary(true) } summary1.row = kosmos.createRowWithEntry(summary1) summary2 = kosmos.buildNotificationEntry() { summaryOfSummary1 = kosmos.buildNotificationEntry() { modifyNotification(kosmos.applicationContext) .setGroup("groupId1.1") .setGroupSummary(true) } summaryOfSummary1.row = kosmos.createRowWithEntry(summaryOfSummary1) summary2 = kosmos.buildNotificationEntry() { modifyNotification(kosmos.applicationContext) .setGroup("groupId2") .setGroupSummary(true) Loading @@ -101,6 +111,7 @@ class GroupExpansionManagerTest : SysuiTestCase() { notificationEntry("foo", 2, summary1.row), notificationEntry("foo", 3, summary1.row), notificationEntry("foo", 4, summary1.row), summaryOfSummary1, ) ) .build(), Loading @@ -118,6 +129,8 @@ class GroupExpansionManagerTest : SysuiTestCase() { ) whenever(groupMembershipManager.getGroupSummary(summary1)).thenReturn(summary1) whenever(groupMembershipManager.getGroupSummary(summaryOfSummary1)) .thenReturn(summaryOfSummary1) whenever(groupMembershipManager.getGroupSummary(summary2)).thenReturn(summary2) underTest = GroupExpansionManagerImpl(dumpManager, groupMembershipManager) Loading Loading @@ -243,11 +256,19 @@ class GroupExpansionManagerTest : SysuiTestCase() { @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupExpanded() { fun isGroupExpanded_groupIsExpanded() { val entryAdapter = summary1.row.entryAdapter underTest.setGroupExpanded(entryAdapter, true) assertThat(underTest.isGroupExpanded(entryAdapter)).isTrue() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupExpanded_parentIsExpanded() { val entryAdapter = summary1.row.entryAdapter underTest.setGroupExpanded(entryAdapter, true) assertThat( underTest.isGroupExpanded( (entries[0] as? GroupEntry)?.getChildren()?.get(0)?.row?.entryAdapter Loading @@ -255,4 +276,22 @@ class GroupExpansionManagerTest : SysuiTestCase() { ) .isTrue() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupExpanded_parentIsExpanded_selfIsExpanded() { underTest.setGroupExpanded(summary1.row.entryAdapter, true) underTest.setGroupExpanded(summaryOfSummary1.row.entryAdapter, true) assertThat(underTest.isGroupExpanded(summaryOfSummary1.row.entryAdapter)).isTrue() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupExpanded_parentIsExpanded_returnsFalseWhenItselfIsAGroup() { val entryAdapter = summary1.row.entryAdapter underTest.setGroupExpanded(entryAdapter, true) assertThat(underTest.isGroupExpanded(summaryOfSummary1.row.entryAdapter)).isFalse() } } packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainerTest.java +25 −2 Original line number Diff line number Diff line Loading @@ -16,14 +16,13 @@ package com.android.systemui.statusbar.notification.stack; import static com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_ALL; import static org.junit.Assert.assertNull; import static org.mockito.Mockito.mock; import android.app.Notification; import android.platform.test.annotations.DisableFlags; import android.platform.test.annotations.EnableFlags; import android.testing.TestableLooper; import android.testing.TestableLooper.RunWithLooper; import android.view.NotificationHeaderView; import android.view.View; Loading Loading @@ -119,6 +118,30 @@ public class NotificationChildrenContainerTest extends SysuiTestCase { NotificationChildrenContainer.NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED); } @Test public void testGetMaxAllowedVisibleChildren_bundle_likeCollapsed() { mChildrenContainer.initBundleHeader(mock(BundleHeaderViewModel.class)); Assert.assertEquals(mChildrenContainer.getMaxAllowedVisibleChildren(true), NotificationChildrenContainer.NUMBER_OF_CHILDREN_BUNDLE_COLLAPSED); } @Test public void testGetMaxAllowedVisibleChildren_bundle_expandedChildren() { mChildrenContainer.initBundleHeader(mock(BundleHeaderViewModel.class)); mChildrenContainer.setChildrenExpanded(true); Assert.assertEquals(mChildrenContainer.getMaxAllowedVisibleChildren(), NotificationChildrenContainer.NUMBER_OF_CHILDREN_BUNDLE_EXPANDED); } @Test public void testGetMaxAllowedVisibleChildren_bundle_userLocked() { mChildrenContainer.initBundleHeader(mock(BundleHeaderViewModel.class)); mGroup.setUserLocked(true); Assert.assertEquals(mChildrenContainer.getMaxAllowedVisibleChildren(), NotificationChildrenContainer.NUMBER_OF_CHILDREN_BUNDLE_EXPANDED); } @Test public void testShowingAsLowPriority_lowPriority() { mChildrenContainer.setIsMinimized(true); Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapter.kt +4 −0 Original line number Diff line number Diff line Loading @@ -253,6 +253,10 @@ class BundleEntryAdapter( override fun isBundled(): Boolean { return false } override fun isBundle(): Boolean { return true } } private const val TAG = "BundleEntryAdapter" packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleSpec.kt +4 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,9 @@ data class BundleSpec(val key: String, @StringRes val titleTextResId: Int) { titleTextResId = R.string.recs_notification_channel_label, ) val DEBUG = BundleSpec(key = "notify", titleTextResId = R.string.notification_channel_developer) BundleSpec( key = "debug_bundle", titleTextResId = R.string.notification_channel_developer, ) } } packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/EntryAdapter.java +6 −1 Original line number Diff line number Diff line Loading @@ -230,8 +230,13 @@ public interface EntryAdapter { @NonNull NotifBindPipeline.BindCallback callback); /** * Returns whether this entry is *within* a bundle. The bundle header will always return false. * Returns whether this entry *is within* a bundle. The bundle header will always return false. */ boolean isBundled(); /** * Returns whether this entry *is* a bundle. */ boolean isBundle(); } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerTest.kt +50 −11 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ class GroupExpansionManagerTest : SysuiTestCase() { private val factory: EntryAdapterFactoryImpl = kosmos.entryAdapterFactory private lateinit var summary1: NotificationEntry private lateinit var summaryOfSummary1: NotificationEntry private lateinit var summary2: NotificationEntry private lateinit var entries: List<ListEntry> Loading @@ -80,13 +81,22 @@ class GroupExpansionManagerTest : SysuiTestCase() { @Before fun setUp() { summary1 = kosmos.buildNotificationEntry() { summary1 = kosmos.buildNotificationEntry() { modifyNotification(kosmos.applicationContext) .setGroup("groupId") .setGroup("groupId1") .setGroupSummary(true) } summary1.row = kosmos.createRowWithEntry(summary1) summary2 = kosmos.buildNotificationEntry() { summaryOfSummary1 = kosmos.buildNotificationEntry() { modifyNotification(kosmos.applicationContext) .setGroup("groupId1.1") .setGroupSummary(true) } summaryOfSummary1.row = kosmos.createRowWithEntry(summaryOfSummary1) summary2 = kosmos.buildNotificationEntry() { modifyNotification(kosmos.applicationContext) .setGroup("groupId2") .setGroupSummary(true) Loading @@ -101,6 +111,7 @@ class GroupExpansionManagerTest : SysuiTestCase() { notificationEntry("foo", 2, summary1.row), notificationEntry("foo", 3, summary1.row), notificationEntry("foo", 4, summary1.row), summaryOfSummary1, ) ) .build(), Loading @@ -118,6 +129,8 @@ class GroupExpansionManagerTest : SysuiTestCase() { ) whenever(groupMembershipManager.getGroupSummary(summary1)).thenReturn(summary1) whenever(groupMembershipManager.getGroupSummary(summaryOfSummary1)) .thenReturn(summaryOfSummary1) whenever(groupMembershipManager.getGroupSummary(summary2)).thenReturn(summary2) underTest = GroupExpansionManagerImpl(dumpManager, groupMembershipManager) Loading Loading @@ -243,11 +256,19 @@ class GroupExpansionManagerTest : SysuiTestCase() { @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupExpanded() { fun isGroupExpanded_groupIsExpanded() { val entryAdapter = summary1.row.entryAdapter underTest.setGroupExpanded(entryAdapter, true) assertThat(underTest.isGroupExpanded(entryAdapter)).isTrue() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupExpanded_parentIsExpanded() { val entryAdapter = summary1.row.entryAdapter underTest.setGroupExpanded(entryAdapter, true) assertThat( underTest.isGroupExpanded( (entries[0] as? GroupEntry)?.getChildren()?.get(0)?.row?.entryAdapter Loading @@ -255,4 +276,22 @@ class GroupExpansionManagerTest : SysuiTestCase() { ) .isTrue() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupExpanded_parentIsExpanded_selfIsExpanded() { underTest.setGroupExpanded(summary1.row.entryAdapter, true) underTest.setGroupExpanded(summaryOfSummary1.row.entryAdapter, true) assertThat(underTest.isGroupExpanded(summaryOfSummary1.row.entryAdapter)).isTrue() } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupExpanded_parentIsExpanded_returnsFalseWhenItselfIsAGroup() { val entryAdapter = summary1.row.entryAdapter underTest.setGroupExpanded(entryAdapter, true) assertThat(underTest.isGroupExpanded(summaryOfSummary1.row.entryAdapter)).isFalse() } }
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainerTest.java +25 −2 Original line number Diff line number Diff line Loading @@ -16,14 +16,13 @@ package com.android.systemui.statusbar.notification.stack; import static com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_ALL; import static org.junit.Assert.assertNull; import static org.mockito.Mockito.mock; import android.app.Notification; import android.platform.test.annotations.DisableFlags; import android.platform.test.annotations.EnableFlags; import android.testing.TestableLooper; import android.testing.TestableLooper.RunWithLooper; import android.view.NotificationHeaderView; import android.view.View; Loading Loading @@ -119,6 +118,30 @@ public class NotificationChildrenContainerTest extends SysuiTestCase { NotificationChildrenContainer.NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED); } @Test public void testGetMaxAllowedVisibleChildren_bundle_likeCollapsed() { mChildrenContainer.initBundleHeader(mock(BundleHeaderViewModel.class)); Assert.assertEquals(mChildrenContainer.getMaxAllowedVisibleChildren(true), NotificationChildrenContainer.NUMBER_OF_CHILDREN_BUNDLE_COLLAPSED); } @Test public void testGetMaxAllowedVisibleChildren_bundle_expandedChildren() { mChildrenContainer.initBundleHeader(mock(BundleHeaderViewModel.class)); mChildrenContainer.setChildrenExpanded(true); Assert.assertEquals(mChildrenContainer.getMaxAllowedVisibleChildren(), NotificationChildrenContainer.NUMBER_OF_CHILDREN_BUNDLE_EXPANDED); } @Test public void testGetMaxAllowedVisibleChildren_bundle_userLocked() { mChildrenContainer.initBundleHeader(mock(BundleHeaderViewModel.class)); mGroup.setUserLocked(true); Assert.assertEquals(mChildrenContainer.getMaxAllowedVisibleChildren(), NotificationChildrenContainer.NUMBER_OF_CHILDREN_BUNDLE_EXPANDED); } @Test public void testShowingAsLowPriority_lowPriority() { mChildrenContainer.setIsMinimized(true); Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapter.kt +4 −0 Original line number Diff line number Diff line Loading @@ -253,6 +253,10 @@ class BundleEntryAdapter( override fun isBundled(): Boolean { return false } override fun isBundle(): Boolean { return true } } private const val TAG = "BundleEntryAdapter"
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleSpec.kt +4 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,9 @@ data class BundleSpec(val key: String, @StringRes val titleTextResId: Int) { titleTextResId = R.string.recs_notification_channel_label, ) val DEBUG = BundleSpec(key = "notify", titleTextResId = R.string.notification_channel_developer) BundleSpec( key = "debug_bundle", titleTextResId = R.string.notification_channel_developer, ) } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/EntryAdapter.java +6 −1 Original line number Diff line number Diff line Loading @@ -230,8 +230,13 @@ public interface EntryAdapter { @NonNull NotifBindPipeline.BindCallback callback); /** * Returns whether this entry is *within* a bundle. The bundle header will always return false. * Returns whether this entry *is within* a bundle. The bundle header will always return false. */ boolean isBundled(); /** * Returns whether this entry *is* a bundle. */ boolean isBundle(); }