SystemUI: Make round QS toggleable [1/3]

Change-Id: I86e3bc990b78e763bfc9fb4a7ed8ffeeff95cc3f
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index f11c7fc..1d5cad1 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -12224,6 +12224,12 @@
         public static final String QS_TILE_SHAPE = "qs_tile_shape";
 
         /**
+         * Quicksettings UI Style
+         * @hide
+         */
+        public static final String QS_STYLE_ROUND = "qs_style_round";
+
+        /*
          * These entries are considered common between the personal and the managed profile,
          * since the managed profile doesn't get to change them.
          */
diff --git a/packages/SystemUI/res/drawable/qs_customizer_toolbar.xml b/packages/SystemUI/res/drawable/qs_customizer_toolbar.xml
index 50cbebc..f1a24aa 100644
--- a/packages/SystemUI/res/drawable/qs_customizer_toolbar.xml
+++ b/packages/SystemUI/res/drawable/qs_customizer_toolbar.xml
@@ -15,6 +15,6 @@
 -->
 <inset xmlns:android="http://schemas.android.com/apk/res/android">
     <shape>
-        <solid android:color="@android:color/transparent"/>
+        <solid android:color="?attr/underSurface"/>
     </shape>
 </inset>
diff --git a/packages/SystemUI/res/drawable/qs_tile_background.xml b/packages/SystemUI/res/drawable/qs_tile_background.xml
index e600014..af976e76 100644
--- a/packages/SystemUI/res/drawable/qs_tile_background.xml
+++ b/packages/SystemUI/res/drawable/qs_tile_background.xml
@@ -16,6 +16,8 @@
   -->
 <ripple xmlns:android="http://schemas.android.com/apk/res/android"
     android:color="@color/qs_tile_ripple_color">
+    <item android:id="@android:id/mask"
+        android:drawable="@drawable/qs_tile_background_shape" />
     <item android:id="@id/background">
         <layer-list>
             <item
diff --git a/packages/SystemUI/res/drawable/qs_tile_background_no_mask.xml b/packages/SystemUI/res/drawable/qs_tile_background_no_mask.xml
new file mode 100644
index 0000000..7af4a05
--- /dev/null
+++ b/packages/SystemUI/res/drawable/qs_tile_background_no_mask.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2021 The Android Open Source Project
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+    android:color="@color/qs_tile_ripple_color">
+    <item android:id="@id/background">
+        <layer-list>
+            <item
+                android:id="@+id/qs_tile_background_base"
+                android:drawable="@drawable/qs_tile_background_shape" />
+            <item android:id="@+id/qs_tile_background_overlay">
+                <selector>
+                    <item
+                        android:state_hovered="true"
+                        android:drawable="@drawable/qs_tile_background_shape_round" />
+                    <item
+                        android:state_focused="true"
+                        android:drawable="@drawable/qs_tile_background_shape_round" />
+                </selector>
+            </item>
+        </layer-list>
+    </item>
+</ripple>
diff --git a/packages/SystemUI/res/drawable/qs_tile_background_shape.xml b/packages/SystemUI/res/drawable/qs_tile_background_shape.xml
index c37fa51..f6b6834 100644
--- a/packages/SystemUI/res/drawable/qs_tile_background_shape.xml
+++ b/packages/SystemUI/res/drawable/qs_tile_background_shape.xml
@@ -16,6 +16,6 @@
   -->
 
 <shape xmlns:android="http://schemas.android.com/apk/res/android">
-    <corners android:radius="100dp" />
+    <corners android:radius="@dimen/qs_corner_radius" />
     <solid android:color="#FFFFFF" />
 </shape>
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/qs_tile_background_shape_round.xml b/packages/SystemUI/res/drawable/qs_tile_background_shape_round.xml
new file mode 100644
index 0000000..66c4727
--- /dev/null
+++ b/packages/SystemUI/res/drawable/qs_tile_background_shape_round.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2021 The Android Open Source Project
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <corners android:radius="100dp" />
+    <solid android:color="#FFFFFF" />
+</shape>
diff --git a/packages/SystemUI/res/layout/qs_panel.xml b/packages/SystemUI/res/layout/qs_panel.xml
index b7b7796..894ea46 100644
--- a/packages/SystemUI/res/layout/qs_panel.xml
+++ b/packages/SystemUI/res/layout/qs_panel.xml
@@ -38,7 +38,7 @@
             android:background="@android:color/transparent"
             android:focusable="true"
             android:accessibilityTraversalBefore="@android:id/edit"
-            android:paddingTop="8dp"
+            android:paddingTop="@dimen/custom_qs_panel_padding_top"
             android:clipToPadding="false"
             android:clipChildren="false">
 
diff --git a/packages/SystemUI/res/layout/qs_tile_label.xml b/packages/SystemUI/res/layout/qs_tile_label.xml
index 356b9fa..974cad3 100644
--- a/packages/SystemUI/res/layout/qs_tile_label.xml
+++ b/packages/SystemUI/res/layout/qs_tile_label.xml
@@ -16,21 +16,23 @@
 -->
 <com.android.systemui.qs.tileimpl.IgnorableChildLinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
+    android:layout_width="0dp"
     android:layout_height="wrap_content"
+    android:layout_weight="1"
     android:clipChildren="false"
     android:clipToPadding="false"
     android:orientation="vertical"
+    android:layout_marginStart="@dimen/qs_label_container_margin"
+    android:layout_marginEnd="0dp"
     android:focusable="false"
     android:importantForAccessibility="no"
-    android:layout_gravity="center_horizontal">
+    android:layout_gravity="center_vertical | start">
 
     <com.android.systemui.util.DelayableMarqueeTextView
         android:id="@+id/tile_label"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal"
-        android:gravity="center_horizontal"
+        android:gravity="start"
         android:textDirection="locale"
         android:ellipsize="marquee"
         android:marqueeRepeatLimit="1"
@@ -43,13 +45,12 @@
         android:id="@+id/app_label"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal"
-        android:gravity="center_horizontal"
+        android:gravity="start"
         android:textDirection="locale"
         android:ellipsize="marquee"
         android:marqueeRepeatLimit="1"
         android:singleLine="true"
-        android:visibility="invisible"
+        android:visibility="gone"
         android:focusable="false"
         android:importantForAccessibility="no"
         android:textAppearance="@style/TextAppearance.QS.TileLabel.Secondary"
diff --git a/packages/SystemUI/res/layout/qs_tile_label_round.xml b/packages/SystemUI/res/layout/qs_tile_label_round.xml
new file mode 100644
index 0000000..376cef1
--- /dev/null
+++ b/packages/SystemUI/res/layout/qs_tile_label_round.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2021 The Android Open Source Project
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<com.android.systemui.qs.tileimpl.IgnorableChildLinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:clipChildren="false"
+    android:clipToPadding="false"
+    android:orientation="vertical"
+    android:focusable="false"
+    android:importantForAccessibility="no"
+    android:layout_gravity="center_horizontal">
+
+    <com.android.systemui.util.DelayableMarqueeTextView
+        android:id="@+id/tile_label"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_horizontal"
+        android:gravity="center_horizontal"
+        android:textDirection="locale"
+        android:ellipsize="marquee"
+        android:marqueeRepeatLimit="1"
+        android:singleLine="true"
+        android:focusable="false"
+        android:importantForAccessibility="no"
+        android:textAppearance="@style/TextAppearance.QS.TileLabel"/>
+
+    <com.android.systemui.util.DelayableMarqueeTextView
+        android:id="@+id/app_label"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_horizontal"
+        android:gravity="center_horizontal"
+        android:textDirection="locale"
+        android:ellipsize="marquee"
+        android:marqueeRepeatLimit="1"
+        android:singleLine="true"
+        android:visibility="invisible"
+        android:focusable="false"
+        android:importantForAccessibility="no"
+        android:textAppearance="@style/TextAppearance.QS.TileLabel.Secondary"
+        android:textColor="?android:attr/textColorSecondary"/>
+
+</com.android.systemui.qs.tileimpl.IgnorableChildLinearLayout>
diff --git a/packages/SystemUI/res/layout/qs_tile_side_icon.xml b/packages/SystemUI/res/layout/qs_tile_side_icon.xml
index ef7c969..fbcead1 100644
--- a/packages/SystemUI/res/layout/qs_tile_side_icon.xml
+++ b/packages/SystemUI/res/layout/qs_tile_side_icon.xml
@@ -15,9 +15,8 @@
     limitations under the License.
 -->
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="0dp"
-    android:layout_height="0dp"
-    android:visibility="gone"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
     android:layout_marginStart="@dimen/qs_label_container_margin"
     android:layout_gravity="center_vertical | end"
 >
diff --git a/packages/SystemUI/res/layout/qs_tile_side_icon_round.xml b/packages/SystemUI/res/layout/qs_tile_side_icon_round.xml
new file mode 100644
index 0000000..d49df26
--- /dev/null
+++ b/packages/SystemUI/res/layout/qs_tile_side_icon_round.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2021 The Android Open Source Project
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="0dp"
+    android:layout_height="0dp"
+    android:visibility="gone"
+    android:layout_marginStart="@dimen/qs_label_container_margin"
+    android:layout_gravity="center_vertical | end"
+>
+    <ImageView
+        android:id="@+id/customDrawable"
+        android:layout_width="wrap_content"
+        android:layout_height="@dimen/qs_side_view_size"
+        android:layout_marginEnd="@dimen/qs_drawable_end_margin"
+        android:adjustViewBounds="true"
+        android:scaleType="fitCenter"
+        android:visibility="gone"
+    />
+
+    <ImageView
+        android:id="@+id/chevron"
+        android:layout_width="@dimen/qs_icon_size"
+        android:layout_height="@dimen/qs_icon_size"
+        android:src="@*android:drawable/ic_chevron_end"
+        android:autoMirrored="true"
+        android:visibility="gone"
+        android:importantForAccessibility="no"
+    />
+</FrameLayout>
diff --git a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml
index 718ba6f..d7313de 100644
--- a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml
+++ b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml
@@ -41,7 +41,7 @@
         android:clipChildren="false"
         android:clipToPadding="false"
         android:focusable="true"
-        android:paddingTop="20dp"
+        android:paddingTop="@dimen/custom_qs_panel_padding_top"
         android:paddingBottom="@dimen/qqs_layout_padding_bottom"
         android:importantForAccessibility="no">
     </com.android.systemui.qs.QuickQSPanel>
diff --git a/packages/SystemUI/res/layout/status_bar_notification_footer.xml b/packages/SystemUI/res/layout/status_bar_notification_footer.xml
index 72424a13..054f1c4 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_footer.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_footer.xml
@@ -20,6 +20,8 @@
         xmlns:app="http://schemas.android.com/apk/res-auto"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
+        android:paddingStart="@dimen/custom_notification_row_padding"
+        android:paddingEnd="@dimen/custom_notification_row_padding"
         android:visibility="gone">
     <com.android.systemui.statusbar.AlphaOptimizedFrameLayout
         android:id="@+id/content"
diff --git a/packages/SystemUI/res/values-land/config.xml b/packages/SystemUI/res/values-land/config.xml
index 78422d0..db526b1 100644
--- a/packages/SystemUI/res/values-land/config.xml
+++ b/packages/SystemUI/res/values-land/config.xml
@@ -21,7 +21,7 @@
      for different hardware and product builds. -->
 <resources>
     <!-- The maximum number of rows in the QuickSettings -->
-    <integer name="quick_settings_max_rows">1</integer>
+    <integer name="quick_settings_max_rows">2</integer>
 
     <integer name="quick_settings_num_columns">4</integer>
 
diff --git a/packages/SystemUI/res/values-land/dimens.xml b/packages/SystemUI/res/values-land/dimens.xml
index 75ff4c1..d841117 100644
--- a/packages/SystemUI/res/values-land/dimens.xml
+++ b/packages/SystemUI/res/values-land/dimens.xml
@@ -22,7 +22,6 @@
     <dimen name="docked_divider_handle_width">2dp</dimen>
     <dimen name="docked_divider_handle_height">16dp</dimen>
 
-    <dimen name="qs_tile_margin_vertical">8dp</dimen>
     <dimen name="qs_brightness_margin_top">0dp</dimen>
     <dimen name="qs_brightness_margin_bottom">12dp</dimen>
     <dimen name="qqs_layout_margin_top">8dp</dimen>
diff --git a/packages/SystemUI/res/values-land/leaf_config.xml b/packages/SystemUI/res/values-land/leaf_config.xml
index 130cc83..752de57 100644
--- a/packages/SystemUI/res/values-land/leaf_config.xml
+++ b/packages/SystemUI/res/values-land/leaf_config.xml
@@ -1,4 +1,4 @@
 <resources>
     <!-- The maximum number of tiles in the QuickQSPanel -->
-    <integer name="quick_qs_panel_max_tiles">6</integer>
+    <integer name="quick_qs_panel_max_tiles">4</integer>
 </resources>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 8303403..1eb40c4 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -58,14 +58,17 @@
          prevent wasting cpu cycles on the dimming animation -->
     <bool name="config_navigation_bar_enable_auto_dim_no_visible_wallpaper">true</bool>
 
+    <!-- The maximum number of tiles in the QuickQSPanel -->
+    <integer name="quick_qs_panel_max_tiles">4</integer>
+
     <!-- The maximum number of rows in the QuickQSPanel -->
-    <integer name="quick_qs_panel_max_rows">1</integer>
+    <integer name="quick_qs_panel_max_rows">2</integer>
 
     <!-- The number of columns in the QuickSettings -->
     <integer name="quick_settings_num_columns">2</integer>
 
     <!-- The number of rows in the QuickSettings -->
-    <integer name="quick_settings_max_rows">3</integer>
+    <integer name="quick_settings_max_rows">4</integer>
 
     <!-- Override column number for quick settings.
     For now, this value has effect only when flag lockscreen.enable_landscape is enabled.
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index c2c731c7..734b79d 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -480,7 +480,7 @@
     <dimen name="car_qs_header_system_icons_area_height">54dp</dimen>
 
     <!-- The height of the quick settings footer that holds the pagination dots and edit button -->
-    <dimen name="qs_footer_height">72dp</dimen>
+    <dimen name="qs_footer_height">48dp</dimen>
 
     <!-- 40dp (circles) + 8dp (circle padding) + 8dp (top) + 4dp (bottom) -->
     <dimen name="footer_actions_height">60dp</dimen>
@@ -636,8 +636,8 @@
     <dimen name="pull_span_min">25dp</dimen>
 
     <dimen name="qs_corner_radius">28dp</dimen>
-    <dimen name="qs_tile_height">96dp</dimen>
-    <dimen name="qs_tile_margin_horizontal">22dp</dimen>
+    <dimen name="qs_tile_height">80dp</dimen>
+    <dimen name="qs_tile_margin_horizontal">8dp</dimen>
     <dimen name="qs_tile_margin_vertical">@dimen/qs_tile_margin_horizontal</dimen>
     <dimen name="qs_tile_margin_top_bottom">4dp</dimen>
     <dimen name="qs_brightness_margin_top">8dp</dimen>
@@ -662,12 +662,12 @@
         longer full width and next page of tiles should be at the edge of the screen -->
     <dimen name="qs_tiles_page_horizontal_margin">@dimen/notification_side_paddings</dimen>
 
-    <dimen name="qs_customize_internal_side_paddings">6dp</dimen>
+    <dimen name="qs_customize_internal_side_paddings">8dp</dimen>
     <dimen name="qs_icon_size">20dp</dimen>
     <dimen name="qs_side_view_size">28dp</dimen>
-    <dimen name="qs_label_container_margin">6dp</dimen>
-    <dimen name="qs_quick_tile_size">55dp</dimen>
-    <dimen name="qs_tile_padding">18dp</dimen>
+    <dimen name="qs_label_container_margin">10dp</dimen>
+    <dimen name="qs_quick_tile_size">60dp</dimen>
+    <dimen name="qs_tile_padding">12dp</dimen>
     <dimen name="qs_tile_start_padding">16dp</dimen>
     <dimen name="qs_drawable_end_margin">4dp</dimen>
     <dimen name="qs_page_indicator_width">16dp</dimen>
@@ -676,7 +676,7 @@
          Scaled @dimen/qs_page_indicator-width by .4f.
     -->
     <dimen name="qs_page_indicator_dot_width">6.4dp</dimen>
-    <dimen name="qs_tile_text_size">12sp</dimen>
+    <dimen name="qs_tile_text_size">14sp</dimen>
     <dimen name="qs_panel_padding">16dp</dimen>
     <dimen name="qs_dual_tile_padding_horizontal">6dp</dimen>
     <dimen name="qs_panel_elevation">4dp</dimen>
diff --git a/packages/SystemUI/res/values/leaf_config.xml b/packages/SystemUI/res/values/leaf_config.xml
index 6356cbf..dcc5833 100644
--- a/packages/SystemUI/res/values/leaf_config.xml
+++ b/packages/SystemUI/res/values/leaf_config.xml
@@ -1,15 +1,15 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
     <!-- The maximum number of tiles in a row -->
-    <integer name="quick_qs_panel_max_tiles">5</integer>
+    <integer name="quick_qs_panel_max_tiles">4</integer>
 
     <!-- The number of columns in the QuickQSPanel -->
-    <integer name="quick_qs_panel_num_columns">5</integer>
-    <integer name="quick_qs_panel_num_columns_landscape">6</integer>
-    <integer name="quick_qs_panel_num_columns_media">4</integer>
+    <integer name="quick_qs_panel_num_columns">2</integer>
+    <integer name="quick_qs_panel_num_columns_landscape">4</integer>
+    <integer name="quick_qs_panel_num_columns_media">2</integer>
 
     <!--The number of columns in the QSPanel -->
-    <integer name="qs_panel_num_columns">4</integer>
-    <integer name="qs_panel_num_columns_landscape">6</integer>
-    <integer name="qs_panel_num_columns_media">4</integer>
+    <integer name="qs_panel_num_columns">2</integer>
+    <integer name="qs_panel_num_columns_landscape">4</integer>
+    <integer name="qs_panel_num_columns_media">2</integer>
 </resources>
diff --git a/packages/SystemUI/res/values/leaf_dimens.xml b/packages/SystemUI/res/values/leaf_dimens.xml
index 8315aec..f4713ee 100644
--- a/packages/SystemUI/res/values/leaf_dimens.xml
+++ b/packages/SystemUI/res/values/leaf_dimens.xml
@@ -24,4 +24,9 @@
 
     <!-- Network traffic -->
     <dimen name="network_traffic_width">25sp</dimen>
+
+    <!-- QS Paddings -->
+    <dimen name="custom_qs_panel_padding_top">0dp</dimen>
+    <dimen name="custom_notification_row_padding">16dp</dimen>
+    <dimen name="custom_qs_tile_label_line_height">20sp</dimen>
 </resources>
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 98538e92..c6b0205 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -127,7 +127,7 @@
     <style name="TextAppearance.QS.TileLabel">
         <item name="android:textSize">@dimen/qs_tile_text_size</item>
         <item name="android:letterSpacing">0.01</item>
-        <item name="android:lineHeight">16sp</item>
+        <item name="android:lineHeight">@dimen/custom_qs_tile_label_line_height</item>
         <item name="android:fontFamily">@*android:string/config_bodyFontFamilyMedium</item>
     </style>
 
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java
index 56af1e6..52102d4 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSAnimator.java
@@ -14,6 +14,8 @@
 
 package com.android.systemui.qs;
 
+import static com.android.systemui.util.qs.QSStyleUtils.isRoundQS;
+
 import android.animation.TimeInterpolator;
 import android.animation.ValueAnimator;
 import android.annotation.NonNull;
@@ -356,8 +358,8 @@
 
                     // Icons
                     translateContent(
-                            quickTileView.getIconWithBackground(),
-                            tileView.getIconWithBackground(),
+                            isRoundQS() ? quickTileView.getIconWithBackground() : quickTileView.getIcon(),
+                            isRoundQS() ? tileView.getIconWithBackground() : tileView.getIcon(),
                             view,
                             xOffset,
                             yOffset,
@@ -399,13 +401,13 @@
                     // Therefore, we use a quadratic interpolator animator to animate the alpha
                     // for tiles in QQS to match.
                     quadraticInterpolatorBuilder
-                            .addFloat(quickTileView.getLabelContainer(), "alpha", 0, 1);
+                            .addFloat(isRoundQS() ? quickTileView.getLabelContainer() : quickTileView.getSecondaryLabel(), "alpha", 0, 1);
                     nonFirstPageAlphaBuilder
-                            .addFloat(quickTileView.getLabelContainer(), "alpha", 0, 0);
+                            .addFloat(isRoundQS() ? quickTileView.getLabelContainer() : quickTileView.getSecondaryLabel(), "alpha", 0, 0);
 
                     mAnimatedQsViews.add(tileView);
                     mAllViews.add(quickTileView);
-                    mAllViews.add(quickTileView.getLabelContainer());
+                    mAllViews.add(isRoundQS() ? quickTileView.getLabelContainer() : quickTileView.getSecondaryLabel());
                 } else if (!isIconInAnimatedRow(count)) {
                     // Pretend there's a corresponding QQS tile (for the position) that we are
                     // expanding from.
@@ -424,8 +426,8 @@
                     mOtherFirstPageTilesHeightAnimator.addView(tileView);
                     tileView.setClipChildren(true);
                     tileView.setClipToPadding(true);
-                    firstPageBuilder.addFloat(tileView.getLabelContainer(), "alpha", 0, 1);
-                    mAllViews.add(tileView.getLabelContainer());
+                    firstPageBuilder.addFloat(isRoundQS() ? tileView.getLabelContainer() : tileView.getSecondaryLabel(), "alpha", 0, 1);
+                    mAllViews.add(isRoundQS() ? tileView.getLabelContainer() : tileView.getSecondaryLabel());
                 }
 
                 mAllViews.add(tileView);
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java
index a48645d..a057f22 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java
@@ -18,6 +18,8 @@
 
 import static android.app.StatusBarManager.DISABLE2_QUICK_SETTINGS;
 
+import static com.android.systemui.util.qs.QSStyleUtils.isRoundQS;
+
 import android.content.Context;
 import android.content.res.Configuration;
 import android.graphics.Canvas;
@@ -105,7 +107,7 @@
         int availableHeight = View.MeasureSpec.getSize(heightMeasureSpec);
         int maxQs = availableHeight - layoutParams.topMargin - layoutParams.bottomMargin
                 - getPaddingBottom();
-        if (navBelow) {
+        if (navBelow && isRoundQS()) {
             maxQs -= getResources().getDimensionPixelSize(R.dimen.navigation_bar_height);
         }
         int padding = mPaddingLeft + mPaddingRight + layoutParams.leftMargin
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSImpl.java
index e7ac090..a8ad6aa 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSImpl.java
@@ -30,6 +30,7 @@
 import android.content.res.Resources;
 import android.graphics.Rect;
 import android.os.Bundle;
+import android.provider.Settings;
 import android.util.IndentingPrintWriter;
 import android.util.Log;
 import android.view.View;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
index 1052402..8234d64 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanel.java
@@ -206,7 +206,7 @@
     void setDisabledByPolicy(boolean disabled) {
         if (disabled != mDisabledByPolicy) {
             mDisabledByPolicy = disabled;
-            setVisibility(disabled ? GONE : VISIBLE);
+            setVisibility(disabled ? View.GONE : View.VISIBLE);
         }
     }
 
@@ -219,10 +219,10 @@
     @Override
     public void setVisibility(int visibility) {
         if (mDisabledByPolicy) {
-            if (getVisibility() == GONE) {
+            if (getVisibility() == View.GONE) {
                 return;
             }
-            visibility = GONE;
+            visibility = View.GONE;
         }
         super.setVisibility(visibility);
     }
@@ -326,11 +326,11 @@
             // We set it as not important while we change this, so setting each tile as selected
             // will not cause them to announce themselves until the user has actually selected the
             // item.
-            setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
+            setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
             for (int i = 0; i < getChildCount(); i++) {
                 getChildAt(i).setSelected(selected);
             }
-            setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_AUTO);
+            setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
             mLastSelected = selected;
         }
     }
diff --git a/packages/SystemUI/src/com/android/systemui/qs/customize/CustomizeTileView.kt b/packages/SystemUI/src/com/android/systemui/qs/customize/CustomizeTileView.kt
index ac51511..b8461dc 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/customize/CustomizeTileView.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/customize/CustomizeTileView.kt
@@ -20,6 +20,7 @@
 import android.text.TextUtils
 import com.android.systemui.plugins.qs.QSTile
 import com.android.systemui.qs.tileimpl.QSTileViewImpl
+import com.android.systemui.util.qs.QSStyleUtils.isRoundQS
 
 /** Class for displaying tiles in [QSCustomizer] with the new design (labels on the side). */
 class CustomizeTileView(context: Context) : QSTileViewImpl(context, collapsed = false) {
@@ -47,7 +48,7 @@
         return if (showAppLabel && !TextUtils.isEmpty(text)) {
             VISIBLE
         } else {
-            INVISIBLE
+            if (isRoundQS()) INVISIBLE else GONE
         }
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt
index 6b046be..c76f249 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt
@@ -61,6 +61,7 @@
 import com.android.systemui.qs.logging.QSLogger
 import com.android.systemui.qs.tileimpl.QSIconViewImpl.QS_ANIM_LENGTH
 import com.android.systemui.res.R
+import com.android.systemui.util.qs.QSStyleUtils.isRoundQS
 import com.android.wm.shell.animation.Interpolators
 import java.util.Objects
 
@@ -105,7 +106,9 @@
         }
 
     private val colorActive = Utils.getColorAttrDefaultColor(context, R.attr.shadeActive)
-    private val colorInactive = Utils.getColorAttrDefaultColor(context, R.attr.shadeInactive)
+    private val colorOffstate = Utils.getColorAttrDefaultColor(context, R.attr.shadeInactive)
+    private val colorInactive = if (isRoundQS()) Utils.applyAlpha(INACTIVE_ALPHA, colorOffstate)
+            else colorOffstate
     private val colorUnavailable = Utils.getColorAttrDefaultColor(context, R.attr.shadeDisabled)
 
     private val overlayColorActive = Utils.applyAlpha(
@@ -115,15 +118,21 @@
         /* alpha= */ 0.08f,
         Utils.getColorAttrDefaultColor(context, R.attr.onShadeInactive))
 
-    private val colorLabelActive = Utils.getColorAttrDefaultColor(context, R.attr.onShadeActive)
-    private val colorLabelInactive = Utils.getColorAttrDefaultColor(context, R.attr.onShadeInactive)
+    private val colorLabelActive = Utils.getColorAttrDefaultColor(context,
+            if (isRoundQS()) R.attr.onShadeInactive
+            else R.attr.onShadeActive)
+    private val colorLabelInactive =
+            Utils.getColorAttrDefaultColor(context, if (isRoundQS()) R.attr.onShadeInactiveVariant
+            else R.attr.onShadeInactive)
     private val colorLabelUnavailable =
         Utils.getColorAttrDefaultColor(context, R.attr.outline)
 
     private val colorSecondaryLabelActive =
-        Utils.getColorAttrDefaultColor(context, R.attr.onShadeActiveVariant)
+            Utils.getColorAttrDefaultColor(context, if (isRoundQS()) R.attr.onShadeInactiveVariant
+            else R.attr.onShadeActiveVariant)
     private val colorSecondaryLabelInactive =
-            Utils.getColorAttrDefaultColor(context, R.attr.onShadeInactiveVariant)
+            Utils.getColorAttrDefaultColor(context, if (isRoundQS()) R.attr.outline
+            else R.attr.onShadeInactiveVariant)
     private val colorSecondaryLabelUnavailable =
         Utils.getColorAttrDefaultColor(context, R.attr.outline)
 
@@ -144,7 +153,7 @@
     private lateinit var ripple: RippleDrawable
     private lateinit var backgroundDrawable: LayerDrawable
     private lateinit var backgroundBaseDrawable: Drawable
-    private lateinit var backgroundOverlayDrawable: Drawable
+    private lateinit var backgroundOverlayDrawable: StateListDrawable
 
     private var backgroundColor: Int = 0
     private var backgroundOverlayColor: Int = 0
@@ -197,30 +206,47 @@
                     "Theme.SystemUI.QuickSettings")
         }
         setId(generateViewId())
-        orientation = LinearLayout.VERTICAL
-        gravity = Gravity.CENTER
+        if (isRoundQS()) {
+            orientation = LinearLayout.VERTICAL
+            gravity = Gravity.CENTER
+        } else {
+            orientation = LinearLayout.HORIZONTAL
+            gravity = Gravity.CENTER_VERTICAL or Gravity.START
+        }
         importantForAccessibility = IMPORTANT_FOR_ACCESSIBILITY_YES
         clipChildren = false
         clipToPadding = false
         isFocusable = true
-        background = null
+        background = if (isRoundQS()) null else createTileBackground()
 
-        val iconContainerSize = context.resources.getDimensionPixelSize(R.dimen.qs_quick_tile_size)
-        radiusActive = iconContainerSize / 2f
-        radiusInactive = iconContainerSize / 4f
-        iconContainer = LinearLayout(context)
-        iconContainer.layoutParams = LayoutParams(iconContainerSize, iconContainerSize)
-        iconContainer.clipChildren = false
-        iconContainer.clipToPadding = false
-        iconContainer.orientation = LinearLayout.VERTICAL
-        iconContainer.gravity = Gravity.CENTER
-        iconContainer.background = createTileBackground()
+        if (isRoundQS()) {
+            val iconContainerSize = context.resources.getDimensionPixelSize(R.dimen.qs_quick_tile_size)
+            radiusActive = iconContainerSize / 2f
+            radiusInactive = iconContainerSize / 4f
+            iconContainer = LinearLayout(context)
+            iconContainer.layoutParams = LayoutParams(iconContainerSize, iconContainerSize)
+            iconContainer.clipChildren = false
+            iconContainer.clipToPadding = false
+            iconContainer.orientation = LinearLayout.VERTICAL
+            iconContainer.gravity = Gravity.CENTER
+            iconContainer.background = createTileBackground()
+        }
+
         setColor(getBackgroundColorForState(QSTile.State.DEFAULT_STATE))
-        setCornerRadius(getCornerRadiusForState(QSTile.State.DEFAULT_STATE))
 
         val iconSize = context.resources.getDimensionPixelSize(R.dimen.qs_icon_size)
-        iconContainer.addView(icon, LayoutParams(iconSize, iconSize))
-        addView(iconContainer, 0)
+
+        if (isRoundQS()) {
+            setCornerRadius(getCornerRadiusForState(QSTile.State.DEFAULT_STATE))
+            iconContainer.addView(icon, LayoutParams(iconSize, iconSize))
+            addView(iconContainer, 0)
+        } else {
+            val padding = resources.getDimensionPixelSize(R.dimen.qs_tile_padding)
+            val startPadding = resources.getDimensionPixelSize(R.dimen.qs_tile_start_padding)
+            setPaddingRelative(startPadding, padding, padding, padding)
+            addView(icon, LayoutParams(iconSize, iconSize))
+        }
+
         createAndAddLabels()
         createAndAddSideView()
         updateResources()
@@ -250,6 +276,45 @@
         FontSizeUtils.updateFontSize(label, R.dimen.qs_tile_text_size)
         FontSizeUtils.updateFontSize(secondaryLabel, R.dimen.qs_tile_text_size)
 
+        if (isRoundQS()) {
+            updateRoundQSResources()
+        } else {
+            updateDefaultResources()
+        }
+    }
+
+    fun updateDefaultResources() {
+        val iconSize = context.resources.getDimensionPixelSize(R.dimen.qs_icon_size)
+        icon.layoutParams.apply {
+            height = iconSize
+            width = iconSize
+        }
+
+        val padding = resources.getDimensionPixelSize(R.dimen.qs_tile_padding)
+        val startPadding = resources.getDimensionPixelSize(R.dimen.qs_tile_start_padding)
+        setPaddingRelative(startPadding, padding, padding, padding)
+
+        val labelMargin = resources.getDimensionPixelSize(R.dimen.qs_label_container_margin)
+        (labelContainer.layoutParams as MarginLayoutParams).apply {
+            marginStart = labelMargin
+        }
+
+        (sideView.layoutParams as MarginLayoutParams).apply {
+            marginStart = labelMargin
+        }
+        (chevronView.layoutParams as MarginLayoutParams).apply {
+            height = iconSize
+            width = iconSize
+        }
+
+        val endMargin = resources.getDimensionPixelSize(R.dimen.qs_drawable_end_margin)
+        (customDrawableView.layoutParams as MarginLayoutParams).apply {
+            height = iconSize
+            marginEnd = endMargin
+        }
+    }
+
+    fun updateRoundQSResources() {
         labelContainer.invalidate()
         labelContainer.apply {
             ignoreLastView = collapsed
@@ -257,20 +322,20 @@
         }
         secondaryLabel.alpha = if (collapsed) 0f else 1f
 
-        val iconContainerSize = context.resources.getDimensionPixelSize(R.dimen.qs_quick_tile_size)
+        orientation = LinearLayout.VERTICAL
+        gravity = Gravity.CENTER
 
+        val iconContainerSize = context.resources.getDimensionPixelSize(R.dimen.qs_quick_tile_size)
         iconContainer.layoutParams.apply {
             height = iconContainerSize
             width = iconContainerSize
         }
-
         val padding = resources.getDimensionPixelSize(R.dimen.qs_tile_padding)
         val iconSize = context.resources.getDimensionPixelSize(R.dimen.qs_icon_size)
         icon.layoutParams.apply {
             height = iconSize
             width = iconSize
         }
-
         iconContainer.setPaddingRelative(padding, padding, padding, padding)
         (labelContainer.layoutParams as MarginLayoutParams).apply {
             topMargin = padding / 2
@@ -279,15 +344,27 @@
 
     private fun createAndAddLabels() {
         labelContainer = LayoutInflater.from(context)
-                .inflate(R.layout.qs_tile_label, this, false) as IgnorableChildLinearLayout
+                .inflate(if (isRoundQS()) R.layout.qs_tile_label_round else R.layout.qs_tile_label, this, false) as IgnorableChildLinearLayout
         label = labelContainer.requireViewById(R.id.tile_label)
         secondaryLabel = labelContainer.requireViewById(R.id.app_label)
-        labelContainer.invalidate()
-        labelContainer.apply {
-            ignoreLastView = collapsed
-            forceUnspecifiedMeasure = collapsed
+        if (isRoundQS()) {
+            labelContainer.invalidate()
+            labelContainer.apply {
+                ignoreLastView = collapsed
+                forceUnspecifiedMeasure = collapsed
+            }
+            secondaryLabel.alpha = if (collapsed) 0f else 1f
+        } else {
+            if (collapsed) {
+                labelContainer.ignoreLastView = true
+                // Ideally, it'd be great if the parent could set this up when measuring just this child
+                // instead of the View class having to support this. However, due to the mysteries of
+                // LinearLayout's double measure pass, we cannot overwrite `measureChild` or any of its
+                // sibling methods to have special behavior for labelContainer.
+                labelContainer.forceUnspecifiedMeasure = true
+                secondaryLabel.alpha = 0f
+            }
         }
-        secondaryLabel.alpha = if (collapsed) 0f else 1f
         setLabelColor(getLabelColorForState(QSTile.State.DEFAULT_STATE))
         setSecondaryLabelColor(getSecondaryLabelColorForState(QSTile.State.DEFAULT_STATE))
         addView(labelContainer)
@@ -295,7 +372,7 @@
 
     private fun createAndAddSideView() {
         sideView = LayoutInflater.from(context)
-                .inflate(R.layout.qs_tile_side_icon, this, false) as ViewGroup
+                .inflate(if (isRoundQS()) R.layout.qs_tile_side_icon_round else R.layout.qs_tile_side_icon, this, false) as ViewGroup
         customDrawableView = sideView.requireViewById(R.id.customDrawable)
         chevronView = sideView.requireViewById(R.id.chevron)
         setChevronColor(getChevronColorForState(QSTile.State.DEFAULT_STATE))
@@ -303,12 +380,12 @@
     }
 
     fun createTileBackground(): Drawable {
-        ripple = mContext.getDrawable(R.drawable.qs_tile_background).mutate() as RippleDrawable
+        ripple = mContext.getDrawable(if (isRoundQS()) R.drawable.qs_tile_background_no_mask else R.drawable.qs_tile_background)!!.mutate() as RippleDrawable
         backgroundDrawable = ripple.findDrawableByLayerId(R.id.background) as LayerDrawable
         backgroundBaseDrawable =
             backgroundDrawable.findDrawableByLayerId(R.id.qs_tile_background_base)
         backgroundOverlayDrawable =
-            backgroundDrawable.findDrawableByLayerId(R.id.qs_tile_background_overlay)
+            backgroundDrawable.findDrawableByLayerId(R.id.qs_tile_background_overlay) as StateListDrawable
         backgroundOverlayDrawable.mutate().setTintMode(PorterDuff.Mode.SRC)
         return ripple
     }
@@ -341,7 +418,7 @@
     }
 
     override fun getIconWithBackground(): View {
-        return iconContainer
+        return if (isRoundQS()) iconContainer else icon
     }
 
     override fun init(tile: QSTile) {
@@ -385,14 +462,26 @@
 
     override fun setClickable(clickable: Boolean) {
         super.setClickable(clickable)
-        iconContainer.background = if (clickable && showRippleEffect) {
-            ripple.also {
-                // In case that the colorBackgroundDrawable was used as the background, make sure
-                // it has the correct callback instead of null
-                backgroundDrawable.callback = it
+        if (isRoundQS()) {
+            iconContainer.background = if (clickable && showRippleEffect) {
+                ripple.also {
+                    // In case that the backgroundDrawable was used as the background, make sure
+                    // it has the correct callback instead of null
+                    backgroundDrawable.callback = it
+                }
+            } else {
+                backgroundDrawable
             }
         } else {
-            backgroundDrawable
+            background = if (clickable && showRippleEffect) {
+                ripple.also {
+                    // In case that the backgroundDrawable was used as the background, make sure
+                    // it has the correct callback instead of null
+                    backgroundDrawable.callback = it
+                }
+            } else {
+                backgroundDrawable
+            }
         }
     }
 
@@ -540,7 +629,7 @@
         if (!Objects.equals(secondaryLabel.text, state.secondaryLabel)) {
             secondaryLabel.text = state.secondaryLabel
             secondaryLabel.visibility = if (TextUtils.isEmpty(state.secondaryLabel)) {
-                INVISIBLE
+                if (isRoundQS()) INVISIBLE else GONE
             } else {
                 VISIBLE
             }
@@ -548,17 +637,23 @@
 
         // Colors
         if (state.state != lastState || state.disabledByPolicy != lastDisabledByPolicy) {
-            tileAnimator.cancel()
+            if (isRoundQS()) {
+                tileAnimator.cancel()
+            } else {
+                singleAnimator.cancel()
+            }
             mQsLogger?.logTileBackgroundColorUpdateIfInternetTile(
                     state.spec,
                     state.state,
                     state.disabledByPolicy,
                     getBackgroundColorForState(state.state, state.disabledByPolicy))
             if (allowAnimations) {
-                for (i in 0 until backgroundOverlayDrawable.getStateCount()) {
-                    shapeAnimator.setFloatValues(
-                        (backgroundOverlayDrawable.getStateDrawable(i) as GradientDrawable).cornerRadius,
-                        getCornerRadiusForState(state.state))
+                if (isRoundQS()) {
+                    for (i in 0 until backgroundOverlayDrawable.getStateCount()) {
+                        shapeAnimator.setFloatValues(
+                            (backgroundOverlayDrawable.getStateDrawable(i) as GradientDrawable).cornerRadius,
+                            getCornerRadiusForState(state.state))
+                    }
                 }
                 singleAnimator.setValues(
                         colorValuesHolder(
@@ -587,8 +682,11 @@
                                 getOverlayColorForState(state.state)
                         )
                     )
-                )
-                tileAnimator.start()
+                if (isRoundQS()) {
+                    tileAnimator.start()
+                } else {
+                   singleAnimator.start()
+                }
             } else {
                 setAllColors(
                     getBackgroundColorForState(state.state, state.disabledByPolicy),
@@ -597,7 +695,9 @@
                     getChevronColorForState(state.state, state.disabledByPolicy),
                     getOverlayColorForState(state.state)
                 )
-                setCornerRadius(getCornerRadiusForState(state.state))
+                if (isRoundQS()) {
+                    setCornerRadius(getCornerRadiusForState(state.state))
+                }
             }
         }
 
diff --git a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayApplier.java b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayApplier.java
index 3376e23..86c2caa 100644
--- a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayApplier.java
+++ b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayApplier.java
@@ -242,6 +242,17 @@
         });
     }
 
+    /* Enable overlays */
+    public void enableOverlay(String overlayName, boolean enable) {
+        mBgExecutor.execute(() -> {
+            try {
+                mOverlayManager.setEnabled(overlayName, enable, UserHandle.SYSTEM);
+            } catch (SecurityException | IllegalStateException e) {
+                Log.e(TAG, "Failed to enable overlay", e);
+            }
+        });
+    }
+
     @VisibleForTesting
     protected OverlayManagerTransaction.Builder getTransactionBuilder() {
         return new OverlayManagerTransaction.Builder();
diff --git a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java
index 44bf6d4..3fc4b05 100644
--- a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java
+++ b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java
@@ -30,6 +30,9 @@
 import static com.android.systemui.theme.ThemeOverlayApplier.OVERLAY_COLOR_INDEX;
 import static com.android.systemui.theme.ThemeOverlayApplier.OVERLAY_COLOR_SOURCE;
 import static com.android.systemui.theme.ThemeOverlayApplier.TIMESTAMP_FIELD;
+import static com.android.systemui.util.qs.QSStyleUtils.QS_STYLE_ROUND_OVERLAY;
+import static com.android.systemui.util.qs.QSStyleUtils.isRoundQSSetting;
+import static com.android.systemui.util.qs.QSStyleUtils.setRoundQS;
 
 import android.app.UiModeManager;
 import android.app.WallpaperColors;
@@ -534,6 +537,25 @@
                 },
                 UserHandle.USER_ALL);
 
+        boolean isRoundQS = isRoundQSSetting(mContext);
+        setRoundQS(isRoundQS);
+        mThemeManager.enableOverlay(QS_STYLE_ROUND_OVERLAY, isRoundQS);
+        mSecureSettings.registerContentObserverForUser(
+                Settings.Secure.getUriFor(Settings.Secure.QS_STYLE_ROUND),
+                false,
+                new ContentObserver(mBgHandler) {
+                    @Override
+                    public void onChange(boolean selfChange, Collection<Uri> collection, int flags,
+                            int userId) {
+                        boolean isRoundQS = isRoundQSSetting(mContext);
+                        setRoundQS(isRoundQS);
+                        mThemeManager.enableOverlay(QS_STYLE_ROUND_OVERLAY, isRoundQS);
+
+                        reevaluateSystemTheme(true /* forceReload */);
+                    }
+                },
+                UserHandle.USER_ALL);
+
         mSecureSettings.registerContentObserverForUser(
                 Settings.Secure.getUriFor(Settings.Secure.QS_BRIGHTNESS_SLIDER_POSITION),
                 false,
diff --git a/packages/SystemUI/src/com/android/systemui/util/qs/QSStyleUtils.java b/packages/SystemUI/src/com/android/systemui/util/qs/QSStyleUtils.java
new file mode 100644
index 0000000..a35d15a
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/util/qs/QSStyleUtils.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2023 The LeafOS Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the
+ * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package com.android.systemui.util.qs;
+
+import android.content.Context;
+import android.os.UserHandle;
+import android.provider.Settings;
+
+import com.android.systemui.R;
+
+public class QSStyleUtils {
+    public static final String QS_STYLE_ROUND = Settings.Secure.QS_STYLE_ROUND;
+    public static final String QS_STYLE_ROUND_OVERLAY = "com.android.systemui.qs_style.round";
+
+    private static boolean mIsRoundQS;
+
+    public static void setRoundQS(boolean enable) {
+        mIsRoundQS = enable;
+    }
+
+    public static boolean isRoundQS() {
+        return mIsRoundQS;
+    }
+
+    public static boolean isRoundQSSetting(Context context) {
+        return Settings.Secure.getIntForUser(context.getContentResolver(),
+                QS_STYLE_ROUND, 1, UserHandle.USER_CURRENT) == 1;
+    }
+}