Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1632d06d authored by Priyanka Advani (xWF)'s avatar Priyanka Advani (xWF) Committed by Android (Google) Code Review
Browse files

Revert "Selectively expand notifications inside bundles"

This reverts commit 1f1577dd.

Reason for revert: Droidmonitor created revert due to b/431796492. Will be verifying through ABTD before submission.

Fix: 431796492
Change-Id: Idef6c2b6f84e97795617371d6b161fc0b832f190
parent 1f1577dd
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ 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
@@ -40,7 +39,6 @@ internal constructor(
    @ShadeDisplayAware context: Context,
    private var mAssistantFeedbackController: AssistantFeedbackController,
    private var mSectionStyleProvider: SectionStyleProvider,
    private val notifCollection: NotifCollection,
) : Coordinator {

    private var entryToExpand: NotificationEntry? = null
@@ -76,14 +74,13 @@ 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(isBundledSingleton
                || (!entry.isBundled && (mAlwaysExpandNonGroupedNotification ||
                    (mAutoExpandFirstNotification && entry == entryToExpand)))
        controller.setSystemExpanded(
            !entry.isBundled &&
                (mAlwaysExpandNonGroupedNotification ||
                    (mAutoExpandFirstNotification && entry == entryToExpand))
        )
        // Show/hide the feedback icon
        controller.setFeedbackIcon(mAssistantFeedbackController.getFeedbackIcon(entry.ranking))
+0 −5
Original line number Diff line number Diff line
@@ -85,8 +85,6 @@ 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() {
@@ -1040,9 +1038,6 @@ 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;
        }
    }
+8 −33
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
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
@@ -29,10 +28,8 @@ 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
@@ -72,8 +69,8 @@ class RowAppearanceCoordinatorTest : SysuiTestCase() {
    @Before
    fun setUp() {
        initMocks(this)
        coordinator = RowAppearanceCoordinator(
            mContext, assistantFeedbackController, sectionStyleProvider, kosmos.notifCollection)
        coordinator =
            RowAppearanceCoordinator(mContext, assistantFeedbackController, sectionStyleProvider)
        coordinator.attach(pipeline)
        beforeRenderListListener = withArgCaptor {
            verify(pipeline).addOnBeforeRenderListListener(capture())
@@ -92,7 +89,7 @@ class RowAppearanceCoordinatorTest : SysuiTestCase() {
    }

    @Test
    fun testSetSystemExpandedOnlyOnFirstIfNotBundle() {
    fun testSetSystemExpandedOnlyOnFirst() {
        whenever(sectionStyleProvider.isMinimizedSection(eq(section1))).thenReturn(false)
        whenever(sectionStyleProvider.isMinimizedSection(eq(section1))).thenReturn(false)
        beforeRenderListListener.onBeforeRenderList(listOf(entry1, entry2))
@@ -114,34 +111,12 @@ class RowAppearanceCoordinatorTest : SysuiTestCase() {
    }

    @Test
    @EnableFlags(NotificationBundleUi.FLAG_NAME)
    fun testSetSystemExpanded_Bundled_NotInGroup() {
        whenever(sectionStyleProvider.isMinimizedSection(eq(section3))).thenReturn(false)
        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"
    fun testSetSystemExpandedNeverIfBundled() {
        whenever(sectionStyleProvider.isMinimizedSection(eq(section1))).thenReturn(false)
        whenever(sectionStyleProvider.isMinimizedSection(eq(section3))).thenReturn(false)
        whenever(kosmos.notifCollection.isOnlyChildInGroup(entry3)).thenReturn(false)

        beforeRenderListListener.onBeforeRenderList(listOf(entry3))
        beforeRenderListListener.onBeforeRenderList(listOf(entry1, entry3))
        afterRenderEntryListener.onAfterRenderEntry(entry1, controller1)
        verify(controller1).setSystemExpanded(eq(true))
        afterRenderEntryListener.onAfterRenderEntry(entry3, controller3)
        verify(controller3).setSystemExpanded(eq(false))
    }