Add a separated flag for Volume Panel large screen

Flag: aconfig new_volume_panel STAGING
Test: manual on the phone and tablet
Bug: 325019492
Change-Id: I229d11cba32257d094079cbae222f5f17d924d15
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/HorizontalVolumePanelContent.kt b/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/HorizontalVolumePanelContent.kt
index 98ef067..0a651c8 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/HorizontalVolumePanelContent.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/HorizontalVolumePanelContent.kt
@@ -51,10 +51,8 @@
             verticalArrangement = Arrangement.spacedBy(space = spacing, alignment = Alignment.Top)
         ) {
             for (component in layout.headerComponents) {
-                AnimatedVisibility(component.isVisible) {
-                    with(component.component as ComposeVolumePanelUiComponent) {
-                        Content(Modifier.weight(1f))
-                    }
+                AnimatedVisibility(visible = component.isVisible) {
+                    with(component.component as ComposeVolumePanelUiComponent) { Content(Modifier) }
                 }
             }
             Row(
@@ -62,9 +60,12 @@
                 horizontalArrangement = Arrangement.spacedBy(spacing),
             ) {
                 for (component in layout.footerComponents) {
-                    AnimatedVisibility(component.isVisible) {
+                    AnimatedVisibility(
+                        visible = component.isVisible,
+                        modifier = Modifier.weight(1f),
+                    ) {
                         with(component.component as ComposeVolumePanelUiComponent) {
-                            Content(Modifier.weight(1f))
+                            Content(Modifier)
                         }
                     }
                 }
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VerticalVolumePanelContent.kt b/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VerticalVolumePanelContent.kt
index 2285128..400072e 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VerticalVolumePanelContent.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VerticalVolumePanelContent.kt
@@ -39,9 +39,7 @@
     ) {
         for (component in layout.headerComponents) {
             AnimatedVisibility(component.isVisible) {
-                with(component.component as ComposeVolumePanelUiComponent) {
-                    Content(Modifier.weight(1f))
-                }
+                with(component.component as ComposeVolumePanelUiComponent) { Content(Modifier) }
             }
         }
         for (component in layout.contentComponents) {
@@ -55,9 +53,12 @@
                 horizontalArrangement = Arrangement.spacedBy(if (isLargeScreen) 28.dp else 20.dp),
             ) {
                 for (component in layout.footerComponents) {
-                    AnimatedVisibility(component.isVisible) {
+                    AnimatedVisibility(
+                        visible = component.isVisible,
+                        modifier = Modifier.weight(1f),
+                    ) {
                         with(component.component as ComposeVolumePanelUiComponent) {
-                            Content(Modifier.weight(1f))
+                            Content(Modifier)
                         }
                     }
                 }
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VolumePanelComposeScope.kt b/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VolumePanelComposeScope.kt
index 8df8d2e..af69091 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VolumePanelComposeScope.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VolumePanelComposeScope.kt
@@ -29,7 +29,7 @@
 
     /** Is true when Volume Panel is using large-screen layout and false the otherwise. */
     val isLargeScreen: Boolean
-        get() = state.isWideScreen
+        get() = state.isLargeScreen
 }
 
 val VolumePanelComposeScope.isPortrait: Boolean
diff --git a/packages/SystemUI/res/values-sw600dp/config.xml b/packages/SystemUI/res/values-sw600dp/config.xml
index f1017d8..b438315 100644
--- a/packages/SystemUI/res/values-sw600dp/config.xml
+++ b/packages/SystemUI/res/values-sw600dp/config.xml
@@ -53,4 +53,7 @@
         <item>bottom_start:home</item>
         <item>bottom_end:create_note</item>
     </string-array>
+
+    <!-- Whether volume panel should use the large screen layout or not -->
+    <bool name="volume_panel_is_large_screen">true</bool>
 </resources>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 65c69f7..beaa708 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -1010,4 +1010,7 @@
 
     <!--  Whether to use a machine learning model for back gesture falsing. -->
     <bool name="config_useBackGestureML">true</bool>
+
+    <!-- Whether volume panel should use the large screen layout or not -->
+    <bool name="volume_panel_is_large_screen">false</bool>
 </resources>
diff --git a/packages/SystemUI/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelState.kt b/packages/SystemUI/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelState.kt
index 7f33a6b..f57e293 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelState.kt
+++ b/packages/SystemUI/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelState.kt
@@ -23,12 +23,12 @@
  * State of the Volume Panel itself.
  *
  * @property orientation is current Volume Panel orientation
- * @property isWideScreen is true when Volume Panel should use wide-screen layout and false the
+ * @property isLargeScreen is true when Volume Panel should use wide-screen layout and false the
  *   otherwise
  */
 data class VolumePanelState(
     @Orientation val orientation: Int,
-    val isWideScreen: Boolean,
+    val isLargeScreen: Boolean,
     val isVisible: Boolean,
 ) {
     init {
diff --git a/packages/SystemUI/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModel.kt b/packages/SystemUI/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModel.kt
index 3c5b75c..5ae827f 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/volume/panel/ui/viewmodel/VolumePanelViewModel.kt
@@ -76,7 +76,7 @@
                 VolumePanelState(
                     orientation = configuration.orientation,
                     isVisible = isVisible,
-                    isWideScreen = !resources.getBoolean(R.bool.config_edgeToEdgeBottomSheetDialog),
+                    isLargeScreen = resources.getBoolean(R.bool.volume_panel_is_large_screen),
                 )
             }
             .stateIn(
@@ -85,7 +85,7 @@
                 VolumePanelState(
                     orientation = resources.configuration.orientation,
                     isVisible = mutablePanelVisibility.value,
-                    isWideScreen = !resources.getBoolean(R.bool.config_edgeToEdgeBottomSheetDialog)
+                    isLargeScreen = resources.getBoolean(R.bool.volume_panel_is_large_screen)
                 ),
             )
     val componentsLayout: Flow<ComponentsLayout> =