Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/ChipTransitionHelperTest.kt +8 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ class ChipTransitionHelperTest : SysuiTestCase() { val newChip = OngoingActivityChipModel.Shown.Timer( key = KEY, icon = createIcon(R.drawable.ic_cake), colors = ColorsModel.Themed, startTimeMs = 100L, Loading @@ -65,6 +66,7 @@ class ChipTransitionHelperTest : SysuiTestCase() { val newerChip = OngoingActivityChipModel.Shown.IconOnly( key = KEY, icon = createIcon(R.drawable.ic_hotspot), colors = ColorsModel.Themed, onClickListenerLegacy = null, Loading @@ -86,6 +88,7 @@ class ChipTransitionHelperTest : SysuiTestCase() { val shownChip = OngoingActivityChipModel.Shown.Timer( key = KEY, icon = createIcon(R.drawable.ic_cake), colors = ColorsModel.Themed, startTimeMs = 100L, Loading Loading @@ -127,6 +130,7 @@ class ChipTransitionHelperTest : SysuiTestCase() { val shownChip = OngoingActivityChipModel.Shown.Timer( key = KEY, icon = createIcon(R.drawable.ic_cake), colors = ColorsModel.Themed, startTimeMs = 100L, Loading Loading @@ -162,4 +166,8 @@ class ChipTransitionHelperTest : SysuiTestCase() { OngoingActivityChipModel.ChipIcon.SingleColorIcon( Icon.Resource(drawable, contentDescription = null) ) companion object { private const val KEY = "testKey" } } packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsViewModelTest.kt +14 −9 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ import com.android.systemui.screenrecord.data.repository.screenRecordRepository import com.android.systemui.statusbar.chips.mediaprojection.domain.interactor.MediaProjectionChipInteractorTest.Companion.NORMAL_PACKAGE import com.android.systemui.statusbar.chips.mediaprojection.domain.interactor.MediaProjectionChipInteractorTest.Companion.setUpPackageManagerForMediaProjection import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips import com.android.systemui.statusbar.chips.screenrecord.ui.viewmodel.ScreenRecordChipViewModel import com.android.systemui.statusbar.chips.sharetoapp.ui.viewmodel.ShareToAppChipViewModel 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 Loading Loading @@ -385,32 +387,35 @@ class OngoingActivityChipsViewModelTest : SysuiTestCase() { fun assertIsScreenRecordChip(latest: OngoingActivityChipModel?) { assertThat(latest).isInstanceOf(OngoingActivityChipModel.Shown::class.java) assertThat((latest as OngoingActivityChipModel.Shown).key) .isEqualTo(ScreenRecordChipViewModel.KEY) val icon = (((latest as OngoingActivityChipModel.Shown).icon) as OngoingActivityChipModel.ChipIcon.SingleColorIcon) .impl as Icon.Resource ((latest.icon) as OngoingActivityChipModel.ChipIcon.SingleColorIcon).impl as Icon.Resource assertThat(icon.res).isEqualTo(R.drawable.ic_screenrecord) } fun assertIsShareToAppChip(latest: OngoingActivityChipModel?) { assertThat(latest).isInstanceOf(OngoingActivityChipModel.Shown::class.java) assertThat((latest as OngoingActivityChipModel.Shown).key) .isEqualTo(ShareToAppChipViewModel.KEY) val icon = (((latest as OngoingActivityChipModel.Shown).icon) as OngoingActivityChipModel.ChipIcon.SingleColorIcon) .impl as Icon.Resource ((latest.icon) as OngoingActivityChipModel.ChipIcon.SingleColorIcon).impl as Icon.Resource assertThat(icon.res).isEqualTo(R.drawable.ic_present_to_all) } fun assertIsCallChip(latest: OngoingActivityChipModel?, notificationKey: String) { assertThat(latest).isInstanceOf(OngoingActivityChipModel.Shown::class.java) assertThat((latest as OngoingActivityChipModel.Shown).key).isEqualTo(notificationKey) if (StatusBarConnectedDisplays.isEnabled) { assertNotificationIcon(latest, notificationKey) return } val icon = (((latest as OngoingActivityChipModel.Shown).icon) as OngoingActivityChipModel.ChipIcon.SingleColorIcon) .impl as Icon.Resource ((latest.icon) as OngoingActivityChipModel.ChipIcon.SingleColorIcon).impl as Icon.Resource assertThat(icon.res).isEqualTo(com.android.internal.R.drawable.ic_phone) } Loading packages/SystemUI/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModel.kt +3 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ constructor( is OngoingCallModel.NoCall, is OngoingCallModel.InCallWithVisibleApp -> OngoingActivityChipModel.Hidden() is OngoingCallModel.InCall -> { val key = state.notificationKey val contentDescription = getContentDescription(state.appName) val icon = if (state.notificationIconView != null) { Loading Loading @@ -97,6 +98,7 @@ constructor( // If the start time is invalid, don't show a timer and show just an // icon. See b/192379214. OngoingActivityChipModel.Shown.IconOnly( key = key, icon = icon, colors = colors, onClickListenerLegacy = getOnClickListener(state), Loading @@ -107,6 +109,7 @@ constructor( state.startTimeMs - systemClock.currentTimeMillis() + systemClock.elapsedRealtime() OngoingActivityChipModel.Shown.Timer( key = key, icon = icon, colors = colors, startTimeMs = startTimeInElapsedRealtime, Loading packages/SystemUI/src/com/android/systemui/statusbar/chips/casttootherdevice/ui/viewmodel/CastToOtherDeviceChipViewModel.kt +4 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.chips.casttootherdevice.ui.viewmodel import android.content.Context import androidx.annotation.DrawableRes import androidx.annotation.VisibleForTesting import com.android.internal.jank.Cuj import com.android.systemui.animation.DialogCuj import com.android.systemui.animation.DialogTransitionAnimator Loading Loading @@ -192,6 +193,7 @@ constructor( state: ProjectionChipModel.Projecting ): OngoingActivityChipModel.Shown { return OngoingActivityChipModel.Shown.Timer( key = KEY, icon = OngoingActivityChipModel.ChipIcon.SingleColorIcon( Icon.Resource( Loading Loading @@ -229,6 +231,7 @@ constructor( private fun createIconOnlyCastChip(deviceName: String?): OngoingActivityChipModel.Shown { return OngoingActivityChipModel.Shown.IconOnly( key = KEY, icon = OngoingActivityChipModel.ChipIcon.SingleColorIcon( Icon.Resource( Loading Loading @@ -276,6 +279,7 @@ constructor( ) companion object { @VisibleForTesting const val KEY = "CastToOtherDevice" @DrawableRes val CAST_TO_OTHER_DEVICE_ICON = R.drawable.ic_cast_connected private val DIALOG_CUJ = DialogCuj(Cuj.CUJ_STATUS_BAR_LAUNCH_DIALOG_FROM_CHIP, tag = "Cast to other device") Loading packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt +7 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ constructor( // If the user tapped this chip to show the HUN, we want to just show the icon because // the HUN will show the rest of the information. return OngoingActivityChipModel.Shown.IconOnly( this.key, icon, colors, onClickListenerLegacy, Loading @@ -123,6 +124,7 @@ constructor( if (this.promotedContent.shortCriticalText != null) { return OngoingActivityChipModel.Shown.Text( this.key, icon, colors, this.promotedContent.shortCriticalText, Loading @@ -140,6 +142,7 @@ constructor( // to always show "now". We don't want early testers to get that experience since it's // not what will happen at launch, so just don't show any time. return OngoingActivityChipModel.Shown.IconOnly( this.key, icon, colors, onClickListenerLegacy, Loading @@ -149,6 +152,7 @@ constructor( if (this.promotedContent.time == null) { return OngoingActivityChipModel.Shown.IconOnly( this.key, icon, colors, onClickListenerLegacy, Loading @@ -158,6 +162,7 @@ constructor( when (this.promotedContent.time.mode) { PromotedNotificationContentModel.When.Mode.BasicTime -> { return OngoingActivityChipModel.Shown.ShortTimeDelta( this.key, icon, colors, time = this.promotedContent.time.time, Loading @@ -167,6 +172,7 @@ constructor( } PromotedNotificationContentModel.When.Mode.CountUp -> { return OngoingActivityChipModel.Shown.Timer( this.key, icon, colors, startTimeMs = this.promotedContent.time.time, Loading @@ -177,6 +183,7 @@ constructor( PromotedNotificationContentModel.When.Mode.CountDown -> { // TODO(b/364653005): Support CountDown. return OngoingActivityChipModel.Shown.Timer( this.key, icon, colors, startTimeMs = this.promotedContent.time.time, Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/ChipTransitionHelperTest.kt +8 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ class ChipTransitionHelperTest : SysuiTestCase() { val newChip = OngoingActivityChipModel.Shown.Timer( key = KEY, icon = createIcon(R.drawable.ic_cake), colors = ColorsModel.Themed, startTimeMs = 100L, Loading @@ -65,6 +66,7 @@ class ChipTransitionHelperTest : SysuiTestCase() { val newerChip = OngoingActivityChipModel.Shown.IconOnly( key = KEY, icon = createIcon(R.drawable.ic_hotspot), colors = ColorsModel.Themed, onClickListenerLegacy = null, Loading @@ -86,6 +88,7 @@ class ChipTransitionHelperTest : SysuiTestCase() { val shownChip = OngoingActivityChipModel.Shown.Timer( key = KEY, icon = createIcon(R.drawable.ic_cake), colors = ColorsModel.Themed, startTimeMs = 100L, Loading Loading @@ -127,6 +130,7 @@ class ChipTransitionHelperTest : SysuiTestCase() { val shownChip = OngoingActivityChipModel.Shown.Timer( key = KEY, icon = createIcon(R.drawable.ic_cake), colors = ColorsModel.Themed, startTimeMs = 100L, Loading Loading @@ -162,4 +166,8 @@ class ChipTransitionHelperTest : SysuiTestCase() { OngoingActivityChipModel.ChipIcon.SingleColorIcon( Icon.Resource(drawable, contentDescription = null) ) companion object { private const val KEY = "testKey" } }
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/ui/viewmodel/OngoingActivityChipsViewModelTest.kt +14 −9 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ import com.android.systemui.screenrecord.data.repository.screenRecordRepository import com.android.systemui.statusbar.chips.mediaprojection.domain.interactor.MediaProjectionChipInteractorTest.Companion.NORMAL_PACKAGE import com.android.systemui.statusbar.chips.mediaprojection.domain.interactor.MediaProjectionChipInteractorTest.Companion.setUpPackageManagerForMediaProjection import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips import com.android.systemui.statusbar.chips.screenrecord.ui.viewmodel.ScreenRecordChipViewModel import com.android.systemui.statusbar.chips.sharetoapp.ui.viewmodel.ShareToAppChipViewModel 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 Loading Loading @@ -385,32 +387,35 @@ class OngoingActivityChipsViewModelTest : SysuiTestCase() { fun assertIsScreenRecordChip(latest: OngoingActivityChipModel?) { assertThat(latest).isInstanceOf(OngoingActivityChipModel.Shown::class.java) assertThat((latest as OngoingActivityChipModel.Shown).key) .isEqualTo(ScreenRecordChipViewModel.KEY) val icon = (((latest as OngoingActivityChipModel.Shown).icon) as OngoingActivityChipModel.ChipIcon.SingleColorIcon) .impl as Icon.Resource ((latest.icon) as OngoingActivityChipModel.ChipIcon.SingleColorIcon).impl as Icon.Resource assertThat(icon.res).isEqualTo(R.drawable.ic_screenrecord) } fun assertIsShareToAppChip(latest: OngoingActivityChipModel?) { assertThat(latest).isInstanceOf(OngoingActivityChipModel.Shown::class.java) assertThat((latest as OngoingActivityChipModel.Shown).key) .isEqualTo(ShareToAppChipViewModel.KEY) val icon = (((latest as OngoingActivityChipModel.Shown).icon) as OngoingActivityChipModel.ChipIcon.SingleColorIcon) .impl as Icon.Resource ((latest.icon) as OngoingActivityChipModel.ChipIcon.SingleColorIcon).impl as Icon.Resource assertThat(icon.res).isEqualTo(R.drawable.ic_present_to_all) } fun assertIsCallChip(latest: OngoingActivityChipModel?, notificationKey: String) { assertThat(latest).isInstanceOf(OngoingActivityChipModel.Shown::class.java) assertThat((latest as OngoingActivityChipModel.Shown).key).isEqualTo(notificationKey) if (StatusBarConnectedDisplays.isEnabled) { assertNotificationIcon(latest, notificationKey) return } val icon = (((latest as OngoingActivityChipModel.Shown).icon) as OngoingActivityChipModel.ChipIcon.SingleColorIcon) .impl as Icon.Resource ((latest.icon) as OngoingActivityChipModel.ChipIcon.SingleColorIcon).impl as Icon.Resource assertThat(icon.res).isEqualTo(com.android.internal.R.drawable.ic_phone) } Loading
packages/SystemUI/src/com/android/systemui/statusbar/chips/call/ui/viewmodel/CallChipViewModel.kt +3 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ constructor( is OngoingCallModel.NoCall, is OngoingCallModel.InCallWithVisibleApp -> OngoingActivityChipModel.Hidden() is OngoingCallModel.InCall -> { val key = state.notificationKey val contentDescription = getContentDescription(state.appName) val icon = if (state.notificationIconView != null) { Loading Loading @@ -97,6 +98,7 @@ constructor( // If the start time is invalid, don't show a timer and show just an // icon. See b/192379214. OngoingActivityChipModel.Shown.IconOnly( key = key, icon = icon, colors = colors, onClickListenerLegacy = getOnClickListener(state), Loading @@ -107,6 +109,7 @@ constructor( state.startTimeMs - systemClock.currentTimeMillis() + systemClock.elapsedRealtime() OngoingActivityChipModel.Shown.Timer( key = key, icon = icon, colors = colors, startTimeMs = startTimeInElapsedRealtime, Loading
packages/SystemUI/src/com/android/systemui/statusbar/chips/casttootherdevice/ui/viewmodel/CastToOtherDeviceChipViewModel.kt +4 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.chips.casttootherdevice.ui.viewmodel import android.content.Context import androidx.annotation.DrawableRes import androidx.annotation.VisibleForTesting import com.android.internal.jank.Cuj import com.android.systemui.animation.DialogCuj import com.android.systemui.animation.DialogTransitionAnimator Loading Loading @@ -192,6 +193,7 @@ constructor( state: ProjectionChipModel.Projecting ): OngoingActivityChipModel.Shown { return OngoingActivityChipModel.Shown.Timer( key = KEY, icon = OngoingActivityChipModel.ChipIcon.SingleColorIcon( Icon.Resource( Loading Loading @@ -229,6 +231,7 @@ constructor( private fun createIconOnlyCastChip(deviceName: String?): OngoingActivityChipModel.Shown { return OngoingActivityChipModel.Shown.IconOnly( key = KEY, icon = OngoingActivityChipModel.ChipIcon.SingleColorIcon( Icon.Resource( Loading Loading @@ -276,6 +279,7 @@ constructor( ) companion object { @VisibleForTesting const val KEY = "CastToOtherDevice" @DrawableRes val CAST_TO_OTHER_DEVICE_ICON = R.drawable.ic_cast_connected private val DIALOG_CUJ = DialogCuj(Cuj.CUJ_STATUS_BAR_LAUNCH_DIALOG_FROM_CHIP, tag = "Cast to other device") Loading
packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt +7 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ constructor( // If the user tapped this chip to show the HUN, we want to just show the icon because // the HUN will show the rest of the information. return OngoingActivityChipModel.Shown.IconOnly( this.key, icon, colors, onClickListenerLegacy, Loading @@ -123,6 +124,7 @@ constructor( if (this.promotedContent.shortCriticalText != null) { return OngoingActivityChipModel.Shown.Text( this.key, icon, colors, this.promotedContent.shortCriticalText, Loading @@ -140,6 +142,7 @@ constructor( // to always show "now". We don't want early testers to get that experience since it's // not what will happen at launch, so just don't show any time. return OngoingActivityChipModel.Shown.IconOnly( this.key, icon, colors, onClickListenerLegacy, Loading @@ -149,6 +152,7 @@ constructor( if (this.promotedContent.time == null) { return OngoingActivityChipModel.Shown.IconOnly( this.key, icon, colors, onClickListenerLegacy, Loading @@ -158,6 +162,7 @@ constructor( when (this.promotedContent.time.mode) { PromotedNotificationContentModel.When.Mode.BasicTime -> { return OngoingActivityChipModel.Shown.ShortTimeDelta( this.key, icon, colors, time = this.promotedContent.time.time, Loading @@ -167,6 +172,7 @@ constructor( } PromotedNotificationContentModel.When.Mode.CountUp -> { return OngoingActivityChipModel.Shown.Timer( this.key, icon, colors, startTimeMs = this.promotedContent.time.time, Loading @@ -177,6 +183,7 @@ constructor( PromotedNotificationContentModel.When.Mode.CountDown -> { // TODO(b/364653005): Support CountDown. return OngoingActivityChipModel.Shown.Timer( this.key, icon, colors, startTimeMs = this.promotedContent.time.time, Loading