summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Brad Hinegardner <bhinegardner@google.com> 2023-09-22 17:31:29 +0000
committer Cherrypicker Worker <android-build-cherrypicker-worker@google.com> 2023-09-25 14:30:08 +0000
commit027da773fd4dfc901b1b951b6406c5c63597fbaa (patch)
treee461dca185de4769e56df22316dd88bf9fa6b1ce
parent05f6991e621ff65a784ddf286691d9e4acd8a9ea (diff)
Align lockscreen state and picker state for Device Controls shortcut
The picker state was previously checking if users had favorites, and ignored if there were any panels. This caused wallpaper picker to not let the user choose Device Controls on the lock screen. The lockscreen state was already checking both of those. This aligns these two. Bug: 295852874 Test: atest HomeControlsKeyguardQuickAffordanceConfigParameterizedStateTest.kt Test: manual reproduce the issue prior to this cl by not being able to select device controls - prove that the fixes here solve the issue (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:bc161c912dfe2a6c7edbc737d38f34772a07d5d7) Merged-In: Id98d0d16e11c3291dc4b906f7dd6e10d077ac96c Change-Id: Id98d0d16e11c3291dc4b906f7dd6e10d077ac96c
-rw-r--r--packages/SystemUI/res/values/strings.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/HomeControlsKeyguardQuickAffordanceConfig.kt5
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/keyguard/data/quickaffordance/HomeControlsKeyguardQuickAffordanceConfigParameterizedStateTest.kt2
3 files changed, 5 insertions, 4 deletions
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 3ca24afe6514..0d0b79cce8b4 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -3081,7 +3081,7 @@
configured. This is shown as part of a dialog that explains to the user why they cannot select
this shortcut for their lock screen right now. [CHAR LIMIT=NONE].
-->
- <string name="home_quick_affordance_unavailable_configure_the_app">&#8226; At least one device is available</string>
+ <string name="home_quick_affordance_unavailable_configure_the_app">&#8226; At least one device or device panel are available</string>
<!---
Explains that the notes app is not available. This is shown as part of a dialog that explains to
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/HomeControlsKeyguardQuickAffordanceConfig.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/HomeControlsKeyguardQuickAffordanceConfig.kt
index f3fc8096f5d7..01fcc8de0e1d 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/HomeControlsKeyguardQuickAffordanceConfig.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/quickaffordance/HomeControlsKeyguardQuickAffordanceConfig.kt
@@ -78,6 +78,7 @@ constructor(
component.getControlsListingController().getOrNull()?.getCurrentServices()
val hasFavorites =
component.getControlsController().getOrNull()?.getFavorites()?.isNotEmpty() == true
+ val hasPanels = currentServices?.any { it.panelActivity != null } == true
val componentPackageName = component.getPackageName()
when {
currentServices.isNullOrEmpty() && !componentPackageName.isNullOrEmpty() -> {
@@ -100,8 +101,8 @@ constructor(
),
)
}
- !hasFavorites -> {
- // Home app installed but no favorites selected.
+ !hasFavorites && !hasPanels -> {
+ // Home app installed but no favorites selected or panel activities available.
val activityClass = component.getControlsUiController().get().resolveActivity()
return disabledPickerState(
explanation =
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/quickaffordance/HomeControlsKeyguardQuickAffordanceConfigParameterizedStateTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/quickaffordance/HomeControlsKeyguardQuickAffordanceConfigParameterizedStateTest.kt
index 1815ea9530e2..cc26eee363ce 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/quickaffordance/HomeControlsKeyguardQuickAffordanceConfigParameterizedStateTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/quickaffordance/HomeControlsKeyguardQuickAffordanceConfigParameterizedStateTest.kt
@@ -176,7 +176,7 @@ class HomeControlsKeyguardQuickAffordanceConfigParameterizedStateTest : SysuiTes
!isFeatureEnabled ->
KeyguardQuickAffordanceConfig.PickerScreenState.UnavailableOnDevice::class
.java
- hasServiceInfos && hasFavorites ->
+ hasServiceInfos && (hasFavorites || hasPanels) ->
KeyguardQuickAffordanceConfig.PickerScreenState.Default::class.java
else -> KeyguardQuickAffordanceConfig.PickerScreenState.Disabled::class.java
}