Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/RowAppearanceCoordinator.kt +7 −4 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.Context import com.android.systemui.res.R import com.android.systemui.shade.ShadeDisplayAware import com.android.systemui.statusbar.notification.AssistantFeedbackController import com.android.systemui.statusbar.notification.collection.NotifCollection import com.android.systemui.statusbar.notification.collection.NotifPipeline import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.collection.PipelineEntry Loading @@ -39,6 +40,7 @@ internal constructor( @ShadeDisplayAware context: Context, private var mAssistantFeedbackController: AssistantFeedbackController, private var mSectionStyleProvider: SectionStyleProvider, private val notifCollection: NotifCollection, ) : Coordinator { private var entryToExpand: NotificationEntry? = null Loading Loading @@ -74,13 +76,14 @@ internal constructor( } private fun onAfterRenderEntry(entry: NotificationEntry, controller: NotifRowController) { val isBundledSingleton = entry.isBundled && (!entry.sbn.isGroup || notifCollection.isOnlyChildInGroup(entry)) // If mAlwaysExpandNonGroupedNotification is false, then only expand the // very first notification if it's not a child of grouped notifications and when // mAutoExpandFirstNotification is true. controller.setSystemExpanded( !entry.isBundled && (mAlwaysExpandNonGroupedNotification || (mAutoExpandFirstNotification && entry == entryToExpand)) controller.setSystemExpanded(isBundledSingleton || (!entry.isBundled && (mAlwaysExpandNonGroupedNotification || (mAutoExpandFirstNotification && entry == entryToExpand))) ) // Show/hide the feedback icon controller.setFeedbackIcon(mAssistantFeedbackController.getFeedbackIcon(entry.ranking)) Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java +5 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,8 @@ public class NotificationChildrenContainer extends ViewGroup @VisibleForTesting static final int NUMBER_OF_CHILDREN_WHEN_COLLAPSED = 2; @VisibleForTesting static final int NUMBER_OF_CHILDREN_WHEN_COLLAPSED_BUNDLED = 5; @VisibleForTesting static final int NUMBER_OF_CHILDREN_WHEN_SYSTEM_EXPANDED = 5; public static final int NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED = 8; private static final AnimationProperties ALPHA_FADE_IN = new AnimationProperties() { Loading Loading @@ -1038,6 +1040,9 @@ public class NotificationChildrenContainer extends ViewGroup if (isBundle()) { return NUMBER_OF_CHILDREN_BUNDLE_COLLAPSED; } else { if (getContainingNotification().getEntryAdapter().isBundled()) { return NUMBER_OF_CHILDREN_WHEN_COLLAPSED_BUNDLED; } return NUMBER_OF_CHILDREN_WHEN_COLLAPSED; } } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RowAppearanceCoordinatorTest.kt +33 −8 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.notification.collection.coordinator import android.app.NotificationChannel import android.platform.test.annotations.EnableFlags import android.testing.TestableLooper.RunWithLooper import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest Loading @@ -28,8 +29,10 @@ import com.android.systemui.statusbar.notification.collection.buildNotificationE import com.android.systemui.statusbar.notification.collection.listbuilder.NotifSection import com.android.systemui.statusbar.notification.collection.listbuilder.OnAfterRenderEntryListener import com.android.systemui.statusbar.notification.collection.listbuilder.OnBeforeRenderListListener import com.android.systemui.statusbar.notification.collection.notifCollection import com.android.systemui.statusbar.notification.collection.provider.SectionStyleProvider import com.android.systemui.statusbar.notification.collection.render.NotifRowController import com.android.systemui.statusbar.notification.shared.NotificationBundleUi import com.android.systemui.testKosmos import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.eq Loading Loading @@ -69,8 +72,8 @@ class RowAppearanceCoordinatorTest : SysuiTestCase() { @Before fun setUp() { initMocks(this) coordinator = RowAppearanceCoordinator(mContext, assistantFeedbackController, sectionStyleProvider) coordinator = RowAppearanceCoordinator( mContext, assistantFeedbackController, sectionStyleProvider, kosmos.notifCollection) coordinator.attach(pipeline) beforeRenderListListener = withArgCaptor { verify(pipeline).addOnBeforeRenderListListener(capture()) Loading @@ -89,7 +92,7 @@ class RowAppearanceCoordinatorTest : SysuiTestCase() { } @Test fun testSetSystemExpandedOnlyOnFirst() { fun testSetSystemExpandedOnlyOnFirstIfNotBundle() { whenever(sectionStyleProvider.isMinimizedSection(eq(section1))).thenReturn(false) whenever(sectionStyleProvider.isMinimizedSection(eq(section1))).thenReturn(false) beforeRenderListListener.onBeforeRenderList(listOf(entry1, entry2)) Loading @@ -111,12 +114,34 @@ class RowAppearanceCoordinatorTest : SysuiTestCase() { } @Test fun testSetSystemExpandedNeverIfBundled() { whenever(sectionStyleProvider.isMinimizedSection(eq(section1))).thenReturn(false) @EnableFlags(NotificationBundleUi.FLAG_NAME) fun testSetSystemExpanded_Bundled_NotInGroup() { whenever(sectionStyleProvider.isMinimizedSection(eq(section3))).thenReturn(false) beforeRenderListListener.onBeforeRenderList(listOf(entry1, entry3)) afterRenderEntryListener.onAfterRenderEntry(entry1, controller1) verify(controller1).setSystemExpanded(eq(true)) beforeRenderListListener.onBeforeRenderList(listOf(entry3)) afterRenderEntryListener.onAfterRenderEntry(entry3, controller3) verify(controller3).setSystemExpanded(eq(true)) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun testSetSystemExpanded_Bundled_SingleNotifInGroup() { entry3.sbn.overrideGroupKey = "bundled" whenever(sectionStyleProvider.isMinimizedSection(eq(section3))).thenReturn(false) whenever(kosmos.notifCollection.isOnlyChildInGroup(entry3)).thenReturn(true) beforeRenderListListener.onBeforeRenderList(listOf(entry3)) afterRenderEntryListener.onAfterRenderEntry(entry3, controller3) verify(controller3).setSystemExpanded(eq(true)) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun testSetSystemExpanded_Bundled_NotMultiChildGroup() { entry3.sbn.overrideGroupKey = "bundled" whenever(sectionStyleProvider.isMinimizedSection(eq(section3))).thenReturn(false) whenever(kosmos.notifCollection.isOnlyChildInGroup(entry3)).thenReturn(false) beforeRenderListListener.onBeforeRenderList(listOf(entry3)) afterRenderEntryListener.onAfterRenderEntry(entry3, controller3) verify(controller3).setSystemExpanded(eq(false)) } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/RowAppearanceCoordinator.kt +7 −4 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.content.Context import com.android.systemui.res.R import com.android.systemui.shade.ShadeDisplayAware import com.android.systemui.statusbar.notification.AssistantFeedbackController import com.android.systemui.statusbar.notification.collection.NotifCollection import com.android.systemui.statusbar.notification.collection.NotifPipeline import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.collection.PipelineEntry Loading @@ -39,6 +40,7 @@ internal constructor( @ShadeDisplayAware context: Context, private var mAssistantFeedbackController: AssistantFeedbackController, private var mSectionStyleProvider: SectionStyleProvider, private val notifCollection: NotifCollection, ) : Coordinator { private var entryToExpand: NotificationEntry? = null Loading Loading @@ -74,13 +76,14 @@ internal constructor( } private fun onAfterRenderEntry(entry: NotificationEntry, controller: NotifRowController) { val isBundledSingleton = entry.isBundled && (!entry.sbn.isGroup || notifCollection.isOnlyChildInGroup(entry)) // If mAlwaysExpandNonGroupedNotification is false, then only expand the // very first notification if it's not a child of grouped notifications and when // mAutoExpandFirstNotification is true. controller.setSystemExpanded( !entry.isBundled && (mAlwaysExpandNonGroupedNotification || (mAutoExpandFirstNotification && entry == entryToExpand)) controller.setSystemExpanded(isBundledSingleton || (!entry.isBundled && (mAlwaysExpandNonGroupedNotification || (mAutoExpandFirstNotification && entry == entryToExpand))) ) // Show/hide the feedback icon controller.setFeedbackIcon(mAssistantFeedbackController.getFeedbackIcon(entry.ranking)) Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java +5 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,8 @@ public class NotificationChildrenContainer extends ViewGroup @VisibleForTesting static final int NUMBER_OF_CHILDREN_WHEN_COLLAPSED = 2; @VisibleForTesting static final int NUMBER_OF_CHILDREN_WHEN_COLLAPSED_BUNDLED = 5; @VisibleForTesting static final int NUMBER_OF_CHILDREN_WHEN_SYSTEM_EXPANDED = 5; public static final int NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED = 8; private static final AnimationProperties ALPHA_FADE_IN = new AnimationProperties() { Loading Loading @@ -1038,6 +1040,9 @@ public class NotificationChildrenContainer extends ViewGroup if (isBundle()) { return NUMBER_OF_CHILDREN_BUNDLE_COLLAPSED; } else { if (getContainingNotification().getEntryAdapter().isBundled()) { return NUMBER_OF_CHILDREN_WHEN_COLLAPSED_BUNDLED; } return NUMBER_OF_CHILDREN_WHEN_COLLAPSED; } } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/RowAppearanceCoordinatorTest.kt +33 −8 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.statusbar.notification.collection.coordinator import android.app.NotificationChannel import android.platform.test.annotations.EnableFlags import android.testing.TestableLooper.RunWithLooper import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest Loading @@ -28,8 +29,10 @@ import com.android.systemui.statusbar.notification.collection.buildNotificationE import com.android.systemui.statusbar.notification.collection.listbuilder.NotifSection import com.android.systemui.statusbar.notification.collection.listbuilder.OnAfterRenderEntryListener import com.android.systemui.statusbar.notification.collection.listbuilder.OnBeforeRenderListListener import com.android.systemui.statusbar.notification.collection.notifCollection import com.android.systemui.statusbar.notification.collection.provider.SectionStyleProvider import com.android.systemui.statusbar.notification.collection.render.NotifRowController import com.android.systemui.statusbar.notification.shared.NotificationBundleUi import com.android.systemui.testKosmos import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.eq Loading Loading @@ -69,8 +72,8 @@ class RowAppearanceCoordinatorTest : SysuiTestCase() { @Before fun setUp() { initMocks(this) coordinator = RowAppearanceCoordinator(mContext, assistantFeedbackController, sectionStyleProvider) coordinator = RowAppearanceCoordinator( mContext, assistantFeedbackController, sectionStyleProvider, kosmos.notifCollection) coordinator.attach(pipeline) beforeRenderListListener = withArgCaptor { verify(pipeline).addOnBeforeRenderListListener(capture()) Loading @@ -89,7 +92,7 @@ class RowAppearanceCoordinatorTest : SysuiTestCase() { } @Test fun testSetSystemExpandedOnlyOnFirst() { fun testSetSystemExpandedOnlyOnFirstIfNotBundle() { whenever(sectionStyleProvider.isMinimizedSection(eq(section1))).thenReturn(false) whenever(sectionStyleProvider.isMinimizedSection(eq(section1))).thenReturn(false) beforeRenderListListener.onBeforeRenderList(listOf(entry1, entry2)) Loading @@ -111,12 +114,34 @@ class RowAppearanceCoordinatorTest : SysuiTestCase() { } @Test fun testSetSystemExpandedNeverIfBundled() { whenever(sectionStyleProvider.isMinimizedSection(eq(section1))).thenReturn(false) @EnableFlags(NotificationBundleUi.FLAG_NAME) fun testSetSystemExpanded_Bundled_NotInGroup() { whenever(sectionStyleProvider.isMinimizedSection(eq(section3))).thenReturn(false) beforeRenderListListener.onBeforeRenderList(listOf(entry1, entry3)) afterRenderEntryListener.onAfterRenderEntry(entry1, controller1) verify(controller1).setSystemExpanded(eq(true)) beforeRenderListListener.onBeforeRenderList(listOf(entry3)) afterRenderEntryListener.onAfterRenderEntry(entry3, controller3) verify(controller3).setSystemExpanded(eq(true)) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun testSetSystemExpanded_Bundled_SingleNotifInGroup() { entry3.sbn.overrideGroupKey = "bundled" whenever(sectionStyleProvider.isMinimizedSection(eq(section3))).thenReturn(false) whenever(kosmos.notifCollection.isOnlyChildInGroup(entry3)).thenReturn(true) beforeRenderListListener.onBeforeRenderList(listOf(entry3)) afterRenderEntryListener.onAfterRenderEntry(entry3, controller3) verify(controller3).setSystemExpanded(eq(true)) } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun testSetSystemExpanded_Bundled_NotMultiChildGroup() { entry3.sbn.overrideGroupKey = "bundled" whenever(sectionStyleProvider.isMinimizedSection(eq(section3))).thenReturn(false) whenever(kosmos.notifCollection.isOnlyChildInGroup(entry3)).thenReturn(false) beforeRenderListListener.onBeforeRenderList(listOf(entry3)) afterRenderEntryListener.onAfterRenderEntry(entry3, controller3) verify(controller3).setSystemExpanded(eq(false)) } Loading