Merge "Strings updates for the new version of High contrast text." into main
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 551a7de..0eef210 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1687,6 +1687,22 @@
         </activity>
 
         <activity
+            android:name=".Settings$LockScreenNotificationsSettingsActivity"
+            android:label="@string/lock_screen_notifs_title"
+            android:exported="true">
+            <intent-filter android:priority="1">
+                <action android:name="android.settings.LOCK_SCREEN_NOTIFICATIONS_SETTINGS" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+                android:value="com.android.settings.notification.LockScreenNotificationsPreferencePageFragment" />
+            <meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
+                android:value="@string/menu_key_display"/>
+            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
+                android:value="true" />
+        </activity>
+
+        <activity
             android:name=".Settings$BlueToothPairingActivity"
             android:label="@string/bluetooth_pairing_page_title"
             android:permission="android.permission.BLUETOOTH_SCAN"
@@ -5424,7 +5440,7 @@
         </service>
 
         <receiver android:name="com.android.settings.connecteddevice.audiosharing.AudioSharingReceiver"
-            android:exported="false">
+            android:exported="true">
             <intent-filter>
                 <action android:name="com.android.settings.action.BLUETOOTH_LE_AUDIO_SHARING_STATE_CHANGE" />
                 <action android:name="com.android.settings.action.BLUETOOTH_LE_AUDIO_SHARING_STOP" />
diff --git a/res/drawable/pointer_icon_fill_color_background.xml b/res/drawable/pointer_icon_fill_color_background.xml
index 20deb5c..89cfe55 100644
--- a/res/drawable/pointer_icon_fill_color_background.xml
+++ b/res/drawable/pointer_icon_fill_color_background.xml
@@ -14,15 +14,217 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<inset xmlns:android="http://schemas.android.com/apk/res/android"
-    android:insetBottom="@dimen/pointer_fill_style_circle_offset"
-    android:insetLeft="@dimen/pointer_fill_style_circle_offset"
-    android:insetRight="@dimen/pointer_fill_style_circle_offset"
-    android:insetTop="@dimen/pointer_fill_style_circle_offset">
-    <shape android:shape="oval">
-        <size
-            android:width="@dimen/pointer_fill_style_circle_inner_diameter"
-            android:height="@dimen/pointer_fill_style_circle_inner_diameter" />
-        <solid android:color="@android:color/white" />
-    </shape>
-</inset>
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" >
+    <item
+        android:state_hovered="true"
+        android:state_selected="true">
+        <layer-list>
+            <item
+                android:top="@dimen/pointer_fill_style_circle_background_outline_offset"
+                android:left="@dimen/pointer_fill_style_circle_background_outline_offset"
+                android:bottom="@dimen/pointer_fill_style_circle_background_outline_offset"
+                android:right="@dimen/pointer_fill_style_circle_background_outline_offset">
+                <shape android:shape="rectangle">
+                    <corners
+                        android:radius="@dimen/pointer_fill_style_circle_background_corner_radius" />
+                    <size
+                        android:width="@dimen/pointer_fill_style_circle_background_outer_diameter_less_stroke"
+                        android:height="@dimen/pointer_fill_style_circle_background_outer_diameter_less_stroke" />
+                    <stroke
+                        android:width="@dimen/pointer_fill_style_circle_background_selected_outline_stroke"
+                        android:color="@androidprv:color/materialColorSecondary" />
+                </shape>
+            </item>
+            <item
+                android:top="@dimen/pointer_fill_style_circle_background_offset"
+                android:left="@dimen/pointer_fill_style_circle_background_offset"
+                android:bottom="@dimen/pointer_fill_style_circle_background_offset"
+                android:right="@dimen/pointer_fill_style_circle_background_offset">
+                <shape android:shape="rectangle">
+                    <corners android:radius="@dimen/pointer_fill_style_circle_background_corner_inner_radius" />
+                    <size
+                        android:width="@dimen/pointer_fill_style_circle_background_outer_diameter_selected"
+                        android:height="@dimen/pointer_fill_style_circle_background_outer_diameter_selected" />
+                    <solid
+                        android:color="@color/pointer_fill_hovered_color" />
+                </shape>
+            </item>
+            <item
+                android:id="@+id/tintableCircleHoveredSelected"
+                android:top="@dimen/pointer_fill_style_circle_offset_selected"
+                android:left="@dimen/pointer_fill_style_circle_offset_selected"
+                android:bottom="@dimen/pointer_fill_style_circle_offset_selected"
+                android:right="@dimen/pointer_fill_style_circle_offset_selected">
+                <shape android:shape="oval">
+                    <size
+                        android:width="@dimen/pointer_fill_style_circle_diameter"
+                        android:height="@dimen/pointer_fill_style_circle_diameter" />
+                    <solid android:color="@android:color/white" />
+                </shape>
+            </item>
+            <item
+                android:top="@dimen/pointer_fill_style_circle_outline_offset_selected"
+                android:left="@dimen/pointer_fill_style_circle_outline_offset_selected"
+                android:bottom="@dimen/pointer_fill_style_circle_outline_offset_selected"
+                android:right="@dimen/pointer_fill_style_circle_outline_offset_selected">
+                <shape android:shape="oval">
+                    <size
+                        android:width="@dimen/pointer_fill_style_circle_outline_diameter"
+                        android:height="@dimen/pointer_fill_style_circle_outline_diameter" />
+                    <stroke
+                        android:width="@dimen/pointer_fill_style_circle_outline_stroke"
+                        android:color="@android:color/white" />
+                </shape>
+            </item>
+            <item android:gravity="center"
+                android:width="@dimen/pointer_fill_style_checkmark_size"
+                android:height="@dimen/pointer_fill_style_checkmark_size"
+                android:drawable="@drawable/pointer_fill_check_24dp" />
+        </layer-list>
+    </item>
+    <item android:state_selected="true">
+        <layer-list>
+            <item
+                android:top="@dimen/pointer_fill_style_circle_background_outline_offset"
+                android:left="@dimen/pointer_fill_style_circle_background_outline_offset"
+                android:bottom="@dimen/pointer_fill_style_circle_background_outline_offset"
+                android:right="@dimen/pointer_fill_style_circle_background_outline_offset">
+                <shape android:shape="rectangle">
+                    <corners android:radius="@dimen/pointer_fill_style_circle_background_corner_radius" />
+                    <size
+                        android:width="@dimen/pointer_fill_style_circle_background_outer_diameter_less_stroke"
+                        android:height="@dimen/pointer_fill_style_circle_background_outer_diameter_less_stroke" />
+                    <stroke
+                        android:width="@dimen/pointer_fill_style_circle_background_selected_outline_stroke"
+                        android:color="@androidprv:color/materialColorSecondary" />
+                </shape>
+            </item>
+            <item
+                android:top="@dimen/pointer_fill_style_circle_background_offset"
+                android:left="@dimen/pointer_fill_style_circle_background_offset"
+                android:bottom="@dimen/pointer_fill_style_circle_background_offset"
+                android:right="@dimen/pointer_fill_style_circle_background_offset">
+                <shape android:shape="rectangle">
+                    <corners android:radius="@dimen/pointer_fill_style_circle_background_corner_inner_radius" />
+                    <size
+                        android:width="@dimen/pointer_fill_style_circle_background_outer_diameter_selected"
+                        android:height="@dimen/pointer_fill_style_circle_background_outer_diameter_selected" />
+                    <solid android:color="@androidprv:color/materialColorSurfaceBright" />
+                </shape>
+            </item>
+            <item
+                android:id="@+id/tintableCircleSelected"
+                android:top="@dimen/pointer_fill_style_circle_offset_selected"
+                android:left="@dimen/pointer_fill_style_circle_offset_selected"
+                android:bottom="@dimen/pointer_fill_style_circle_offset_selected"
+                android:right="@dimen/pointer_fill_style_circle_offset_selected">
+                <shape android:shape="oval">
+                    <size
+                        android:width="@dimen/pointer_fill_style_circle_diameter"
+                        android:height="@dimen/pointer_fill_style_circle_diameter" />
+                    <solid android:color="@android:color/white" />
+                </shape>
+            </item>
+            <item
+                android:top="@dimen/pointer_fill_style_circle_outline_offset_selected"
+                android:left="@dimen/pointer_fill_style_circle_outline_offset_selected"
+                android:bottom="@dimen/pointer_fill_style_circle_outline_offset_selected"
+                android:right="@dimen/pointer_fill_style_circle_outline_offset_selected">
+                <shape android:shape="oval">
+                    <size
+                        android:width="@dimen/pointer_fill_style_circle_outline_diameter"
+                        android:height="@dimen/pointer_fill_style_circle_outline_diameter" />
+                    <stroke
+                        android:width="@dimen/pointer_fill_style_circle_outline_stroke"
+                        android:color="@android:color/white" />
+                </shape>
+            </item>
+            <item
+                android:gravity="center"
+                android:width="@dimen/pointer_fill_style_checkmark_size"
+                android:height="@dimen/pointer_fill_style_checkmark_size"
+                android:drawable="@drawable/pointer_fill_check_24dp" />
+        </layer-list>
+    </item>
+    <item android:state_hovered="true">
+        <layer-list>
+            <item>
+                <shape android:shape="rectangle">
+                    <corners android:radius="@dimen/pointer_fill_style_circle_background_corner_radius" />
+                    <size
+                        android:width="@dimen/pointer_fill_style_circle_background_outer_diameter"
+                        android:height="@dimen/pointer_fill_style_circle_background_outer_diameter" />
+                    <solid android:color="@color/pointer_fill_hovered_color" />
+                </shape>
+            </item>
+            <item
+                android:id="@+id/tintableCircleHovered"
+                android:top="@dimen/pointer_fill_style_circle_offset"
+                android:left="@dimen/pointer_fill_style_circle_offset"
+                android:bottom="@dimen/pointer_fill_style_circle_offset"
+                android:right="@dimen/pointer_fill_style_circle_offset">
+                <shape android:shape="oval">
+                    <size
+                        android:width="@dimen/pointer_fill_style_circle_diameter"
+                        android:height="@dimen/pointer_fill_style_circle_diameter" />
+                    <solid android:color="@android:color/white" />
+                </shape>
+            </item>
+            <item
+                android:top="@dimen/pointer_fill_style_circle_outline_offset"
+                android:left="@dimen/pointer_fill_style_circle_outline_offset"
+                android:bottom="@dimen/pointer_fill_style_circle_outline_offset"
+                android:right="@dimen/pointer_fill_style_circle_outline_offset">
+                <shape android:shape="oval">
+                    <size
+                        android:width="@dimen/pointer_fill_style_circle_outline_diameter"
+                        android:height="@dimen/pointer_fill_style_circle_outline_diameter" />
+                    <stroke
+                        android:width="@dimen/pointer_fill_style_circle_outline_stroke"
+                        android:color="@android:color/white" />
+                </shape>
+            </item>
+        </layer-list>
+    </item>
+    <item><!-- default state -->
+        <layer-list>
+            <item>
+                <shape android:shape="rectangle">
+                    <corners android:radius="@dimen/pointer_fill_style_circle_background_corner_radius" />
+                    <size
+                        android:width="@dimen/pointer_fill_style_circle_background_outer_diameter"
+                        android:height="@dimen/pointer_fill_style_circle_background_outer_diameter" />
+                    <solid android:color="@androidprv:color/materialColorSurfaceBright" />
+                </shape>
+            </item>
+            <item
+                android:id="@+id/tintableCircleDefault"
+                android:top="@dimen/pointer_fill_style_circle_offset"
+                android:left="@dimen/pointer_fill_style_circle_offset"
+                android:bottom="@dimen/pointer_fill_style_circle_offset"
+                android:right="@dimen/pointer_fill_style_circle_offset">
+                <shape android:shape="oval">
+                    <size
+                        android:width="@dimen/pointer_fill_style_circle_diameter"
+                        android:height="@dimen/pointer_fill_style_circle_diameter" />
+                    <solid android:color="@android:color/white" />
+                </shape>
+            </item>
+            <item
+                android:top="@dimen/pointer_fill_style_circle_outline_offset"
+                android:left="@dimen/pointer_fill_style_circle_outline_offset"
+                android:bottom="@dimen/pointer_fill_style_circle_outline_offset"
+                android:right="@dimen/pointer_fill_style_circle_outline_offset">
+                <shape android:shape="oval">
+                    <size
+                        android:width="@dimen/pointer_fill_style_circle_outline_diameter"
+                        android:height="@dimen/pointer_fill_style_circle_outline_diameter" />
+                    <stroke
+                        android:width="@dimen/pointer_fill_style_circle_outline_stroke"
+                        android:color="@android:color/white" />
+                </shape>
+            </item>
+        </layer-list>
+    </item>
+</selector>
diff --git a/res/drawable/pointer_icon_fill_color_foreground.xml b/res/drawable/pointer_icon_fill_color_foreground.xml
deleted file mode 100644
index 3d41620..0000000
--- a/res/drawable/pointer_icon_fill_color_foreground.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright 2024 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">
-    <item android:state_selected="true" android:state_hovered="true">
-        <layer-list>
-            <item>
-                <shape android:shape="oval">
-                    <size android:width="@dimen/pointer_fill_style_circle_hover_selected_diameter"
-                        android:height="@dimen/pointer_fill_style_circle_hover_selected_diameter" />
-                    <stroke android:width="@dimen/pointer_fill_style_shape_hovered_stroke"
-                        android:color="@color/pointer_fill_outline_color" />
-                </shape>
-            </item>
-            <item
-                android:top="@dimen/pointer_fill_style_checkmark_hovered_padding"
-                android:left="@dimen/pointer_fill_style_checkmark_hovered_padding"
-                android:bottom="@dimen/pointer_fill_style_checkmark_hovered_padding"
-                android:right="@dimen/pointer_fill_style_checkmark_hovered_padding"
-                android:drawable="@drawable/pointer_fill_check_24dp" />
-        </layer-list>
-    </item>
-    <item android:state_selected="true">
-        <layer-list>
-            <item>
-                <inset android:insetTop="@dimen/pointer_fill_style_circle_selected_offset"
-                    android:insetLeft="@dimen/pointer_fill_style_circle_selected_offset"
-                    android:insetBottom="@dimen/pointer_fill_style_circle_selected_offset"
-                    android:insetRight="@dimen/pointer_fill_style_circle_selected_offset">
-                    <shape android:shape="oval">
-                        <size android:width="@dimen/pointer_fill_style_circle_selected_diameter"
-                            android:height="@dimen/pointer_fill_style_circle_selected_diameter" />
-                        <stroke android:width="@dimen/pointer_fill_style_shape_selected_stroke"
-                            android:color="@color/pointer_fill_outline_color" />
-                    </shape>
-                </inset>
-            </item>
-            <item
-                android:top="@dimen/pointer_fill_style_checkmark_selected_padding"
-                android:left="@dimen/pointer_fill_style_checkmark_selected_padding"
-                android:bottom="@dimen/pointer_fill_style_checkmark_selected_padding"
-                android:right="@dimen/pointer_fill_style_checkmark_selected_padding"
-                android:drawable="@drawable/pointer_fill_check_24dp" />
-        </layer-list>
-    </item>
-    <item android:state_hovered="true">
-        <shape android:shape="oval">
-            <size android:width="@dimen/pointer_fill_style_circle_hover_diameter"
-                android:height="@dimen/pointer_fill_style_circle_hover_diameter" />
-            <stroke android:width="@dimen/pointer_fill_style_shape_hovered_stroke"
-                android:color="@color/pointer_fill_outline_color" />
-        </shape>
-    </item>
-</selector>
diff --git a/res/layout/battery_chart_graph.xml b/res/layout/battery_chart_graph.xml
index b84f38a..358cdd0 100644
--- a/res/layout/battery_chart_graph.xml
+++ b/res/layout/battery_chart_graph.xml
@@ -53,6 +53,7 @@
             android:layout_height="@dimen/chartview_layout_height"
             android:layout_marginBottom="16dp"
             android:visibility="gone"
+            android:alpha="0"
             android:contentDescription="@string/hourly_battery_usage_chart"
             android:textAppearance="?android:attr/textAppearanceSmall"
             settings:textColor="?android:attr/textColorSecondary" />
diff --git a/res/layout/keyboard_layout_dialog_switch_hint.xml b/res/layout/keyboard_layout_dialog_switch_hint.xml
deleted file mode 100644
index af8c3f4..0000000
--- a/res/layout/keyboard_layout_dialog_switch_hint.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 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:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:orientation="vertical">
-
-    <ImageView android:id="@+id/titleDivider"
-        android:layout_width="match_parent"
-        android:layout_height="1dip"
-        android:scaleType="fitXY"
-        android:gravity="fill_horizontal"
-        android:src="@android:drawable/divider_horizontal_dark"
-        android:contentDescription="@null" />
-
-    <TextView
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:text="@string/keyboard_layout_dialog_switch_hint"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        android:textColor="?android:attr/textColorAlertDialogListItem"
-        android:minHeight="48dp"
-        android:gravity="center" />
-
-</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/pointer_icon_fill_style_layout.xml b/res/layout/pointer_icon_fill_style_layout.xml
index aba57a6..2be750f 100644
--- a/res/layout/pointer_icon_fill_style_layout.xml
+++ b/res/layout/pointer_icon_fill_style_layout.xml
@@ -42,7 +42,6 @@
         android:layout_height="@dimen/pointer_fill_container_height"
         android:layout_marginBottom="@dimen/pointer_fill_style_circle_padding"
         android:layout_marginTop="@dimen/pointer_fill_style_circle_padding"
-        android:background="@drawable/pointer_icon_fill_container_background"
         android:gravity="center"
         android:paddingTop="@dimen/pointer_fill_style_container_padding"
         android:paddingBottom="@dimen/pointer_fill_style_container_padding">
@@ -53,19 +52,18 @@
             android:focusable="false"
             android:clickable="false"
             android:importantForAccessibility="no"
-            android:layout_weight="4" />
+            android:layout_weight="1" />
 
         <ImageView
             android:id="@+id/button_black"
-            android:layout_width="@dimen/pointer_fill_style_circle_diameter"
+            android:layout_width="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:layout_weight="0"
-            android:layout_height="@dimen/pointer_fill_style_circle_diameter"
+            android:layout_height="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:adjustViewBounds="true"
-            android:maxWidth="@dimen/pointer_fill_style_circle_diameter"
+            android:maxWidth="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:contentDescription="@string/pointer_fill_style_black_button"
             android:scaleType="center"
-            android:background="@drawable/pointer_icon_fill_color_background"
-            android:src="@drawable/pointer_icon_fill_color_foreground" />
+            android:src="@drawable/pointer_icon_fill_color_background" />
 
         <View
             android:layout_width="0dp"
@@ -73,19 +71,18 @@
             android:focusable="false"
             android:clickable="false"
             android:importantForAccessibility="no"
-            android:layout_weight="3" />
+            android:layout_weight="1" />
 
         <ImageView
             android:id="@+id/button_green"
-            android:layout_width="@dimen/pointer_fill_style_circle_diameter"
+            android:layout_width="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:layout_weight="0"
-            android:layout_height="@dimen/pointer_fill_style_circle_diameter"
+            android:layout_height="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:adjustViewBounds="true"
-            android:maxWidth="@dimen/pointer_fill_style_circle_diameter"
+            android:maxWidth="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:contentDescription="@string/pointer_fill_style_green_button"
             android:scaleType="center"
-            android:background="@drawable/pointer_icon_fill_color_background"
-            android:src="@drawable/pointer_icon_fill_color_foreground" />
+            android:src="@drawable/pointer_icon_fill_color_background" />
 
         <View
             android:layout_width="0dp"
@@ -93,19 +90,18 @@
             android:focusable="false"
             android:clickable="false"
             android:importantForAccessibility="no"
-            android:layout_weight="3" />
+            android:layout_weight="1" />
 
         <ImageView
             android:id="@+id/button_red"
-            android:layout_width="@dimen/pointer_fill_style_circle_diameter"
+            android:layout_width="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:layout_weight="0"
-            android:layout_height="@dimen/pointer_fill_style_circle_diameter"
+            android:layout_height="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:adjustViewBounds="true"
-            android:maxWidth="@dimen/pointer_fill_style_circle_diameter"
+            android:maxWidth="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:contentDescription="@string/pointer_fill_style_red_button"
             android:scaleType="center"
-            android:background="@drawable/pointer_icon_fill_color_background"
-            android:src="@drawable/pointer_icon_fill_color_foreground" />
+            android:src="@drawable/pointer_icon_fill_color_background" />
 
         <View
             android:layout_width="0dp"
@@ -113,19 +109,18 @@
             android:focusable="false"
             android:clickable="false"
             android:importantForAccessibility="no"
-            android:layout_weight="3" />
+            android:layout_weight="1" />
 
         <ImageView
             android:id="@+id/button_pink"
-            android:layout_width="@dimen/pointer_fill_style_circle_diameter"
+            android:layout_width="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:layout_weight="0"
-            android:layout_height="@dimen/pointer_fill_style_circle_diameter"
+            android:layout_height="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:adjustViewBounds="true"
-            android:maxWidth="@dimen/pointer_fill_style_circle_diameter"
+            android:maxWidth="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:contentDescription="@string/pointer_fill_style_pink_button"
             android:scaleType="center"
-            android:background="@drawable/pointer_icon_fill_color_background"
-            android:src="@drawable/pointer_icon_fill_color_foreground" />
+            android:src="@drawable/pointer_icon_fill_color_background" />
 
         <View
             android:layout_width="0dp"
@@ -133,19 +128,18 @@
             android:focusable="false"
             android:clickable="false"
             android:importantForAccessibility="no"
-            android:layout_weight="3" />
+            android:layout_weight="1" />
 
         <ImageView
             android:id="@+id/button_blue"
-            android:layout_width="@dimen/pointer_fill_style_circle_diameter"
+            android:layout_width="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:layout_weight="0"
-            android:layout_height="@dimen/pointer_fill_style_circle_diameter"
+            android:layout_height="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:adjustViewBounds="true"
-            android:maxWidth="@dimen/pointer_fill_style_circle_diameter"
+            android:maxWidth="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:contentDescription="@string/pointer_fill_style_blue_button"
             android:scaleType="center"
-            android:background="@drawable/pointer_icon_fill_color_background"
-            android:src="@drawable/pointer_icon_fill_color_foreground" />
+            android:src="@drawable/pointer_icon_fill_color_background" />
 
         <View
             android:layout_width="0dp"
@@ -153,19 +147,18 @@
             android:focusable="false"
             android:clickable="false"
             android:importantForAccessibility="no"
-            android:layout_weight="3" />
+            android:layout_weight="1" />
 
         <ImageView
             android:id="@+id/button_purple"
-            android:layout_width="@dimen/pointer_fill_style_circle_diameter"
+            android:layout_width="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:layout_weight="0"
-            android:layout_height="@dimen/pointer_fill_style_circle_diameter"
+            android:layout_height="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:adjustViewBounds="true"
-            android:maxWidth="@dimen/pointer_fill_style_circle_diameter"
+            android:maxWidth="@dimen/pointer_fill_style_circle_background_outer_diameter"
             android:contentDescription="@string/pointer_fill_style_purple_button"
             android:scaleType="center"
-            android:background="@drawable/pointer_icon_fill_color_background"
-            android:src="@drawable/pointer_icon_fill_color_foreground" />
+            android:src="@drawable/pointer_icon_fill_color_background" />
 
         <View
             android:layout_width="0dp"
@@ -173,7 +166,7 @@
             android:focusable="false"
             android:clickable="false"
             android:importantForAccessibility="no"
-            android:layout_weight="4" />
+            android:layout_weight="1" />
     </LinearLayout>
 
 </LinearLayout>
diff --git a/res/layout/settings_main_prefs.xml b/res/layout/settings_main_prefs.xml
index 48352e2..affdd7a 100644
--- a/res/layout/settings_main_prefs.xml
+++ b/res/layout/settings_main_prefs.xml
@@ -28,6 +28,13 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"/>
 
+    <com.android.settings.widget.SettingsMainSwitchBar
+        android:id="@+id/expressive_switch_bar"
+        android:visibility="gone"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginHorizontal="16dip"/>
+
     <FrameLayout
         android:id="@+id/main_content"
         android:layout_width="match_parent"
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
index a117e47..3892138 100644
--- a/res/values-night/colors.xml
+++ b/res/values-night/colors.xml
@@ -77,8 +77,8 @@
     <!-- Switch bar disabled state color-->
     <color name="switch_bar_state_disabled_color">#1FE3E3E3</color>
 
-    <!-- Pointer fill color setting outline color-->
-    <color name="pointer_fill_outline_color">#FFFFFF</color>
+    <!-- Pointer fill color setting, fill selector's background color on hover. -->
+    <color name="pointer_fill_hovered_color">#3E373C</color>
 
     <!-- Connected displays -->
     <color name="display_topology_background_color">@color/settingslib_color_charcoal</color>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 0b7e0c1..6e3f96f 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -219,8 +219,8 @@
     <!-- Switch bar disabled state color-->
     <color name="switch_bar_state_disabled_color">#1F1F1F1F</color>
 
-    <!-- Pointer fill color setting outline color-->
-    <color name="pointer_fill_outline_color">#000000</color>
+    <!-- Pointer fill color setting, fill selector's background color on hover. -->
+    <color name="pointer_fill_hovered_color">#1C201A1E</color>
 
     <!-- Connected displays -->
     <color name="display_topology_background_color">@color/settingslib_color_grey100</color>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index d202f85..2784f37 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -180,21 +180,28 @@
     <dimen name="keyboard_picker_text_size">16sp</dimen>
 
     <!-- Pointer -->
-    <dimen name="pointer_fill_container_height">88dp</dimen>
-    <dimen name="pointer_fill_container_max_width">448dp</dimen>
+    <dimen name="pointer_fill_container_height">80dp</dimen>
+    <dimen name="pointer_fill_container_max_width">468dp</dimen>
     <dimen name="pointer_fill_style_container_padding">32dp</dimen>
-    <dimen name="pointer_fill_style_circle_diameter">56dp</dimen>
-    <dimen name="pointer_fill_style_circle_hover_selected_diameter">52dp</dimen>
-    <dimen name="pointer_fill_style_circle_hover_diameter">56dp</dimen>
-    <dimen name="pointer_fill_style_circle_selected_diameter">50dp</dimen>
-    <dimen name="pointer_fill_style_circle_inner_diameter">40dp</dimen>
-    <dimen name="pointer_fill_style_circle_offset">8dp</dimen>
+    <dimen name="pointer_fill_style_target_width">64dp</dimen>
+    <dimen name="pointer_fill_style_circle_diameter">39dp</dimen>
+    <dimen name="pointer_fill_style_circle_outline_diameter">39.5dp</dimen>
+    <dimen name="pointer_fill_style_circle_background_corner_radius">20dp</dimen>
+    <dimen name="pointer_fill_style_circle_background_corner_inner_radius">16dp</dimen>
+    <dimen name="pointer_fill_style_circle_background_outer_diameter">64dp</dimen>
+    <dimen name="pointer_fill_style_circle_background_outer_diameter_less_stroke">62dp</dimen>
+    <dimen name="pointer_fill_style_circle_background_outer_diameter_selected">52dp</dimen>
+    <dimen name="pointer_fill_style_circle_background_outline_offset">1dp</dimen>
+    <dimen name="pointer_fill_style_circle_offset">12.5dp</dimen>
+    <dimen name="pointer_fill_style_circle_offset_selected">13.25dp</dimen>
+    <dimen name="pointer_fill_style_circle_outline_offset">12.25dp</dimen>
+    <dimen name="pointer_fill_style_circle_outline_offset_selected">13dp</dimen>
+    <dimen name="pointer_fill_style_circle_background_offset">7dp</dimen>
+    <dimen name="pointer_fill_style_circle_outline_stroke">1dp</dimen>
+    <dimen name="pointer_fill_style_circle_background_selected_outline_stroke">2dp</dimen>
     <dimen name="pointer_fill_style_circle_padding">16dp</dimen>
-    <dimen name="pointer_fill_style_circle_selected_offset">3dp</dimen>
-    <dimen name="pointer_fill_style_checkmark_selected_padding">14dp</dimen>
-    <dimen name="pointer_fill_style_checkmark_hovered_padding">17dp</dimen>
-    <dimen name="pointer_fill_style_shape_selected_stroke">2dp</dimen>
-    <dimen name="pointer_fill_style_shape_hovered_stroke">4dp</dimen>
+    <dimen name="pointer_fill_style_checkmark_selected_padding">16dp</dimen>
+    <dimen name="pointer_fill_style_checkmark_size">24dp</dimen>
     <dimen name="pointer_stroke_style_padding">8dp</dimen>
     <dimen name="pointer_stroke_style_text_padding">21dp</dimen>
     <dimen name="pointer_scale_padding">8dp</dimen>
diff --git a/res/xml/keyboard_layout_picker_fragment.xml b/res/xml/keyboard_layout_picker_fragment.xml
deleted file mode 100644
index d1bf971..0000000
--- a/res/xml/keyboard_layout_picker_fragment.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
-                  xmlns:settings="http://schemas.android.com/apk/res-auto"
-                  android:key="keyboard_layout_picker"
-                  android:title="@string/keyboard_layout_picker_title"
-                  settings:controller="com.android.settings.inputmethod.KeyboardLayoutPickerController">
-
-</PreferenceScreen>
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index d5cf9aa..aa52a2a 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -131,6 +131,9 @@
     public static class AccessibilityDaltonizerSettingsActivity extends SettingsActivity { /* empty */ }
     /** Activity for lockscreen settings. */
     public static class LockScreenSettingsActivity extends SettingsActivity { /* empty */ }
+    /** Activity for notifications on lockscreen settings. */
+    public static class LockScreenNotificationsSettingsActivity
+            extends SettingsActivity { /* empty */ }
     /** Activity for bluetooth pairing settings. */
     public static class BlueToothPairingActivity extends SettingsActivity { /* empty */ }
     /** Activity for Reduce Bright Colors. */
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index c81d504..4de04d3 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -311,7 +311,10 @@
         }
 
         setContentView(R.layout.settings_main_prefs);
-        mMainSwitch = findViewById(R.id.switch_bar);
+
+        mMainSwitch = SettingsThemeHelper.isExpressiveTheme(this)
+                ? findViewById(R.id.expressive_switch_bar)
+                : findViewById(R.id.switch_bar);
         if (mMainSwitch != null) {
             mMainSwitch.setMetricsCategory(lookupMetricsCategory());
             mMainSwitch.setTranslationZ(findViewById(R.id.main_content).getTranslationZ() + 1);
diff --git a/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java b/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java
index 2a22902..886c949 100644
--- a/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java
@@ -41,6 +41,7 @@
 import androidx.preference.PreferenceScreen;
 
 import com.android.internal.accessibility.common.ShortcutConstants;
+import com.android.internal.accessibility.util.ShortcutUtils;
 import com.android.settings.R;
 import com.android.settings.accessibility.shortcuts.EditShortcutsPreferenceFragment;
 import com.android.settings.dashboard.RestrictedDashboardFragment;
@@ -308,8 +309,8 @@
 
         final int shortcutTypes = getUserPreferredShortcutTypes();
         mShortcutPreference.setChecked(
-                AccessibilityUtil.hasValuesInSettings(getPrefContext(), shortcutTypes,
-                        getComponentName()));
+                ShortcutUtils.isShortcutContained(
+                        getPrefContext(), shortcutTypes, getComponentName().flattenToString()));
         mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
     }
 
diff --git a/src/com/android/settings/accessibility/AccessibilityUtil.java b/src/com/android/settings/accessibility/AccessibilityUtil.java
index 772ed96..04c4702 100644
--- a/src/com/android/settings/accessibility/AccessibilityUtil.java
+++ b/src/com/android/settings/accessibility/AccessibilityUtil.java
@@ -21,7 +21,6 @@
 import static android.view.WindowInsets.Type.systemBars;
 import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL;
 
-import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.DEFAULT;
 import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.GESTURE;
 import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.HARDWARE;
 import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.QUICK_SETTINGS;
@@ -37,7 +36,6 @@
 import android.graphics.Rect;
 import android.icu.text.CaseMap;
 import android.os.Build;
-import android.os.UserHandle;
 import android.provider.Settings;
 import android.text.TextUtils;
 import android.util.TypedValue;
@@ -195,52 +193,6 @@
     }
 
     /**
-     * Returns if component name existed in one of {@code shortcutTypes} string in Settings.
-     *
-     * @param context The current context.
-     * @param shortcutTypes A combination of {@link UserShortcutType}.
-     * @param componentName The component name that need to be checked existed in Settings.
-     * @return {@code true} if componentName existed in Settings.
-     */
-    static boolean hasValuesInSettings(Context context, int shortcutTypes,
-            @NonNull ComponentName componentName) {
-        for (int shortcutType : AccessibilityUtil.SHORTCUTS_ORDER_IN_UI) {
-            if (!android.provider.Flags.a11yStandaloneGestureEnabled()) {
-                if ((shortcutType & GESTURE) == GESTURE) {
-                    continue;
-                }
-            }
-            if ((shortcutTypes & shortcutType) == shortcutType
-                    && hasValueInSettings(context, shortcutType, componentName)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Returns if component name existed in {@code shortcutType} string Settings.
-     *
-     * @param context The current context.
-     * @param shortcutType The preferred shortcut type user selected.
-     * @param componentName The component name that need to be checked existed in Settings.
-     * @return {@code true} if componentName existed in Settings.
-     *
-     * @deprecated use
-     * {@link ShortcutUtils#isShortcutContained(Context, int, String)} instead.
-     *
-     * (TODO 367414968: finish removal.)
-     */
-    @Deprecated
-    @VisibleForTesting
-    static boolean hasValueInSettings(Context context, @UserShortcutType int shortcutType,
-            @NonNull ComponentName componentName) {
-        return ShortcutUtils.getShortcutTargetsFromSettings(
-                context, shortcutType, UserHandle.myUserId()
-        ).contains(componentName.flattenToString());
-    }
-
-    /**
      * Gets the corresponding user shortcut type of a given accessibility service.
      *
      * @param context The current context.
@@ -250,14 +202,15 @@
      */
     static int getUserShortcutTypesFromSettings(Context context,
             @NonNull ComponentName componentName) {
-        int shortcutTypes = DEFAULT;
+        int shortcutTypes = UserShortcutType.DEFAULT;
         for (int shortcutType : AccessibilityUtil.SHORTCUTS_ORDER_IN_UI) {
             if (!android.provider.Flags.a11yStandaloneGestureEnabled()) {
                 if ((shortcutType & GESTURE) == GESTURE) {
                     continue;
                 }
             }
-            if (hasValueInSettings(context, shortcutType, componentName)) {
+            if (ShortcutUtils.isShortcutContained(
+                    context, shortcutType, componentName.flattenToString())) {
                 shortcutTypes |= shortcutType;
             }
         }
diff --git a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
index 49f22bf..91f8c4f 100644
--- a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
@@ -56,6 +56,7 @@
 import androidx.recyclerview.widget.RecyclerView;
 
 import com.android.internal.accessibility.common.ShortcutConstants;
+import com.android.internal.accessibility.util.ShortcutUtils;
 import com.android.settings.R;
 import com.android.settings.SettingsActivity;
 import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
@@ -630,8 +631,8 @@
 
         final int shortcutTypes = getUserPreferredShortcutTypes();
         mShortcutPreference.setChecked(
-                AccessibilityUtil.hasValuesInSettings(getPrefContext(), shortcutTypes,
-                        mComponentName));
+                ShortcutUtils.isShortcutContained(
+                        getPrefContext(), shortcutTypes, mComponentName.flattenToString()));
         mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
     }
 
diff --git a/src/com/android/settings/applications/appcompat/UserAspectRatioManager.java b/src/com/android/settings/applications/appcompat/UserAspectRatioManager.java
index db239aa..40626b7 100644
--- a/src/com/android/settings/applications/appcompat/UserAspectRatioManager.java
+++ b/src/com/android/settings/applications/appcompat/UserAspectRatioManager.java
@@ -72,7 +72,6 @@
             "enable_app_compat_user_aspect_ratio_fullscreen";
     private static final boolean DEFAULT_VALUE_ENABLE_USER_ASPECT_RATIO_FULLSCREEN = true;
 
-    final boolean mIsUserMinAspectRatioAppDefaultFlagEnabled = Flags.userMinAspectRatioAppDefault();
     private final boolean mIgnoreActivityOrientationRequest;
 
     private final Context mContext;
@@ -252,8 +251,7 @@
     boolean isOverrideToFullscreenEnabled(String pkgName, int userId) {
         Boolean appAllowsOrientationOverride = readComponentProperty(mContext.getPackageManager(),
                 pkgName, PROPERTY_COMPAT_ALLOW_ORIENTATION_OVERRIDE);
-        return mIsUserMinAspectRatioAppDefaultFlagEnabled
-                && hasAspectRatioOption(USER_MIN_ASPECT_RATIO_FULLSCREEN, pkgName)
+        return hasAspectRatioOption(USER_MIN_ASPECT_RATIO_FULLSCREEN, pkgName)
                 && !FALSE.equals(appAllowsOrientationOverride)
                 && (isFullscreenCompatChangeEnabled(pkgName, userId)
                     || isUniversalResizeable(pkgName, userId));
@@ -326,15 +324,13 @@
             throw new RuntimeException("config_userAspectRatioOverrideValues options must have"
                     + " USER_MIN_ASPECT_RATIO_UNSET value");
         }
-        if (mIsUserMinAspectRatioAppDefaultFlagEnabled) {
-            userMinAspectRatioMap.put(USER_MIN_ASPECT_RATIO_APP_DEFAULT,
-                    userMinAspectRatioMap.get(USER_MIN_ASPECT_RATIO_UNSET));
-            mUserAspectRatioOrder.put(USER_MIN_ASPECT_RATIO_APP_DEFAULT,
-                    mUserAspectRatioOrder.get(USER_MIN_ASPECT_RATIO_UNSET));
-            if (mUserAspectRatioA11yMap.containsKey(USER_MIN_ASPECT_RATIO_UNSET)) {
-                mUserAspectRatioA11yMap.put(USER_MIN_ASPECT_RATIO_APP_DEFAULT,
-                        mUserAspectRatioA11yMap.get(USER_MIN_ASPECT_RATIO_UNSET));
-            }
+        userMinAspectRatioMap.put(USER_MIN_ASPECT_RATIO_APP_DEFAULT,
+                userMinAspectRatioMap.get(USER_MIN_ASPECT_RATIO_UNSET));
+        mUserAspectRatioOrder.put(USER_MIN_ASPECT_RATIO_APP_DEFAULT,
+                mUserAspectRatioOrder.get(USER_MIN_ASPECT_RATIO_UNSET));
+        if (mUserAspectRatioA11yMap.containsKey(USER_MIN_ASPECT_RATIO_UNSET)) {
+            mUserAspectRatioA11yMap.put(USER_MIN_ASPECT_RATIO_APP_DEFAULT,
+                    mUserAspectRatioA11yMap.get(USER_MIN_ASPECT_RATIO_UNSET));
         }
         return userMinAspectRatioMap;
     }
diff --git a/src/com/android/settings/bluetooth/AmbientVolumePreference.java b/src/com/android/settings/bluetooth/AmbientVolumePreference.java
index e916c04..8196edf 100644
--- a/src/com/android/settings/bluetooth/AmbientVolumePreference.java
+++ b/src/com/android/settings/bluetooth/AmbientVolumePreference.java
@@ -21,25 +21,29 @@
 import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_YES;
 import static android.view.View.VISIBLE;
 
+import static com.android.settings.bluetooth.BluetoothDetailsAmbientVolumePreferenceController.KEY_AMBIENT_VOLUME_SLIDER;
 import static com.android.settingslib.bluetooth.HearingAidInfo.DeviceSide.SIDE_LEFT;
 import static com.android.settingslib.bluetooth.HearingAidInfo.DeviceSide.SIDE_RIGHT;
 
+import android.bluetooth.BluetoothDevice;
 import android.content.Context;
-import android.util.ArrayMap;
 import android.view.View;
 import android.widget.ImageView;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.annotation.VisibleForTesting;
 import androidx.preference.PreferenceGroup;
 import androidx.preference.PreferenceViewHolder;
 
 import com.android.settings.R;
 import com.android.settings.widget.SeekBarPreference;
+import com.android.settingslib.bluetooth.AmbientVolumeUi;
 
+import com.google.common.collect.BiMap;
+import com.google.common.collect.HashBiMap;
 import com.google.common.primitives.Ints;
 
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -49,27 +53,13 @@
  * separated control for devices in the same set. Toggle the expand icon will make the UI switch
  * between unified and separated control.
  */
-public class AmbientVolumePreference extends PreferenceGroup {
+public class AmbientVolumePreference extends PreferenceGroup implements AmbientVolumeUi {
 
-    /** Interface definition for a callback to be invoked when the icon is clicked. */
-    public interface OnIconClickListener {
-        /** Called when the expand icon is clicked. */
-        void onExpandIconClick();
-
-        /** Called when the ambient volume icon is clicked. */
-        void onAmbientVolumeIconClick();
-    };
-
-    static final float ROTATION_COLLAPSED = 0f;
-    static final float ROTATION_EXPANDED = 180f;
-    static final int AMBIENT_VOLUME_LEVEL_MIN = 0;
-    static final int AMBIENT_VOLUME_LEVEL_MAX = 24;
-    static final int AMBIENT_VOLUME_LEVEL_DEFAULT = 24;
-    static final int SIDE_UNIFIED = 999;
-    static final List<Integer> VALID_SIDES = List.of(SIDE_UNIFIED, SIDE_LEFT, SIDE_RIGHT);
+    private static final int ORDER_AMBIENT_VOLUME_CONTROL_UNIFIED = 0;
+    private static final int ORDER_AMBIENT_VOLUME_CONTROL_SEPARATED = 1;
 
     @Nullable
-    private OnIconClickListener mListener;
+    private AmbientVolumeUiListener mListener;
     @Nullable
     private View mExpandIcon;
     @Nullable
@@ -78,27 +68,21 @@
     private boolean mExpanded = false;
     private boolean mMutable = false;
     private boolean mMuted = false;
-    private Map<Integer, SeekBarPreference> mSideToSliderMap = new ArrayMap<>();
-
-    /**
-     * Ambient volume level for hearing device ambient control icon
-     * <p>
-     * This icon visually represents the current ambient gain setting.
-     * It displays separate levels for the left and right sides, each with 5 levels ranging from 0
-     * to 4.
-     * <p>
-     * To represent the combined left/right levels with a single value, the following calculation
-     * is used:
-     *      finalLevel = (leftLevel * 5) + rightLevel
-     * For example:
-     * <ul>
-     *    <li>If left level is 2 and right level is 3, the final level will be 13 (2 * 5 + 3)</li>
-     *    <li>If both left and right levels are 0, the final level will be 0</li>
-     *    <li>If both left and right levels are 4, the final level will be 24</li>
-     * </ul>
-     */
+    private final BiMap<Integer, SeekBarPreference> mSideToSliderMap = HashBiMap.create();
     private int mVolumeLevel = AMBIENT_VOLUME_LEVEL_DEFAULT;
 
+    private final OnPreferenceChangeListener mPreferenceChangeListener =
+            (slider, v) -> {
+                if (slider instanceof SeekBarPreference && v instanceof final Integer value) {
+                    final Integer side = mSideToSliderMap.inverse().get(slider);
+                    if (mListener != null && side != null) {
+                        mListener.onSliderValueChange(side, value);
+                    }
+                    return true;
+                }
+                return false;
+            };
+
     public AmbientVolumePreference(@NonNull Context context) {
         super(context, null);
         setLayoutResource(R.layout.preference_ambient_volume);
@@ -138,7 +122,8 @@
         updateExpandIcon();
     }
 
-    void setExpandable(boolean expandable) {
+    @Override
+    public void setExpandable(boolean expandable) {
         mExpandable = expandable;
         if (!mExpandable) {
             setExpanded(false);
@@ -146,11 +131,13 @@
         updateExpandIcon();
     }
 
-    boolean isExpandable() {
+    @Override
+    public boolean isExpandable() {
         return mExpandable;
     }
 
-    void setExpanded(boolean expanded) {
+    @Override
+    public void setExpanded(boolean expanded) {
         if (!mExpandable && expanded) {
             return;
         }
@@ -159,11 +146,13 @@
         updateLayout();
     }
 
-    boolean isExpanded() {
+    @Override
+    public boolean isExpanded() {
         return mExpanded;
     }
 
-    void setMutable(boolean mutable) {
+    @Override
+    public void setMutable(boolean mutable) {
         mMutable = mutable;
         if (!mMutable) {
             mVolumeLevel = AMBIENT_VOLUME_LEVEL_DEFAULT;
@@ -172,11 +161,13 @@
         updateVolumeIcon();
     }
 
-    boolean isMutable() {
+    @Override
+    public boolean isMutable() {
         return mMutable;
     }
 
-    void setMuted(boolean muted) {
+    @Override
+    public void setMuted(boolean muted) {
         if (!mMutable && muted) {
             return;
         }
@@ -189,25 +180,35 @@
         updateVolumeIcon();
     }
 
-    boolean isMuted() {
+    @Override
+    public boolean isMuted() {
         return mMuted;
     }
 
-    void setOnIconClickListener(@Nullable OnIconClickListener listener) {
+    @Override
+    public void setListener(@Nullable AmbientVolumeUiListener listener) {
         mListener = listener;
     }
 
-    void setSliders(Map<Integer, SeekBarPreference> sideToSliderMap) {
-        mSideToSliderMap = sideToSliderMap;
-        for (SeekBarPreference preference : sideToSliderMap.values()) {
-            if (findPreference(preference.getKey()) == null) {
-                addPreference(preference);
+    @Override
+    public void setupSliders(@NonNull Map<Integer, BluetoothDevice> sideToDeviceMap) {
+        sideToDeviceMap.forEach((side, device) ->
+                createSlider(side, ORDER_AMBIENT_VOLUME_CONTROL_SEPARATED + side));
+        createSlider(SIDE_UNIFIED, ORDER_AMBIENT_VOLUME_CONTROL_UNIFIED);
+
+        if (!mSideToSliderMap.isEmpty()) {
+            for (int side : VALID_SIDES) {
+                final SeekBarPreference slider = mSideToSliderMap.get(side);
+                if (slider != null && findPreference(slider.getKey()) == null) {
+                    addPreference(slider);
+                }
             }
         }
         updateLayout();
     }
 
-    void setSliderEnabled(int side, boolean enabled) {
+    @Override
+    public void setSliderEnabled(int side, boolean enabled) {
         SeekBarPreference slider = mSideToSliderMap.get(side);
         if (slider != null && slider.isEnabled() != enabled) {
             slider.setEnabled(enabled);
@@ -215,7 +216,8 @@
         }
     }
 
-    void setSliderValue(int side, int value) {
+    @Override
+    public void setSliderValue(int side, int value) {
         SeekBarPreference slider = mSideToSliderMap.get(side);
         if (slider != null && slider.getProgress() != value) {
             slider.setProgress(value);
@@ -223,7 +225,8 @@
         }
     }
 
-    void setSliderRange(int side, int min, int max) {
+    @Override
+    public void setSliderRange(int side, int min, int max) {
         SeekBarPreference slider = mSideToSliderMap.get(side);
         if (slider != null) {
             slider.setMin(min);
@@ -231,7 +234,8 @@
         }
     }
 
-    void updateLayout() {
+    @Override
+    public void updateLayout() {
         mSideToSliderMap.forEach((side, slider) -> {
             if (side == SIDE_UNIFIED) {
                 slider.setVisible(!mExpanded);
@@ -279,8 +283,7 @@
         mExpandIcon.setVisibility(mExpandable ? VISIBLE : GONE);
         mExpandIcon.setRotation(mExpanded ? ROTATION_EXPANDED : ROTATION_COLLAPSED);
         if (mExpandable) {
-            final int stringRes = mExpanded
-                    ? R.string.bluetooth_ambient_volume_control_collapse
+            final int stringRes = mExpanded ? R.string.bluetooth_ambient_volume_control_collapse
                     : R.string.bluetooth_ambient_volume_control_expand;
             mExpandIcon.setContentDescription(getContext().getString(stringRes));
         } else {
@@ -294,8 +297,7 @@
         }
         mVolumeIcon.setImageLevel(mMuted ? 0 : mVolumeLevel);
         if (mMutable) {
-            final int stringRes = mMuted
-                    ? R.string.bluetooth_ambient_volume_unmute
+            final int stringRes = mMuted ? R.string.bluetooth_ambient_volume_unmute
                     : R.string.bluetooth_ambient_volume_mute;
             mVolumeIcon.setContentDescription(getContext().getString(stringRes));
             mVolumeIcon.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
@@ -304,4 +306,27 @@
             mVolumeIcon.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
         }
     }
+
+    private void createSlider(int side, int order) {
+        if (mSideToSliderMap.containsKey(side)) {
+            return;
+        }
+        SeekBarPreference slider = new SeekBarPreference(getContext());
+        slider.setKey(KEY_AMBIENT_VOLUME_SLIDER + "_" + side);
+        slider.setOrder(order);
+        slider.setOnPreferenceChangeListener(mPreferenceChangeListener);
+        if (side == SIDE_LEFT) {
+            slider.setTitle(
+                    getContext().getString(R.string.bluetooth_ambient_volume_control_left));
+        } else if (side == SIDE_RIGHT) {
+            slider.setTitle(
+                    getContext().getString(R.string.bluetooth_ambient_volume_control_right));
+        }
+        mSideToSliderMap.put(side, slider);
+    }
+
+    @VisibleForTesting
+    Map<Integer, SeekBarPreference> getSliders() {
+        return mSideToSliderMap;
+    }
 }
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsAmbientVolumePreferenceController.java b/src/com/android/settings/bluetooth/BluetoothDetailsAmbientVolumePreferenceController.java
index f237ffe..4b0b5d4 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsAmbientVolumePreferenceController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsAmbientVolumePreferenceController.java
@@ -16,41 +16,20 @@
 
 package com.android.settings.bluetooth;
 
-import static android.bluetooth.AudioInputControl.MUTE_NOT_MUTED;
-import static android.bluetooth.AudioInputControl.MUTE_MUTED;
-import static android.bluetooth.BluetoothDevice.BOND_BONDED;
-
-import static com.android.settings.bluetooth.AmbientVolumePreference.SIDE_UNIFIED;
-import static com.android.settings.bluetooth.AmbientVolumePreference.VALID_SIDES;
 import static com.android.settings.bluetooth.BluetoothDetailsHearingDeviceController.KEY_HEARING_DEVICE_GROUP;
 import static com.android.settings.bluetooth.BluetoothDetailsHearingDeviceController.ORDER_AMBIENT_VOLUME;
-import static com.android.settingslib.bluetooth.HearingAidInfo.DeviceSide.SIDE_INVALID;
-import static com.android.settingslib.bluetooth.HearingAidInfo.DeviceSide.SIDE_LEFT;
-import static com.android.settingslib.bluetooth.HearingAidInfo.DeviceSide.SIDE_RIGHT;
-import static com.android.settingslib.bluetooth.HearingDeviceLocalDataManager.Data.INVALID_VOLUME;
 
-import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothProfile;
 import android.content.Context;
-import android.util.ArraySet;
-import android.util.Log;
-import android.widget.Toast;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.annotation.VisibleForTesting;
-import androidx.preference.Preference;
 import androidx.preference.PreferenceCategory;
 import androidx.preference.PreferenceFragmentCompat;
 import androidx.preference.PreferenceScreen;
 
-import com.android.settings.R;
-import com.android.settings.widget.SeekBarPreference;
-import com.android.settingslib.bluetooth.AmbientVolumeController;
-import com.android.settingslib.bluetooth.BluetoothCallback;
+import com.android.settingslib.bluetooth.AmbientVolumeUiController;
 import com.android.settingslib.bluetooth.CachedBluetoothDevice;
-import com.android.settingslib.bluetooth.HearingDeviceLocalDataManager;
-import com.android.settingslib.bluetooth.HearingDeviceLocalDataManager.Data;
 import com.android.settingslib.bluetooth.LocalBluetoothManager;
 import com.android.settingslib.bluetooth.VolumeControlProfile;
 import com.android.settingslib.core.lifecycle.Lifecycle;
@@ -58,39 +37,21 @@
 import com.android.settingslib.core.lifecycle.events.OnStop;
 import com.android.settingslib.utils.ThreadUtils;
 
-import com.google.common.collect.BiMap;
-import com.google.common.collect.HashBiMap;
-
-import java.util.Map;
-import java.util.Set;
-
-/** A {@link BluetoothDetailsController} that manages ambient volume control preferences. */
-public class BluetoothDetailsAmbientVolumePreferenceController extends
-        BluetoothDetailsController implements Preference.OnPreferenceChangeListener,
-        HearingDeviceLocalDataManager.OnDeviceLocalDataChangeListener, OnStart, OnStop,
-        AmbientVolumeController.AmbientVolumeControlCallback, BluetoothCallback {
+/** A {@link BluetoothDetailsController} that manages ambient volume preference. */
+public class BluetoothDetailsAmbientVolumePreferenceController extends BluetoothDetailsController
+        implements OnStart, OnStop {
 
     private static final boolean DEBUG = true;
     private static final String TAG = "AmbientPrefController";
 
     static final String KEY_AMBIENT_VOLUME = "ambient_volume";
     static final String KEY_AMBIENT_VOLUME_SLIDER = "ambient_volume_slider";
-    private static final int ORDER_AMBIENT_VOLUME_CONTROL_UNIFIED = 0;
-    private static final int ORDER_AMBIENT_VOLUME_CONTROL_SEPARATED = 1;
 
     private final LocalBluetoothManager mBluetoothManager;
-    private final Set<CachedBluetoothDevice> mCachedDevices = new ArraySet<>();
-    private final BiMap<Integer, BluetoothDevice> mSideToDeviceMap = HashBiMap.create();
-    private final BiMap<Integer, SeekBarPreference> mSideToSliderMap = HashBiMap.create();
-    private final HearingDeviceLocalDataManager mLocalDataManager;
-    private final AmbientVolumeController mVolumeController;
-
-    @Nullable
-    private PreferenceCategory mDeviceControls;
     @Nullable
     private AmbientVolumePreference mPreference;
     @Nullable
-    private Toast mToast;
+    private AmbientVolumeUiController mAmbientUiController;
 
     public BluetoothDetailsAmbientVolumePreferenceController(@NonNull Context context,
             @NonNull LocalBluetoothManager manager,
@@ -99,45 +60,42 @@
             @NonNull Lifecycle lifecycle) {
         super(context, fragment, device, lifecycle);
         mBluetoothManager = manager;
-        mLocalDataManager = new HearingDeviceLocalDataManager(context);
-        mLocalDataManager.setOnDeviceLocalDataChangeListener(this,
-                ThreadUtils.getBackgroundExecutor());
-        mVolumeController = new AmbientVolumeController(manager.getProfileManager(), this);
     }
 
     @VisibleForTesting
-    BluetoothDetailsAmbientVolumePreferenceController(@NonNull Context context,
+    public BluetoothDetailsAmbientVolumePreferenceController(@NonNull Context context,
             @NonNull LocalBluetoothManager manager,
             @NonNull PreferenceFragmentCompat fragment,
             @NonNull CachedBluetoothDevice device,
             @NonNull Lifecycle lifecycle,
-            @NonNull HearingDeviceLocalDataManager localSettings,
-            @NonNull AmbientVolumeController volumeController) {
+            @NonNull AmbientVolumeUiController uiController) {
         super(context, fragment, device, lifecycle);
         mBluetoothManager = manager;
-        mLocalDataManager = localSettings;
-        mVolumeController = volumeController;
+        mAmbientUiController = uiController;
     }
 
     @Override
     protected void init(PreferenceScreen screen) {
-        mDeviceControls = screen.findPreference(KEY_HEARING_DEVICE_GROUP);
-        if (mDeviceControls == null) {
+        PreferenceCategory deviceControls = screen.findPreference(KEY_HEARING_DEVICE_GROUP);
+        if (deviceControls == null) {
             return;
         }
-        loadDevices();
+        mPreference = new AmbientVolumePreference(deviceControls.getContext());
+        mPreference.setKey(KEY_AMBIENT_VOLUME);
+        mPreference.setOrder(ORDER_AMBIENT_VOLUME);
+        deviceControls.addPreference(mPreference);
+
+        mAmbientUiController = new AmbientVolumeUiController(mContext, mBluetoothManager,
+                mPreference);
+        mAmbientUiController.loadDevice(mCachedDevice);
     }
 
     @Override
     public void onStart() {
         ThreadUtils.postOnBackgroundThread(() -> {
-            mBluetoothManager.getEventManager().registerCallback(this);
-            mLocalDataManager.start();
-            mCachedDevices.forEach(device -> {
-                device.registerCallback(ThreadUtils.getBackgroundExecutor(), this);
-                mVolumeController.registerCallback(ThreadUtils.getBackgroundExecutor(),
-                        device.getDevice());
-            });
+            if (mAmbientUiController != null) {
+                mAmbientUiController.start();
+            }
         });
     }
 
@@ -153,12 +111,9 @@
     @Override
     public void onStop() {
         ThreadUtils.postOnBackgroundThread(() -> {
-            mBluetoothManager.getEventManager().unregisterCallback(this);
-            mLocalDataManager.stop();
-            mCachedDevices.forEach(device -> {
-                device.unregisterCallback(this);
-                mVolumeController.unregisterCallback(device.getDevice());
-            });
+            if (mAmbientUiController != null) {
+                mAmbientUiController.stop();
+            }
         });
     }
 
@@ -167,16 +122,8 @@
         if (!isAvailable()) {
             return;
         }
-        boolean shouldShowAmbientControl = isAmbientControlAvailable();
-        if (shouldShowAmbientControl) {
-            if (mPreference != null) {
-                mPreference.setVisible(true);
-            }
-            loadRemoteDataToUi();
-        } else {
-            if (mPreference != null) {
-                mPreference.setVisible(false);
-            }
+        if (mAmbientUiController != null) {
+            mAmbientUiController.refresh();
         }
     }
 
@@ -191,424 +138,4 @@
     public String getPreferenceKey() {
         return KEY_AMBIENT_VOLUME;
     }
-
-    @Override
-    public boolean onPreferenceChange(@NonNull Preference preference, @Nullable Object newValue) {
-        if (preference instanceof SeekBarPreference && newValue instanceof final Integer value) {
-            final int side = mSideToSliderMap.inverse().getOrDefault(preference, SIDE_INVALID);
-            if (DEBUG) {
-                Log.d(TAG, "onPreferenceChange: side=" + side + ", value=" + value);
-            }
-            setVolumeIfValid(side, value);
-
-            Runnable setAmbientRunnable = () -> {
-                if (side == SIDE_UNIFIED) {
-                    mSideToDeviceMap.forEach((s, d) -> mVolumeController.setAmbient(d, value));
-                } else {
-                    final BluetoothDevice device = mSideToDeviceMap.get(side);
-                    mVolumeController.setAmbient(device, value);
-                }
-            };
-
-            if (isControlMuted()) {
-                // User drag on the volume slider when muted. Unmute the devices first.
-                if (mPreference != null) {
-                    mPreference.setMuted(false);
-                }
-                for (BluetoothDevice device : mSideToDeviceMap.values()) {
-                    mVolumeController.setMuted(device, false);
-                }
-                // Restore the value before muted
-                loadLocalDataToUi();
-                // Delay set ambient on remote device since the immediately sequential command
-                // might get failed sometimes
-                mContext.getMainThreadHandler().postDelayed(setAmbientRunnable, 1000L);
-            } else {
-                setAmbientRunnable.run();
-            }
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    public void onProfileConnectionStateChanged(@NonNull CachedBluetoothDevice cachedDevice,
-            int state, int bluetoothProfile) {
-        if (bluetoothProfile == BluetoothProfile.VOLUME_CONTROL
-                && state == BluetoothProfile.STATE_CONNECTED
-                && mCachedDevices.contains(cachedDevice)) {
-            // After VCP connected, AICS may not ready yet and still return invalid value, delay
-            // a while to wait AICS ready as a workaround
-            mContext.getMainThreadHandler().postDelayed(this::refresh, 1000L);
-        }
-    }
-
-    @Override
-    public void onDeviceAttributesChanged() {
-        mCachedDevices.forEach(device -> {
-            device.unregisterCallback(this);
-            mVolumeController.unregisterCallback(device.getDevice());
-        });
-        mContext.getMainExecutor().execute(() -> {
-            loadDevices();
-            if (!mCachedDevices.isEmpty()) {
-                refresh();
-            }
-            ThreadUtils.postOnBackgroundThread(() ->
-                    mCachedDevices.forEach(device -> {
-                        device.registerCallback(ThreadUtils.getBackgroundExecutor(), this);
-                        mVolumeController.registerCallback(ThreadUtils.getBackgroundExecutor(),
-                                device.getDevice());
-                    })
-            );
-        });
-    }
-
-    @Override
-    public void onDeviceLocalDataChange(@NonNull String address, @Nullable Data data) {
-        if (data == null) {
-            // The local data is removed because the device is unpaired, do nothing
-            return;
-        }
-        for (BluetoothDevice device : mSideToDeviceMap.values()) {
-            if (device.getAnonymizedAddress().equals(address)) {
-                mContext.getMainExecutor().execute(() -> loadLocalDataToUi(device));
-                return;
-            }
-        }
-    }
-
-    @Override
-    public void onVolumeControlServiceConnected() {
-        mCachedDevices.forEach(
-                device -> mVolumeController.registerCallback(ThreadUtils.getBackgroundExecutor(),
-                        device.getDevice()));
-    }
-
-    @Override
-    public void onAmbientChanged(@NonNull BluetoothDevice device, int gainSettings) {
-        if (DEBUG) {
-            Log.d(TAG, "onAmbientChanged, value:" + gainSettings + ", device:" + device);
-        }
-        Data data = mLocalDataManager.get(device);
-        boolean isInitiatedFromUi = (isControlExpanded() && data.ambient() == gainSettings)
-                || (!isControlExpanded() && data.groupAmbient() == gainSettings);
-        if (isInitiatedFromUi) {
-            // The change is initiated from UI, no need to update UI
-            return;
-        }
-
-        // We have to check if we need to expand the controls by getting all remote
-        // device's ambient value, delay for a while to wait all remote devices update
-        // to the latest value to avoid unnecessary expand action.
-        mContext.getMainThreadHandler().postDelayed(this::refresh, 1200L);
-    }
-
-    @Override
-    public void onMuteChanged(@NonNull BluetoothDevice device, int mute) {
-        if (DEBUG) {
-            Log.d(TAG, "onMuteChanged, mute:" + mute + ", device:" + device);
-        }
-        boolean isInitiatedFromUi = (isControlMuted() && mute == MUTE_MUTED)
-                || (!isControlMuted() && mute == MUTE_NOT_MUTED);
-        if (isInitiatedFromUi) {
-            // The change is initiated from UI, no need to update UI
-            return;
-        }
-
-        // We have to check if we need to mute the devices by getting all remote
-        // device's mute state, delay for a while to wait all remote devices update
-        // to the latest value.
-        mContext.getMainThreadHandler().postDelayed(this::refresh, 1200L);
-    }
-
-    @Override
-    public void onCommandFailed(@NonNull BluetoothDevice device) {
-        Log.w(TAG, "onCommandFailed, device:" + device);
-        mContext.getMainExecutor().execute(() -> {
-            showErrorToast();
-            refresh();
-        });
-    }
-
-    private void loadDevices() {
-        mSideToDeviceMap.clear();
-        mCachedDevices.clear();
-        if (VALID_SIDES.contains(mCachedDevice.getDeviceSide())
-                && mCachedDevice.getBondState() == BOND_BONDED) {
-            mSideToDeviceMap.put(mCachedDevice.getDeviceSide(), mCachedDevice.getDevice());
-            mCachedDevices.add(mCachedDevice);
-        }
-        for (CachedBluetoothDevice memberDevice : mCachedDevice.getMemberDevice()) {
-            if (VALID_SIDES.contains(memberDevice.getDeviceSide())
-                    && memberDevice.getBondState() == BOND_BONDED) {
-                mSideToDeviceMap.put(memberDevice.getDeviceSide(), memberDevice.getDevice());
-                mCachedDevices.add(memberDevice);
-            }
-        }
-        createAmbientVolumePreference();
-        createSliderPreferences();
-        if (mPreference != null) {
-            mPreference.setExpandable(mSideToDeviceMap.size() > 1);
-            mPreference.setSliders((mSideToSliderMap));
-        }
-    }
-
-    private void createAmbientVolumePreference() {
-        if (mPreference != null || mDeviceControls == null) {
-            return;
-        }
-
-        mPreference = new AmbientVolumePreference(mDeviceControls.getContext());
-        mPreference.setKey(KEY_AMBIENT_VOLUME);
-        mPreference.setOrder(ORDER_AMBIENT_VOLUME);
-        mPreference.setOnIconClickListener(
-                new AmbientVolumePreference.OnIconClickListener() {
-                    @Override
-                    public void onExpandIconClick() {
-                        mSideToDeviceMap.forEach((s, d) -> {
-                            if (!isControlMuted()) {
-                                // Apply previous collapsed/expanded volume to remote device
-                                Data data = mLocalDataManager.get(d);
-                                int volume = isControlExpanded()
-                                        ? data.ambient() : data.groupAmbient();
-                                mVolumeController.setAmbient(d, volume);
-                            }
-                            // Update new value to local data
-                            mLocalDataManager.updateAmbientControlExpanded(d, isControlExpanded());
-                        });
-                    }
-
-                    @Override
-                    public void onAmbientVolumeIconClick() {
-                        if (!isControlMuted()) {
-                            loadLocalDataToUi();
-                        }
-                        for (BluetoothDevice device : mSideToDeviceMap.values()) {
-                            mVolumeController.setMuted(device, isControlMuted());
-                        }
-                    }
-                });
-        if (mDeviceControls.findPreference(mPreference.getKey()) == null) {
-            mDeviceControls.addPreference(mPreference);
-        }
-    }
-
-    private void createSliderPreferences() {
-        mSideToDeviceMap.forEach((s, d) ->
-                createSliderPreference(s, ORDER_AMBIENT_VOLUME_CONTROL_SEPARATED + s));
-        createSliderPreference(SIDE_UNIFIED, ORDER_AMBIENT_VOLUME_CONTROL_UNIFIED);
-    }
-
-    private void createSliderPreference(int side, int order) {
-        if (mSideToSliderMap.containsKey(side) || mDeviceControls == null) {
-            return;
-        }
-        SeekBarPreference preference = new SeekBarPreference(mDeviceControls.getContext());
-        preference.setKey(KEY_AMBIENT_VOLUME_SLIDER + "_" + side);
-        preference.setOrder(order);
-        preference.setOnPreferenceChangeListener(this);
-        if (side == SIDE_LEFT) {
-            preference.setTitle(mContext.getString(R.string.bluetooth_ambient_volume_control_left));
-        } else if (side == SIDE_RIGHT) {
-            preference.setTitle(
-                    mContext.getString(R.string.bluetooth_ambient_volume_control_right));
-        }
-        mSideToSliderMap.put(side, preference);
-    }
-
-    /** Refreshes the control UI visibility and enabled state. */
-    private void refreshControlUi() {
-        if (mPreference != null) {
-            boolean isAnySliderEnabled = false;
-            for (Map.Entry<Integer, BluetoothDevice> entry : mSideToDeviceMap.entrySet()) {
-                final int side = entry.getKey();
-                final BluetoothDevice device = entry.getValue();
-                final boolean enabled = isDeviceConnectedToVcp(device)
-                        && mVolumeController.isAmbientControlAvailable(device);
-                isAnySliderEnabled |= enabled;
-                mPreference.setSliderEnabled(side, enabled);
-            }
-            mPreference.setSliderEnabled(SIDE_UNIFIED, isAnySliderEnabled);
-            mPreference.updateLayout();
-        }
-    }
-
-    /** Sets the volume to the corresponding control slider. */
-    private void setVolumeIfValid(int side, int volume) {
-        if (volume == INVALID_VOLUME) {
-            return;
-        }
-        if (mPreference != null) {
-            mPreference.setSliderValue(side, volume);
-        }
-        // Update new value to local data
-        if (side == SIDE_UNIFIED) {
-            mSideToDeviceMap.forEach((s, d) -> mLocalDataManager.updateGroupAmbient(d, volume));
-        } else {
-            mLocalDataManager.updateAmbient(mSideToDeviceMap.get(side), volume);
-        }
-    }
-
-    private void loadLocalDataToUi() {
-        mSideToDeviceMap.forEach((s, d) -> loadLocalDataToUi(d));
-    }
-
-    private void loadLocalDataToUi(BluetoothDevice device) {
-        final Data data = mLocalDataManager.get(device);
-        if (DEBUG) {
-            Log.d(TAG, "loadLocalDataToUi, data=" + data + ", device=" + device);
-        }
-        final int side = mSideToDeviceMap.inverse().getOrDefault(device, SIDE_INVALID);
-        if (isDeviceConnectedToVcp(device) && !isControlMuted()) {
-            setVolumeIfValid(side, data.ambient());
-            setVolumeIfValid(SIDE_UNIFIED, data.groupAmbient());
-        }
-        setControlExpanded(data.ambientControlExpanded());
-        refreshControlUi();
-    }
-
-    private void loadRemoteDataToUi() {
-        BluetoothDevice leftDevice = mSideToDeviceMap.get(SIDE_LEFT);
-        AmbientVolumeController.RemoteAmbientState leftState =
-                mVolumeController.refreshAmbientState(leftDevice);
-        BluetoothDevice rightDevice = mSideToDeviceMap.get(SIDE_RIGHT);
-        AmbientVolumeController.RemoteAmbientState rightState =
-                mVolumeController.refreshAmbientState(rightDevice);
-        if (DEBUG) {
-            Log.d(TAG, "loadRemoteDataToUi, left=" + leftState + ", right=" + rightState);
-        }
-
-        if (mPreference != null) {
-            mSideToDeviceMap.forEach((side, device) -> {
-                int ambientMax = mVolumeController.getAmbientMax(device);
-                int ambientMin = mVolumeController.getAmbientMin(device);
-                if (ambientMin != ambientMax) {
-                    mPreference.setSliderRange(side, ambientMin, ambientMax);
-                    mPreference.setSliderRange(SIDE_UNIFIED, ambientMin, ambientMax);
-                }
-            });
-        }
-
-        // Update ambient volume
-        final int leftAmbient = leftState != null ? leftState.gainSetting() : INVALID_VOLUME;
-        final int rightAmbient = rightState != null ? rightState.gainSetting() : INVALID_VOLUME;
-        if (isControlExpanded()) {
-            setVolumeIfValid(SIDE_LEFT, leftAmbient);
-            setVolumeIfValid(SIDE_RIGHT, rightAmbient);
-        } else {
-            if (leftAmbient != rightAmbient && leftAmbient != INVALID_VOLUME
-                    && rightAmbient != INVALID_VOLUME) {
-                setVolumeIfValid(SIDE_LEFT, leftAmbient);
-                setVolumeIfValid(SIDE_RIGHT, rightAmbient);
-                setControlExpanded(true);
-            } else {
-                int unifiedAmbient = leftAmbient != INVALID_VOLUME ? leftAmbient : rightAmbient;
-                setVolumeIfValid(SIDE_UNIFIED, unifiedAmbient);
-            }
-        }
-        // Initialize local data between side and group value
-        initLocalDataIfNeeded();
-
-        // Update mute state
-        boolean mutable = true;
-        boolean muted = true;
-        if (isDeviceConnectedToVcp(leftDevice) && leftState != null) {
-            mutable &= leftState.isMutable();
-            muted &= leftState.isMuted();
-        }
-        if (isDeviceConnectedToVcp(rightDevice) && rightState != null) {
-            mutable &= rightState.isMutable();
-            muted &= rightState.isMuted();
-        }
-        if (mPreference != null) {
-            mPreference.setMutable(mutable);
-            mPreference.setMuted(muted);
-        }
-
-        // Ensure remote device mute state is synced
-        syncMuteStateIfNeeded(leftDevice, leftState, muted);
-        syncMuteStateIfNeeded(rightDevice, rightState, muted);
-
-        refreshControlUi();
-    }
-
-    /** Check if any device in the group has valid ambient control points */
-    private boolean isAmbientControlAvailable() {
-        for (BluetoothDevice device : mSideToDeviceMap.values()) {
-            // Found ambient local data for this device, show the ambient control
-            if (mLocalDataManager.get(device).hasAmbientData()) {
-                return true;
-            }
-            // Found remote ambient control points on this device, show the ambient control
-            if (mVolumeController.isAmbientControlAvailable(device)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private boolean isControlExpanded() {
-        return mPreference != null && mPreference.isExpanded();
-    }
-
-    private void setControlExpanded(boolean expanded) {
-        if (mPreference != null && mPreference.isExpanded() != expanded) {
-            mPreference.setExpanded(expanded);
-        }
-        mSideToDeviceMap.forEach((s, d) -> {
-            // Update new value to local data
-            mLocalDataManager.updateAmbientControlExpanded(d, expanded);
-        });
-    }
-
-    private boolean isControlMuted() {
-        return mPreference != null && mPreference.isMuted();
-    }
-
-    private void initLocalDataIfNeeded() {
-        int smallerVolumeAmongGroup = Integer.MAX_VALUE;
-        for (BluetoothDevice device : mSideToDeviceMap.values()) {
-            Data data = mLocalDataManager.get(device);
-            if (data.ambient() != INVALID_VOLUME) {
-                smallerVolumeAmongGroup = Math.min(data.ambient(), smallerVolumeAmongGroup);
-            } else if (data.groupAmbient() != INVALID_VOLUME) {
-                // Initialize side ambient from group ambient value
-                mLocalDataManager.updateAmbient(device, data.groupAmbient());
-            }
-        }
-        if (smallerVolumeAmongGroup != Integer.MAX_VALUE) {
-            for (BluetoothDevice device : mSideToDeviceMap.values()) {
-                Data data = mLocalDataManager.get(device);
-                if (data.groupAmbient() == INVALID_VOLUME) {
-                    // Initialize group ambient from smaller side ambient value
-                    mLocalDataManager.updateGroupAmbient(device, smallerVolumeAmongGroup);
-                }
-            }
-        }
-    }
-
-    private void syncMuteStateIfNeeded(@Nullable BluetoothDevice device,
-            @Nullable AmbientVolumeController.RemoteAmbientState state, boolean muted) {
-        if (isDeviceConnectedToVcp(device) && state != null && state.isMutable()) {
-            if (state.isMuted() != muted) {
-                mVolumeController.setMuted(device, muted);
-            }
-        }
-    }
-
-    private boolean isDeviceConnectedToVcp(@Nullable BluetoothDevice device) {
-        return device != null && device.isConnected()
-                && mBluetoothManager.getProfileManager().getVolumeControlProfile()
-                .getConnectionStatus(device) == BluetoothProfile.STATE_CONNECTED;
-    }
-
-    private void showErrorToast() {
-        if (mToast != null) {
-            mToast.cancel();
-        }
-        mToast = Toast.makeText(mContext, R.string.bluetooth_ambient_volume_error,
-                Toast.LENGTH_SHORT);
-        mToast.show();
-    }
 }
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index 8541c7a..eeecdd5 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -130,7 +130,6 @@
 import com.android.settings.gestures.SwipeToNotificationSettings;
 import com.android.settings.gestures.SystemNavigationGestureSettings;
 import com.android.settings.inputmethod.AvailableVirtualKeyboardFragment;
-import com.android.settings.inputmethod.KeyboardLayoutPickerFragment;
 import com.android.settings.inputmethod.KeyboardSettings;
 import com.android.settings.inputmethod.ModifierKeysSettings;
 import com.android.settings.inputmethod.NewKeyboardLayoutEnabledLocalesFragment;
@@ -156,6 +155,7 @@
 import com.android.settings.network.tether.TetherSettings;
 import com.android.settings.nfc.PaymentSettings;
 import com.android.settings.notification.ConfigureNotificationSettings;
+import com.android.settings.notification.LockScreenNotificationsPreferencePageFragment;
 import com.android.settings.notification.NotificationAccessSettings;
 import com.android.settings.notification.NotificationAssistantPicker;
 import com.android.settings.notification.PoliteNotificationsPreferenceFragment;
@@ -309,7 +309,6 @@
             PrintJobSettingsFragment.class.getName(),
             TrustedCredentialsSettings.class.getName(),
             PaymentSettings.class.getName(),
-            KeyboardLayoutPickerFragment.class.getName(),
             PhysicalKeyboardFragment.class.getName(),
             ZenModeSettings.class.getName(),
             SoundSettings.class.getName(),
@@ -365,6 +364,7 @@
             EnterprisePrivacySettings.class.getName(),
             WebViewAppPicker.class.getName(),
             LockscreenDashboardFragment.class.getName(),
+            LockScreenNotificationsPreferencePageFragment.class.getName(),
             MemtagPage.class.getName(),
             BluetoothDeviceDetailsFragment.class.getName(),
             BluetoothBroadcastDialog.class.getName(),
diff --git a/src/com/android/settings/datetime/AutoTimePreferenceController.java b/src/com/android/settings/datetime/AutoTimePreferenceController.java
index 5b17e7e..cc005d7 100644
--- a/src/com/android/settings/datetime/AutoTimePreferenceController.java
+++ b/src/com/android/settings/datetime/AutoTimePreferenceController.java
@@ -26,6 +26,7 @@
 import android.app.time.TimeConfiguration;
 import android.app.time.TimeManager;
 import android.content.Context;
+import android.util.Log;
 
 import androidx.preference.Preference;
 
@@ -35,6 +36,8 @@
 
 public class AutoTimePreferenceController extends TogglePreferenceController {
 
+    private static final String TAG = "AutoTimePreferenceController";
+
     private UpdateTimeAndDateCallback mCallback;
     private final TimeManager mTimeManager;
 
@@ -74,7 +77,8 @@
                 // arbitrary.
                 return AVAILABLE;
             default:
-                throw new IllegalStateException("Unknown capability=" + capability);
+                Log.e(TAG, "Unknown capability=" + capability);
+                return UNSUPPORTED_ON_DEVICE;
         }
     }
 
diff --git a/src/com/android/settings/datetime/AutoTimeZonePreferenceController.java b/src/com/android/settings/datetime/AutoTimeZonePreferenceController.java
index ecd416d..f60a5cc 100644
--- a/src/com/android/settings/datetime/AutoTimeZonePreferenceController.java
+++ b/src/com/android/settings/datetime/AutoTimeZonePreferenceController.java
@@ -26,6 +26,7 @@
 import android.app.time.TimeZoneCapabilitiesAndConfig;
 import android.app.time.TimeZoneConfiguration;
 import android.content.Context;
+import android.util.Log;
 
 import androidx.preference.Preference;
 
@@ -35,6 +36,8 @@
 
 public class AutoTimeZonePreferenceController extends TogglePreferenceController {
 
+    private static final String TAG = "AutoTimeZonePreferenceController";
+
     private boolean mIsFromSUW;
     private UpdateTimeAndDateCallback mCallback;
     private final TimeManager mTimeManager;
@@ -92,7 +95,8 @@
                 // arbitrary.
                 return AVAILABLE;
             default:
-                throw new IllegalStateException("Unknown capability=" + capability);
+                Log.e(TAG, "Unknown capability=" + capability);
+                return UNSUPPORTED_ON_DEVICE;
         }
     }
 
diff --git a/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceController.java b/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceController.java
index d475d9d..05f5af6 100644
--- a/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceController.java
+++ b/src/com/android/settings/datetime/LocationTimeZoneDetectionPreferenceController.java
@@ -25,6 +25,7 @@
 import android.app.time.TimeZoneCapabilitiesAndConfig;
 import android.app.time.TimeZoneConfiguration;
 import android.content.Context;
+import android.util.Log;
 
 import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
@@ -138,7 +139,8 @@
         } else if (capability == CAPABILITY_NOT_APPLICABLE || capability == CAPABILITY_POSSESSED) {
             return isAutoTimeZoneEnabled() ? AVAILABLE : DISABLED_DEPENDENT_SETTING;
         } else {
-            throw new IllegalStateException("Unknown capability=" + capability);
+            Log.e(TAG, "Unknown capability=" + capability);
+            return UNSUPPORTED_ON_DEVICE;
         }
     }
 
diff --git a/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java b/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java
index 04dfc79..ac42ee3 100644
--- a/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java
+++ b/src/com/android/settings/development/bluetooth/AbstractBluetoothDialogPreferenceController.java
@@ -85,6 +85,8 @@
         if (bluetoothA2dp == null) {
             return;
         }
+        // update the cache of a2dp config(mBluetoothA2dpConfigStore) before writing config.
+        initConfigStore();
         writeConfigurationValues(index);
         final BluetoothCodecConfig codecConfig = mBluetoothA2dpConfigStore.createCodecConfig();
         BluetoothDevice activeDevice = getA2dpActiveDevice();
diff --git a/src/com/android/settings/display/AutoBrightnessPreferenceControllerForSetupWizard.java b/src/com/android/settings/display/AutoBrightnessPreferenceControllerForSetupWizard.java
index 7afe3ea..d9979a9 100644
--- a/src/com/android/settings/display/AutoBrightnessPreferenceControllerForSetupWizard.java
+++ b/src/com/android/settings/display/AutoBrightnessPreferenceControllerForSetupWizard.java
@@ -19,8 +19,12 @@
 import android.content.Context;
 
 import androidx.annotation.NonNull;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
 
 import com.android.settings.accessibility.Flags;
+import com.android.settingslib.RestrictedPreferenceHelper;
+import com.android.settingslib.RestrictedPreferenceHelperProvider;
 
 /**
  * The top-level preference controller that updates the adaptive brightness in the SetupWizard.
@@ -28,15 +32,35 @@
 public class AutoBrightnessPreferenceControllerForSetupWizard
         extends AutoBrightnessPreferenceController {
 
+    private RestrictedPreferenceHelper mRestrictedPreferenceHelper;
+
     public AutoBrightnessPreferenceControllerForSetupWizard(@NonNull Context context,
             @NonNull String key) {
         super(context, key);
     }
 
+    private boolean isRestricted() {
+        if (mRestrictedPreferenceHelper == null) {
+            return false;
+        }
+        return mRestrictedPreferenceHelper.isDisabledByAdmin()
+                || mRestrictedPreferenceHelper.isDisabledByEcm();
+    }
+
+    @Override
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+        Preference preference = screen.findPreference(getPreferenceKey());
+        if (preference instanceof RestrictedPreferenceHelperProvider helperProvider) {
+            mRestrictedPreferenceHelper = helperProvider.getRestrictedPreferenceHelper();
+            preference.setVisible(!isRestricted());
+        }
+    }
+
     @Override
     @AvailabilityStatus
     public int getAvailabilityStatus() {
-        if (!Flags.addBrightnessSettingsInSuw()) {
+        if (!Flags.addBrightnessSettingsInSuw() || isRestricted()) {
             return CONDITIONALLY_UNAVAILABLE;
         }
         return super.getAvailabilityStatus();
diff --git a/src/com/android/settings/display/BrightnessLevelPreference.kt b/src/com/android/settings/display/BrightnessLevelPreference.kt
index 73a2280..ca54d78 100644
--- a/src/com/android/settings/display/BrightnessLevelPreference.kt
+++ b/src/com/android/settings/display/BrightnessLevelPreference.kt
@@ -40,7 +40,7 @@
 import com.android.settingslib.display.BrightnessUtils.GAMMA_SPACE_MAX
 import com.android.settingslib.display.BrightnessUtils.GAMMA_SPACE_MIN
 import com.android.settingslib.display.BrightnessUtils.convertLinearToGammaFloat
-import com.android.settingslib.metadata.PersistentPreference
+import com.android.settingslib.metadata.FloatPersistentPreference
 import com.android.settingslib.metadata.PreferenceMetadata
 import com.android.settingslib.metadata.PreferenceSummaryProvider
 import com.android.settingslib.metadata.ReadWritePermit
@@ -52,7 +52,7 @@
 // LINT.IfChange
 class BrightnessLevelPreference :
     PreferenceMetadata,
-    PersistentPreference<Float>,
+    FloatPersistentPreference,
     PreferenceBinding,
     PreferenceRestrictionMixin,
     PreferenceSummaryProvider,
@@ -78,7 +78,7 @@
     override val useAdminDisabledSummary: Boolean
         get() = true
 
-    override fun intent(context: Context) =
+    override fun intent(context: Context): Intent? =
         Intent(ACTION_SHOW_BRIGHTNESS_DIALOG)
             .setPackage(Utils.SYSTEMUI_PACKAGE_NAME)
             .putExtra(
diff --git a/src/com/android/settings/display/BrightnessLevelPreferenceControllerForSetupWizard.java b/src/com/android/settings/display/BrightnessLevelPreferenceControllerForSetupWizard.java
index 6e002ae..197e4fe 100644
--- a/src/com/android/settings/display/BrightnessLevelPreferenceControllerForSetupWizard.java
+++ b/src/com/android/settings/display/BrightnessLevelPreferenceControllerForSetupWizard.java
@@ -20,8 +20,12 @@
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
 
 import com.android.settings.accessibility.Flags;
+import com.android.settingslib.RestrictedPreferenceHelper;
+import com.android.settingslib.RestrictedPreferenceHelperProvider;
 import com.android.settingslib.core.lifecycle.Lifecycle;
 
 /**
@@ -31,15 +35,35 @@
 public class BrightnessLevelPreferenceControllerForSetupWizard extends
         BrightnessLevelPreferenceController {
 
+    private RestrictedPreferenceHelper mRestrictedPreferenceHelper;
+
     public BrightnessLevelPreferenceControllerForSetupWizard(@NonNull Context context,
             @Nullable Lifecycle lifecycle) {
         super(context, lifecycle);
     }
 
+    private boolean isRestricted() {
+        if (mRestrictedPreferenceHelper == null) {
+            return false;
+        }
+        return mRestrictedPreferenceHelper.isDisabledByAdmin()
+                || mRestrictedPreferenceHelper.isDisabledByEcm();
+    }
+
+    @Override
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+        Preference preference = screen.findPreference(getPreferenceKey());
+        if (preference instanceof RestrictedPreferenceHelperProvider helperProvider) {
+            mRestrictedPreferenceHelper = helperProvider.getRestrictedPreferenceHelper();
+            preference.setVisible(!isRestricted());
+        }
+    }
+
     @Override
     @AvailabilityStatus
     public int getAvailabilityStatus() {
-        if (!Flags.addBrightnessSettingsInSuw()) {
+        if (!Flags.addBrightnessSettingsInSuw() || isRestricted()) {
             return CONDITIONALLY_UNAVAILABLE;
         }
         return super.getAvailabilityStatus();
diff --git a/src/com/android/settings/fuelgauge/batteryusage/PowerUsageAdvanced.java b/src/com/android/settings/fuelgauge/batteryusage/PowerUsageAdvanced.java
index 9943d0b..b8188b8 100644
--- a/src/com/android/settings/fuelgauge/batteryusage/PowerUsageAdvanced.java
+++ b/src/com/android/settings/fuelgauge/batteryusage/PowerUsageAdvanced.java
@@ -32,6 +32,8 @@
 import androidx.annotation.VisibleForTesting;
 import androidx.loader.app.LoaderManager;
 import androidx.loader.content.Loader;
+import androidx.preference.PreferenceScreen;
+import androidx.recyclerview.widget.RecyclerView;
 
 import com.android.settings.R;
 import com.android.settings.SettingsActivity;
@@ -150,6 +152,13 @@
     }
 
     @Override
+    protected RecyclerView.Adapter onCreateAdapter(PreferenceScreen preferenceScreen) {
+        final RecyclerView.Adapter adapter = super.onCreateAdapter(preferenceScreen);
+        adapter.setHasStableIds(true);
+        return adapter;
+    }
+
+    @Override
     protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
         final List<AbstractPreferenceController> controllers = new ArrayList<>();
         mBatteryTipsController = new BatteryTipsController(context);
diff --git a/src/com/android/settings/inputmethod/KeyboardLayoutDialogFragment.java b/src/com/android/settings/inputmethod/KeyboardLayoutDialogFragment.java
deleted file mode 100644
index a4baa91..0000000
--- a/src/com/android/settings/inputmethod/KeyboardLayoutDialogFragment.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * Copyright (C) 2012 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.inputmethod;
-
-import android.app.Activity;
-import android.app.Dialog;
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.hardware.input.InputDeviceIdentifier;
-import android.hardware.input.InputManager;
-import android.hardware.input.InputManager.InputDeviceListener;
-import android.hardware.input.KeyboardLayout;
-import android.os.Bundle;
-import android.view.InputDevice;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.CheckedTextView;
-import android.widget.RadioButton;
-import android.widget.TextView;
-
-import androidx.appcompat.app.AlertDialog;
-import androidx.loader.app.LoaderManager.LoaderCallbacks;
-import androidx.loader.content.AsyncTaskLoader;
-import androidx.loader.content.Loader;
-
-import com.android.settings.R;
-import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
-
-import java.util.ArrayList;
-import java.util.Collections;
-
-public class KeyboardLayoutDialogFragment extends InstrumentedDialogFragment
-        implements InputDeviceListener, LoaderCallbacks<KeyboardLayoutDialogFragment.Keyboards> {
-    private static final String KEY_INPUT_DEVICE_IDENTIFIER = "inputDeviceIdentifier";
-
-    private InputDeviceIdentifier mInputDeviceIdentifier;
-    private int mInputDeviceId = -1;
-    private InputManager mIm;
-    private KeyboardLayoutAdapter mAdapter;
-
-    public KeyboardLayoutDialogFragment() {
-    }
-
-    public KeyboardLayoutDialogFragment(InputDeviceIdentifier inputDeviceIdentifier) {
-        mInputDeviceIdentifier = inputDeviceIdentifier;
-    }
-
-
-    @Override
-    public int getMetricsCategory() {
-        return SettingsEnums.DIALOG_KEYBOARD_LAYOUT;
-    }
-
-    @Override
-    public void onAttach(Activity activity) {
-        super.onAttach(activity);
-
-        Context context = activity.getBaseContext();
-        mIm = (InputManager)context.getSystemService(Context.INPUT_SERVICE);
-        mAdapter = new KeyboardLayoutAdapter(context);
-    }
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        if (savedInstanceState != null) {
-            mInputDeviceIdentifier = savedInstanceState.getParcelable(KEY_INPUT_DEVICE_IDENTIFIER);
-        }
-
-        getLoaderManager().initLoader(0, null, this);
-    }
-
-    @Override
-    public void onSaveInstanceState(Bundle outState) {
-        super.onSaveInstanceState(outState);
-        outState.putParcelable(KEY_INPUT_DEVICE_IDENTIFIER, mInputDeviceIdentifier);
-    }
-
-    @Override
-    public Dialog onCreateDialog(Bundle savedInstanceState) {
-        Context context = getActivity();
-        LayoutInflater inflater = LayoutInflater.from(context);
-        AlertDialog.Builder builder = new AlertDialog.Builder(context)
-            .setTitle(R.string.keyboard_layout_dialog_title)
-            .setPositiveButton(R.string.keyboard_layout_dialog_setup_button,
-                    new DialogInterface.OnClickListener() {
-                        @Override
-                        public void onClick(DialogInterface dialog, int which) {
-                            onSetupLayoutsButtonClicked();
-                        }
-                    })
-            .setSingleChoiceItems(mAdapter, -1,
-                    new DialogInterface.OnClickListener() {
-                        @Override
-                        public void onClick(DialogInterface dialog, int which) {
-                            onKeyboardLayoutClicked(which);
-                        }
-                    })
-            .setView(inflater.inflate(R.layout.keyboard_layout_dialog_switch_hint, null));
-        updateSwitchHintVisibility();
-        return builder.create();
-    }
-
-    @Override
-    public void onResume() {
-        super.onResume();
-
-        mIm.registerInputDeviceListener(this, null);
-
-        InputDevice inputDevice =
-                mIm.getInputDeviceByDescriptor(mInputDeviceIdentifier.getDescriptor());
-        if (inputDevice == null) {
-            dismiss();
-            return;
-        }
-        mInputDeviceId = inputDevice.getId();
-    }
-
-    @Override
-    public void onPause() {
-        mIm.unregisterInputDeviceListener(this);
-        mInputDeviceId = -1;
-
-        super.onPause();
-    }
-
-    @Override
-    public void onCancel(DialogInterface dialog) {
-        super.onCancel(dialog);
-        dismiss();
-    }
-
-    private void onSetupLayoutsButtonClicked() {
-        ((OnSetupKeyboardLayoutsListener)getTargetFragment()).onSetupKeyboardLayouts(
-                mInputDeviceIdentifier);
-    }
-
-    @Override
-    public void onActivityResult(int requestCode, int resultCode, Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-        show(getActivity().getSupportFragmentManager(), "layout");
-    }
-
-    private void onKeyboardLayoutClicked(int which) {
-        if (which >= 0 && which < mAdapter.getCount()) {
-            KeyboardLayout keyboardLayout = mAdapter.getItem(which);
-            if (keyboardLayout != null) {
-                mIm.setCurrentKeyboardLayoutForInputDevice(mInputDeviceIdentifier,
-                        keyboardLayout.getDescriptor());
-            }
-            dismiss();
-        }
-    }
-
-    @Override
-    public Loader<Keyboards> onCreateLoader(int id, Bundle args) {
-        return new KeyboardLayoutLoader(getActivity().getBaseContext(), mInputDeviceIdentifier);
-    }
-
-    @Override
-    public void onLoadFinished(Loader<Keyboards> loader, Keyboards data) {
-        mAdapter.clear();
-        mAdapter.addAll(data.keyboardLayouts);
-        mAdapter.setCheckedItem(data.current);
-        AlertDialog dialog = (AlertDialog)getDialog();
-        if (dialog != null) {
-            dialog.getListView().setItemChecked(data.current, true);
-        }
-        updateSwitchHintVisibility();
-    }
-
-    @Override
-    public void onLoaderReset(Loader<Keyboards> loader) {
-        mAdapter.clear();
-        updateSwitchHintVisibility();
-    }
-
-    @Override
-    public void onInputDeviceAdded(int deviceId) {
-    }
-
-    @Override
-    public void onInputDeviceChanged(int deviceId) {
-        if (mInputDeviceId >= 0 && deviceId == mInputDeviceId) {
-            getLoaderManager().restartLoader(0, null, this);
-        }
-    }
-
-    @Override
-    public void onInputDeviceRemoved(int deviceId) {
-        if (mInputDeviceId >= 0 && deviceId == mInputDeviceId) {
-            dismiss();
-        }
-    }
-
-    private void updateSwitchHintVisibility() {
-        AlertDialog dialog = (AlertDialog)getDialog();
-        if (dialog != null) {
-            View customPanel = dialog.findViewById(com.google.android.material.R.id.customPanel);
-            customPanel.setVisibility(mAdapter.getCount() > 1 ? View.VISIBLE : View.GONE);
-        }
-    }
-
-    private static final class KeyboardLayoutAdapter extends ArrayAdapter<KeyboardLayout> {
-        private final LayoutInflater mInflater;
-        private int mCheckedItem = -1;
-
-        public KeyboardLayoutAdapter(Context context) {
-            super(context, com.android.internal.R.layout.simple_list_item_2_single_choice);
-            mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-        }
-
-        public void setCheckedItem(int position) {
-            mCheckedItem = position;
-        }
-
-        @Override
-        public View getView(int position, View convertView, ViewGroup parent) {
-            KeyboardLayout item = getItem(position);
-            String label, collection;
-            if (item != null) {
-                label = item.getLabel();
-                collection = item.getCollection();
-            } else {
-                label = getContext().getString(R.string.keyboard_layout_default_label);
-                collection = "";
-            }
-
-            boolean checked = (position == mCheckedItem);
-            if (collection.isEmpty()) {
-                return inflateOneLine(convertView, parent, label, checked);
-            } else {
-                return inflateTwoLine(convertView, parent, label, collection, checked);
-            }
-        }
-
-        private View inflateOneLine(View convertView, ViewGroup parent,
-                String label, boolean checked) {
-            View view = convertView;
-            if (view == null || isTwoLine(view)) {
-                view = mInflater.inflate(
-                        com.android.internal.R.layout.simple_list_item_single_choice,
-                        parent, false);
-                setTwoLine(view, false);
-            }
-            CheckedTextView headline = (CheckedTextView) view.findViewById(android.R.id.text1);
-            headline.setText(label);
-            headline.setChecked(checked);
-            return view;
-        }
-
-        private View inflateTwoLine(View convertView, ViewGroup parent,
-                String label, String collection, boolean checked) {
-            View view = convertView;
-            if (view == null || !isTwoLine(view)) {
-                view = mInflater.inflate(
-                        com.android.internal.R.layout.simple_list_item_2_single_choice,
-                        parent, false);
-                setTwoLine(view, true);
-            }
-            TextView headline = (TextView) view.findViewById(android.R.id.text1);
-            TextView subText = (TextView) view.findViewById(android.R.id.text2);
-            RadioButton radioButton =
-                    (RadioButton)view.findViewById(com.android.internal.R.id.radio);
-            headline.setText(label);
-            subText.setText(collection);
-            radioButton.setChecked(checked);
-            return view;
-        }
-
-        private static boolean isTwoLine(View view) {
-            return view.getTag() == Boolean.TRUE;
-        }
-
-        private static void setTwoLine(View view, boolean twoLine) {
-            view.setTag(Boolean.valueOf(twoLine));
-        }
-    }
-
-    private static final class KeyboardLayoutLoader extends AsyncTaskLoader<Keyboards> {
-        private final InputDeviceIdentifier mInputDeviceIdentifier;
-
-        public KeyboardLayoutLoader(Context context, InputDeviceIdentifier inputDeviceIdentifier) {
-            super(context);
-            mInputDeviceIdentifier = inputDeviceIdentifier;
-        }
-
-        @Override
-        public Keyboards loadInBackground() {
-            Keyboards keyboards = new Keyboards();
-            InputManager im = (InputManager)getContext().getSystemService(Context.INPUT_SERVICE);
-            if (mInputDeviceIdentifier == null || InputPeripheralsSettingsUtils.getInputDevice(
-                    im, mInputDeviceIdentifier) == null) {
-                keyboards.keyboardLayouts.add(null); // default layout
-                keyboards.current = 0;
-                return keyboards;
-            }
-            String[] keyboardLayoutDescriptors = im.getEnabledKeyboardLayoutsForInputDevice(
-                    mInputDeviceIdentifier);
-            for (String keyboardLayoutDescriptor : keyboardLayoutDescriptors) {
-                KeyboardLayout keyboardLayout = im.getKeyboardLayout(keyboardLayoutDescriptor);
-                if (keyboardLayout != null) {
-                    keyboards.keyboardLayouts.add(keyboardLayout);
-                }
-            }
-            Collections.sort(keyboards.keyboardLayouts);
-
-            String currentKeyboardLayoutDescriptor =
-                    im.getCurrentKeyboardLayoutForInputDevice(mInputDeviceIdentifier);
-            if (currentKeyboardLayoutDescriptor != null) {
-                final int numKeyboardLayouts = keyboards.keyboardLayouts.size();
-                for (int i = 0; i < numKeyboardLayouts; i++) {
-                    if (keyboards.keyboardLayouts.get(i).getDescriptor().equals(
-                            currentKeyboardLayoutDescriptor)) {
-                        keyboards.current = i;
-                        break;
-                    }
-                }
-            }
-
-            if (keyboards.keyboardLayouts.isEmpty()) {
-                keyboards.keyboardLayouts.add(null); // default layout
-                keyboards.current = 0;
-            }
-            return keyboards;
-        }
-
-        @Override
-        protected void onStartLoading() {
-            super.onStartLoading();
-            forceLoad();
-        }
-
-        @Override
-        protected void onStopLoading() {
-            super.onStopLoading();
-            cancelLoad();
-        }
-    }
-
-    public static final class Keyboards {
-        public final ArrayList<KeyboardLayout> keyboardLayouts = new ArrayList<KeyboardLayout>();
-        public int current = -1;
-    }
-
-    public interface OnSetupKeyboardLayoutsListener {
-        public void onSetupKeyboardLayouts(InputDeviceIdentifier mInputDeviceIdentifier);
-    }
-}
diff --git a/src/com/android/settings/inputmethod/KeyboardLayoutPickerController.java b/src/com/android/settings/inputmethod/KeyboardLayoutPickerController.java
deleted file mode 100644
index 97d8ffc..0000000
--- a/src/com/android/settings/inputmethod/KeyboardLayoutPickerController.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * 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.inputmethod;
-
-
-import android.content.Context;
-import android.hardware.input.InputDeviceIdentifier;
-import android.hardware.input.InputManager;
-import android.hardware.input.KeyboardLayout;
-
-import androidx.fragment.app.Fragment;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-import androidx.preference.SwitchPreferenceCompat;
-import androidx.preference.TwoStatePreference;
-
-import com.android.settings.core.BasePreferenceController;
-import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.core.lifecycle.events.OnStart;
-import com.android.settingslib.core.lifecycle.events.OnStop;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-public class KeyboardLayoutPickerController extends BasePreferenceController implements
-        InputManager.InputDeviceListener, LifecycleObserver, OnStart, OnStop {
-
-    private final InputManager mIm;
-    private final Map<TwoStatePreference, KeyboardLayout> mPreferenceMap;
-
-    private Fragment mParent;
-    private int mInputDeviceId;
-    private InputDeviceIdentifier mInputDeviceIdentifier;
-    private KeyboardLayout[] mKeyboardLayouts;
-    private PreferenceScreen mScreen;
-
-
-    public KeyboardLayoutPickerController(Context context, String key) {
-        super(context, key);
-        mIm = (InputManager) context.getSystemService(Context.INPUT_SERVICE);
-        mInputDeviceId = -1;
-        mPreferenceMap = new HashMap<>();
-    }
-
-    public void initialize(Fragment parent, InputDeviceIdentifier inputDeviceIdentifier) {
-        mParent = parent;
-        mInputDeviceIdentifier = inputDeviceIdentifier;
-        mKeyboardLayouts = mIm.getKeyboardLayoutsForInputDevice(mInputDeviceIdentifier);
-        Arrays.sort(mKeyboardLayouts);
-    }
-
-    @Override
-    public void onStart() {
-        mIm.registerInputDeviceListener(this, null);
-        if (mInputDeviceIdentifier == null
-                || InputPeripheralsSettingsUtils.getInputDevice(mIm, mInputDeviceIdentifier)
-                == null) {
-            return;
-        }
-        mInputDeviceId =
-                InputPeripheralsSettingsUtils.getInputDevice(mIm,
-                        mInputDeviceIdentifier).getId();
-        updateCheckedState();
-    }
-
-    @Override
-    public void onStop() {
-        mIm.unregisterInputDeviceListener(this);
-        mInputDeviceId = -1;
-    }
-
-    @Override
-    public void displayPreference(PreferenceScreen screen) {
-        super.displayPreference(screen);
-        mScreen = screen;
-        createPreferenceHierarchy();
-    }
-
-    @Override
-    public int getAvailabilityStatus() {
-        return AVAILABLE;
-    }
-
-    @Override
-    public boolean handlePreferenceTreeClick(Preference preference) {
-        if (!(preference instanceof TwoStatePreference switchPref)) {
-            return false;
-        }
-
-        final KeyboardLayout layout = mPreferenceMap.get(switchPref);
-        if (layout != null) {
-            final boolean checked = switchPref.isChecked();
-            if (checked) {
-                mIm.addKeyboardLayoutForInputDevice(mInputDeviceIdentifier,
-                        layout.getDescriptor());
-            } else {
-                mIm.removeKeyboardLayoutForInputDevice(mInputDeviceIdentifier,
-                        layout.getDescriptor());
-            }
-        }
-        return true;
-    }
-
-    @Override
-    public void onInputDeviceAdded(int deviceId) {
-
-    }
-
-    @Override
-    public void onInputDeviceRemoved(int deviceId) {
-        if (mInputDeviceId >= 0 && deviceId == mInputDeviceId) {
-            mParent.getActivity().finish();
-        }
-    }
-
-    @Override
-    public void onInputDeviceChanged(int deviceId) {
-        if (mInputDeviceId >= 0 && deviceId == mInputDeviceId) {
-            updateCheckedState();
-        }
-    }
-
-    private void updateCheckedState() {
-        final String[] enabledKeyboardLayouts = mIm.getEnabledKeyboardLayoutsForInputDevice(
-                mInputDeviceIdentifier);
-        Arrays.sort(enabledKeyboardLayouts);
-
-        for (Map.Entry<TwoStatePreference, KeyboardLayout> entry : mPreferenceMap.entrySet()) {
-            entry.getKey().setChecked(Arrays.binarySearch(enabledKeyboardLayouts,
-                    entry.getValue().getDescriptor()) >= 0);
-        }
-    }
-
-    private void createPreferenceHierarchy() {
-        if (mKeyboardLayouts == null) {
-            return;
-        }
-        for (KeyboardLayout layout : mKeyboardLayouts) {
-            final TwoStatePreference pref = new SwitchPreferenceCompat(mScreen.getContext());
-            pref.setTitle(layout.getLabel());
-            pref.setSummary(layout.getCollection());
-            // TODO: Waiting for new API to use a prefix with special number to setKey
-            pref.setKey(layout.getDescriptor());
-            mScreen.addPreference(pref);
-            mPreferenceMap.put(pref, layout);
-        }
-    }
-}
-
diff --git a/src/com/android/settings/inputmethod/KeyboardLayoutPickerFragment.java b/src/com/android/settings/inputmethod/KeyboardLayoutPickerFragment.java
deleted file mode 100644
index c21ac63..0000000
--- a/src/com/android/settings/inputmethod/KeyboardLayoutPickerFragment.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2016 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.inputmethod;
-
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.hardware.input.InputDeviceIdentifier;
-import android.hardware.input.InputManager;
-
-import com.android.settings.R;
-import com.android.settings.dashboard.DashboardFragment;
-
-public class KeyboardLayoutPickerFragment extends DashboardFragment {
-
-    private static final String TAG = "KeyboardLayoutPicker";
-
-    /**
-     * Intent extra: The input device descriptor of the keyboard whose keyboard
-     * layout is to be changed.
-     */
-    public static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier";
-
-    @Override
-    public int getMetricsCategory() {
-        return SettingsEnums.INPUTMETHOD_KEYBOARD;
-    }
-
-    @Override
-    public void onAttach(Context context) {
-        super.onAttach(context);
-
-        final InputDeviceIdentifier inputDeviceIdentifier = getActivity().getIntent().
-                getParcelableExtra(EXTRA_INPUT_DEVICE_IDENTIFIER);
-        final InputManager im = context.getSystemService(InputManager.class);
-        if (InputPeripheralsSettingsUtils.getInputDevice(im, inputDeviceIdentifier) == null) {
-            return;
-        }
-        use(KeyboardLayoutPickerController.class).initialize(this /*parent*/,
-                inputDeviceIdentifier);
-    }
-
-    @Override
-    protected String getLogTag() {
-        return TAG;
-    }
-
-    protected int getPreferenceScreenResId() {
-        return R.xml.keyboard_layout_picker_fragment;
-    }
-}
diff --git a/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java b/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java
index fcb672d..8aa5ac7 100644
--- a/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java
+++ b/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java
@@ -20,12 +20,10 @@
 import android.app.settings.SettingsEnums;
 import android.content.ContentResolver;
 import android.content.Context;
-import android.content.Intent;
 import android.database.ContentObserver;
 import android.hardware.input.InputDeviceIdentifier;
 import android.hardware.input.InputManager;
 import android.hardware.input.InputSettings;
-import android.hardware.input.KeyboardLayout;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
@@ -47,7 +45,6 @@
 
 import com.android.internal.util.Preconditions;
 import com.android.settings.R;
-import com.android.settings.Settings;
 import com.android.settings.core.SubSettingLauncher;
 import com.android.settings.dashboard.DashboardFragment;
 import com.android.settings.keyboard.Flags;
@@ -66,8 +63,7 @@
 //  controllers between here and A11y Setting page.
 @SearchIndexable
 public final class PhysicalKeyboardFragment extends DashboardFragment
-        implements InputManager.InputDeviceListener,
-        KeyboardLayoutDialogFragment.OnSetupKeyboardLayoutsListener {
+        implements InputManager.InputDeviceListener {
 
     private static final String KEYBOARD_OPTIONS_CATEGORY = "keyboard_options_category";
     private static final String KEYBOARD_A11Y_CATEGORY = "keyboard_a11y_category";
@@ -79,6 +75,7 @@
     private static final String KEYBOARD_SHORTCUTS_HELPER = "keyboard_shortcuts_helper";
     private static final String MODIFIER_KEYS_SETTINGS = "modifier_keys_settings";
     private static final String EXTRA_AUTO_SELECTION = "auto_selection";
+    public static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier";
     private static final String TAG = "KeyboardAndTouchA11yFragment";
     private static final Uri sVirtualKeyboardSettingsUri = Secure.getUriFor(
             Secure.SHOW_IME_WITH_HARD_KEYBOARD);
@@ -112,13 +109,8 @@
     private TwoStatePreference mAccessibilityStickyKeys = null;
     @Nullable
     private TwoStatePreference mAccessibilityMouseKeys = null;
-
-    private Intent mIntentWaitingForResult;
     private boolean mSupportsFirmwareUpdate;
 
-    static final String EXTRA_BT_ADDRESS = "extra_bt_address";
-    private String mBluetoothAddress;
-
     @Override
     protected String getLogTag() {
         return TAG;
@@ -197,8 +189,7 @@
             mKeyboardA11yCategory.setVisible(false);
         }
         InputDeviceIdentifier inputDeviceIdentifier = activity.getIntent().getParcelableExtra(
-                KeyboardLayoutPickerFragment.EXTRA_INPUT_DEVICE_IDENTIFIER,
-                InputDeviceIdentifier.class);
+                EXTRA_INPUT_DEVICE_IDENTIFIER, InputDeviceIdentifier.class);
         int intentFromWhere =
                 activity.getIntent().getIntExtra(android.provider.Settings.EXTRA_ENTRYPOINT, -1);
         if (intentFromWhere != -1) {
@@ -360,13 +351,6 @@
         }
     }
 
-    private void showKeyboardLayoutDialog(InputDeviceIdentifier inputDeviceIdentifier) {
-        KeyboardLayoutDialogFragment fragment = new KeyboardLayoutDialogFragment(
-                inputDeviceIdentifier);
-        fragment.setTargetFragment(this, 0);
-        fragment.show(getActivity().getSupportFragmentManager(), "keyboardLayout");
-    }
-
     private void showEnabledLocalesKeyboardLayoutList(InputDeviceIdentifier inputDeviceIdentifier) {
         Bundle arguments = new Bundle();
         arguments.putParcelable(InputPeripheralsSettingsUtils.EXTRA_INPUT_DEVICE_IDENTIFIER,
@@ -505,45 +489,6 @@
         }
     };
 
-    @Override
-    public void onSetupKeyboardLayouts(InputDeviceIdentifier inputDeviceIdentifier) {
-        final Intent intent = new Intent(Intent.ACTION_MAIN);
-        intent.setClass(getActivity(), Settings.KeyboardLayoutPickerActivity.class);
-        intent.putExtra(KeyboardLayoutPickerFragment.EXTRA_INPUT_DEVICE_IDENTIFIER,
-                inputDeviceIdentifier);
-        mIntentWaitingForResult = intent;
-        startActivityForResult(intent, 0);
-    }
-
-    @Override
-    public void onActivityResult(int requestCode, int resultCode, Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-
-        if (mIntentWaitingForResult != null) {
-            InputDeviceIdentifier inputDeviceIdentifier = mIntentWaitingForResult
-                    .getParcelableExtra(KeyboardLayoutPickerFragment.EXTRA_INPUT_DEVICE_IDENTIFIER,
-                            InputDeviceIdentifier.class);
-            mIntentWaitingForResult = null;
-            showKeyboardLayoutDialog(inputDeviceIdentifier);
-        }
-    }
-
-    private static String getLayoutLabel(@NonNull InputDevice device,
-            @NonNull Context context, @NonNull InputManager im) {
-        final String currentLayoutDesc =
-                im.getCurrentKeyboardLayoutForInputDevice(device.getIdentifier());
-        if (currentLayoutDesc == null) {
-            return context.getString(R.string.keyboard_layout_default_label);
-        }
-        final KeyboardLayout currentLayout = im.getKeyboardLayout(currentLayoutDesc);
-        if (currentLayout == null) {
-            return context.getString(R.string.keyboard_layout_default_label);
-        }
-        // If current layout is specified but the layout is null, just return an empty string
-        // instead of falling back to R.string.keyboard_layout_default_label.
-        return TextUtils.emptyIfNull(currentLayout.getLabel());
-    }
-
     @NonNull
     static List<HardKeyboardDeviceInfo> getHardKeyboards(@NonNull Context context) {
         final List<HardKeyboardDeviceInfo> keyboards = new ArrayList<>();
@@ -559,7 +504,6 @@
             keyboards.add(new HardKeyboardDeviceInfo(
                     device.getName(),
                     device.getIdentifier(),
-                    getLayoutLabel(device, context, im),
                     device.getBluetoothAddress(),
                     device.getVendorId(),
                     device.getProductId()));
@@ -572,12 +516,8 @@
             if (result != 0) {
                 return result;
             }
-            result = a.mDeviceIdentifier.getDescriptor().compareTo(
+            return a.mDeviceIdentifier.getDescriptor().compareTo(
                     b.mDeviceIdentifier.getDescriptor());
-            if (result != 0) {
-                return result;
-            }
-            return collator.compare(a.mLayoutLabel, b.mLayoutLabel);
         });
         return keyboards;
     }
@@ -587,8 +527,6 @@
         public final String mDeviceName;
         @NonNull
         public final InputDeviceIdentifier mDeviceIdentifier;
-        @NonNull
-        public final String mLayoutLabel;
         @Nullable
         public final String mBluetoothAddress;
         @NonNull
@@ -599,13 +537,11 @@
         public HardKeyboardDeviceInfo(
                 @Nullable String deviceName,
                 @NonNull InputDeviceIdentifier deviceIdentifier,
-                @NonNull String layoutLabel,
                 @Nullable String bluetoothAddress,
                 @NonNull int vendorId,
                 @NonNull int productId) {
             mDeviceName = TextUtils.emptyIfNull(deviceName);
             mDeviceIdentifier = deviceIdentifier;
-            mLayoutLabel = layoutLabel;
             mBluetoothAddress = bluetoothAddress;
             mVendorId = vendorId;
             mProductId = productId;
@@ -625,9 +561,6 @@
             if (!Objects.equals(mDeviceIdentifier, that.mDeviceIdentifier)) {
                 return false;
             }
-            if (!TextUtils.equals(mLayoutLabel, that.mLayoutLabel)) {
-                return false;
-            }
             if (!TextUtils.equals(mBluetoothAddress, that.mBluetoothAddress)) {
                 return false;
             }
diff --git a/src/com/android/settings/inputmethod/PointerFillStylePreference.java b/src/com/android/settings/inputmethod/PointerFillStylePreference.java
index 74284d6..9c9d076 100644
--- a/src/com/android/settings/inputmethod/PointerFillStylePreference.java
+++ b/src/com/android/settings/inputmethod/PointerFillStylePreference.java
@@ -25,6 +25,9 @@
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.graphics.Color;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
+import android.graphics.drawable.StateListDrawable;
 import android.provider.Settings;
 import android.util.AttributeSet;
 import android.view.PointerIcon;
@@ -41,6 +44,11 @@
 
 
 public class PointerFillStylePreference extends Preference {
+    private static final int[] STATE_HOVERED_SELECTED =
+            new int[]{android.R.attr.state_hovered, android.R.attr.state_selected};
+    private static final int[] STATE_SELECTED = new int[]{android.R.attr.state_selected};
+    private static final int[] STATE_HOVERED = new int[]{android.R.attr.state_hovered};
+    private static final int[] STATE_DEFAULT = new int[]{};
 
     @Nullable private LinearLayout mButtonHolder;
 
@@ -82,11 +90,7 @@
         if (button == null) {
             return;
         }
-        int[] attrs = {com.android.internal.R.attr.pointerIconVectorFill};
-        try (TypedArray ta = getContext().obtainStyledAttributes(
-                PointerIcon.vectorFillStyleToResource(style), attrs)) {
-            button.getBackground().setTint(ta.getColor(0, Color.BLACK));
-        }
+        tintButtonByStyle(button, style);
         button.setOnClickListener(
                 (v) -> {
                     getPreferenceDataStore().putInt(Settings.System.POINTER_FILL_STYLE, style);
@@ -96,6 +100,32 @@
         button.setPointerIcon(PointerIcon.getSystemIcon(getContext(), PointerIcon.TYPE_ARROW));
     }
 
+    private void tintButtonByStyle(ImageView button, int style) {
+        int[] attrs = {com.android.internal.R.attr.pointerIconVectorFill};
+        try (TypedArray ta = getContext().obtainStyledAttributes(
+                PointerIcon.vectorFillStyleToResource(style), attrs)) {
+            // Index 0, as there is only one attribute returned here.
+            int color = ta.getColor(/* index= */ 0, Color.BLACK);
+            StateListDrawable stateListDrawable = (StateListDrawable) button.getDrawable();
+            tintDrawableByLayerId(stateListDrawable, STATE_HOVERED_SELECTED,
+                    R.id.tintableCircleHoveredSelected, color);
+            tintDrawableByLayerId(stateListDrawable, STATE_SELECTED, R.id.tintableCircleSelected,
+                    color);
+            tintDrawableByLayerId(stateListDrawable, STATE_HOVERED, R.id.tintableCircleHovered,
+                    color);
+            tintDrawableByLayerId(stateListDrawable, STATE_DEFAULT, R.id.tintableCircleDefault,
+                    color);
+        }
+    }
+
+    private void tintDrawableByLayerId(StateListDrawable stateListDrawable, int[] stateSet,
+            int layerId, int color) {
+        int index = stateListDrawable.findStateDrawableIndex(stateSet);
+        LayerDrawable layerDrawable = (LayerDrawable) stateListDrawable.getStateDrawable(index);
+        Drawable drawable = layerDrawable.findDrawableByLayerId(layerId);
+        drawable.setTint(color);
+    }
+
     private void setButtonChecked(int id) {
         if (mButtonHolder == null) {
             return;
diff --git a/src/com/android/settings/service/PreferenceServiceRequestTransformer.kt b/src/com/android/settings/service/PreferenceServiceRequestTransformer.kt
index 18307e0..2fe2754 100644
--- a/src/com/android/settings/service/PreferenceServiceRequestTransformer.kt
+++ b/src/com/android/settings/service/PreferenceServiceRequestTransformer.kt
@@ -192,7 +192,7 @@
     val sensitivity = when (sensitivityLevel) {
         SensitivityLevel.NO_SENSITIVITY -> SettingsPreferenceMetadata.NO_SENSITIVITY
         SensitivityLevel.LOW_SENSITIVITY -> SettingsPreferenceMetadata.EXPECT_POST_CONFIRMATION
-        SensitivityLevel.MEDIUM_SENSITIVITY -> SettingsPreferenceMetadata.EXPECT_PRE_CONFIRMATION
+        SensitivityLevel.MEDIUM_SENSITIVITY -> SettingsPreferenceMetadata.DEEPLINK_ONLY
         else -> SettingsPreferenceMetadata.NO_DIRECT_ACCESS
     }
     return SettingsPreferenceMetadata.Builder(screenKey, key)
@@ -204,5 +204,7 @@
         .setWritable(persistent)
         .setLaunchIntent(launchIntent.toIntent())
         .setWriteSensitivity(sensitivity)
+        .setReadPermissions(readPermissionsList)
+        .setWritePermissions(writePermissionsList)
         .build()
 }
diff --git a/tests/robotests/assets/exempt_not_implementing_index_provider b/tests/robotests/assets/exempt_not_implementing_index_provider
index 7099089..2157491 100644
--- a/tests/robotests/assets/exempt_not_implementing_index_provider
+++ b/tests/robotests/assets/exempt_not_implementing_index_provider
@@ -48,7 +48,6 @@
 com.android.settings.fuelgauge.RestrictedAppDetails
 com.android.settings.IccLockSettings
 com.android.settings.inputmethod.InputMethodAndSubtypeEnabler
-com.android.settings.inputmethod.KeyboardLayoutPickerFragment
 com.android.settings.inputmethod.SpellCheckersSettings
 com.android.settings.location.LocationPersonalSettings
 com.android.settings.location.LocationWorkProfileSettings
diff --git a/tests/robotests/config/robolectric.properties b/tests/robotests/config/robolectric.properties
index 2ec65a0..a879954 100644
--- a/tests/robotests/config/robolectric.properties
+++ b/tests/robotests/config/robolectric.properties
@@ -1,6 +1,7 @@
 sdk=NEWEST_SDK
 shadows=\
    com.android.settings.testutils.shadow.ShadowThreadUtils \
+   com.android.settings.testutils.shadow.ShadowAccessibilityManager \
    com.android.settings.network.ShadowServiceManagerExtend
 instrumentedPackages=androidx.preference
 sqliteMode=native
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
index 0c942e3..9315995 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilitySettingsTest.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.accessibility;
 
+import static com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType.SOFTWARE;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.any;
@@ -564,9 +566,8 @@
     }
 
     private void setShortcutEnabled(ComponentName componentName, boolean enabled) {
-        Settings.Secure.putString(mContext.getContentResolver(),
-                Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS,
-                enabled ? componentName.flattenToString() : "");
+        mShadowAccessibilityManager.setAccessibilityShortcutTargets(
+                SOFTWARE, (enabled) ? List.of(componentName.flattenToString()) : List.of());
     }
 
     private BooleanSubject assertUriObserversContainsClazz(
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragmentTest.java
index 552a4a7..c6624b2 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragmentTest.java
@@ -40,6 +40,7 @@
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.accessibility.AccessibilityManager;
 import android.widget.PopupWindow;
 
 import androidx.annotation.Nullable;
@@ -52,6 +53,7 @@
 import com.android.settings.SettingsActivity;
 import com.android.settings.SubSettings;
 import com.android.settings.accessibility.shortcuts.EditShortcutsPreferenceFragment;
+import com.android.settings.testutils.shadow.ShadowAccessibilityManager;
 import com.android.settings.testutils.shadow.ShadowFragment;
 
 import org.junit.Before;
@@ -66,36 +68,31 @@
 import org.robolectric.shadow.api.Shadow;
 import org.robolectric.shadows.ShadowApplication;
 
+import java.util.List;
 import java.util.Locale;
 
 /** Tests for {@link AccessibilityShortcutPreferenceFragment} */
 @RunWith(RobolectricTestRunner.class)
-@Config(shadows = {
-        com.android.settings.testutils.shadow.ShadowFragment.class,
-})
+@Config(shadows = com.android.settings.testutils.shadow.ShadowFragment.class)
 public class AccessibilityShortcutPreferenceFragmentTest {
     private static final String PLACEHOLDER_PACKAGE_NAME = "com.placeholder.example";
     private static final String PLACEHOLDER_CLASS_NAME = PLACEHOLDER_PACKAGE_NAME + ".placeholder";
-    private static final String PLACEHOLDER_TILE_CLASS_NAME =
-            PLACEHOLDER_PACKAGE_NAME + "tile.placeholder";
     private static final ComponentName PLACEHOLDER_COMPONENT_NAME = new ComponentName(
             PLACEHOLDER_PACKAGE_NAME, PLACEHOLDER_CLASS_NAME);
-
-    private static final String SOFTWARE_SHORTCUT_KEY =
-            Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS;
-    private static final String HARDWARE_SHORTCUT_KEY =
-            Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE;
     private TestAccessibilityShortcutPreferenceFragment mFragment;
     private PreferenceScreen mScreen;
     private Context mContext = ApplicationProvider.getApplicationContext();
 
     @Mock(answer = Answers.RETURNS_DEEP_STUBS)
     private PreferenceManager mPreferenceManager;
+    private ShadowAccessibilityManager mShadowAccessibilityManager;
 
     @Before
     public void setUpTestFragment() {
         MockitoAnnotations.initMocks(this);
 
+        mShadowAccessibilityManager = Shadow.extract(
+                mContext.getSystemService(AccessibilityManager.class));
         mFragment = spy(new TestAccessibilityShortcutPreferenceFragment(null));
         when(mFragment.getPreferenceManager()).thenReturn(mPreferenceManager);
         when(mFragment.getPreferenceManager().getContext()).thenReturn(mContext);
@@ -118,8 +115,10 @@
 
     @Test
     public void updateShortcutPreferenceData_hasValueInSettings_assignToVariable() {
-        putStringIntoSettings(SOFTWARE_SHORTCUT_KEY, PLACEHOLDER_COMPONENT_NAME.flattenToString());
-        putStringIntoSettings(HARDWARE_SHORTCUT_KEY, PLACEHOLDER_COMPONENT_NAME.flattenToString());
+        mShadowAccessibilityManager.setAccessibilityShortcutTargets(
+                SOFTWARE, List.of(PLACEHOLDER_COMPONENT_NAME.flattenToString()));
+        mShadowAccessibilityManager.setAccessibilityShortcutTargets(
+                HARDWARE, List.of(PLACEHOLDER_COMPONENT_NAME.flattenToString()));
 
         mFragment.updateShortcutPreferenceData();
 
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityUtilTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityUtilTest.java
index bcd7c87..c93ee1e 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityUtilTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilityUtilTest.java
@@ -45,8 +45,6 @@
 
 import androidx.test.core.app.ApplicationProvider;
 
-import com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType;
-import com.android.internal.accessibility.util.ShortcutUtils;
 import com.android.settings.R;
 
 import org.junit.Before;
@@ -57,7 +55,6 @@
 import org.xmlpull.v1.XmlPullParserException;
 
 import java.io.IOException;
-import java.util.StringJoiner;
 
 @RunWith(RobolectricTestRunner.class)
 public final class AccessibilityUtilTest {
@@ -67,16 +64,6 @@
     private static final String MOCK_CLASS_NAME2 = MOCK_PACKAGE_NAME + ".mock_a11y_service2";
     private static final ComponentName MOCK_COMPONENT_NAME = new ComponentName(MOCK_PACKAGE_NAME,
             MOCK_CLASS_NAME);
-    private static final ComponentName MOCK_COMPONENT_NAME2 = new ComponentName(MOCK_PACKAGE_NAME,
-            MOCK_CLASS_NAME2);
-    private static final String SOFTWARE_SHORTCUT_KEY =
-            Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS;
-    private static final String HARDWARE_SHORTCUT_KEY =
-            Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE;
-    private static final String QUICK_SETTINGS_SHORTCUT_KEY =
-            Settings.Secure.ACCESSIBILITY_QS_TARGETS;
-
-    private static final String PLACEHOLDER_SETTING_FEATURE = "placeholderSettingFeature";
     @Rule
     public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
 
@@ -162,56 +149,6 @@
     }
 
     @Test
-    public void hasValueInSettings_putValue_hasValue() {
-        setShortcut(SOFTWARE, MOCK_COMPONENT_NAME.flattenToString());
-
-        assertThat(AccessibilityUtil.hasValueInSettings(mContext, SOFTWARE,
-                MOCK_COMPONENT_NAME)).isTrue();
-    }
-
-    @Test
-    public void getUserShortcutTypeFromSettings_putOneValue_hasValue() {
-        setShortcut(SOFTWARE, MOCK_COMPONENT_NAME.flattenToString());
-
-        final int shortcutTypes = AccessibilityUtil.getUserShortcutTypesFromSettings(mContext,
-                MOCK_COMPONENT_NAME);
-
-        assertThat(shortcutTypes).isEqualTo(
-                SOFTWARE
-        );
-    }
-
-    @Test
-    public void getUserShortcutTypeFromSettings_putTwoValues_hasValue() {
-        setShortcut(SOFTWARE, MOCK_COMPONENT_NAME.flattenToString());
-        setShortcut(HARDWARE, MOCK_COMPONENT_NAME.flattenToString());
-
-        final int shortcutTypes = AccessibilityUtil.getUserShortcutTypesFromSettings(mContext,
-                MOCK_COMPONENT_NAME);
-
-        assertThat(shortcutTypes).isEqualTo(
-                SOFTWARE
-                        | HARDWARE
-        );
-    }
-
-    @Test
-    public void getUserShortcutTypeFromSettings_threeShortcutTypesChosen() {
-        setShortcut(SOFTWARE, MOCK_COMPONENT_NAME.flattenToString());
-        setShortcut(HARDWARE, MOCK_COMPONENT_NAME.flattenToString());
-        setShortcut(QUICK_SETTINGS, MOCK_COMPONENT_NAME.flattenToString());
-
-        final int shortcutTypes = AccessibilityUtil.getUserShortcutTypesFromSettings(mContext,
-                MOCK_COMPONENT_NAME);
-
-        assertThat(shortcutTypes).isEqualTo(
-                SOFTWARE
-                        | HARDWARE
-                        | QUICK_SETTINGS
-        );
-    }
-
-    @Test
     public void convertKeyFromSettings_shortcutTypeSoftware() {
         assertThat(AccessibilityUtil.convertKeyFromSettings(SOFTWARE))
                 .isEqualTo(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
@@ -308,28 +245,9 @@
         return null;
     }
 
-    private String getStringFromSettings(String key) {
-        return Settings.Secure.getString(mContext.getContentResolver(), key);
-    }
-
     private void setSettingsFeatureEnabled(String settingsKey, boolean enabled) {
         Settings.Secure.putInt(mContext.getContentResolver(),
                 settingsKey,
                 enabled ? AccessibilityUtil.State.ON : AccessibilityUtil.State.OFF);
     }
-
-    private void setShortcut(@UserShortcutType int shortcutType, String... componentNames) {
-        StringJoiner shortcutComponents = new StringJoiner(":");
-        for (String componentName : componentNames) {
-            shortcutComponents.add(componentName);
-        }
-        Settings.Secure.putString(mContext.getContentResolver(),
-                ShortcutUtils.convertToKey(shortcutType), shortcutComponents.toString());
-    }
-
-    private void clearShortcuts() {
-        Settings.Secure.putString(mContext.getContentResolver(), SOFTWARE_SHORTCUT_KEY, "");
-        Settings.Secure.putString(mContext.getContentResolver(), HARDWARE_SHORTCUT_KEY, "");
-        Settings.Secure.putString(mContext.getContentResolver(), QUICK_SETTINGS_SHORTCUT_KEY, "");
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragmentTest.java
index 390a8ca..50d5ea4 100644
--- a/tests/robotests/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/ToggleDaltonizerPreferenceFragmentTest.java
@@ -193,7 +193,6 @@
     }
 
     private ToggleDaltonizerPreferenceFragment getFragmentInResumedState() {
-
         mActivityController.create().start().resume();
         Fragment fragment = mActivityController.get().getSupportFragmentManager().findFragmentById(
                 R.id.main_content);
diff --git a/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java
index 6dbb8b5..ad5b1b5 100644
--- a/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragmentTest.java
@@ -43,6 +43,7 @@
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.accessibility.AccessibilityManager;
 import android.widget.PopupWindow;
 
 import androidx.fragment.app.FragmentActivity;
@@ -54,6 +55,7 @@
 import com.android.settings.R;
 import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
 import com.android.settings.flags.Flags;
+import com.android.settings.testutils.shadow.ShadowAccessibilityManager;
 import com.android.settings.testutils.shadow.ShadowFragment;
 import com.android.settingslib.widget.TopIntroPreference;
 
@@ -72,12 +74,14 @@
 import org.robolectric.shadow.api.Shadow;
 import org.robolectric.shadows.ShadowApplication;
 
+import java.util.List;
 import java.util.Locale;
 
 /** Tests for {@link ToggleFeaturePreferenceFragment} */
 @RunWith(RobolectricTestRunner.class)
 @Config(shadows = {
         ShadowFragment.class,
+        ShadowAccessibilityManager.class
 })
 public class ToggleFeaturePreferenceFragmentTest {
     @Rule
@@ -109,6 +113,7 @@
 
     @Mock(answer = Answers.RETURNS_DEEP_STUBS)
     private PreferenceManager mPreferenceManager;
+    private ShadowAccessibilityManager mShadowAccessibilityManager;
 
     @Mock
     private FragmentActivity mActivity;
@@ -120,6 +125,8 @@
     @Before
     public void setUpTestFragment() {
         MockitoAnnotations.initMocks(this);
+        mShadowAccessibilityManager = Shadow.extract(
+                mContext.getSystemService(AccessibilityManager.class));
 
         mFragment = spy(new TestToggleFeaturePreferenceFragment());
         when(mFragment.getPreferenceManager()).thenReturn(mPreferenceManager);
@@ -178,10 +185,10 @@
     @Test
     public void updateShortcutPreferenceData_hasValueInSettings_assignToVariable() {
         mFragment.mComponentName = PLACEHOLDER_COMPONENT_NAME;
-        putSecureStringIntoSettings(SOFTWARE_SHORTCUT_KEY,
-                PLACEHOLDER_COMPONENT_NAME.flattenToString());
-        putSecureStringIntoSettings(HARDWARE_SHORTCUT_KEY,
-                PLACEHOLDER_COMPONENT_NAME.flattenToString());
+        mShadowAccessibilityManager.setAccessibilityShortcutTargets(
+                SOFTWARE, List.of(PLACEHOLDER_COMPONENT_NAME.flattenToString()));
+        mShadowAccessibilityManager.setAccessibilityShortcutTargets(
+                HARDWARE, List.of(PLACEHOLDER_COMPONENT_NAME.flattenToString()));
 
         mFragment.updateShortcutPreferenceData();
 
@@ -339,10 +346,6 @@
         assertThat(summary).isEqualTo(expected);
     }
 
-    private void putSecureStringIntoSettings(String key, String componentName) {
-        Settings.Secure.putString(mContext.getContentResolver(), key, componentName);
-    }
-
     private String getSecureStringFromSettings(String key) {
         return Settings.Secure.getString(mContext.getContentResolver(), key);
     }
diff --git a/tests/robotests/src/com/android/settings/bluetooth/AmbientVolumePreferenceTest.java b/tests/robotests/src/com/android/settings/bluetooth/AmbientVolumePreferenceTest.java
index ec406c4..115f642 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/AmbientVolumePreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/AmbientVolumePreferenceTest.java
@@ -26,8 +26,10 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import android.bluetooth.BluetoothDevice;
 import android.content.Context;
 import android.util.ArrayMap;
 import android.view.View;
@@ -40,6 +42,7 @@
 
 import com.android.settings.R;
 import com.android.settings.widget.SeekBarPreference;
+import com.android.settingslib.bluetooth.AmbientVolumeUi;
 
 import org.junit.Before;
 import org.junit.Rule;
@@ -69,14 +72,14 @@
     @Spy
     private Context mContext = ApplicationProvider.getApplicationContext();
     @Mock
-    private AmbientVolumePreference.OnIconClickListener mListener;
+    private AmbientVolumeUi.AmbientVolumeUiListener mListener;
     @Mock
     private View mItemView;
 
     private AmbientVolumePreference mPreference;
     private ImageView mExpandIcon;
     private ImageView mVolumeIcon;
-    private final Map<Integer, SeekBarPreference> mSideToSlidersMap = new ArrayMap<>();
+    private final Map<Integer, BluetoothDevice> mSideToDeviceMap = new ArrayMap<>();
 
     @Before
     public void setUp() {
@@ -84,13 +87,27 @@
         PreferenceScreen preferenceScreen = preferenceManager.createPreferenceScreen(mContext);
         mPreference = new AmbientVolumePreference(mContext);
         mPreference.setKey(KEY_AMBIENT_VOLUME);
-        mPreference.setOnIconClickListener(mListener);
+        mPreference.setListener(mListener);
         mPreference.setExpandable(true);
         mPreference.setMutable(true);
         preferenceScreen.addPreference(mPreference);
 
-        prepareSliders();
-        mPreference.setSliders(mSideToSlidersMap);
+        prepareDevices();
+        mPreference.setupSliders(mSideToDeviceMap);
+        mPreference.getSliders().forEach((side, slider) -> {
+            slider.setMin(0);
+            slider.setMax(4);
+            if (side == SIDE_LEFT) {
+                slider.setKey(KEY_LEFT_SLIDER);
+                slider.setProgress(TEST_LEFT_VOLUME_LEVEL);
+            } else if (side == SIDE_RIGHT) {
+                slider.setKey(KEY_RIGHT_SLIDER);
+                slider.setProgress(TEST_RIGHT_VOLUME_LEVEL);
+            } else {
+                slider.setKey(KEY_UNIFIED_SLIDER);
+                slider.setProgress(TEST_UNIFIED_VOLUME_LEVEL);
+            }
+        });
 
         mExpandIcon = new ImageView(mContext);
         mVolumeIcon = new ImageView(mContext);
@@ -206,33 +223,16 @@
 
     private void assertControlUiCorrect() {
         final boolean expanded = mPreference.isExpanded();
-        assertThat(mSideToSlidersMap.get(SIDE_UNIFIED).isVisible()).isEqualTo(!expanded);
-        assertThat(mSideToSlidersMap.get(SIDE_LEFT).isVisible()).isEqualTo(expanded);
-        assertThat(mSideToSlidersMap.get(SIDE_RIGHT).isVisible()).isEqualTo(expanded);
+        Map<Integer, SeekBarPreference> sliders = mPreference.getSliders();
+        assertThat(sliders.get(SIDE_UNIFIED).isVisible()).isEqualTo(!expanded);
+        assertThat(sliders.get(SIDE_LEFT).isVisible()).isEqualTo(expanded);
+        assertThat(sliders.get(SIDE_RIGHT).isVisible()).isEqualTo(expanded);
         final float rotation = expanded ? ROTATION_EXPANDED : ROTATION_COLLAPSED;
         assertThat(mExpandIcon.getRotation()).isEqualTo(rotation);
     }
 
-    private void prepareSliders() {
-        prepareSlider(SIDE_UNIFIED);
-        prepareSlider(SIDE_LEFT);
-        prepareSlider(SIDE_RIGHT);
-    }
-
-    private void prepareSlider(int side) {
-        SeekBarPreference slider = new SeekBarPreference(mContext);
-        slider.setMin(0);
-        slider.setMax(4);
-        if (side == SIDE_LEFT) {
-            slider.setKey(KEY_LEFT_SLIDER);
-            slider.setProgress(TEST_LEFT_VOLUME_LEVEL);
-        } else if (side == SIDE_RIGHT) {
-            slider.setKey(KEY_RIGHT_SLIDER);
-            slider.setProgress(TEST_RIGHT_VOLUME_LEVEL);
-        } else {
-            slider.setKey(KEY_UNIFIED_SLIDER);
-            slider.setProgress(TEST_UNIFIED_VOLUME_LEVEL);
-        }
-        mSideToSlidersMap.put(side, slider);
+    private void prepareDevices() {
+        mSideToDeviceMap.put(SIDE_LEFT, mock(BluetoothDevice.class));
+        mSideToDeviceMap.put(SIDE_RIGHT, mock(BluetoothDevice.class));
     }
 }
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsAmbientVolumePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsAmbientVolumePreferenceControllerTest.java
index 975d3b4..fb10d09 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsAmbientVolumePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsAmbientVolumePreferenceControllerTest.java
@@ -16,46 +16,25 @@
 
 package com.android.settings.bluetooth;
 
-import static android.bluetooth.AudioInputControl.MUTE_DISABLED;
-import static android.bluetooth.AudioInputControl.MUTE_NOT_MUTED;
-import static android.bluetooth.AudioInputControl.MUTE_MUTED;
-import static android.bluetooth.BluetoothDevice.BOND_BONDED;
-
 import static com.android.settings.bluetooth.BluetoothDetailsAmbientVolumePreferenceController.KEY_AMBIENT_VOLUME;
-import static com.android.settings.bluetooth.BluetoothDetailsAmbientVolumePreferenceController.KEY_AMBIENT_VOLUME_SLIDER;
 import static com.android.settings.bluetooth.BluetoothDetailsHearingDeviceController.KEY_HEARING_DEVICE_GROUP;
-import static com.android.settingslib.bluetooth.HearingAidInfo.DeviceSide.SIDE_LEFT;
-import static com.android.settingslib.bluetooth.HearingAidInfo.DeviceSide.SIDE_RIGHT;
 
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyBoolean;
-import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyLong;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-import static org.robolectric.Shadows.shadowOf;
 
-import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothProfile;
-import android.content.ContentResolver;
 import android.os.Handler;
-import android.os.Looper;
-import android.provider.Settings;
 
 import androidx.preference.PreferenceCategory;
 
 import com.android.settings.testutils.shadow.ShadowThreadUtils;
-import com.android.settings.widget.SeekBarPreference;
-import com.android.settingslib.bluetooth.AmbientVolumeController;
+import com.android.settingslib.bluetooth.AmbientVolumeUiController;
 import com.android.settingslib.bluetooth.BluetoothEventManager;
-import com.android.settingslib.bluetooth.CachedBluetoothDevice;
-import com.android.settingslib.bluetooth.HearingDeviceLocalDataManager;
 import com.android.settingslib.bluetooth.LocalBluetoothManager;
 import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
 import com.android.settingslib.bluetooth.VolumeControlProfile;
@@ -69,41 +48,19 @@
 import org.mockito.junit.MockitoRule;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.annotation.Config;
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
-import org.robolectric.shadows.ShadowSettings;
 
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Executor;
 
 /** Tests for {@link BluetoothDetailsAmbientVolumePreferenceController}. */
 @RunWith(RobolectricTestRunner.class)
 @Config(shadows = {
-        BluetoothDetailsAmbientVolumePreferenceControllerTest.ShadowGlobal.class,
         ShadowThreadUtils.class
 })
 public class BluetoothDetailsAmbientVolumePreferenceControllerTest extends
         BluetoothDetailsControllerTestBase {
-
     @Rule
     public final MockitoRule mMockitoRule = MockitoJUnit.rule();
 
-    private static final String LEFT_CONTROL_KEY = KEY_AMBIENT_VOLUME_SLIDER + "_" + SIDE_LEFT;
-    private static final String RIGHT_CONTROL_KEY = KEY_AMBIENT_VOLUME_SLIDER + "_" + SIDE_RIGHT;
-    private static final String TEST_ADDRESS = "00:00:00:00:11";
-    private static final String TEST_MEMBER_ADDRESS = "00:00:00:00:22";
-
-    @Mock
-    private CachedBluetoothDevice mCachedMemberDevice;
-    @Mock
-    private BluetoothDevice mDevice;
-    @Mock
-    private BluetoothDevice mMemberDevice;
-    @Mock
-    private HearingDeviceLocalDataManager mLocalDataManager;
     @Mock
     private LocalBluetoothManager mBluetoothManager;
     @Mock
@@ -113,9 +70,9 @@
     @Mock
     private VolumeControlProfile mVolumeControlProfile;
     @Mock
-    private AmbientVolumeController mVolumeController;
-    @Mock
     private Handler mTestHandler;
+    @Mock
+    private AmbientVolumeUiController mUiController;
 
     private BluetoothDetailsAmbientVolumePreferenceController mController;
 
@@ -124,24 +81,16 @@
         super.setUp();
 
         mContext = spy(mContext);
+
+        when(mBluetoothManager.getProfileManager()).thenReturn(mProfileManager);
+        when(mBluetoothManager.getEventManager()).thenReturn(mEventManager);
+        mController = spy(
+                new BluetoothDetailsAmbientVolumePreferenceController(mContext, mBluetoothManager,
+                        mFragment, mCachedDevice, mLifecycle, mUiController));
+
         PreferenceCategory deviceControls = new PreferenceCategory(mContext);
         deviceControls.setKey(KEY_HEARING_DEVICE_GROUP);
         mScreen.addPreference(deviceControls);
-        mController = spy(
-                new BluetoothDetailsAmbientVolumePreferenceController(mContext, mBluetoothManager,
-                        mFragment, mCachedDevice, mLifecycle, mLocalDataManager,
-                        mVolumeController));
-
-        when(mBluetoothManager.getEventManager()).thenReturn(mEventManager);
-        when(mBluetoothManager.getProfileManager()).thenReturn(mProfileManager);
-        when(mProfileManager.getVolumeControlProfile()).thenReturn(mVolumeControlProfile);
-        when(mVolumeControlProfile.getConnectionStatus(mDevice)).thenReturn(
-                BluetoothProfile.STATE_CONNECTED);
-        when(mVolumeControlProfile.getConnectionStatus(mMemberDevice)).thenReturn(
-                BluetoothProfile.STATE_CONNECTED);
-        when(mCachedDevice.getProfiles()).thenReturn(List.of(mVolumeControlProfile));
-        when(mLocalDataManager.get(any(BluetoothDevice.class))).thenReturn(
-                new HearingDeviceLocalDataManager.Data.Builder().build());
 
         when(mContext.getMainThreadHandler()).thenReturn(mTestHandler);
         when(mTestHandler.postDelayed(any(Runnable.class), anyLong())).thenAnswer(
@@ -152,283 +101,42 @@
     }
 
     @Test
-    public void init_deviceWithoutMember_controlNotExpandable() {
-        prepareDevice(/* hasMember= */ false);
-
+    public void init_preferenceAdded() {
         mController.init(mScreen);
 
         AmbientVolumePreference preference = mScreen.findPreference(KEY_AMBIENT_VOLUME);
         assertThat(preference).isNotNull();
-        assertThat(preference.isExpandable()).isFalse();
     }
 
     @Test
-    public void init_deviceWithMember_controlExpandable() {
-        prepareDevice(/* hasMember= */ true);
+    public void refresh_deviceNotSupportVcp_verifyUiControllerNoRefresh() {
+        when(mCachedDevice.getProfiles()).thenReturn(List.of());
 
-        mController.init(mScreen);
+        mController.refresh();
 
-        AmbientVolumePreference preference = mScreen.findPreference(KEY_AMBIENT_VOLUME);
-        assertThat(preference).isNotNull();
-        assertThat(preference.isExpandable()).isTrue();
+        verify(mUiController, never()).refresh();
     }
 
     @Test
-    public void onDeviceLocalDataChange_noMemberAndExpanded_uiCorrectAndDataUpdated() {
-        prepareDevice(/* hasMember= */ false);
-        mController.init(mScreen);
-        HearingDeviceLocalDataManager.Data data = new HearingDeviceLocalDataManager.Data.Builder()
-                .ambient(0).groupAmbient(0).ambientControlExpanded(true).build();
-        when(mLocalDataManager.get(mDevice)).thenReturn(data);
+    public void refresh_deviceSupportVcp_verifyUiControllerRefresh() {
+        when(mCachedDevice.getProfiles()).thenReturn(List.of(mVolumeControlProfile));
 
-        mController.onDeviceLocalDataChange(TEST_ADDRESS, data);
-        shadowOf(Looper.getMainLooper()).idle();
+        mController.refresh();
 
-        AmbientVolumePreference preference = mScreen.findPreference(KEY_AMBIENT_VOLUME);
-        assertThat(preference).isNotNull();
-        assertThat(preference.isExpanded()).isFalse();
-        verifyDeviceDataUpdated(mDevice);
+        verify(mUiController).refresh();
     }
 
     @Test
-    public void onDeviceLocalDataChange_noMemberAndCollapsed_uiCorrectAndDataUpdated() {
-        prepareDevice(/* hasMember= */ false);
-        mController.init(mScreen);
-        HearingDeviceLocalDataManager.Data data = new HearingDeviceLocalDataManager.Data.Builder()
-                .ambient(0).groupAmbient(0).ambientControlExpanded(false).build();
-        when(mLocalDataManager.get(mDevice)).thenReturn(data);
-
-        mController.onDeviceLocalDataChange(TEST_ADDRESS, data);
-        shadowOf(Looper.getMainLooper()).idle();
-
-        AmbientVolumePreference preference = mScreen.findPreference(KEY_AMBIENT_VOLUME);
-        assertThat(preference).isNotNull();
-        assertThat(preference.isExpanded()).isFalse();
-        verifyDeviceDataUpdated(mDevice);
-    }
-
-    @Test
-    public void onDeviceLocalDataChange_hasMemberAndExpanded_uiCorrectAndDataUpdated() {
-        prepareDevice(/* hasMember= */ true);
-        mController.init(mScreen);
-        HearingDeviceLocalDataManager.Data data = new HearingDeviceLocalDataManager.Data.Builder()
-                .ambient(0).groupAmbient(0).ambientControlExpanded(true).build();
-        when(mLocalDataManager.get(mDevice)).thenReturn(data);
-
-        mController.onDeviceLocalDataChange(TEST_ADDRESS, data);
-        shadowOf(Looper.getMainLooper()).idle();
-
-        AmbientVolumePreference preference = mScreen.findPreference(KEY_AMBIENT_VOLUME);
-        assertThat(preference).isNotNull();
-        assertThat(preference.isExpanded()).isTrue();
-        verifyDeviceDataUpdated(mDevice);
-    }
-
-    @Test
-    public void onDeviceLocalDataChange_hasMemberAndCollapsed_uiCorrectAndDataUpdated() {
-        prepareDevice(/* hasMember= */ true);
-        mController.init(mScreen);
-        HearingDeviceLocalDataManager.Data data = new HearingDeviceLocalDataManager.Data.Builder()
-                .ambient(0).groupAmbient(0).ambientControlExpanded(false).build();
-        when(mLocalDataManager.get(mDevice)).thenReturn(data);
-
-        mController.onDeviceLocalDataChange(TEST_ADDRESS, data);
-        shadowOf(Looper.getMainLooper()).idle();
-
-        AmbientVolumePreference preference = mScreen.findPreference(KEY_AMBIENT_VOLUME);
-        assertThat(preference).isNotNull();
-        assertThat(preference.isExpanded()).isFalse();
-        verifyDeviceDataUpdated(mDevice);
-    }
-
-    @Test
-    public void onStart_localDataManagerStartAndCallbackRegistered() {
-        prepareDevice(/* hasMember= */ true);
-        mController.init(mScreen);
-
+    public void onStart_verifyUiControllerStart() {
         mController.onStart();
 
-        verify(mLocalDataManager, atLeastOnce()).start();
-        verify(mVolumeController).registerCallback(any(Executor.class), eq(mDevice));
-        verify(mVolumeController).registerCallback(any(Executor.class), eq(mMemberDevice));
-        verify(mCachedDevice).registerCallback(any(Executor.class),
-                any(CachedBluetoothDevice.Callback.class));
-        verify(mCachedMemberDevice).registerCallback(any(Executor.class),
-                any(CachedBluetoothDevice.Callback.class));
+        verify(mUiController).start();
     }
 
     @Test
-    public void onStop_localDataManagerStopAndCallbackUnregistered() {
-        prepareDevice(/* hasMember= */ true);
-        mController.init(mScreen);
-
+    public void onStop_verifyUiControllerStop() {
         mController.onStop();
 
-        verify(mLocalDataManager).stop();
-        verify(mVolumeController).unregisterCallback(mDevice);
-        verify(mVolumeController).unregisterCallback(mMemberDevice);
-        verify(mCachedDevice).unregisterCallback(any(CachedBluetoothDevice.Callback.class));
-        verify(mCachedMemberDevice).unregisterCallback(any(CachedBluetoothDevice.Callback.class));
-    }
-
-    @Test
-    public void onDeviceAttributesChanged_newDevice_newPreference() {
-        prepareDevice(/* hasMember= */ false);
-        mController.init(mScreen);
-
-        // check the right control is null before onDeviceAttributesChanged()
-        SeekBarPreference leftControl = mScreen.findPreference(LEFT_CONTROL_KEY);
-        SeekBarPreference rightControl = mScreen.findPreference(RIGHT_CONTROL_KEY);
-        assertThat(leftControl).isNotNull();
-        assertThat(rightControl).isNull();
-
-        prepareDevice(/* hasMember= */ true);
-        mController.onDeviceAttributesChanged();
-        shadowOf(Looper.getMainLooper()).idle();
-
-        // check the right control is created after onDeviceAttributesChanged()
-        SeekBarPreference updatedLeftControl = mScreen.findPreference(LEFT_CONTROL_KEY);
-        SeekBarPreference updatedRightControl = mScreen.findPreference(RIGHT_CONTROL_KEY);
-        assertThat(updatedLeftControl).isEqualTo(leftControl);
-        assertThat(updatedRightControl).isNotNull();
-    }
-
-    @Test
-    public void onAmbientChanged_refreshWhenNotInitiateFromUi() {
-        prepareDevice(/* hasMember= */ false);
-        mController.init(mScreen);
-        final int testAmbient = 10;
-        HearingDeviceLocalDataManager.Data data = new HearingDeviceLocalDataManager.Data.Builder()
-                .ambient(testAmbient)
-                .groupAmbient(testAmbient)
-                .ambientControlExpanded(false)
-                .build();
-        when(mLocalDataManager.get(mDevice)).thenReturn(data);
-        getPreference().setExpanded(true);
-
-        mController.onAmbientChanged(mDevice, testAmbient);
-        verify(mController, never()).refresh();
-
-        final int updatedTestAmbient = 20;
-        mController.onAmbientChanged(mDevice, updatedTestAmbient);
-        verify(mController).refresh();
-    }
-
-    @Test
-    public void onMuteChanged_refreshWhenNotInitiateFromUi() {
-        prepareDevice(/* hasMember= */ false);
-        mController.init(mScreen);
-        final int testMute = MUTE_NOT_MUTED;
-        AmbientVolumeController.RemoteAmbientState state =
-                new AmbientVolumeController.RemoteAmbientState(testMute, 0);
-        when(mVolumeController.refreshAmbientState(mDevice)).thenReturn(state);
-        getPreference().setMuted(false);
-
-        mController.onMuteChanged(mDevice, testMute);
-        verify(mController, never()).refresh();
-
-        final int updatedTestMute = MUTE_MUTED;
-        mController.onMuteChanged(mDevice, updatedTestMute);
-        verify(mController).refresh();
-    }
-
-    @Test
-    public void refresh_leftAndRightDifferentGainSetting_expandControl() {
-        prepareDevice(/* hasMember= */ true);
-        mController.init(mScreen);
-        prepareRemoteData(mDevice, 10, MUTE_NOT_MUTED);
-        prepareRemoteData(mMemberDevice, 20, MUTE_NOT_MUTED);
-        getPreference().setExpanded(false);
-
-        mController.refresh();
-
-        assertThat(getPreference().isExpanded()).isTrue();
-    }
-
-    @Test
-    public void refresh_oneSideNotMutable_controlNotMutableAndNotMuted() {
-        prepareDevice(/* hasMember= */ true);
-        mController.init(mScreen);
-        prepareRemoteData(mDevice, 10, MUTE_DISABLED);
-        prepareRemoteData(mMemberDevice, 20, MUTE_NOT_MUTED);
-        getPreference().setMutable(true);
-        getPreference().setMuted(true);
-
-        mController.refresh();
-
-        assertThat(getPreference().isMutable()).isFalse();
-        assertThat(getPreference().isMuted()).isFalse();
-    }
-
-    @Test
-    public void refresh_oneSideNotMuted_controlNotMutedAndSyncToRemote() {
-        prepareDevice(/* hasMember= */ true);
-        mController.init(mScreen);
-        prepareRemoteData(mDevice, 10, MUTE_MUTED);
-        prepareRemoteData(mMemberDevice, 20, MUTE_NOT_MUTED);
-        getPreference().setMutable(true);
-        getPreference().setMuted(true);
-
-        mController.refresh();
-
-        assertThat(getPreference().isMutable()).isTrue();
-        assertThat(getPreference().isMuted()).isFalse();
-        verify(mVolumeController).setMuted(mDevice, false);
-    }
-
-    private void prepareDevice(boolean hasMember) {
-        when(mCachedDevice.getDeviceSide()).thenReturn(SIDE_LEFT);
-        when(mCachedDevice.getDevice()).thenReturn(mDevice);
-        when(mCachedDevice.getBondState()).thenReturn(BOND_BONDED);
-        when(mDevice.getAddress()).thenReturn(TEST_ADDRESS);
-        when(mDevice.getAnonymizedAddress()).thenReturn(TEST_ADDRESS);
-        when(mDevice.isConnected()).thenReturn(true);
-        if (hasMember) {
-            when(mCachedDevice.getMemberDevice()).thenReturn(Set.of(mCachedMemberDevice));
-            when(mCachedMemberDevice.getDeviceSide()).thenReturn(SIDE_RIGHT);
-            when(mCachedMemberDevice.getDevice()).thenReturn(mMemberDevice);
-            when(mCachedMemberDevice.getBondState()).thenReturn(BOND_BONDED);
-            when(mMemberDevice.getAddress()).thenReturn(TEST_MEMBER_ADDRESS);
-            when(mMemberDevice.getAnonymizedAddress()).thenReturn(TEST_MEMBER_ADDRESS);
-            when(mMemberDevice.isConnected()).thenReturn(true);
-        }
-    }
-
-    private void prepareRemoteData(BluetoothDevice device, int gainSetting, int mute) {
-        when(mVolumeController.isAmbientControlAvailable(device)).thenReturn(true);
-        when(mVolumeController.refreshAmbientState(device)).thenReturn(
-                new AmbientVolumeController.RemoteAmbientState(gainSetting, mute));
-    }
-
-    private void verifyDeviceDataUpdated(BluetoothDevice device) {
-        verify(mLocalDataManager, atLeastOnce()).updateAmbient(eq(device), anyInt());
-        verify(mLocalDataManager, atLeastOnce()).updateGroupAmbient(eq(device), anyInt());
-        verify(mLocalDataManager, atLeastOnce()).updateAmbientControlExpanded(eq(device),
-                anyBoolean());
-    }
-
-    private AmbientVolumePreference getPreference() {
-        return mScreen.findPreference(KEY_AMBIENT_VOLUME);
-    }
-
-    @Implements(value = Settings.Global.class)
-    public static class ShadowGlobal extends ShadowSettings.ShadowGlobal {
-        private static final Map<ContentResolver, Map<String, String>> sDataMap = new HashMap<>();
-
-        @Implementation
-        protected static boolean putStringForUser(
-                ContentResolver cr, String name, String value, int userHandle) {
-            get(cr).put(name, value);
-            return true;
-        }
-
-        @Implementation
-        protected static String getStringForUser(ContentResolver cr, String name, int userHandle) {
-            return get(cr).get(name);
-        }
-
-        private static Map<String, String> get(ContentResolver cr) {
-            return sDataMap.computeIfAbsent(cr, k -> new HashMap<>());
-        }
+        verify(mUiController).stop();
     }
 }
diff --git a/tests/robotests/src/com/android/settings/display/AutoBrightnessPreferenceControllerForSetupWizardTest.java b/tests/robotests/src/com/android/settings/display/AutoBrightnessPreferenceControllerForSetupWizardTest.java
index 1113d68..8f0b4a5 100644
--- a/tests/robotests/src/com/android/settings/display/AutoBrightnessPreferenceControllerForSetupWizardTest.java
+++ b/tests/robotests/src/com/android/settings/display/AutoBrightnessPreferenceControllerForSetupWizardTest.java
@@ -16,19 +16,28 @@
 
 package com.android.settings.display;
 
+
 import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
 import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
 import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.Mockito.mock;
+
 import android.content.Context;
 import android.platform.test.annotations.DisableFlags;
 import android.platform.test.annotations.EnableFlags;
 import android.platform.test.flag.junit.SetFlagsRule;
 
+import androidx.preference.Preference;
+import androidx.preference.PreferenceManager;
+import androidx.preference.PreferenceScreen;
+
 import com.android.settings.accessibility.Flags;
 import com.android.settings.testutils.shadow.SettingsShadowResources;
+import com.android.settingslib.RestrictedLockUtils;
+import com.android.settingslib.RestrictedSwitchPreference;
 
 import org.junit.Before;
 import org.junit.Rule;
@@ -58,35 +67,79 @@
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mContext = RuntimeEnvironment.application;
+
         mController =
                 new AutoBrightnessPreferenceControllerForSetupWizard(mContext, PREFERENCE_KEY);
     }
 
     @Test
     @EnableFlags(Flags.FLAG_ADD_BRIGHTNESS_SETTINGS_IN_SUW)
-    public void getAvailabilityStatus_configTrueAndFlagOn_shouldReturnAvailableUnsearchable() {
-        SettingsShadowResources.overrideResource(
-                com.android.internal.R.bool.config_automatic_brightness_available, true);
+    public void displayPreference_flagOn_preferenceVisibleTrue() {
+        Preference preference =
+                displayPreference(/* configAvailable= */ true, /* restricted= */ false);
+        assertThat(preference.isVisible()).isTrue();
+    }
 
+    @Test
+    @EnableFlags(Flags.FLAG_ADD_BRIGHTNESS_SETTINGS_IN_SUW)
+    public void displayPreference_flagOnAndRestricted_preferenceVisibleFalse() {
+        Preference preference =
+                displayPreference(/* configAvailable= */ true, /* restricted= */ true);
+        assertThat(preference.isVisible()).isFalse();
+    }
+
+    @Test
+    @EnableFlags(Flags.FLAG_ADD_BRIGHTNESS_SETTINGS_IN_SUW)
+    public void getAvailabilityStatus_configTrueAndFlagOn_availableUnsearchable() {
+        displayPreference(/* configAvailable= */ true, /* restricted= */ false);
         assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE_UNSEARCHABLE);
     }
 
     @Test
     @EnableFlags(Flags.FLAG_ADD_BRIGHTNESS_SETTINGS_IN_SUW)
-    public void getAvailabilityStatus_configFalseSetAndFlagOn_shouldReturnUnsupportedOnDevice() {
-        SettingsShadowResources.overrideResource(
-                com.android.internal.R.bool.config_automatic_brightness_available, false);
+    public void getAvailabilityStatus_configTrueAndFlagOnAndRestricted_conditionallyUnavailable() {
+        displayPreference(/* configAvailable= */ true, /* restricted= */ true);
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
+    }
 
+    @Test
+    @EnableFlags(Flags.FLAG_ADD_BRIGHTNESS_SETTINGS_IN_SUW)
+    public void getAvailabilityStatus_configFalseAndFlagOn_unsupportedOnDevice() {
+        displayPreference(/* configAvailable= */ false, /* restricted= */ false);
         assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
     }
 
     @Test
-    @DisableFlags(Flags.FLAG_ADD_BRIGHTNESS_SETTINGS_IN_SUW)
-    public void getAvailabilityStatus_flagOff_shouldReturnConditionallyUnavailable() {
-        SettingsShadowResources.overrideResource(
-                com.android.internal.R.bool.config_automatic_brightness_available, true);
-
+    @EnableFlags(Flags.FLAG_ADD_BRIGHTNESS_SETTINGS_IN_SUW)
+    public void getAvailabilityStatus_configFalseAndFlagOnAndRestricted_conditionallyUnavailable() {
+        displayPreference(/* configAvailable= */ false, /* restricted= */ true);
         assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
     }
+
+    @Test
+    @DisableFlags(Flags.FLAG_ADD_BRIGHTNESS_SETTINGS_IN_SUW)
+    public void getAvailabilityStatus_flagOff_conditionallyUnavailable() {
+        displayPreference(/* configAvailable= */ true, /* restricted= */ false);
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
+    }
+
+    private RestrictedSwitchPreference displayPreference(
+            boolean configAvailable, boolean restricted) {
+        SettingsShadowResources.overrideResource(
+                com.android.internal.R.bool.config_automatic_brightness_available, configAvailable);
+
+        final PreferenceManager manager = new PreferenceManager(mContext);
+        final PreferenceScreen screen = manager.createPreferenceScreen(mContext);
+        final RestrictedSwitchPreference preference = new RestrictedSwitchPreference(mContext);
+        preference.setKey(mController.getPreferenceKey());
+        preference.setDisabledByAdmin(restricted
+                ? mock(RestrictedLockUtils.EnforcedAdmin.class)
+                : null);
+        assertThat(preference.isDisabledByAdmin()).isEqualTo(restricted);
+        screen.addPreference(preference);
+
+        mController.displayPreference(screen);
+        return preference;
+    }
 }
 
diff --git a/tests/robotests/src/com/android/settings/display/BrightnessLevelPreferenceControllerForSetupWizardTest.java b/tests/robotests/src/com/android/settings/display/BrightnessLevelPreferenceControllerForSetupWizardTest.java
index 25ddd1e..6e44464 100644
--- a/tests/robotests/src/com/android/settings/display/BrightnessLevelPreferenceControllerForSetupWizardTest.java
+++ b/tests/robotests/src/com/android/settings/display/BrightnessLevelPreferenceControllerForSetupWizardTest.java
@@ -21,12 +21,20 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.Mockito.mock;
+
 import android.content.Context;
 import android.platform.test.annotations.DisableFlags;
 import android.platform.test.annotations.EnableFlags;
 import android.platform.test.flag.junit.SetFlagsRule;
 
+import androidx.preference.Preference;
+import androidx.preference.PreferenceManager;
+import androidx.preference.PreferenceScreen;
+
 import com.android.settings.accessibility.Flags;
+import com.android.settingslib.RestrictedLockUtils;
+import com.android.settingslib.RestrictedPreference;
 
 import org.junit.Before;
 import org.junit.Rule;
@@ -51,19 +59,58 @@
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mContext = RuntimeEnvironment.application;
+
         mController = new BrightnessLevelPreferenceControllerForSetupWizard(mContext,
                 /* lifecycle= */ null);
     }
 
     @Test
     @EnableFlags(Flags.FLAG_ADD_BRIGHTNESS_SETTINGS_IN_SUW)
-    public void getAvailabilityStatus_flagOn_shouldReturnAvailable() {
+    public void displayPreference_flagOn_preferenceVisibleTrue() {
+        Preference preference = displayPreference(/* restricted= */ false);
+        assertThat(preference.isVisible()).isTrue();
+    }
+
+    @Test
+    @EnableFlags(Flags.FLAG_ADD_BRIGHTNESS_SETTINGS_IN_SUW)
+    public void displayPreference_flagOnAndRestricted_preferenceVisibleFalse() {
+        Preference preference = displayPreference(/* restricted= */ true);
+        assertThat(preference.isVisible()).isFalse();
+    }
+
+    @Test
+    @EnableFlags(Flags.FLAG_ADD_BRIGHTNESS_SETTINGS_IN_SUW)
+    public void getAvailabilityStatus_flagOn_available() {
+        displayPreference(/* restricted= */ false);
         assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
     }
 
     @Test
-    @DisableFlags(Flags.FLAG_ADD_BRIGHTNESS_SETTINGS_IN_SUW)
-    public void getAvailabilityStatus_flagOff_shouldReturnConditionallyUnavailable() {
+    @EnableFlags(Flags.FLAG_ADD_BRIGHTNESS_SETTINGS_IN_SUW)
+    public void getAvailabilityStatus_flagOnAndRestricted_conditionallyUnavailable() {
+        displayPreference(/* restricted= */ true);
         assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
     }
+
+    @Test
+    @DisableFlags(Flags.FLAG_ADD_BRIGHTNESS_SETTINGS_IN_SUW)
+    public void getAvailabilityStatus_flagOff_conditionallyUnavailable() {
+        displayPreference(/* restricted= */ false);
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
+    }
+
+    private RestrictedPreference displayPreference(boolean restricted) {
+        final PreferenceManager manager = new PreferenceManager(mContext);
+        final PreferenceScreen screen = manager.createPreferenceScreen(mContext);
+        final RestrictedPreference preference = new RestrictedPreference(mContext);
+        preference.setKey(mController.getPreferenceKey());
+        preference.setDisabledByAdmin(restricted
+                ? mock(RestrictedLockUtils.EnforcedAdmin.class)
+                : null);
+        assertThat(preference.isDisabledByAdmin()).isEqualTo(restricted);
+        screen.addPreference(preference);
+
+        mController.displayPreference(screen);
+        return preference;
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/inputmethod/KeyboardLayoutPickerControllerTest.java b/tests/robotests/src/com/android/settings/inputmethod/KeyboardLayoutPickerControllerTest.java
deleted file mode 100644
index 0a1ccbb..0000000
--- a/tests/robotests/src/com/android/settings/inputmethod/KeyboardLayoutPickerControllerTest.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * 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.inputmethod;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.hardware.input.InputDeviceIdentifier;
-import android.hardware.input.InputManager;
-import android.hardware.input.KeyboardLayout;
-import android.view.InputDevice;
-
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentActivity;
-import androidx.preference.PreferenceManager;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.core.BasePreferenceController;
-import com.android.settings.testutils.shadow.ShadowInputDevice;
-
-import org.junit.Before;
-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.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-import org.robolectric.shadows.ShadowApplication;
-
-@RunWith(RobolectricTestRunner.class)
-@Config(shadows = {
-        com.android.settings.testutils.shadow.ShadowFragment.class,
-})
-public class KeyboardLayoutPickerControllerTest {
-
-    @Mock
-    private Fragment mFragment;
-    @Mock
-    private InputManager mInputManager;
-
-    private Context mContext;
-    private InputDeviceIdentifier mInputDeviceIdentifier;
-    private KeyboardLayoutPickerController mController;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        final ShadowApplication shadowContext = ShadowApplication.getInstance();
-        shadowContext.setSystemService(Context.INPUT_SERVICE, mInputManager);
-
-        mContext = RuntimeEnvironment.application;
-        mInputDeviceIdentifier = new InputDeviceIdentifier("descriptor", 1, 1);
-        mController = new KeyboardLayoutPickerController(mContext, "pref_key");
-
-        initializeOneLayout();
-    }
-
-    @Test
-    public void isAlwaysAvailable() {
-        assertThat(mController.getAvailabilityStatus())
-                .isEqualTo(BasePreferenceController.AVAILABLE);
-    }
-
-    @Test
-    public void testLifecycle_onStart_shouldRegisterInputManager() {
-        final FragmentActivity activity = Robolectric.setupActivity(FragmentActivity.class);
-        when(mFragment.getActivity()).thenReturn(activity);
-
-        mController.onStart();
-
-        // Register is called, but unregister should not be called.
-        verify(mInputManager).registerInputDeviceListener(mController, null);
-        verify(mInputManager, never()).unregisterInputDeviceListener(mController);
-    }
-
-    @Test
-    public void testLifecycle_onStart_NoInputDevice_shouldReturn() {
-        final FragmentActivity activity = Robolectric.setupActivity(FragmentActivity.class);
-        when(mInputManager.getInputDeviceByDescriptor(anyString())).thenReturn(null);
-        when(mFragment.getActivity()).thenReturn(activity);
-
-        mController.onStart();
-        verify(mInputManager, never()).getEnabledKeyboardLayoutsForInputDevice(any());
-    }
-
-    @Test
-    public void testLifecycle_onStop_shouldCancelRegisterInputManager() {
-        mController.onStop();
-
-        // Unregister is called, but register should not be called.
-        verify(mInputManager).unregisterInputDeviceListener(mController);
-        verify(mInputManager, never()).registerInputDeviceListener(mController, null);
-    }
-
-    @Test
-    public void test_createPreferenceHierarchy_shouldAddOnePreference() {
-        final PreferenceManager preferenceManager = new PreferenceManager(mContext);
-        final PreferenceScreen screen = preferenceManager.createPreferenceScreen(mContext);
-
-        mController.displayPreference(screen);
-
-        // We create a keyboard layouts in initializeOneLayout()
-        assertThat(screen.getPreferenceCount()).isEqualTo(1);
-    }
-
-    @Test
-    public void test_createPreferenceHierarchy_shouldAddTwoPreference() {
-        initializeTwoLayouts();
-        final PreferenceManager preferenceManager = new PreferenceManager(mContext);
-        final PreferenceScreen screen = preferenceManager.createPreferenceScreen(mContext);
-
-        mController.displayPreference(screen);
-
-        // We create two keyboard layouts in initializeOneLayout()
-        assertThat(screen.getPreferenceCount()).isEqualTo(2);
-    }
-
-    @Test
-    @Config(shadows = ShadowInputDevice.class)
-    public void testOnDeviceRemove_getSameDevice_shouldFinish() {
-        final int TARGET_DEVICE_ID = 1;
-        final FragmentActivity activity = Robolectric.setupActivity(FragmentActivity.class);
-        final String[] enableKeyboardLayouts = {"layout1"};
-        final InputDevice device = ShadowInputDevice.makeInputDevicebyId(TARGET_DEVICE_ID);
-
-        when(mFragment.getActivity()).thenReturn(activity);
-        when(mInputManager.getInputDeviceByDescriptor(anyString())).thenReturn(device);
-        when(mInputManager.getEnabledKeyboardLayoutsForInputDevice(
-                any(InputDeviceIdentifier.class))).thenReturn(enableKeyboardLayouts);
-
-        mController.onStart();
-        mController.onInputDeviceRemoved(TARGET_DEVICE_ID);
-
-        assertThat(activity.isFinishing()).isTrue();
-    }
-
-    @Test
-    @Config(shadows = ShadowInputDevice.class)
-    public void testOnDeviceRemove_getDifferentDevice_shouldNotFinish() {
-        final int TARGET_DEVICE_ID = 1;
-        final int ANOTHER_DEVICE_ID = 2;
-        final FragmentActivity activity = Robolectric.setupActivity(FragmentActivity.class);
-        final String[] enableKeyboardLayouts = {"layout1"};
-        final InputDevice device = ShadowInputDevice.makeInputDevicebyId(TARGET_DEVICE_ID);
-
-        when(mFragment.getActivity()).thenReturn(activity);
-        when(mInputManager.getInputDeviceByDescriptor(anyString())).thenReturn(device);
-        when(mInputManager.getEnabledKeyboardLayoutsForInputDevice(
-                any(InputDeviceIdentifier.class))).thenReturn(enableKeyboardLayouts);
-
-        mController.onStart();
-        mController.onInputDeviceRemoved(ANOTHER_DEVICE_ID);
-
-        assertThat(activity.isFinishing()).isFalse();
-    }
-
-    private void initializeOneLayout() {
-        final KeyboardLayout[] keyboardLayouts = {new KeyboardLayout("", "", "", 1, null, 0, 1, 1)};
-        when(mInputManager.getKeyboardLayoutsForInputDevice(
-                any(InputDeviceIdentifier.class))).thenReturn(
-                keyboardLayouts);
-
-        mController.initialize(mFragment, mInputDeviceIdentifier);
-    }
-
-    private void initializeTwoLayouts() {
-        final KeyboardLayout[] keyboardLayouts = {new KeyboardLayout("", "", "", 1, null, 0, 1, 1),
-                new KeyboardLayout("", "", "", 2, null, 0, 2, 2)};
-        when(mInputManager.getKeyboardLayoutsForInputDevice(any(InputDeviceIdentifier.class))).
-                thenReturn(keyboardLayouts);
-
-        mController.initialize(mFragment, mInputDeviceIdentifier);
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/inputmethod/KeyboardSettingsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/inputmethod/KeyboardSettingsPreferenceControllerTest.java
index b8070d3..482dcd3 100644
--- a/tests/robotests/src/com/android/settings/inputmethod/KeyboardSettingsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/inputmethod/KeyboardSettingsPreferenceControllerTest.java
@@ -90,7 +90,6 @@
                 new HardKeyboardDeviceInfo(
                         "TEST_DEVICE",
                         mInputDeviceIdentifier,
-                        "TEST_DEVICE_LABEL",
                         address,
                         VENDOR_ID,
                         PRODUCT_ID);
diff --git a/tests/robotests/src/com/android/settings/inputmethod/PhysicalKeyboardPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/inputmethod/PhysicalKeyboardPreferenceControllerTest.java
index 9ddfd5b..014a506 100644
--- a/tests/robotests/src/com/android/settings/inputmethod/PhysicalKeyboardPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/inputmethod/PhysicalKeyboardPreferenceControllerTest.java
@@ -50,7 +50,6 @@
 public class PhysicalKeyboardPreferenceControllerTest {
 
     private static final String DEVICE_NAME = "deviceName";
-    private static final String LAYOUT_LABEL = "deviceLayutLabel";
     private static final String BLUETOOTHADDRESS = "deviceBluetoothAddress";
     private static final int VENDOR_ID = 123;
     private static final int PRODUCT_ID = 456;
@@ -85,7 +84,6 @@
         keyboards.add(new HardKeyboardDeviceInfo(
                 DEVICE_NAME,
                 mIdentifier,
-                LAYOUT_LABEL,
                 BLUETOOTHADDRESS,
                 VENDOR_ID,
                 PRODUCT_ID));
diff --git a/tests/robotests/src/com/android/settings/service/PreferenceServiceRequestTransformerTest.kt b/tests/robotests/src/com/android/settings/service/PreferenceServiceRequestTransformerTest.kt
index 7631a00..da7ba5b 100644
--- a/tests/robotests/src/com/android/settings/service/PreferenceServiceRequestTransformerTest.kt
+++ b/tests/robotests/src/com/android/settings/service/PreferenceServiceRequestTransformerTest.kt
@@ -41,10 +41,8 @@
 import com.android.settingslib.graph.preferenceOrGroupProto
 import com.android.settingslib.graph.preferenceProto
 import com.android.settingslib.graph.preferenceScreenProto
+import com.android.settingslib.graph.preferenceValueProto
 import com.android.settingslib.graph.proto.PreferenceGraphProto
-import com.android.settingslib.graph.proto.PreferenceProto
-import com.android.settingslib.graph.proto.PreferenceValueProto
-import com.android.settingslib.graph.proto.TextProto
 import com.android.settingslib.graph.textProto
 import com.android.settingslib.graph.toProto
 import com.android.settingslib.metadata.SensitivityLevel
@@ -57,8 +55,7 @@
 @RequiresFlagsEnabled(FLAG_SETTINGS_CATALYST)
 class PreferenceServiceRequestTransformerTest {
 
-    @get:Rule
-    val checkFlagsRule: CheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule()
+    @get:Rule val checkFlagsRule: CheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule()
 
     @Test
     fun transformCatalystGetMetadataResponse_emptyGraph_returnsFrameworkResponseWithError() {
@@ -97,7 +94,7 @@
                                 title = textProto { string = "title2" }
                                 enabled = false
                             }
-                        }
+                        },
                     )
                 )
             }
@@ -110,21 +107,23 @@
             assertThat(metadataList.size).isEqualTo(2)
         }
         assertThat(
-            fResult.metadataList.any {
-                it.key == "key1" &&
-                it.screenKey == "screen" &&
-                it.title == "title1" &&
-                it.isEnabled == true
-            }
-        ).isTrue()
+                fResult.metadataList.any {
+                    it.key == "key1" &&
+                        it.screenKey == "screen" &&
+                        it.title == "title1" &&
+                        it.isEnabled
+                }
+            )
+            .isTrue()
         assertThat(
-            fResult.metadataList.any {
-                it.key == "key2" &&
-                it.screenKey == "screen" &&
-                it.title == "title2" &&
-                it.isEnabled == false
-            }
-        ).isTrue()
+                fResult.metadataList.any {
+                    it.key == "key2" &&
+                        it.screenKey == "screen" &&
+                        it.title == "title2" &&
+                        !it.isEnabled
+                }
+            )
+            .isTrue()
     }
 
     @Test
@@ -143,26 +142,28 @@
     fun transformCatalystGetValueResponse_success_returnsValidFrameworkResponse() {
         val context: Context = ApplicationProvider.getApplicationContext()
         val fRequest = GetValueRequest.Builder("screen", "key").build()
-        val cResult = PreferenceGetterResponse(
-            emptyMap(),
-            mapOf(
-                PreferenceCoordinate(fRequest.screenKey, fRequest.preferenceKey) to
-                        PreferenceProto.newBuilder()
-                            .setKey("key")
-                            .setTitle(TextProto.newBuilder().setString("title"))
-                            .setSummary(TextProto.newBuilder().setString("summary"))
-                            .setEnabled(true)
-                            .setAvailable(true)
-                            .setRestricted(true)
-                            .setPersistent(true)
-                            .setSensitivityLevel(SensitivityLevel.LOW_SENSITIVITY)
-                            .setLaunchIntent(
+        val cResult =
+            PreferenceGetterResponse(
+                emptyMap(),
+                mapOf(
+                    PreferenceCoordinate(fRequest.screenKey, fRequest.preferenceKey) to
+                        preferenceProto {
+                            key = "key"
+                            title = textProto { string = "title" }
+                            summary = textProto { string = "summary" }
+                            enabled = true
+                            available = true
+                            restricted = true
+                            persistent = true
+                            sensitivityLevel = SensitivityLevel.LOW_SENSITIVITY
+                            addReadPermissions("read_permission")
+                            addWritePermissions("write_permission")
+                            launchIntent =
                                 Intent(context, SettingsHomepageActivity::class.java).toProto()
-                            )
-                            .setValue(PreferenceValueProto.newBuilder().setBooleanValue(true))
-                            .build()
+                            value = preferenceValueProto { booleanValue = true }
+                        }
+                ),
             )
-        )
         val fResult = transformCatalystGetValueResponse(context, fRequest, cResult)
         assertThat(fResult!!.resultCode).isEqualTo(GetValueResult.RESULT_OK)
         with(fResult.metadata!!) {
@@ -174,6 +175,8 @@
             assertThat(isWritable).isTrue()
             assertThat(writeSensitivity)
                 .isEqualTo(SettingsPreferenceMetadata.EXPECT_POST_CONFIRMATION)
+            assertThat(readPermissions).containsExactly("read_permission")
+            assertThat(writePermissions).containsExactly("write_permission")
             assertThat(launchIntent).isNotNull()
             assertThat(launchIntent!!.component!!.className)
                 .isEqualTo(SettingsHomepageActivity::class.java.name)
@@ -188,13 +191,14 @@
     fun transformCatalystGetValueResponse_failure_returnsValidFrameworkResponse() {
         val context: Context = ApplicationProvider.getApplicationContext()
         val fRequest = GetValueRequest.Builder("screen", "key").build()
-        val cResult = PreferenceGetterResponse(
-            mapOf(
-                PreferenceCoordinate(fRequest.screenKey, fRequest.preferenceKey) to
+        val cResult =
+            PreferenceGetterResponse(
+                mapOf(
+                    PreferenceCoordinate(fRequest.screenKey, fRequest.preferenceKey) to
                         PreferenceGetterErrorCode.NOT_FOUND
-            ),
-            emptyMap()
-        )
+                ),
+                emptyMap(),
+            )
         val fResult = transformCatalystGetValueResponse(context, fRequest, cResult)
         with(fResult!!) {
             assertThat(resultCode).isEqualTo(GetValueResult.RESULT_UNSUPPORTED)
@@ -214,13 +218,15 @@
 
     @Test
     fun transformFrameworkSetValueRequest_typeBoolean_returnsValidCatalystRequest() {
-        val fRequest = SetValueRequest.Builder(
-            "screen",
-            "pref",
-            SettingsPreferenceValue.Builder(SettingsPreferenceValue.TYPE_BOOLEAN)
-                .setBooleanValue(true)
+        val fRequest =
+            SetValueRequest.Builder(
+                    "screen",
+                    "pref",
+                    SettingsPreferenceValue.Builder(SettingsPreferenceValue.TYPE_BOOLEAN)
+                        .setBooleanValue(true)
+                        .build(),
+                )
                 .build()
-        ).build()
         val cRequest = transformFrameworkSetValueRequest(fRequest)
         with(cRequest!!) {
             assertThat(screenKey).isEqualTo(fRequest.screenKey)
@@ -232,13 +238,15 @@
 
     @Test
     fun transformFrameworkSetValueRequest_typeInt_returnsValidCatalystRequest() {
-        val fRequest = SetValueRequest.Builder(
-            "screen",
-            "pref",
-            SettingsPreferenceValue.Builder(SettingsPreferenceValue.TYPE_INT)
-                .setIntValue(5)
+        val fRequest =
+            SetValueRequest.Builder(
+                    "screen",
+                    "pref",
+                    SettingsPreferenceValue.Builder(SettingsPreferenceValue.TYPE_INT)
+                        .setIntValue(5)
+                        .build(),
+                )
                 .build()
-        ).build()
         val cRequest = transformFrameworkSetValueRequest(fRequest)
         with(cRequest!!) {
             assertThat(screenKey).isEqualTo(fRequest.screenKey)
@@ -250,59 +258,59 @@
 
     @Test
     fun transformFrameworkSetValueRequest_typeString_returnsNull() {
-        val fRequest = SetValueRequest.Builder(
-            "screen",
-            "pref",
-            SettingsPreferenceValue.Builder(SettingsPreferenceValue.TYPE_STRING)
-                .setStringValue("value")
+        val fRequest =
+            SetValueRequest.Builder(
+                    "screen",
+                    "pref",
+                    SettingsPreferenceValue.Builder(SettingsPreferenceValue.TYPE_STRING)
+                        .setStringValue("value")
+                        .build(),
+                )
                 .build()
-        ).build()
         val cRequest = transformFrameworkSetValueRequest(fRequest)
         assertThat(cRequest).isNull()
     }
 
     @Test
     fun transformCatalystSetValueResponse_returnsValidFrameworkResponse() {
-        assertThat(
-            transformCatalystSetValueResponse(PreferenceSetterResult.OK).resultCode
-        ).isEqualTo(SetValueResult.RESULT_OK)
+        assertThat(transformCatalystSetValueResponse(PreferenceSetterResult.OK).resultCode)
+            .isEqualTo(SetValueResult.RESULT_OK)
+
+        assertThat(transformCatalystSetValueResponse(PreferenceSetterResult.UNAVAILABLE).resultCode)
+            .isEqualTo(SetValueResult.RESULT_UNAVAILABLE)
+
+        assertThat(transformCatalystSetValueResponse(PreferenceSetterResult.DISABLED).resultCode)
+            .isEqualTo(SetValueResult.RESULT_DISABLED)
+
+        assertThat(transformCatalystSetValueResponse(PreferenceSetterResult.UNSUPPORTED).resultCode)
+            .isEqualTo(SetValueResult.RESULT_UNSUPPORTED)
+
+        assertThat(transformCatalystSetValueResponse(PreferenceSetterResult.DISALLOW).resultCode)
+            .isEqualTo(SetValueResult.RESULT_DISALLOW)
 
         assertThat(
-            transformCatalystSetValueResponse(PreferenceSetterResult.UNAVAILABLE).resultCode
-        ).isEqualTo(SetValueResult.RESULT_UNAVAILABLE)
+                transformCatalystSetValueResponse(PreferenceSetterResult.REQUIRE_APP_PERMISSION)
+                    .resultCode
+            )
+            .isEqualTo(SetValueResult.RESULT_REQUIRE_APP_PERMISSION)
 
         assertThat(
-            transformCatalystSetValueResponse(PreferenceSetterResult.DISABLED).resultCode
-        ).isEqualTo(SetValueResult.RESULT_DISABLED)
+                transformCatalystSetValueResponse(PreferenceSetterResult.REQUIRE_USER_AGREEMENT)
+                    .resultCode
+            )
+            .isEqualTo(SetValueResult.RESULT_REQUIRE_USER_CONSENT)
+
+        assertThat(transformCatalystSetValueResponse(PreferenceSetterResult.RESTRICTED).resultCode)
+            .isEqualTo(SetValueResult.RESULT_RESTRICTED)
 
         assertThat(
-            transformCatalystSetValueResponse(PreferenceSetterResult.UNSUPPORTED).resultCode
-        ).isEqualTo(SetValueResult.RESULT_UNSUPPORTED)
+                transformCatalystSetValueResponse(PreferenceSetterResult.INVALID_REQUEST).resultCode
+            )
+            .isEqualTo(SetValueResult.RESULT_INVALID_REQUEST)
 
         assertThat(
-            transformCatalystSetValueResponse(PreferenceSetterResult.DISALLOW).resultCode
-        ).isEqualTo(SetValueResult.RESULT_DISALLOW)
-
-        assertThat(
-            transformCatalystSetValueResponse(PreferenceSetterResult.REQUIRE_APP_PERMISSION)
-                .resultCode
-        ).isEqualTo(SetValueResult.RESULT_REQUIRE_APP_PERMISSION)
-
-        assertThat(
-            transformCatalystSetValueResponse(PreferenceSetterResult.REQUIRE_USER_AGREEMENT)
-                .resultCode
-        ).isEqualTo(SetValueResult.RESULT_REQUIRE_USER_CONSENT)
-
-        assertThat(
-            transformCatalystSetValueResponse(PreferenceSetterResult.RESTRICTED).resultCode
-        ).isEqualTo(SetValueResult.RESULT_RESTRICTED)
-
-        assertThat(
-            transformCatalystSetValueResponse(PreferenceSetterResult.INVALID_REQUEST).resultCode
-        ).isEqualTo(SetValueResult.RESULT_INVALID_REQUEST)
-
-        assertThat(
-            transformCatalystSetValueResponse(PreferenceSetterResult.INTERNAL_ERROR).resultCode
-        ).isEqualTo(SetValueResult.RESULT_INTERNAL_ERROR)
+                transformCatalystSetValueResponse(PreferenceSetterResult.INTERNAL_ERROR).resultCode
+            )
+            .isEqualTo(SetValueResult.RESULT_INTERNAL_ERROR)
     }
-}
\ No newline at end of file
+}
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAccessibilityManager.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAccessibilityManager.java
index 7de69a7..2741212 100644
--- a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAccessibilityManager.java
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowAccessibilityManager.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.testutils.shadow;
 
+import static com.google.common.truth.Truth.assertThat;
+
 import android.accessibilityservice.AccessibilityShortcutInfo;
 import android.annotation.NonNull;
 import android.annotation.UserIdInt;
@@ -24,11 +26,12 @@
 import android.util.ArrayMap;
 import android.view.accessibility.AccessibilityManager;
 
-import com.android.internal.accessibility.common.ShortcutConstants;
+import com.android.internal.accessibility.common.ShortcutConstants.UserShortcutType;
 
 import org.robolectric.annotation.Implementation;
 import org.robolectric.annotation.Implements;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -39,6 +42,7 @@
 public class ShadowAccessibilityManager extends org.robolectric.shadows.ShadowAccessibilityManager {
     private Map<ComponentName, ComponentName> mA11yFeatureToTileMap = new ArrayMap<>();
     private List<AccessibilityShortcutInfo> mInstalledAccessibilityShortcutList = List.of();
+    private Map<Integer, List<String>> mShortcutTargets = new ArrayMap<>();
 
     /**
      * Implements a hidden method {@link AccessibilityManager#getA11yFeatureToTileMap}
@@ -80,7 +84,20 @@
      */
     @Implementation
     public List<String> getAccessibilityShortcutTargets(
-            @ShortcutConstants.UserShortcutType int shortcutType) {
-        return List.of();
+            @UserShortcutType int shortcutType) {
+        if (!mShortcutTargets.containsKey(shortcutType)) {
+            mShortcutTargets.put(shortcutType, new ArrayList<>());
+        }
+        List<String> targets = mShortcutTargets.get(shortcutType);
+        assertThat(targets).isNotNull();
+        return targets;
+    }
+
+    /**
+     * Used by tests to easily write directly to a shortcut targets value
+     */
+    public void setAccessibilityShortcutTargets(
+            @UserShortcutType int shortcutType, List<String> targets) {
+        mShortcutTargets.put(shortcutType, targets);
     }
 }
diff --git a/tests/unit/src/com/android/settings/applications/appcompat/UserAspectRatioManagerTest.java b/tests/unit/src/com/android/settings/applications/appcompat/UserAspectRatioManagerTest.java
index 4c07555..a31b0f0 100644
--- a/tests/unit/src/com/android/settings/applications/appcompat/UserAspectRatioManagerTest.java
+++ b/tests/unit/src/com/android/settings/applications/appcompat/UserAspectRatioManagerTest.java
@@ -31,7 +31,7 @@
 
 import static com.android.settings.applications.appcompat.UserAspectRatioManager.KEY_ENABLE_USER_ASPECT_RATIO_FULLSCREEN;
 import static com.android.settings.applications.appcompat.UserAspectRatioManager.KEY_ENABLE_USER_ASPECT_RATIO_SETTINGS;
-import static com.android.window.flags.Flags.FLAG_USER_MIN_ASPECT_RATIO_APP_DEFAULT;
+import static com.android.window.flags.Flags.FLAG_UNIVERSAL_RESIZABLE_BY_DEFAULT;
 
 import static com.google.common.truth.Truth.assertThat;
 
@@ -54,6 +54,7 @@
 import android.content.pm.PackageManager;
 import android.content.res.Resources;
 import android.os.RemoteException;
+import android.platform.test.annotations.DisableFlags;
 import android.platform.test.flag.junit.SetFlagsRule;
 import android.provider.DeviceConfig;
 
@@ -102,7 +103,6 @@
         when(mContext.getResources()).thenReturn(mResources);
         when(mContext.getSystemService(LauncherApps.class)).thenReturn(launcherApps);
         enableAllDefaultAspectRatioOptions();
-        mSetFlagsRule.disableFlags(FLAG_USER_MIN_ASPECT_RATIO_APP_DEFAULT);
 
         mUtils = new FakeUserAspectRatioManager(mContext, mIPm);
 
@@ -318,19 +318,6 @@
         assertThrows(RuntimeException.class, () -> new FakeUserAspectRatioManager(mContext, mIPm));
     }
 
-    @Test
-    public void testGetUserMinAspectRatioMapping_appDefaultFlagEnabled() {
-        // Flag is disabled by default, app default not loaded
-        assertFalse(mUtils.hasAspectRatioOption(USER_MIN_ASPECT_RATIO_APP_DEFAULT, mPackageName));
-
-        mSetFlagsRule.enableFlags(FLAG_USER_MIN_ASPECT_RATIO_APP_DEFAULT);
-        mUtils = new FakeUserAspectRatioManager(mContext, mIPm);
-
-        assertTrue(mUtils.hasAspectRatioOption(USER_MIN_ASPECT_RATIO_APP_DEFAULT, mPackageName));
-        assertThat(getUserMinAspectRatioEntry(USER_MIN_ASPECT_RATIO_APP_DEFAULT, mPackageName))
-                .isEqualTo(getUserMinAspectRatioEntry(USER_MIN_ASPECT_RATIO_UNSET, mPackageName));
-    }
-
     private void assertUnsetIsFullscreen() {
         // Fullscreen option is pre-selected
         assertThat(getUserMinAspectRatioEntry(USER_MIN_ASPECT_RATIO_UNSET, mPackageName))
@@ -406,14 +393,8 @@
     }
 
     @Test
-    public void testIsOverrideToFullscreenEnabled_flagDisabled_returnsFalse() {
-        mUtils.setFullscreenCompatChange(true);
-        assertFalse(mUtils.isOverrideToFullscreenEnabled(mPackageName, mContext.getUserId()));
-    }
-
-    @Test
+    @DisableFlags({FLAG_UNIVERSAL_RESIZABLE_BY_DEFAULT})
     public void testIsOverrideToFullscreenEnabledUnivRes_flagDisabled_returnsFalse() {
-        mUtils.setFullscreenCompatChange(true);
         assertFalse(mUtils.isOverrideToFullscreenEnabled(mPackageName, mContext.getUserId()));
     }
 
@@ -426,20 +407,12 @@
     }
 
     private void setIsOverrideToFullscreenEnabledBecauseCompatChange(boolean enabled) {
-        if (enabled) {
-            mSetFlagsRule.enableFlags(FLAG_USER_MIN_ASPECT_RATIO_APP_DEFAULT);
-            mUtils = new FakeUserAspectRatioManager(mContext, mIPm);
-        }
         mUtils.setFullscreenCompatChange(enabled);
         when(mUtils.hasAspectRatioOption(USER_MIN_ASPECT_RATIO_FULLSCREEN, mPackageName))
                 .thenReturn(enabled);
     }
 
     private void setIsOverrideToFullscreenEnabledBecauseUniversalResizeable(boolean enabled) {
-        if (enabled) {
-            mSetFlagsRule.enableFlags(FLAG_USER_MIN_ASPECT_RATIO_APP_DEFAULT);
-            mUtils = new FakeUserAspectRatioManager(mContext, mIPm);
-        }
         mUtils.setUniversalResizeable(enabled);
         when(mUtils.hasAspectRatioOption(USER_MIN_ASPECT_RATIO_FULLSCREEN, mPackageName))
                 .thenReturn(enabled);