From 95bda57311e97a7a6776e821c3ba8bdf837284a3 Mon Sep 17 00:00:00 2001 From: Brad Hinegardner Date: Thu, 23 Feb 2023 13:54:05 -0500 Subject: [PATCH] Custom Lockscreen Shortcut preview reflects whether a shortcut is activated Disable the activated state while in preview mode. Bug: b/269617901 Test: manual; toggle on a shortcut, go to the picker, observe proper colors/UI Test: KeyguardBottomAreaViewModelTest.kt updated to handle new behavior Change-Id: I084ed4deae605a36c86304e921c9665d72ac0d50 --- .../keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt | 4 +++- .../keyguard/ui/viewmodel/KeyguardBottomAreaViewModelTest.kt | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt index 1e3b60c27d841..e7184f74ca595 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt @@ -187,6 +187,7 @@ constructor( previewMode.isInPreviewMode && previewMode.shouldHighlightSelectedAffordance && !isSelected, + forceInactive = previewMode.isInPreviewMode ) } .distinctUntilChanged() @@ -198,6 +199,7 @@ constructor( isClickable: Boolean, isSelected: Boolean, isDimmed: Boolean, + forceInactive: Boolean, ): KeyguardQuickAffordanceViewModel { return when (this) { is KeyguardQuickAffordanceModel.Visible -> @@ -213,7 +215,7 @@ constructor( ) }, isClickable = isClickable, - isActivated = activationState is ActivationState.Active, + isActivated = !forceInactive && activationState is ActivationState.Active, isSelected = isSelected, useLongPress = quickAffordanceInteractor.useLongPress, isDimmed = isDimmed, diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModelTest.kt index 8bd8be565eee7..c727b3a6cd10d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModelTest.kt @@ -308,7 +308,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() { TestConfig( isVisible = true, isClickable = false, - isActivated = true, + isActivated = false, icon = icon, canShowWhileLocked = false, intent = Intent("action"), @@ -363,7 +363,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() { TestConfig( isVisible = true, isClickable = false, - isActivated = true, + isActivated = false, icon = icon, canShowWhileLocked = false, intent = Intent("action"),