Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/sharetoapp/ui/viewmodel/ShareToAppChipViewModelTest.kt +30 −0 Original line number Diff line number Diff line Loading @@ -701,4 +701,34 @@ class ShareToAppChipViewModelTest : SysuiTestCase() { verify(kosmos.mockDialogTransitionAnimator) .show(eq(mockScreenShareDialog), any(), any()) } @Test fun chip_packageNameIsSet_entireScreen() = testScope.runTest { val latest by collectLastValue(underTest.chip) mediaProjectionRepo.mediaProjectionState.value = MediaProjectionState.Projecting.EntireScreen(NORMAL_PACKAGE) assertThat(latest).isInstanceOf(OngoingActivityChipModel.Active::class.java) assertThat((latest as OngoingActivityChipModel.Active).managingPackageName) .isEqualTo(NORMAL_PACKAGE) } @Test fun chip_packageNameIsSet_singleTask() = testScope.runTest { val latest by collectLastValue(underTest.chip) mediaProjectionRepo.mediaProjectionState.value = MediaProjectionState.Projecting.SingleTask( NORMAL_PACKAGE, hostDeviceName = null, createTask(taskId = 1), ) assertThat(latest).isInstanceOf(OngoingActivityChipModel.Active::class.java) assertThat((latest as OngoingActivityChipModel.Active).managingPackageName) .isEqualTo(NORMAL_PACKAGE) } } packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt +3 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,7 @@ constructor( } return PrunedNotificationChipModel( key = key, packageName = packageName, appName = appName, statusBarChipIconView = statusBarChipIconView, text = content.shortCriticalText, Loading Loading @@ -213,6 +214,7 @@ constructor( return OngoingActivityChipModel.Active( key = key, managingPackageName = packageName, isImportantForPrivacy = false, icon = icon, content = content, Loading Loading @@ -246,6 +248,7 @@ constructor( */ private data class PrunedNotificationChipModel( val key: String, val packageName: String, val appName: String, val statusBarChipIconView: StatusBarIconView?, /** Loading packages/SystemUI/src/com/android/systemui/statusbar/chips/sharetoapp/ui/viewmodel/ShareToAppChipViewModel.kt +1 −0 Original line number Diff line number Diff line Loading @@ -262,6 +262,7 @@ constructor( tag = TAG, ) ), managingPackageName = state.projectionState.hostPackage, instanceId = instanceId, ) } Loading packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/model/OngoingActivityChipModel.kt +3 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,8 @@ sealed class OngoingActivityChipModel { * A key that uniquely identifies this chip. Used for better visual effects, like animation. */ val key: String, /** The package name of the app managing this chip. */ val managingPackageName: String? = null, /** * True if this chip is critical for privacy so we should keep it visible at all times, and * false otherwise. Loading @@ -84,6 +86,7 @@ sealed class OngoingActivityChipModel { val isHidden: Boolean = false, /** Whether the transition from hidden to shown should be animated. */ val shouldAnimate: Boolean = true, /** * An optional per-chip ID used for logging. Should stay the same throughout the lifetime of * a single chip. Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/chips/sharetoapp/ui/viewmodel/ShareToAppChipViewModelTest.kt +30 −0 Original line number Diff line number Diff line Loading @@ -701,4 +701,34 @@ class ShareToAppChipViewModelTest : SysuiTestCase() { verify(kosmos.mockDialogTransitionAnimator) .show(eq(mockScreenShareDialog), any(), any()) } @Test fun chip_packageNameIsSet_entireScreen() = testScope.runTest { val latest by collectLastValue(underTest.chip) mediaProjectionRepo.mediaProjectionState.value = MediaProjectionState.Projecting.EntireScreen(NORMAL_PACKAGE) assertThat(latest).isInstanceOf(OngoingActivityChipModel.Active::class.java) assertThat((latest as OngoingActivityChipModel.Active).managingPackageName) .isEqualTo(NORMAL_PACKAGE) } @Test fun chip_packageNameIsSet_singleTask() = testScope.runTest { val latest by collectLastValue(underTest.chip) mediaProjectionRepo.mediaProjectionState.value = MediaProjectionState.Projecting.SingleTask( NORMAL_PACKAGE, hostDeviceName = null, createTask(taskId = 1), ) assertThat(latest).isInstanceOf(OngoingActivityChipModel.Active::class.java) assertThat((latest as OngoingActivityChipModel.Active).managingPackageName) .isEqualTo(NORMAL_PACKAGE) } }
packages/SystemUI/src/com/android/systemui/statusbar/chips/notification/ui/viewmodel/NotifChipsViewModel.kt +3 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,7 @@ constructor( } return PrunedNotificationChipModel( key = key, packageName = packageName, appName = appName, statusBarChipIconView = statusBarChipIconView, text = content.shortCriticalText, Loading Loading @@ -213,6 +214,7 @@ constructor( return OngoingActivityChipModel.Active( key = key, managingPackageName = packageName, isImportantForPrivacy = false, icon = icon, content = content, Loading Loading @@ -246,6 +248,7 @@ constructor( */ private data class PrunedNotificationChipModel( val key: String, val packageName: String, val appName: String, val statusBarChipIconView: StatusBarIconView?, /** Loading
packages/SystemUI/src/com/android/systemui/statusbar/chips/sharetoapp/ui/viewmodel/ShareToAppChipViewModel.kt +1 −0 Original line number Diff line number Diff line Loading @@ -262,6 +262,7 @@ constructor( tag = TAG, ) ), managingPackageName = state.projectionState.hostPackage, instanceId = instanceId, ) } Loading
packages/SystemUI/src/com/android/systemui/statusbar/chips/ui/model/OngoingActivityChipModel.kt +3 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,8 @@ sealed class OngoingActivityChipModel { * A key that uniquely identifies this chip. Used for better visual effects, like animation. */ val key: String, /** The package name of the app managing this chip. */ val managingPackageName: String? = null, /** * True if this chip is critical for privacy so we should keep it visible at all times, and * false otherwise. Loading @@ -84,6 +86,7 @@ sealed class OngoingActivityChipModel { val isHidden: Boolean = false, /** Whether the transition from hidden to shown should be animated. */ val shouldAnimate: Boolean = true, /** * An optional per-chip ID used for logging. Should stay the same throughout the lifetime of * a single chip. Loading