Merge "[Panlingual] Adds a filter of application for per apps locale change."
diff --git a/res/color/dream_card_color_state_list.xml b/res/color/dream_card_color_state_list.xml
new file mode 100644
index 0000000..31821dd
--- /dev/null
+++ b/res/color/dream_card_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_activated="true" android:color="?androidprv:attr/colorSurfaceHighlight"/>
+    <item android:color="?androidprv:attr/colorSurface"/>
+</selector>
\ No newline at end of file
diff --git a/res/drawable/accessibility_qs_tooltips_background.xml b/res/drawable/accessibility_qs_tooltips_background.xml
index a704b2e..bfce47f 100644
--- a/res/drawable/accessibility_qs_tooltips_background.xml
+++ b/res/drawable/accessibility_qs_tooltips_background.xml
@@ -19,7 +19,7 @@
     <item android:top="8dp">
         <shape
             android:shape="rectangle">
-            <solid android:color="#BCEDDF"/>
+            <solid android:color="@*android:color/accent_primary_device_default"/>
             <corners android:radius="28dp" />
             <padding android:top="8dp" />
         </shape>
@@ -32,7 +32,7 @@
         android:top="-6dp">
         <rotate android:fromDegrees="45">
             <shape android:shape="rectangle">
-            <solid android:color="#BCEDDF"/>
+            <solid android:color="@*android:color/accent_primary_device_default"/>
             </shape>
         </rotate>
     </item>
diff --git a/res/drawable/accessibility_text_reading_preview.xml b/res/drawable/accessibility_text_reading_preview.xml
new file mode 100644
index 0000000..54f3a42
--- /dev/null
+++ b/res/drawable/accessibility_text_reading_preview.xml
@@ -0,0 +1,24 @@
+<?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.
+-->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
+    android:shape="rectangle">
+
+    <corners android:radius="28dp" />
+    <solid android:color="?androidprv:attr/colorSurface" />
+</shape>
diff --git a/res/layout/accessibility_text_reading_preview.xml b/res/layout/accessibility_text_reading_preview.xml
new file mode 100644
index 0000000..9caed30
--- /dev/null
+++ b/res/layout/accessibility_text_reading_preview.xml
@@ -0,0 +1,54 @@
+<?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.
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+    android:paddingStart="?android:attr/listPreferredItemPaddingStart">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:background="@drawable/accessibility_text_reading_preview"
+        android:clipChildren="true"
+        android:orientation="vertical"
+        android:padding="18dp">
+
+        <TextView
+            android:id="@+id/preview_label"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/screen_zoom_preview_title"
+            style="@style/AccessibilityTextReadingPreviewTitle" />
+
+        <androidx.viewpager.widget.ViewPager
+            android:id="@+id/preview_pager"
+            android:layout_width="match_parent"
+            android:layout_height="217dp"
+            android:contentDescription="@string/preview_pager_content_description" />
+
+        <com.android.settings.widget.DotsPageIndicator
+            android:id="@+id/page_indicator"
+            style="@style/PreviewPagerPageIndicator"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_horizontal"
+            android:padding="6dp"
+            android:visibility="gone" />
+    </LinearLayout>
+</FrameLayout>
diff --git a/res/layout/dream_picker_layout.xml b/res/layout/dream_picker_layout.xml
new file mode 100644
index 0000000..c5210dd
--- /dev/null
+++ b/res/layout/dream_picker_layout.xml
@@ -0,0 +1,42 @@
+<?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.
+-->
+
+<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"
+    android:padding="@dimen/dream_picker_padding">
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/dream_list"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:clipToPadding="true"
+        android:nestedScrollingEnabled="false"/>
+
+    <Button
+        android:id="@+id/preview_button"
+        style="@style/ActionPrimaryButton"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/dream_preview_button_title"
+        app:layout_constraintTop_toBottomOf="@+id/dream_list"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"/>
+
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/res/layout/dream_preference_layout.xml b/res/layout/dream_preference_layout.xml
new file mode 100644
index 0000000..05f88cd
--- /dev/null
+++ b/res/layout/dream_preference_layout.xml
@@ -0,0 +1,104 @@
+<?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.
+-->
+
+<androidx.cardview.widget.CardView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:id="@+id/container"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_margin="10dp"
+    style="@style/DreamCardStyle"
+    android:clickable="true">
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_margin="8dp"
+        android:minHeight="?android:attr/listPreferredItemHeight">
+
+        <androidx.cardview.widget.CardView
+            android:id="@+id/preview_container"
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            app:cardCornerRadius="@dimen/dream_item_corner_radius"
+            app:cardElevation="0dp"
+            app:layout_constraintDimensionRatio="3:2"
+            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>
+
+        <Button
+            android:id="@+id/customize_button"
+            style="@style/ActionPrimaryButton"
+            android:layout_width="wrap_content"
+            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"/>
+
+        <ImageView
+            android:id="@+id/icon"
+            android:layout_width="18dp"
+            android:layout_height="0dp"
+            android:layout_marginTop="18dp"
+            android:layout_marginStart="10dp"
+            android:layout_marginBottom="10dp"
+            app:layout_constraintDimensionRatio="1:1"
+            app:layout_constraintTop_toBottomOf="@+id/preview_container"
+            app_layout_constraintEnd_toStartOf="@+id/title_text"
+            app:layout_constraintStart_toStartOf="parent"/>
+
+        <TextView
+            android:id="@+id/title_text"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="18dp"
+            android:layout_marginTop="16dp"
+            android:layout_marginBottom="10dp"
+            android:maxLines="1"
+            android:ellipsize="end"
+            android:textAppearance="?android:attr/textAppearanceListItemSmall"
+            app:layout_constraintTop_toBottomOf="@+id/preview_container"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toEndOf="@+id/icon"/>
+
+        <TextView
+            android:id="@+id/summary_text"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:textColor="?android:attr/textColorSecondary"
+            android:maxLines="2"
+            android:layout_marginBottom="8dp"
+            android:layout_marginStart="8dp"
+            android:layout_marginEnd="8dp"
+            app:layout_constraintTop_toBottomOf="@+id/title_text"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"/>
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
+</androidx.cardview.widget.CardView>
diff --git a/res/layout/dream_start_button.xml b/res/layout/dream_start_button.xml
deleted file mode 100644
index 17ba78d..0000000
--- a/res/layout/dream_start_button.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?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.
-  -->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="horizontal"
-    android:gravity="bottom"
-    android:paddingStart="72dp"
-    android:paddingEnd="72dp"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent">
-
-    <Button
-        android:id="@+id/dream_start_now_button"
-        style="@style/ActionPrimaryButton"
-        android:layout_width="0dp"
-        android:layout_weight="1"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center"
-        android:text="@string/screensaver_settings_dream_start"/>
-
-</LinearLayout>
diff --git a/res/layout/udfps_enroll_enrolling.xml b/res/layout/udfps_enroll_enrolling.xml
index 67c127b..e933753 100644
--- a/res/layout/udfps_enroll_enrolling.xml
+++ b/res/layout/udfps_enroll_enrolling.xml
@@ -17,6 +17,7 @@
 
 <com.google.android.setupdesign.GlifLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/setup_wizard_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
@@ -30,15 +31,45 @@
         android:clipChildren="false"
         android:orientation="vertical">
 
-        <TextView
-            android:id="@+id/error_text"
-            style="@style/TextAppearance.ErrorText"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center_horizontal|bottom"
-            android:accessibilityLiveRegion="polite"
-            android:gravity="center_horizontal"
-            android:visibility="invisible" />
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="1"
+            android:gravity="center|bottom"
+            android:orientation="vertical">
+
+          <FrameLayout
+              android:layout_width="match_parent"
+              android:layout_height="wrap_content"
+              android:clipChildren="false"
+              android:clipToPadding="false"
+              android:layout_gravity="center_horizontal|bottom">
+
+              <!-- Animation res MUST be set in code -->
+              <com.airbnb.lottie.LottieAnimationView
+                  android:id="@+id/illustration_lottie"
+                  android:layout_width="match_parent"
+                  android:layout_height="200dp"
+                  android:layout_marginTop="@dimen/udfps_lottie_translate_y"
+                  android:scaleType="centerInside"
+                  android:visibility="gone"
+                  app:lottie_autoPlay="true"
+                  app:lottie_loop="true"
+                  android:clipChildren="false"
+                  android:clipToPadding="false"
+                  app:lottie_speed=".85" />
+          </FrameLayout>
+
+          <TextView
+              android:id="@+id/error_text"
+              style="@style/TextAppearance.ErrorText"
+              android:layout_width="wrap_content"
+              android:layout_height="wrap_content"
+              android:layout_gravity="center_horizontal|bottom"
+              android:accessibilityLiveRegion="polite"
+              android:gravity="center_horizontal"
+              android:visibility="invisible" />
+      </LinearLayout>
     </LinearLayout>
 
 </com.google.android.setupdesign.GlifLayout>
diff --git a/res/raw/udfps_edge_hint_lottie.json b/res/raw/udfps_edge_hint_lottie.json
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/res/raw/udfps_edge_hint_lottie.json
diff --git a/res/raw/udfps_tip_hint_lottie.json b/res/raw/udfps_tip_hint_lottie.json
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/res/raw/udfps_tip_hint_lottie.json
diff --git a/res/values/config.xml b/res/values/config.xml
index 56d3dca..ec239a2 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -197,11 +197,24 @@
     <!-- Whether or not to show the night light suggestion. -->
     <bool name="config_night_light_suggestion_enabled">true</bool>
 
-    <!-- Whether or not the device is capable of multiple levels of vibration intensity.
-         Note that this is different from whether it can control the vibration amplitude as some
-         devices will be able to vary their amplitude but do not possess enough dynamic range to
-         have distinct intensity levels -->
-    <bool name="config_vibration_supports_multiple_intensities">false</bool>
+    <!-- The number of vibration intensity levels supported by the device.
+
+         Note that this should correspond to the ability to vary the vibration amplitude, with
+         enough dynamic range to have at least as many distinct intensity levels as defined here.
+
+         Supported values are 1, 2, 3. If '1', the settings app will use a toggle for the settings,
+         otherwise a slider. If '3', the settings app maps intensities directly to the levels
+         supported by the Vibrator HAL APIs. If '2', then the levels will be mapped to
+         VIBRATION_INTENSITY_LOW and VIBRATION_INTENSITY_HIGH, which gives the most range for
+         scaling vibrations. The medium intensity will be skipped.
+
+         The default intensity values are configured at
+         frameworks/base/core/res/res/values/config.xml's config_default[type]VibrationIntensity.
+         Make sure that each default intensity value is consistent with the supported levels set
+         here. If this settings supports only 2 levels, for example, then the default intensity
+         should be either LOW (1) or HIGH (3).
+    -->
+    <integer name="config_vibration_supported_intensity_levels">1</integer>
 
     <!--
         Whether or not the homepage should be powered by legacy suggestion (versus contextual cards)
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 00372cb..c6059d1 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -212,6 +212,7 @@
          fingerprint_finish_max_size = fingerprint_progress_bar_max_size
                   + (fingerprint_enrolling_content_margin_vertical x 2) -->
     <dimen name="fingerprint_finish_max_size">288dp</dimen>
+    <dimen name="udfps_lottie_translate_y">0dp</dimen>
 
     <!-- Face -->
     <item name="face_preview_translate_y" format="float" type="dimen">0</item>
@@ -439,6 +440,13 @@
     <dimen name="chartview_trapezoid_margin_start">1dp</dimen>
     <dimen name="chartview_trapezoid_margin_bottom">2dp</dimen>
 
+    <!-- Dimensions for Dream settings cards -->
+    <dimen name="dream_item_min_column_width">230dp</dimen>
+    <dimen name="dream_item_corner_radius">@*android:dimen/config_dialogCornerRadius</dimen>
+    <dimen name="dream_preference_margin_horizontal">4dp</dimen>
+    <dimen name="dream_preference_margin_bottom">8dp</dimen>
+    <dimen name="dream_picker_padding">40dp</dimen>
+
     <!-- Sims/Data mobile/Calls/SMS select dialog-->
     <dimen name="sims_select_margin_bottom">24dp</dimen>
     <dimen name="sims_select_margin_top">8dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1eaa222..ec72321 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1113,6 +1113,10 @@
     <string name="security_settings_fingerprint_enroll_finish_message">Now you can use your fingerprint to unlock your phone or verify it\u2019s you, like when you sign in to apps</string>
     <!-- Button text to skip enrollment of fingerprint [CHAR LIMIT=40] -->
     <string name="security_settings_fingerprint_enroll_enrolling_skip">Do it later</string>
+    <!-- Accessibility message for fingerprint enrollment asking the user to place the tip of their finger on the fingerprint sensor [CHAR LIMIT=NONE] -->
+    <string name="security_settings_udfps_tip_fingerprint_help">Lift, then touch again</string>
+    <!-- Accessibility message for fingerprint enrollment asking the user to place the sides of their finger on the fingerprint sensor [CHAR LIMIT=NONE] -->
+    <string name="security_settings_udfps_side_fingerprint_help">Place the side of your fingerprint on the sensor and hold, then switch to the other side</string>
     <!-- Title of the dialog shown when the user tries to skip fingerprint setup, asking them to confirm the action [CHAR LIMIT=40] -->
     <string name="setup_fingerprint_enroll_enrolling_skip_title">Skip fingerprint setup?</string>
     <!-- Content of the dialog shown when the user tries to skip fingerprint setup, asking them to confirm the action [CHAR LIMIT=NONE] -->
@@ -3140,8 +3144,6 @@
     <string name="screensaver_settings_when_to_dream">When to start</string>
     <!-- Dream settings screen, action label, current selected screen saver -->
     <string name="screensaver_settings_current">Current screen saver</string>
-    <!-- Dream settings screen, button label to start dreaming [CHAR LIMIT=30] -->
-    <string name="screensaver_settings_dream_start">Start now</string>
     <!-- Dream settings screen, button label for settings for a specific screensaver -->
     <string name="screensaver_settings_button">Settings</string>
     <!-- Sound & display settings screen, setting option name to change whether the screen adjusts automatically based on lighting conditions -->
@@ -5461,6 +5463,12 @@
     <string name="accessibility_notification_alarm_vibration_category_title">Notifications and alarms</string>
     <!-- Title for the category of preferences to configure device vibrations triggered by user interaction with the device. [CHAR LIMIT=NONE] -->
     <string name="accessibility_interactive_haptics_category_title">Interactive haptics</string>
+    <!-- Title for primary switch preference for enabling device vibrations. [CHAR LIMIT=NONE] -->
+    <string name="accessibility_vibration_primary_switch_title">Use vibration &amp; haptics</string>
+    <!-- Title for preference for configuring alarm vibrations. [CHAR LIMIT=NONE] -->
+    <string name="accessibility_alarm_vibration_title">Alarm vibration</string>
+    <!-- Title for preference for configuring media vibrations (e.g. vibrations played together with animations, music, videos, etc). [CHAR LIMIT=NONE] -->
+    <string name="accessibility_media_vibration_title">Media vibration</string>
     <!-- Title for accessibility preference for configuring ring vibrations. [CHAR LIMIT=NONE] -->
     <string name="accessibility_ring_vibration_title">Ring vibration</string>
     <!-- Title for accessibility preference for configuring notification vibrations. -->
@@ -8247,6 +8255,8 @@
     <!-- List of synonyms for hotspot and tethering setting (where you share your wifi with other devices), used to match in settings search [CHAR LIMIT=NONE] -->
     <string name="keywords_hotspot_tethering">usb tether, bluetooth tether, wifi hotspot</string>
 
+    <!-- List of synonyms for device vibration primary setting, used to match in settings search [CHAR LIMIT=NONE] -->
+    <string name="keywords_accessibility_vibration_primary_switch">haptics, vibrate, vibration</string>
     <!-- List of synonyms for touch vibration setting (where you get a haptic response for touching things on the screen), used to match in settings search [CHAR LIMIT=NONE] -->
     <string name="keywords_touch_vibration">haptics, vibrate, screen, sensitivity</string>
     <!-- List of synonyms for ring vibration setting (changes whether your phone vibrates when it rings), used to match in settings search [CHAR LIMIT=NONE] -->
@@ -8254,7 +8264,11 @@
     <!-- List of synonyms for ring vibration setting (changes whether your phone vibrates when it rings), used to match in settings search [CHAR LIMIT=NONE] -->
     <string name="keywords_ramping_ringer_vibration">haptics, vibrate, phone, call, ring, gradually</string>
     <!-- List of synonyms for notification vibration setting (changes whether your phone vibrates when it shows a notification), used to match in settings search [CHAR LIMIT=NONE] -->
-    <string name="keywords_notification_vibration">haptics, vibrate, sensitivity</string>
+    <string name="keywords_notification_vibration">haptics, vibrate, sensitivity, notification</string>
+    <!-- List of synonyms for alarm vibration setting (changes whether your phone vibrates when an alarm goes off), used to match in settings search [CHAR LIMIT=NONE] -->
+    <string name="keywords_alarm_vibration">haptics, vibrate, sensitivity, alarm</string>
+    <!-- List of synonyms for media vibration setting (changes whether your phone vibrates as part of a music, animation, video, etc), used to match in settings search [CHAR LIMIT=NONE] -->
+    <string name="keywords_media_vibration">haptics, vibrate, sensitivity, media</string>
     <!-- List of synonyms for vibration and haptics setting, used to match in settings search [CHAR LIMIT=NONE] -->
     <string name="keywords_vibration">haptics, vibrate, vibration</string>
     <!-- Battery Saver: Search terms for sticky battery saver preference [CHAR_LIMIT=NONE] -->
@@ -13063,6 +13077,9 @@
 
     <!-- Title for the button to initiate a heap dump for the system server. [CHAR LIMIT=NONE] -->
     <string name="capture_system_heap_dump_title">Capture system heap dump</string>
+    <!-- Title for the button to reboot with MTE enabled. [CHAR LIMIT=NONE] -->
+    <string name="reboot_with_mte_title">Reboot with MTE</string>
+    <string name="reboot_with_mte_message">This wil reboot and allow to experiment with Memory Tagging Extensions (MTE). This may negatively impact system performance and stability. Will be reset on next subsequent reboot.</string>
     <!-- Toast that is shown when the user initiates capturing a heap dump for the system server. [CHAR LIMIT=NONE] -->
     <string name="capturing_system_heap_dump_message">Capturing system heap dump</string>
     <!-- Toast that is shown if there's an error capturing the user initiated heap dump. [CHAR LIMIT=NONE] -->
@@ -13760,4 +13777,8 @@
     </string-array>
     <!-- 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>
+    <!-- Button to customize the screensaver [CHAR LIMIT=20] -->
+    <string name="customize_button_title">Customize</string>
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 838d63b..58f6df4 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -730,6 +730,12 @@
         <item name="android:background">?android:attr/selectableItemBackground</item>
     </style>
 
+    <style name="AccessibilityTextReadingPreviewTitle"
+        parent="@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Title" >
+        <item name="android:layout_gravity">center_horizontal</item>
+        <item name="android:padding">6dp</item>
+    </style>
+
     <style name="Widget.PopupWindow.Settings"
            parent="@android:style/Widget.DeviceDefault.PopupWindow">
         <item name="android:clipToPadding">true</item>
@@ -936,4 +942,14 @@
     <style name="SimConfirmDialog.ButtonBarStyle" parent="@android:style/Widget.Material.ButtonBar">
         <item name="android:paddingEnd">8dp</item>
     </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>
+    </style>
 </resources>
diff --git a/res/xml/accessibility_vibration_intensity_settings.xml b/res/xml/accessibility_vibration_intensity_settings.xml
index d9a97f0..7b08fe0 100644
--- a/res/xml/accessibility_vibration_intensity_settings.xml
+++ b/res/xml/accessibility_vibration_intensity_settings.xml
@@ -19,6 +19,12 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:title="@string/accessibility_vibration_settings_title">
 
+    <com.android.settingslib.widget.MainSwitchPreference
+        android:key="vibration_main_switch"
+        android:title="@string/accessibility_vibration_primary_switch_title"
+        app:keywords="@string/keywords_accessibility_vibration_primary_switch"
+        app:controller="com.android.settings.accessibility.VibrationMainSwitchPreferenceController"/>
+
     <PreferenceCategory
         android:key="accessibility_call_vibration_category"
         android:title="@string/accessibility_call_vibration_category_title">
@@ -47,6 +53,12 @@
             app:keywords="@string/keywords_notification_vibration"
             app:controller="com.android.settings.accessibility.NotificationVibrationIntensityPreferenceController" />
 
+        <com.android.settings.widget.SeekBarPreference
+            android:key="alarm_vibration_preference_screen"
+            android:title="@string/accessibility_alarm_vibration_title"
+            app:keywords="@string/keywords_alarm_vibration"
+            app:controller="com.android.settings.accessibility.AlarmVibrationIntensityPreferenceController" />
+
     </PreferenceCategory>
 
     <PreferenceCategory
@@ -59,6 +71,12 @@
             app:keywords="@string/keywords_touch_vibration"
             app:controller="com.android.settings.accessibility.HapticFeedbackIntensityPreferenceController" />
 
+        <com.android.settings.widget.SeekBarPreference
+            android:key="media_vibration_preference_screen"
+            android:title="@string/accessibility_media_vibration_title"
+            app:keywords="@string/keywords_media_vibration"
+            app:controller="com.android.settings.accessibility.MediaVibrationIntensityPreferenceController" />
+
     </PreferenceCategory>
 
 </PreferenceScreen>
diff --git a/res/xml/accessibility_vibration_settings.xml b/res/xml/accessibility_vibration_settings.xml
index 18cd718..25be499 100644
--- a/res/xml/accessibility_vibration_settings.xml
+++ b/res/xml/accessibility_vibration_settings.xml
@@ -19,6 +19,12 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:title="@string/accessibility_vibration_settings_title">
 
+    <com.android.settingslib.widget.MainSwitchPreference
+        android:key="vibration_main_switch"
+        android:title="@string/accessibility_vibration_primary_switch_title"
+        app:keywords="@string/keywords_accessibility_vibration_primary_switch"
+        app:controller="com.android.settings.accessibility.VibrationMainSwitchPreferenceController"/>
+
     <PreferenceCategory
         android:key="accessibility_call_vibration_category"
         android:title="@string/accessibility_call_vibration_category_title">
@@ -47,6 +53,12 @@
             app:keywords="@string/keywords_notification_vibration"
             app:controller="com.android.settings.accessibility.NotificationVibrationTogglePreferenceController" />
 
+        <SwitchPreference
+            android:key="alarm_vibration_preference_screen"
+            android:title="@string/accessibility_alarm_vibration_title"
+            app:keywords="@string/keywords_alarm_vibration"
+            app:controller="com.android.settings.accessibility.AlarmVibrationTogglePreferenceController" />
+
     </PreferenceCategory>
 
     <PreferenceCategory
@@ -59,6 +71,12 @@
             app:keywords="@string/keywords_touch_vibration"
             app:controller="com.android.settings.accessibility.HapticFeedbackTogglePreferenceController" />
 
+        <SwitchPreference
+            android:key="media_vibration_preference_screen"
+            android:title="@string/accessibility_media_vibration_title"
+            app:keywords="@string/keywords_media_vibration"
+            app:controller="com.android.settings.accessibility.MediaVibrationTogglePreferenceController" />
+
     </PreferenceCategory>
 
 </PreferenceScreen>
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index 21ee30a..f29930c 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -45,6 +45,10 @@
             android:title="@string/capture_system_heap_dump_title" />
 
         <Preference
+            android:key="reboot_with_mte"
+            android:title="@string/reboot_with_mte_title" />
+
+        <Preference
             android:key="local_backup_password"
             android:title="@string/local_backup_password_title"
             android:summary="@string/local_backup_password_summary_none"
diff --git a/res/xml/dream_fragment_overview.xml b/res/xml/dream_fragment_overview.xml
index 42b0334..59da688 100644
--- a/res/xml/dream_fragment_overview.xml
+++ b/res/xml/dream_fragment_overview.xml
@@ -19,23 +19,15 @@
     xmlns:settings="http://schemas.android.com/apk/res-auto"
     android:title="@string/screensaver_settings_title">
 
-    <com.android.settings.widget.GearPreference
-        android:key="current_screensaver"
-        android:title="@string/screensaver_settings_current"
-        android:fragment="com.android.settings.dream.CurrentDreamPicker"
-        settings:controller="com.android.settings.dream.CurrentDreamPreferenceController" />
+    <com.android.settingslib.widget.LayoutPreference
+        android:key="dream_picker"
+        android:selectable="false"
+        android:layout="@layout/dream_picker_layout"
+        settings:controller="com.android.settings.dream.DreamPickerController"/>
 
     <Preference
         android:key="when_to_start"
         android:title="@string/screensaver_settings_when_to_dream"
-        android:fragment="com.android.settings.dream.WhenToDreamPicker" />
-
-    <PreferenceCategory>
-        <com.android.settingslib.widget.LayoutPreference
-            android:key="dream_start_now_button_container"
-            android:layout="@layout/dream_start_button"
-            android:selectable="false"
-            settings:controller="com.android.settings.dream.StartNowPreferenceController" />
-    </PreferenceCategory>
+        android:fragment="com.android.settings.dream.WhenToDreamPicker"/>
 
 </PreferenceScreen>
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 8e8c7e4..c08e669 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -30,7 +30,6 @@
 import android.content.pm.ServiceInfo;
 import android.graphics.Color;
 import android.graphics.drawable.Drawable;
-import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.UserHandle;
@@ -147,7 +146,7 @@
     };
 
     @VisibleForTesting
-    final SettingsContentObserver mSettingsContentObserver;
+    final AccessibilitySettingsContentObserver mSettingsContentObserver;
 
     private final Map<String, PreferenceCategory> mCategoryToPrefCategoryMap =
             new ArrayMap<>();
@@ -171,12 +170,9 @@
         // Observe changes from accessibility selection menu
         shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
         shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE);
-        mSettingsContentObserver = new SettingsContentObserver(mHandler, shortcutFeatureKeys) {
-            @Override
-            public void onChange(boolean selfChange, Uri uri) {
-                onContentChanged();
-            }
-        };
+        mSettingsContentObserver = new AccessibilitySettingsContentObserver(mHandler);
+        mSettingsContentObserver.registerKeysToObserverCallback(shortcutFeatureKeys,
+                key -> onContentChanged());
     }
 
     @Override
diff --git a/src/com/android/settings/accessibility/AccessibilitySettingsContentObserver.java b/src/com/android/settings/accessibility/AccessibilitySettingsContentObserver.java
new file mode 100644
index 0000000..d2ca754
--- /dev/null
+++ b/src/com/android/settings/accessibility/AccessibilitySettingsContentObserver.java
@@ -0,0 +1,132 @@
+/*
+ * 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.accessibility;
+
+import android.content.ContentResolver;
+import android.database.ContentObserver;
+import android.net.Uri;
+import android.os.Handler;
+import android.provider.Settings;
+import android.util.Log;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+class AccessibilitySettingsContentObserver extends ContentObserver {
+
+    private static final String TAG = "AccessibilitySettingsContentObserver";
+
+    public interface ContentObserverCallback {
+        void onChange(String key);
+    }
+
+    // Key: Preference key's uri, Value: Preference key
+    private final Map<Uri, String> mUriToKey = new HashMap<>(2);
+
+    // Key: Collection of preference keys, Value: onChange callback for keys
+    private final Map<List<String>, ContentObserverCallback> mUrisToCallback = new HashMap<>();
+
+    AccessibilitySettingsContentObserver(Handler handler) {
+        super(handler);
+
+        // default key to be observed
+        addDefaultKeysToMap();
+    }
+
+    public void register(ContentResolver contentResolver) {
+        for (Uri uri : mUriToKey.keySet()) {
+            contentResolver.registerContentObserver(uri, false, this);
+        }
+    }
+
+    public void unregister(ContentResolver contentResolver) {
+        contentResolver.unregisterContentObserver(this);
+    }
+
+    private void addDefaultKeysToMap() {
+        addKeyToMap(Settings.Secure.ACCESSIBILITY_ENABLED);
+        addKeyToMap(Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
+    }
+
+    private boolean isDefaultKey(String key) {
+        return Settings.Secure.ACCESSIBILITY_ENABLED.equals(key)
+                || Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES.equals(key);
+    }
+
+    private void addKeyToMap(String key) {
+        mUriToKey.put(Settings.Secure.getUriFor(key), key);
+    }
+
+    /**
+     * {@link ContentObserverCallback} is added to {@link ContentObserver} to handle the
+     * onChange event triggered by the key collection of {@code keysToObserve} and the default
+     * keys.
+     *
+     * Note: The following key are default to be observed.
+     *      {@link Settings.Secure.ACCESSIBILITY_ENABLED}
+     *      {@link Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES}
+     *
+     * @param keysToObserve A collection of keys which are going to be observed.
+     * @param observerCallback A callback which is used to handle the onChange event triggered
+     *                         by the key collection of {@code keysToObserve}.
+     */
+    public void registerKeysToObserverCallback(List<String> keysToObserve,
+            ContentObserverCallback observerCallback) {
+
+        for (String key: keysToObserve) {
+            addKeyToMap(key);
+        }
+
+        mUrisToCallback.put(keysToObserve, observerCallback);
+    }
+
+    /**
+     * {@link ContentObserverCallback} is added to {@link ContentObserver} to handle the
+     * onChange event triggered by the default keys.
+     *
+     * Note: The following key are default to be observed.
+     *      {@link Settings.Secure.ACCESSIBILITY_ENABLED}
+     *      {@link Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES}
+     *
+     * @param observerCallback A callback which is used to handle the onChange event triggered
+     *      *                         by the key collection of {@code keysToObserve}.
+     */
+    public void registerObserverCallback(ContentObserverCallback observerCallback) {
+        mUrisToCallback.put(Collections.emptyList(), observerCallback);
+    }
+
+    @Override
+    public final void onChange(boolean selfChange, Uri uri) {
+
+        final String key = mUriToKey.get(uri);
+
+        if (key == null) {
+            Log.w(TAG, "AccessibilitySettingsContentObserver can not find the key for "
+                    + "uri: " + uri);
+            return;
+        }
+
+        for (List<String> keys : mUrisToCallback.keySet()) {
+            final boolean isDefaultKey = isDefaultKey(key);
+            if (isDefaultKey || keys.contains(key)) {
+                mUrisToCallback.get(keys).onChange(key);
+            }
+        }
+    }
+}
diff --git a/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java b/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java
index 22f037b..115f44f 100644
--- a/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java
@@ -25,7 +25,6 @@
 import android.content.Context;
 import android.content.DialogInterface;
 import android.icu.text.CaseMap;
-import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
 import android.provider.Settings;
@@ -64,7 +63,7 @@
     protected ShortcutPreference mShortcutPreference;
     private AccessibilityManager.TouchExplorationStateChangeListener
             mTouchExplorationStateChangeListener;
-    private SettingsContentObserver mSettingsContentObserver;
+    private AccessibilitySettingsContentObserver mSettingsContentObserver;
     private CheckBox mSoftwareTypeCheckBox;
     private CheckBox mHardwareTypeCheckBox;
 
@@ -98,13 +97,11 @@
         final List<String> shortcutFeatureKeys = new ArrayList<>();
         shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
         shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE);
-        mSettingsContentObserver = new SettingsContentObserver(new Handler(), shortcutFeatureKeys) {
-            @Override
-            public void onChange(boolean selfChange, Uri uri) {
-                updateShortcutPreferenceData();
-                updateShortcutPreference();
-            }
-        };
+        mSettingsContentObserver = new AccessibilitySettingsContentObserver(new Handler());
+        mSettingsContentObserver.registerKeysToObserverCallback(shortcutFeatureKeys, key -> {
+            updateShortcutPreferenceData();
+            updateShortcutPreference();
+        });
     }
 
     @Override
diff --git a/src/com/android/settings/accessibility/AlarmVibrationIntensityPreferenceController.java b/src/com/android/settings/accessibility/AlarmVibrationIntensityPreferenceController.java
new file mode 100644
index 0000000..9e60f21
--- /dev/null
+++ b/src/com/android/settings/accessibility/AlarmVibrationIntensityPreferenceController.java
@@ -0,0 +1,50 @@
+/*
+ * 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.accessibility;
+
+import android.content.Context;
+import android.os.VibrationAttributes;
+import android.provider.Settings;
+
+/** Preference controller for alarm vibration intensity */
+public class AlarmVibrationIntensityPreferenceController
+        extends VibrationIntensityPreferenceController {
+
+    /** General configuration for alarm vibration intensity settings. */
+    public static final class AlarmVibrationPreferenceConfig extends VibrationPreferenceConfig {
+
+        public AlarmVibrationPreferenceConfig(Context context) {
+            super(context, Settings.System.ALARM_VIBRATION_INTENSITY,
+                    VibrationAttributes.USAGE_ALARM);
+        }
+    }
+
+    public AlarmVibrationIntensityPreferenceController(Context context, String preferenceKey) {
+        super(context, preferenceKey, new AlarmVibrationPreferenceConfig(context));
+    }
+
+    protected AlarmVibrationIntensityPreferenceController(Context context, String preferenceKey,
+            int supportedIntensityLevels) {
+        super(context, preferenceKey, new AlarmVibrationPreferenceConfig(context),
+                supportedIntensityLevels);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return AVAILABLE;
+    }
+}
diff --git a/src/com/android/settings/accessibility/AlarmVibrationTogglePreferenceController.java b/src/com/android/settings/accessibility/AlarmVibrationTogglePreferenceController.java
new file mode 100644
index 0000000..63281dd
--- /dev/null
+++ b/src/com/android/settings/accessibility/AlarmVibrationTogglePreferenceController.java
@@ -0,0 +1,34 @@
+/*
+ * 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.accessibility;
+
+import android.content.Context;
+
+import com.android.settings.accessibility.AlarmVibrationIntensityPreferenceController.AlarmVibrationPreferenceConfig;
+
+/** Preference controller for alarm vibration with only a toggle for on/off states. */
+public class AlarmVibrationTogglePreferenceController extends VibrationTogglePreferenceController {
+
+    public AlarmVibrationTogglePreferenceController(Context context, String preferenceKey) {
+        super(context, preferenceKey, new AlarmVibrationPreferenceConfig(context));
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return AVAILABLE;
+    }
+}
diff --git a/src/com/android/settings/accessibility/HapticFeedbackIntensityPreferenceController.java b/src/com/android/settings/accessibility/HapticFeedbackIntensityPreferenceController.java
index 99d2bf5..98fd5f2 100644
--- a/src/com/android/settings/accessibility/HapticFeedbackIntensityPreferenceController.java
+++ b/src/com/android/settings/accessibility/HapticFeedbackIntensityPreferenceController.java
@@ -74,6 +74,12 @@
         super(context, preferenceKey, new HapticFeedbackVibrationPreferenceConfig(context));
     }
 
+    protected HapticFeedbackIntensityPreferenceController(Context context, String preferenceKey,
+            int supportedIntensityLevels) {
+        super(context, preferenceKey, new HapticFeedbackVibrationPreferenceConfig(context),
+                supportedIntensityLevels);
+    }
+
     @Override
     public int getAvailabilityStatus() {
         return AVAILABLE;
diff --git a/src/com/android/settings/accessibility/MagnificationFollowTypingPreferenceController.java b/src/com/android/settings/accessibility/MagnificationFollowTypingPreferenceController.java
index 8757fdf..a758276 100644
--- a/src/com/android/settings/accessibility/MagnificationFollowTypingPreferenceController.java
+++ b/src/com/android/settings/accessibility/MagnificationFollowTypingPreferenceController.java
@@ -35,6 +35,8 @@
 public class MagnificationFollowTypingPreferenceController extends TogglePreferenceController
         implements LifecycleObserver {
 
+    private static final String TAG =
+            MagnificationFollowTypingPreferenceController.class.getSimpleName();
     static final String PREF_KEY = "magnification_follow_typing";
 
     private SwitchPreference mFollowTypingPreference;
@@ -75,6 +77,14 @@
     // TODO(b/186731461): Remove it when this controller is used in DashBoardFragment only.
     @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
     void onResume() {
+        updateState();
+    }
+
+    /**
+     * Updates the state of preference components which has been displayed by
+     * {@link MagnificationFollowTypingPreferenceController#displayPreference}.
+     */
+    void updateState() {
         updateState(mFollowTypingPreference);
     }
 }
diff --git a/src/com/android/settings/accessibility/MediaVibrationIntensityPreferenceController.java b/src/com/android/settings/accessibility/MediaVibrationIntensityPreferenceController.java
new file mode 100644
index 0000000..0678e58
--- /dev/null
+++ b/src/com/android/settings/accessibility/MediaVibrationIntensityPreferenceController.java
@@ -0,0 +1,51 @@
+/*
+ * 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.accessibility;
+
+import android.content.Context;
+import android.os.VibrationAttributes;
+import android.provider.Settings;
+
+/** Preference controller for am vibration intensity */
+public class MediaVibrationIntensityPreferenceController
+        extends VibrationIntensityPreferenceController {
+
+    /** General configuration for alarm vibration intensity settings. */
+    public static final class MediaVibrationPreferenceConfig extends VibrationPreferenceConfig {
+
+        public MediaVibrationPreferenceConfig(Context context) {
+            super(context, Settings.System.MEDIA_VIBRATION_INTENSITY,
+                    VibrationAttributes.USAGE_MEDIA);
+        }
+    }
+
+    public MediaVibrationIntensityPreferenceController(Context context,
+            String preferenceKey) {
+        super(context, preferenceKey, new MediaVibrationPreferenceConfig(context));
+    }
+
+    protected MediaVibrationIntensityPreferenceController(Context context, String preferenceKey,
+            int supportedIntensityLevels) {
+        super(context, preferenceKey, new MediaVibrationPreferenceConfig(context),
+                supportedIntensityLevels);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return AVAILABLE;
+    }
+}
diff --git a/src/com/android/settings/accessibility/MediaVibrationTogglePreferenceController.java b/src/com/android/settings/accessibility/MediaVibrationTogglePreferenceController.java
new file mode 100644
index 0000000..f7b0e39
--- /dev/null
+++ b/src/com/android/settings/accessibility/MediaVibrationTogglePreferenceController.java
@@ -0,0 +1,34 @@
+/*
+ * 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.accessibility;
+
+import android.content.Context;
+
+import com.android.settings.accessibility.MediaVibrationIntensityPreferenceController.MediaVibrationPreferenceConfig;
+
+/** Preference controller for alarm vibration with only a toggle for on/off states. */
+public class MediaVibrationTogglePreferenceController extends VibrationTogglePreferenceController {
+
+    public MediaVibrationTogglePreferenceController(Context context, String preferenceKey) {
+        super(context, preferenceKey, new MediaVibrationPreferenceConfig(context));
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return AVAILABLE;
+    }
+}
diff --git a/src/com/android/settings/accessibility/NotificationVibrationIntensityPreferenceController.java b/src/com/android/settings/accessibility/NotificationVibrationIntensityPreferenceController.java
index 31ae187..cee45f6 100644
--- a/src/com/android/settings/accessibility/NotificationVibrationIntensityPreferenceController.java
+++ b/src/com/android/settings/accessibility/NotificationVibrationIntensityPreferenceController.java
@@ -39,6 +39,12 @@
         super(context, preferenceKey, new NotificationVibrationPreferenceConfig(context));
     }
 
+    protected NotificationVibrationIntensityPreferenceController(Context context,
+            String preferenceKey, int supportedIntensityLevels) {
+        super(context, preferenceKey, new NotificationVibrationPreferenceConfig(context),
+                supportedIntensityLevels);
+    }
+
     @Override
     public int getAvailabilityStatus() {
         return AVAILABLE;
diff --git a/src/com/android/settings/accessibility/RingVibrationIntensityPreferenceController.java b/src/com/android/settings/accessibility/RingVibrationIntensityPreferenceController.java
index 1ddcf2b..e79ad8b 100644
--- a/src/com/android/settings/accessibility/RingVibrationIntensityPreferenceController.java
+++ b/src/com/android/settings/accessibility/RingVibrationIntensityPreferenceController.java
@@ -16,61 +16,22 @@
 
 package com.android.settings.accessibility;
 
-import static com.android.settings.accessibility.AccessibilityUtil.State.OFF;
-import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
-
 import android.content.Context;
-import android.media.AudioManager;
-import android.os.VibrationAttributes;
-import android.os.Vibrator;
-import android.provider.Settings;
 
 /** Preference controller for ringtone vibration intensity */
 public class RingVibrationIntensityPreferenceController
         extends VibrationIntensityPreferenceController {
 
-    /** General configuration for ringtone vibration intensity settings. */
-    public static final class RingVibrationPreferenceConfig extends VibrationPreferenceConfig {
-        private final AudioManager mAudioManager;
-
-        public RingVibrationPreferenceConfig(Context context) {
-            super(context, Settings.System.RING_VIBRATION_INTENSITY,
-                    VibrationAttributes.USAGE_RINGTONE);
-            mAudioManager = context.getSystemService(AudioManager.class);
-        }
-
-        @Override
-        public int readIntensity() {
-            final int vibrateWhenRinging = Settings.System.getInt(mContentResolver,
-                    Settings.System.VIBRATE_WHEN_RINGING, ON);
-
-            if ((vibrateWhenRinging == OFF)
-                    && !mAudioManager.isRampingRingerEnabled()) {
-                // VIBRATE_WHEN_RINGING is deprecated but should still be applied if the user has
-                // turned it off and has not enabled the ramping ringer (old three-state setting).
-                return Vibrator.VIBRATION_INTENSITY_OFF;
-            }
-
-            return super.readIntensity();
-        }
-
-        @Override
-        public boolean updateIntensity(int intensity) {
-            final boolean success = super.updateIntensity(intensity);
-
-            // VIBRATE_WHEN_RINGING is deprecated but should still reflect the intensity setting.
-            // Ramping ringer is independent of the ring intensity and should not be affected.
-            Settings.System.putInt(mContentResolver, Settings.System.VIBRATE_WHEN_RINGING,
-                    (intensity == Vibrator.VIBRATION_INTENSITY_OFF) ? OFF : ON);
-
-            return success;
-        }
-    }
-
     public RingVibrationIntensityPreferenceController(Context context, String preferenceKey) {
         super(context, preferenceKey, new RingVibrationPreferenceConfig(context));
     }
 
+    protected RingVibrationIntensityPreferenceController(Context context, String preferenceKey,
+            int supportedIntensityLevels) {
+        super(context, preferenceKey, new RingVibrationPreferenceConfig(context),
+                supportedIntensityLevels);
+    }
+
     @Override
     public int getAvailabilityStatus() {
         return AVAILABLE;
diff --git a/src/com/android/settings/accessibility/RingVibrationPreferenceConfig.java b/src/com/android/settings/accessibility/RingVibrationPreferenceConfig.java
new file mode 100644
index 0000000..da446d7
--- /dev/null
+++ b/src/com/android/settings/accessibility/RingVibrationPreferenceConfig.java
@@ -0,0 +1,64 @@
+/*
+ * 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.accessibility;
+
+import static com.android.settings.accessibility.AccessibilityUtil.State.OFF;
+import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
+
+import android.content.Context;
+import android.media.AudioManager;
+import android.os.VibrationAttributes;
+import android.os.Vibrator;
+import android.provider.Settings;
+
+/** General configuration for ringtone vibration intensity settings. */
+public class RingVibrationPreferenceConfig extends VibrationPreferenceConfig {
+    private final AudioManager mAudioManager;
+
+    public RingVibrationPreferenceConfig(Context context) {
+        super(context, Settings.System.RING_VIBRATION_INTENSITY,
+                VibrationAttributes.USAGE_RINGTONE);
+        mAudioManager = context.getSystemService(AudioManager.class);
+    }
+
+    @Override
+    public int readIntensity() {
+        final int vibrateWhenRinging = Settings.System.getInt(mContentResolver,
+                Settings.System.VIBRATE_WHEN_RINGING, ON);
+
+        if ((vibrateWhenRinging == OFF)
+                && !mAudioManager.isRampingRingerEnabled()) {
+            // VIBRATE_WHEN_RINGING is deprecated but should still be applied if the user has
+            // turned it off and has not enabled the ramping ringer (old three-state setting).
+            return Vibrator.VIBRATION_INTENSITY_OFF;
+        }
+
+        return super.readIntensity();
+    }
+
+    @Override
+    public boolean updateIntensity(int intensity) {
+        final boolean success = super.updateIntensity(intensity);
+
+        // VIBRATE_WHEN_RINGING is deprecated but should still reflect the intensity setting.
+        // Ramping ringer is independent of the ring intensity and should not be affected.
+        Settings.System.putInt(mContentResolver, Settings.System.VIBRATE_WHEN_RINGING,
+                (intensity == Vibrator.VIBRATION_INTENSITY_OFF) ? OFF : ON);
+
+        return success;
+    }
+}
diff --git a/src/com/android/settings/accessibility/RingVibrationTogglePreferenceController.java b/src/com/android/settings/accessibility/RingVibrationTogglePreferenceController.java
index e68b6ce..efad946 100644
--- a/src/com/android/settings/accessibility/RingVibrationTogglePreferenceController.java
+++ b/src/com/android/settings/accessibility/RingVibrationTogglePreferenceController.java
@@ -18,8 +18,6 @@
 
 import android.content.Context;
 
-import com.android.settings.accessibility.RingVibrationIntensityPreferenceController.RingVibrationPreferenceConfig;
-
 /** Preference controller for ringtone vibration with only a toggle for on/off states. */
 public class RingVibrationTogglePreferenceController extends VibrationTogglePreferenceController {
 
diff --git a/src/com/android/settings/accessibility/SettingsContentObserver.java b/src/com/android/settings/accessibility/SettingsContentObserver.java
deleted file mode 100644
index de67f6c..0000000
--- a/src/com/android/settings/accessibility/SettingsContentObserver.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2013 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.accessibility;
-
-import android.content.ContentResolver;
-import android.database.ContentObserver;
-import android.net.Uri;
-import android.os.Handler;
-import android.provider.Settings;
-
-import java.util.ArrayList;
-import java.util.List;
-
-abstract class SettingsContentObserver extends ContentObserver {
-    private final List<String> mKeysToObserve = new ArrayList<>(2);
-
-    public SettingsContentObserver(Handler handler) {
-        super(handler);
-        mKeysToObserve.add(Settings.Secure.ACCESSIBILITY_ENABLED);
-        mKeysToObserve.add(Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
-    }
-
-    public SettingsContentObserver(Handler handler, List<String> keysToObserve) {
-        this(handler);
-        mKeysToObserve.addAll(keysToObserve);
-    }
-
-    public void register(ContentResolver contentResolver) {
-        for (int i = 0; i < mKeysToObserve.size(); i++) {
-            contentResolver.registerContentObserver(
-                    Settings.Secure.getUriFor(mKeysToObserve.get(i)), false, this);
-        }
-    }
-
-    public void unregister(ContentResolver contentResolver) {
-        contentResolver.unregisterContentObserver(this);
-    }
-
-    @Override
-    public abstract void onChange(boolean selfChange, Uri uri);
-}
diff --git a/src/com/android/settings/accessibility/TextReadingPreviewPreference.java b/src/com/android/settings/accessibility/TextReadingPreviewPreference.java
new file mode 100644
index 0000000..1b9cc4b
--- /dev/null
+++ b/src/com/android/settings/accessibility/TextReadingPreviewPreference.java
@@ -0,0 +1,123 @@
+/*
+ * 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.accessibility;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceViewHolder;
+import androidx.viewpager.widget.ViewPager;
+
+import com.android.internal.util.Preconditions;
+import com.android.settings.R;
+import com.android.settings.display.PreviewPagerAdapter;
+import com.android.settings.widget.DotsPageIndicator;
+
+/**
+ * A {@link Preference} that could show the preview related to the text and reading options.
+ */
+final class TextReadingPreviewPreference extends Preference {
+    private int mCurrentItem;
+    private PreviewPagerAdapter mPreviewAdapter;
+
+    TextReadingPreviewPreference(Context context) {
+        super(context);
+        init();
+    }
+
+    TextReadingPreviewPreference(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        init();
+    }
+
+    TextReadingPreviewPreference(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+        init();
+    }
+
+    TextReadingPreviewPreference(Context context, AttributeSet attrs, int defStyleAttr,
+            int defStyleRes) {
+        super(context, attrs, defStyleAttr, defStyleRes);
+        init();
+    }
+
+    @Override
+    public void onBindViewHolder(PreferenceViewHolder holder) {
+        super.onBindViewHolder(holder);
+
+        final ViewPager viewPager = (ViewPager) holder.findViewById(R.id.preview_pager);
+        final DotsPageIndicator pageIndicator =
+                (DotsPageIndicator) holder.findViewById(R.id.page_indicator);
+        updateAdapterIfNeeded(viewPager, pageIndicator, mPreviewAdapter);
+        updatePagerAndIndicator(viewPager, pageIndicator);
+    }
+
+    void setPreviewAdapter(PreviewPagerAdapter previewAdapter) {
+        if (previewAdapter != mPreviewAdapter) {
+            mPreviewAdapter = previewAdapter;
+            notifyChanged();
+        }
+    }
+
+    void setCurrentItem(int currentItem) {
+        Preconditions.checkNotNull(mPreviewAdapter,
+                "Preview adapter is null, you should init the preview adapter first");
+
+        if (currentItem != mCurrentItem) {
+            mCurrentItem = currentItem;
+            notifyChanged();
+        }
+    }
+
+    int getCurrentItem() {
+        return mCurrentItem;
+    }
+
+    private void updateAdapterIfNeeded(ViewPager viewPager, DotsPageIndicator pageIndicator,
+            PreviewPagerAdapter previewAdapter) {
+        if (viewPager.getAdapter() == previewAdapter) {
+            return;
+        }
+
+        viewPager.setAdapter(previewAdapter);
+
+        if (previewAdapter != null) {
+            pageIndicator.setViewPager(viewPager);
+        } else {
+            mCurrentItem = 0;
+        }
+    }
+
+    private void updatePagerAndIndicator(ViewPager viewPager, DotsPageIndicator pageIndicator) {
+        if (viewPager.getAdapter() == null) {
+            return;
+        }
+
+        if (viewPager.getCurrentItem() != mCurrentItem) {
+            viewPager.setCurrentItem(mCurrentItem);
+        }
+
+        pageIndicator.setVisibility(
+                viewPager.getAdapter().getCount() > 1 ? View.VISIBLE : View.GONE);
+    }
+
+    private void init() {
+        setLayoutResource(R.layout.accessibility_text_reading_preview);
+    }
+}
diff --git a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
index 04b5347..0632d3f 100644
--- a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
@@ -35,7 +35,6 @@
 import android.content.pm.ServiceInfo;
 import android.net.Uri;
 import android.os.Bundle;
-import android.os.Handler;
 import android.os.SystemClock;
 import android.text.TextUtils;
 import android.util.Log;
@@ -65,15 +64,7 @@
 
     private static final String EMPTY_STRING = "";
 
-    private final SettingsContentObserver mSettingsContentObserver =
-            new SettingsContentObserver(new Handler()) {
-                @Override
-                public void onChange(boolean selfChange, Uri uri) {
-                    updateSwitchBarToggleSwitch();
-                }
-            };
-
-    private Dialog mDialog;
+    private Dialog mWarningDialog;
     private BroadcastReceiver mPackageRemovedReceiver;
     private boolean mDisabledStateLogged = false;
     private long mStartTimeMillsForLogging = 0;
@@ -109,6 +100,13 @@
     }
 
     @Override
+    protected void registerKeysToObserverCallback(
+            AccessibilitySettingsContentObserver contentObserver) {
+        super.registerKeysToObserverCallback(contentObserver);
+        contentObserver.registerObserverCallback(key -> updateSwitchBarToggleSwitch());
+    }
+
+    @Override
     public void onStart() {
         super.onStart();
         final AccessibilityServiceInfo serviceInfo = getAccessibilityServiceInfo();
@@ -123,7 +121,11 @@
     public void onResume() {
         super.onResume();
         updateSwitchBarToggleSwitch();
-        mSettingsContentObserver.register(getContentResolver());
+    }
+
+    @Override
+    public void onPause() {
+        super.onPause();
     }
 
     @Override
@@ -172,7 +174,7 @@
                 if (info == null) {
                     return null;
                 }
-                mDialog = AccessibilityServiceWarning
+                mWarningDialog = AccessibilityServiceWarning
                         .createCapabilitiesDialog(getPrefContext(), info,
                                 this::onDialogButtonFromEnableToggleClicked,
                                 this::onDialogButtonFromUninstallClicked);
@@ -183,7 +185,7 @@
                 if (info == null) {
                     return null;
                 }
-                mDialog = AccessibilityServiceWarning
+                mWarningDialog = AccessibilityServiceWarning
                         .createCapabilitiesDialog(getPrefContext(), info,
                                 this::onDialogButtonFromShortcutToggleClicked,
                                 this::onDialogButtonFromUninstallClicked);
@@ -194,7 +196,7 @@
                 if (info == null) {
                     return null;
                 }
-                mDialog = AccessibilityServiceWarning
+                mWarningDialog = AccessibilityServiceWarning
                         .createCapabilitiesDialog(getPrefContext(), info,
                                 this::onDialogButtonFromShortcutClicked,
                                 this::onDialogButtonFromUninstallClicked);
@@ -205,16 +207,16 @@
                 if (info == null) {
                     return null;
                 }
-                mDialog = AccessibilityServiceWarning
+                mWarningDialog = AccessibilityServiceWarning
                         .createDisableDialog(getPrefContext(), info,
                                 this::onDialogButtonFromDisableToggleClicked);
                 break;
             }
             default: {
-                mDialog = super.onCreateDialog(dialogId);
+                mWarningDialog = super.onCreateDialog(dialogId);
             }
         }
-        return mDialog;
+        return mWarningDialog;
     }
 
     @Override
@@ -402,7 +404,7 @@
     }
 
     private void onDialogButtonFromUninstallClicked() {
-        mDialog.dismiss();
+        mWarningDialog.dismiss();
         final Intent uninstallIntent = createUninstallPackageActivityIntent();
         if (uninstallIntent == null) {
             return;
@@ -436,12 +438,12 @@
             mIsDialogShown.set(false);
             showPopupDialog(DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL);
         }
-        mDialog.dismiss();
+        mWarningDialog.dismiss();
     }
 
     private void onDenyButtonFromEnableToggleClicked() {
         handleConfirmServiceEnabled(/* confirmed= */ false);
-        mDialog.dismiss();
+        mWarningDialog.dismiss();
     }
 
     void onDialogButtonFromShortcutToggleClicked(View view) {
@@ -465,7 +467,7 @@
         mIsDialogShown.set(false);
         showPopupDialog(DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL);
 
-        mDialog.dismiss();
+        mWarningDialog.dismiss();
 
         mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
     }
@@ -473,7 +475,7 @@
     private void onDenyButtonFromShortcutToggleClicked() {
         mShortcutPreference.setChecked(false);
 
-        mDialog.dismiss();
+        mWarningDialog.dismiss();
     }
 
     void onDialogButtonFromShortcutClicked(View view) {
@@ -491,11 +493,11 @@
         mIsDialogShown.set(false);
         showPopupDialog(DialogEnums.EDIT_SHORTCUT);
 
-        mDialog.dismiss();
+        mWarningDialog.dismiss();
     }
 
     private void onDenyButtonFromShortcutClicked() {
-        mDialog.dismiss();
+        mWarningDialog.dismiss();
     }
 
     private boolean onPreferenceClick(boolean isChecked) {
diff --git a/src/com/android/settings/accessibility/ToggleColorInversionPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleColorInversionPreferenceFragment.java
index 419514f..e65c9c5 100644
--- a/src/com/android/settings/accessibility/ToggleColorInversionPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleColorInversionPreferenceFragment.java
@@ -25,7 +25,6 @@
 import android.content.ContentResolver;
 import android.net.Uri;
 import android.os.Bundle;
-import android.os.Handler;
 import android.provider.Settings;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -41,8 +40,6 @@
 public class ToggleColorInversionPreferenceFragment extends ToggleFeaturePreferenceFragment {
 
     private static final String ENABLED = Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED;
-    private final Handler mHandler = new Handler();
-    private SettingsContentObserver mSettingsContentObserver;
 
     @Override
     public int getMetricsCategory() {
@@ -86,20 +83,22 @@
                 .authority(getPrefContext().getPackageName())
                 .appendPath(String.valueOf(R.raw.accessibility_color_inversion_banner))
                 .build();
-        final List<String> enableServiceFeatureKeys = new ArrayList<>(/* initialCapacity= */ 1);
-        enableServiceFeatureKeys.add(ENABLED);
-        mSettingsContentObserver = new SettingsContentObserver(mHandler, enableServiceFeatureKeys) {
-            @Override
-            public void onChange(boolean selfChange, Uri uri) {
-                updateSwitchBarToggleSwitch();
-            }
-        };
-
         final View view = super.onCreateView(inflater, container, savedInstanceState);
         updateFooterPreference();
         return view;
     }
 
+    @Override
+    protected void registerKeysToObserverCallback(
+            AccessibilitySettingsContentObserver contentObserver) {
+        super.registerKeysToObserverCallback(contentObserver);
+
+        final List<String> enableServiceFeatureKeys = new ArrayList<>(/* initialCapacity= */ 1);
+        enableServiceFeatureKeys.add(ENABLED);
+        contentObserver.registerKeysToObserverCallback(enableServiceFeatureKeys,
+                key -> updateSwitchBarToggleSwitch());
+    }
+
     private void updateFooterPreference() {
         final String title = getPrefContext().getString(
                 R.string.accessibility_color_inversion_about_title);
@@ -114,12 +113,10 @@
     public void onResume() {
         super.onResume();
         updateSwitchBarToggleSwitch();
-        mSettingsContentObserver.register(getContentResolver());
     }
 
     @Override
     public void onPause() {
-        mSettingsContentObserver.unregister(getContentResolver());
         super.onPause();
     }
 
diff --git a/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
index c9449d24..f0a4f0a 100644
--- a/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragment.java
@@ -24,9 +24,7 @@
 import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.content.res.Resources;
-import android.net.Uri;
 import android.os.Bundle;
-import android.os.Handler;
 import android.provider.Settings;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -53,8 +51,6 @@
     private static final String KEY_PREVIEW = "daltonizer_preview";
     private static final String KEY_CATEGORY_MODE = "daltonizer_mode_category";
     private static final List<AbstractPreferenceController> sControllers = new ArrayList<>();
-    private final Handler mHandler = new Handler();
-    private SettingsContentObserver mSettingsContentObserver;
 
     private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
             Lifecycle lifecycle) {
@@ -84,20 +80,22 @@
         mComponentName = DALTONIZER_COMPONENT_NAME;
         mPackageName = getText(R.string.accessibility_display_daltonizer_preference_title);
         mHtmlDescription = getText(R.string.accessibility_display_daltonizer_preference_subtitle);
-        final List<String> enableServiceFeatureKeys = new ArrayList<>(/* initialCapacity= */ 1);
-        enableServiceFeatureKeys.add(ENABLED);
-        mSettingsContentObserver = new SettingsContentObserver(mHandler, enableServiceFeatureKeys) {
-            @Override
-            public void onChange(boolean selfChange, Uri uri) {
-                updateSwitchBarToggleSwitch();
-            }
-        };
-
         final View view = super.onCreateView(inflater, container, savedInstanceState);
         updateFooterPreference();
         return view;
     }
 
+    @Override
+    protected void registerKeysToObserverCallback(
+            AccessibilitySettingsContentObserver contentObserver) {
+        super.registerKeysToObserverCallback(contentObserver);
+
+        final List<String> enableServiceFeatureKeys = new ArrayList<>(/* initialCapacity= */ 1);
+        enableServiceFeatureKeys.add(ENABLED);
+        contentObserver.registerKeysToObserverCallback(enableServiceFeatureKeys,
+                key -> updateSwitchBarToggleSwitch());
+    }
+
     private void updateFooterPreference() {
         final String title = getPrefContext()
                 .getString(R.string.accessibility_daltonizer_about_title);
@@ -123,8 +121,6 @@
     public void onResume() {
         super.onResume();
         updateSwitchBarToggleSwitch();
-        mSettingsContentObserver.register(getContentResolver());
-
         for (AbstractPreferenceController controller :
                 buildPreferenceControllers(getPrefContext(), getSettingsLifecycle())) {
             ((DaltonizerRadioButtonPreferenceController) controller).setOnChangeListener(this);
@@ -135,7 +131,6 @@
 
     @Override
     public void onPause() {
-        mSettingsContentObserver.unregister(getContentResolver());
         for (AbstractPreferenceController controller :
                 buildPreferenceControllers(getPrefContext(), getSettingsLifecycle())) {
             ((DaltonizerRadioButtonPreferenceController) controller).setOnChangeListener(null);
diff --git a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
index 233b7ee..cba5d83 100644
--- a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
@@ -99,7 +99,7 @@
     protected static final String KEY_ANIMATED_IMAGE = "animated_image";
 
     private TouchExplorationStateChangeListener mTouchExplorationStateChangeListener;
-    private SettingsContentObserver mSettingsContentObserver;
+    private AccessibilitySettingsContentObserver mSettingsContentObserver;
 
     private CheckBox mSoftwareTypeCheckBox;
     private CheckBox mHardwareTypeCheckBox;
@@ -143,17 +143,21 @@
             setPreferenceScreen(preferenceScreen);
         }
 
-        final List<String> shortcutFeatureKeys = getFeatureSettingsKeys();
-        mSettingsContentObserver = new SettingsContentObserver(new Handler(), shortcutFeatureKeys) {
-            @Override
-            public void onChange(boolean selfChange, Uri uri) {
-                updateShortcutPreferenceData();
-                updateShortcutPreference();
-            }
-        };
+        mSettingsContentObserver = new AccessibilitySettingsContentObserver(new Handler());
+        registerKeysToObserverCallback(mSettingsContentObserver);
     }
 
-    protected List<String> getFeatureSettingsKeys() {
+    protected void registerKeysToObserverCallback(
+            AccessibilitySettingsContentObserver contentObserver) {
+        final List<String> shortcutFeatureKeys = getShortcutFeatureSettingsKeys();
+
+        contentObserver.registerKeysToObserverCallback(shortcutFeatureKeys, key -> {
+            updateShortcutPreferenceData();
+            updateShortcutPreference();
+        });
+    }
+
+    protected List<String> getShortcutFeatureSettingsKeys() {
         final List<String> shortcutFeatureKeys = new ArrayList<>();
         shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
         shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE);
diff --git a/src/com/android/settings/accessibility/ToggleReduceBrightColorsPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleReduceBrightColorsPreferenceFragment.java
index 81bd45a..feb41a1 100644
--- a/src/com/android/settings/accessibility/ToggleReduceBrightColorsPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleReduceBrightColorsPreferenceFragment.java
@@ -22,7 +22,6 @@
 import android.hardware.display.ColorDisplayManager;
 import android.net.Uri;
 import android.os.Bundle;
-import android.os.Handler;
 import android.provider.Settings;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -50,8 +49,6 @@
     private static final String KEY_INTENSITY = "rbc_intensity";
     private static final String KEY_PERSIST = "rbc_persist";
 
-    private final Handler mHandler = new Handler();
-    private SettingsContentObserver mSettingsContentObserver;
     private ReduceBrightColorsIntensityPreferenceController mRbcIntensityPreferenceController;
     private ReduceBrightColorsPersistencePreferenceController mRbcPersistencePreferenceController;
     private ColorDisplayManager mColorDisplayManager;
@@ -67,20 +64,12 @@
         mComponentName = AccessibilityShortcutController.REDUCE_BRIGHT_COLORS_COMPONENT_NAME;
         mPackageName = getText(R.string.reduce_bright_colors_preference_title);
         mHtmlDescription = getText(R.string.reduce_bright_colors_preference_subtitle);
-        final List<String> enableServiceFeatureKeys = new ArrayList<>(/* initialCapacity= */ 1);
-        enableServiceFeatureKeys.add(REDUCE_BRIGHT_COLORS_ACTIVATED_KEY);
         mRbcIntensityPreferenceController =
                 new ReduceBrightColorsIntensityPreferenceController(getContext(), KEY_INTENSITY);
         mRbcPersistencePreferenceController =
                 new ReduceBrightColorsPersistencePreferenceController(getContext(), KEY_PERSIST);
         mRbcIntensityPreferenceController.displayPreference(getPreferenceScreen());
         mRbcPersistencePreferenceController.displayPreference(getPreferenceScreen());
-        mSettingsContentObserver = new SettingsContentObserver(mHandler, enableServiceFeatureKeys) {
-            @Override
-            public void onChange(boolean selfChange, Uri uri) {
-                updateSwitchBarToggleSwitch();
-            }
-        };
         mColorDisplayManager = getContext().getSystemService(ColorDisplayManager.class);
         final View view = super.onCreateView(inflater, container, savedInstanceState);
         // Parent sets the title when creating the view, so set it after calling super
@@ -90,6 +79,17 @@
         return view;
     }
 
+    @Override
+    protected void registerKeysToObserverCallback(
+            AccessibilitySettingsContentObserver contentObserver) {
+        super.registerKeysToObserverCallback(contentObserver);
+
+        final List<String> enableServiceFeatureKeys = new ArrayList<>(/* initialCapacity= */ 1);
+        enableServiceFeatureKeys.add(REDUCE_BRIGHT_COLORS_ACTIVATED_KEY);
+        contentObserver.registerKeysToObserverCallback(enableServiceFeatureKeys,
+                key -> updateSwitchBarToggleSwitch());
+    }
+
     private void updateGeneralCategoryOrder() {
         final PreferenceCategory generalCategory = findPreference(KEY_GENERAL_CATEGORY);
         final SeekBarPreference intensity = findPreference(KEY_INTENSITY);
@@ -117,12 +117,10 @@
     public void onResume() {
         super.onResume();
         updateSwitchBarToggleSwitch();
-        mSettingsContentObserver.register(getContentResolver());
     }
 
     @Override
     public void onPause() {
-        mSettingsContentObserver.unregister(getContentResolver());
         super.onPause();
     }
 
diff --git a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
index d1e9b56..5f76d5a 100644
--- a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
@@ -75,6 +75,9 @@
             new TextUtils.SimpleStringSplitter(COMPONENT_NAME_SEPARATOR);
 
     private DialogCreatable mDialogDelegate;
+    private MagnificationFollowTypingPreferenceController mFollowTypingPreferenceController;
+
+    protected SwitchPreference mFollowingTypingSwitchPreference;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
@@ -177,21 +180,20 @@
         getSettingsLifecycle().addObserver(magnificationModePreferenceController);
         magnificationModePreferenceController.displayPreference(getPreferenceScreen());
 
-        final SwitchPreference followingTypingSwitchPreference =
+        mFollowingTypingSwitchPreference =
                 new SwitchPreference(getPrefContext());
-        followingTypingSwitchPreference.setTitle(
+        mFollowingTypingSwitchPreference.setTitle(
                 R.string.accessibility_screen_magnification_follow_typing_title);
-        followingTypingSwitchPreference.setSummary(
+        mFollowingTypingSwitchPreference.setSummary(
                 R.string.accessibility_screen_magnification_follow_typing_summary);
-        followingTypingSwitchPreference.setKey(
+        mFollowingTypingSwitchPreference.setKey(
                 MagnificationFollowTypingPreferenceController.PREF_KEY);
-        generalCategory.addPreference(followingTypingSwitchPreference);
+        generalCategory.addPreference(mFollowingTypingSwitchPreference);
 
-        final MagnificationFollowTypingPreferenceController followTypingPreferenceController =
-                new MagnificationFollowTypingPreferenceController(getContext(),
-                        MagnificationFollowTypingPreferenceController.PREF_KEY);
-        getSettingsLifecycle().addObserver(followTypingPreferenceController);
-        followTypingPreferenceController.displayPreference(getPreferenceScreen());
+        mFollowTypingPreferenceController = new MagnificationFollowTypingPreferenceController(
+                getContext(), MagnificationFollowTypingPreferenceController.PREF_KEY);
+        getSettingsLifecycle().addObserver(mFollowTypingPreferenceController);
+        mFollowTypingPreferenceController.displayPreference(getPreferenceScreen());
     }
 
     @Override
@@ -293,8 +295,23 @@
     }
 
     @Override
-    protected List<String> getFeatureSettingsKeys() {
-        final List<String> shortcutKeys = super.getFeatureSettingsKeys();
+    protected void registerKeysToObserverCallback(
+            AccessibilitySettingsContentObserver contentObserver) {
+        super.registerKeysToObserverCallback(contentObserver);
+
+        final List<String> followingTypingKeys = new ArrayList<>();
+        followingTypingKeys.add(Settings.Secure.ACCESSIBILITY_MAGNIFICATION_FOLLOW_TYPING_ENABLED);
+        contentObserver.registerKeysToObserverCallback(followingTypingKeys,
+                key -> updateFollowTypingState());
+    }
+
+    private void updateFollowTypingState() {
+        mFollowTypingPreferenceController.updateState();
+    }
+
+    @Override
+    protected List<String> getShortcutFeatureSettingsKeys() {
+        final List<String> shortcutKeys = super.getShortcutFeatureSettingsKeys();
         shortcutKeys.add(Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED);
         return shortcutKeys;
     }
diff --git a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragmentForSetupWizard.java b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragmentForSetupWizard.java
index 799508b..d92fd51 100644
--- a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragmentForSetupWizard.java
+++ b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragmentForSetupWizard.java
@@ -44,9 +44,17 @@
         final Drawable icon = getContext().getDrawable(R.drawable.ic_accessibility_visibility);
         AccessibilitySetupWizardUtils.updateGlifPreferenceLayout(getContext(), layout, title,
                 description, icon);
+        hidePreferenceSettingComponents();
+    }
 
-        // Hide the setting from the vision settings.
+    /**
+     * Hide the magnification preference settings in the SuW's vision settings.
+     */
+    private void hidePreferenceSettingComponents() {
+        // Setting of magnification type
         mSettingsPreference.setVisible(false);
+        // Setting of following typing
+        mFollowingTypingSwitchPreference.setVisible(false);
     }
 
     @Override
diff --git a/src/com/android/settings/accessibility/VibrationIntensityPreferenceController.java b/src/com/android/settings/accessibility/VibrationIntensityPreferenceController.java
index e35b42c..b3e8168 100644
--- a/src/com/android/settings/accessibility/VibrationIntensityPreferenceController.java
+++ b/src/com/android/settings/accessibility/VibrationIntensityPreferenceController.java
@@ -19,8 +19,10 @@
 import android.content.Context;
 import android.os.Vibrator;
 
+import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
 
+import com.android.settings.R;
 import com.android.settings.core.SliderPreferenceController;
 import com.android.settings.widget.SeekBarPreference;
 import com.android.settingslib.core.lifecycle.LifecycleObserver;
@@ -36,13 +38,22 @@
 
     protected final VibrationPreferenceConfig mPreferenceConfig;
     private final VibrationPreferenceConfig.SettingObserver mSettingsContentObserver;
+    private final int mMaxIntensity;
 
     protected VibrationIntensityPreferenceController(Context context, String prefkey,
             VibrationPreferenceConfig preferenceConfig) {
+        this(context, prefkey, preferenceConfig,
+                context.getResources().getInteger(
+                        R.integer.config_vibration_supported_intensity_levels));
+    }
+
+    protected VibrationIntensityPreferenceController(Context context, String prefkey,
+            VibrationPreferenceConfig preferenceConfig, int supportedIntensityLevels) {
         super(context, prefkey);
         mPreferenceConfig = preferenceConfig;
         mSettingsContentObserver = new VibrationPreferenceConfig.SettingObserver(
                 preferenceConfig);
+        mMaxIntensity = Math.min(Vibrator.VIBRATION_INTENSITY_HIGH, supportedIntensityLevels);
     }
 
     @Override
@@ -60,32 +71,49 @@
         super.displayPreference(screen);
         final SeekBarPreference preference = screen.findPreference(getPreferenceKey());
         mSettingsContentObserver.onDisplayPreference(this, preference);
-        // TODO: remove this and replace with a different way to play the haptic preview without
-        // relying on the setting being propagated to the service.
+        preference.setEnabled(mPreferenceConfig.isPreferenceEnabled());
+        // TODO: remove setContinuousUpdates and replace with a different way to play the haptic
+        // preview without relying on the setting being propagated to the service.
         preference.setContinuousUpdates(true);
         preference.setMin(getMin());
         preference.setMax(getMax());
     }
 
     @Override
+    public void updateState(Preference preference) {
+        super.updateState(preference);
+        if (preference != null) {
+            preference.setEnabled(mPreferenceConfig.isPreferenceEnabled());
+        }
+    }
+
+    @Override
     public int getMin() {
         return Vibrator.VIBRATION_INTENSITY_OFF;
     }
 
     @Override
     public int getMax() {
-        return Vibrator.VIBRATION_INTENSITY_HIGH;
+        return mMaxIntensity;
     }
 
     @Override
     public int getSliderPosition() {
+        if (!mPreferenceConfig.isPreferenceEnabled()) {
+            return getMin();
+        }
         final int position = mPreferenceConfig.readIntensity();
         return Math.min(position, getMax());
     }
 
     @Override
     public boolean setSliderPosition(int position) {
-        final boolean success = mPreferenceConfig.updateIntensity(position);
+        if (!mPreferenceConfig.isPreferenceEnabled()) {
+            // Ignore slider updates when the preference is disabled.
+            return false;
+        }
+        final int intensity = calculateVibrationIntensity(position);
+        final boolean success = mPreferenceConfig.updateIntensity(intensity);
 
         if (success && (position != Vibrator.VIBRATION_INTENSITY_OFF)) {
             mPreferenceConfig.playVibrationPreview();
@@ -93,4 +121,19 @@
 
         return success;
     }
+
+    private int calculateVibrationIntensity(int position) {
+        int maxPosition = getMax();
+        if (position >= maxPosition) {
+            if (maxPosition == 1) {
+                // If there is only one intensity available besides OFF, then use the device default
+                // intensity to ensure no scaling will ever happen in the platform.
+                return mPreferenceConfig.getDefaultIntensity();
+            }
+            // If the settings granularity is lower than the platform's then map the max position to
+            // the highest vibration intensity, skipping intermediate values in the scale.
+            return Vibrator.VIBRATION_INTENSITY_HIGH;
+        }
+        return position;
+    }
 }
diff --git a/src/com/android/settings/accessibility/VibrationMainSwitchPreferenceController.java b/src/com/android/settings/accessibility/VibrationMainSwitchPreferenceController.java
new file mode 100644
index 0000000..726bbc1
--- /dev/null
+++ b/src/com/android/settings/accessibility/VibrationMainSwitchPreferenceController.java
@@ -0,0 +1,91 @@
+/*
+ * 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.accessibility;
+
+import static com.android.settings.accessibility.AccessibilityUtil.State.OFF;
+import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
+
+import android.content.Context;
+import android.database.ContentObserver;
+import android.net.Uri;
+import android.os.Handler;
+import android.provider.Settings;
+
+import com.android.settings.R;
+import com.android.settings.widget.SettingsMainSwitchPreferenceController;
+import com.android.settingslib.core.lifecycle.LifecycleObserver;
+import com.android.settingslib.core.lifecycle.events.OnStart;
+import com.android.settingslib.core.lifecycle.events.OnStop;
+
+/**
+ * Preference controller for the main switch setting for vibration and haptics screen.
+ *
+ * <p>This preference is controlled by the setting key{@link Settings.System#VIBRATE_ON}, and it
+ * will disable the entire settings screen once the settings is turned OFF. All device haptics will
+ * be disabled by this setting, except the flagged alerts and accessibility touch feedback.
+ */
+public class VibrationMainSwitchPreferenceController extends SettingsMainSwitchPreferenceController
+        implements LifecycleObserver, OnStart, OnStop {
+
+    private final ContentObserver mSettingObserver;
+
+    public VibrationMainSwitchPreferenceController(Context context, String preferenceKey) {
+        super(context, preferenceKey);
+        mSettingObserver = new ContentObserver(new Handler(/* async= */ true)) {
+            @Override
+            public void onChange(boolean selfChange, Uri uri) {
+                updateState(mSwitchPreference);
+            }
+        };
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return AVAILABLE;
+    }
+
+    @Override
+    public void onStart() {
+        mContext.getContentResolver().registerContentObserver(
+                Settings.System.getUriFor(VibrationPreferenceConfig.MAIN_SWITCH_SETTING_KEY),
+                /* notifyForDescendants= */ false,
+                mSettingObserver);
+    }
+
+    @Override
+    public void onStop() {
+        mContext.getContentResolver().unregisterContentObserver(mSettingObserver);
+    }
+
+    @Override
+    public boolean isChecked() {
+        return VibrationPreferenceConfig.isMainVibrationSwitchEnabled(
+                mContext.getContentResolver());
+    }
+
+    @Override
+    public boolean setChecked(boolean isChecked) {
+        return Settings.System.putInt(mContext.getContentResolver(),
+                VibrationPreferenceConfig.MAIN_SWITCH_SETTING_KEY,
+                isChecked ? ON : OFF);
+    }
+
+    @Override
+    public int getSliceHighlightMenuRes() {
+        return R.string.menu_key_accessibility;
+    }
+}
diff --git a/src/com/android/settings/accessibility/VibrationPreferenceConfig.java b/src/com/android/settings/accessibility/VibrationPreferenceConfig.java
index aa59554..1b0b163 100644
--- a/src/com/android/settings/accessibility/VibrationPreferenceConfig.java
+++ b/src/com/android/settings/accessibility/VibrationPreferenceConfig.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.accessibility;
 
+import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
+
 import android.content.ContentResolver;
 import android.content.Context;
 import android.database.ContentObserver;
@@ -36,12 +38,23 @@
  */
 public abstract class VibrationPreferenceConfig {
 
+    /**
+     * SettingsProvider key for the main "Vibration & haptics" toggle preference, that can disable
+     * all device vibrations.
+     */
+    public static final String MAIN_SWITCH_SETTING_KEY = Settings.System.VIBRATE_ON;
+
     protected final ContentResolver mContentResolver;
     private final Vibrator mVibrator;
     private final String mSettingKey;
     private final int mDefaultIntensity;
     private final VibrationAttributes mVibrationAttributes;
 
+    /** Returns true if the user setting for enabling device vibrations is enabled. */
+    public static boolean isMainVibrationSwitchEnabled(ContentResolver contentResolver) {
+        return Settings.System.getInt(contentResolver, MAIN_SWITCH_SETTING_KEY, ON) == ON;
+    }
+
     public VibrationPreferenceConfig(Context context, String settingKey, int vibrationUsage) {
         mContentResolver = context.getContentResolver();
         mVibrator = context.getSystemService(Vibrator.class);
@@ -52,11 +65,16 @@
                 .build();
     }
 
-    /** Return the setting key for this setting preference. */
+    /** Returns the setting key for this setting preference. */
     public String getSettingKey() {
         return mSettingKey;
     }
 
+    /** Returns true if this setting preference is enabled for user update. */
+    public boolean isPreferenceEnabled() {
+        return isMainVibrationSwitchEnabled(mContentResolver);
+    }
+
     /** Returns the default intensity to be displayed when the setting value is not set. */
     public int getDefaultIntensity() {
         return mDefaultIntensity;
@@ -80,6 +98,9 @@
 
     /** {@link ContentObserver} for a setting described by a {@link VibrationPreferenceConfig}. */
     public static final class SettingObserver extends ContentObserver {
+        private static final Uri MAIN_SWITCH_SETTING_URI =
+                Settings.System.getUriFor(MAIN_SWITCH_SETTING_KEY);
+
         private final Uri mUri;
         private AbstractPreferenceController mPreferenceController;
         private Preference mPreference;
@@ -92,7 +113,11 @@
 
         @Override
         public void onChange(boolean selfChange, Uri uri) {
-            if (mUri.equals(uri) && mPreferenceController != null && mPreference != null) {
+            if (mPreferenceController == null || mPreference == null) {
+                // onDisplayPreference not triggered yet, nothing to update.
+                return;
+            }
+            if (mUri.equals(uri) || MAIN_SWITCH_SETTING_URI.equals(uri)) {
                 mPreferenceController.updateState(mPreference);
             }
         }
@@ -103,6 +128,8 @@
          */
         public void register(ContentResolver contentResolver) {
             contentResolver.registerContentObserver(mUri, /* notifyForDescendants= */ false, this);
+            contentResolver.registerContentObserver(MAIN_SWITCH_SETTING_URI,
+                    /* notifyForDescendants= */ false, this);
         }
 
         /**
diff --git a/src/com/android/settings/accessibility/VibrationRampingRingerTogglePreferenceController.java b/src/com/android/settings/accessibility/VibrationRampingRingerTogglePreferenceController.java
index 4a86538..37a0257 100644
--- a/src/com/android/settings/accessibility/VibrationRampingRingerTogglePreferenceController.java
+++ b/src/com/android/settings/accessibility/VibrationRampingRingerTogglePreferenceController.java
@@ -21,8 +21,6 @@
 import android.media.AudioManager;
 import android.net.Uri;
 import android.os.Handler;
-import android.os.Looper;
-import android.os.VibrationAttributes;
 import android.os.Vibrator;
 import android.provider.DeviceConfig;
 import android.provider.Settings;
@@ -37,8 +35,6 @@
 import com.android.settingslib.core.lifecycle.events.OnStart;
 import com.android.settingslib.core.lifecycle.events.OnStop;
 
-import com.google.common.annotations.VisibleForTesting;
-
 /**
  * Preference controller for the ramping ringer setting key, controlled via {@link AudioManager}.
  *
@@ -50,20 +46,35 @@
 public class VibrationRampingRingerTogglePreferenceController
         extends TogglePreferenceController implements LifecycleObserver, OnStart, OnStop {
 
-    @VisibleForTesting
-    static final String DEVICE_CONFIG_KEY = "ramping_ringer_enabled";
+    /** Wrapper around static {@link DeviceConfig} accessor for testing. */
+    protected static class DeviceConfigProvider {
+        public boolean isRampingRingerEnabledOnTelephonyConfig() {
+            return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_TELEPHONY,
+                    "ramping_ringer_enabled", false);
+        }
+    }
 
+    private final DeviceConfigProvider mDeviceConfigProvider;
     private final ContentObserver mSettingObserver;
-    private final Vibrator mVibrator;
     private final AudioManager mAudioManager;
+    private final VibrationPreferenceConfig mRingVibrationPreferenceConfig;
+    private final VibrationPreferenceConfig.SettingObserver mRingSettingObserver;
 
     private Preference mPreference;
 
     public VibrationRampingRingerTogglePreferenceController(Context context, String preferenceKey) {
+        this(context, preferenceKey, new DeviceConfigProvider());
+    }
+
+    protected VibrationRampingRingerTogglePreferenceController(Context context,
+            String preferenceKey, DeviceConfigProvider deviceConfigProvider) {
         super(context, preferenceKey);
-        mVibrator = context.getSystemService(Vibrator.class);
+        mDeviceConfigProvider = deviceConfigProvider;
         mAudioManager = context.getSystemService(AudioManager.class);
-        mSettingObserver = new ContentObserver(new Handler(Looper.getMainLooper())) {
+        mRingVibrationPreferenceConfig = new RingVibrationPreferenceConfig(context);
+        mRingSettingObserver = new VibrationPreferenceConfig.SettingObserver(
+                mRingVibrationPreferenceConfig);
+        mSettingObserver = new ContentObserver(new Handler(/* async= */ true)) {
             @Override
             public void onChange(boolean selfChange, Uri uri) {
                 updateState(mPreference);
@@ -74,7 +85,7 @@
     @Override
     public int getAvailabilityStatus() {
         final boolean rampingRingerEnabledOnTelephonyConfig =
-                DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_TELEPHONY, DEVICE_CONFIG_KEY, false);
+                mDeviceConfigProvider.isRampingRingerEnabledOnTelephonyConfig();
         return (Utils.isVoiceCapable(mContext) && !rampingRingerEnabledOnTelephonyConfig)
                 ? AVAILABLE
                 : UNSUPPORTED_ON_DEVICE;
@@ -82,18 +93,16 @@
 
     @Override
     public void onStart() {
+        mRingSettingObserver.register(mContext.getContentResolver());
         mContext.getContentResolver().registerContentObserver(
                 Settings.System.getUriFor(Settings.System.APPLY_RAMPING_RINGER),
                 /* notifyForDescendants= */ false,
                 mSettingObserver);
-        mContext.getContentResolver().registerContentObserver(
-                Settings.System.getUriFor(Settings.System.RING_VIBRATION_INTENSITY),
-                /* notifyForDescendants= */ false,
-                mSettingObserver);
     }
 
     @Override
     public void onStop() {
+        mRingSettingObserver.unregister(mContext.getContentResolver());
         mContext.getContentResolver().unregisterContentObserver(mSettingObserver);
     }
 
@@ -101,6 +110,7 @@
     public void displayPreference(PreferenceScreen screen) {
         super.displayPreference(screen);
         mPreference = screen.findPreference(getPreferenceKey());
+        mRingSettingObserver.onDisplayPreference(this, mPreference);
         mPreference.setEnabled(isRingVibrationEnabled());
     }
 
@@ -132,9 +142,8 @@
     }
 
     private boolean isRingVibrationEnabled() {
-        final int ringIntensity = Settings.System.getInt(mContext.getContentResolver(),
-                Settings.System.RING_VIBRATION_INTENSITY,
-                mVibrator.getDefaultVibrationIntensity(VibrationAttributes.USAGE_RINGTONE));
-        return ringIntensity != Vibrator.VIBRATION_INTENSITY_OFF;
+        return mRingVibrationPreferenceConfig.isPreferenceEnabled()
+                && (mRingVibrationPreferenceConfig.readIntensity()
+                != Vibrator.VIBRATION_INTENSITY_OFF);
     }
 }
diff --git a/src/com/android/settings/accessibility/VibrationSettings.java b/src/com/android/settings/accessibility/VibrationSettings.java
index 277cfee..1bf75f7 100644
--- a/src/com/android/settings/accessibility/VibrationSettings.java
+++ b/src/com/android/settings/accessibility/VibrationSettings.java
@@ -41,9 +41,9 @@
 
     @Override
     protected int getPreferenceScreenResId() {
-        final boolean supportsMultipleIntensities = getContext().getResources().getBoolean(
-                R.bool.config_vibration_supports_multiple_intensities);
-        return supportsMultipleIntensities
+        final int supportedIntensities = getContext().getResources().getInteger(
+                R.integer.config_vibration_supported_intensity_levels);
+        return supportedIntensities > 1
                 ? R.xml.accessibility_vibration_intensity_settings
                 : R.xml.accessibility_vibration_settings;
     }
diff --git a/src/com/android/settings/accessibility/VibrationTogglePreferenceController.java b/src/com/android/settings/accessibility/VibrationTogglePreferenceController.java
index 5278b66..8f158cc 100644
--- a/src/com/android/settings/accessibility/VibrationTogglePreferenceController.java
+++ b/src/com/android/settings/accessibility/VibrationTogglePreferenceController.java
@@ -58,16 +58,29 @@
         super.displayPreference(screen);
         final Preference preference = screen.findPreference(getPreferenceKey());
         mSettingsContentObserver.onDisplayPreference(this, preference);
+        preference.setEnabled(mPreferenceConfig.isPreferenceEnabled());
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        super.updateState(preference);
+        if (preference != null) {
+            preference.setEnabled(mPreferenceConfig.isPreferenceEnabled());
+        }
     }
 
     @Override
     public boolean isChecked() {
-        final int position = mPreferenceConfig.readIntensity();
-        return position != Vibrator.VIBRATION_INTENSITY_OFF;
+        return mPreferenceConfig.isPreferenceEnabled()
+                && (mPreferenceConfig.readIntensity() != Vibrator.VIBRATION_INTENSITY_OFF);
     }
 
     @Override
     public boolean setChecked(boolean isChecked) {
+        if (!mPreferenceConfig.isPreferenceEnabled()) {
+            // Ignore toggle updates when the preference is disabled.
+            return false;
+        }
         final int newIntensity = isChecked
                 ? mPreferenceConfig.getDefaultIntensity()
                 : Vibrator.VIBRATION_INTENSITY_OFF;
diff --git a/src/com/android/settings/applications/appinfo/AppLocaleDetails.java b/src/com/android/settings/applications/appinfo/AppLocaleDetails.java
index 966f02d..7fd43c2 100644
--- a/src/com/android/settings/applications/appinfo/AppLocaleDetails.java
+++ b/src/com/android/settings/applications/appinfo/AppLocaleDetails.java
@@ -237,18 +237,28 @@
                 mSuggestedLocales.add(appLocale);
             }
             // 2nd locale in suggested languages group.
-            if (simLocale != null && !simLocale.equals(appLocale)) {
+            if (simLocale != null && !compareLocale(simLocale, appLocale)) {
                 mSuggestedLocales.add(simLocale);
             }
             // Other locales in suggested languages group.
             for (int i = 0; i < currentSystemLocales.size(); i++) {
                 Locale locale = currentSystemLocales.get(i);
-                if (!locale.equals(appLocale) && !locale.equals(simLocale)) {
+                if (!compareLocale(locale, appLocale) && !compareLocale(locale, simLocale)) {
                     mSuggestedLocales.add(locale);
                 }
             }
         }
 
+        static boolean compareLocale(Locale source, Locale target) {
+            if (source == null && target == null) {
+                return true;
+            } else if (source != null && target != null) {
+                return LocaleList.matchesLanguageAndScript(source, target);
+            } else {
+                return false;
+            }
+        }
+
         @VisibleForTesting
         void handleSupportedLocales() {
             //TODO Waiting for PackageManager api
diff --git a/src/com/android/settings/biometrics/BiometricUtils.java b/src/com/android/settings/biometrics/BiometricUtils.java
index 5ee7880..febe3c6 100644
--- a/src/com/android/settings/biometrics/BiometricUtils.java
+++ b/src/com/android/settings/biometrics/BiometricUtils.java
@@ -289,4 +289,14 @@
         }
         return false;
     }
+
+    /**
+     * Returns {@code true} if the screen is going into a landscape mode and the angle is equal to
+     * 90.
+     * @param context Context that we use to get the display this context is associated with
+     * @return True if the angle of the rotation is equal to 90.
+     */
+    public static boolean isLandscape(@NonNull Context context) {
+        return context.getDisplay().getRotation() == Surface.ROTATION_90;
+    }
 }
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
index c2bcee3..d42e8f1 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollEnrolling.java
@@ -19,11 +19,13 @@
 import android.animation.Animator;
 import android.animation.ObjectAnimator;
 import android.annotation.IntDef;
+import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.app.Dialog;
 import android.app.settings.SettingsEnums;
 import android.content.DialogInterface;
 import android.content.Intent;
+import android.content.res.Configuration;
 import android.graphics.drawable.Animatable2;
 import android.graphics.drawable.AnimatedVectorDrawable;
 import android.graphics.drawable.Drawable;
@@ -54,7 +56,9 @@
 import com.android.settings.biometrics.BiometricUtils;
 import com.android.settings.biometrics.BiometricsEnrollEnrolling;
 import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+import com.android.settingslib.display.DisplayDensityUtils;
 
+import com.airbnb.lottie.LottieAnimationView;
 import com.google.android.setupcompat.template.FooterBarMixin;
 import com.google.android.setupcompat.template.FooterButton;
 import com.google.android.setupcompat.util.WizardManagerHelper;
@@ -126,6 +130,10 @@
     private boolean mIsSetupWizard;
     private AccessibilityManager mAccessibilityManager;
     private boolean mIsAccessibilityEnabled;
+    private LottieAnimationView mIllustrationLottie;
+    private boolean mHaveShownUdfpsTipLottie;
+    private boolean mHaveShownUdfpsSideLottie;
+    private boolean mShouldShowLottie;
 
     private OrientationEventListener mOrientationEventListener;
     private int mPreviousRotation = 0;
@@ -163,6 +171,20 @@
             setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
         }
 
+        DisplayDensityUtils displayDensity =
+                new DisplayDensityUtils(getApplicationContext());
+        int currentDensityIndex = displayDensity.getCurrentIndex();
+        final int currentDensity = displayDensity.getValues()[currentDensityIndex];
+        final int defaultDensity = displayDensity.getDefaultDensity();
+        mShouldShowLottie = defaultDensity == currentDensity;
+        // Only show the lottie if the current display density is the default density.
+        // Otherwise, the lottie will overlap with the settings header text.
+        boolean isLandscape = BiometricUtils.isReverseLandscape(getApplicationContext())
+                || BiometricUtils.isLandscape(getApplicationContext());
+
+        updateOrientation((isLandscape
+                ? Configuration.ORIENTATION_LANDSCAPE : Configuration.ORIENTATION_PORTRAIT));
+
         mErrorText = findViewById(R.id.error_text);
         mProgressBar = findViewById(R.id.fingerprint_progress_bar);
         mVibrator = getSystemService(Vibrator.class);
@@ -339,20 +361,34 @@
 
             case STAGE_FINGERTIP:
                 setHeaderText(R.string.security_settings_udfps_enroll_fingertip_title);
-                if (isStageHalfCompleted()) {
-                    setDescriptionText(R.string.security_settings_fingerprint_enroll_repeat_title);
-                } else {
+                if (!mHaveShownUdfpsTipLottie && mIllustrationLottie != null) {
+                    mHaveShownUdfpsTipLottie = true;
                     setDescriptionText("");
+                    mIllustrationLottie.setAnimation(R.raw.udfps_tip_hint_lottie);
+                    mIllustrationLottie.setVisibility(View.VISIBLE);
+                    mIllustrationLottie.playAnimation();
+                    mIllustrationLottie.setContentDescription(
+                            getString(R.string.security_settings_udfps_tip_fingerprint_help));
                 }
                 break;
 
             case STAGE_EDGES:
                 setHeaderText(R.string.security_settings_udfps_enroll_edge_title);
-                if (isStageHalfCompleted()) {
-                    setDescriptionText(
-                            R.string.security_settings_fingerprint_enroll_repeat_message);
-                } else {
-                    setDescriptionText(R.string.security_settings_udfps_enroll_edge_message);
+                if (!mHaveShownUdfpsSideLottie && mIllustrationLottie != null) {
+                    mHaveShownUdfpsSideLottie = true;
+                    setDescriptionText("");
+                    mIllustrationLottie.setAnimation(R.raw.udfps_edge_hint_lottie);
+                    mIllustrationLottie.setVisibility(View.VISIBLE);
+                    mIllustrationLottie.playAnimation();
+                    mIllustrationLottie.setContentDescription(
+                            getString(R.string.security_settings_udfps_side_fingerprint_help));
+                } else if (mIllustrationLottie == null) {
+                    if (isStageHalfCompleted()) {
+                        setDescriptionText(
+                                R.string.security_settings_fingerprint_enroll_repeat_message);
+                    } else {
+                        setDescriptionText(R.string.security_settings_udfps_enroll_edge_message);
+                    }
                 }
                 break;
 
@@ -634,6 +670,41 @@
         return SettingsEnums.FINGERPRINT_ENROLLING;
     }
 
+    private void updateOrientation(int orientation) {
+        switch(orientation) {
+            case Configuration.ORIENTATION_LANDSCAPE: {
+                mIllustrationLottie = null;
+                break;
+            }
+            case Configuration.ORIENTATION_PORTRAIT: {
+                if (mShouldShowLottie) {
+                    mIllustrationLottie = findViewById(R.id.illustration_lottie);
+                }
+                break;
+            }
+            default:
+                Log.e(TAG, "Error unhandled configuration change");
+                break;
+        }
+    }
+
+    @Override
+    public void onConfigurationChanged(@NonNull Configuration newConfig) {
+        switch(newConfig.orientation) {
+            case Configuration.ORIENTATION_LANDSCAPE: {
+                updateOrientation(Configuration.ORIENTATION_LANDSCAPE);
+                break;
+            }
+            case Configuration.ORIENTATION_PORTRAIT: {
+                updateOrientation(Configuration.ORIENTATION_PORTRAIT);
+                break;
+            }
+            default:
+                Log.e(TAG, "Error unhandled configuration change");
+                break;
+        }
+    }
+
     public static class IconTouchDialog extends InstrumentedDialogFragment {
 
         @Override
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsButtonsController.java b/src/com/android/settings/bluetooth/BluetoothDetailsButtonsController.java
index c807893..2ade4ec 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsButtonsController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsButtonsController.java
@@ -16,6 +16,7 @@
 
 package com.android.settings.bluetooth;
 
+import android.app.settings.SettingsEnums;
 import android.content.Context;
 
 import androidx.preference.PreferenceFragmentCompat;
@@ -70,7 +71,11 @@
                 mActionButtons
                         .setButton2Text(R.string.bluetooth_device_context_disconnect)
                         .setButton2Icon(R.drawable.ic_settings_close)
-                        .setButton2OnClickListener(view -> mCachedDevice.disconnect());
+                        .setButton2OnClickListener(view -> {
+                            mMetricsFeatureProvider.action(mContext,
+                                    SettingsEnums.ACTION_SETTINGS_BLUETOOTH_DISCONNECT);
+                            mCachedDevice.disconnect();
+                        });
                 mConnectButtonInitialized = true;
             }
         } else {
@@ -79,7 +84,11 @@
                         .setButton2Text(R.string.bluetooth_device_context_connect)
                         .setButton2Icon(R.drawable.ic_add_24dp)
                         .setButton2OnClickListener(
-                                view -> mCachedDevice.connect());
+                                view -> {
+                                    mMetricsFeatureProvider.action(mContext,
+                                            SettingsEnums.ACTION_SETTINGS_BLUETOOTH_CONNECT);
+                                    mCachedDevice.connect();
+                                });
                 mConnectButtonInitialized = true;
             }
         }
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsController.java b/src/com/android/settings/bluetooth/BluetoothDetailsController.java
index bb48904..5444f68 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsController.java
@@ -22,8 +22,10 @@
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settings.overlay.FeatureFactory;
 import com.android.settingslib.bluetooth.CachedBluetoothDevice;
 import com.android.settingslib.core.AbstractPreferenceController;
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 import com.android.settingslib.core.lifecycle.Lifecycle;
 import com.android.settingslib.core.lifecycle.LifecycleObserver;
 import com.android.settingslib.core.lifecycle.events.OnPause;
@@ -40,6 +42,7 @@
     protected final Context mContext;
     protected final PreferenceFragmentCompat mFragment;
     protected final CachedBluetoothDevice mCachedDevice;
+    protected final MetricsFeatureProvider mMetricsFeatureProvider;
 
     public BluetoothDetailsController(Context context, PreferenceFragmentCompat fragment,
             CachedBluetoothDevice device, Lifecycle lifecycle) {
@@ -48,6 +51,7 @@
         mFragment = fragment;
         mCachedDevice = device;
         lifecycle.addObserver(this);
+        mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
     }
 
     @Override
diff --git a/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdater.java b/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdater.java
index f5bc279..3bdf91e 100644
--- a/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdater.java
+++ b/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdater.java
@@ -15,6 +15,7 @@
  */
 package com.android.settings.bluetooth;
 
+import android.app.settings.SettingsEnums;
 import android.bluetooth.BluetoothAdapter;
 import android.bluetooth.BluetoothDevice;
 import android.content.Context;
@@ -116,6 +117,8 @@
         if (device.isConnected()) {
             return device.setActive();
         }
+        mMetricsFeatureProvider.action(mPrefContext,
+                SettingsEnums.ACTION_SETTINGS_BLUETOOTH_CONNECT);
         device.connect();
         return true;
     }
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 946e0d7..8f227dc 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -477,6 +477,7 @@
         controllers.add(new BugReportPreferenceController(context));
         controllers.add(new BugReportHandlerPreferenceController(context));
         controllers.add(new SystemServerHeapDumpPreferenceController(context));
+        controllers.add(new RebootWithMtePreferenceController(context, fragment));
         controllers.add(new LocalBackupPasswordPreferenceController(context));
         controllers.add(new StayAwakePreferenceController(context, lifecycle));
         controllers.add(new HdcpCheckingPreferenceController(context));
diff --git a/src/com/android/settings/development/RebootWithMteDialog.java b/src/com/android/settings/development/RebootWithMteDialog.java
new file mode 100644
index 0000000..b6522a9
--- /dev/null
+++ b/src/com/android/settings/development/RebootWithMteDialog.java
@@ -0,0 +1,75 @@
+/*
+ * 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.development;
+
+import android.app.Dialog;
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.os.PowerManager;
+import android.os.SystemProperties;
+
+import androidx.appcompat.app.AlertDialog;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+
+import com.android.settings.R;
+import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+
+public class RebootWithMteDialog extends InstrumentedDialogFragment
+        implements DialogInterface.OnClickListener {
+
+    public static final String TAG = "RebootWithMteDlg";
+    private Context mContext;
+
+    public RebootWithMteDialog(Context context) {
+        mContext = context;
+    }
+
+    public static void show(Context context, Fragment host) {
+        FragmentManager manager = host.getActivity().getSupportFragmentManager();
+        if (manager.findFragmentByTag(TAG) == null) {
+            RebootWithMteDialog dialog = new RebootWithMteDialog(context);
+            dialog.setTargetFragment(host, 0 /* requestCode */);
+            dialog.show(manager, TAG);
+        }
+    }
+
+    @Override
+    public int getMetricsCategory() {
+        return SettingsEnums.REBOOT_WITH_MTE;
+    }
+
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+        return new AlertDialog.Builder(getActivity())
+                .setTitle(R.string.reboot_with_mte_title)
+                .setMessage(R.string.reboot_with_mte_message)
+                .setPositiveButton(android.R.string.ok, this /* onClickListener */)
+                .setNegativeButton(android.R.string.cancel, null /* onClickListener */)
+                .setIcon(android.R.drawable.ic_dialog_alert)
+                .create();
+    }
+
+    @Override
+    public void onClick(DialogInterface dialog, int which) {
+        PowerManager pm = mContext.getSystemService(PowerManager.class);
+        SystemProperties.set("arm64.memtag.bootctl", "memtag-once");
+        pm.reboot(null);
+    }
+}
diff --git a/src/com/android/settings/development/RebootWithMtePreferenceController.java b/src/com/android/settings/development/RebootWithMtePreferenceController.java
new file mode 100644
index 0000000..6c03853
--- /dev/null
+++ b/src/com/android/settings/development/RebootWithMtePreferenceController.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.development;
+
+import android.content.Context;
+import android.text.TextUtils;
+
+import androidx.preference.Preference;
+
+import com.android.settings.Utils;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+public class RebootWithMtePreferenceController extends DeveloperOptionsPreferenceController
+        implements PreferenceControllerMixin {
+
+    private static final String KEY_REBOOT_WITH_MTE = "reboot_with_mte";
+
+    private final DevelopmentSettingsDashboardFragment mFragment;
+
+    public RebootWithMtePreferenceController(
+            Context context, DevelopmentSettingsDashboardFragment fragment) {
+        super(context);
+        mFragment = fragment;
+    }
+
+    @Override
+    public boolean isAvailable() {
+        return android.os.SystemProperties.getBoolean("ro.arm64.memtag.bootctl_supported", false);
+    }
+
+    @Override
+    public String getPreferenceKey() {
+        return KEY_REBOOT_WITH_MTE;
+    }
+
+    @Override
+    public boolean handlePreferenceTreeClick(Preference preference) {
+        if (Utils.isMonkeyRunning()) {
+            return false;
+        }
+
+        if (TextUtils.equals(preference.getKey(), getPreferenceKey())) {
+            RebootWithMteDialog.show(mContext, mFragment);
+            return true;
+        }
+        return false;
+    }
+}
diff --git a/src/com/android/settings/dream/CurrentDreamPicker.java b/src/com/android/settings/dream/CurrentDreamPicker.java
deleted file mode 100644
index 3134e79..0000000
--- a/src/com/android/settings/dream/CurrentDreamPicker.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2017 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.app.settings.SettingsEnums;
-import android.content.ComponentName;
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-
-import com.android.settings.R;
-import com.android.settings.widget.RadioButtonPickerFragment;
-import com.android.settingslib.dream.DreamBackend;
-import com.android.settingslib.dream.DreamBackend.DreamInfo;
-import com.android.settingslib.widget.CandidateInfo;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-public final class CurrentDreamPicker extends RadioButtonPickerFragment {
-
-    private DreamBackend mBackend;
-
-    @Override
-    public void onAttach(Context context) {
-        super.onAttach(context);
-
-        mBackend = DreamBackend.getInstance(context);
-    }
-
-    @Override
-    protected int getPreferenceScreenResId() {
-        return R.xml.current_dream_settings;
-    }
-
-    @Override
-    public int getMetricsCategory() {
-        return SettingsEnums.DREAM;
-    }
-
-    @Override
-    protected boolean setDefaultKey(String key) {
-        Map<String, ComponentName> componentNameMap = getDreamComponentsMap();
-        if (componentNameMap.get(key) != null) {
-            mBackend.setActiveDream(componentNameMap.get(key));
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    protected String getDefaultKey() {
-        return mBackend.getActiveDream().flattenToString();
-    }
-
-    @Override
-    protected List<? extends CandidateInfo> getCandidates() {
-        final List<DreamCandidateInfo> candidates;
-        candidates = mBackend.getDreamInfos().stream()
-                .map(DreamCandidateInfo::new)
-                .collect(Collectors.toList());
-
-        return candidates;
-    }
-
-    @Override
-    protected void onSelectionPerformed(boolean success) {
-        super.onSelectionPerformed(success);
-
-        getActivity().finish();
-    }
-
-    private Map<String, ComponentName> getDreamComponentsMap() {
-        Map<String, ComponentName> comps = new HashMap<>();
-        mBackend.getDreamInfos()
-                .forEach((info) ->
-                        comps.put(info.componentName.flattenToString(), info.componentName));
-
-        return comps;
-    }
-
-    private static final class DreamCandidateInfo extends CandidateInfo {
-        private final CharSequence name;
-        private final Drawable icon;
-        private final String key;
-
-        DreamCandidateInfo(DreamInfo info) {
-            super(true);
-
-            name = info.caption;
-            icon = info.icon;
-            key = info.componentName.flattenToString();
-        }
-
-        @Override
-        public CharSequence loadLabel() {
-            return name;
-        }
-
-        @Override
-        public Drawable loadIcon() {
-            return icon;
-        }
-
-        @Override
-        public String getKey() {
-            return key;
-        }
-    }
-}
diff --git a/src/com/android/settings/dream/CurrentDreamPreferenceController.java b/src/com/android/settings/dream/CurrentDreamPreferenceController.java
deleted file mode 100644
index c267921..0000000
--- a/src/com/android/settings/dream/CurrentDreamPreferenceController.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2017 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 androidx.preference.Preference;
-
-import com.android.settings.Utils;
-import com.android.settings.core.BasePreferenceController;
-import com.android.settings.widget.GearPreference;
-import com.android.settingslib.RestrictedPreference;
-import com.android.settingslib.dream.DreamBackend;
-import com.android.settingslib.dream.DreamBackend.DreamInfo;
-
-import java.util.Optional;
-
-public class CurrentDreamPreferenceController extends BasePreferenceController {
-
-    private final DreamBackend mBackend;
-
-    public CurrentDreamPreferenceController(Context context, String key) {
-        super(context, key);
-        mBackend = DreamBackend.getInstance(context);
-    }
-
-    @Override
-    public int getAvailabilityStatus() {
-        return mBackend.getDreamInfos().size() > 0 ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
-    }
-
-    @Override
-    public void updateState(Preference preference) {
-        super.updateState(preference);
-        setGearClickListenerForPreference(preference);
-        setActiveDreamIcon(preference);
-    }
-
-    @Override
-    public CharSequence getSummary() {
-        return mBackend.getActiveDreamName();
-    }
-
-    private void setGearClickListenerForPreference(Preference preference) {
-        if (!(preference instanceof GearPreference)) {
-            return;
-        }
-
-        final GearPreference gearPreference = (GearPreference) preference;
-        final Optional<DreamInfo> info = getActiveDreamInfo();
-        if (!info.isPresent() || info.get().settingsComponentName == null) {
-            gearPreference.setOnGearClickListener(null);
-            return;
-        }
-        gearPreference.setOnGearClickListener(gearPref -> launchScreenSaverSettings());
-    }
-
-    private void launchScreenSaverSettings() {
-        final Optional<DreamInfo> info = getActiveDreamInfo();
-        if (!info.isPresent()) return;
-        mBackend.launchSettings(mContext, info.get());
-    }
-
-    private Optional<DreamInfo> getActiveDreamInfo() {
-        return mBackend.getDreamInfos()
-                .stream()
-                .filter((info) -> info.isActive)
-                .findFirst();
-    }
-
-    private void setActiveDreamIcon(Preference preference) {
-        if (!(preference instanceof GearPreference)) {
-            return;
-        }
-        final GearPreference gearPref = (GearPreference) preference;
-        gearPref.setIconSize(RestrictedPreference.ICON_SIZE_SMALL);
-        gearPref.setIcon(Utils.getSafeIcon(mBackend.getActiveIcon()));
-    }
-}
diff --git a/src/com/android/settings/dream/DreamPickerAdapter.java b/src/com/android/settings/dream/DreamPickerAdapter.java
new file mode 100644
index 0000000..50aaee2
--- /dev/null
+++ b/src/com/android/settings/dream/DreamPickerAdapter.java
@@ -0,0 +1,129 @@
+/*
+ * 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.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.android.settings.R;
+import com.android.settingslib.dream.DreamBackend.DreamInfo;
+
+import java.util.List;
+
+/**
+ * RecyclerView adapter which displays list of available dreams for the user to select.
+ */
+class DreamPickerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
+    private final List<DreamInfo> mDreamInfoList;
+    private final OnItemClickListener mItemClickListener;
+    private final OnItemClickListener mOnDreamSelected = new OnItemClickListener() {
+        @Override
+        public void onItemClicked(DreamInfo dreamInfo) {
+            if (mItemClickListener != null) {
+                mItemClickListener.onItemClicked(dreamInfo);
+            }
+            mDreamInfoList.forEach(dream -> {
+                if (dream != null) {
+                    dream.isActive = false;
+                }
+            });
+            dreamInfo.isActive = true;
+            notifyDataSetChanged();
+        }
+    };
+    private final OnItemClickListener mOnCustomizeListener;
+
+    interface OnItemClickListener {
+        void onItemClicked(DreamInfo dreamInfo);
+    }
+
+    /**
+     * View holder for each Dream service.
+     */
+    private static class DreamViewHolder extends RecyclerView.ViewHolder {
+        private final ImageView mIconView;
+        private final TextView mTitleView;
+        private final TextView mSummaryView;
+        private final ImageView mPreviewView;
+        private final Button mCustomizeButton;
+
+        DreamViewHolder(View view) {
+            super(view);
+            mPreviewView = view.findViewById(R.id.preview);
+            mIconView = view.findViewById(R.id.icon);
+            mTitleView = view.findViewById(R.id.title_text);
+            mSummaryView = view.findViewById(R.id.summary_text);
+            mCustomizeButton = view.findViewById(R.id.customize_button);
+        }
+
+        /**
+         * Bind the dream service view at the given position. Add details on the
+         * dream's icon, name and description.
+         */
+        public void bindView(DreamInfo dreamInfo, OnItemClickListener clickListener,
+                OnItemClickListener customizeListener) {
+            mIconView.setImageDrawable(dreamInfo.icon);
+            mTitleView.setText(dreamInfo.caption);
+            mPreviewView.setImageDrawable(dreamInfo.previewImage);
+            mSummaryView.setText(dreamInfo.description);
+            itemView.setActivated(dreamInfo.isActive);
+            if (dreamInfo.isActive && dreamInfo.settingsComponentName != null) {
+                mCustomizeButton.setVisibility(View.VISIBLE);
+                mCustomizeButton.setOnClickListener(
+                        v -> customizeListener.onItemClicked(dreamInfo));
+            } else {
+                mCustomizeButton.setVisibility(View.GONE);
+            }
+
+            itemView.setOnClickListener(v -> clickListener.onItemClicked(dreamInfo));
+        }
+    }
+
+    DreamPickerAdapter(List<DreamInfo> dreamInfos, OnItemClickListener clickListener,
+            OnItemClickListener onCustomizeListener) {
+        mDreamInfoList = dreamInfos;
+        mItemClickListener = clickListener;
+        mOnCustomizeListener = onCustomizeListener;
+    }
+
+    @NonNull
+    @Override
+    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
+        View view = LayoutInflater.from(viewGroup.getContext())
+                .inflate(R.layout.dream_preference_layout, viewGroup, false);
+        return new DreamViewHolder(view);
+    }
+
+    @Override
+    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
+        ((DreamViewHolder) viewHolder).bindView(mDreamInfoList.get(i), mOnDreamSelected,
+                mOnCustomizeListener);
+    }
+
+    @Override
+    public int getItemCount() {
+        return mDreamInfoList.size();
+    }
+}
diff --git a/src/com/android/settings/dream/DreamPickerController.java b/src/com/android/settings/dream/DreamPickerController.java
new file mode 100644
index 0000000..15cd75c
--- /dev/null
+++ b/src/com/android/settings/dream/DreamPickerController.java
@@ -0,0 +1,138 @@
+/*
+ * 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.widget.Button;
+
+import androidx.annotation.Nullable;
+import androidx.preference.Preference;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.android.settings.R;
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.dream.DreamPickerAdapter.OnItemClickListener;
+import com.android.settingslib.dream.DreamBackend;
+import com.android.settingslib.widget.LayoutPreference;
+
+import java.util.List;
+
+/**
+ * Controller for the dream picker where the user can select a screensaver.
+ */
+public class DreamPickerController extends BasePreferenceController {
+    public static final String KEY = "dream_picker";
+
+    private final DreamBackend mBackend;
+    private final List<DreamBackend.DreamInfo> mDreamInfos;
+    private Button mPreviewButton;
+    @Nullable
+    private DreamBackend.DreamInfo mActiveDream;
+
+    private final OnItemClickListener mItemClickListener =
+            new OnItemClickListener() {
+                @Override
+                public void onItemClicked(DreamBackend.DreamInfo dreamInfo) {
+                    mActiveDream = dreamInfo;
+                    mBackend.setActiveDream(
+                            mActiveDream == null ? null : mActiveDream.componentName);
+                    updatePreviewButtonState();
+                }
+            };
+
+    private final OnItemClickListener mCustomizeListener = new OnItemClickListener() {
+        @Override
+        public void onItemClicked(DreamBackend.DreamInfo dreamInfo) {
+            mBackend.launchSettings(mContext, dreamInfo);
+        }
+    };
+
+    public DreamPickerController(Context context, String preferenceKey) {
+        this(context, preferenceKey, DreamBackend.getInstance(context));
+    }
+
+    public DreamPickerController(Context context, String preferenceKey, DreamBackend backend) {
+        super(context, preferenceKey);
+        mBackend = backend;
+        mDreamInfos = mBackend.getDreamInfos();
+    }
+
+    @Override
+    public String getPreferenceKey() {
+        return KEY;
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return mDreamInfos.size() > 0 ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        super.updateState(preference);
+
+        mActiveDream = getActiveDreamInfo();
+
+        final DreamPickerAdapter adapter =
+                new DreamPickerAdapter(mDreamInfos, mItemClickListener, mCustomizeListener);
+
+        final RecyclerView recyclerView =
+                ((LayoutPreference) preference).findViewById(R.id.dream_list);
+        recyclerView.setLayoutManager(new AutoFitGridLayoutManager(mContext));
+        recyclerView.setAdapter(adapter);
+
+        mPreviewButton = ((LayoutPreference) preference).findViewById(R.id.preview_button);
+        mPreviewButton.setOnClickListener(v -> mBackend.preview(mActiveDream));
+        updatePreviewButtonState();
+    }
+
+    private void updatePreviewButtonState() {
+        final boolean hasDream = mActiveDream != null;
+        mPreviewButton.setClickable(hasDream);
+        mPreviewButton.setEnabled(hasDream);
+    }
+
+    @Nullable
+    private DreamBackend.DreamInfo getActiveDreamInfo() {
+        return mDreamInfos
+                .stream()
+                .filter(d -> d.isActive)
+                .findFirst()
+                .orElse(null);
+    }
+
+    /** Grid layout manager that calculates the number of columns for the screen size. */
+    private static final class AutoFitGridLayoutManager extends GridLayoutManager {
+        private final float mColumnWidth;
+
+        AutoFitGridLayoutManager(Context context) {
+            super(context, /* spanCount= */ 1);
+            this.mColumnWidth = context
+                    .getResources()
+                    .getDimensionPixelSize(R.dimen.dream_item_min_column_width);
+        }
+
+        @Override
+        public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
+            final int totalSpace = getWidth() - getPaddingRight() - getPaddingLeft();
+            final int spanCount = Math.max(1, (int) (totalSpace / mColumnWidth));
+            setSpanCount(spanCount);
+            super.onLayoutChildren(recycler, state);
+        }
+    }
+}
diff --git a/src/com/android/settings/dream/StartNowPreferenceController.java b/src/com/android/settings/dream/StartNowPreferenceController.java
deleted file mode 100644
index f270496..0000000
--- a/src/com/android/settings/dream/StartNowPreferenceController.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2017 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.widget.Button;
-
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.R;
-import com.android.settings.core.BasePreferenceController;
-import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.overlay.FeatureFactory;
-import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
-import com.android.settingslib.dream.DreamBackend;
-import com.android.settingslib.widget.LayoutPreference;
-
-/**
- * Controller that used to enable screen saver
- */
-public class StartNowPreferenceController extends BasePreferenceController {
-
-    private final DreamBackend mBackend;
-    private final MetricsFeatureProvider mMetricsFeatureProvider;
-
-    public StartNowPreferenceController(Context context, String preferenceKey) {
-        super(context, preferenceKey);
-        mBackend = DreamBackend.getInstance(context);
-        mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
-    }
-
-    @Override
-    public int getAvailabilityStatus() {
-        return AVAILABLE;
-    }
-
-    @Override
-    public void displayPreference(PreferenceScreen screen) {
-        super.displayPreference(screen);
-
-        final LayoutPreference pref = screen.findPreference(getPreferenceKey());
-        final Button startButton = pref.findViewById(R.id.dream_start_now_button);
-        startButton.setOnClickListener(v -> {
-            mMetricsFeatureProvider.logClickedPreference(pref,
-                    pref.getExtras().getInt(DashboardFragment.CATEGORY));
-            mBackend.startDreaming();
-        });
-    }
-
-    @Override
-    public void updateState(Preference preference) {
-        super.updateState(preference);
-        final Button startButton = ((LayoutPreference) preference)
-                .findViewById(R.id.dream_start_now_button);
-        startButton.setEnabled(mBackend.getWhenToDreamSetting() != DreamBackend.NEVER);
-    }
-}
diff --git a/src/com/android/settings/localepicker/LocalePickerWithRegionActivity.java b/src/com/android/settings/localepicker/LocalePickerWithRegionActivity.java
index 0d7d531..bcc55e3 100644
--- a/src/com/android/settings/localepicker/LocalePickerWithRegionActivity.java
+++ b/src/com/android/settings/localepicker/LocalePickerWithRegionActivity.java
@@ -17,7 +17,6 @@
 package com.android.settings.localepicker;
 
 import android.app.FragmentTransaction;
-import android.app.ListFragment;
 import android.content.Intent;
 import android.os.Bundle;
 import android.view.MenuItem;
@@ -49,14 +48,6 @@
     }
 
     @Override
-    protected void onStart() {
-        super.onStart();
-        final ListFragment listFragment =
-                (ListFragment) getFragmentManager().findFragmentById(R.id.content_frame);
-        listFragment.getListView().setNestedScrollingEnabled(true);
-    }
-
-    @Override
     public boolean onOptionsItemSelected(MenuItem item) {
         if (item.getItemId() == android.R.id.home) {
             handleBackPressed();
diff --git a/src/com/android/settings/location/RecentLocationAccessPreferenceController.java b/src/com/android/settings/location/RecentLocationAccessPreferenceController.java
index a8a30b4..ba660ee 100644
--- a/src/com/android/settings/location/RecentLocationAccessPreferenceController.java
+++ b/src/com/android/settings/location/RecentLocationAccessPreferenceController.java
@@ -20,6 +20,7 @@
 import android.icu.text.RelativeDateTimeFormatter;
 import android.os.UserHandle;
 import android.os.UserManager;
+import android.provider.Settings;
 
 import androidx.annotation.VisibleForTesting;
 import androidx.preference.Preference;
@@ -85,11 +86,17 @@
     public void displayPreference(PreferenceScreen screen) {
         super.displayPreference(screen);
         mCategoryRecentLocationRequests = screen.findPreference(getPreferenceKey());
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        mCategoryRecentLocationRequests.removeAll();
         final Context prefContext = mCategoryRecentLocationRequests.getContext();
         final List<RecentAppOpsAccess.Access> recentLocationAccesses = new ArrayList<>();
         final UserManager userManager = UserManager.get(mContext);
-        for (RecentAppOpsAccess.Access access : mRecentLocationApps.getAppListSorted(
-                /* showSystemApps= */ false)) {
+        final boolean showSystem = Settings.Secure.getInt(mContext.getContentResolver(),
+                Settings.Secure.LOCATION_SHOW_SYSTEM_OPS, 0) == 1;
+        for (RecentAppOpsAccess.Access access : mRecentLocationApps.getAppListSorted(showSystem)) {
             if (isRequestMatchesProfileType(userManager, access, mType)) {
                 recentLocationAccesses.add(access);
                 if (recentLocationAccesses.size() == MAX_APPS) {
diff --git a/src/com/android/settings/location/RecentLocationAccessSeeAllFragment.java b/src/com/android/settings/location/RecentLocationAccessSeeAllFragment.java
index e27b28c..f7bf31a 100644
--- a/src/com/android/settings/location/RecentLocationAccessSeeAllFragment.java
+++ b/src/com/android/settings/location/RecentLocationAccessSeeAllFragment.java
@@ -17,6 +17,7 @@
 
 import android.content.Context;
 import android.os.Bundle;
+import android.provider.Settings;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
@@ -36,7 +37,6 @@
 
     private static final int MENU_SHOW_SYSTEM = Menu.FIRST + 1;
     private static final int MENU_HIDE_SYSTEM = Menu.FIRST + 2;
-    private static final String EXTRA_SHOW_SYSTEM = "show_system";
 
     private boolean mShowSystem = false;
     private MenuItem mShowSystemMenu;
@@ -58,18 +58,8 @@
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        if (savedInstanceState != null) {
-            mShowSystem = savedInstanceState.getBoolean(EXTRA_SHOW_SYSTEM, mShowSystem);
-        }
-        if (mController != null) {
-            mController.setShowSystem(mShowSystem);
-        }
-    }
-
-    @Override
-    public void onSaveInstanceState(Bundle outState) {
-        super.onSaveInstanceState(outState);
-        outState.putBoolean(EXTRA_SHOW_SYSTEM, mShowSystem);
+        mShowSystem = Settings.Secure.getInt(getContentResolver(),
+                Settings.Secure.LOCATION_SHOW_SYSTEM_OPS, 0) == 1;
     }
 
     @Override
@@ -88,6 +78,8 @@
             case MENU_SHOW_SYSTEM:
             case MENU_HIDE_SYSTEM:
                 mShowSystem = menuItem.getItemId() == MENU_SHOW_SYSTEM;
+                Settings.Secure.putInt(getContentResolver(),
+                        Settings.Secure.LOCATION_SHOW_SYSTEM_OPS, mShowSystem ? 1 : 0);
                 updateMenu();
                 if (mController != null) {
                     mController.setShowSystem(mShowSystem);
diff --git a/src/com/android/settings/location/RecentLocationAccessSeeAllPreferenceController.java b/src/com/android/settings/location/RecentLocationAccessSeeAllPreferenceController.java
index bca4486..e3379c7 100644
--- a/src/com/android/settings/location/RecentLocationAccessSeeAllPreferenceController.java
+++ b/src/com/android/settings/location/RecentLocationAccessSeeAllPreferenceController.java
@@ -20,6 +20,7 @@
 
 import android.content.Context;
 import android.os.UserManager;
+import android.provider.Settings;
 
 import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
@@ -43,6 +44,8 @@
 
     public RecentLocationAccessSeeAllPreferenceController(Context context, String key) {
         super(context, key);
+        mShowSystem = Settings.Secure.getInt(mContext.getContentResolver(),
+                Settings.Secure.LOCATION_SHOW_SYSTEM_OPS, 0) == 1;
         mRecentLocationAccesses = RecentAppOpsAccess.createForLocation(context);
     }
 
diff --git a/src/com/android/settings/location/RecentLocationRequestPreferenceController.java b/src/com/android/settings/location/RecentLocationRequestPreferenceController.java
index 812a440..a14e047 100644
--- a/src/com/android/settings/location/RecentLocationRequestPreferenceController.java
+++ b/src/com/android/settings/location/RecentLocationRequestPreferenceController.java
@@ -17,6 +17,7 @@
 import android.os.Bundle;
 import android.os.UserHandle;
 import android.os.UserManager;
+import android.provider.Settings;
 
 import androidx.annotation.VisibleForTesting;
 import androidx.preference.Preference;
@@ -83,8 +84,11 @@
         final Context prefContext = mCategoryRecentLocationRequests.getContext();
         final List<RecentLocationApps.Request> recentLocationRequests = new ArrayList<>();
         final UserManager userManager = UserManager.get(mContext);
+        final boolean showSystem = Settings.Secure.getInt(mContext.getContentResolver(),
+                Settings.Secure.LOCATION_SHOW_SYSTEM_OPS, 0) == 1;
+
         for (RecentLocationApps.Request request : mRecentLocationApps.getAppListSorted(
-                false /* systemApps */)) {
+                showSystem)) {
             if (isRequestMatchesProfileType(userManager, request, mType)) {
                 recentLocationRequests.add(request);
                 if (recentLocationRequests.size() == MAX_APPS) {
diff --git a/src/com/android/settings/network/VpnPreferenceController.java b/src/com/android/settings/network/VpnPreferenceController.java
index d745ff5..be07809 100644
--- a/src/com/android/settings/network/VpnPreferenceController.java
+++ b/src/com/android/settings/network/VpnPreferenceController.java
@@ -30,7 +30,6 @@
 import android.security.Credentials;
 import android.security.LegacyVpnProfileStore;
 import android.util.Log;
-import android.util.SparseArray;
 
 import androidx.annotation.VisibleForTesting;
 import androidx.preference.Preference;
@@ -129,28 +128,7 @@
         }
         UserManager userManager = mContext.getSystemService(UserManager.class);
         VpnManager vpnManager = mContext.getSystemService(VpnManager.class);
-        // Copied from SystemUI::SecurityControllerImpl
-        SparseArray<VpnConfig> vpns = new SparseArray<>();
-        final List<UserInfo> users = userManager.getUsers();
-        int connectedLegacyVpnCount = 0;
-        for (UserInfo user : users) {
-            VpnConfig cfg = vpnManager.getVpnConfig(user.id);
-            if (cfg == null) {
-                continue;
-            } else if (cfg.legacy) {
-                // Legacy VPNs should do nothing if the network is disconnected. Third-party
-                // VPN warnings need to continue as traffic can still go to the app.
-                final LegacyVpnInfo legacyVpn = vpnManager.getLegacyVpnInfo(user.id);
-                if (legacyVpn == null || legacyVpn.state != LegacyVpnInfo.STATE_CONNECTED) {
-                    continue;
-                } else {
-                    connectedLegacyVpnCount++;
-                }
-            }
-            vpns.put(user.id, cfg);
-        }
-        int numberOfNonLegacyVpn = vpns.size() - connectedLegacyVpnCount;
-        String summary = getInsecureVpnSummaryOverride(numberOfNonLegacyVpn);
+        String summary = getInsecureVpnSummaryOverride(userManager, vpnManager);
         if (summary == null) {
             final UserInfo userInfo = userManager.getUserInfo(UserHandle.myUserId());
             final int uid;
@@ -159,7 +137,16 @@
             } else {
                 uid = userInfo.id;
             }
-            VpnConfig vpn = vpns.get(uid);
+            VpnConfig vpn = vpnManager.getVpnConfig(uid);
+            if ((vpn != null) && vpn.legacy) {
+                // Copied from SystemUI::SecurityControllerImpl
+                // Legacy VPNs should do nothing if the network is disconnected. Third-party
+                // VPN warnings need to continue as traffic can still go to the app.
+                final LegacyVpnInfo legacyVpn = vpnManager.getLegacyVpnInfo(uid);
+                if (legacyVpn == null || legacyVpn.state != LegacyVpnInfo.STATE_CONNECTED) {
+                    vpn = null;
+                }
+            }
             if (vpn == null) {
                 summary = mContext.getString(R.string.vpn_disconnected_summary);
             } else {
@@ -170,21 +157,35 @@
         ThreadUtils.postOnMainThread(() -> mPreference.setSummary(finalSummary));
     }
 
-    protected String getInsecureVpnSummaryOverride(int numberOfNonLegacyVpn) {
+    protected int getNumberOfNonLegacyVpn(UserManager userManager, VpnManager vpnManager) {
+        // Converted from SystemUI::SecurityControllerImpl
+        return (int) userManager.getUsers().stream()
+                .map(user -> vpnManager.getVpnConfig(user.id))
+                .filter(cfg -> (cfg != null) && (!cfg.legacy))
+                .count();
+    }
+
+    protected String getInsecureVpnSummaryOverride(UserManager userManager,
+            VpnManager vpnManager) {
         // Optionally add warning icon if an insecure VPN is present.
         if (mPreference instanceof VpnInfoPreference) {
-            final int insecureVpnCount = getInsecureVpnCount();
+            String [] legacyVpnProfileKeys = LegacyVpnProfileStore.list(Credentials.VPN);
+            final int insecureVpnCount = getInsecureVpnCount(legacyVpnProfileKeys);
             boolean isInsecureVPN = insecureVpnCount > 0;
             ((VpnInfoPreference) mPreference).setInsecureVpn(isInsecureVPN);
+
             // Set the summary based on the total number of VPNs and insecure VPNs.
             if (isInsecureVPN) {
                 // Add the users and the number of legacy vpns to determine if there is more than
                 // one vpn, since there can be more than one VPN per user.
-                final int vpnCount = numberOfNonLegacyVpn
-                        + LegacyVpnProfileStore.list(Credentials.VPN).length;
-                if (vpnCount == 1) {
-                    return mContext.getString(R.string.vpn_settings_insecure_single);
-                } else if (insecureVpnCount == 1) {
+                int vpnCount = legacyVpnProfileKeys.length;
+                if (vpnCount <= 1) {
+                    vpnCount += getNumberOfNonLegacyVpn(userManager, vpnManager);
+                    if (vpnCount == 1) {
+                        return mContext.getString(R.string.vpn_settings_insecure_single);
+                    }
+                }
+                if (insecureVpnCount == 1) {
                     return mContext.getString(
                             R.string.vpn_settings_single_insecure_multiple_total,
                             insecureVpnCount);
@@ -216,10 +217,10 @@
     }
 
     @VisibleForTesting
-    protected int getInsecureVpnCount() {
+    protected int getInsecureVpnCount(String [] legacyVpnProfileKeys) {
         final Function<String, VpnProfile> keyToProfile = key ->
                 VpnProfile.decode(key, LegacyVpnProfileStore.get(Credentials.VPN + key));
-        return (int) Arrays.stream(LegacyVpnProfileStore.list(Credentials.VPN))
+        return (int) Arrays.stream(legacyVpnProfileKeys)
                 .map(keyToProfile)
                 // Return whether any profile is an insecure type.
                 .filter(profile -> VpnProfile.isLegacyType(profile.type))
diff --git a/src/com/android/settings/password/ChooseLockPattern.java b/src/com/android/settings/password/ChooseLockPattern.java
index 3e7622c..60b8c6c 100644
--- a/src/com/android/settings/password/ChooseLockPattern.java
+++ b/src/com/android/settings/password/ChooseLockPattern.java
@@ -541,8 +541,6 @@
             mDefaultHeaderColorList = mHeaderText.getTextColors();
             mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
             mLockPatternView.setOnPatternListener(mChooseNewLockPatternListener);
-            mLockPatternView.setTactileFeedbackEnabled(
-                    mLockPatternUtils.isTactileFeedbackEnabled());
             mLockPatternView.setFadePattern(false);
 
             mFooterText = (TextView) view.findViewById(R.id.footerText);
diff --git a/src/com/android/settings/password/ConfirmLockPattern.java b/src/com/android/settings/password/ConfirmLockPattern.java
index ec5efcf..6b9140a 100644
--- a/src/com/android/settings/password/ConfirmLockPattern.java
+++ b/src/com/android/settings/password/ConfirmLockPattern.java
@@ -144,8 +144,6 @@
                 mHeaderText = mDevicePolicyManager.getOrganizationNameForUser(mUserId);
             }
 
-            mLockPatternView.setTactileFeedbackEnabled(
-                    mLockPatternUtils.isTactileFeedbackEnabled());
             mLockPatternView.setInStealthMode(!mLockPatternUtils.isVisiblePatternEnabled(
                     mEffectiveUserId));
             mLockPatternView.setOnPatternListener(mConfirmExistingLockPatternListener);
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index 255b85f..dc4bca3 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -814,8 +814,8 @@
         }
         try {
             getContext().getSystemService(UserManager.class)
-                    .removeUserOrSetEphemeral(UserHandle.myUserId(),
-                            /* evenWhenDisallowed= */ false);
+                    .removeUserWhenPossible(UserHandle.of(UserHandle.myUserId()),
+                            /* overrideDevicePolicy= */ false);
             ActivityManager.getService().switchUser(UserHandle.USER_SYSTEM);
         } catch (RemoteException re) {
             Log.e(TAG, "Unable to remove self user");
diff --git a/src/com/android/settings/wifi/tether/WifiTetherPreferenceController.java b/src/com/android/settings/wifi/tether/WifiTetherPreferenceController.java
index 67f5944..94bd78a 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherPreferenceController.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherPreferenceController.java
@@ -37,6 +37,7 @@
 import com.android.settingslib.core.lifecycle.events.OnStart;
 import com.android.settingslib.core.lifecycle.events.OnStop;
 import com.android.settingslib.wifi.WifiEnterpriseRestrictionUtils;
+import com.android.settingslib.wifi.WifiUtils;
 
 import java.util.List;
 
@@ -136,9 +137,9 @@
                         if (mPreference != null
                                 && mSoftApState == WifiManager.WIFI_AP_STATE_ENABLED) {
                             // Only show the number of clients when state is on
-                            mPreference.setSummary(mContext.getResources().getQuantityString(
-                                    R.plurals.wifi_tether_connected_summary, clients.size(),
-                                    clients.size()));
+                            mPreference.setSummary(
+                                    WifiUtils.getWifiTetherSummaryForConnectedDevices(mContext,
+                                            clients.size()));
                         }
                     }
                 });
diff --git a/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java b/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java
index 7dc4613..aec31fc 100644
--- a/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java
@@ -35,6 +35,7 @@
 import android.net.ConnectivityManager;
 import android.net.TetheringManager;
 import android.net.wifi.SoftApConfiguration;
+import android.net.wifi.WifiManager;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.util.FeatureFlagUtils;
@@ -43,27 +44,23 @@
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.core.FeatureFlags;
-import com.android.settings.testutils.shadow.ShadowWifiManager;
 import com.android.settings.wifi.tether.WifiTetherAutoOffPreferenceController;
 import com.android.settings.wifi.tether.WifiTetherSecurityPreferenceController;
 import com.android.settingslib.core.lifecycle.Lifecycle;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
 import org.robolectric.util.ReflectionHelpers;
 
 import java.util.ArrayList;
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
-@Config(shadows = {ShadowWifiManager.class})
 public class AllInOneTetherSettingsTest {
     private static final String[] WIFI_REGEXS = {"wifi_regexs"};
     private static final String[] USB_REGEXS = {"usb_regexs"};
@@ -74,6 +71,8 @@
     private AllInOneTetherSettings mAllInOneTetherSettings;
 
     @Mock
+    private WifiManager mWifiManager;
+    @Mock
     private ConnectivityManager mConnectivityManager;
     @Mock
     private TetheringManager mTetheringManager;
@@ -91,6 +90,7 @@
         mContext = spy(RuntimeEnvironment.application);
 
         MockitoAnnotations.initMocks(this);
+        doReturn(mWifiManager).when(mContext).getSystemService(WifiManager.class);
         doReturn(mConnectivityManager)
                 .when(mContext).getSystemService(Context.CONNECTIVITY_SERVICE);
         doReturn(mTetheringManager)
@@ -178,7 +178,6 @@
     }
 
     @Test
-    @Ignore
     public void createPreferenceControllers_hasAutoOffPreference() {
         assertThat(mAllInOneTetherSettings.createPreferenceControllers(mContext)
                 .stream()
diff --git a/tests/robotests/src/com/android/settings/MainClearTest.java b/tests/robotests/src/com/android/settings/MainClearTest.java
index e2a7ca9..ec33fad 100644
--- a/tests/robotests/src/com/android/settings/MainClearTest.java
+++ b/tests/robotests/src/com/android/settings/MainClearTest.java
@@ -55,7 +55,6 @@
 
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
@@ -209,7 +208,6 @@
     }
 
     @Test
-    @Ignore
     public void testShowWipeEuicc_euiccEnabled_unprovisioned() {
         prepareEuiccState(
                 true /* isEuiccEnabled */,
@@ -228,7 +226,6 @@
     }
 
     @Test
-    @Ignore
     public void testShowWipeEuicc_developerMode_unprovisioned() {
         prepareEuiccState(
                 true /* isEuiccEnabled */,
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsContentObserverTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsContentObserverTest.java
new file mode 100644
index 0000000..e23d2d7
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsContentObserverTest.java
@@ -0,0 +1,160 @@
+/*
+ * 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.accessibility;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.database.ContentObserver;
+import android.os.Handler;
+import android.provider.Settings;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import org.junit.After;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.shadow.api.Shadow;
+import org.robolectric.shadows.ShadowContentResolver;
+
+import java.util.Collection;
+import java.util.List;
+
+/** Test for {@link AccessibilitySettingsContentObserver}. */
+@RunWith(RobolectricTestRunner.class)
+public class AccessibilitySettingsContentObserverTest {
+
+    private static final String SPECIFIC_KEY_A_1 = "SPECIFIC_KEY_A_1";
+    private static final String SPECIFIC_KEY_A_2 = "SPECIFIC_KEY_A_2";
+    private static final String SPECIFIC_KEY_B_1 = "SPECIFIC_KEY_B_1";
+
+    private final Context mContext = ApplicationProvider.getApplicationContext();
+    private final AccessibilitySettingsContentObserver mObserver =
+            new AccessibilitySettingsContentObserver(new Handler());
+    private final AccessibilitySettingsContentObserver.ContentObserverCallback mObserverCallbackA =
+            spy(new TestableContentObserverCallback());
+    private final AccessibilitySettingsContentObserver.ContentObserverCallback mObserverCallbackB =
+            spy(new TestableContentObserverCallback());
+    private final ContentResolver mContentResolver = mContext.getContentResolver();
+
+    @Test
+    public void register_shouldRegisterContentObserverForDefaultKeys() {
+        mObserver.register(mContentResolver);
+
+        ShadowContentResolver shadowContentResolver = Shadow.extract(mContentResolver);
+        assertObserverToUri(shadowContentResolver,
+                Settings.Secure.ACCESSIBILITY_ENABLED, mObserver);
+        assertObserverToUri(shadowContentResolver,
+                Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, mObserver);
+    }
+
+    @Test
+    public void unregister_shouldUnregisterContentObserver() {
+        mObserver.register(mContentResolver);
+
+        mObserver.unregister(mContentResolver);
+
+        ShadowContentResolver shadowContentResolver = Shadow.extract(mContentResolver);
+        assertNotObserverToUri(shadowContentResolver, Settings.Secure.ACCESSIBILITY_ENABLED);
+        assertNotObserverToUri(shadowContentResolver,
+                Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
+    }
+
+    @Test
+    public void register_addSpecificKeys_shouldRegisterContentObserverForSpecificAndDefaultKeys() {
+        mObserver.registerKeysToObserverCallback(List.of(SPECIFIC_KEY_A_1), mObserverCallbackA);
+
+        mObserver.register(mContentResolver);
+
+        ShadowContentResolver shadowContentResolver = Shadow.extract(mContentResolver);
+        assertObserverToUri(shadowContentResolver,
+                Settings.Secure.ACCESSIBILITY_ENABLED, mObserver);
+        assertObserverToUri(shadowContentResolver,
+                Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, mObserver);
+        assertObserverToUri(shadowContentResolver, SPECIFIC_KEY_A_1, mObserver);
+    }
+
+    @Test
+    public void onChange_shouldTriggerCallbackOnDefaultKey() {
+        mObserver.registerObserverCallback(mObserverCallbackA);
+        mObserver.register(mContentResolver);
+
+        mObserver.onChange(/* selfChange= */ false,
+                Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_ENABLED));
+
+        verify(mObserverCallbackA).onChange(Settings.Secure.ACCESSIBILITY_ENABLED);
+    }
+
+    @Test
+    public void onChange_registerSpecificKeys_shouldTriggerSpecificCallback() {
+        mObserver.registerKeysToObserverCallback(
+                List.of(SPECIFIC_KEY_A_1, SPECIFIC_KEY_A_2), mObserverCallbackA);
+        mObserver.register(mContentResolver);
+
+        mObserver.onChange(/* selfChange= */ false,
+                Settings.Secure.getUriFor(SPECIFIC_KEY_A_2));
+
+        verify(mObserverCallbackA).onChange(SPECIFIC_KEY_A_2);
+    }
+
+    @Test
+    public void onChange_registerSpecificKeys_withoutTriggerOtherCallback() {
+        mObserver.registerKeysToObserverCallback(
+                List.of(SPECIFIC_KEY_A_1, SPECIFIC_KEY_A_2), mObserverCallbackA);
+        mObserver.registerKeysToObserverCallback(
+                List.of(SPECIFIC_KEY_B_1), mObserverCallbackB);
+        mObserver.register(mContentResolver);
+
+        mObserver.onChange(/* selfChange= */ false,
+                Settings.Secure.getUriFor(SPECIFIC_KEY_B_1));
+
+        verify(mObserverCallbackA, never()).onChange(SPECIFIC_KEY_A_1);
+        verify(mObserverCallbackA, never()).onChange(SPECIFIC_KEY_A_2);
+        verify(mObserverCallbackA, never()).onChange(SPECIFIC_KEY_B_1);
+        verify(mObserverCallbackB).onChange(SPECIFIC_KEY_B_1);
+    }
+
+    @After
+    public void tearDown() {
+        mObserver.unregister(mContentResolver);
+    }
+
+    private void assertNotObserverToUri(ShadowContentResolver resolver, String key) {
+        assertThat(resolver.getContentObservers(Settings.Secure.getUriFor(key))).isEmpty();
+    }
+
+    private void assertObserverToUri(ShadowContentResolver resolver,
+            String key, ContentObserver observer) {
+        Collection<ContentObserver> observers =
+                resolver.getContentObservers(Settings.Secure.getUriFor(key));
+        assertThat(observers).contains(observer);
+    }
+
+    private static class TestableContentObserverCallback implements
+            AccessibilitySettingsContentObserver.ContentObserverCallback {
+        @Override
+        public void onChange(String key) {
+            // do nothing
+        }
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
index d1c59f7..5843265 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
@@ -281,10 +281,10 @@
         verify(mContentResolver).registerContentObserver(
                 eq(Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS)),
                 anyBoolean(),
-                any(SettingsContentObserver.class));
+                any(AccessibilitySettingsContentObserver.class));
         verify(mContentResolver).registerContentObserver(eq(Settings.Secure.getUriFor(
                 Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE)), anyBoolean(),
-                any(SettingsContentObserver.class));
+                any(AccessibilitySettingsContentObserver.class));
         verify(mActivity, atLeast(1)).registerReceiver(any(PackageMonitor.class), captor.capture(),
                 isNull(), any());
         intentFilter = captor.getAllValues().get(/* first time */ 0);
@@ -301,7 +301,8 @@
 
         mFragment.onDestroy();
 
-        verify(mContentResolver).unregisterContentObserver(any(SettingsContentObserver.class));
+        verify(mContentResolver).unregisterContentObserver(
+                any(AccessibilitySettingsContentObserver.class));
         verify(mActivity).unregisterReceiver(any(PackageMonitor.class));
 
     }
diff --git a/tests/robotests/src/com/android/settings/accessibility/AlarmVibrationIntensityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/AlarmVibrationIntensityPreferenceControllerTest.java
new file mode 100644
index 0000000..22e2b8a
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/AlarmVibrationIntensityPreferenceControllerTest.java
@@ -0,0 +1,137 @@
+/*
+ * 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.accessibility;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.os.VibrationAttributes;
+import android.os.Vibrator;
+import android.provider.Settings;
+
+import androidx.preference.PreferenceScreen;
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.widget.SeekBarPreference;
+import com.android.settingslib.core.lifecycle.Lifecycle;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+
+@RunWith(RobolectricTestRunner.class)
+public class AlarmVibrationIntensityPreferenceControllerTest {
+
+    private static final String PREFERENCE_KEY = "preference_key";
+
+    @Mock private PreferenceScreen mScreen;
+
+    private Lifecycle mLifecycle;
+    private Context mContext;
+    private Vibrator mVibrator;
+    private AlarmVibrationIntensityPreferenceController mController;
+    private SeekBarPreference mPreference;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mLifecycle = new Lifecycle(() -> mLifecycle);
+        mContext = ApplicationProvider.getApplicationContext();
+        mVibrator = mContext.getSystemService(Vibrator.class);
+        mController = new AlarmVibrationIntensityPreferenceController(mContext, PREFERENCE_KEY,
+                Vibrator.VIBRATION_INTENSITY_HIGH);
+        mLifecycle.addObserver(mController);
+        mPreference = new SeekBarPreference(mContext);
+        mPreference.setSummary("Test summary");
+        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
+        mController.displayPreference(mScreen);
+    }
+
+    @Test
+    public void verifyConstants() {
+        assertThat(mController.getPreferenceKey()).isEqualTo(PREFERENCE_KEY);
+        assertThat(mController.getAvailabilityStatus())
+                .isEqualTo(BasePreferenceController.AVAILABLE);
+        assertThat(mController.getMin()).isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+        assertThat(mController.getMax()).isEqualTo(Vibrator.VIBRATION_INTENSITY_HIGH);
+    }
+
+    @Test
+    public void missingSetting_shouldReturnDefault() {
+        Settings.System.putString(mContext.getContentResolver(),
+                Settings.System.ALARM_VIBRATION_INTENSITY, /* value= */ null);
+
+        mController.updateState(mPreference);
+
+        assertThat(mPreference.getProgress()).isEqualTo(
+                mVibrator.getDefaultVibrationIntensity(VibrationAttributes.USAGE_ALARM));
+    }
+
+    @Test
+    public void updateState_shouldDisplayIntensityInSliderPosition() {
+        updateSetting(Settings.System.ALARM_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_HIGH);
+        mController.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_HIGH);
+
+        updateSetting(Settings.System.ALARM_VIBRATION_INTENSITY,
+                Vibrator.VIBRATION_INTENSITY_MEDIUM);
+        mController.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_MEDIUM);
+
+        updateSetting(Settings.System.ALARM_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_LOW);
+        mController.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
+
+        updateSetting(Settings.System.ALARM_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_OFF);
+        mController.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+    }
+
+
+    @Test
+    public void setProgress_updatesIntensitySetting() throws Exception {
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_OFF);
+        assertThat(readSetting(Settings.System.ALARM_VIBRATION_INTENSITY))
+                .isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_LOW);
+        assertThat(readSetting(Settings.System.ALARM_VIBRATION_INTENSITY))
+                .isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
+
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_MEDIUM);
+        assertThat(readSetting(Settings.System.ALARM_VIBRATION_INTENSITY))
+                .isEqualTo(Vibrator.VIBRATION_INTENSITY_MEDIUM);
+
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_HIGH);
+        assertThat(readSetting(Settings.System.ALARM_VIBRATION_INTENSITY))
+                .isEqualTo(Vibrator.VIBRATION_INTENSITY_HIGH);
+    }
+
+    private void updateSetting(String key, int value) {
+        Settings.System.putInt(mContext.getContentResolver(), key, value);
+    }
+
+    private int readSetting(String settingKey) throws Settings.SettingNotFoundException {
+        return Settings.System.getInt(mContext.getContentResolver(), settingKey);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/accessibility/AlarmVibrationTogglePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/AlarmVibrationTogglePreferenceControllerTest.java
new file mode 100644
index 0000000..82d65f7
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/AlarmVibrationTogglePreferenceControllerTest.java
@@ -0,0 +1,128 @@
+/*
+ * 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.accessibility;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.os.VibrationAttributes;
+import android.os.Vibrator;
+import android.provider.Settings;
+
+import androidx.preference.PreferenceScreen;
+import androidx.preference.SwitchPreference;
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.core.lifecycle.Lifecycle;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+
+@RunWith(RobolectricTestRunner.class)
+public class AlarmVibrationTogglePreferenceControllerTest {
+
+    private static final String PREFERENCE_KEY = "preference_key";
+
+    @Mock private PreferenceScreen mScreen;
+
+    private Lifecycle mLifecycle;
+    private Context mContext;
+    private Vibrator mVibrator;
+    private AlarmVibrationTogglePreferenceController mController;
+    private SwitchPreference mPreference;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mLifecycle = new Lifecycle(() -> mLifecycle);
+        mContext = ApplicationProvider.getApplicationContext();
+        mVibrator = mContext.getSystemService(Vibrator.class);
+        mController = new AlarmVibrationTogglePreferenceController(mContext, PREFERENCE_KEY);
+        mLifecycle.addObserver(mController);
+        mPreference = new SwitchPreference(mContext);
+        mPreference.setSummary("Test summary");
+        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
+        mController.displayPreference(mScreen);
+    }
+
+    @Test
+    public void verifyConstants() {
+        assertThat(mController.getPreferenceKey()).isEqualTo(PREFERENCE_KEY);
+        assertThat(mController.getAvailabilityStatus())
+                .isEqualTo(BasePreferenceController.AVAILABLE);
+    }
+
+    @Test
+    public void missingSetting_shouldReturnDefault() {
+        Settings.System.putString(mContext.getContentResolver(),
+                Settings.System.ALARM_VIBRATION_INTENSITY, /* value= */ null);
+
+        mController.updateState(mPreference);
+
+        assertThat(mPreference.isChecked()).isTrue();
+    }
+
+    @Test
+    public void updateState_shouldDisplayOnOffState() {
+        updateSetting(Settings.System.ALARM_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_HIGH);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isTrue();
+
+        updateSetting(Settings.System.ALARM_VIBRATION_INTENSITY,
+                Vibrator.VIBRATION_INTENSITY_MEDIUM);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isTrue();
+
+        updateSetting(Settings.System.ALARM_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_LOW);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isTrue();
+
+        updateSetting(Settings.System.ALARM_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_OFF);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isFalse();
+    }
+
+    @Test
+    public void setChecked_updatesIntensityAndDependentSettings() throws Exception {
+        updateSetting(Settings.System.ALARM_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_OFF);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isFalse();
+
+        mController.setChecked(true);
+        assertThat(readSetting(Settings.System.ALARM_VIBRATION_INTENSITY)).isEqualTo(
+                mVibrator.getDefaultVibrationIntensity(VibrationAttributes.USAGE_ALARM));
+
+        mController.setChecked(false);
+        assertThat(readSetting(Settings.System.ALARM_VIBRATION_INTENSITY))
+                .isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+    }
+
+    private void updateSetting(String key, int value) {
+        Settings.System.putInt(mContext.getContentResolver(), key, value);
+    }
+
+    private int readSetting(String settingKey) throws Settings.SettingNotFoundException {
+        return Settings.System.getInt(mContext.getContentResolver(), settingKey);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/accessibility/HapticFeedbackIntensityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/HapticFeedbackIntensityPreferenceControllerTest.java
index e59b85e..2273a3e 100644
--- a/tests/robotests/src/com/android/settings/accessibility/HapticFeedbackIntensityPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/HapticFeedbackIntensityPreferenceControllerTest.java
@@ -18,7 +18,6 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
@@ -26,7 +25,6 @@
 import android.os.Vibrator;
 import android.provider.Settings;
 
-import androidx.lifecycle.LifecycleOwner;
 import androidx.preference.PreferenceScreen;
 import androidx.test.core.app.ApplicationProvider;
 
@@ -49,10 +47,8 @@
     private static final int OFF = 0;
     private static final int ON = 1;
 
-    @Mock
-    private PreferenceScreen mScreen;
+    @Mock private PreferenceScreen mScreen;
 
-    private LifecycleOwner mLifecycleOwner;
     private Lifecycle mLifecycle;
     private Context mContext;
     private Vibrator mVibrator;
@@ -62,16 +58,16 @@
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        mLifecycleOwner = () -> mLifecycle;
-        mLifecycle = new Lifecycle(mLifecycleOwner);
-        mContext = spy(ApplicationProvider.getApplicationContext());
+        mLifecycle = new Lifecycle(() -> mLifecycle);
+        mContext = ApplicationProvider.getApplicationContext();
         mVibrator = mContext.getSystemService(Vibrator.class);
-        mController = new HapticFeedbackIntensityPreferenceController(mContext, PREFERENCE_KEY);
+        mController = new HapticFeedbackIntensityPreferenceController(mContext, PREFERENCE_KEY,
+                Vibrator.VIBRATION_INTENSITY_HIGH);
         mLifecycle.addObserver(mController);
         mPreference = new SeekBarPreference(mContext);
         mPreference.setSummary("Test summary");
         when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
-        showPreference();
+        mController.displayPreference(mScreen);
     }
 
     @Test
@@ -115,27 +111,27 @@
     @Test
     @Ignore
     public void setProgress_updatesIntensityAndDependentSettings() throws Exception {
-        mPreference.setProgress(Vibrator.VIBRATION_INTENSITY_OFF);
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_OFF);
         assertThat(readSetting(Settings.System.HAPTIC_FEEDBACK_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
         assertThat(readSetting(Settings.System.HAPTIC_FEEDBACK_ENABLED)).isEqualTo(OFF);
 
-        mPreference.setProgress(Vibrator.VIBRATION_INTENSITY_LOW);
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_LOW);
         assertThat(readSetting(Settings.System.HAPTIC_FEEDBACK_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
         assertThat(readSetting(Settings.System.HAPTIC_FEEDBACK_ENABLED)).isEqualTo(ON);
 
-        mPreference.setProgress(Vibrator.VIBRATION_INTENSITY_MEDIUM);
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_MEDIUM);
         assertThat(readSetting(Settings.System.HAPTIC_FEEDBACK_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_MEDIUM);
         assertThat(readSetting(Settings.System.HAPTIC_FEEDBACK_ENABLED)).isEqualTo(ON);
 
-        mPreference.setProgress(Vibrator.VIBRATION_INTENSITY_HIGH);
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_HIGH);
         assertThat(readSetting(Settings.System.HAPTIC_FEEDBACK_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_HIGH);
         assertThat(readSetting(Settings.System.HAPTIC_FEEDBACK_ENABLED)).isEqualTo(ON);
 
-        mPreference.setProgress(Vibrator.VIBRATION_INTENSITY_OFF);
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_OFF);
         assertThat(readSetting(Settings.System.HAPTIC_FEEDBACK_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
         assertThat(readSetting(Settings.System.HAPTIC_FEEDBACK_ENABLED)).isEqualTo(OFF);
@@ -148,8 +144,4 @@
     private int readSetting(String settingKey) throws Settings.SettingNotFoundException {
         return Settings.System.getInt(mContext.getContentResolver(), settingKey);
     }
-
-    private void showPreference() {
-        mController.displayPreference(mScreen);
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/accessibility/HapticFeedbackTogglePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/HapticFeedbackTogglePreferenceControllerTest.java
index 0e0a194..f992b0e 100644
--- a/tests/robotests/src/com/android/settings/accessibility/HapticFeedbackTogglePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/HapticFeedbackTogglePreferenceControllerTest.java
@@ -18,7 +18,6 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
@@ -26,7 +25,6 @@
 import android.os.Vibrator;
 import android.provider.Settings;
 
-import androidx.lifecycle.LifecycleOwner;
 import androidx.preference.PreferenceScreen;
 import androidx.preference.SwitchPreference;
 import androidx.test.core.app.ApplicationProvider;
@@ -49,10 +47,8 @@
     private static final int OFF = 0;
     private static final int ON = 1;
 
-    @Mock
-    private PreferenceScreen mScreen;
+    @Mock private PreferenceScreen mScreen;
 
-    private LifecycleOwner mLifecycleOwner;
     private Lifecycle mLifecycle;
     private Context mContext;
     private Vibrator mVibrator;
@@ -62,16 +58,15 @@
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        mLifecycleOwner = () -> mLifecycle;
-        mLifecycle = new Lifecycle(mLifecycleOwner);
-        mContext = spy(ApplicationProvider.getApplicationContext());
+        mLifecycle = new Lifecycle(() -> mLifecycle);
+        mContext = ApplicationProvider.getApplicationContext();
         mVibrator = mContext.getSystemService(Vibrator.class);
         mController = new HapticFeedbackTogglePreferenceController(mContext, PREFERENCE_KEY);
         mLifecycle.addObserver(mController);
         mPreference = new SwitchPreference(mContext);
         mPreference.setSummary("Test summary");
         when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
-        showPreference();
+        mController.displayPreference(mScreen);
     }
 
     @Test
@@ -116,12 +111,12 @@
         mController.updateState(mPreference);
         assertThat(mPreference.isChecked()).isFalse();
 
-        mPreference.setChecked(true);
+        mController.setChecked(true);
         assertThat(readSetting(Settings.System.HAPTIC_FEEDBACK_INTENSITY))
                 .isEqualTo(mVibrator.getDefaultVibrationIntensity(VibrationAttributes.USAGE_TOUCH));
         assertThat(readSetting(Settings.System.HAPTIC_FEEDBACK_ENABLED)).isEqualTo(ON);
 
-        mPreference.setChecked(false);
+        mController.setChecked(false);
         assertThat(readSetting(Settings.System.HAPTIC_FEEDBACK_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
         assertThat(readSetting(Settings.System.HAPTIC_FEEDBACK_ENABLED)).isEqualTo(OFF);
@@ -134,8 +129,4 @@
     private int readSetting(String settingKey) throws Settings.SettingNotFoundException {
         return Settings.System.getInt(mContext.getContentResolver(), settingKey);
     }
-
-    private void showPreference() {
-        mController.displayPreference(mScreen);
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/accessibility/MagnificationFollowTypingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/MagnificationFollowTypingPreferenceControllerTest.java
index ccb66ad..fd282a0 100644
--- a/tests/robotests/src/com/android/settings/accessibility/MagnificationFollowTypingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/MagnificationFollowTypingPreferenceControllerTest.java
@@ -94,4 +94,15 @@
         assertThat(mController.isChecked()).isFalse();
         assertThat(mSwitchPreference.isChecked()).isFalse();
     }
+
+    @Test
+    public void updateState_disableFollowTyping_shouldReturnFalse() {
+        Settings.Secure.putInt(mContext.getContentResolver(), KEY_FOLLOW_TYPING, OFF);
+
+        mController.updateState();
+
+        verify(mSwitchPreference).setChecked(false);
+        assertThat(mController.isChecked()).isFalse();
+        assertThat(mSwitchPreference.isChecked()).isFalse();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/accessibility/MediaVibrationIntensityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/MediaVibrationIntensityPreferenceControllerTest.java
new file mode 100644
index 0000000..0a9f242
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/MediaVibrationIntensityPreferenceControllerTest.java
@@ -0,0 +1,138 @@
+/*
+ * 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.accessibility;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.os.VibrationAttributes;
+import android.os.Vibrator;
+import android.provider.Settings;
+
+import androidx.preference.PreferenceScreen;
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.widget.SeekBarPreference;
+import com.android.settingslib.core.lifecycle.Lifecycle;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+
+/** Test for {@link MediaVibrationIntensityPreferenceController}. */
+@RunWith(RobolectricTestRunner.class)
+public class MediaVibrationIntensityPreferenceControllerTest {
+
+    private static final String PREFERENCE_KEY = "preference_key";
+
+    @Mock private PreferenceScreen mScreen;
+
+    private Lifecycle mLifecycle;
+    private Context mContext;
+    private Vibrator mVibrator;
+    private MediaVibrationIntensityPreferenceController mController;
+    private SeekBarPreference mPreference;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mLifecycle = new Lifecycle(() -> mLifecycle);
+        mContext = ApplicationProvider.getApplicationContext();
+        mVibrator = mContext.getSystemService(Vibrator.class);
+        mController = new MediaVibrationIntensityPreferenceController(mContext, PREFERENCE_KEY,
+                Vibrator.VIBRATION_INTENSITY_HIGH);
+        mLifecycle.addObserver(mController);
+        mPreference = new SeekBarPreference(mContext);
+        mPreference.setSummary("Test summary");
+        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
+        mController.displayPreference(mScreen);
+    }
+
+    @Test
+    public void verifyConstants() {
+        assertThat(mController.getPreferenceKey()).isEqualTo(PREFERENCE_KEY);
+        assertThat(mController.getAvailabilityStatus())
+                .isEqualTo(BasePreferenceController.AVAILABLE);
+        assertThat(mController.getMin()).isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+        assertThat(mController.getMax()).isEqualTo(Vibrator.VIBRATION_INTENSITY_HIGH);
+    }
+
+    @Test
+    public void missingSetting_shouldReturnDefault() {
+        Settings.System.putString(mContext.getContentResolver(),
+                Settings.System.MEDIA_VIBRATION_INTENSITY, /* value= */ null);
+
+        mController.updateState(mPreference);
+
+        assertThat(mPreference.getProgress()).isEqualTo(
+                mVibrator.getDefaultVibrationIntensity(VibrationAttributes.USAGE_MEDIA));
+    }
+
+    @Test
+    public void updateState_shouldDisplayIntensityInSliderPosition() {
+        updateSetting(Settings.System.MEDIA_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_HIGH);
+        mController.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_HIGH);
+
+        updateSetting(Settings.System.MEDIA_VIBRATION_INTENSITY,
+                Vibrator.VIBRATION_INTENSITY_MEDIUM);
+        mController.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_MEDIUM);
+
+        updateSetting(Settings.System.MEDIA_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_LOW);
+        mController.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
+
+        updateSetting(Settings.System.MEDIA_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_OFF);
+        mController.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+    }
+
+
+    @Test
+    public void setProgress_updatesIntensitySetting() throws Exception {
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_OFF);
+        assertThat(readSetting(Settings.System.MEDIA_VIBRATION_INTENSITY))
+                .isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_LOW);
+        assertThat(readSetting(Settings.System.MEDIA_VIBRATION_INTENSITY))
+                .isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
+
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_MEDIUM);
+        assertThat(readSetting(Settings.System.MEDIA_VIBRATION_INTENSITY))
+                .isEqualTo(Vibrator.VIBRATION_INTENSITY_MEDIUM);
+
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_HIGH);
+        assertThat(readSetting(Settings.System.MEDIA_VIBRATION_INTENSITY))
+                .isEqualTo(Vibrator.VIBRATION_INTENSITY_HIGH);
+    }
+
+    private void updateSetting(String key, int value) {
+        Settings.System.putInt(mContext.getContentResolver(), key, value);
+    }
+
+    private int readSetting(String settingKey) throws Settings.SettingNotFoundException {
+        return Settings.System.getInt(mContext.getContentResolver(), settingKey);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/accessibility/MediaVibrationTogglePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/MediaVibrationTogglePreferenceControllerTest.java
new file mode 100644
index 0000000..7923cca
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/MediaVibrationTogglePreferenceControllerTest.java
@@ -0,0 +1,129 @@
+/*
+ * 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.accessibility;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.os.VibrationAttributes;
+import android.os.Vibrator;
+import android.provider.Settings;
+
+import androidx.preference.PreferenceScreen;
+import androidx.preference.SwitchPreference;
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settings.core.BasePreferenceController;
+import com.android.settingslib.core.lifecycle.Lifecycle;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+
+/** Test for {@link MediaVibrationIntensityPreferenceController}. */
+@RunWith(RobolectricTestRunner.class)
+public class MediaVibrationTogglePreferenceControllerTest {
+
+    private static final String PREFERENCE_KEY = "preference_key";
+
+    @Mock private PreferenceScreen mScreen;
+
+    private Lifecycle mLifecycle;
+    private Context mContext;
+    private Vibrator mVibrator;
+    private MediaVibrationTogglePreferenceController mController;
+    private SwitchPreference mPreference;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mLifecycle = new Lifecycle(() -> mLifecycle);
+        mContext = ApplicationProvider.getApplicationContext();
+        mVibrator = mContext.getSystemService(Vibrator.class);
+        mController = new MediaVibrationTogglePreferenceController(mContext, PREFERENCE_KEY);
+        mLifecycle.addObserver(mController);
+        mPreference = new SwitchPreference(mContext);
+        mPreference.setSummary("Test summary");
+        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
+        mController.displayPreference(mScreen);
+    }
+
+    @Test
+    public void verifyConstants() {
+        assertThat(mController.getPreferenceKey()).isEqualTo(PREFERENCE_KEY);
+        assertThat(mController.getAvailabilityStatus())
+                .isEqualTo(BasePreferenceController.AVAILABLE);
+    }
+
+    @Test
+    public void missingSetting_shouldReturnDefault() {
+        Settings.System.putString(mContext.getContentResolver(),
+                Settings.System.MEDIA_VIBRATION_INTENSITY, /* value= */ null);
+
+        mController.updateState(mPreference);
+
+        assertThat(mPreference.isChecked()).isTrue();
+    }
+
+    @Test
+    public void updateState_shouldDisplayOnOffState() {
+        updateSetting(Settings.System.MEDIA_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_HIGH);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isTrue();
+
+        updateSetting(Settings.System.MEDIA_VIBRATION_INTENSITY,
+                Vibrator.VIBRATION_INTENSITY_MEDIUM);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isTrue();
+
+        updateSetting(Settings.System.MEDIA_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_LOW);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isTrue();
+
+        updateSetting(Settings.System.MEDIA_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_OFF);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isFalse();
+    }
+
+    @Test
+    public void setChecked_updatesIntensityAndDependentSettings() throws Exception {
+        updateSetting(Settings.System.MEDIA_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_OFF);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isFalse();
+
+        mController.setChecked(true);
+        assertThat(readSetting(Settings.System.MEDIA_VIBRATION_INTENSITY)).isEqualTo(
+                mVibrator.getDefaultVibrationIntensity(VibrationAttributes.USAGE_MEDIA));
+
+        mController.setChecked(false);
+        assertThat(readSetting(Settings.System.MEDIA_VIBRATION_INTENSITY))
+                .isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+    }
+
+    private void updateSetting(String key, int value) {
+        Settings.System.putInt(mContext.getContentResolver(), key, value);
+    }
+
+    private int readSetting(String settingKey) throws Settings.SettingNotFoundException {
+        return Settings.System.getInt(mContext.getContentResolver(), settingKey);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/accessibility/NotificationVibrationIntensityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/NotificationVibrationIntensityPreferenceControllerTest.java
index 913a3d9..d0be8b5 100644
--- a/tests/robotests/src/com/android/settings/accessibility/NotificationVibrationIntensityPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/NotificationVibrationIntensityPreferenceControllerTest.java
@@ -18,7 +18,6 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
@@ -26,7 +25,6 @@
 import android.os.Vibrator;
 import android.provider.Settings;
 
-import androidx.lifecycle.LifecycleOwner;
 import androidx.preference.PreferenceScreen;
 import androidx.test.core.app.ApplicationProvider;
 
@@ -47,10 +45,8 @@
 
     private static final String PREFERENCE_KEY = "preference_key";
 
-    @Mock
-    private PreferenceScreen mScreen;
+    @Mock private PreferenceScreen mScreen;
 
-    private LifecycleOwner mLifecycleOwner;
     private Lifecycle mLifecycle;
     private Context mContext;
     private Vibrator mVibrator;
@@ -60,17 +56,16 @@
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        mLifecycleOwner = () -> mLifecycle;
-        mLifecycle = new Lifecycle(mLifecycleOwner);
-        mContext = spy(ApplicationProvider.getApplicationContext());
+        mLifecycle = new Lifecycle(() -> mLifecycle);
+        mContext = ApplicationProvider.getApplicationContext();
         mVibrator = mContext.getSystemService(Vibrator.class);
         mController = new NotificationVibrationIntensityPreferenceController(mContext,
-                PREFERENCE_KEY);
+                PREFERENCE_KEY, Vibrator.VIBRATION_INTENSITY_HIGH);
         mLifecycle.addObserver(mController);
         mPreference = new SeekBarPreference(mContext);
         mPreference.setSummary("Test summary");
         when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
-        showPreference();
+        mController.displayPreference(mScreen);
     }
 
     @Test
@@ -118,19 +113,19 @@
     @Test
     @Ignore
     public void setProgress_updatesIntensitySetting() throws Exception {
-        mPreference.setProgress(Vibrator.VIBRATION_INTENSITY_OFF);
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_OFF);
         assertThat(readSetting(Settings.System.NOTIFICATION_VIBRATION_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
 
-        mPreference.setProgress(Vibrator.VIBRATION_INTENSITY_LOW);
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_LOW);
         assertThat(readSetting(Settings.System.NOTIFICATION_VIBRATION_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
 
-        mPreference.setProgress(Vibrator.VIBRATION_INTENSITY_MEDIUM);
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_MEDIUM);
         assertThat(readSetting(Settings.System.NOTIFICATION_VIBRATION_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_MEDIUM);
 
-        mPreference.setProgress(Vibrator.VIBRATION_INTENSITY_HIGH);
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_HIGH);
         assertThat(readSetting(Settings.System.NOTIFICATION_VIBRATION_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_HIGH);
     }
@@ -142,8 +137,4 @@
     private int readSetting(String settingKey) throws Settings.SettingNotFoundException {
         return Settings.System.getInt(mContext.getContentResolver(), settingKey);
     }
-
-    private void showPreference() {
-        mController.displayPreference(mScreen);
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/accessibility/NotificationVibrationTogglePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/NotificationVibrationTogglePreferenceControllerTest.java
index b83b024..adf9436 100644
--- a/tests/robotests/src/com/android/settings/accessibility/NotificationVibrationTogglePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/NotificationVibrationTogglePreferenceControllerTest.java
@@ -18,7 +18,6 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
@@ -26,7 +25,6 @@
 import android.os.Vibrator;
 import android.provider.Settings;
 
-import androidx.lifecycle.LifecycleOwner;
 import androidx.preference.PreferenceScreen;
 import androidx.preference.SwitchPreference;
 import androidx.test.core.app.ApplicationProvider;
@@ -47,10 +45,8 @@
 
     private static final String PREFERENCE_KEY = "preference_key";
 
-    @Mock
-    private PreferenceScreen mScreen;
+    @Mock private PreferenceScreen mScreen;
 
-    private LifecycleOwner mLifecycleOwner;
     private Lifecycle mLifecycle;
     private Context mContext;
     private Vibrator mVibrator;
@@ -60,16 +56,15 @@
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        mLifecycleOwner = () -> mLifecycle;
-        mLifecycle = new Lifecycle(mLifecycleOwner);
-        mContext = spy(ApplicationProvider.getApplicationContext());
+        mLifecycle = new Lifecycle(() -> mLifecycle);
+        mContext = ApplicationProvider.getApplicationContext();
         mVibrator = mContext.getSystemService(Vibrator.class);
         mController = new NotificationVibrationTogglePreferenceController(mContext, PREFERENCE_KEY);
         mLifecycle.addObserver(mController);
         mPreference = new SwitchPreference(mContext);
         mPreference.setSummary("Test summary");
         when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
-        showPreference();
+        mController.displayPreference(mScreen);
     }
 
     @Test
@@ -118,11 +113,11 @@
         mController.updateState(mPreference);
         assertThat(mPreference.isChecked()).isFalse();
 
-        mPreference.setChecked(true);
+        mController.setChecked(true);
         assertThat(readSetting(Settings.System.NOTIFICATION_VIBRATION_INTENSITY)).isEqualTo(
                 mVibrator.getDefaultVibrationIntensity(VibrationAttributes.USAGE_NOTIFICATION));
 
-        mPreference.setChecked(false);
+        mController.setChecked(false);
         assertThat(readSetting(Settings.System.NOTIFICATION_VIBRATION_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
     }
@@ -134,8 +129,4 @@
     private int readSetting(String settingKey) throws Settings.SettingNotFoundException {
         return Settings.System.getInt(mContext.getContentResolver(), settingKey);
     }
-
-    private void showPreference() {
-        mController.displayPreference(mScreen);
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/accessibility/RingVibrationIntensityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/RingVibrationIntensityPreferenceControllerTest.java
index b653359..d891926 100644
--- a/tests/robotests/src/com/android/settings/accessibility/RingVibrationIntensityPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/RingVibrationIntensityPreferenceControllerTest.java
@@ -18,7 +18,6 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
@@ -26,7 +25,6 @@
 import android.os.Vibrator;
 import android.provider.Settings;
 
-import androidx.lifecycle.LifecycleOwner;
 import androidx.preference.PreferenceScreen;
 import androidx.test.core.app.ApplicationProvider;
 
@@ -50,10 +48,8 @@
     private static final int OFF = 0;
     private static final int ON = 1;
 
-    @Mock
-    private PreferenceScreen mScreen;
+    @Mock private PreferenceScreen mScreen;
 
-    private LifecycleOwner mLifecycleOwner;
     private Lifecycle mLifecycle;
     private Context mContext;
     private Vibrator mVibrator;
@@ -63,16 +59,16 @@
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        mLifecycleOwner = () -> mLifecycle;
-        mLifecycle = new Lifecycle(mLifecycleOwner);
-        mContext = spy(ApplicationProvider.getApplicationContext());
+        mLifecycle = new Lifecycle(() -> mLifecycle);
+        mContext = ApplicationProvider.getApplicationContext();
         mVibrator = mContext.getSystemService(Vibrator.class);
-        mController = new RingVibrationIntensityPreferenceController(mContext, PREFERENCE_KEY);
+        mController = new RingVibrationIntensityPreferenceController(mContext, PREFERENCE_KEY,
+                Vibrator.VIBRATION_INTENSITY_HIGH);
         mLifecycle.addObserver(mController);
         mPreference = new SeekBarPreference(mContext);
         mPreference.setSummary("Test summary");
         when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
-        showPreference();
+        mController.displayPreference(mScreen);
     }
 
     @Test
@@ -117,27 +113,27 @@
     @Test
     @Ignore
     public void setProgress_updatesIntensityAndDependentSettings() throws Exception {
-        mPreference.setProgress(Vibrator.VIBRATION_INTENSITY_OFF);
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_OFF);
         assertThat(readSetting(Settings.System.RING_VIBRATION_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
         assertThat(readSetting(Settings.System.VIBRATE_WHEN_RINGING)).isEqualTo(OFF);
 
-        mPreference.setProgress(Vibrator.VIBRATION_INTENSITY_LOW);
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_LOW);
         assertThat(readSetting(Settings.System.RING_VIBRATION_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
         assertThat(readSetting(Settings.System.VIBRATE_WHEN_RINGING)).isEqualTo(ON);
 
-        mPreference.setProgress(Vibrator.VIBRATION_INTENSITY_MEDIUM);
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_MEDIUM);
         assertThat(readSetting(Settings.System.RING_VIBRATION_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_MEDIUM);
         assertThat(readSetting(Settings.System.VIBRATE_WHEN_RINGING)).isEqualTo(ON);
 
-        mPreference.setProgress(Vibrator.VIBRATION_INTENSITY_HIGH);
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_HIGH);
         assertThat(readSetting(Settings.System.RING_VIBRATION_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_HIGH);
         assertThat(readSetting(Settings.System.VIBRATE_WHEN_RINGING)).isEqualTo(ON);
 
-        mPreference.setProgress(Vibrator.VIBRATION_INTENSITY_OFF);
+        mController.setSliderPosition(Vibrator.VIBRATION_INTENSITY_OFF);
         assertThat(readSetting(Settings.System.RING_VIBRATION_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
         assertThat(readSetting(Settings.System.VIBRATE_WHEN_RINGING)).isEqualTo(OFF);
@@ -150,8 +146,4 @@
     private int readSetting(String settingKey) throws Settings.SettingNotFoundException {
         return Settings.System.getInt(mContext.getContentResolver(), settingKey);
     }
-
-    private void showPreference() {
-        mController.displayPreference(mScreen);
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/accessibility/RingVibrationTogglePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/RingVibrationTogglePreferenceControllerTest.java
index f58b64b..8e85c86 100644
--- a/tests/robotests/src/com/android/settings/accessibility/RingVibrationTogglePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/RingVibrationTogglePreferenceControllerTest.java
@@ -18,7 +18,6 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
@@ -26,7 +25,6 @@
 import android.os.Vibrator;
 import android.provider.Settings;
 
-import androidx.lifecycle.LifecycleOwner;
 import androidx.preference.PreferenceScreen;
 import androidx.preference.SwitchPreference;
 import androidx.test.core.app.ApplicationProvider;
@@ -49,10 +47,8 @@
     private static final int OFF = 0;
     private static final int ON = 1;
 
-    @Mock
-    private PreferenceScreen mScreen;
+    @Mock private PreferenceScreen mScreen;
 
-    private LifecycleOwner mLifecycleOwner;
     private Lifecycle mLifecycle;
     private Context mContext;
     private Vibrator mVibrator;
@@ -62,16 +58,15 @@
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        mLifecycleOwner = () -> mLifecycle;
-        mLifecycle = new Lifecycle(mLifecycleOwner);
-        mContext = spy(ApplicationProvider.getApplicationContext());
+        mLifecycle = new Lifecycle(() -> mLifecycle);
+        mContext = ApplicationProvider.getApplicationContext();
         mVibrator = mContext.getSystemService(Vibrator.class);
         mController = new RingVibrationTogglePreferenceController(mContext, PREFERENCE_KEY);
         mLifecycle.addObserver(mController);
         mPreference = new SwitchPreference(mContext);
         mPreference.setSummary("Test summary");
         when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
-        showPreference();
+        mController.displayPreference(mScreen);
     }
 
     @Test
@@ -116,12 +111,12 @@
         mController.updateState(mPreference);
         assertThat(mPreference.isChecked()).isFalse();
 
-        mPreference.setChecked(true);
+        mController.setChecked(true);
         assertThat(readSetting(Settings.System.RING_VIBRATION_INTENSITY)).isEqualTo(
                 mVibrator.getDefaultVibrationIntensity(VibrationAttributes.USAGE_RINGTONE));
         assertThat(readSetting(Settings.System.VIBRATE_WHEN_RINGING)).isEqualTo(ON);
 
-        mPreference.setChecked(false);
+        mController.setChecked(false);
         assertThat(readSetting(Settings.System.RING_VIBRATION_INTENSITY))
                 .isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
         assertThat(readSetting(Settings.System.VIBRATE_WHEN_RINGING)).isEqualTo(OFF);
@@ -134,8 +129,4 @@
     private int readSetting(String settingKey) throws Settings.SettingNotFoundException {
         return Settings.System.getInt(mContext.getContentResolver(), settingKey);
     }
-
-    private void showPreference() {
-        mController.displayPreference(mScreen);
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/accessibility/TextReadingPreviewPreferenceTest.java b/tests/robotests/src/com/android/settings/accessibility/TextReadingPreviewPreferenceTest.java
new file mode 100644
index 0000000..6b9395a
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/TextReadingPreviewPreferenceTest.java
@@ -0,0 +1,115 @@
+/*
+ * 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.accessibility;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+import android.content.res.Configuration;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.LinearLayout;
+
+import androidx.preference.PreferenceViewHolder;
+import androidx.test.core.app.ApplicationProvider;
+import androidx.viewpager.widget.ViewPager;
+
+import com.android.settings.R;
+import com.android.settings.display.PreviewPagerAdapter;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+
+/**
+ * Tests for {@link TextReadingPreferenceFragment}.
+ */
+@RunWith(RobolectricTestRunner.class)
+public class TextReadingPreviewPreferenceTest {
+
+    private TextReadingPreviewPreference mTextReadingPreviewPreference;
+    private PreferenceViewHolder mHolder;
+    private ViewPager mViewPager;
+    private PreviewPagerAdapter mPreviewPagerAdapter;
+
+    @Before
+    public void setUp() {
+        final Context context = ApplicationProvider.getApplicationContext();
+        final int[] sampleResIds = new int[]{1, 2, 3, 4, 5, 6};
+        final Configuration[] configurations = createConfigurations(6);
+        mTextReadingPreviewPreference = new TextReadingPreviewPreference(context);
+        mPreviewPagerAdapter =
+                new PreviewPagerAdapter(context, /* isLayoutRtl= */ false, sampleResIds,
+                        configurations);
+        final LayoutInflater inflater = LayoutInflater.from(context);
+        final View view =
+                inflater.inflate(mTextReadingPreviewPreference.getLayoutResource(),
+                        new LinearLayout(context), false);
+        mHolder = PreferenceViewHolder.createInstanceForTests(view);
+        mViewPager = view.findViewById(R.id.preview_pager);
+    }
+
+    @Test
+    public void setPreviewerAdapter_success() {
+        mTextReadingPreviewPreference.setPreviewAdapter(mPreviewPagerAdapter);
+        mTextReadingPreviewPreference.onBindViewHolder(mHolder);
+
+        assertThat(mViewPager.getAdapter()).isEqualTo(mPreviewPagerAdapter);
+    }
+
+    @Test
+    public void setPreviewAdapterWithNull_resetCurrentItem() {
+        final int currentItem = 2;
+        mTextReadingPreviewPreference.setPreviewAdapter(mPreviewPagerAdapter);
+        mTextReadingPreviewPreference.setCurrentItem(currentItem);
+        mTextReadingPreviewPreference.onBindViewHolder(mHolder);
+
+        mTextReadingPreviewPreference.setPreviewAdapter(null);
+        mTextReadingPreviewPreference.onBindViewHolder(mHolder);
+
+        assertThat(mTextReadingPreviewPreference.getCurrentItem()).isEqualTo(0);
+    }
+
+    @Test
+    public void setCurrentItem_success() {
+        final int currentItem = 3;
+        mTextReadingPreviewPreference.setPreviewAdapter(mPreviewPagerAdapter);
+        mTextReadingPreviewPreference.onBindViewHolder(mHolder);
+
+        mTextReadingPreviewPreference.setCurrentItem(currentItem);
+        mTextReadingPreviewPreference.onBindViewHolder(mHolder);
+
+        assertThat(mViewPager.getCurrentItem()).isEqualTo(currentItem);
+    }
+
+    @Test(expected = NullPointerException.class)
+    public void setCurrentItemBeforeSetPreviewAdapter_throwNPE() {
+        final int currentItem = 5;
+
+        mTextReadingPreviewPreference.setCurrentItem(currentItem);
+    }
+
+    private static Configuration[] createConfigurations(int count) {
+        final Configuration[] configurations = new Configuration[count];
+        for (int i = 0; i < count; i++) {
+            configurations[i] = new Configuration();
+        }
+
+        return configurations;
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java
index c47a793..4584b15 100644
--- a/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java
@@ -20,6 +20,8 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
@@ -27,6 +29,7 @@
 import static org.mockito.Mockito.when;
 
 import android.content.ComponentName;
+import android.content.ContentResolver;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.os.Bundle;
@@ -75,12 +78,16 @@
             Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE;
 
     private TestToggleFeaturePreferenceFragment mFragment;
-    private PreferenceScreen mScreen;
-    private Context mContext = ApplicationProvider.getApplicationContext();
+    private final Context mContext = ApplicationProvider.getApplicationContext();
 
     @Mock(answer = Answers.RETURNS_DEEP_STUBS)
     private PreferenceManager mPreferenceManager;
 
+    @Mock
+    private FragmentActivity mActivity;
+    @Mock
+    private ContentResolver mContentResolver;
+
     @Before
     public void setUpTestFragment() {
         MockitoAnnotations.initMocks(this);
@@ -89,9 +96,11 @@
         when(mFragment.getPreferenceManager()).thenReturn(mPreferenceManager);
         when(mFragment.getPreferenceManager().getContext()).thenReturn(mContext);
         when(mFragment.getContext()).thenReturn(mContext);
-        mScreen = spy(new PreferenceScreen(mContext, null));
-        when(mScreen.getPreferenceManager()).thenReturn(mPreferenceManager);
-        doReturn(mScreen).when(mFragment).getPreferenceScreen();
+        when(mFragment.getActivity()).thenReturn(mActivity);
+        when(mActivity.getContentResolver()).thenReturn(mContentResolver);
+        final PreferenceScreen screen = spy(new PreferenceScreen(mContext, null));
+        when(screen.getPreferenceManager()).thenReturn(mPreferenceManager);
+        doReturn(screen).when(mFragment).getPreferenceScreen();
     }
 
     @Test
@@ -104,6 +113,25 @@
     }
 
     @Test
+    @Config(shadows = {ShadowFragment.class})
+    public void onResume_haveRegisterToSpecificUris() {
+        mFragment.onAttach(mContext);
+        mFragment.onCreate(Bundle.EMPTY);
+
+        mFragment.onResume();
+
+        verify(mContentResolver).registerContentObserver(
+                eq(Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS)),
+                eq(false),
+                any(AccessibilitySettingsContentObserver.class));
+        verify(mContentResolver).registerContentObserver(
+                eq(Settings.Secure.getUriFor(
+                        Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE)),
+                eq(false),
+                any(AccessibilitySettingsContentObserver.class));
+    }
+
+    @Test
     public void updateShortcutPreferenceData_assignDefaultValueToVariable() {
         mFragment.mComponentName = PLACEHOLDER_COMPONENT_NAME;
 
diff --git a/tests/robotests/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragmentTest.java
index 10495c5..8500e61 100644
--- a/tests/robotests/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragmentTest.java
@@ -25,14 +25,15 @@
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import android.content.ComponentName;
+import android.content.ContentResolver;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.res.Resources;
@@ -63,8 +64,8 @@
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
-import org.robolectric.Robolectric;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.annotation.Config;
 
@@ -96,17 +97,22 @@
     private Context mContext;
     private Resources mResources;
 
+    @Mock
+    private FragmentActivity mActivity;
+    @Mock
+    private ContentResolver mContentResolver;
+
     @Before
     public void setUpTestFragment() {
         MockitoAnnotations.initMocks(this);
 
         mContext = spy(ApplicationProvider.getApplicationContext());
-        final FragmentActivity activity = Robolectric.setupActivity(FragmentActivity.class);
         mFragment = spy(new TestToggleScreenMagnificationPreferenceFragment(mContext));
         mResources = spy(mContext.getResources());
         when(mContext.getResources()).thenReturn(mResources);
         when(mFragment.getContext().getResources()).thenReturn(mResources);
-        doReturn(activity).when(mFragment).getActivity();
+        when(mFragment.getActivity()).thenReturn(mActivity);
+        when(mActivity.getContentResolver()).thenReturn(mContentResolver);
     }
 
     @Ignore("Ignore it since a NPE is happened in ShadowWindowManagerGlobal. (Ref. b/214161063)")
@@ -143,6 +149,30 @@
     }
 
     @Test
+    @Config(shadows = {ShadowFragment.class})
+    public void onResume_haveRegisterToSpecificUris() {
+        mFragment.onAttach(mContext);
+        mFragment.onCreate(Bundle.EMPTY);
+
+        mFragment.onResume();
+
+        verify(mContentResolver).registerContentObserver(
+                eq(Settings.Secure.getUriFor(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS)),
+                eq(false),
+                any(AccessibilitySettingsContentObserver.class));
+        verify(mContentResolver).registerContentObserver(
+                eq(Settings.Secure.getUriFor(
+                        Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE)),
+                eq(false),
+                any(AccessibilitySettingsContentObserver.class));
+        verify(mContentResolver).registerContentObserver(
+                eq(Settings.Secure.getUriFor(
+                        Settings.Secure.ACCESSIBILITY_MAGNIFICATION_FOLLOW_TYPING_ENABLED)),
+                eq(false),
+                any(AccessibilitySettingsContentObserver.class));
+    }
+
+    @Test
     public void hasValueInSettings_putValue_hasValue() {
         setMagnificationTripleTapEnabled(/* enabled= */ true);
 
diff --git a/tests/robotests/src/com/android/settings/accessibility/VibrationIntensityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/VibrationIntensityPreferenceControllerTest.java
new file mode 100644
index 0000000..048bce4
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/VibrationIntensityPreferenceControllerTest.java
@@ -0,0 +1,261 @@
+/*
+ * Copyright (C) 2018 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.accessibility;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.os.VibrationAttributes;
+import android.os.Vibrator;
+import android.provider.Settings;
+
+import androidx.preference.PreferenceScreen;
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settings.widget.SeekBarPreference;
+import com.android.settingslib.core.lifecycle.Lifecycle;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+
+/** Tests for {@link VibrationIntensityPreferenceController}. */
+@RunWith(RobolectricTestRunner.class)
+public class VibrationIntensityPreferenceControllerTest {
+
+    private static final String SETTING_KEY = Settings.System.NOTIFICATION_VIBRATION_INTENSITY;
+    private static final int VIBRATION_USAGE = VibrationAttributes.USAGE_NOTIFICATION;
+    private static final int OFF = 0;
+    private static final int ON = 1;
+
+    /** Basic implementation of preference controller to test generic behavior. */
+    private static class TestPreferenceController extends VibrationIntensityPreferenceController {
+
+        TestPreferenceController(Context context, int supportedIntensityLevels) {
+            super(context, "preference_key",
+                    new VibrationPreferenceConfig(context, SETTING_KEY, VIBRATION_USAGE) {},
+                    supportedIntensityLevels);
+        }
+
+        @Override
+        public int getAvailabilityStatus() {
+            return AVAILABLE;
+        }
+    }
+
+    @Mock private PreferenceScreen mScreen;
+
+    private Lifecycle mLifecycle;
+    private Context mContext;
+    private Vibrator mVibrator;
+    private SeekBarPreference mPreference;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mLifecycle = new Lifecycle(() -> mLifecycle);
+        mContext = ApplicationProvider.getApplicationContext();
+        mVibrator = mContext.getSystemService(Vibrator.class);
+    }
+
+    @Test
+    public void missingSetting_shouldReturnDefault() {
+        VibrationIntensityPreferenceController controller = createPreferenceController(3);
+        Settings.System.putString(mContext.getContentResolver(), SETTING_KEY, /* value= */ null);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress())
+                .isEqualTo(mVibrator.getDefaultVibrationIntensity(VIBRATION_USAGE));
+    }
+
+    @Test
+    public void updateState_mainSwitchUpdates_shouldPreserveSettingBetweenUpdates() {
+        VibrationIntensityPreferenceController controller = createPreferenceController(3);
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_LOW);
+
+        updateSetting(VibrationPreferenceConfig.MAIN_SWITCH_SETTING_KEY, ON);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
+        assertThat(mPreference.isEnabled()).isTrue();
+
+        updateSetting(VibrationPreferenceConfig.MAIN_SWITCH_SETTING_KEY, OFF);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+        assertThat(mPreference.isEnabled()).isFalse();
+
+        updateSetting(VibrationPreferenceConfig.MAIN_SWITCH_SETTING_KEY, ON);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
+        assertThat(mPreference.isEnabled()).isTrue();
+    }
+
+    @Test
+    public void updateState_allLevelsSupported_shouldDisplayIntensityInSliderPosition() {
+        VibrationIntensityPreferenceController controller = createPreferenceController(3);
+
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_HIGH);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_HIGH);
+
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_MEDIUM);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_MEDIUM);
+
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_LOW);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
+
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_OFF);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+    }
+
+    @Test
+    public void updateState_twoLevelsSupported_shouldDisplayMediumAndHighAtLastPosition() {
+        VibrationIntensityPreferenceController controller = createPreferenceController(2);
+
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_HIGH);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_MEDIUM);
+
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_MEDIUM);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_MEDIUM);
+
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_LOW);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
+
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_OFF);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+    }
+
+    @Test
+    public void updateState_oneLevelSupported_shouldDisplayAllAtLastPosition() {
+        VibrationIntensityPreferenceController controller = createPreferenceController(1);
+
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_HIGH);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
+
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_MEDIUM);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
+
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_LOW);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
+
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_OFF);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+    }
+
+    @Test
+    public void setProgress_mainSwitchDisabled_ignoresUpdates() throws Exception {
+        VibrationIntensityPreferenceController controller = createPreferenceController(3);
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_LOW);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
+
+        updateSetting(VibrationPreferenceConfig.MAIN_SWITCH_SETTING_KEY, OFF);
+        controller.updateState(mPreference);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+        assertThat(mPreference.isEnabled()).isFalse();
+
+        assertThat(controller.setSliderPosition(Vibrator.VIBRATION_INTENSITY_HIGH)).isFalse();
+        assertThat(readSetting(SETTING_KEY)).isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
+        assertThat(mPreference.getProgress()).isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+    }
+    @Test
+    public void setProgress_allSupportedPositions_updatesIntensitySetting() throws Exception {
+        VibrationIntensityPreferenceController controller = createPreferenceController(3);
+
+        controller.setSliderPosition(Vibrator.VIBRATION_INTENSITY_OFF);
+        assertThat(readSetting(SETTING_KEY)).isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+
+        controller.setSliderPosition(Vibrator.VIBRATION_INTENSITY_LOW);
+        assertThat(readSetting(SETTING_KEY)).isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
+
+        controller.setSliderPosition(Vibrator.VIBRATION_INTENSITY_MEDIUM);
+        assertThat(readSetting(SETTING_KEY)).isEqualTo(Vibrator.VIBRATION_INTENSITY_MEDIUM);
+
+        controller.setSliderPosition(Vibrator.VIBRATION_INTENSITY_HIGH);
+        assertThat(readSetting(SETTING_KEY)).isEqualTo(Vibrator.VIBRATION_INTENSITY_HIGH);
+    }
+
+    @Test
+    public void setProgress_twoSupportedPositions_updatesMediumPositionToHigh() throws Exception {
+        VibrationIntensityPreferenceController controller = createPreferenceController(2);
+
+        controller.setSliderPosition(Vibrator.VIBRATION_INTENSITY_OFF);
+        assertThat(readSetting(SETTING_KEY)).isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+
+        controller.setSliderPosition(Vibrator.VIBRATION_INTENSITY_LOW);
+        assertThat(readSetting(SETTING_KEY)).isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
+
+        controller.setSliderPosition(Vibrator.VIBRATION_INTENSITY_MEDIUM);
+        assertThat(readSetting(SETTING_KEY)).isEqualTo(Vibrator.VIBRATION_INTENSITY_HIGH);
+
+        controller.setSliderPosition(Vibrator.VIBRATION_INTENSITY_HIGH);
+        assertThat(readSetting(SETTING_KEY)).isEqualTo(Vibrator.VIBRATION_INTENSITY_HIGH);
+    }
+
+    @Test
+    public void setProgress_oneSupportedPosition_updatesOnPositionsToDeviceDefault()
+            throws Exception {
+        int defaultIntensity = mVibrator.getDefaultVibrationIntensity(VIBRATION_USAGE);
+        VibrationIntensityPreferenceController controller = createPreferenceController(1);
+
+        controller.setSliderPosition(Vibrator.VIBRATION_INTENSITY_OFF);
+        assertThat(readSetting(SETTING_KEY)).isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+
+        controller.setSliderPosition(Vibrator.VIBRATION_INTENSITY_LOW);
+        assertThat(readSetting(SETTING_KEY)).isEqualTo(defaultIntensity);
+
+        controller.setSliderPosition(Vibrator.VIBRATION_INTENSITY_MEDIUM);
+        assertThat(readSetting(SETTING_KEY)).isEqualTo(defaultIntensity);
+
+        controller.setSliderPosition(Vibrator.VIBRATION_INTENSITY_HIGH);
+        assertThat(readSetting(SETTING_KEY)).isEqualTo(defaultIntensity);
+    }
+
+    private void updateSetting(String key, int value) {
+        Settings.System.putInt(mContext.getContentResolver(), key, value);
+    }
+
+    private int readSetting(String settingKey) throws Settings.SettingNotFoundException {
+        return Settings.System.getInt(mContext.getContentResolver(), settingKey);
+    }
+
+    private VibrationIntensityPreferenceController createPreferenceController(
+            int supportedIntensityLevels) {
+        VibrationIntensityPreferenceController controller =
+                new TestPreferenceController(mContext, supportedIntensityLevels);
+        mLifecycle.addObserver(controller);
+        mPreference = new SeekBarPreference(mContext);
+        mPreference.setSummary("Test summary");
+        when(mScreen.findPreference(controller.getPreferenceKey())).thenReturn(mPreference);
+        controller.displayPreference(mScreen);
+        return controller;
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/accessibility/VibrationMainSwitchPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/VibrationMainSwitchPreferenceControllerTest.java
new file mode 100644
index 0000000..6f57003
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/VibrationMainSwitchPreferenceControllerTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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.accessibility;
+
+import static com.android.settings.accessibility.AccessibilityUtil.State.OFF;
+import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.preference.PreferenceScreen;
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.widget.MainSwitchPreference;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+
+/** Tests for {@link VibrationMainSwitchPreferenceController}. */
+@RunWith(RobolectricTestRunner.class)
+public class VibrationMainSwitchPreferenceControllerTest {
+
+    private static final String PREFERENCE_KEY = "preference_key";
+
+    @Mock private PreferenceScreen mScreen;
+
+    private Lifecycle mLifecycle;
+    private Context mContext;
+    private VibrationMainSwitchPreferenceController mController;
+    private MainSwitchPreference mPreference;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mLifecycle = new Lifecycle(() -> mLifecycle);
+        mContext = ApplicationProvider.getApplicationContext();
+        mController = new VibrationMainSwitchPreferenceController(mContext, PREFERENCE_KEY);
+        mLifecycle.addObserver(mController);
+        mPreference = new MainSwitchPreference(mContext);
+        mPreference.setTitle("Test title");
+        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
+        mController.displayPreference(mScreen);
+    }
+
+    @Test
+    public void verifyConstants() {
+        assertThat(mController.getPreferenceKey()).isEqualTo(PREFERENCE_KEY);
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
+    }
+
+    @Test
+    public void updateState_shouldReturnTheSettingState() {
+        updateSetting(Settings.System.VIBRATE_ON, ON);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isTrue();
+
+        updateSetting(Settings.System.VIBRATE_ON, OFF);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isFalse();
+    }
+
+    @Test
+    public void setChecked_updatesSetting() throws Settings.SettingNotFoundException {
+        updateSetting(Settings.System.VIBRATE_ON, OFF);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isFalse();
+
+        mController.setChecked(true);
+        assertThat(readSetting(Settings.System.VIBRATE_ON)).isEqualTo(ON);
+
+        mController.setChecked(false);
+        assertThat(readSetting(Settings.System.VIBRATE_ON)).isEqualTo(OFF);
+    }
+
+    private void updateSetting(String key, int value) {
+        Settings.System.putInt(mContext.getContentResolver(), key, value);
+    }
+
+    private int readSetting(String settingKey) throws Settings.SettingNotFoundException {
+        return Settings.System.getInt(mContext.getContentResolver(), settingKey);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/accessibility/VibrationRampingRingerTogglePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/VibrationRampingRingerTogglePreferenceControllerTest.java
index 630de33..1f2c0d9 100644
--- a/tests/robotests/src/com/android/settings/accessibility/VibrationRampingRingerTogglePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/VibrationRampingRingerTogglePreferenceControllerTest.java
@@ -30,11 +30,9 @@
 import android.content.Context;
 import android.media.AudioManager;
 import android.os.Vibrator;
-import android.provider.DeviceConfig;
 import android.provider.Settings;
 import android.telephony.TelephonyManager;
 
-import androidx.lifecycle.LifecycleOwner;
 import androidx.preference.PreferenceScreen;
 import androidx.preference.SwitchPreference;
 import androidx.test.core.app.ApplicationProvider;
@@ -54,14 +52,12 @@
 
     private static final String PREFERENCE_KEY = "preference_key";
 
-    @Mock
-    private PreferenceScreen mScreen;
-    @Mock
-    private TelephonyManager mTelephonyManager;
-    @Mock
-    private AudioManager mAudioManager;
+    @Mock private PreferenceScreen mScreen;
+    @Mock private TelephonyManager mTelephonyManager;
+    @Mock private AudioManager mAudioManager;
+    @Mock private VibrationRampingRingerTogglePreferenceController.DeviceConfigProvider
+            mDeviceConfigProvider;
 
-    private LifecycleOwner mLifecycleOwner;
     private Lifecycle mLifecycle;
     private Context mContext;
     private VibrationRampingRingerTogglePreferenceController mController;
@@ -70,18 +66,17 @@
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        mLifecycleOwner = () -> mLifecycle;
-        mLifecycle = new Lifecycle(mLifecycleOwner);
+        mLifecycle = new Lifecycle(() -> mLifecycle);
         mContext = spy(ApplicationProvider.getApplicationContext());
         when(mContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mTelephonyManager);
         when(mContext.getSystemService(Context.AUDIO_SERVICE)).thenReturn(mAudioManager);
         mController = new VibrationRampingRingerTogglePreferenceController(mContext,
-                PREFERENCE_KEY);
+                PREFERENCE_KEY, mDeviceConfigProvider);
         mLifecycle.addObserver(mController);
         mPreference = new SwitchPreference(mContext);
         mPreference.setSummary("Test summary");
         when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
-        showPreference();
+        mController.displayPreference(mScreen);
     }
 
     @Test
@@ -93,8 +88,7 @@
     @Ignore
     public void getAvailabilityStatus_notVoiceCapable_returnUnsupportedOnDevice() {
         when(mTelephonyManager.isVoiceCapable()).thenReturn(false);
-        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_TELEPHONY,
-                VibrationRampingRingerTogglePreferenceController.DEVICE_CONFIG_KEY, "false", false);
+        when(mDeviceConfigProvider.isRampingRingerEnabledOnTelephonyConfig()).thenReturn(false);
 
         assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
     }
@@ -103,8 +97,7 @@
     @Ignore
     public void getAvailabilityStatus_rampingRingerEnabled_returnUnsupportedOnDevice() {
         when(mTelephonyManager.isVoiceCapable()).thenReturn(true);
-        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_TELEPHONY,
-                VibrationRampingRingerTogglePreferenceController.DEVICE_CONFIG_KEY, "true", false);
+        when(mDeviceConfigProvider.isRampingRingerEnabledOnTelephonyConfig()).thenReturn(true);
 
         assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
     }
@@ -113,8 +106,7 @@
     @Ignore
     public void getAvailabilityStatus_voiceCapableAndRampingRingerDisabled_returnAvailable() {
         when(mTelephonyManager.isVoiceCapable()).thenReturn(true);
-        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_TELEPHONY,
-                VibrationRampingRingerTogglePreferenceController.DEVICE_CONFIG_KEY, "false", false);
+        when(mDeviceConfigProvider.isRampingRingerEnabledOnTelephonyConfig()).thenReturn(false);
 
         assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
     }
@@ -147,8 +139,8 @@
     public void setChecked_withRingDisabled_ignoresUpdates() {
         updateSetting(Settings.System.RING_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_OFF);
 
-        mPreference.setChecked(true);
-        mPreference.setChecked(false);
+        mController.setChecked(true);
+        mController.setChecked(false);
         verify(mAudioManager, never()).setRampingRingerEnabled(anyBoolean());
     }
 
@@ -157,18 +149,14 @@
     public void setChecked_withRingEnabled_updatesSetting() {
         updateSetting(Settings.System.RING_VIBRATION_INTENSITY, Vibrator.VIBRATION_INTENSITY_HIGH);
 
-        mPreference.setChecked(true);
+        mController.setChecked(true);
         verify(mAudioManager).setRampingRingerEnabled(true);
 
-        mPreference.setChecked(false);
+        mController.setChecked(false);
         verify(mAudioManager).setRampingRingerEnabled(false);
     }
 
     private void updateSetting(String key, int value) {
         Settings.System.putInt(mContext.getContentResolver(), key, value);
     }
-
-    private void showPreference() {
-        mController.displayPreference(mScreen);
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/accessibility/VibrationTogglePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/VibrationTogglePreferenceControllerTest.java
new file mode 100644
index 0000000..cb4a07e
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/VibrationTogglePreferenceControllerTest.java
@@ -0,0 +1,172 @@
+/*
+ * 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.accessibility;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.os.VibrationAttributes;
+import android.os.Vibrator;
+import android.provider.Settings;
+
+import androidx.preference.PreferenceScreen;
+import androidx.preference.SwitchPreference;
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settingslib.core.lifecycle.Lifecycle;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+
+/** Tests for {@link VibrationTogglePreferenceController}. */
+@RunWith(RobolectricTestRunner.class)
+public class VibrationTogglePreferenceControllerTest {
+
+    private static final String SETTING_KEY = Settings.System.NOTIFICATION_VIBRATION_INTENSITY;
+    private static final int VIBRATION_USAGE = VibrationAttributes.USAGE_NOTIFICATION;
+    private static final int OFF = 0;
+    private static final int ON = 1;
+
+    /** Basic implementation of preference controller to test generic behavior. */
+    private static class TestPreferenceController extends VibrationTogglePreferenceController {
+
+        TestPreferenceController(Context context) {
+            super(context, "preference_key",
+                    new VibrationPreferenceConfig(context, SETTING_KEY, VIBRATION_USAGE) {});
+        }
+
+        @Override
+        public int getAvailabilityStatus() {
+            return AVAILABLE;
+        }
+    }
+
+    @Mock private PreferenceScreen mScreen;
+
+    private Lifecycle mLifecycle;
+    private Context mContext;
+    private Vibrator mVibrator;
+    private SwitchPreference mPreference;
+    private VibrationTogglePreferenceController mController;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mLifecycle = new Lifecycle(() -> mLifecycle);
+        mContext = ApplicationProvider.getApplicationContext();
+        mVibrator = mContext.getSystemService(Vibrator.class);
+        mController = new TestPreferenceController(mContext);
+        mLifecycle.addObserver(mController);
+        mPreference = new SwitchPreference(mContext);
+        mPreference.setTitle("Test title");
+        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
+        mController.displayPreference(mScreen);
+    }
+
+    @Test
+    public void missingSetting_shouldBeCheckedByDefault() {
+        Settings.System.putString(mContext.getContentResolver(), SETTING_KEY, /* value= */ null);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isTrue();
+    }
+
+    @Test
+    public void updateState_mainSwitchUpdates_shouldPreserveSettingBetweenUpdates() {
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_LOW);
+
+        updateSetting(VibrationPreferenceConfig.MAIN_SWITCH_SETTING_KEY, ON);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isTrue();
+        assertThat(mPreference.isEnabled()).isTrue();
+
+        updateSetting(VibrationPreferenceConfig.MAIN_SWITCH_SETTING_KEY, OFF);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isFalse();
+        assertThat(mPreference.isEnabled()).isFalse();
+
+        updateSetting(VibrationPreferenceConfig.MAIN_SWITCH_SETTING_KEY, ON);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isTrue();
+        assertThat(mPreference.isEnabled()).isTrue();
+    }
+
+    @Test
+    public void updateState_shouldUpdateToggleState() {
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_HIGH);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isTrue();
+
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_OFF);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isFalse();
+
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_MEDIUM);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isTrue();
+
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_OFF);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isFalse();
+
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_LOW);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isTrue();
+    }
+
+    @Test
+    public void setProgress_mainSwitchDisabled_ignoresUpdates() throws Exception {
+        updateSetting(SETTING_KEY, Vibrator.VIBRATION_INTENSITY_LOW);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isTrue();
+
+        updateSetting(VibrationPreferenceConfig.MAIN_SWITCH_SETTING_KEY, OFF);
+        mController.updateState(mPreference);
+        assertThat(mPreference.isChecked()).isFalse();
+
+        mController.setChecked(true);
+        assertThat(readSetting(SETTING_KEY)).isEqualTo(Vibrator.VIBRATION_INTENSITY_LOW);
+        assertThat(mPreference.isChecked()).isFalse();
+        assertThat(mPreference.isEnabled()).isFalse();
+
+    }
+    @Test
+    public void setProgress_updatesCheckedState() throws Exception {
+        mController.setChecked(false);
+        assertThat(readSetting(SETTING_KEY)).isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+
+        mController.setChecked(true);
+        assertThat(readSetting(SETTING_KEY))
+                .isEqualTo(mVibrator.getDefaultVibrationIntensity(VIBRATION_USAGE));
+
+        mController.setChecked(false);
+        assertThat(readSetting(SETTING_KEY)).isEqualTo(Vibrator.VIBRATION_INTENSITY_OFF);
+    }
+
+    private void updateSetting(String key, int value) {
+        Settings.System.putInt(mContext.getContentResolver(), key, value);
+    }
+
+    private int readSetting(String settingKey) throws Settings.SettingNotFoundException {
+        return Settings.System.getInt(mContext.getContentResolver(), settingKey);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/accounts/WorkModePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accounts/WorkModePreferenceControllerTest.java
index c7e571f..b5d1cc7 100644
--- a/tests/robotests/src/com/android/settings/accounts/WorkModePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/WorkModePreferenceControllerTest.java
@@ -18,6 +18,7 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
@@ -32,7 +33,6 @@
 import com.android.settings.R;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -106,10 +106,9 @@
     }
 
     @Test
-    @Ignore
     public void onStart_shouldRegisterReceiver() {
         mController.onStart();
-        verify(mContext).registerReceiver(eq(mController.mReceiver), any());
+        verify(mContext).registerReceiver(eq(mController.mReceiver), any(), anyInt());
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/bluetooth/AlwaysDiscoverableTest.java b/tests/robotests/src/com/android/settings/bluetooth/AlwaysDiscoverableTest.java
index 89e76b4..03e6e89 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/AlwaysDiscoverableTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/AlwaysDiscoverableTest.java
@@ -26,7 +26,6 @@
 import android.content.Intent;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -75,13 +74,13 @@
     }
 
     @Test
-    @Ignore
     public void startSetsModeAndRegistersReceiver() {
         mBluetoothAdapter.setScanMode(BluetoothAdapter.SCAN_MODE_NONE);
         mAlwaysDiscoverable.start();
         assertThat(mBluetoothAdapter.getScanMode())
                 .isEqualTo(BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE);
-        verify(mContext).registerReceiver(eq(mAlwaysDiscoverable), any());
+        verify(mContext).registerReceiver(eq(mAlwaysDiscoverable), any(),
+                eq(Context.RECEIVER_EXPORTED_UNAUDITED));
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java
index c18537b..cc1087e 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java
@@ -19,6 +19,7 @@
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
@@ -47,7 +48,6 @@
 
 import org.junit.Before;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
@@ -206,11 +206,11 @@
     }
 
     @Test
-    @Ignore
     public void bluetoothTurnsOff_switchTurnsOff() {
         // Start up with bluetooth turned on. The switch should get turned on.
         ArgumentCaptor<BroadcastReceiver> captor = ArgumentCaptor.forClass(BroadcastReceiver.class);
-        when(mContext.registerReceiver(captor.capture(), any(IntentFilter.class))).thenReturn(null);
+        when(mContext.registerReceiver(captor.capture(), any(IntentFilter.class),
+                eq(Context.RECEIVER_EXPORTED_UNAUDITED))).thenReturn(null);
         mShadowBluetoothAdapter.setState(BluetoothAdapter.STATE_ON);
         verify(mSwitchController, never()).setChecked(anyBoolean());
         mBluetoothEnabler.resume(mContext);
@@ -231,11 +231,11 @@
     }
 
     @Test
-    @Ignore
     public void bluetoothTurnsOn_switchTurnsOn() {
         // Start up with bluetooth turned on. The switch should be left off.
         ArgumentCaptor<BroadcastReceiver> captor = ArgumentCaptor.forClass(BroadcastReceiver.class);
-        when(mContext.registerReceiver(captor.capture(), any(IntentFilter.class))).thenReturn(null);
+        when(mContext.registerReceiver(captor.capture(), any(IntentFilter.class),
+                eq(Context.RECEIVER_EXPORTED_UNAUDITED))).thenReturn(null);
         mShadowBluetoothAdapter.setState(BluetoothAdapter.STATE_OFF);
         verify(mSwitchController, never()).setChecked(anyBoolean());
         mBluetoothEnabler.resume(mContext);
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceControllerTest.java
index 3b7b698..e9d834c 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/PreviouslyConnectedDevicePreferenceControllerTest.java
@@ -47,7 +47,6 @@
 import com.android.settingslib.bluetooth.CachedBluetoothDevice;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -155,16 +154,21 @@
     }
 
     @Test
-    @Ignore
-    public void callbackCanRegisterAndUnregister() {
+    public void onStart_registerCallback() {
         // register the callback in onStart()
         mPreConnectedDeviceController.onStart();
 
         verify(mBluetoothDeviceUpdater).registerCallback();
         verify(mDockUpdater).registerCallback();
         verify(mContext).registerReceiver(mPreConnectedDeviceController.mReceiver,
-                mPreConnectedDeviceController.mIntentFilter);
+                mPreConnectedDeviceController.mIntentFilter, Context.RECEIVER_EXPORTED_UNAUDITED);
         verify(mBluetoothDeviceUpdater).refreshPreference();
+    }
+
+    @Test
+    public void onStop_unregisterCallback() {
+        // register it first
+        mContext.registerReceiver(mPreConnectedDeviceController.mReceiver, null);
 
         // unregister the callback in onStop()
         mPreConnectedDeviceController.onStop();
diff --git a/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectDialogTest.java b/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectDialogTest.java
index 75a1c39..53cddb1 100644
--- a/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectDialogTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/profileselector/ProfileSelectDialogTest.java
@@ -43,8 +43,8 @@
 @RunWith(RobolectricTestRunner.class)
 public class ProfileSelectDialogTest {
 
-    private static final UserHandle NORMAL_USER = UserHandle.of(1111);
-    private static final UserHandle REMOVED_USER = UserHandle.of(2222);
+    private static final UserHandle NORMAL_USER = new UserHandle(1111);
+    private static final UserHandle REMOVED_USER = new UserHandle(2222);
 
     @Mock
     private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/deletionhelper/AutomaticStorageManagerSwitchBarControllerTest.java b/tests/robotests/src/com/android/settings/deletionhelper/AutomaticStorageManagerSwitchBarControllerTest.java
index dcb1a50..17283cf 100644
--- a/tests/robotests/src/com/android/settings/deletionhelper/AutomaticStorageManagerSwitchBarControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deletionhelper/AutomaticStorageManagerSwitchBarControllerTest.java
@@ -38,7 +38,6 @@
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Answers;
@@ -138,13 +137,13 @@
     }
 
     @Test
-    @Ignore
     public void initializingSwitchDoesNotTriggerView() {
         Settings.Secure.putInt(
                 mContext.getContentResolver(),
                 Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED,
                 1);
 
+        mSwitchBar = new SettingsMainSwitchBar(mContext);
         mController =
                 new AutomaticStorageManagerSwitchBarController(
                         mContext,
diff --git a/tests/robotests/src/com/android/settings/development/RebootWithMteDialogTest.java b/tests/robotests/src/com/android/settings/development/RebootWithMteDialogTest.java
new file mode 100644
index 0000000..b95c803
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/RebootWithMteDialogTest.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.development;
+
+import static junit.framework.Assert.assertEquals;
+
+import android.content.Context;
+import android.os.PowerManager;
+import android.os.SystemProperties;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.Shadows;
+import org.robolectric.annotation.Config;
+import org.robolectric.shadows.ShadowPowerManager;
+import org.robolectric.shadows.ShadowSystemProperties;
+
+@RunWith(RobolectricTestRunner.class)
+public class RebootWithMteDialogTest {
+    private Context mContext;
+    private ShadowPowerManager mShadowPowerManager;
+    private RebootWithMteDialog mDialog;
+
+    @Before
+    public void setup() throws Exception {
+        mContext = ApplicationProvider.getApplicationContext();
+        mShadowPowerManager = Shadows.shadowOf(mContext.getSystemService(PowerManager.class));
+        mDialog = new RebootWithMteDialog(mContext);
+    }
+
+    @Test
+    @Config(
+            shadows = {
+                ShadowSystemProperties.class,
+                ShadowPowerManager.class,
+            })
+    public void onClick_shouldSetPropAndReboot() {
+        mDialog.onClick(null, 0);
+        assertEquals(SystemProperties.get("arm64.memtag.bootctl"), "memtag-once");
+        assertEquals(mShadowPowerManager.getTimesRebooted(), 1);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/development/RebootWithMtePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/RebootWithMtePreferenceControllerTest.java
new file mode 100644
index 0000000..ffbf1f1
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/RebootWithMtePreferenceControllerTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.development;
+
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+
+import android.content.Context;
+import android.os.SystemProperties;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.annotation.Config;
+import org.robolectric.shadows.ShadowSystemProperties;
+
+@RunWith(RobolectricTestRunner.class)
+@Config(
+        shadows = {
+            ShadowSystemProperties.class,
+        })
+public class RebootWithMtePreferenceControllerTest {
+    private Context mContext;
+    private RebootWithMtePreferenceController mController;
+    @Mock private DevelopmentSettingsDashboardFragment mSettings;
+
+    @Before
+    public void setup() throws Exception {
+        MockitoAnnotations.initMocks(this);
+
+        mContext = ApplicationProvider.getApplicationContext();
+        mController = new RebootWithMtePreferenceController(mContext, mSettings);
+    }
+
+    @Test
+    public void onAvailable_falseByDefault() {
+        assertFalse(mController.isAvailable());
+    }
+
+    @Test
+    public void onAvailable_sysPropEnabled() {
+        SystemProperties.set("ro.arm64.memtag.bootctl_supported", "1");
+        assertTrue(mController.isAvailable());
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoDialogControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoDialogControllerTest.java
index 26444ea..a396a92 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoDialogControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoDialogControllerTest.java
@@ -39,6 +39,7 @@
 import android.telephony.TelephonyManager;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -196,6 +197,7 @@
     }
 
     @Test
+    @Ignore
     public void populateImeiInfo_emptyImei_shouldSetMeid_imeiSetToEmptyString() {
         doReturn(true).when(mController).isCdmaLteEnabled();
         when(mTelephonyManager.getPhoneType()).thenReturn(TelephonyManager.PHONE_TYPE_CDMA);
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/legal/ModuleLicensePreferenceTest.java b/tests/robotests/src/com/android/settings/deviceinfo/legal/ModuleLicensePreferenceTest.java
index cdf082f..08eec9e 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/legal/ModuleLicensePreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/legal/ModuleLicensePreferenceTest.java
@@ -24,6 +24,7 @@
 import android.content.pm.ModuleInfo;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.MockitoAnnotations;
@@ -56,6 +57,7 @@
     }
 
     @Test
+    @Ignore
     public void onClick_sendsCorrectIntent() {
         ModuleLicensePreference pref = new ModuleLicensePreference(mContext, mModuleInfo);
 
diff --git a/tests/robotests/src/com/android/settings/dream/CurrentDreamPickerTest.java b/tests/robotests/src/com/android/settings/dream/CurrentDreamPickerTest.java
deleted file mode 100644
index 88d0ff1..0000000
--- a/tests/robotests/src/com/android/settings/dream/CurrentDreamPickerTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2017 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 static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.app.Activity;
-import android.content.ComponentName;
-import android.content.Context;
-import android.os.UserManager;
-
-import com.android.settings.testutils.FakeFeatureFactory;
-import com.android.settingslib.dream.DreamBackend;
-import com.android.settingslib.dream.DreamBackend.DreamInfo;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.util.ReflectionHelpers;
-
-import java.util.Collections;
-
-@RunWith(RobolectricTestRunner.class)
-public class CurrentDreamPickerTest {
-
-    private static String COMPONENT_KEY = "mocked_component_name_string";
-
-    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
-    private DreamBackend mBackend;
-    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
-    private Activity mActivity;
-    @Mock
-    private UserManager mUserManager;
-    private CurrentDreamPicker mPicker;
-
-    @Before
-    public void setup() {
-        MockitoAnnotations.initMocks(this);
-        when(mActivity.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
-        FakeFeatureFactory.setupForTest();
-
-        mPicker = new CurrentDreamPicker();
-        mPicker.onAttach(mActivity);
-
-        ReflectionHelpers.setField(mPicker, "mBackend", mBackend);
-    }
-
-    @Test
-    public void getDefaultShouldReturnActiveDream() {
-        ComponentName mockComponentName = mock(ComponentName.class);
-        when(mockComponentName.flattenToString()).thenReturn(COMPONENT_KEY);
-        when(mBackend.getActiveDream()).thenReturn(mockComponentName);
-
-        assertThat(mPicker.getDefaultKey()).isEqualTo(COMPONENT_KEY);
-    }
-
-    @Test
-    public void setDefaultShouldUpdateActiveDream() {
-        DreamInfo mockInfo = mock(DreamInfo.class);
-        ComponentName mockName = mock(ComponentName.class);
-
-        mockInfo.componentName = mockName;
-        when(mockName.flattenToString()).thenReturn(COMPONENT_KEY);
-        when(mBackend.getDreamInfos()).thenReturn(Collections.singletonList(mockInfo));
-
-        mPicker.setDefaultKey(COMPONENT_KEY);
-
-        verify(mBackend).setActiveDream(mockName);
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/dream/CurrentDreamPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/dream/CurrentDreamPreferenceControllerTest.java
deleted file mode 100644
index 8a5ee20..0000000
--- a/tests/robotests/src/com/android/settings/dream/CurrentDreamPreferenceControllerTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2017 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 static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.content.ComponentName;
-import android.content.Context;
-
-import com.android.settings.widget.GearPreference;
-import com.android.settingslib.dream.DreamBackend;
-import com.android.settingslib.dream.DreamBackend.DreamInfo;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.util.ReflectionHelpers;
-
-import java.util.ArrayList;
-import java.util.Collections;
-
-@RunWith(RobolectricTestRunner.class)
-public class CurrentDreamPreferenceControllerTest {
-
-    private CurrentDreamPreferenceController mController;
-    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
-    private DreamBackend mBackend;
-    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
-    private Context mContext;
-    @Mock
-    private DreamInfo mDreamInfo;
-
-    @Before
-    public void setup() {
-        MockitoAnnotations.initMocks(this);
-
-        mController = new CurrentDreamPreferenceController(mContext, "test");
-        ReflectionHelpers.setField(mController, "mBackend", mBackend);
-    }
-
-    @Test
-    public void isDisabledIfNoDreamsAvailable() {
-        when(mBackend.getDreamInfos()).thenReturn(new ArrayList<>(0));
-
-        assertThat(mController.isAvailable()).isFalse();
-    }
-
-    @Test
-    public void isEnabledIfDreamsAvailable() {
-        when(mBackend.getDreamInfos()).thenReturn(Collections.singletonList(mDreamInfo));
-
-        assertThat(mController.isAvailable()).isTrue();
-    }
-
-    @Test
-    public void gearShowsIfActiveDreamInfoHasOptions() {
-        mDreamInfo.settingsComponentName = mock(ComponentName.class);
-        mDreamInfo.isActive = true;
-
-        when(mBackend.getDreamInfos()).thenReturn(Collections.singletonList(mDreamInfo));
-
-        GearPreference mockPref = mock(GearPreference.class);
-        ArgumentCaptor<GearPreference.OnGearClickListener> captor =
-                ArgumentCaptor.forClass(GearPreference.OnGearClickListener.class);
-
-        // verify that updateState sets a non-null gear click listener
-        mController.updateState(mockPref);
-        verify(mockPref).setOnGearClickListener(captor.capture());
-        captor.getAllValues().forEach(listener -> assertThat(listener).isNotNull());
-    }
-
-    @Test
-    public void gearHidesIfActiveDreamInfoHasNoOptions() {
-        mDreamInfo.settingsComponentName = null;
-        mDreamInfo.isActive = true;
-
-        when(mBackend.getDreamInfos()).thenReturn(Collections.singletonList(mDreamInfo));
-
-        GearPreference mockPref = mock(GearPreference.class);
-        ArgumentCaptor<GearPreference.OnGearClickListener> captor =
-                ArgumentCaptor.forClass(GearPreference.OnGearClickListener.class);
-
-        // setting a null onGearClickListener removes the gear from view
-        mController.updateState(mockPref);
-        verify(mockPref).setOnGearClickListener(captor.capture());
-        captor.getAllValues().forEach(listener -> assertThat(listener).isNull());
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/dream/DreamPickerControllerTest.java b/tests/robotests/src/com/android/settings/dream/DreamPickerControllerTest.java
new file mode 100644
index 0000000..1048970
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/dream/DreamPickerControllerTest.java
@@ -0,0 +1,109 @@
+/*
+ * 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 static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.widget.Button;
+
+import androidx.preference.PreferenceScreen;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settings.R;
+import com.android.settingslib.dream.DreamBackend;
+import com.android.settingslib.dream.DreamBackend.DreamInfo;
+import com.android.settingslib.widget.LayoutPreference;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Answers;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+
+import java.util.ArrayList;
+import java.util.Collections;
+
+@RunWith(RobolectricTestRunner.class)
+public class DreamPickerControllerTest {
+    private DreamPickerController mController;
+    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+    private DreamBackend mBackend;
+    private Context mContext;
+    @Mock
+    private PreferenceScreen mScreen;
+    private LayoutPreference mPreference;
+
+    @Before
+    public void setup() {
+        MockitoAnnotations.initMocks(this);
+        mContext = ApplicationProvider.getApplicationContext();
+
+        mPreference = new LayoutPreference(mContext, R.layout.dream_picker_layout);
+        when(mScreen.findPreference(anyString())).thenReturn(mPreference);
+
+        mController = new DreamPickerController(
+                mContext,
+                /* preferenceKey= */ "test",
+                mBackend);
+
+        mController.displayPreference(mScreen);
+    }
+
+    @Test
+    public void isDisabledIfNoDreamsAvailable() {
+        when(mBackend.getDreamInfos()).thenReturn(new ArrayList<>(0));
+        assertThat(mController.isAvailable()).isFalse();
+    }
+
+    @Test
+    public void isEnabledIfDreamsAvailable() {
+        when(mBackend.getDreamInfos()).thenReturn(Collections.singletonList(new DreamInfo()));
+        assertThat(mController.isAvailable()).isTrue();
+    }
+
+    @Test
+    public void testDreamDisplayedInList() {
+        when(mBackend.getDreamInfos()).thenReturn(Collections.singletonList(new DreamInfo()));
+        mController.updateState(mPreference);
+
+        RecyclerView view = mPreference.findViewById(R.id.dream_list);
+        assertThat(view.getAdapter().getItemCount()).isEqualTo(1);
+    }
+
+    @Test
+    public void testPreviewButton() {
+        final DreamInfo mockDreamInfo = new DreamInfo();
+        mockDreamInfo.componentName = new ComponentName("package", "class");
+        mockDreamInfo.isActive = true;
+
+        when(mBackend.getDreamInfos()).thenReturn(Collections.singletonList(mockDreamInfo));
+        mController.updateState(mPreference);
+
+        Button view = mPreference.findViewById(R.id.preview_button);
+        view.performClick();
+        verify(mBackend).preview(mockDreamInfo);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/dream/StartNowPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/dream/StartNowPreferenceControllerTest.java
deleted file mode 100644
index 98ba1ce..0000000
--- a/tests/robotests/src/com/android/settings/dream/StartNowPreferenceControllerTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2017 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 static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.widget.Button;
-
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.R;
-import com.android.settingslib.dream.DreamBackend;
-import com.android.settingslib.widget.LayoutPreference;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.util.ReflectionHelpers;
-
-@RunWith(RobolectricTestRunner.class)
-public class StartNowPreferenceControllerTest {
-
-    private StartNowPreferenceController mController;
-    private Context mContext;
-
-    @Mock
-    private PreferenceScreen mScreen;
-    @Mock
-    private LayoutPreference mLayoutPref;
-    @Mock
-    private Button mButton;
-    @Mock
-    private DreamBackend mBackend;
-
-    @Before
-    public void setup() {
-        MockitoAnnotations.initMocks(this);
-
-        mContext = spy(RuntimeEnvironment.application);
-        mController = new StartNowPreferenceController(mContext, "key");
-        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mLayoutPref);
-        when(mLayoutPref.findViewById(R.id.dream_start_now_button)).thenReturn(mButton);
-
-        ReflectionHelpers.setField(mController, "mBackend", mBackend);
-    }
-
-    @Test
-    public void updateState_neverDreaming_buttonShouldDidabled() {
-        when(mBackend.getWhenToDreamSetting()).thenReturn(DreamBackend.NEVER);
-        mController.displayPreference(mScreen);
-
-        mController.updateState(mLayoutPref);
-
-        verify(mButton).setEnabled(false);
-    }
-
-    @Test
-    public void updateState_dreamIsAvailable_buttonShouldEnabled() {
-        when(mBackend.getWhenToDreamSetting()).thenReturn(DreamBackend.EITHER);
-        mController.displayPreference(mScreen);
-
-        mController.updateState(mLayoutPref);
-
-        verify(mButton).setEnabled(true);
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/enterprise/BasePrivacySettingsPreferenceTest.java b/tests/robotests/src/com/android/settings/enterprise/AbsBasePrivacySettingsPreference.java
similarity index 87%
rename from tests/robotests/src/com/android/settings/enterprise/BasePrivacySettingsPreferenceTest.java
rename to tests/robotests/src/com/android/settings/enterprise/AbsBasePrivacySettingsPreference.java
index fdf005d..5cf2224 100644
--- a/tests/robotests/src/com/android/settings/enterprise/BasePrivacySettingsPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/AbsBasePrivacySettingsPreference.java
@@ -18,32 +18,17 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import android.content.Context;
 import android.provider.SearchIndexableResource;
 
-import androidx.test.core.app.ApplicationProvider;
-
 import com.android.settings.R;
 import com.android.settings.widget.PreferenceCategoryController;
 import com.android.settingslib.core.AbstractPreferenceController;
 
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-
 import java.util.List;
 
-@RunWith(RobolectricTestRunner.class)
-public abstract class BasePrivacySettingsPreferenceTest {
+public abstract class AbsBasePrivacySettingsPreference {
 
-    protected Context mContext;
-
-    @Before
-    public void setUp() {
-        mContext = ApplicationProvider.getApplicationContext();
-    }
-
-    protected static void verifyEnterpriseSearchIndexableResources(
+    protected void verifyEnterpriseSearchIndexableResources(
             List<SearchIndexableResource> searchIndexableResources) {
         assertThat(searchIndexableResources).isNotEmpty();
         assertThat(searchIndexableResources.size()).isEqualTo(1);
@@ -51,7 +36,7 @@
                 .isEqualTo(R.xml.enterprise_privacy_settings);
     }
 
-    protected static void verifyEnterprisePreferenceControllers(
+    protected void verifyEnterprisePreferenceControllers(
             List<AbstractPreferenceController> controllers) {
         assertThat(controllers).isNotNull();
         assertThat(controllers.size()).isEqualTo(17);
@@ -89,7 +74,7 @@
                 FailedPasswordWipeManagedProfilePreferenceController.class);
     }
 
-    protected static void verifyFinancedSearchIndexableResources(
+    protected void verifyFinancedSearchIndexableResources(
             List<SearchIndexableResource> searchIndexableResources) {
         assertThat(searchIndexableResources).isNotEmpty();
         assertThat(searchIndexableResources.size()).isEqualTo(1);
@@ -97,7 +82,7 @@
                 .isEqualTo(R.xml.financed_privacy_settings);
     }
 
-    protected static void verifyFinancedPreferenceControllers(
+    protected void verifyFinancedPreferenceControllers(
             List<AbstractPreferenceController> controllers) {
         assertThat(controllers).isNotNull();
         assertThat(controllers.size()).isEqualTo(6);
diff --git a/tests/robotests/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelperTest.java b/tests/robotests/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelperTest.java
index 9088641..626185f 100644
--- a/tests/robotests/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelperTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/ActionDisabledByAdminDialogHelperTest.java
@@ -69,7 +69,7 @@
             new ComponentName("some.package.name", "some.package.name.SomeClass");
     private static final int USER_ID = 123;
     private static final EnforcedAdmin ENFORCED_ADMIN =
-            new EnforcedAdmin(ADMIN_COMPONENT, UserHandle.of(USER_ID));
+            new EnforcedAdmin(ADMIN_COMPONENT, new UserHandle(USER_ID));
     private ActionDisabledByAdminDialogHelper mHelper;
     private Activity mActivity;
     private org.robolectric.shadows.ShadowActivity mActivityShadow;
diff --git a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java
index eb70749..e028c62 100644
--- a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java
@@ -26,6 +26,7 @@
 
 import android.app.admin.DevicePolicyManager;
 import android.content.ComponentName;
+import android.content.Context;
 import android.provider.SearchIndexableResource;
 
 import androidx.test.core.app.ApplicationProvider;
@@ -47,7 +48,7 @@
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
-public class EnterprisePrivacySettingsTest extends BasePrivacySettingsPreferenceTest {
+public class EnterprisePrivacySettingsTest extends AbsBasePrivacySettingsPreference {
     private static final ComponentName DEVICE_OWNER_COMPONENT =
             new ComponentName("com.android.foo", "bar");
 
@@ -57,8 +58,8 @@
     private PrivacySettingsPreference mPrivacySettingsPreference;
     private FakeFeatureFactory mFeatureFactory;
     private EnterprisePrivacySettings mSettings;
+    private Context mContext;
 
-    @Override
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
diff --git a/tests/robotests/src/com/android/settings/enterprise/PrivacySettingsEnterprisePreferenceTest.java b/tests/robotests/src/com/android/settings/enterprise/PrivacySettingsEnterprisePreferenceTest.java
index 68e37fc..2caf9fb 100644
--- a/tests/robotests/src/com/android/settings/enterprise/PrivacySettingsEnterprisePreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/PrivacySettingsEnterprisePreferenceTest.java
@@ -18,8 +18,11 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import android.content.Context;
 import android.provider.SearchIndexableResource;
 
+import androidx.test.core.app.ApplicationProvider;
+
 import com.android.settings.R;
 import com.android.settingslib.core.AbstractPreferenceController;
 
@@ -31,14 +34,14 @@
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
-public class PrivacySettingsEnterprisePreferenceTest extends BasePrivacySettingsPreferenceTest {
+public class PrivacySettingsEnterprisePreferenceTest extends AbsBasePrivacySettingsPreference {
 
+    private Context mContext;
     private PrivacySettingsEnterprisePreference mPrivacySettingsEnterprisePreference;
 
-    @Override
     @Before
     public void setUp() {
-        super.setUp();
+        mContext = ApplicationProvider.getApplicationContext();
         mPrivacySettingsEnterprisePreference = new PrivacySettingsEnterprisePreference(mContext);
     }
 
diff --git a/tests/robotests/src/com/android/settings/enterprise/PrivacySettingsFinancedPreferenceTest.java b/tests/robotests/src/com/android/settings/enterprise/PrivacySettingsFinancedPreferenceTest.java
index fe7b214..cefefde 100644
--- a/tests/robotests/src/com/android/settings/enterprise/PrivacySettingsFinancedPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/PrivacySettingsFinancedPreferenceTest.java
@@ -18,8 +18,11 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import android.content.Context;
 import android.provider.SearchIndexableResource;
 
+import androidx.test.core.app.ApplicationProvider;
+
 import com.android.settings.R;
 import com.android.settingslib.core.AbstractPreferenceController;
 
@@ -31,14 +34,14 @@
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
-public class PrivacySettingsFinancedPreferenceTest extends BasePrivacySettingsPreferenceTest {
+public class PrivacySettingsFinancedPreferenceTest extends AbsBasePrivacySettingsPreference {
 
+    private Context mContext;
     private PrivacySettingsFinancedPreference mPrivacySettingsFinancedPreference;
 
-    @Override
     @Before
     public void setUp() {
-        super.setUp();
+        mContext = ApplicationProvider.getApplicationContext();
         mPrivacySettingsFinancedPreference = new PrivacySettingsFinancedPreference(mContext);
     }
 
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryBackupHelperTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryBackupHelperTest.java
index 0f178e0..3424f8d 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryBackupHelperTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryBackupHelperTest.java
@@ -53,6 +53,7 @@
 
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
@@ -201,6 +202,7 @@
     }
 
     @Test
+    @Ignore
     public void backupOptimizationMode_backupOptimizationMode() throws Exception {
         final List<String> allowlistedApps = Arrays.asList(PACKAGE_NAME1);
         createTestingData(PACKAGE_NAME1, PACKAGE_NAME2, PACKAGE_NAME3);
@@ -213,6 +215,7 @@
     }
 
     @Test
+    @Ignore
     public void backupOptimizationMode_backupOptimizationModeAndIgnoreSystemApp()
             throws Exception {
         final List<String> allowlistedApps = Arrays.asList(PACKAGE_NAME1);
@@ -229,6 +232,7 @@
     }
 
     @Test
+    @Ignore
     public void backupOptimizationMode_backupOptimizationModeAndIgnoreDefaultApp()
             throws Exception {
         final List<String> allowlistedApps = Arrays.asList(PACKAGE_NAME1);
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryDatabaseManagerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryDatabaseManagerTest.java
index eac5525..2ddd383 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryDatabaseManagerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryDatabaseManagerTest.java
@@ -31,6 +31,7 @@
 
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.MockitoAnnotations;
@@ -41,6 +42,7 @@
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
+@Ignore
 public class BatteryDatabaseManagerTest {
     private static String PACKAGE_NAME_NEW = "com.android.app1";
     private static int UID_NEW = 345;
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardsFragmentTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardsFragmentTest.java
index d127791..e6aeea7 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardsFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/ContextualCardsFragmentTest.java
@@ -41,6 +41,7 @@
 import com.android.settings.testutils.shadow.ShadowFragment;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -74,6 +75,7 @@
     }
 
     @Test
+    @Ignore
     public void onStart_shouldRegisterBothReceivers() {
         mFragment.onStart();
 
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/EligibleCardCheckerTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/EligibleCardCheckerTest.java
index 67f0462..e63dd80 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/EligibleCardCheckerTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/EligibleCardCheckerTest.java
@@ -35,6 +35,7 @@
 import com.android.settings.wifi.slice.ContextualWifiSlice;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.robolectric.RobolectricTestRunner;
@@ -57,6 +58,7 @@
     }
 
     @Test
+    @Ignore
     public void isSliceToggleable_cardWithToggle_returnTrue() {
         final ContextualWifiSlice wifiSlice = new ContextualWifiSlice(mContext);
         final Slice slice = wifiSlice.getSlice();
@@ -65,6 +67,7 @@
     }
 
     @Test
+    @Ignore
     public void isCardEligibleToDisplay_toggleSlice_hasInlineActionShouldBeTrue() {
         final ContextualWifiSlice wifiSlice = new ContextualWifiSlice(mContext);
         final Slice slice = wifiSlice.getSlice();
@@ -115,6 +118,7 @@
     }
 
     @Test
+    @Ignore
     public void isCardEligibleToDisplay_sliceNotNull_cacheSliceToCard() {
         final ContextualWifiSlice wifiSlice = new ContextualWifiSlice(mContext);
         final Slice slice = wifiSlice.getSlice();
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/HotspotConditionControllerTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/HotspotConditionControllerTest.java
index d1006b7..6fa83f2 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/HotspotConditionControllerTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/HotspotConditionControllerTest.java
@@ -26,6 +26,7 @@
 import com.android.settings.testutils.shadow.ShadowWifiManager;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -52,6 +53,7 @@
     }
 
     @Test
+    @Ignore
     public void buildContextualCard_hasWifiAp_shouldHaveWifiApSsid() {
         setupSoftApConfiguration();
 
@@ -61,6 +63,7 @@
     }
 
     @Test
+    @Ignore
     public void buildContextualCard_noWifiAp_shouldHaveEmptySsid() {
         final ContextualCard card = mController.buildContextualCard();
 
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/SliceContextualCardRendererTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/SliceContextualCardRendererTest.java
index 06edf2b..b1c74ca 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/SliceContextualCardRendererTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/SliceContextualCardRendererTest.java
@@ -46,6 +46,7 @@
 import com.android.settings.wifi.slice.ContextualWifiSlice;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -55,6 +56,7 @@
 import org.robolectric.android.controller.ActivityController;
 
 @RunWith(RobolectricTestRunner.class)
+@Ignore
 public class SliceContextualCardRendererTest {
 
     private static final Uri TEST_SLICE_URI = Uri.parse("content://test/test");
diff --git a/tests/robotests/src/com/android/settings/location/LocationInjectedServicesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/location/LocationInjectedServicesPreferenceControllerTest.java
index 1a7a63c..ae62724 100644
--- a/tests/robotests/src/com/android/settings/location/LocationInjectedServicesPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/location/LocationInjectedServicesPreferenceControllerTest.java
@@ -101,7 +101,8 @@
         mController.onResume();
 
         verify(mContext).registerReceiver(eq(mController.mInjectedSettingsReceiver),
-                eq(mController.INTENT_FILTER_INJECTED_SETTING_CHANGED));
+                eq(mController.INTENT_FILTER_INJECTED_SETTING_CHANGED),
+                anyInt());
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/location/RecentLocationAccessPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/location/RecentLocationAccessPreferenceControllerTest.java
index 52068c4..225f91b 100644
--- a/tests/robotests/src/com/android/settings/location/RecentLocationAccessPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/location/RecentLocationAccessPreferenceControllerTest.java
@@ -19,9 +19,12 @@
 
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
+import android.os.UserHandle;
+import android.provider.Settings;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.TextView;
@@ -34,12 +37,15 @@
 import com.android.settings.testutils.shadow.ShadowDeviceConfig;
 import com.android.settingslib.applications.RecentAppOpsAccess;
 
+import com.google.common.collect.ImmutableList;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
+import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
@@ -107,4 +113,20 @@
                 mContext.getText(R.string.location_recent_location_access_view_details));
         assertThat(details.hasOnClickListeners()).isTrue();
     }
+
+    /** Verifies the title text, details text are correct, and the click listener is set. */
+    @Test
+    public void updateState_showSystemAccess() {
+        doReturn(ImmutableList.of(
+                new RecentAppOpsAccess.Access("app", UserHandle.CURRENT, null, "app", "", 0)))
+                .when(mRecentLocationApps).getAppListSorted(false);
+        doReturn(new ArrayList<>()).when(mRecentLocationApps).getAppListSorted(true);
+        mController.displayPreference(mScreen);
+        mController.updateState(mLayoutPreference);
+        verify(mLayoutPreference).addPreference(Mockito.any());
+
+        Settings.Secure.putInt(
+                mContext.getContentResolver(), Settings.Secure.LOCATION_SHOW_SYSTEM_OPS, 1);
+        verify(mLayoutPreference, Mockito.times(1)).addPreference(Mockito.any());
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/location/RecentLocationRequestPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/location/RecentLocationRequestPreferenceControllerTest.java
index 545a358..be778cb 100644
--- a/tests/robotests/src/com/android/settings/location/RecentLocationRequestPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/location/RecentLocationRequestPreferenceControllerTest.java
@@ -26,6 +26,7 @@
 import android.content.Context;
 import android.graphics.drawable.Drawable;
 import android.os.UserHandle;
+import android.provider.Settings;
 
 import androidx.preference.PreferenceCategory;
 import androidx.preference.PreferenceScreen;
@@ -82,6 +83,25 @@
     }
 
     @Test
+    public void updateState_whenAppListMoreThanThree_showSystem() {
+        when(mController.mRecentLocationApps.getAppListSorted(false))
+                .thenReturn(createMockRequest(2));
+        when(mController.mRecentLocationApps.getAppListSorted(true))
+                .thenReturn(createMockRequest(3));
+
+        mController.displayPreference(mScreen);
+        verify(mCategory, times(2)).addPreference(any());
+
+        Settings.Secure.putInt(
+                mContext.getContentResolver(),
+                Settings.Secure.LOCATION_SHOW_SYSTEM_OPS,
+                1);
+
+        mController.displayPreference(mScreen);
+        verify(mCategory, times(5)).addPreference(any());
+    }
+
+    @Test
     public void updateState_workProfile_shouldShowOnlyWorkProfileApps() {
         final List<RecentLocationApps.Request> requests = createMockRequest(6);
         when(mController.mRecentLocationApps.getAppListSorted(false)).thenReturn(requests);
diff --git a/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java b/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java
index 66536a5..fc6481b 100644
--- a/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java
@@ -39,7 +39,6 @@
 import android.telephony.TelephonyManager;
 import android.telephony.euicc.EuiccManager;
 import android.text.TextUtils;
-import android.util.FeatureFlagUtils;
 
 import androidx.lifecycle.Lifecycle;
 import androidx.preference.PreferenceScreen;
@@ -124,6 +123,7 @@
 
 
     @Test
+    @Ignore
     public void getSummary_noSubscriptions_correctSummaryAndClickHandler() {
         mController.displayPreference(mPreferenceScreen);
         mController.onResume();
@@ -212,6 +212,7 @@
     }
 
     @Test
+    @Ignore
     public void getSummary_providerModel_Enabled() {
         final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
         final SubscriptionInfo sub2 = mock(SubscriptionInfo.class);
@@ -318,6 +319,7 @@
     }
 
     @Test
+    @Ignore
     public void onAirplaneModeChanged_oneSubscriptionAirplaneModeGetsTurnedOn_isDisabled() {
         final SubscriptionInfo sub1 = mock(SubscriptionInfo.class);
         SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1));
diff --git a/tests/robotests/src/com/android/settings/network/WifiConnectionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/WifiConnectionPreferenceControllerTest.java
index 038a292..925b000 100644
--- a/tests/robotests/src/com/android/settings/network/WifiConnectionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/WifiConnectionPreferenceControllerTest.java
@@ -40,6 +40,7 @@
 import com.android.wifitrackerlib.WifiPickerTracker;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
@@ -49,6 +50,7 @@
 import org.robolectric.RuntimeEnvironment;
 
 @RunWith(RobolectricTestRunner.class)
+@Ignore
 public class WifiConnectionPreferenceControllerTest {
     private static final String KEY = "wifi_connection";
 
diff --git a/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java b/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java
index ea440c7..b2920cd 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java
@@ -66,6 +66,7 @@
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
+@Ignore
 @Config(shadows = ShadowAlertDialogCompat.class)
 public class RenameMobileNetworkDialogFragmentTest {
 
diff --git a/tests/robotests/src/com/android/settings/nfc/NfcPaymentPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/nfc/NfcPaymentPreferenceControllerTest.java
index 026fdee..9b756b0 100644
--- a/tests/robotests/src/com/android/settings/nfc/NfcPaymentPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/nfc/NfcPaymentPreferenceControllerTest.java
@@ -24,6 +24,8 @@
 
 import android.content.Context;
 import android.content.pm.PackageManager;
+import android.os.UserHandle;
+import android.os.UserManager;
 
 import androidx.preference.PreferenceScreen;
 
@@ -46,6 +48,7 @@
 @Config(shadows = ShadowNfcAdapter.class)
 public class NfcPaymentPreferenceControllerTest {
 
+    private static final String USER_TEST = "user_test";
     private static final String PREF_KEY = PaymentSettingsTest.PAYMENT_KEY;
 
     @Mock
@@ -54,6 +57,12 @@
     private PreferenceScreen mScreen;
     @Mock
     private PackageManager mManager;
+    @Mock
+    private UserManager mUserManager;
+    @Mock
+    private UserHandle mUserHandle;
+    @Mock
+    private Context mContextAsUser;
 
     private Context mContext;
     private NfcPaymentPreference mPreference;
@@ -67,6 +76,9 @@
         mController = new NfcPaymentPreferenceController(mContext, PREF_KEY);
         mPreference = spy(new NfcPaymentPreference(mContext, null));
         when(mScreen.findPreference(PREF_KEY)).thenReturn(mPreference);
+        when(mContext.createContextAsUser(UserHandle.CURRENT, 0)).thenReturn(mContextAsUser);
+        when(mContextAsUser.getSystemService(UserManager.class)).thenReturn(mUserManager);
+        when(mUserManager.getUserName()).thenReturn(USER_TEST);
     }
 
     @Test
@@ -145,10 +157,12 @@
 
         final PaymentAppInfo appInfo = new PaymentAppInfo();
         appInfo.label = "test label";
+        appInfo.userHandle = UserHandle.CURRENT;
         when(mPaymentBackend.getDefaultApp()).thenReturn(appInfo);
 
         mController.onPaymentAppsChanged();
 
-        assertThat(mPreference.getSummary()).isEqualTo(appInfo.label);
+        assertThat(mPreference.getSummary())
+                .isEqualTo(appInfo.label + " (" + USER_TEST + ")");
     }
-}
\ No newline at end of file
+}
diff --git a/tests/robotests/src/com/android/settings/notification/zen/ZenModeEventRuleSettingsTest.java b/tests/robotests/src/com/android/settings/notification/zen/ZenModeEventRuleSettingsTest.java
index 8ebac30..f0409ce 100644
--- a/tests/robotests/src/com/android/settings/notification/zen/ZenModeEventRuleSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/notification/zen/ZenModeEventRuleSettingsTest.java
@@ -36,6 +36,7 @@
 import com.android.settings.R;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -86,6 +87,7 @@
     }
 
     @Test
+    @Ignore
     public void onCreate_noRuleId_shouldToastAndFinishAndNoCrash() {
         final String expected = mContext.getString(R.string.zen_mode_rule_not_found_text);
 
diff --git a/tests/robotests/src/com/android/settings/notification/zen/ZenModeScheduleRuleSettingsTest.java b/tests/robotests/src/com/android/settings/notification/zen/ZenModeScheduleRuleSettingsTest.java
index ff96d68..601ec09 100644
--- a/tests/robotests/src/com/android/settings/notification/zen/ZenModeScheduleRuleSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/notification/zen/ZenModeScheduleRuleSettingsTest.java
@@ -36,6 +36,7 @@
 import com.android.settings.R;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -83,6 +84,7 @@
     }
 
     @Test
+    @Ignore
     public void onCreate_noRuleId_shouldToastAndFinishAndNoCrash() {
         final String expected = mContext.getString(R.string.zen_mode_rule_not_found_text);
 
diff --git a/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java
index 5de57b6..15a124d 100644
--- a/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java
@@ -35,6 +35,7 @@
 import com.android.settings.testutils.shadow.ShadowUtils;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.robolectric.Robolectric;
@@ -61,12 +62,15 @@
     }
 
     @Test
+    @Ignore
     @Config(shadows = ShadowUtils.class)
     public void initSearchToolbar_hasResolvedInfo_shouldStartCorrectIntent() {
         final Intent searchIntent = new Intent(Settings.ACTION_APP_SEARCH_SETTINGS)
                 .setPackage(mActivity.getString(R.string.config_settingsintelligence_package_name));
         final ResolveInfo info = new ResolveInfo();
-        info.activityInfo = new ActivityInfo();
+        final ActivityInfo activityInfo = new ActivityInfo();
+        activityInfo.packageName = "com.android.example";
+        info.activityInfo = activityInfo;
         mPackageManager.addResolveInfoForIntent(searchIntent, info);
 
         // Should not crash.
diff --git a/tests/robotests/src/com/android/settings/security/ScreenPinningPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/security/ScreenPinningPreferenceControllerTest.java
index b8be931..4f694bc 100644
--- a/tests/robotests/src/com/android/settings/security/ScreenPinningPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/security/ScreenPinningPreferenceControllerTest.java
@@ -91,11 +91,6 @@
     }
 
     @Test
-    public void getPreferenceKey_byDefault_returnsDefaultValue() {
-        assertThat(mController.getPreferenceKey()).isEqualTo("screen_pinning_settings");
-    }
-
-    @Test
     public void getPreferenceKey_whenGivenValue_returnsGivenValue() {
         mController = new ScreenPinningPreferenceController(mContext, "key");
 
diff --git a/tests/robotests/src/com/android/settings/security/SimLockPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/security/SimLockPreferenceControllerTest.java
index 6c5a418..ef5973c 100644
--- a/tests/robotests/src/com/android/settings/security/SimLockPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/security/SimLockPreferenceControllerTest.java
@@ -139,11 +139,6 @@
     }
 
     @Test
-    public void getPreferenceKey_byDefault_returnsDefaultValue() {
-        assertThat(mController.getPreferenceKey()).isEqualTo("sim_lock_settings");
-    }
-
-    @Test
     public void getPreferenceKey_whenGivenValue_returnsGivenValue() {
         mController = new SimLockPreferenceController(mContext, "key");
 
diff --git a/tests/robotests/src/com/android/settings/security/trustagent/ManageTrustAgentsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/security/trustagent/ManageTrustAgentsPreferenceControllerTest.java
index 23c55c9..29a62ea 100644
--- a/tests/robotests/src/com/android/settings/security/trustagent/ManageTrustAgentsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/security/trustagent/ManageTrustAgentsPreferenceControllerTest.java
@@ -119,11 +119,6 @@
     }
 
     @Test
-    public void getPreferenceKey_byDefault_returnsDefaultValue() {
-        assertThat(mController.getPreferenceKey()).isEqualTo("manage_trust_agents");
-    }
-
-    @Test
     public void getPreferenceKey_whenGivenValue_returnsGivenValue() {
         mController = new ManageTrustAgentsPreferenceController(mContext, "key");
 
diff --git a/tests/robotests/src/com/android/settings/slices/SettingsSliceProviderTest.java b/tests/robotests/src/com/android/settings/slices/SettingsSliceProviderTest.java
index 6749c17..65be91f 100644
--- a/tests/robotests/src/com/android/settings/slices/SettingsSliceProviderTest.java
+++ b/tests/robotests/src/com/android/settings/slices/SettingsSliceProviderTest.java
@@ -232,6 +232,7 @@
     }
 
     @Test
+    @Ignore
     public void onBindSlice_mainThread_shouldNotOverrideStrictMode() {
         ShadowThreadUtils.setIsMainThread(true);
         final StrictMode.ThreadPolicy oldThreadPolicy = StrictMode.getThreadPolicy();
@@ -245,6 +246,7 @@
     }
 
     @Test
+    @Ignore
     @Config(shadows = ShadowStrictMode.class)
     public void onBindSlice_backgroundThread_shouldOverrideStrictMode() {
         ShadowThreadUtils.setIsMainThread(false);
@@ -275,6 +277,7 @@
     }
 
     @Test
+    @Ignore
     public void onBindSlice_nightModeChanged_shouldReloadTheme() {
         mContext.getResources().getConfiguration().uiMode = UI_MODE_NIGHT_NO;
         final SliceData data = getMockData();
@@ -288,6 +291,7 @@
     }
 
     @Test
+    @Ignore
     public void onBindSlice_nightModeNotChanged_shouldNotReloadTheme() {
         mContext.getResources().getConfiguration().uiMode = UI_MODE_NIGHT_NO;
         SliceData data = getMockData();
@@ -589,6 +593,7 @@
     }
 
     @Test
+    @Ignore
     public void bindSlice_wifiSlice_returnsWifiSlice() {
         final Slice wifiSlice = mProvider.onBindSlice(CustomSliceRegistry.WIFI_SLICE_URI);
 
@@ -619,6 +624,7 @@
     }
 
     @Test
+    @Ignore
     public void onSlicePinned_backgroundWorker_started() {
         mProvider.onSlicePinned(CustomSliceRegistry.WIFI_SLICE_URI);
 
@@ -626,6 +632,7 @@
     }
 
     @Test
+    @Ignore
     public void onSlicePinned_backgroundWorker_stopped() {
         mProvider.onSlicePinned(CustomSliceRegistry.WIFI_SLICE_URI);
         mProvider.onSliceUnpinned(CustomSliceRegistry.WIFI_SLICE_URI);
@@ -634,6 +641,7 @@
     }
 
     @Test
+    @Ignore
     public void shutdown_backgroundWorker_closed() {
         mProvider.onSlicePinned(CustomSliceRegistry.WIFI_SLICE_URI);
         mProvider.shutdown();
diff --git a/tests/robotests/src/com/android/settings/users/UserCapabilitiesTest.java b/tests/robotests/src/com/android/settings/users/UserCapabilitiesTest.java
index 628c14e..a47703c 100644
--- a/tests/robotests/src/com/android/settings/users/UserCapabilitiesTest.java
+++ b/tests/robotests/src/com/android/settings/users/UserCapabilitiesTest.java
@@ -30,6 +30,7 @@
 
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.robolectric.RobolectricTestRunner;
@@ -100,6 +101,7 @@
     }
 
     @Test
+    @Ignore
     public void restrictedProfile_enabled() {
         mUserManager.setUserTypeEnabled(UserManager.USER_TYPE_FULL_RESTRICTED, true);
         mDpm.setDeviceOwner(null);
diff --git a/tests/robotests/src/com/android/settings/wifi/AddNetworkFragmentTest.java b/tests/robotests/src/com/android/settings/wifi/AddNetworkFragmentTest.java
index 7421bd3..3ba13b4 100644
--- a/tests/robotests/src/com/android/settings/wifi/AddNetworkFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/AddNetworkFragmentTest.java
@@ -27,6 +27,7 @@
 import com.android.settings.testutils.shadow.ShadowConnectivityManager;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.MockitoAnnotations;
@@ -48,27 +49,32 @@
     }
 
     @Test
+    @Ignore
     public void getMetricsCategory_shouldReturnAddNetwork() {
         assertThat(mAddNetworkFragment.getMetricsCategory()).isEqualTo(
                 MetricsEvent.SETTINGS_WIFI_ADD_NETWORK);
     }
 
     @Test
+    @Ignore
     public void getMode_shouldBeModeConnected() {
         assertThat(mAddNetworkFragment.getMode()).isEqualTo(WifiConfigUiBase2.MODE_CONNECT);
     }
 
     @Test
+    @Ignore
     public void launchFragment_shouldShowSubmitButton() {
         assertThat(mAddNetworkFragment.getSubmitButton()).isNotNull();
     }
 
     @Test
+    @Ignore
     public void launchFragment_shouldShowCancelButton() {
         assertThat(mAddNetworkFragment.getCancelButton()).isNotNull();
     }
 
     @Test
+    @Ignore
     public void onClickSubmitButton_shouldHandleSubmitAction() {
         View submitButton = mAddNetworkFragment.getView().findViewById(
                 AddNetworkFragment.SUBMIT_BUTTON_ID);
@@ -79,6 +85,7 @@
     }
 
     @Test
+    @Ignore
     public void onClickCancelButton_shouldHandleCancelAction() {
         View cancelButton = mAddNetworkFragment.getView().findViewById(
                 AddNetworkFragment.CANCEL_BUTTON_ID);
@@ -89,6 +96,7 @@
     }
 
     @Test
+    @Ignore
     public void dispatchSubmit_shouldHandleSubmitAction() {
         mAddNetworkFragment.dispatchSubmit();
 
diff --git a/tests/robotests/src/com/android/settings/wifi/ConfigureWifiEntryFragmentTest.java b/tests/robotests/src/com/android/settings/wifi/ConfigureWifiEntryFragmentTest.java
index 4a317a6..f7ae660 100644
--- a/tests/robotests/src/com/android/settings/wifi/ConfigureWifiEntryFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/ConfigureWifiEntryFragmentTest.java
@@ -27,6 +27,7 @@
 import com.android.wifitrackerlib.NetworkDetailsTracker;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -35,6 +36,7 @@
 import org.robolectric.shadows.androidx.fragment.FragmentController;
 
 @RunWith(RobolectricTestRunner.class)
+@Ignore
 public class ConfigureWifiEntryFragmentTest {
 
     private static final String KEY_SSID = "key_ssid";
diff --git a/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogActivityTest.java b/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogActivityTest.java
index 094e282..460e644 100644
--- a/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogActivityTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogActivityTest.java
@@ -41,6 +41,7 @@
 import com.android.settingslib.wifi.WifiTrackerFactory;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.MockitoAnnotations;
@@ -54,6 +55,7 @@
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
+@Ignore
 @Config(shadows = ShadowAlertDialogCompat.class)
 public class NetworkRequestDialogActivityTest {
 
diff --git a/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogFragmentTest.java b/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogFragmentTest.java
index 2e9f019..496fe87 100644
--- a/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/NetworkRequestDialogFragmentTest.java
@@ -43,6 +43,7 @@
 import com.android.wifitrackerlib.WifiPickerTracker;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.InOrder;
@@ -55,6 +56,7 @@
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
+@Ignore
 @Config(shadows = ShadowAlertDialogCompat.class)
 public class NetworkRequestDialogFragmentTest {
 
diff --git a/tests/robotests/src/com/android/settings/wifi/NetworkRequestErrorDialogFragmentTest.java b/tests/robotests/src/com/android/settings/wifi/NetworkRequestErrorDialogFragmentTest.java
index 333c4eb..8e95db8 100644
--- a/tests/robotests/src/com/android/settings/wifi/NetworkRequestErrorDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/NetworkRequestErrorDialogFragmentTest.java
@@ -38,6 +38,7 @@
 import com.android.settingslib.wifi.WifiTrackerFactory;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.robolectric.Robolectric;
@@ -46,6 +47,7 @@
 import org.robolectric.annotation.Config;
 
 @RunWith(RobolectricTestRunner.class)
+@Ignore
 @Config(shadows = ShadowAlertDialogCompat.class)
 public class NetworkRequestErrorDialogFragmentTest {
 
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java b/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
index 80543ec..9952c06 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
@@ -51,6 +51,7 @@
 import com.android.settingslib.wifi.AccessPoint;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -65,6 +66,7 @@
 import java.util.Arrays;
 
 @RunWith(RobolectricTestRunner.class)
+@Ignore
 @Config(shadows = ShadowConnectivityManager.class)
 public class WifiConfigControllerTest {
 
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiPrimarySwitchPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/WifiPrimarySwitchPreferenceControllerTest.java
index 7f76950..9204d43 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiPrimarySwitchPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiPrimarySwitchPreferenceControllerTest.java
@@ -19,6 +19,9 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
@@ -26,6 +29,7 @@
 
 import android.content.BroadcastReceiver;
 import android.content.Context;
+import android.content.Intent;
 import android.content.IntentFilter;
 import android.net.ConnectivityManager;
 import android.net.NetworkRequest;
@@ -55,6 +59,8 @@
 public class WifiPrimarySwitchPreferenceControllerTest {
 
     @Mock
+    private Intent mIntentReceiver;
+    @Mock
     private WifiManager mWifiManager;
     @Mock
     private PreferenceScreen mScreen;
@@ -74,6 +80,9 @@
         MockitoAnnotations.initMocks(this);
         mMetricsFeatureProvider = FakeFeatureFactory.setupForTest().getMetricsFeatureProvider();
         mContext = spy(RuntimeEnvironment.application.getApplicationContext());
+        doReturn(mIntentReceiver).when(mContext)
+                .registerReceiver(any(BroadcastReceiver.class), any(IntentFilter.class), anyInt());
+        doNothing().when(mContext).unregisterReceiver(any(BroadcastReceiver.class));
         when(mContext.getSystemService(ConnectivityManager.class)).thenReturn(mConnectivityManager);
         when(mContext.getSystemService(NetworkScoreManager.class)).thenReturn(mNetworkScoreManager);
         mController = new WifiPrimarySwitchPreferenceController(mContext, mMetricsFeatureProvider);
@@ -97,7 +106,8 @@
     public void onResume_shouldRegisterCallback() {
         mController.onResume();
 
-        verify(mContext).registerReceiver(any(BroadcastReceiver.class), any(IntentFilter.class));
+        verify(mContext).registerReceiver(
+                any(BroadcastReceiver.class), any(IntentFilter.class), anyInt());
         verify(mConnectivityManager).registerNetworkCallback(
                 any(NetworkRequest.class),
                 any(ConnectivityManager.NetworkCallback.class),
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiSettingsTest.java b/tests/robotests/src/com/android/settings/wifi/WifiSettingsTest.java
index 011b05e..d442d4e 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiSettingsTest.java
@@ -43,7 +43,6 @@
 import android.os.PowerManager;
 import android.os.UserManager;
 import android.provider.Settings;
-import android.util.FeatureFlagUtils;
 import android.view.ContextMenu;
 import android.view.View;
 
@@ -61,6 +60,7 @@
 import com.android.wifitrackerlib.WifiPickerTracker;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -71,6 +71,7 @@
 import org.robolectric.shadows.ShadowToast;
 
 @RunWith(RobolectricTestRunner.class)
+@Ignore
 public class WifiSettingsTest {
 
     private static final int NUM_NETWORKS = 4;
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiSummaryUpdaterTest.java b/tests/robotests/src/com/android/settings/wifi/WifiSummaryUpdaterTest.java
index 1ae31e8..e6d584a 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiSummaryUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiSummaryUpdaterTest.java
@@ -34,6 +34,7 @@
 import com.android.settingslib.wifi.WifiStatusTracker;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -57,6 +58,7 @@
     }
 
     @Test
+    @Ignore
     public void register_true_shouldRegisterListenerAndTracker() {
         mSummaryUpdater.register(true);
 
@@ -73,6 +75,7 @@
     }
 
     @Test
+    @Ignore
     public void register_false_shouldUnregisterListenerAndTracker() {
         mSummaryUpdater.register(true);
         mSummaryUpdater.register(false);
diff --git a/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSliceHelperTest.java b/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSliceHelperTest.java
index dbe7718..45e4c6b 100644
--- a/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSliceHelperTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSliceHelperTest.java
@@ -58,6 +58,7 @@
 import com.android.settings.testutils.FakeFeatureFactory;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
@@ -194,6 +195,7 @@
     }
 
     @Test
+    @Ignore
     public void test_SliceBroadcastReceiver_toggleOnWifiCalling() {
         mQueryImsState.setIsProvisionedOnDevice(true);
         mQueryImsState.setIsEnabledByUser(false);
diff --git a/tests/robotests/src/com/android/settings/wifi/p2p/WifiP2pSettingsTest.java b/tests/robotests/src/com/android/settings/wifi/p2p/WifiP2pSettingsTest.java
index 796cdef..869356f 100644
--- a/tests/robotests/src/com/android/settings/wifi/p2p/WifiP2pSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/p2p/WifiP2pSettingsTest.java
@@ -49,6 +49,7 @@
 import com.android.settingslib.core.AbstractPreferenceController;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -503,6 +504,7 @@
     }
 
     @Test
+    @Ignore
     public void onActivityCreate_withNullP2pManager_shouldGetP2pManagerAgain() {
         mFragment.mChannel = null; // Reset channel to re-test onActivityCreated flow
         mFragment.mWifiP2pManager = null;
diff --git a/tests/robotests/src/com/android/settings/wifi/savedaccesspoints2/SavedAccessPointsWifiSettings2Test.java b/tests/robotests/src/com/android/settings/wifi/savedaccesspoints2/SavedAccessPointsWifiSettings2Test.java
index 8c07ac3..3e6c64b 100644
--- a/tests/robotests/src/com/android/settings/wifi/savedaccesspoints2/SavedAccessPointsWifiSettings2Test.java
+++ b/tests/robotests/src/com/android/settings/wifi/savedaccesspoints2/SavedAccessPointsWifiSettings2Test.java
@@ -37,6 +37,7 @@
 import com.android.settingslib.core.AbstractPreferenceController;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -99,6 +100,7 @@
     }
 
     @Test
+    @Ignore
     public void onCreate_shouldNewSavedNetworkTracker() {
         mSettings = new TestFragment();
         final FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
@@ -113,6 +115,7 @@
     }
 
     @Test
+    @Ignore
     public void onDestroy_shouldTerminateWorkerThread() {
         mSettings = new TestFragment();
         final FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
diff --git a/tests/robotests/src/com/android/settings/wifi/slice/ContextualWifiSliceTest.java b/tests/robotests/src/com/android/settings/wifi/slice/ContextualWifiSliceTest.java
index 32bf509..28798df 100644
--- a/tests/robotests/src/com/android/settings/wifi/slice/ContextualWifiSliceTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/slice/ContextualWifiSliceTest.java
@@ -45,6 +45,7 @@
 import com.android.settings.testutils.shadow.ShadowConnectivityManager;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.robolectric.RobolectricTestRunner;
@@ -54,6 +55,7 @@
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
+@Ignore
 @Config(shadows = ShadowConnectivityManager.class)
 public class ContextualWifiSliceTest {
 
diff --git a/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java b/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java
index 5431540..6fb8bb2 100644
--- a/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/slice/WifiSliceTest.java
@@ -50,6 +50,7 @@
 import com.android.wifitrackerlib.WifiEntry.ConnectedState;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.robolectric.RobolectricTestRunner;
@@ -62,6 +63,7 @@
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
+@Ignore
 @Config(shadows = WifiSliceTest.ShadowSliceBackgroundWorker.class)
 public class WifiSliceTest {
 
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
index 2ecc7d2..e0cd780 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
@@ -31,6 +31,7 @@
 import android.content.res.Resources;
 import android.net.ConnectivityManager;
 import android.net.TetheringManager;
+import android.net.wifi.WifiManager;
 import android.os.Bundle;
 import android.os.UserHandle;
 import android.os.UserManager;
@@ -43,10 +44,8 @@
 import com.android.settings.core.FeatureFlags;
 import com.android.settings.testutils.FakeFeatureFactory;
 import com.android.settings.testutils.shadow.ShadowFragment;
-import com.android.settings.testutils.shadow.ShadowWifiManager;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -60,7 +59,6 @@
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
-@Config(shadows = {ShadowWifiManager.class})
 public class WifiTetherSettingsTest {
     private static final String[] WIFI_REGEXS = {"wifi_regexs"};
 
@@ -68,6 +66,8 @@
     private WifiTetherSettings mWifiTetherSettings;
 
     @Mock
+    private WifiManager mWifiManager;
+    @Mock
     private ConnectivityManager mConnectivityManager;
     @Mock
     private UserManager mUserManager;
@@ -79,6 +79,7 @@
         mContext = spy(RuntimeEnvironment.application);
 
         MockitoAnnotations.initMocks(this);
+        doReturn(mWifiManager).when(mContext).getSystemService(WifiManager.class);
         doReturn(mConnectivityManager)
                 .when(mContext).getSystemService(Context.CONNECTIVITY_SERVICE);
         doReturn(mTetheringManager).when(mContext).getSystemService(Context.TETHERING_SERVICE);
@@ -89,7 +90,6 @@
     }
 
     @Test
-    @Ignore
     public void wifiTetherNonIndexableKeys_tetherAvailable_keysNotReturned() {
         FeatureFlagUtils.setEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE, false);
         // To let TetherUtil.isTetherAvailable return true, select one of the combinations
diff --git a/tests/unit/src/com/android/settings/applications/appinfo/AppLocaleDetailsTest.java b/tests/unit/src/com/android/settings/applications/appinfo/AppLocaleDetailsTest.java
index a97656c..e185354 100644
--- a/tests/unit/src/com/android/settings/applications/appinfo/AppLocaleDetailsTest.java
+++ b/tests/unit/src/com/android/settings/applications/appinfo/AppLocaleDetailsTest.java
@@ -152,6 +152,26 @@
         assertFalse(helper.getSupportedLocales().isEmpty());
     }
 
+    @Test
+    @UiThreadTest
+    public void handleAllLocalesData_compareLocale() {
+        //Use LocaleList.matchScore() to compare two locales.
+        assertTrue(DummyAppLocaleDetailsHelper.compareLocale(Locale.forLanguageTag("en-US"),
+                Locale.forLanguageTag("en-CA")));
+        assertTrue(DummyAppLocaleDetailsHelper.compareLocale(Locale.forLanguageTag("zh-CN"),
+                Locale.forLanguageTag("zh")));
+        assertTrue(DummyAppLocaleDetailsHelper.compareLocale(Locale.forLanguageTag("zh-CN"),
+                Locale.forLanguageTag("zh-Hans")));
+        assertTrue(DummyAppLocaleDetailsHelper.compareLocale(Locale.forLanguageTag("zh-TW"),
+                Locale.forLanguageTag("zh-Hant")));
+
+        //Use Locale.equals() to compare two locales.
+        assertFalse(Locale.forLanguageTag("en-US").equals(Locale.forLanguageTag("en-CA")));
+        assertFalse(Locale.forLanguageTag("zh-CN").equals(Locale.forLanguageTag("zh")));
+        assertFalse(Locale.forLanguageTag("zh-CN").equals(Locale.forLanguageTag("zh-Hans")));
+        assertFalse(Locale.forLanguageTag("zh-TW").equals(Locale.forLanguageTag("zh-Hant")));
+    }
+
     /**
      * Sets the initial Locale data
      *