Merge changes from topics "dreams-phone", "dreams-preview-placeholder"

* changes:
  Add default placeholder when a dream doesn't provide a preview image.
  Update default dream settings dimens for phones.
  Update dream settings UX to match latest mocks.
diff --git a/res/color/dream_card_color_state_list.xml b/res/color/dream_card_color_state_list.xml
index b5de7b4..b0c86bb 100644
--- a/res/color/dream_card_color_state_list.xml
+++ b/res/color/dream_card_color_state_list.xml
@@ -17,6 +17,6 @@
 
 <selector xmlns:android="http://schemas.android.com/apk/res/android"
           xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
-    <item android:state_selected="true" android:color="?androidprv:attr/colorSurfaceVariant"/>
-    <item android:color="?androidprv:attr/colorSurfaceHighlight"/>
+    <item android:state_selected="true" android:color="?androidprv:attr/colorAccentPrimary"/>
+    <item android:color="?androidprv:attr/colorSurface"/>
 </selector>
\ No newline at end of file
diff --git a/res/color/dream_card_text_color_state_list.xml b/res/color/dream_card_text_color_state_list.xml
new file mode 100644
index 0000000..438855f
--- /dev/null
+++ b/res/color/dream_card_text_color_state_list.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2022 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.
+  -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+          xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+    <item android:state_selected="true" android:color="?androidprv:attr/textColorOnAccent"/>
+    <item android:color="?android:attr/textColorPrimary"/>
+</selector>
\ No newline at end of file
diff --git a/res/drawable/dream_default_preview_icon.xml b/res/drawable/dream_default_preview_icon.xml
new file mode 100644
index 0000000..7d247bb
--- /dev/null
+++ b/res/drawable/dream_default_preview_icon.xml
@@ -0,0 +1,24 @@
+<!--
+  ~ Copyright (C) 2022 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.
+  -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24"
+        android:viewportHeight="24">
+    <path android:fillColor="?android:attr/textColorSecondary"
+          android:pathData="M3,19Q2.175,19 1.588,18.413Q1,17.825 1,17V7Q1,6.175 1.588,5.588Q2.175,5 3,5H13Q13.825,5 14.413,5.588Q15,6.175 15,7V17Q15,17.825 14.413,18.413Q13.825,19 13,19ZM3,17H13Q13,17 13,17Q13,17 13,17V7Q13,7 13,7Q13,7 13,7H3Q3,7 3,7Q3,7 3,7V17Q3,17 3,17Q3,17 3,17ZM17,19V5H19V19ZM21,19V5H23V19ZM4,15H12L9.4,11.5L7.5,14L6.1,12.15ZM3,7Q3,7 3,7Q3,7 3,7V17Q3,17 3,17Q3,17 3,17Q3,17 3,17Q3,17 3,17V7Q3,7 3,7Q3,7 3,7Z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/dream_preview_rounded_bg.xml b/res/drawable/dream_preview_rounded_bg.xml
new file mode 100644
index 0000000..4da0c7c1
--- /dev/null
+++ b/res/drawable/dream_preview_rounded_bg.xml
@@ -0,0 +1,22 @@
+<!--
+  ~ Copyright (C) 2022 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"
+       xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+       android:shape="rectangle">
+    <solid android:color="?androidprv:attr/colorSurfaceHighlight" />
+    <corners android:radius="@dimen/dream_item_corner_radius"/>
+</shape>
\ No newline at end of file
diff --git a/res/layout/dream_picker_layout.xml b/res/layout/dream_picker_layout.xml
index 6de7ff6..68e2051 100644
--- a/res/layout/dream_picker_layout.xml
+++ b/res/layout/dream_picker_layout.xml
@@ -15,32 +15,25 @@
     limitations under the License.
 -->
 
-<LinearLayout
+
+<androidx.constraintlayout.widget.ConstraintLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
-    <androidx.cardview.widget.CardView
-        android:id="@+id/dream_picker_container"
-        android:layout_width="match_parent"
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/dream_list"
+        android:layout_width="0dp"
         android:layout_height="wrap_content"
-        style="@style/DreamPickerBackgroundStyle">
+        android:clipToPadding="true"
+        android:nestedScrollingEnabled="false"
+        android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+        android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+        android:paddingBottom="@dimen/dream_preference_card_padding"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"/>
 
-        <androidx.constraintlayout.widget.ConstraintLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content">
-
-            <androidx.recyclerview.widget.RecyclerView
-                android:id="@+id/dream_list"
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:clipToPadding="true"
-                android:nestedScrollingEnabled="false"
-                app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintEnd_toEndOf="parent"/>
-
-        </androidx.constraintlayout.widget.ConstraintLayout>
-
-    </androidx.cardview.widget.CardView>
-</LinearLayout>
+</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/res/layout/dream_preference_layout.xml b/res/layout/dream_preference_layout.xml
index 2bc67ba..9528f4d 100644
--- a/res/layout/dream_preference_layout.xml
+++ b/res/layout/dream_preference_layout.xml
@@ -17,7 +17,6 @@
 
 <androidx.cardview.widget.CardView
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/container"
     android:layout_width="match_parent"
@@ -30,21 +29,26 @@
         android:layout_height="wrap_content"
         android:minHeight="?android:attr/listPreferredItemHeight">
 
-        <androidx.cardview.widget.CardView
-            android:id="@+id/preview_container"
-            android:layout_width="match_parent"
+        <ImageView
+            android:id="@+id/preview"
+            android:layout_width="0dp"
             android:layout_height="0dp"
-            app:cardCornerRadius="@dimen/dream_item_corner_radius"
-            app:cardElevation="0dp"
+            android:background="@drawable/dream_preview_rounded_bg"
             app:layout_constraintDimensionRatio="1:1"
             app:layout_constraintTop_toTopOf="parent"
-            app:layout_constraintStart_toStartOf="parent">
-            <ImageView
-                android:id="@+id/preview"
-                android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:scaleType="centerCrop"/>
-        </androidx.cardview.widget.CardView>
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"/>
+
+        <ImageView
+            android:id="@+id/preview_placeholder"
+            android:layout_width="@dimen/dream_preview_placeholder_width"
+            android:layout_height="0dp"
+            android:src="@drawable/dream_default_preview_icon"
+            app:layout_constraintDimensionRatio="1:1"
+            app:layout_constraintTop_toTopOf="@+id/preview"
+            app:layout_constraintBottom_toBottomOf="@+id/preview"
+            app:layout_constraintStart_toStartOf="@+id/preview"
+            app:layout_constraintEnd_toEndOf="@+id/preview"/>
 
         <Button
             android:id="@+id/customize_button"
@@ -53,10 +57,10 @@
             android:layout_height="wrap_content"
             android:visibility="gone"
             android:text="@string/customize_button_title"
-            app:layout_constraintTop_toTopOf="@+id/preview_container"
-            app:layout_constraintBottom_toBottomOf="@+id/preview_container"
-            app:layout_constraintStart_toStartOf="@+id/preview_container"
-            app:layout_constraintEnd_toEndOf="@+id/preview_container"/>
+            app:layout_constraintTop_toTopOf="@+id/preview"
+            app:layout_constraintBottom_toBottomOf="@+id/preview"
+            app:layout_constraintStart_toStartOf="@+id/preview"
+            app:layout_constraintEnd_toEndOf="@+id/preview"/>
 
         <ImageView
             android:id="@+id/icon"
@@ -68,7 +72,7 @@
             android:gravity="center_vertical"
             app:layout_constraintDimensionRatio="1:1"
             app:layout_constraintHorizontal_chainStyle="packed"
-            app:layout_constraintTop_toBottomOf="@+id/preview_container"
+            app:layout_constraintTop_toBottomOf="@+id/preview"
             app_layout_constraintEnd_toStartOf="@+id/title_text"
             app:layout_constraintStart_toStartOf="parent"/>
 
@@ -82,8 +86,9 @@
             android:gravity="center_vertical"
             android:maxLines="1"
             android:ellipsize="end"
-            android:textAppearance="?android:attr/textAppearanceListItemSmall"
-            app:layout_constraintTop_toBottomOf="@+id/preview_container"
+            android:textSize="16sp"
+            android:textColor="@color/dream_card_text_color_state_list"
+            app:layout_constraintTop_toBottomOf="@+id/preview"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toEndOf="@+id/icon"/>
 
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index be1ba5b..78dbcce 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -441,7 +441,7 @@
     <dimen name="chartview_trapezoid_margin_bottom">2dp</dimen>
 
     <!-- Dimensions for Dream settings cards -->
-    <dimen name="dream_item_min_column_width">210dp</dimen>
+    <dimen name="dream_item_min_column_width">174dp</dimen>
     <dimen name="dream_item_corner_radius">28dp</dimen>
     <dimen name="dream_item_content_padding">8dp</dimen>
     <dimen name="dream_item_icon_size">20dp</dimen>
@@ -449,9 +449,10 @@
     <dimen name="dream_item_title_margin_bottom">8dp</dimen>
     <dimen name="dream_item_title_margin_start">18dp</dimen>
     <dimen name="dream_item_icon_margin_start">10dp</dimen>
-    <dimen name="dream_preference_margin_horizontal">10dp</dimen>
+    <dimen name="dream_preference_card_padding">16dp</dimen>
     <dimen name="dream_preference_margin_bottom">20dp</dimen>
     <dimen name="dream_picker_margin_horizontal">48dp</dimen>
+    <dimen name="dream_preview_placeholder_width">52dp</dimen>
 
     <!-- Sims/Data mobile/Calls/SMS select dialog-->
     <dimen name="sims_select_margin_bottom">24dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 96b31f2..135dd56 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -13905,11 +13905,13 @@
     <!-- TARE dialog button to proceed with a value change [CHAR LIMIT=none] -->
     <string name="tare_dialog_confirm_button_title">Confirm</string>
     <!-- Button to preview the selected screensaver in settings [CHAR LIMIT=40] -->
-    <string name="dream_preview_button_title">Preview screensaver</string>
+    <string name="dream_preview_button_title">Preview screen saver</string>
     <!-- The title of the category to show for the screensaver selector in settings [CHAR LIMIT=none] -->
-    <string name="dream_picker_category">Choose an image</string>
-    <!-- The title of the category to show for the screensaver overlay selector in settings [CHAR LIMIT=none] -->
-    <string name="dream_complications_picker_category">Choose more options</string>
+    <string name="dream_picker_category">Choose a background</string>
+    <!-- The title of the toggle which enables/disables overlays on top of the screen saver [CHAR LIMIT=none] -->
+    <string name="dream_complications_toggle_title">Show additional information</string>
+    <!-- The summary of what overlays this toggle controls [CHAR LIMIT=none] -->
+    <string name="dream_complications_toggle_summary">Display data time, date and weather on the screen saver</string>
     <!-- The title of the category to show for the screensaver miscellaneous settings [CHAR LIMIT=none] -->
     <string name="dream_more_settings_category">More settings</string>
     <!-- The title of the screen saver setup page [CHAR LIMIT=none] -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index a64eb1f..ebaea6b 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -944,23 +944,10 @@
     </style>
 
     <style name="DreamCardStyle">
-        <item name="android:layout_marginBottom">@dimen/dream_preference_margin_bottom</item>
-        <item name="android:layout_marginStart">@dimen/dream_preference_margin_horizontal</item>
-        <item name="android:layout_marginEnd">@dimen/dream_preference_margin_horizontal</item>
         <item name="cardBackgroundColor">@color/dream_card_color_state_list</item>
         <item name="cardCornerRadius">@dimen/dream_item_corner_radius</item>
         <item name="cardElevation">0dp</item>
         <item name="rippleColor">?android:attr/colorControlHighlight</item>
         <item name="contentPadding">@dimen/dream_item_content_padding</item>
     </style>
-
-    <style name="DreamPickerBackgroundStyle">
-        <item name="android:layout_marginBottom">48dp</item>
-        <item name="android:layout_marginStart">@dimen/dream_picker_margin_horizontal</item>
-        <item name="android:layout_marginEnd">@dimen/dream_picker_margin_horizontal</item>
-        <item name="cardBackgroundColor">?androidprv:attr/colorSurface</item>
-        <item name="cardCornerRadius">24dp</item>
-        <item name="cardElevation">0dp</item>
-        <item name="contentPadding">32dp</item>
-    </style>
 </resources>
diff --git a/res/xml/dream_fragment_overview.xml b/res/xml/dream_fragment_overview.xml
index 9dfa105..105cec4 100644
--- a/res/xml/dream_fragment_overview.xml
+++ b/res/xml/dream_fragment_overview.xml
@@ -29,18 +29,12 @@
     </PreferenceCategory>
 
     <PreferenceCategory
-        android:key="dream_complication_category"
-        android:title="@string/dream_complications_picker_category"
-        settings:controller="com.android.settings.dream.DreamComplicationCategoryController">
-        <com.android.settingslib.widget.LayoutPreference
-            android:key="dream_complication_picker"
-            android:selectable="false"
-            android:layout="@layout/dream_picker_layout"
-            settings:controller="com.android.settings.dream.DreamComplicationPickerController"/>
-    </PreferenceCategory>
-
-    <PreferenceCategory
         android:title="@string/dream_more_settings_category">
+        <SwitchPreference
+            android:key="dream_complications_toggle"
+            android:title="@string/dream_complications_toggle_title"
+            android:summary="@string/dream_complications_toggle_summary"
+            settings:controller="com.android.settings.dream.DreamComplicationPreferenceController"/>
         <Preference
             android:key="when_to_start"
             android:title="@string/screensaver_settings_when_to_dream"
diff --git a/src/com/android/settings/dream/DreamAdapter.java b/src/com/android/settings/dream/DreamAdapter.java
index 8d0e9d5..4e16ccb 100644
--- a/src/com/android/settings/dream/DreamAdapter.java
+++ b/src/com/android/settings/dream/DreamAdapter.java
@@ -48,6 +48,7 @@
         private final ImageView mIconView;
         private final TextView mTitleView;
         private final ImageView mPreviewView;
+        private final ImageView mPreviewPlaceholderView;
         private final Button mCustomizeButton;
         private final Context mContext;
 
@@ -55,6 +56,7 @@
             super(view);
             mContext = context;
             mPreviewView = view.findViewById(R.id.preview);
+            mPreviewPlaceholderView = view.findViewById(R.id.preview_placeholder);
             mIconView = view.findViewById(R.id.icon);
             mTitleView = view.findViewById(R.id.title_text);
             mCustomizeButton = view.findViewById(R.id.customize_button);
@@ -68,10 +70,9 @@
 
             final Drawable previewImage = item.getPreviewImage();
             if (previewImage != null) {
-                mPreviewView.setVisibility(View.VISIBLE);
                 mPreviewView.setImageDrawable(previewImage);
-            } else {
-                mPreviewView.setVisibility(View.GONE);
+                mPreviewView.setClipToOutline(true);
+                mPreviewPlaceholderView.setVisibility(View.GONE);
             }
 
             final Drawable icon = item.isActive()
diff --git a/src/com/android/settings/dream/DreamComplicationPickerController.java b/src/com/android/settings/dream/DreamComplicationPickerController.java
deleted file mode 100644
index 09ed8da..0000000
--- a/src/com/android/settings/dream/DreamComplicationPickerController.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2022 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.
- */
-
-package com.android.settings.dream;
-
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-
-import androidx.preference.PreferenceScreen;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.android.settings.R;
-import com.android.settings.core.BasePreferenceController;
-import com.android.settingslib.dream.DreamBackend;
-import com.android.settingslib.widget.LayoutPreference;
-
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * Controller for the component allowing a user to select overlays to show on top of dreams.
- */
-public class DreamComplicationPickerController extends BasePreferenceController {
-    private static final String KEY = "dream_complication_picker";
-
-    private final DreamBackend mBackend;
-    private final Set<Integer> mSupportedComplications;
-
-    private class ComplicationItem implements IDreamItem {
-        private final int mComplicationType;
-        private boolean mEnabled;
-
-        ComplicationItem(@DreamBackend.ComplicationType int complicationType) {
-            mComplicationType = complicationType;
-            mEnabled = mBackend.isComplicationEnabled(mComplicationType);
-        }
-
-        @Override
-        public CharSequence getTitle() {
-            return mBackend.getComplicationTitle(mComplicationType);
-        }
-
-        @Override
-        public Drawable getIcon() {
-            // TODO(b/215703483): add icon for each complication
-            return null;
-        }
-
-        @Override
-        public void onItemClicked() {
-            mEnabled = !mEnabled;
-            mBackend.setComplicationEnabled(mComplicationType, mEnabled);
-        }
-
-        @Override
-        public Drawable getPreviewImage() {
-            // TODO(b/215703483): add preview image for each complication
-            return null;
-        }
-
-        @Override
-        public boolean isActive() {
-            return mEnabled;
-        }
-    }
-
-    public DreamComplicationPickerController(Context context) {
-        super(context, KEY);
-        mBackend = DreamBackend.getInstance(context);
-        mSupportedComplications = mBackend.getSupportedComplications();
-    }
-
-    @Override
-    public String getPreferenceKey() {
-        return KEY;
-    }
-
-    @Override
-    public int getAvailabilityStatus() {
-        return mSupportedComplications.size() > 0 ? AVAILABLE
-                : CONDITIONALLY_UNAVAILABLE;
-    }
-
-    @Override
-    public void displayPreference(PreferenceScreen screen) {
-        super.displayPreference(screen);
-
-        DreamAdapter adapter = new DreamAdapter(mSupportedComplications.stream()
-                .map(ComplicationItem::new)
-                .collect(Collectors.toList()));
-
-        LayoutPreference pref = screen.findPreference(getPreferenceKey());
-        if (pref != null) {
-            final RecyclerView recyclerView = pref.findViewById(R.id.dream_list);
-            recyclerView.setLayoutManager(new AutoFitGridLayoutManager(mContext));
-            recyclerView.setHasFixedSize(true);
-            recyclerView.setAdapter(adapter);
-        }
-    }
-}
diff --git a/src/com/android/settings/dream/DreamComplicationPreferenceController.java b/src/com/android/settings/dream/DreamComplicationPreferenceController.java
new file mode 100644
index 0000000..d9c4fb3
--- /dev/null
+++ b/src/com/android/settings/dream/DreamComplicationPreferenceController.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+package com.android.settings.dream;
+
+import android.content.Context;
+
+import com.android.settings.R;
+import com.android.settings.core.TogglePreferenceController;
+import com.android.settingslib.dream.DreamBackend;
+
+/**
+ * Controller for the {@link androidx.preference.SwitchPreference} which controls if dream
+ * overlays should be enabled.
+ */
+public class DreamComplicationPreferenceController extends TogglePreferenceController {
+    private final DreamBackend mBackend;
+
+    public DreamComplicationPreferenceController(Context context, String key) {
+        super(context, key);
+        mBackend = DreamBackend.getInstance(context);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return mBackend.getSupportedComplications().isEmpty() ? CONDITIONALLY_UNAVAILABLE
+                : AVAILABLE;
+    }
+
+    @Override
+    public boolean isChecked() {
+        return mBackend.getEnabledComplications().containsAll(mBackend.getSupportedComplications());
+    }
+
+    @Override
+    public boolean setChecked(boolean isChecked) {
+        for (int complication : mBackend.getSupportedComplications()) {
+            mBackend.setComplicationEnabled(complication, isChecked);
+        }
+        return true;
+    }
+
+    @Override
+    public int getSliceHighlightMenuRes() {
+        return R.string.menu_key_display;
+    }
+}
diff --git a/src/com/android/settings/dream/DreamPickerController.java b/src/com/android/settings/dream/DreamPickerController.java
index 6d5463c..b7ba614 100644
--- a/src/com/android/settings/dream/DreamPickerController.java
+++ b/src/com/android/settings/dream/DreamPickerController.java
@@ -21,7 +21,7 @@
 import android.graphics.drawable.Drawable;
 
 import androidx.annotation.Nullable;
-import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
 import androidx.recyclerview.widget.RecyclerView;
 
 import com.android.settings.R;
@@ -71,16 +71,21 @@
     }
 
     @Override
-    public void updateState(Preference preference) {
-        super.updateState(preference);
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
 
         mAdapter = new DreamAdapter(mDreamInfos.stream()
                 .map(DreamItem::new)
                 .collect(Collectors.toList()));
 
-        final RecyclerView recyclerView =
-                ((LayoutPreference) preference).findViewById(R.id.dream_list);
+        final LayoutPreference pref = screen.findPreference(getPreferenceKey());
+        if (pref == null) {
+            return;
+        }
+        final RecyclerView recyclerView = pref.findViewById(R.id.dream_list);
         recyclerView.setLayoutManager(new AutoFitGridLayoutManager(mContext));
+        recyclerView.addItemDecoration(
+                new GridSpacingItemDecoration(mContext, R.dimen.dream_preference_card_padding));
         recyclerView.setHasFixedSize(true);
         recyclerView.setAdapter(mAdapter);
     }
diff --git a/src/com/android/settings/dream/DreamSettings.java b/src/com/android/settings/dream/DreamSettings.java
index 2acce07..bfa19a9 100644
--- a/src/com/android/settings/dream/DreamSettings.java
+++ b/src/com/android/settings/dream/DreamSettings.java
@@ -34,14 +34,12 @@
 import com.android.settings.R;
 import com.android.settings.dashboard.DashboardFragment;
 import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settings.widget.PreferenceCategoryController;
 import com.android.settingslib.core.AbstractPreferenceController;
 import com.android.settingslib.dream.DreamBackend;
 import com.android.settingslib.dream.DreamBackend.WhenToDream;
 import com.android.settingslib.search.SearchIndexable;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 
 @SearchIndexable
@@ -52,7 +50,6 @@
     static final String WHILE_DOCKED_ONLY = "while_docked_only";
     static final String EITHER_CHARGING_OR_DOCKED = "either_charging_or_docked";
     static final String NEVER_DREAM = "never";
-    private static final String COMPLICATIONS_CATEGORY_KEY = "dream_complication_category";
 
     @WhenToDream
     static int getSettingFromPrefKey(String key) {
@@ -138,14 +135,8 @@
 
     private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
         final List<AbstractPreferenceController> controllers = new ArrayList<>();
-        final DreamComplicationPickerController complicationPickerController =
-                new DreamComplicationPickerController(context);
-
-        controllers.add(complicationPickerController);
-        controllers.add(new WhenToDreamPreferenceController(context));
         controllers.add(new DreamPickerController(context));
-        controllers.add(new PreferenceCategoryController(context, COMPLICATIONS_CATEGORY_KEY)
-                .setChildren(Collections.singletonList(complicationPickerController)));
+        controllers.add(new WhenToDreamPreferenceController(context));
         return controllers;
     }
 
diff --git a/src/com/android/settings/dream/GridSpacingItemDecoration.java b/src/com/android/settings/dream/GridSpacingItemDecoration.java
new file mode 100644
index 0000000..6e6a551
--- /dev/null
+++ b/src/com/android/settings/dream/GridSpacingItemDecoration.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+package com.android.settings.dream;
+
+import android.content.Context;
+import android.graphics.Rect;
+import android.view.View;
+
+import androidx.annotation.DimenRes;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+/**
+ * RecyclerView item decorator to be used with {@link GridLayoutManager} for applying padding to
+ * only the inner elements of the grid.
+ */
+public class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
+    private final int mSpacing;
+    private final boolean mRtl;
+
+    public GridSpacingItemDecoration(Context context, @DimenRes int spacingId) {
+        mSpacing = context.getResources().getDimensionPixelSize(spacingId);
+        mRtl = context.getResources().getConfiguration().getLayoutDirection()
+                == View.LAYOUT_DIRECTION_RTL;
+    }
+
+    @Override
+    public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
+            RecyclerView.State state) {
+        final RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
+
+        if (!(layoutManager instanceof GridLayoutManager)) {
+            return;
+        }
+
+        final int spanCount = ((GridLayoutManager) layoutManager).getSpanCount();
+        final int position = parent.getChildAdapterPosition(view);
+        final int column = position % spanCount;
+
+        final int startPadding = column * mSpacing / spanCount;
+        final int endPadding = mSpacing - (column + 1) * mSpacing / spanCount;
+
+        outRect.left = mRtl ? endPadding : startPadding;
+        outRect.right = mRtl ? startPadding : endPadding;
+        if (position >= spanCount) {
+            outRect.top = mSpacing;
+        }
+    }
+}