Merge "Align lockscreen state and picker state for Device Controls shortcut" into main
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index bbc363b..5860806 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -3104,7 +3104,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 4e71ef4..cc36961 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 @@
             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 @@
                         ),
                 )
             }
-            !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 12fa4c8..477f455 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 @@
                     !isFeatureEnabled ->
                         KeyguardQuickAffordanceConfig.PickerScreenState.UnavailableOnDevice::class
                             .java
-                    hasServiceInfos && hasFavorites ->
+                    hasServiceInfos && (hasFavorites || hasPanels) ->
                         KeyguardQuickAffordanceConfig.PickerScreenState.Default::class.java
                     else -> KeyguardQuickAffordanceConfig.PickerScreenState.Disabled::class.java
                 }