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

Commit b544e906 authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Remove some more getEntry() usages around keys" into main

parents 4556eaf2 a7cd3a83
Loading
Loading
Loading
Loading
+34 −19
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ class DismissibilityCoordinatorTest : SysuiTestCase() {

        assertTrue(
            "Notifs without any flags should be dismissible",
            dismissibilityProvider.isDismissable(entry)
            dismissibilityProvider.isDismissable(entry.key)
        )
    }

@@ -96,7 +96,7 @@ class DismissibilityCoordinatorTest : SysuiTestCase() {

        assertFalse(
            "Non-dismiss Notifs should NOT be dismissible",
            dismissibilityProvider.isDismissable(entry)
            dismissibilityProvider.isDismissable(entry.key)
        )
    }

@@ -113,7 +113,7 @@ class DismissibilityCoordinatorTest : SysuiTestCase() {

        assertFalse(
            "Ongoing Notifs should NOT be dismissible when the device is locked",
            dismissibilityProvider.isDismissable(entry)
            dismissibilityProvider.isDismissable(entry.key)
        )
    }

@@ -130,7 +130,7 @@ class DismissibilityCoordinatorTest : SysuiTestCase() {

        assertTrue(
            "Ongoing Notifs should be dismissible when the device is unlocked",
            dismissibilityProvider.isDismissable(entry)
            dismissibilityProvider.isDismissable(entry.key)
        )
    }

@@ -148,7 +148,7 @@ class DismissibilityCoordinatorTest : SysuiTestCase() {

        assertFalse(
            "Non-dismiss Notifs should NOT be dismissible",
            dismissibilityProvider.isDismissable(entry)
            dismissibilityProvider.isDismissable(entry.key)
        )
    }

@@ -174,16 +174,16 @@ class DismissibilityCoordinatorTest : SysuiTestCase() {

        assertTrue(
            "Notifs without any flags should be dismissible",
            dismissibilityProvider.isDismissable(noFlagEntry)
            dismissibilityProvider.isDismissable(noFlagEntry.key)
        )
        assertTrue(
            "Ongoing Notifs should be dismissible when the device is unlocked",
            dismissibilityProvider.isDismissable(ongoingEntry)
            dismissibilityProvider.isDismissable(ongoingEntry.key)
        )

        assertFalse(
            "Non-dismiss Notifs should NOT be dismissible",
            dismissibilityProvider.isDismissable(nonDismissEntry)
            dismissibilityProvider.isDismissable(nonDismissEntry.key)
        )
    }

@@ -199,10 +199,13 @@ class DismissibilityCoordinatorTest : SysuiTestCase() {

        onBeforeRenderListListener.onBeforeRenderList(listOf(group))

        assertFalse("Child should be non-dismissible", dismissibilityProvider.isDismissable(entry))
        assertFalse(
            "Child should be non-dismissible",
            dismissibilityProvider.isDismissable(entry.key)
        )
        assertFalse(
            "Summary should be non-dismissible",
            dismissibilityProvider.isDismissable(summary)
            dismissibilityProvider.isDismissable(summary.key)
        )
    }

@@ -219,10 +222,13 @@ class DismissibilityCoordinatorTest : SysuiTestCase() {

        onBeforeRenderListListener.onBeforeRenderList(listOf(group))

        assertFalse("Child should be non-dismissible", dismissibilityProvider.isDismissable(entry))
        assertFalse(
            "Child should be non-dismissible",
            dismissibilityProvider.isDismissable(entry.key)
        )
        assertFalse(
            "Summary should be non-dismissible",
            dismissibilityProvider.isDismissable(summary)
            dismissibilityProvider.isDismissable(summary.key)
        )
    }

@@ -239,8 +245,11 @@ class DismissibilityCoordinatorTest : SysuiTestCase() {

        onBeforeRenderListListener.onBeforeRenderList(listOf(group))

        assertTrue("Child should be dismissible", dismissibilityProvider.isDismissable(entry))
        assertTrue("Summary should be dismissible", dismissibilityProvider.isDismissable(summary))
        assertTrue("Child should be dismissible", dismissibilityProvider.isDismissable(entry.key))
        assertTrue(
            "Summary should be dismissible",
            dismissibilityProvider.isDismissable(summary.key)
        )
    }

    @Test
@@ -254,7 +263,10 @@ class DismissibilityCoordinatorTest : SysuiTestCase() {

        onBeforeRenderListListener.onBeforeRenderList(listOf(group))

        assertFalse("Child should be non-dismissible", dismissibilityProvider.isDismissable(entry))
        assertFalse(
            "Child should be non-dismissible",
            dismissibilityProvider.isDismissable(entry.key)
        )
    }

    @Test
@@ -269,7 +281,10 @@ class DismissibilityCoordinatorTest : SysuiTestCase() {

        onBeforeRenderListListener.onBeforeRenderList(listOf(group))

        assertFalse("Child should be non-dismissible", dismissibilityProvider.isDismissable(entry))
        assertFalse(
            "Child should be non-dismissible",
            dismissibilityProvider.isDismissable(entry.key)
        )
    }

    @Test
@@ -284,7 +299,7 @@ class DismissibilityCoordinatorTest : SysuiTestCase() {

        onBeforeRenderListListener.onBeforeRenderList(listOf(group))

        assertTrue("Child should be dismissible", dismissibilityProvider.isDismissable(entry))
        assertTrue("Child should be dismissible", dismissibilityProvider.isDismissable(entry.key))
    }

    @Test
@@ -299,10 +314,10 @@ class DismissibilityCoordinatorTest : SysuiTestCase() {

        onBeforeRenderListListener.onBeforeRenderList(listOf(group))

        assertTrue("Child should be dismissible", dismissibilityProvider.isDismissable(entry))
        assertTrue("Child should be dismissible", dismissibilityProvider.isDismissable(entry.key))
        assertFalse(
            "Summary should be non-dismissible",
            dismissibilityProvider.isDismissable(summary)
            dismissibilityProvider.isDismissable(summary.key)
        )
    }
}
+8 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import com.android.systemui.shade.transition.LargeScreenShadeInterpolator
import com.android.systemui.statusbar.NotificationShelf
import com.android.systemui.statusbar.StatusBarState
import com.android.systemui.statusbar.notification.RoundableState
import com.android.systemui.statusbar.notification.collection.EntryAdapter
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.emptyshade.ui.view.EmptyShadeView
import com.android.systemui.statusbar.notification.footer.ui.view.FooterView
@@ -56,6 +57,7 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() {
    private val stackScrollAlgorithm = StackScrollAlgorithm(context, hostView)
    private val notificationRow = mock<ExpandableNotificationRow>()
    private val notificationEntry = mock<NotificationEntry>()
    private val notificationEntryAdapter = mock<EntryAdapter>()
    private val dumpManager = mock<DumpManager>()
    private val mStatusBarKeyguardViewManager = mock<StatusBarKeyguardViewManager>()
    private val notificationShelf = mock<NotificationShelf>()
@@ -109,8 +111,10 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() {
        Assume.assumeFalse(isTv())
        mDependency.injectTestDependency(FeatureFlags::class.java, featureFlags)
        whenever(notificationShelf.viewState).thenReturn(ExpandableViewState())
        whenever(notificationRow.key).thenReturn("key")
        whenever(notificationRow.viewState).thenReturn(ExpandableViewState())
        whenever(notificationRow.entry).thenReturn(notificationEntry)
        whenever(notificationRow.entryAdapter).thenReturn(notificationEntryAdapter)
        whenever(notificationRow.roundableState)
            .thenReturn(RoundableState(notificationRow, notificationRow, 0f))
        ambientState.isSmallScreen = true
@@ -452,7 +456,11 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() {
    @Test
    fun resetViewStates_hunsOverlapping_bottomHunClipped() {
        val topHun = mockExpandableNotificationRow()
        whenever(topHun.key).thenReturn("key")
        whenever(topHun.entryAdapter).thenReturn(notificationEntryAdapter)
        val bottomHun = mockExpandableNotificationRow()
        whenever(bottomHun.key).thenReturn("key")
        whenever(bottomHun.entryAdapter).thenReturn(notificationEntryAdapter)
        whenever(topHun.isHeadsUp).thenReturn(true)
        whenever(topHun.isPinned).thenReturn(true)
        whenever(bottomHun.isHeadsUp).thenReturn(true)
+2 −2
Original line number Diff line number Diff line
@@ -388,7 +388,7 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() {

        // Pulsing: Enabled
        row.isHeadsUp = true
        underTest.updateHeadsUpAndPulsingRoundness(entry)
        underTest.updateHeadsUpAndPulsingRoundness(row)

        val debugString: String = row.roundableState.debugString()
        // If Pulsing is enabled, roundness should be set to 1
@@ -397,7 +397,7 @@ class HeadsUpAppearanceControllerTest : SysuiTestCase() {

        // Pulsing: Disabled
        row.isHeadsUp = false
        underTest.updateHeadsUpAndPulsingRoundness(entry)
        underTest.updateHeadsUpAndPulsingRoundness(row)

        // If Pulsing is disabled, roundness should be set to 0
        assertThat(row.topRoundness.toDouble()).isWithin(0.001).of(0.0)
+7 −8
Original line number Diff line number Diff line
@@ -30,26 +30,25 @@ class ActionClickLogger @Inject constructor(
    @NotifInteractionLog private val buffer: LogBuffer
) {
    fun logInitialClick(
        entry: NotificationEntry?,
        entry: String?,
        index: Integer?,
        pendingIntent: PendingIntent
    ) {
        buffer.log(TAG, LogLevel.DEBUG, {
            str1 = entry?.key
            str2 = entry?.ranking?.channel?.id
            str1 = entry
            str3 = pendingIntent.toString()
            int1 = index?.toInt() ?: Int.MIN_VALUE
        }, {
            "ACTION CLICK $str1 (channel=$str2) for pending intent $str3 at index $int1"
            "ACTION CLICK $str1 for pending intent $str3 at index $int1"
        })
    }

    fun logRemoteInputWasHandled(
        entry: NotificationEntry?,
        entry: String?,
        index: Int?
    ) {
        buffer.log(TAG, LogLevel.DEBUG, {
            str1 = entry?.key
            str1 = entry
            int1 = index ?: Int.MIN_VALUE
        }, {
            "  [Action click] Triggered remote input (for $str1) at index $int1"
@@ -57,12 +56,12 @@ class ActionClickLogger @Inject constructor(
    }

    fun logStartingIntentWithDefaultHandler(
        entry: NotificationEntry?,
        entry: String?,
        pendingIntent: PendingIntent,
        index: Int?
    ) {
        buffer.log(TAG, LogLevel.DEBUG, {
            str1 = entry?.key
            str1 = entry
            str2 = pendingIntent.toString()
            int1 = index ?: Int.MIN_VALUE
        }, {
+2 −2
Original line number Diff line number Diff line
@@ -560,10 +560,10 @@ constructor(
        var entry: NotificationEntry? = null
        if (expandView is ExpandableNotificationRow) {
            entry = expandView.entry
            entry.setUserExpanded(/* userExpanded= */ true, /* allowChildExpansion= */ true)
            expandView.setUserExpanded(/* userExpanded= */ true, /* allowChildExpansion= */ true)
            // Indicate that the group expansion is changing at this time -- this way the group
            // and children backgrounds / divider animations will look correct.
            entry.setGroupExpansionChanging(true)
            expandView.isGroupExpansionChanging = true
            userId = entry.sbn.userId
        }
        var fullShadeNeedsBouncer =
Loading