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

Commit dc9372b2 authored by Jeff DeCew's avatar Jeff DeCew
Browse files

[RONs] Implement the structure required for redacting the AOD RON

* This introduces the PromotedNotificationContentModels class which holds both a public and private model
* Implements 2 of 3 redacted content extraction codepaths:
  * Implements unredacted extraction when redaction type is none
  * Implements fully redacted extraction otherwise
  * Does not implement redacted extraction from the Notification.publicVersion object when one is present.
* Does not implement locked state checking for AOD; always shows the public version on AOD for now.

Bug: 400991304
Flag: android.app.ui_rich_ongoing
Test: presubmit
Change-Id: I76086cb35dfdbd396d5b1c226545500f454e40bf
parent 15b076e7
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import com.android.systemui.statusbar.chips.ui.model.OngoingActivityChipModel
import com.android.systemui.statusbar.chips.ui.view.ChipBackgroundContainer
import com.android.systemui.statusbar.core.StatusBarConnectedDisplays
import com.android.systemui.statusbar.core.StatusBarRootModernization
import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentBuilder
import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel
import com.android.systemui.statusbar.phone.ongoingcall.DisableChipsModernization
import com.android.systemui.statusbar.phone.ongoingcall.EnableChipsModernization
@@ -799,8 +800,8 @@ class CallChipViewModelTest(flags: FlagsParameterization) : SysuiTestCase() {
            }

        private val PROMOTED_CONTENT_WITH_COLOR =
            PromotedNotificationContentModel.Builder("notif")
                .apply {
            PromotedNotificationContentBuilder("notif")
                .applyToShared {
                    this.colors =
                        PromotedNotificationContentModel.Colors(
                            backgroundColor = PROMOTED_BACKGROUND_COLOR,
+3 −3
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import com.android.systemui.statusbar.StatusBarIconView
import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips
import com.android.systemui.statusbar.core.StatusBarConnectedDisplays
import com.android.systemui.statusbar.notification.data.model.activeNotificationModel
import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel
import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentBuilder
import com.android.systemui.testKosmos
import com.android.systemui.util.time.fakeSystemClock
import com.google.common.truth.Truth.assertThat
@@ -420,7 +420,7 @@ class SingleNotificationChipInteractorTest : SysuiTestCase() {
            // WHEN the notif gets a new UID that starts as visible
            activityManagerRepository.fake.startingIsAppVisibleValue = true
            val newPromotedContentBuilder =
                PromotedNotificationContentModel.Builder("notif").apply {
                PromotedNotificationContentBuilder("notif").applyToShared {
                    this.shortCriticalText = "Arrived"
                }
            val newPromotedContent = newPromotedContentBuilder.build()
@@ -452,6 +452,6 @@ class SingleNotificationChipInteractorTest : SysuiTestCase() {

    companion object {
        private const val UID = 885
        private val PROMOTED_CONTENT = PromotedNotificationContentModel.Builder("notif1").build()
        private val PROMOTED_CONTENT = PromotedNotificationContentBuilder("notif1").build()
    }
}
+31 −43
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ import com.android.systemui.statusbar.notification.data.repository.ActiveNotific
import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository
import com.android.systemui.statusbar.notification.data.repository.addNotif
import com.android.systemui.statusbar.notification.data.repository.removeNotif
import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel
import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentBuilder
import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel
import com.android.systemui.statusbar.notification.shared.CallType
import com.android.systemui.testKosmos
@@ -65,7 +65,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    activeNotificationModel(
                        key = "notif",
                        statusBarChipIcon = mock<StatusBarIconView>(),
                        promotedContent = PromotedNotificationContentModel.Builder("notif").build(),
                        promotedContent = PromotedNotificationContentBuilder("notif").build(),
                    )
                )
            )
@@ -96,7 +96,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    activeNotificationModel(
                        key = "notif",
                        statusBarChipIcon = null,
                        promotedContent = PromotedNotificationContentModel.Builder("notif").build(),
                        promotedContent = PromotedNotificationContentBuilder("notif").build(),
                    )
                )
            )
@@ -115,7 +115,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    activeNotificationModel(
                        key = "notif",
                        statusBarChipIcon = null,
                        promotedContent = PromotedNotificationContentModel.Builder("notif").build(),
                        promotedContent = PromotedNotificationContentBuilder("notif").build(),
                    )
                )
            )
@@ -135,7 +135,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    activeNotificationModel(
                        key = "notif",
                        statusBarChipIcon = icon,
                        promotedContent = PromotedNotificationContentModel.Builder("notif").build(),
                        promotedContent = PromotedNotificationContentBuilder("notif").build(),
                    )
                )
            )
@@ -158,12 +158,12 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    activeNotificationModel(
                        key = "notif1",
                        statusBarChipIcon = firstIcon,
                        promotedContent = PromotedNotificationContentModel.Builder("notif1").build(),
                        promotedContent = PromotedNotificationContentBuilder("notif1").build(),
                    ),
                    activeNotificationModel(
                        key = "notif2",
                        statusBarChipIcon = secondIcon,
                        promotedContent = PromotedNotificationContentModel.Builder("notif2").build(),
                        promotedContent = PromotedNotificationContentBuilder("notif2").build(),
                    ),
                    activeNotificationModel(
                        key = "notif3",
@@ -195,7 +195,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                        key = "notif",
                        uid = uid,
                        statusBarChipIcon = mock<StatusBarIconView>(),
                        promotedContent = PromotedNotificationContentModel.Builder("notif1").build(),
                        promotedContent = PromotedNotificationContentBuilder("notif1").build(),
                    )
                )
            )
@@ -223,14 +223,14 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                        key = "promotedNormal",
                        statusBarChipIcon = mock(),
                        promotedContent =
                            PromotedNotificationContentModel.Builder("promotedNormal").build(),
                            PromotedNotificationContentBuilder("promotedNormal").build(),
                        callType = CallType.None,
                    ),
                    activeNotificationModel(
                        key = "promotedCall",
                        statusBarChipIcon = mock(),
                        promotedContent =
                            PromotedNotificationContentModel.Builder("promotedCall").build(),
                            PromotedNotificationContentBuilder("promotedCall").build(),
                        callType = CallType.Ongoing,
                    ),
                )
@@ -256,7 +256,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    activeNotificationModel(
                        key = "notif",
                        statusBarChipIcon = firstIcon,
                        promotedContent = PromotedNotificationContentModel.Builder("notif").build(),
                        promotedContent = PromotedNotificationContentBuilder("notif").build(),
                    )
                )
            )
@@ -269,7 +269,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    activeNotificationModel(
                        key = "notif",
                        statusBarChipIcon = secondIcon,
                        promotedContent = PromotedNotificationContentModel.Builder("notif").build(),
                        promotedContent = PromotedNotificationContentBuilder("notif").build(),
                    )
                )
            )
@@ -282,7 +282,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    activeNotificationModel(
                        key = "notif",
                        statusBarChipIcon = thirdIcon,
                        promotedContent = PromotedNotificationContentModel.Builder("notif").build(),
                        promotedContent = PromotedNotificationContentBuilder("notif").build(),
                    )
                )
            )
@@ -302,7 +302,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    activeNotificationModel(
                        key = "notif",
                        statusBarChipIcon = mock(),
                        promotedContent = PromotedNotificationContentModel.Builder("notif").build(),
                        promotedContent = PromotedNotificationContentBuilder("notif").build(),
                    )
                )
            )
@@ -325,7 +325,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    activeNotificationModel(
                        key = "notif",
                        statusBarChipIcon = mock(),
                        promotedContent = PromotedNotificationContentModel.Builder("notif").build(),
                        promotedContent = PromotedNotificationContentBuilder("notif").build(),
                    )
                )
            )
@@ -348,7 +348,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                activeNotificationModel(
                    key = "notif1",
                    statusBarChipIcon = firstIcon,
                    promotedContent = PromotedNotificationContentModel.Builder("notif1").build(),
                    promotedContent = PromotedNotificationContentBuilder("notif1").build(),
                )
            setNotifs(listOf(notif1))
            assertThat(latest!!.map { it.key }).containsExactly("notif1").inOrder()
@@ -359,7 +359,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                activeNotificationModel(
                    key = "notif2",
                    statusBarChipIcon = secondIcon,
                    promotedContent = PromotedNotificationContentModel.Builder("notif2").build(),
                    promotedContent = PromotedNotificationContentBuilder("notif2").build(),
                )
            setNotifs(listOf(notif1, notif2))

@@ -380,7 +380,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {

            // WHEN notif1 gets an update
            val notif1NewPromotedContent =
                PromotedNotificationContentModel.Builder("notif1").apply {
                PromotedNotificationContentBuilder("notif1").applyToShared {
                    this.shortCriticalText = "Arrived"
                }
            setNotifs(
@@ -426,8 +426,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    key = notif1Info.key,
                    uid = notif1Info.uid,
                    statusBarChipIcon = notif1Info.icon,
                    promotedContent =
                        PromotedNotificationContentModel.Builder(notif1Info.key).build(),
                    promotedContent = PromotedNotificationContentBuilder(notif1Info.key).build(),
                )
            )
            activityManagerRepository.fake.setIsAppVisible(notif1Info.uid, isAppVisible = false)
@@ -443,8 +442,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    key = notif2Info.key,
                    uid = notif2Info.uid,
                    statusBarChipIcon = notif2Info.icon,
                    promotedContent =
                        PromotedNotificationContentModel.Builder(notif2Info.key).build(),
                    promotedContent = PromotedNotificationContentBuilder(notif2Info.key).build(),
                )
            )
            activityManagerRepository.fake.setIsAppVisible(notif2Info.uid, isAppVisible = false)
@@ -482,16 +480,14 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    key = notif1Info.key,
                    uid = notif1Info.uid,
                    statusBarChipIcon = notif1Info.icon,
                    promotedContent =
                        PromotedNotificationContentModel.Builder(notif1Info.key).build(),
                    promotedContent = PromotedNotificationContentBuilder(notif1Info.key).build(),
                )
            val notif2 =
                activeNotificationModel(
                    key = notif2Info.key,
                    uid = notif2Info.uid,
                    statusBarChipIcon = notif2Info.icon,
                    promotedContent =
                        PromotedNotificationContentModel.Builder(notif2Info.key).build(),
                    promotedContent = PromotedNotificationContentBuilder(notif2Info.key).build(),
                )
            setNotifs(listOf(notif1, notif2))
            assertThat(latest!!.map { it.key }).containsExactly("notif1", "notif2").inOrder()
@@ -537,16 +533,14 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    key = notif1Info.key,
                    uid = notif1Info.uid,
                    statusBarChipIcon = notif1Info.icon,
                    promotedContent =
                        PromotedNotificationContentModel.Builder(notif1Info.key).build(),
                    promotedContent = PromotedNotificationContentBuilder(notif1Info.key).build(),
                )
            val notif2 =
                activeNotificationModel(
                    key = notif2Info.key,
                    uid = notif2Info.uid,
                    statusBarChipIcon = notif2Info.icon,
                    promotedContent =
                        PromotedNotificationContentModel.Builder(notif2Info.key).build(),
                    promotedContent = PromotedNotificationContentBuilder(notif2Info.key).build(),
                )
            setNotifs(listOf(notif1, notif2))
            assertThat(latest!!.map { it.key }).containsExactly("notif1", "notif2").inOrder()
@@ -567,8 +561,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    key = notif3Info.key,
                    uid = notif3Info.uid,
                    statusBarChipIcon = notif3Info.icon,
                    promotedContent =
                        PromotedNotificationContentModel.Builder(notif3Info.key).build(),
                    promotedContent = PromotedNotificationContentBuilder(notif3Info.key).build(),
                )
            setNotifs(listOf(notif1, notif2, notif3))

@@ -597,8 +590,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    key = notif1Info.key,
                    uid = notif1Info.uid,
                    statusBarChipIcon = notif1Info.icon,
                    promotedContent =
                        PromotedNotificationContentModel.Builder(notif1Info.key).build(),
                    promotedContent = PromotedNotificationContentBuilder(notif1Info.key).build(),
                )
            setNotifs(listOf(notif1))

@@ -609,8 +601,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    key = notif2Info.key,
                    uid = notif2Info.uid,
                    statusBarChipIcon = notif2Info.icon,
                    promotedContent =
                        PromotedNotificationContentModel.Builder(notif2Info.key).build(),
                    promotedContent = PromotedNotificationContentBuilder(notif2Info.key).build(),
                )
            setNotifs(listOf(notif1, notif2))

@@ -637,7 +628,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {

            // WHEN notif2 gets an update
            val notif2NewPromotedContent =
                PromotedNotificationContentModel.Builder("notif2").apply {
                PromotedNotificationContentBuilder("notif2").applyToShared {
                    this.shortCriticalText = "Arrived"
                }
            setNotifs(
@@ -662,8 +653,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    key = notif3Info.key,
                    uid = notif3Info.uid,
                    statusBarChipIcon = notif3Info.icon,
                    promotedContent =
                        PromotedNotificationContentModel.Builder(notif3Info.key).build(),
                    promotedContent = PromotedNotificationContentBuilder(notif3Info.key).build(),
                )
            setNotifs(listOf(notif1, notif2, notif3))

@@ -710,8 +700,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    activeNotificationModel(
                        key = "notif|uid1",
                        statusBarChipIcon = firstIcon,
                        promotedContent =
                            PromotedNotificationContentModel.Builder("notif|uid1").build(),
                        promotedContent = PromotedNotificationContentBuilder("notif|uid1").build(),
                    )
                )
            )
@@ -725,8 +714,7 @@ class StatusBarNotificationChipsInteractorTest : SysuiTestCase() {
                    activeNotificationModel(
                        key = "notif|uid2",
                        statusBarChipIcon = secondIcon,
                        promotedContent =
                            PromotedNotificationContentModel.Builder("notif|uid2").build(),
                        promotedContent = PromotedNotificationContentBuilder("notif|uid2").build(),
                    )
                )
            )
+28 −28

File changed.

Preview size limit exceeded, changes collapsed.

+39 −62

File changed.

Preview size limit exceeded, changes collapsed.

Loading