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

Commit d7aec9a6 authored by Lyn Han's avatar Lyn Han Committed by Android (Google) Code Review
Browse files

Merge changes If66094f1,I2be0999f,I3001c01f,I6af8183f,I1af34282, ... into main

* changes:
  Add javadoc for NotifPipeline.setNotifBundler
  Type check BundleEntry in PreparationCoordinator
  Implement NotifBundler pluggable
  Update ListAttachState.section javadoc
  Hide bundle in shelf for lockscreen minimalism
  Null check representativeEntry in RankingCoordinator
  Move getSectionIndex impl to PipelineEntry
  Remove getSection override in BundleEntry
parents fc5aa392 4d0f0957
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock
import org.mockito.MockitoAnnotations
import kotlin.test.assertEquals

@SmallTest
@RunWith(AndroidJUnit4::class)
@@ -87,6 +88,18 @@ class BundleCoordinatorTest : SysuiTestCase() {
        isFalse()
    }

    @Test
    fun testBundler_getBundleIdOrNull_returnBundleId() {
        val classifiedEntry = makeEntryOfChannelType(PROMOTIONS_ID)
        assertEquals(coordinator.bundler.getBundleIdOrNull(classifiedEntry), PROMOTIONS_ID)
    }

    @Test
    fun testBundler_getBundleIdOrNull_returnNull() {
        val unclassifiedEntry = makeEntryOfChannelType("not system channel")
        assertEquals(coordinator.bundler.getBundleIdOrNull(unclassifiedEntry), null)
    }

    private fun makeEntryOfChannelType(
        type: String,
        buildBlock: NotificationEntryBuilder.() -> Unit = {}
+8 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import com.android.systemui.kosmos.testScope
import com.android.systemui.plugins.statusbar.statusBarStateController
import com.android.systemui.shade.shadeTestUtil
import com.android.systemui.statusbar.SysuiStatusBarStateController
import com.android.systemui.statusbar.notification.collection.BundleEntry
import com.android.systemui.statusbar.notification.collection.GroupEntryBuilder
import com.android.systemui.statusbar.notification.collection.NotifPipeline
import com.android.systemui.statusbar.notification.collection.NotificationEntry
@@ -280,6 +281,8 @@ class LockScreenMinimalismCoordinatorTest : SysuiTestCase() {
        val group = GroupEntryBuilder().setSummary(parent).addChild(child1).addChild(child2).build()
        val listEntryList = listOf(group, solo1, solo2)
        val notificationEntryList = listOf(solo1, solo2, parent, child1, child2)
        val bundle = BundleEntry("bundleKey")
        val bundleList = listOf(bundle)

        runCoordinatorTest {
            // All entries are added (and now unseen)
@@ -300,6 +303,11 @@ class LockScreenMinimalismCoordinatorTest : SysuiTestCase() {
            assertThatTopOngoingKey().isEqualTo(null)
            assertThatTopUnseenKey().isEqualTo(solo1.key)

            // TEST: bundle is not picked
            onBeforeTransformGroupsListener.onBeforeTransformGroups(bundleList)
            assertThatTopOngoingKey().isEqualTo(null)
            assertThatTopUnseenKey().isEqualTo(null)

            // TEST: if top-ranked unseen is colorized, fall back to #2 ranked unseen
            solo1.setColorizedFgs(true)
            onBeforeTransformGroupsListener.onBeforeTransformGroups(listEntryList)
+0 −11
Original line number Diff line number Diff line
@@ -61,17 +61,6 @@ public class BundleEntry extends PipelineEntry {
        return null;
    }

    @Nullable
    @Override
    public NotifSection getSection() {
        return null;
    }

    @Override
    public int getSectionIndex() {
        return 0;
    }

    @Nullable
    @Override
    public PipelineEntry getParent() {
+2 −2
Original line number Diff line number Diff line
@@ -31,8 +31,8 @@ data class ListAttachState private constructor(
    var parent: PipelineEntry?,

    /**
     * The section that this ListEntry was sorted into. If the child of the group, this will be the
     * parent's section. Null if not attached to the list.
     * The section that this PipelineEntry was sorted into. If the child of the group, this will be
     * the parent's section. Null if not attached to the list.
     */
    var section: NotifSection?,

+0 −4
Original line number Diff line number Diff line
@@ -66,10 +66,6 @@ public abstract class ListEntry extends PipelineEntry {
        return mPreviousAttachState.getParent();
    }

    public int getSectionIndex() {
        return mAttachState.getSection() != null ? mAttachState.getSection().getIndex() : -1;
    }

    /**
     * Stores the current attach state into {@link #getPreviousAttachState()}} and then starts a
     * fresh attach state (all entries will be null/default-initialized).
Loading