summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Caitlin Shkuratov <caitlinshk@google.com> 2025-01-28 15:47:46 +0000
committer Caitlin Shkuratov <caitlinshk@google.com> 2025-01-30 06:36:16 -0800
commit53bda7c253441fc6c0b03721ab9fe523480e8357 (patch)
treeaa8b11dc5c30acd597bea869f6ca723dd1627bd9
parente69156bf28b6be52875fc3c14d72cf2006502cd4 (diff)
[SB][Notif] Use correct content descriptions for RON chips & call chips.
Bug: 364653005 Flag: com.android.systemui.status_bar_notification_chips Test: Verify call chip content description is "{app name} notification: Ongoing call. {time}" Test: Verify notif chip content description is "{app name} notification: Ongoing. {chip text}" Test: Verify screen recording chip content description is "Screen recording" (or "Screen casting" or "Screen sharing"), {time}" Test: Verify all the above with chips_modernization flag OFF and ON Change-Id: I0608dc680af24027c1f2947da550f98f2587423d
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModelTest.kt56
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/domain/interactor/SingleNotificationChipInteractorTest.kt5
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModelTest.kt61
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithNotifsViewModelTest.kt24
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt2
-rw-r--r--packages/SystemUI/res/values/strings.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModel.kt21
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/domain/interactor/SingleNotificationChipInteractor.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/domain/model/NotificationChipModel.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt29
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/binder/OngoingActivityChipBinder.kt28
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/compose/OngoingActivityChip.kt19
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/model/OngoingActivityChipModel.kt11
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationListInteractor.kt17
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/shared/ActiveNotificationModel.kt2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractor.kt1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallModel.kt2
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModelKosmos.kt2
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModelKosmos.kt2
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/data/model/ActiveNotificationModelBuilder.kt2
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationListInteractorKosmos.kt7
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallModelBuilder.kt11
23 files changed, 254 insertions, 57 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModelTest.kt
index 75262a4d058d..03c07510ce53 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModelTest.kt
@@ -24,9 +24,9 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.animation.Expandable
+import com.android.systemui.common.shared.model.ContentDescription.Companion.loadContentDescription
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.coroutines.collectLastValue
-import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.testScope
import com.android.systemui.plugins.activityStarter
import com.android.systemui.res.R
@@ -47,6 +47,7 @@ import com.android.systemui.statusbar.phone.ongoingcall.StatusBarChipsModernizat
import com.android.systemui.statusbar.phone.ongoingcall.data.repository.ongoingCallRepository
import com.android.systemui.statusbar.phone.ongoingcall.shared.model.OngoingCallModel
import com.android.systemui.statusbar.phone.ongoingcall.shared.model.inCallModel
+import com.android.systemui.testKosmos
import com.android.systemui.util.time.fakeSystemClock
import com.google.common.truth.Truth.assertThat
import kotlin.test.Test
@@ -60,7 +61,7 @@ import org.mockito.kotlin.whenever
@SmallTest
@RunWith(AndroidJUnit4::class)
class CallChipViewModelTest : SysuiTestCase() {
- private val kosmos = Kosmos()
+ private val kosmos = testKosmos()
private val notificationListRepository = kosmos.activeNotificationListRepository
private val testScope = kosmos.testScope
private val repo = kosmos.ongoingCallRepository
@@ -162,25 +163,34 @@ class CallChipViewModelTest : SysuiTestCase() {
@Test
@DisableFlags(StatusBarConnectedDisplays.FLAG_NAME)
- fun chip_zeroStartTime_cdFlagOff_iconIsNotifIcon() =
+ fun chip_zeroStartTime_cdFlagOff_iconIsNotifIcon_withContentDescription() =
testScope.runTest {
val latest by collectLastValue(underTest.chip)
val notifIcon = createStatusBarIconViewOrNull()
- repo.setOngoingCallState(inCallModel(startTimeMs = 0, notificationIcon = notifIcon))
+ repo.setOngoingCallState(
+ inCallModel(
+ startTimeMs = 0,
+ notificationIcon = notifIcon,
+ appName = "Fake app name",
+ )
+ )
assertThat((latest as OngoingActivityChipModel.Shown).icon)
.isInstanceOf(OngoingActivityChipModel.ChipIcon.StatusBarView::class.java)
val actualIcon =
- (((latest as OngoingActivityChipModel.Shown).icon)
- as OngoingActivityChipModel.ChipIcon.StatusBarView)
- .impl
- assertThat(actualIcon).isEqualTo(notifIcon)
+ (latest as OngoingActivityChipModel.Shown).icon
+ as OngoingActivityChipModel.ChipIcon.StatusBarView
+ assertThat(actualIcon.impl).isEqualTo(notifIcon)
+ assertThat(actualIcon.contentDescription.loadContentDescription(context))
+ .contains("Ongoing call")
+ assertThat(actualIcon.contentDescription.loadContentDescription(context))
+ .contains("Fake app name")
}
@Test
@EnableFlags(StatusBarConnectedDisplays.FLAG_NAME)
- fun chip_zeroStartTime_cdFlagOn_iconIsNotifKeyIcon() =
+ fun chip_zeroStartTime_cdFlagOn_iconIsNotifKeyIcon_withContentDescription() =
testScope.runTest {
val latest by collectLastValue(underTest.chip)
@@ -189,11 +199,22 @@ class CallChipViewModelTest : SysuiTestCase() {
startTimeMs = 0,
notificationIcon = createStatusBarIconViewOrNull(),
notificationKey = "notifKey",
+ appName = "Fake app name",
)
)
assertThat((latest as OngoingActivityChipModel.Shown).icon)
- .isEqualTo(OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon("notifKey"))
+ .isInstanceOf(
+ OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon::class.java
+ )
+ val actualIcon =
+ (latest as OngoingActivityChipModel.Shown).icon
+ as OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon
+ assertThat(actualIcon.notificationKey).isEqualTo("notifKey")
+ assertThat(actualIcon.contentDescription.loadContentDescription(context))
+ .contains("Ongoing call")
+ assertThat(actualIcon.contentDescription.loadContentDescription(context))
+ .contains("Fake app name")
}
@Test
@@ -216,7 +237,7 @@ class CallChipViewModelTest : SysuiTestCase() {
@Test
@EnableFlags(StatusBarConnectedDisplays.FLAG_NAME)
- fun chip_notifIconFlagOn_butNullNotifIcon_iconNotifKey() =
+ fun chip_notifIconFlagOn_butNullNotifIcon_cdFlagOn_iconIsNotifKeyIcon_withContentDescription() =
testScope.runTest {
val latest by collectLastValue(underTest.chip)
@@ -225,11 +246,22 @@ class CallChipViewModelTest : SysuiTestCase() {
startTimeMs = 1000,
notificationIcon = null,
notificationKey = "notifKey",
+ appName = "Fake app name",
)
)
assertThat((latest as OngoingActivityChipModel.Shown).icon)
- .isEqualTo(OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon("notifKey"))
+ .isInstanceOf(
+ OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon::class.java
+ )
+ val actualIcon =
+ (latest as OngoingActivityChipModel.Shown).icon
+ as OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon
+ assertThat(actualIcon.notificationKey).isEqualTo("notifKey")
+ assertThat(actualIcon.contentDescription.loadContentDescription(context))
+ .contains("Ongoing call")
+ assertThat(actualIcon.contentDescription.loadContentDescription(context))
+ .contains("Fake app name")
}
@Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/domain/interactor/SingleNotificationChipInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/domain/interactor/SingleNotificationChipInteractorTest.kt
index fe15eac46e2d..05f2585cfaa5 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/domain/interactor/SingleNotificationChipInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/domain/interactor/SingleNotificationChipInteractorTest.kt
@@ -49,6 +49,7 @@ class SingleNotificationChipInteractorTest : SysuiTestCase() {
val startingNotif =
activeNotificationModel(
key = "notif1",
+ appName = "Fake Name",
statusBarChipIcon = icon,
promotedContent = PROMOTED_CONTENT,
)
@@ -58,6 +59,7 @@ class SingleNotificationChipInteractorTest : SysuiTestCase() {
val latest by collectLastValue(underTest.notificationChip)
assertThat(latest!!.key).isEqualTo("notif1")
+ assertThat(latest!!.appName).isEqualTo("Fake Name")
assertThat(latest!!.statusBarChipIconView).isEqualTo(icon)
assertThat(latest!!.promotedContent).isEqualTo(PROMOTED_CONTENT)
}
@@ -70,6 +72,7 @@ class SingleNotificationChipInteractorTest : SysuiTestCase() {
factory.create(
activeNotificationModel(
key = "notif1",
+ appName = "Fake Name",
statusBarChipIcon = originalIconView,
promotedContent = PROMOTED_CONTENT,
),
@@ -82,12 +85,14 @@ class SingleNotificationChipInteractorTest : SysuiTestCase() {
underTest.setNotification(
activeNotificationModel(
key = "notif1",
+ appName = "New Name",
statusBarChipIcon = newIconView,
promotedContent = PROMOTED_CONTENT,
)
)
assertThat(latest!!.key).isEqualTo("notif1")
+ assertThat(latest!!.appName).isEqualTo("New Name")
assertThat(latest!!.statusBarChipIconView).isEqualTo(newIconView)
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModelTest.kt
index 942e6554e5d9..1f77ddc73aa5 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModelTest.kt
@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.chips.notification.ui.viewmodel
+import android.content.Context
import android.platform.test.annotations.DisableFlags
import android.platform.test.annotations.EnableFlags
import android.view.View
@@ -23,6 +24,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.Flags.FLAG_PROMOTE_NOTIFICATIONS_AUTOMATICALLY
import com.android.systemui.SysuiTestCase
+import com.android.systemui.common.shared.model.ContentDescription.Companion.loadContentDescription
import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository
import com.android.systemui.kosmos.collectLastValue
@@ -125,7 +127,7 @@ class NotifChipsViewModelTest : SysuiTestCase() {
@Test
@DisableFlags(FLAG_PROMOTE_NOTIFICATIONS_AUTOMATICALLY)
- fun chips_onePromotedNotif_statusBarIconViewMatches() =
+ fun chips_onePromotedNotif_connectedDisplaysFlagDisabled_statusBarIconViewMatches() =
kosmos.runTest {
val latest by collectLastValue(underTest.chips)
@@ -134,6 +136,7 @@ class NotifChipsViewModelTest : SysuiTestCase() {
listOf(
activeNotificationModel(
key = "notif",
+ appName = "Fake App Name",
statusBarChipIcon = icon,
promotedContent = PromotedNotificationContentModel.Builder("notif").build(),
)
@@ -142,7 +145,13 @@ class NotifChipsViewModelTest : SysuiTestCase() {
assertThat(latest).hasSize(1)
val chip = latest!![0]
- assertIsNotifChip(chip, icon, "notif")
+ assertIsNotifChip(
+ chip,
+ context,
+ icon,
+ expectedNotificationKey = "notif",
+ expectedContentDescriptionSubstrings = listOf("Ongoing", "Fake App Name"),
+ )
}
@Test
@@ -157,6 +166,7 @@ class NotifChipsViewModelTest : SysuiTestCase() {
listOf(
activeNotificationModel(
key = notifKey,
+ appName = "Fake App Name",
statusBarChipIcon = null,
promotedContent = PromotedNotificationContentModel.Builder(notifKey).build(),
)
@@ -165,9 +175,13 @@ class NotifChipsViewModelTest : SysuiTestCase() {
assertThat(latest).hasSize(1)
val chip = latest!![0]
- assertThat(chip).isInstanceOf(OngoingActivityChipModel.Shown::class.java)
- assertThat(chip.icon)
- .isEqualTo(OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon(notifKey))
+ assertIsNotifChip(
+ chip,
+ context,
+ expectedIcon = null,
+ expectedNotificationKey = "notif",
+ expectedContentDescriptionSubstrings = listOf("Ongoing", "Fake App Name"),
+ )
}
@Test
@@ -230,8 +244,8 @@ class NotifChipsViewModelTest : SysuiTestCase() {
)
assertThat(latest).hasSize(2)
- assertIsNotifChip(latest!![0], firstIcon, "notif1")
- assertIsNotifChip(latest!![1], secondIcon, "notif2")
+ assertIsNotifChip(latest!![0], context, firstIcon, "notif1")
+ assertIsNotifChip(latest!![1], context, secondIcon, "notif2")
}
@Test
@@ -590,7 +604,7 @@ class NotifChipsViewModelTest : SysuiTestCase() {
// THEN the "notif" chip keeps showing time
val chip = latest!![0]
assertThat(chip).isInstanceOf(OngoingActivityChipModel.Shown.ShortTimeDelta::class.java)
- assertIsNotifChip(chip, icon, "notif")
+ assertIsNotifChip(chip, context, icon, "notif")
}
@Test
@@ -705,24 +719,41 @@ class NotifChipsViewModelTest : SysuiTestCase() {
companion object {
fun assertIsNotifChip(
latest: OngoingActivityChipModel?,
+ context: Context,
expectedIcon: StatusBarIconView?,
- notificationKey: String,
+ expectedNotificationKey: String,
+ expectedContentDescriptionSubstrings: List<String> = emptyList(),
) {
val shown = latest as OngoingActivityChipModel.Shown
if (StatusBarConnectedDisplays.isEnabled) {
assertThat(shown.icon)
- .isEqualTo(
- OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon(notificationKey)
+ .isInstanceOf(
+ OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon::class.java
)
+ val icon = shown.icon as OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon
+
+ assertThat(icon.notificationKey).isEqualTo(expectedNotificationKey)
+ expectedContentDescriptionSubstrings.forEach {
+ assertThat(icon.contentDescription.loadContentDescription(context)).contains(it)
+ }
} else {
- assertThat(latest.icon)
- .isEqualTo(OngoingActivityChipModel.ChipIcon.StatusBarView(expectedIcon!!))
+ assertThat(shown.icon)
+ .isInstanceOf(OngoingActivityChipModel.ChipIcon.StatusBarView::class.java)
+ val icon = shown.icon as OngoingActivityChipModel.ChipIcon.StatusBarView
+ assertThat(icon.impl).isEqualTo(expectedIcon!!)
+ expectedContentDescriptionSubstrings.forEach {
+ assertThat(icon.contentDescription.loadContentDescription(context)).contains(it)
+ }
}
}
fun assertIsNotifKey(latest: OngoingActivityChipModel?, expectedKey: String) {
- assertThat((latest as OngoingActivityChipModel.Shown).icon)
- .isEqualTo(OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon(expectedKey))
+ assertThat(
+ ((latest as OngoingActivityChipModel.Shown).icon
+ as OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon)
+ .notificationKey
+ )
+ .isEqualTo(expectedKey)
}
}
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithNotifsViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithNotifsViewModelTest.kt
index 28f360108e50..78103a9906c4 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithNotifsViewModelTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsWithNotifsViewModelTest.kt
@@ -311,7 +311,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() {
)
)
- assertIsNotifChip(latest!!.primary, icon, "notif")
+ assertIsNotifChip(latest!!.primary, context, icon, "notif")
assertThat(latest!!.secondary).isInstanceOf(OngoingActivityChipModel.Hidden::class.java)
}
@@ -339,8 +339,8 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() {
)
)
- assertIsNotifChip(latest!!.primary, firstIcon, "firstNotif")
- assertIsNotifChip(latest!!.secondary, secondIcon, "secondNotif")
+ assertIsNotifChip(latest!!.primary, context, firstIcon, "firstNotif")
+ assertIsNotifChip(latest!!.secondary, context, secondIcon, "secondNotif")
}
@Test
@@ -374,8 +374,8 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() {
)
)
- assertIsNotifChip(latest!!.primary, firstIcon, "firstNotif")
- assertIsNotifChip(latest!!.secondary, secondIcon, "secondNotif")
+ assertIsNotifChip(latest!!.primary, context, firstIcon, "firstNotif")
+ assertIsNotifChip(latest!!.secondary, context, secondIcon, "secondNotif")
}
@Test
@@ -407,7 +407,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() {
)
assertIsCallChip(latest!!.primary, callNotificationKey)
- assertIsNotifChip(latest!!.secondary, firstIcon, "firstNotif")
+ assertIsNotifChip(latest!!.secondary, context, firstIcon, "firstNotif")
}
@Test
@@ -456,7 +456,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() {
val latest by collectLastValue(underTest.primaryChip)
- assertIsNotifChip(latest, notifIcon, "notif")
+ assertIsNotifChip(latest, context, notifIcon, "notif")
// WHEN the higher priority call chip is added
callRepo.setOngoingCallState(
@@ -527,7 +527,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() {
callRepo.setOngoingCallState(OngoingCallModel.NoCall)
// THEN the lower priority notif is used
- assertIsNotifChip(latest, notifIcon, "notif")
+ assertIsNotifChip(latest, context, notifIcon, "notif")
}
@Test
@@ -552,7 +552,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() {
val latest by collectLastValue(underTest.chips)
- assertIsNotifChip(latest!!.primary, notifIcon, "notif")
+ assertIsNotifChip(latest!!.primary, context, notifIcon, "notif")
assertThat(latest!!.secondary).isInstanceOf(OngoingActivityChipModel.Hidden::class.java)
// WHEN the higher priority call chip is added
@@ -563,7 +563,7 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() {
// THEN the higher priority call chip is used as primary and notif is demoted to
// secondary
assertIsCallChip(latest!!.primary, callNotificationKey)
- assertIsNotifChip(latest!!.secondary, notifIcon, "notif")
+ assertIsNotifChip(latest!!.secondary, context, notifIcon, "notif")
// WHEN the higher priority media projection chip is added
mediaProjectionState.value =
@@ -590,13 +590,13 @@ class OngoingActivityChipsWithNotifsViewModelTest : SysuiTestCase() {
// THEN media projection and notif remain
assertIsShareToAppChip(latest!!.primary)
- assertIsNotifChip(latest!!.secondary, notifIcon, "notif")
+ assertIsNotifChip(latest!!.secondary, context, notifIcon, "notif")
// WHEN media projection is dropped
mediaProjectionState.value = MediaProjectionState.NotProjecting
// THEN notif is promoted to primary
- assertIsNotifChip(latest!!.primary, notifIcon, "notif")
+ assertIsNotifChip(latest!!.primary, context, notifIcon, "notif")
assertThat(latest!!.secondary).isInstanceOf(OngoingActivityChipModel.Hidden::class.java)
}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt
index 5d9aa71c5d89..35b19c19d5ce 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationsListInteractorTest.kt
@@ -47,7 +47,7 @@ class RenderNotificationsListInteractorTest : SysuiTestCase() {
private val notifsRepository = kosmos.activeNotificationListRepository
private val notifsInteractor = kosmos.activeNotificationsInteractor
private val underTest =
- RenderNotificationListInteractor(notifsRepository, sectionStyleProvider = mock())
+ RenderNotificationListInteractor(notifsRepository, sectionStyleProvider = mock(), context)
@Test
fun setRenderedList_preservesOrdering() =
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index fc9635bb6e45..7b2e8126b0c2 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -3401,6 +3401,8 @@
<!-- Content description for a chip in the status bar showing that the user is currently on a call. [CHAR LIMIT=NONE] -->
<string name="ongoing_call_content_description">Ongoing call</string>
+ <!-- Content description for a chip in the status bar showing that the user currently has an ongoing activity. [CHAR LIMIT=NONE]-->
+ <string name="ongoing_notification_extra_content_description">Ongoing</string>
<!-- Provider Model: Default title of the mobile network in the mobile layout. [CHAR LIMIT=50] -->
<string name="mobile_data_settings_title">Mobile data</string>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModel.kt
index 541a07c47df2..98b75216bbe9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModel.kt
@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.chips.call.ui.viewmodel
+import android.content.Context
import android.view.View
import com.android.internal.jank.Cuj
import com.android.systemui.animation.ActivityTransitionAnimator
@@ -23,6 +24,7 @@ import com.android.systemui.common.shared.model.ContentDescription
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
+import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.core.LogLevel
import com.android.systemui.plugins.ActivityStarter
@@ -52,6 +54,7 @@ import kotlinx.coroutines.flow.stateIn
open class CallChipViewModel
@Inject
constructor(
+ @Main private val context: Context,
@Application private val scope: CoroutineScope,
interactor: CallChipInteractor,
systemClock: SystemClock,
@@ -65,15 +68,18 @@ constructor(
is OngoingCallModel.NoCall,
is OngoingCallModel.InCallWithVisibleApp -> OngoingActivityChipModel.Hidden()
is OngoingCallModel.InCall -> {
+ val contentDescription = getContentDescription(state.appName)
val icon =
if (state.notificationIconView != null) {
StatusBarConnectedDisplays.assertInLegacyMode()
OngoingActivityChipModel.ChipIcon.StatusBarView(
- state.notificationIconView
+ state.notificationIconView,
+ contentDescription,
)
} else if (StatusBarConnectedDisplays.isEnabled) {
OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon(
- state.notificationKey
+ state.notificationKey,
+ contentDescription,
)
} else {
OngoingActivityChipModel.ChipIcon.SingleColorIcon(phoneIcon)
@@ -155,6 +161,17 @@ constructor(
)
}
+ private fun getContentDescription(appName: String): ContentDescription {
+ val ongoingCallDescription = context.getString(R.string.ongoing_call_content_description)
+ return ContentDescription.Loaded(
+ context.getString(
+ R.string.accessibility_desc_notification_icon,
+ appName,
+ ongoingCallDescription,
+ )
+ )
+ }
+
companion object {
private val phoneIcon =
Icon.Resource(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/domain/interactor/SingleNotificationChipInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/domain/interactor/SingleNotificationChipInteractor.kt
index cece52110567..a9338885d4c2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/domain/interactor/SingleNotificationChipInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/domain/interactor/SingleNotificationChipInteractor.kt
@@ -138,7 +138,7 @@ constructor(
}
}
- return NotificationChipModel(key, statusBarChipIconView, promotedContent)
+ return NotificationChipModel(key, appName, statusBarChipIconView, promotedContent)
}
@AssistedFactory
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/domain/model/NotificationChipModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/domain/model/NotificationChipModel.kt
index c6759da304bb..e7a90804a768 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/domain/model/NotificationChipModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/domain/model/NotificationChipModel.kt
@@ -22,6 +22,8 @@ import com.android.systemui.statusbar.notification.promoted.shared.model.Promote
/** Modeling all the data needed to render a status bar notification chip. */
data class NotificationChipModel(
val key: String,
+ /** The user-readable name of the app that posted the call notification. */
+ val appName: String,
val statusBarChipIconView: StatusBarIconView?,
val promotedContent: PromotedNotificationContentModel,
)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt
index 46456b841e3f..b0da6428f579 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt
@@ -16,10 +16,14 @@
package com.android.systemui.statusbar.chips.notification.ui.viewmodel
+import android.content.Context
import android.view.View
import com.android.systemui.Flags
+import com.android.systemui.common.shared.model.ContentDescription
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
+import com.android.systemui.dagger.qualifiers.Main
+import com.android.systemui.res.R
import com.android.systemui.statusbar.chips.notification.domain.interactor.StatusBarNotificationChipsInteractor
import com.android.systemui.statusbar.chips.notification.domain.model.NotificationChipModel
import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips
@@ -43,6 +47,7 @@ import kotlinx.coroutines.launch
class NotifChipsViewModel
@Inject
constructor(
+ @Main private val context: Context,
@Application private val applicationScope: CoroutineScope,
private val notifChipsInteractor: StatusBarNotificationChipsInteractor,
headsUpNotificationInteractor: HeadsUpNotificationInteractor,
@@ -65,13 +70,20 @@ constructor(
headsUpState: TopPinnedState
): OngoingActivityChipModel.Shown {
StatusBarNotifChips.assertInNewMode()
+ val contentDescription = getContentDescription(this.appName)
val icon =
if (this.statusBarChipIconView != null) {
StatusBarConnectedDisplays.assertInLegacyMode()
- OngoingActivityChipModel.ChipIcon.StatusBarView(this.statusBarChipIconView)
+ OngoingActivityChipModel.ChipIcon.StatusBarView(
+ this.statusBarChipIconView,
+ contentDescription,
+ )
} else {
StatusBarConnectedDisplays.assertInNewMode()
- OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon(this.key)
+ OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon(
+ this.key,
+ contentDescription,
+ )
}
val colors = this.promotedContent.toCustomColorsModel()
@@ -79,6 +91,7 @@ constructor(
// The notification pipeline needs everything to run on the main thread, so keep
// this event on the main thread.
applicationScope.launch {
+ // TODO(b/364653005): Move accessibility focus to the HUN when chip is tapped.
notifChipsInteractor.onPromotedNotificationChipTapped(this@toActivityChipModel.key)
}
}
@@ -173,4 +186,16 @@ constructor(
}
}
}
+
+ private fun getContentDescription(appName: String): ContentDescription {
+ val ongoingDescription =
+ context.getString(R.string.ongoing_notification_extra_content_description)
+ return ContentDescription.Loaded(
+ context.getString(
+ R.string.accessibility_desc_notification_icon,
+ appName,
+ ongoingDescription,
+ )
+ )
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/binder/OngoingActivityChipBinder.kt b/packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/binder/OngoingActivityChipBinder.kt
index f5764d59e6ff..de9d4974c0c6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/binder/OngoingActivityChipBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/binder/OngoingActivityChipBinder.kt
@@ -26,6 +26,8 @@ import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.TextView
import androidx.annotation.UiThread
+import com.android.systemui.common.shared.model.ContentDescription
+import com.android.systemui.common.ui.binder.ContentDescriptionViewBinder
import com.android.systemui.common.ui.binder.IconViewBinder
import com.android.systemui.res.R
import com.android.systemui.statusbar.StatusBarIconView
@@ -187,7 +189,13 @@ object OngoingActivityChipBinder {
}
is OngoingActivityChipModel.ChipIcon.StatusBarView -> {
StatusBarConnectedDisplays.assertInLegacyMode()
- setStatusBarIconView(defaultIconView, icon.impl, iconTint, backgroundView)
+ setStatusBarIconView(
+ defaultIconView,
+ icon.impl,
+ icon.contentDescription,
+ iconTint,
+ backgroundView,
+ )
}
is OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon -> {
StatusBarConnectedDisplays.assertInNewMode()
@@ -196,7 +204,13 @@ object OngoingActivityChipBinder {
// This means that the notification key doesn't exist anymore.
return
}
- setStatusBarIconView(defaultIconView, iconView, iconTint, backgroundView)
+ setStatusBarIconView(
+ defaultIconView,
+ iconView,
+ icon.contentDescription,
+ iconTint,
+ backgroundView,
+ )
}
}
}
@@ -215,6 +229,7 @@ object OngoingActivityChipBinder {
private fun setStatusBarIconView(
defaultIconView: ImageView,
iconView: StatusBarIconView,
+ iconContentDescription: ContentDescription,
iconTint: Int,
backgroundView: ChipBackgroundContainer,
) {
@@ -224,9 +239,12 @@ object OngoingActivityChipBinder {
// 1. Set up the right visual params.
with(iconView) {
id = CUSTOM_ICON_VIEW_ID
- // TODO(b/354930838): For RON chips, use the app name for the content description.
- contentDescription =
- context.resources.getString(R.string.ongoing_call_content_description)
+ if (StatusBarNotifChips.isEnabled) {
+ ContentDescriptionViewBinder.bind(iconContentDescription, this)
+ } else {
+ contentDescription =
+ context.resources.getString(R.string.ongoing_call_content_description)
+ }
tintView(iconTint)
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/compose/OngoingActivityChip.kt b/packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/compose/OngoingActivityChip.kt
index 647f3bd469f1..816f291b9273 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/compose/OngoingActivityChip.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/compose/OngoingActivityChip.kt
@@ -37,11 +37,14 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.dimensionResource
+import androidx.compose.ui.semantics.contentDescription
+import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
import com.android.compose.animation.Expandable
import com.android.systemui.animation.Expandable
import com.android.systemui.common.ui.compose.Icon
+import com.android.systemui.common.ui.compose.load
import com.android.systemui.res.R
import com.android.systemui.statusbar.chips.ui.model.ColorsModel
import com.android.systemui.statusbar.chips.ui.model.OngoingActivityChipModel
@@ -82,11 +85,25 @@ private fun ChipBody(
val isClickable = onClick != {}
val hasEmbeddedIcon = model.icon is OngoingActivityChipModel.ChipIcon.StatusBarView
+ val contentDescription =
+ when (val icon = model.icon) {
+ is OngoingActivityChipModel.ChipIcon.StatusBarView -> icon.contentDescription.load()
+ is OngoingActivityChipModel.ChipIcon.StatusBarNotificationIcon ->
+ icon.contentDescription.load()
+ is OngoingActivityChipModel.ChipIcon.SingleColorIcon -> null
+ null -> null
+ }
+
// Use a Box with `fillMaxHeight` to create a larger click surface for the chip. The visible
// height of the chip is determined by the height of the background of the Row below.
Box(
contentAlignment = Alignment.Center,
- modifier = modifier.fillMaxHeight().clickable(enabled = isClickable, onClick = onClick),
+ modifier =
+ modifier.fillMaxHeight().clickable(enabled = isClickable, onClick = onClick).semantics {
+ if (contentDescription != null) {
+ this.contentDescription = contentDescription
+ }
+ },
) {
Row(
horizontalArrangement = Arrangement.Center,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/model/OngoingActivityChipModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/model/OngoingActivityChipModel.kt
index e0c764570132..d44646cb6144 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/model/OngoingActivityChipModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/model/OngoingActivityChipModel.kt
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.chips.ui.model
import android.view.View
import com.android.systemui.animation.Expandable
+import com.android.systemui.common.shared.model.ContentDescription
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.statusbar.StatusBarIconView
import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips
@@ -140,7 +141,10 @@ sealed class OngoingActivityChipModel {
* The icon is a custom icon, which is set on [impl]. The icon was likely created by an
* external app.
*/
- data class StatusBarView(val impl: StatusBarIconView) : ChipIcon {
+ data class StatusBarView(
+ val impl: StatusBarIconView,
+ val contentDescription: ContentDescription,
+ ) : ChipIcon {
init {
StatusBarConnectedDisplays.assertInLegacyMode()
}
@@ -150,7 +154,10 @@ sealed class OngoingActivityChipModel {
* The icon is a custom icon, which is set on a notification, and can be looked up using the
* provided [notificationKey]. The icon was likely created by an external app.
*/
- data class StatusBarNotificationIcon(val notificationKey: String) : ChipIcon {
+ data class StatusBarNotificationIcon(
+ val notificationKey: String,
+ val contentDescription: ContentDescription,
+ ) : ChipIcon {
init {
StatusBarConnectedDisplays.assertInNewMode()
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationListInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationListInteractor.kt
index fd5973e0ab3b..bde3c4d8c632 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationListInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationListInteractor.kt
@@ -21,10 +21,12 @@ import android.app.Notification.CallStyle.CALL_TYPE_SCREENING
import android.app.Notification.CallStyle.CALL_TYPE_UNKNOWN
import android.app.Notification.EXTRA_CALL_TYPE
import android.app.PendingIntent
+import android.content.Context
import android.graphics.drawable.Icon
import android.service.notification.StatusBarNotification
import android.util.ArrayMap
import com.android.app.tracing.traceSection
+import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.statusbar.StatusBarIconView
import com.android.systemui.statusbar.notification.collection.GroupEntry
import com.android.systemui.statusbar.notification.collection.ListEntry
@@ -50,6 +52,7 @@ class RenderNotificationListInteractor
constructor(
private val repository: ActiveNotificationListRepository,
private val sectionStyleProvider: SectionStyleProvider,
+ @Main private val context: Context,
) {
/**
* Sets the current list of rendered notification entries as displayed in the notification list.
@@ -57,7 +60,7 @@ constructor(
fun setRenderedList(entries: List<ListEntry>) {
traceSection("RenderNotificationListInteractor.setRenderedList") {
repository.activeNotifications.update { existingModels ->
- buildActiveNotificationsStore(existingModels, sectionStyleProvider) {
+ buildActiveNotificationsStore(existingModels, sectionStyleProvider, context) {
entries.forEach(::addListEntry)
setRankingsMap(entries)
}
@@ -69,13 +72,17 @@ constructor(
private fun buildActiveNotificationsStore(
existingModels: ActiveNotificationsStore,
sectionStyleProvider: SectionStyleProvider,
+ context: Context,
block: ActiveNotificationsStoreBuilder.() -> Unit,
): ActiveNotificationsStore =
- ActiveNotificationsStoreBuilder(existingModels, sectionStyleProvider).apply(block).build()
+ ActiveNotificationsStoreBuilder(existingModels, sectionStyleProvider, context)
+ .apply(block)
+ .build()
private class ActiveNotificationsStoreBuilder(
private val existingModels: ActiveNotificationsStore,
private val sectionStyleProvider: SectionStyleProvider,
+ private val context: Context,
) {
private val builder = ActiveNotificationsStore.Builder()
@@ -154,6 +161,7 @@ private class ActiveNotificationsStoreBuilder(
statusBarChipIconView = icons.statusBarChipIcon,
uid = sbn.uid,
packageName = sbn.packageName,
+ appName = sbn.notification.loadHeaderAppName(context),
contentIntent = sbn.notification.contentIntent,
instanceId = sbn.instanceId?.id,
isGroupSummary = sbn.notification.isGroupSummary,
@@ -180,6 +188,7 @@ private fun ActiveNotificationsStore.createOrReuse(
statusBarChipIconView: StatusBarIconView?,
uid: Int,
packageName: String,
+ appName: String,
contentIntent: PendingIntent?,
instanceId: Int?,
isGroupSummary: Boolean,
@@ -206,6 +215,7 @@ private fun ActiveNotificationsStore.createOrReuse(
instanceId = instanceId,
isGroupSummary = isGroupSummary,
packageName = packageName,
+ appName = appName,
contentIntent = contentIntent,
bucket = bucket,
callType = callType,
@@ -230,6 +240,7 @@ private fun ActiveNotificationsStore.createOrReuse(
instanceId = instanceId,
isGroupSummary = isGroupSummary,
packageName = packageName,
+ appName = appName,
contentIntent = contentIntent,
bucket = bucket,
callType = callType,
@@ -253,6 +264,7 @@ private fun ActiveNotificationModel.isCurrent(
statusBarChipIconView: StatusBarIconView?,
uid: Int,
packageName: String,
+ appName: String,
contentIntent: PendingIntent?,
instanceId: Int?,
isGroupSummary: Boolean,
@@ -278,6 +290,7 @@ private fun ActiveNotificationModel.isCurrent(
instanceId != this.instanceId -> false
isGroupSummary != this.isGroupSummary -> false
packageName != this.packageName -> false
+ appName != this.appName -> false
contentIntent != this.contentIntent -> false
bucket != this.bucket -> false
callType != this.callType -> false
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/shared/ActiveNotificationModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/shared/ActiveNotificationModel.kt
index ab8be306ab5e..f00c3ae20e30 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/shared/ActiveNotificationModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/shared/ActiveNotificationModel.kt
@@ -68,6 +68,8 @@ data class ActiveNotificationModel(
val uid: Int,
/** The notifying app's packageName. */
val packageName: String,
+ /** The notifying app's display name. */
+ val appName: String,
/** The intent to execute if UI related to this notification is clicked. */
val contentIntent: PendingIntent?,
/** A small per-notification ID, used for statsd logging. */
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt
index a29934fa3a16..949cb0a718d4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/OngoingCallController.kt
@@ -160,6 +160,7 @@ constructor(
notificationIconView = currentInfo.notificationIconView,
intent = currentInfo.intent,
notificationKey = currentInfo.key,
+ appName = currentInfo.appName,
promotedContent = currentInfo.promotedContent,
)
} else {
@@ -217,6 +218,7 @@ constructor(
notifModel.statusBarChipIconView,
notifModel.contentIntent,
notifModel.uid,
+ notifModel.appName,
notifModel.promotedContent,
isOngoing = true,
statusBarSwipedAway = callNotificationInfo?.statusBarSwipedAway ?: false,
@@ -337,6 +339,7 @@ constructor(
val notificationIconView: StatusBarIconView?,
val intent: PendingIntent?,
val uid: Int,
+ val appName: String,
/**
* If the call notification also meets promoted notification criteria, this field is filled
* in with the content related to promotion. Otherwise null.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractor.kt
index ba7628fb3c07..2fd7d82043a0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractor.kt
@@ -163,6 +163,7 @@ constructor(
notificationIconView = model.statusBarChipIconView,
intent = model.contentIntent,
notificationKey = model.key,
+ appName = model.appName,
promotedContent = model.promotedContent,
)
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallModel.kt
index 7d00e9d58e5b..6507b727eb48 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallModel.kt
@@ -42,6 +42,7 @@ sealed interface OngoingCallModel {
* @property notificationIconView the [android.app.Notification.getSmallIcon] that's set on the
* call notification. We may use this icon in the chip instead of the default phone icon.
* @property intent the intent associated with the call notification.
+ * @property appName the user-readable name of the app that posted the call notification.
* @property promotedContent if the call notification also meets promoted notification criteria,
* this field is filled in with the content related to promotion. Otherwise null.
*/
@@ -50,6 +51,7 @@ sealed interface OngoingCallModel {
val notificationIconView: StatusBarIconView?,
val intent: PendingIntent?,
val notificationKey: String,
+ val appName: String,
val promotedContent: PromotedNotificationContentModel?,
) : OngoingCallModel
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModelKosmos.kt
index 1e304d979e03..ab61a3ef4c3f 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModelKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModelKosmos.kt
@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.chips.call.ui.viewmodel
+import android.content.applicationContext
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.plugins.activityStarter
@@ -26,6 +27,7 @@ import com.android.systemui.util.time.fakeSystemClock
val Kosmos.callChipViewModel: CallChipViewModel by
Kosmos.Fixture {
CallChipViewModel(
+ applicationContext,
scope = applicationCoroutineScope,
interactor = callChipInteractor,
systemClock = fakeSystemClock,
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModelKosmos.kt
index d0c80c7332b3..878c2deb43b2 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModelKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModelKosmos.kt
@@ -16,6 +16,7 @@
package com.android.systemui.statusbar.chips.notification.ui.viewmodel
+import android.content.applicationContext
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.statusbar.chips.notification.domain.interactor.statusBarNotificationChipsInteractor
@@ -24,6 +25,7 @@ import com.android.systemui.statusbar.notification.stack.domain.interactor.heads
val Kosmos.notifChipsViewModel: NotifChipsViewModel by
Kosmos.Fixture {
NotifChipsViewModel(
+ applicationContext,
applicationCoroutineScope,
statusBarNotificationChipsInteractor,
headsUpNotificationInteractor,
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/data/model/ActiveNotificationModelBuilder.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/data/model/ActiveNotificationModelBuilder.kt
index c6ae15df6859..63085e178e7d 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/data/model/ActiveNotificationModelBuilder.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/data/model/ActiveNotificationModelBuilder.kt
@@ -43,6 +43,7 @@ fun activeNotificationModel(
instanceId: Int? = null,
isGroupSummary: Boolean = false,
packageName: String = "pkg",
+ appName: String = "appName",
contentIntent: PendingIntent? = null,
bucket: Int = BUCKET_UNKNOWN,
callType: CallType = CallType.None,
@@ -64,6 +65,7 @@ fun activeNotificationModel(
statusBarChipIconView = statusBarChipIcon,
uid = uid,
packageName = packageName,
+ appName = appName,
contentIntent = contentIntent,
instanceId = instanceId,
isGroupSummary = isGroupSummary,
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationListInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationListInteractorKosmos.kt
index f7acae9846df..0acf98fec054 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationListInteractorKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/domain/interactor/RenderNotificationListInteractorKosmos.kt
@@ -16,11 +16,16 @@
package com.android.systemui.statusbar.notification.domain.interactor
+import android.content.applicationContext
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.statusbar.notification.collection.provider.sectionStyleProvider
import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository
val Kosmos.renderNotificationListInteractor by
Kosmos.Fixture {
- RenderNotificationListInteractor(activeNotificationListRepository, sectionStyleProvider)
+ RenderNotificationListInteractor(
+ activeNotificationListRepository,
+ sectionStyleProvider,
+ applicationContext,
+ )
}
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallModelBuilder.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallModelBuilder.kt
index f4e74fe0e6bb..923b36d4f2cf 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallModelBuilder.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallModelBuilder.kt
@@ -26,5 +26,14 @@ fun inCallModel(
notificationIcon: StatusBarIconView? = null,
intent: PendingIntent? = null,
notificationKey: String = "test",
+ appName: String = "",
promotedContent: PromotedNotificationContentModel? = null,
-) = OngoingCallModel.InCall(startTimeMs, notificationIcon, intent, notificationKey, promotedContent)
+) =
+ OngoingCallModel.InCall(
+ startTimeMs,
+ notificationIcon,
+ intent,
+ notificationKey,
+ appName,
+ promotedContent,
+ )