Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorTest.kt +39 −5 Original line number Original line Diff line number Diff line Loading @@ -69,18 +69,19 @@ class OngoingCallInteractorTest : SysuiTestCase() { } } @Test @Test fun ongoingCallNotification_setsAllFields() = fun ongoingCallNotification_setsAllFields_withAppHidden() = kosmos.runTest { kosmos.runTest { val latest by collectLastValue(underTest.ongoingCallState) val latest by collectLastValue(underTest.ongoingCallState) // Set up notification with icon view and intent // Set up notification with icon view and intent val key = "promotedCall" val startTimeMs = 1000L val testIconView: StatusBarIconView = mock() val testIconView: StatusBarIconView = mock() val testIntent: PendingIntent = mock() val testIntent: PendingIntent = mock() val testPromotedContent = val testPromotedContent = PromotedNotificationContentModel.Builder(key).build() PromotedNotificationContentModel.Builder("promotedCall").build() addOngoingCallState( addOngoingCallState( key = "promotedCall", key = key, startTimeMs = 1000L, startTimeMs = startTimeMs, statusBarChipIconView = testIconView, statusBarChipIconView = testIconView, contentIntent = testIntent, contentIntent = testIntent, promotedContent = testPromotedContent, promotedContent = testPromotedContent, Loading @@ -89,8 +90,41 @@ class OngoingCallInteractorTest : SysuiTestCase() { // Verify model is InCall and has the correct icon, intent, and promoted content. // Verify model is InCall and has the correct icon, intent, and promoted content. assertThat(latest).isInstanceOf(OngoingCallModel.InCall::class.java) assertThat(latest).isInstanceOf(OngoingCallModel.InCall::class.java) val model = latest as OngoingCallModel.InCall val model = latest as OngoingCallModel.InCall assertThat(model.startTimeMs).isEqualTo(startTimeMs) assertThat(model.notificationIconView).isSameInstanceAs(testIconView) assertThat(model.notificationIconView).isSameInstanceAs(testIconView) assertThat(model.intent).isSameInstanceAs(testIntent) assertThat(model.intent).isSameInstanceAs(testIntent) assertThat(model.notificationKey).isEqualTo(key) assertThat(model.promotedContent).isSameInstanceAs(testPromotedContent) } @Test fun ongoingCallNotification_setsAllFields_withAppVisible() = kosmos.runTest { kosmos.activityManagerRepository.fake.startingIsAppVisibleValue = true val latest by collectLastValue(underTest.ongoingCallState) // Set up notification with icon view and intent val key = "promotedCall" val startTimeMs = 1000L val testIconView: StatusBarIconView = mock() val testIntent: PendingIntent = mock() val testPromotedContent = PromotedNotificationContentModel.Builder(key).build() addOngoingCallState( key = key, startTimeMs = startTimeMs, statusBarChipIconView = testIconView, contentIntent = testIntent, promotedContent = testPromotedContent, ) // Verify model is InCallWithVisibleApp and has the correct icon, intent, and promoted // content. assertThat(latest).isInstanceOf(OngoingCallModel.InCallWithVisibleApp::class.java) val model = latest as OngoingCallModel.InCallWithVisibleApp assertThat(model.startTimeMs).isEqualTo(startTimeMs) assertThat(model.notificationIconView).isSameInstanceAs(testIconView) assertThat(model.intent).isSameInstanceAs(testIntent) assertThat(model.notificationKey).isEqualTo(key) assertThat(model.promotedContent).isSameInstanceAs(testPromotedContent) assertThat(model.promotedContent).isSameInstanceAs(testPromotedContent) } } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractor.kt +8 −1 Original line number Original line Diff line number Diff line Loading @@ -150,7 +150,14 @@ constructor( return when { return when { isVisible -> { isVisible -> { logger.d({ "Call app is visible: uid=$int1" }) { int1 = model.uid } logger.d({ "Call app is visible: uid=$int1" }) { int1 = model.uid } OngoingCallModel.InCallWithVisibleApp OngoingCallModel.InCallWithVisibleApp( startTimeMs = model.whenTime, notificationIconView = model.statusBarChipIconView, intent = model.contentIntent, notificationKey = model.key, appName = model.appName, promotedContent = model.promotedContent, ) } } else -> { else -> { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallModel.kt +14 −1 Original line number Original line Diff line number Diff line Loading @@ -28,8 +28,21 @@ sealed interface OngoingCallModel { /** /** * There is an ongoing call but the call app is currently visible, so we don't need to show the * There is an ongoing call but the call app is currently visible, so we don't need to show the * chip. * chip. * * @property startTimeMs see [InCall.startTimeMs]. * @property notificationIconView see [InCall.notificationIconView]. * @property intent see [InCall.intent]. * @property appName see [InCall.appName]. * @property promotedContent see [InCall.promotedContent]. */ */ data object InCallWithVisibleApp : OngoingCallModel data class InCallWithVisibleApp( val startTimeMs: Long, val notificationIconView: StatusBarIconView?, val intent: PendingIntent?, val notificationKey: String, val appName: String, val promotedContent: PromotedNotificationContentModel?, ) : OngoingCallModel /** /** * There *is* an ongoing call. * There *is* an ongoing call. Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorTest.kt +39 −5 Original line number Original line Diff line number Diff line Loading @@ -69,18 +69,19 @@ class OngoingCallInteractorTest : SysuiTestCase() { } } @Test @Test fun ongoingCallNotification_setsAllFields() = fun ongoingCallNotification_setsAllFields_withAppHidden() = kosmos.runTest { kosmos.runTest { val latest by collectLastValue(underTest.ongoingCallState) val latest by collectLastValue(underTest.ongoingCallState) // Set up notification with icon view and intent // Set up notification with icon view and intent val key = "promotedCall" val startTimeMs = 1000L val testIconView: StatusBarIconView = mock() val testIconView: StatusBarIconView = mock() val testIntent: PendingIntent = mock() val testIntent: PendingIntent = mock() val testPromotedContent = val testPromotedContent = PromotedNotificationContentModel.Builder(key).build() PromotedNotificationContentModel.Builder("promotedCall").build() addOngoingCallState( addOngoingCallState( key = "promotedCall", key = key, startTimeMs = 1000L, startTimeMs = startTimeMs, statusBarChipIconView = testIconView, statusBarChipIconView = testIconView, contentIntent = testIntent, contentIntent = testIntent, promotedContent = testPromotedContent, promotedContent = testPromotedContent, Loading @@ -89,8 +90,41 @@ class OngoingCallInteractorTest : SysuiTestCase() { // Verify model is InCall and has the correct icon, intent, and promoted content. // Verify model is InCall and has the correct icon, intent, and promoted content. assertThat(latest).isInstanceOf(OngoingCallModel.InCall::class.java) assertThat(latest).isInstanceOf(OngoingCallModel.InCall::class.java) val model = latest as OngoingCallModel.InCall val model = latest as OngoingCallModel.InCall assertThat(model.startTimeMs).isEqualTo(startTimeMs) assertThat(model.notificationIconView).isSameInstanceAs(testIconView) assertThat(model.notificationIconView).isSameInstanceAs(testIconView) assertThat(model.intent).isSameInstanceAs(testIntent) assertThat(model.intent).isSameInstanceAs(testIntent) assertThat(model.notificationKey).isEqualTo(key) assertThat(model.promotedContent).isSameInstanceAs(testPromotedContent) } @Test fun ongoingCallNotification_setsAllFields_withAppVisible() = kosmos.runTest { kosmos.activityManagerRepository.fake.startingIsAppVisibleValue = true val latest by collectLastValue(underTest.ongoingCallState) // Set up notification with icon view and intent val key = "promotedCall" val startTimeMs = 1000L val testIconView: StatusBarIconView = mock() val testIntent: PendingIntent = mock() val testPromotedContent = PromotedNotificationContentModel.Builder(key).build() addOngoingCallState( key = key, startTimeMs = startTimeMs, statusBarChipIconView = testIconView, contentIntent = testIntent, promotedContent = testPromotedContent, ) // Verify model is InCallWithVisibleApp and has the correct icon, intent, and promoted // content. assertThat(latest).isInstanceOf(OngoingCallModel.InCallWithVisibleApp::class.java) val model = latest as OngoingCallModel.InCallWithVisibleApp assertThat(model.startTimeMs).isEqualTo(startTimeMs) assertThat(model.notificationIconView).isSameInstanceAs(testIconView) assertThat(model.intent).isSameInstanceAs(testIntent) assertThat(model.notificationKey).isEqualTo(key) assertThat(model.promotedContent).isSameInstanceAs(testPromotedContent) assertThat(model.promotedContent).isSameInstanceAs(testPromotedContent) } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractor.kt +8 −1 Original line number Original line Diff line number Diff line Loading @@ -150,7 +150,14 @@ constructor( return when { return when { isVisible -> { isVisible -> { logger.d({ "Call app is visible: uid=$int1" }) { int1 = model.uid } logger.d({ "Call app is visible: uid=$int1" }) { int1 = model.uid } OngoingCallModel.InCallWithVisibleApp OngoingCallModel.InCallWithVisibleApp( startTimeMs = model.whenTime, notificationIconView = model.statusBarChipIconView, intent = model.contentIntent, notificationKey = model.key, appName = model.appName, promotedContent = model.promotedContent, ) } } else -> { else -> { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/shared/model/OngoingCallModel.kt +14 −1 Original line number Original line Diff line number Diff line Loading @@ -28,8 +28,21 @@ sealed interface OngoingCallModel { /** /** * There is an ongoing call but the call app is currently visible, so we don't need to show the * There is an ongoing call but the call app is currently visible, so we don't need to show the * chip. * chip. * * @property startTimeMs see [InCall.startTimeMs]. * @property notificationIconView see [InCall.notificationIconView]. * @property intent see [InCall.intent]. * @property appName see [InCall.appName]. * @property promotedContent see [InCall.promotedContent]. */ */ data object InCallWithVisibleApp : OngoingCallModel data class InCallWithVisibleApp( val startTimeMs: Long, val notificationIconView: StatusBarIconView?, val intent: PendingIntent?, val notificationKey: String, val appName: String, val promotedContent: PromotedNotificationContentModel?, ) : OngoingCallModel /** /** * There *is* an ongoing call. * There *is* an ongoing call. Loading