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

Commit 0cbfacb7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[SB][Chips] Add managingPackage name for call chips" into main

parents 0d68ca55 293151b3
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -193,13 +193,20 @@ class CallChipViewModelTest(flags: FlagsParameterization) : SysuiTestCase() {
            val latest by collectLastValue(underTest.chip)

            val instanceId = InstanceId.fakeInstanceId(10)
            addOngoingCallState(startTimeMs = -2, isAppVisible = false, instanceId = instanceId)
            addOngoingCallState(
                startTimeMs = -2,
                isAppVisible = false,
                instanceId = instanceId,
                packageName = PACKAGE_NAME,
            )

            assertThat((latest as OngoingActivityChipModel.Active).content)
                .isInstanceOf(OngoingActivityChipModel.Content.IconOnly::class.java)
            assertThat((latest as OngoingActivityChipModel.Active).isHidden).isFalse()
            assertThat((latest as OngoingActivityChipModel.Active).isImportantForPrivacy).isFalse()
            assertThat((latest as OngoingActivityChipModel.Active).instanceId).isEqualTo(instanceId)
            assertThat((latest as OngoingActivityChipModel.Active).managingPackageName)
                .isEqualTo(PACKAGE_NAME)
        }

    @Test
@@ -1455,7 +1462,7 @@ class CallChipViewModelTest(flags: FlagsParameterization) : SysuiTestCase() {

        private const val NOTIFICATION_KEY = "testKey"
        private const val NOTIFICATION_UID = 12345

        private const val PACKAGE_NAME = "testApp.package.name"
        @get:Parameters(name = "{0}")
        @JvmStatic
        val flags: List<FlagsParameterization>
+1 −0
Original line number Diff line number Diff line
@@ -255,6 +255,7 @@ constructor(
        return OngoingActivityChipModel.Active(
            key = key,
            icon = icon,
            managingPackageName = state.packageName,
            content = content,
            colors = colors,
            onClickListenerLegacy = getOnClickListener(intent, instanceId, state.notificationKey),
+3 −0
Original line number Diff line number Diff line
@@ -174,6 +174,7 @@ constructor(
                // be safely made false.
                isAppVisible = false,
                notificationInstanceId = currentInfo.instanceId,
                packageName = currentInfo.packageName,
            )
        } else {
            return OngoingCallModel.NoCall
@@ -236,6 +237,7 @@ constructor(
                    notifModel.promotedContent,
                    isOngoing = true,
                    statusBarSwipedAway = callNotificationInfo?.statusBarSwipedAway ?: false,
                    packageName = notifModel.packageName,
                )
            if (newOngoingCallInfo == callNotificationInfo) {
                return
@@ -367,6 +369,7 @@ constructor(
        val isOngoing: Boolean,
        /** True if the user has swiped away the status bar while in this phone call. */
        val statusBarSwipedAway: Boolean,
        val packageName: String,
    )

    override fun dump(pw: PrintWriter, args: Array<out String>) {
+1 −0
Original line number Diff line number Diff line
@@ -169,6 +169,7 @@ constructor(
            requestedPromotion = model.requestedPromotion,
            isAppVisible = isVisible,
            notificationInstanceId = model.instanceId,
            packageName = model.packageName,
        )
    }

+2 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ sealed interface OngoingCallModel {
     * @property isAppVisible whether the app to which the call belongs is currently visible.
     * @property notificationInstanceId an optional per-chip ID used for logging. Should stay the
     *   same throughout the lifetime of a single chip.
     * @property packageName the package name of the app to which the call belongs.
     */
    data class InCall(
        val startTimeMs: Long,
@@ -61,6 +62,7 @@ sealed interface OngoingCallModel {
        val promotedContent: PromotedNotificationContentModels?,
        val isAppVisible: Boolean,
        val notificationInstanceId: InstanceId?,
        val packageName: String,
    ) : OngoingCallModel {
        override fun logString(): String {
            return "InCall(notifKey=$notificationKey " +
Loading