Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryAdapterTest.kt +56 −0 Original line number Diff line number Diff line Loading @@ -578,4 +578,60 @@ class NotificationEntryAdapterTest : SysuiTestCase() { underTest = factory.create(entry) as NotificationEntryAdapter assertThat(underTest.isBundled).isTrue() } @Test fun onBundleDisabled_individualNotification() { val notification: Notification = Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) .addAction(Mockito.mock(Notification.Action::class.java)) .build() val entry = NotificationEntryBuilder().setNotification(notification).build() underTest = factory.create(entry) as NotificationEntryAdapter underTest.onBundleDisabled() assertThat(underTest.isMarkedForUserTriggeredMovement).isTrue() verify(kosmos.mockVisualStabilityCoordinator) .temporarilyAllowSectionChanges(eq(entry), anyLong()) } @Test fun onBundleDisabled_groupRoot() { val summaryRow: ExpandableNotificationRow = mock() val childRow: ExpandableNotificationRow = mock() val summary: Notification = Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) .setGroupSummary(true) .setGroup("key") .build() val child: Notification = Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) .addAction(Mockito.mock(Notification.Action::class.java)) .setGroup("key") .build() val group = GroupEntryBuilder().setParent(GroupEntry.ROOT_ENTRY).build() val summaryEntry = NotificationEntryBuilder().setNotification(summary).setParent(group).build() group.setSummary(summaryEntry) summaryEntry.row = summaryRow val childEntry = NotificationEntryBuilder().setNotification(child).setParent(group).build() childEntry.row = childRow val childAdapter = factory.create(childEntry) as NotificationEntryAdapter whenever(childRow.entryAdapter).thenReturn(childAdapter) whenever(summaryRow.attachedChildren).thenReturn(listOf(childRow)) underTest = factory.create(summaryEntry) as NotificationEntryAdapter underTest.onBundleDisabled() verify(kosmos.mockVisualStabilityCoordinator) .temporarilyAllowSectionChanges(eq(summaryEntry), anyLong()) verify(kosmos.mockVisualStabilityCoordinator) .temporarilyAllowSectionChanges(eq(childEntry), anyLong()) } } packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/BundleHeaderGutsViewModelTest.kt +0 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,6 @@ class BundleHeaderGutsViewModelTest : SysuiTestCase() { // Assert verify(mockDisableBundle).invoke() verify(mockOnDismissClicked).invoke() verify(mockCloseGuts, never()).invoke() } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapter.kt +5 −0 Original line number Diff line number Diff line Loading @@ -252,6 +252,11 @@ class BundleEntryAdapter( override fun isBundle(): Boolean { return true } override fun onBundleDisabled() { // do nothing. it should not be possible for a bundle to be contained within a bundle Log.wtf(TAG, "onBundleDisabled() called") } } private const val TAG = "BundleEntryAdapter" packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/EntryAdapter.java +5 −0 Original line number Diff line number Diff line Loading @@ -238,5 +238,10 @@ public interface EntryAdapter { * Returns whether this entry *is* a bundle. */ boolean isBundle(); /** * Processes when the bundle this entry is within is disabled. */ void onBundleDisabled(); } packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntryAdapter.kt +9 −0 Original line number Diff line number Diff line Loading @@ -288,4 +288,13 @@ class NotificationEntryAdapter( override fun isBundle(): Boolean { return false } override fun onBundleDisabled() { markForUserTriggeredMovement(true) onImportanceChanged() if (isGroupRoot()) { row.attachedChildren?.forEach { it.entryAdapter.onBundleDisabled() } } } } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryAdapterTest.kt +56 −0 Original line number Diff line number Diff line Loading @@ -578,4 +578,60 @@ class NotificationEntryAdapterTest : SysuiTestCase() { underTest = factory.create(entry) as NotificationEntryAdapter assertThat(underTest.isBundled).isTrue() } @Test fun onBundleDisabled_individualNotification() { val notification: Notification = Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) .addAction(Mockito.mock(Notification.Action::class.java)) .build() val entry = NotificationEntryBuilder().setNotification(notification).build() underTest = factory.create(entry) as NotificationEntryAdapter underTest.onBundleDisabled() assertThat(underTest.isMarkedForUserTriggeredMovement).isTrue() verify(kosmos.mockVisualStabilityCoordinator) .temporarilyAllowSectionChanges(eq(entry), anyLong()) } @Test fun onBundleDisabled_groupRoot() { val summaryRow: ExpandableNotificationRow = mock() val childRow: ExpandableNotificationRow = mock() val summary: Notification = Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) .setGroupSummary(true) .setGroup("key") .build() val child: Notification = Notification.Builder(mContext, "") .setSmallIcon(R.drawable.ic_person) .addAction(Mockito.mock(Notification.Action::class.java)) .setGroup("key") .build() val group = GroupEntryBuilder().setParent(GroupEntry.ROOT_ENTRY).build() val summaryEntry = NotificationEntryBuilder().setNotification(summary).setParent(group).build() group.setSummary(summaryEntry) summaryEntry.row = summaryRow val childEntry = NotificationEntryBuilder().setNotification(child).setParent(group).build() childEntry.row = childRow val childAdapter = factory.create(childEntry) as NotificationEntryAdapter whenever(childRow.entryAdapter).thenReturn(childAdapter) whenever(summaryRow.attachedChildren).thenReturn(listOf(childRow)) underTest = factory.create(summaryEntry) as NotificationEntryAdapter underTest.onBundleDisabled() verify(kosmos.mockVisualStabilityCoordinator) .temporarilyAllowSectionChanges(eq(summaryEntry), anyLong()) verify(kosmos.mockVisualStabilityCoordinator) .temporarilyAllowSectionChanges(eq(childEntry), anyLong()) } }
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/ui/viewmodel/BundleHeaderGutsViewModelTest.kt +0 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,6 @@ class BundleHeaderGutsViewModelTest : SysuiTestCase() { // Assert verify(mockDisableBundle).invoke() verify(mockOnDismissClicked).invoke() verify(mockCloseGuts, never()).invoke() } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/BundleEntryAdapter.kt +5 −0 Original line number Diff line number Diff line Loading @@ -252,6 +252,11 @@ class BundleEntryAdapter( override fun isBundle(): Boolean { return true } override fun onBundleDisabled() { // do nothing. it should not be possible for a bundle to be contained within a bundle Log.wtf(TAG, "onBundleDisabled() called") } } private const val TAG = "BundleEntryAdapter"
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/EntryAdapter.java +5 −0 Original line number Diff line number Diff line Loading @@ -238,5 +238,10 @@ public interface EntryAdapter { * Returns whether this entry *is* a bundle. */ boolean isBundle(); /** * Processes when the bundle this entry is within is disabled. */ void onBundleDisabled(); }
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntryAdapter.kt +9 −0 Original line number Diff line number Diff line Loading @@ -288,4 +288,13 @@ class NotificationEntryAdapter( override fun isBundle(): Boolean { return false } override fun onBundleDisabled() { markForUserTriggeredMovement(true) onImportanceChanged() if (isGroupRoot()) { row.attachedChildren?.forEach { it.entryAdapter.onBundleDisabled() } } } }