Merge "Fix that the preview text in "Text and reading options" page is too small." into tm-dev
diff --git a/res/color/dream_card_icon_color_state_list.xml b/res/color/dream_card_icon_color_state_list.xml
new file mode 100644
index 0000000..c2e32cb
--- /dev/null
+++ b/res/color/dream_card_icon_color_state_list.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2022 The Android Open Source Project
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android"
+          xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
+    <item android:state_selected="true" android:color="?androidprv:attr/textColorOnAccent"/>
+    <item android:color="?androidprv:attr/colorAccentPrimaryVariant"/>
+</selector>
\ No newline at end of file
diff --git a/res/drawable/ic_accessibility_animation.xml b/res/drawable/ic_accessibility_animation.xml
new file mode 100644
index 0000000..13bc4a2
--- /dev/null
+++ b/res/drawable/ic_accessibility_animation.xml
@@ -0,0 +1,36 @@
+<!--
+  Copyright 2022 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item>
+        <com.android.settingslib.widget.AdaptiveIconShapeDrawable
+            android:width="@dimen/accessibility_icon_size"
+            android:height="@dimen/accessibility_icon_size"
+            android:color="@color/accessibility_feature_background"/>
+    </item>
+    <item android:gravity="center">
+        <vector
+            android:width="@dimen/accessibility_icon_foreground_size"
+            android:height="@dimen/accessibility_icon_foreground_size"
+            android:viewportWidth="24"
+            android:viewportHeight="24">
+            <path
+                android:fillColor="#ffffff"
+                android:fillType="evenOdd"
+                android:pathData="M9,22Q7.55,22 6.275,21.45Q5,20.9 4.05,19.95Q3.1,19 2.55,17.725Q2,16.45 2,15Q2,12.975 3.05,11.3Q4.1,9.625 5.8,8.75Q6.3,7.775 7.038,7.037Q7.775,6.3 8.75,5.8Q9.575,4.1 11.275,3.05Q12.975,2 15,2Q16.45,2 17.725,2.55Q19,3.1 19.95,4.05Q20.9,5 21.45,6.275Q22,7.55 22,9Q22,11.125 20.95,12.75Q19.9,14.375 18.2,15.25Q17.7,16.225 16.962,16.962Q16.225,17.7 15.25,18.2Q14.375,19.9 12.7,20.95Q11.025,22 9,22ZM9,20Q9.825,20 10.588,19.75Q11.35,19.5 12,19Q10.55,19 9.275,18.45Q8,17.9 7.05,16.95Q6.1,16 5.55,14.725Q5,13.45 5,12Q4.5,12.65 4.25,13.412Q4,14.175 4,15Q4,16.05 4.4,16.95Q4.8,17.85 5.475,18.525Q6.15,19.2 7.05,19.6Q7.95,20 9,20ZM12,17Q12.825,17 13.613,16.75Q14.4,16.5 15.05,16Q13.575,16 12.3,15.438Q11.025,14.875 10.075,13.925Q9.125,12.975 8.562,11.7Q8,10.425 8,8.95Q7.5,9.6 7.25,10.387Q7,11.175 7,12Q7,13.05 7.388,13.95Q7.775,14.85 8.475,15.525Q9.15,16.225 10.05,16.613Q10.95,17 12,17ZM15,14Q15.45,14 15.863,13.925Q16.275,13.85 16.7,13.7Q17.25,12.2 16.863,10.812Q16.475,9.425 15.525,8.475Q14.575,7.525 13.188,7.137Q11.8,6.75 10.3,7.3Q10.15,7.725 10.075,8.137Q10,8.55 10,9Q10,10.05 10.387,10.95Q10.775,11.85 11.475,12.525Q12.15,13.225 13.05,13.613Q13.95,14 15,14ZM19,12.05Q19.5,11.4 19.75,10.612Q20,9.825 20,9Q20,7.95 19.613,7.05Q19.225,6.15 18.525,5.475Q17.85,4.775 16.95,4.387Q16.05,4 15,4Q14.125,4 13.363,4.25Q12.6,4.5 11.95,5Q13.425,5 14.7,5.562Q15.975,6.125 16.925,7.075Q17.875,8.025 18.438,9.3Q19,10.575 19,12.05Z" />
+        </vector>
+    </item>
+</layer-list>
\ No newline at end of file
diff --git a/res/layout-land/udfps_enroll_enrolling_land.xml b/res/layout-land/udfps_enroll_enrolling_land.xml
index 7ccd396..776f8a9 100644
--- a/res/layout-land/udfps_enroll_enrolling_land.xml
+++ b/res/layout-land/udfps_enroll_enrolling_land.xml
@@ -61,10 +61,10 @@
                         style="@style/SudGlifIcon"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
-                        android:layout_gravity="?attr/sudGlifHeaderGravity"
+                        android:scaleType="fitStart"
                         android:layout_marginStart="0dp"
                         android:layout_marginEnd="0dp"
-                        android:src="@drawable/ic_fingerprint_header" />
+                        android:src="@drawable/ic_lock" />
 
                     <TextView
                         android:id="@+id/suc_layout_title"
diff --git a/res/layout/app_preferred_settings.xml b/res/layout/app_preferred_settings.xml
index b3343f5..126b9d8 100644
--- a/res/layout/app_preferred_settings.xml
+++ b/res/layout/app_preferred_settings.xml
@@ -18,7 +18,7 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:paddingStart="@dimen/preference_no_icon_padding_start"
+    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
     android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
     android:paddingBottom="5dip"
     android:orientation="vertical">
diff --git a/res/values/colors.xml b/res/values/colors.xml
index fef8419..f972e29 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -205,4 +205,7 @@
 
     <!-- Battery error text color -->
     <color name="battery_info_error_color_black">@*android:color/primary_text_default_material_light</color>
+
+    <!-- Background for multiple user settings page avatars -->
+    <color name="user_avatar_color_bg">?androidprv:attr/colorSurface</color>
 </resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 4f2dd93..635bd82 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -134,6 +134,7 @@
     <dimen name="avatar_length">48dp</dimen>
     <dimen name="avatar_margin_top">56dp</dimen>
     <dimen name="avatar_margin_end">24dp</dimen>
+    <dimen name="multiple_users_avatar_size">20dp</dimen>
 
     <!-- Homepage title -->
     <dimen name="homepage_title_margin_bottom">8dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 02bc5dd..5e654f9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2919,6 +2919,8 @@
     <string name="screen_resolution_summary_high">1080p FHD+</string>
     <!-- Display settings screen, "QHD+" screen resolution summary [CHAR LIMIT=NONE] -->
     <string name="screen_resolution_summary_highest">1440p QHD+</string>
+    <!-- The footer message for switch screen resolution [CHAR LIMIT=NONE] -->
+    <string name="screen_resolution_footer">Switching your resolution might cause some apps currently running to close.</string>
 
     <!-- Display settings screen, Color mode settings title [CHAR LIMIT=30] -->
     <string name="color_mode_title">Colors</string>
@@ -5212,9 +5214,9 @@
     <!-- Title for accessibility shortcut preference for magnification. [CHAR LIMIT=60] -->
     <string name="accessibility_screen_magnification_shortcut_title">Magnification shortcut</string>
     <!-- Title for accessibility follow typing preference for magnification. [CHAR LIMIT=35] -->
-    <string name="accessibility_screen_magnification_follow_typing_title">Follow typing</string>
+    <string name="accessibility_screen_magnification_follow_typing_title">Magnify typing</string>
     <!-- Summary for accessibility follow typing preference for magnification. [CHAR LIMIT=none] -->
-    <string name="accessibility_screen_magnification_follow_typing_summary">Magnification area automatically follows the text as you type</string>
+    <string name="accessibility_screen_magnification_follow_typing_summary">Magnifier follows text as you type</string>
     <!-- Title for screen magnification footer. [CHAR LIMIT=60] -->
     <string name="accessibility_screen_magnification_about_title">About magnification</string>
     <!-- Screen magnification footer link content description [CHAR LIMIT=NONE] -->
@@ -10617,7 +10619,7 @@
     <!-- Body text of prompt dialog app can invoke to turn off optimization [CHAR LIMIT=NONE] -->
     <string name="high_power_prompt_body">
         Allowing <xliff:g id="app_name" example="Settings">%1$s</xliff:g> to always run in the background may reduce battery life.
-        \n\nYou can change this later from Settings > Apps &amp; notifications.</string>
+        \n\nYou can change this later from Settings > Apps.</string>
     <!-- Summary of power usage for an app [CHAR LIMIT=NONE] -->
     <string name="battery_summary"><xliff:g id="percentage" example="2">%1$s</xliff:g> use since last full charge</string>
     <!-- Summary of power usage for an app within past 24 hr[CHAR LIMIT=NONE] -->
@@ -12315,6 +12317,14 @@
     <!-- Location setting: preference summary - describes the behavior of forcing full raw GNSS satellite measurements [CHAR LIMIT=NONE] -->
     <string name="enable_gnss_raw_meas_full_tracking_summary">Track all GNSS constellations and frequencies with no duty cycling</string>
 
+    <!-- Developer options Input method category strings -->
+    <!-- Title for input method category [CHAR LIMIT=30]-->
+    <string name="input_method_category">Input Method</string>
+    <!-- [CHAR LIMIT=30] Title for Stylus handwriting settings -->
+    <string name="stylus_handwriting">Stylus handwriting</string>
+    <!-- [CHAR LIMIT=130] Summary for Stylus handwriting toggle -->
+    <string name="stylus_handwriting_summary">When enabled, current Input method receives stylus MotionEvent if an Editor is focused.</string>
+
     <!-- Name of setting for switching device theme [CHAR LIMIT=60] -->
     <string name="device_theme">Device theme</string>
     <!-- Name of default device theme [CHAR LIMIT=60] -->
@@ -13615,7 +13625,7 @@
     <!-- Title for default print service main switch. [CHAR LIMIT=50] -->
     <string name="default_print_service_main_switch_title">Use print service</string>
     <!-- Title for multiple users main switch. [CHAR LIMIT=50] -->
-    <string name="multiple_users_main_switch_title">Use multiple users</string>
+    <string name="multiple_users_main_switch_title">Enable multiple users</string>
     <!-- Title for wireless debugging main switch. [CHAR LIMIT=50] -->
     <string name="wireless_debugging_main_switch_title">Use wireless debugging</string>
     <!-- Title for graphics driver main switch. [CHAR LIMIT=50] -->
diff --git a/res/xml/accessibility_color_and_motion.xml b/res/xml/accessibility_color_and_motion.xml
index 86b6564..a313526 100644
--- a/res/xml/accessibility_color_and_motion.xml
+++ b/res/xml/accessibility_color_and_motion.xml
@@ -39,7 +39,18 @@
         settings:keywords="@string/keywords_color_inversion"
         settings:controller="com.android.settings.accessibility.ColorInversionPreferenceController"/>
 
+    <com.android.settings.display.darkmode.DarkModePreference
+        android:key="dark_ui_mode_accessibility"
+        android:icon="@drawable/ic_dark_ui"
+        android:title="@string/dark_ui_mode"
+        android:fragment="com.android.settings.display.darkmode.DarkModeSettingsFragment"
+        android:widgetLayout="@null"
+        settings:widgetLayout="@null"
+        settings:controller="com.android.settings.display.DarkUIPreferenceController"
+        settings:searchable="false"/>
+
     <SwitchPreference
+        android:icon="@drawable/ic_accessibility_animation"
         android:key="toggle_disable_animations"
         android:persistent="false"
         android:summary="@string/accessibility_disable_animations_summary"
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 22226a1..2e253e2 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -60,16 +60,6 @@
             settings:keywords="@string/keywords_reduce_bright_colors"
             settings:controller="com.android.settings.accessibility.ReduceBrightColorsPreferenceController"/>
 
-        <com.android.settings.display.darkmode.DarkModePreference
-            android:key="dark_ui_mode_accessibility"
-            android:icon="@drawable/ic_dark_ui"
-            android:title="@string/dark_ui_mode"
-            android:fragment="com.android.settings.display.darkmode.DarkModeSettingsFragment"
-            android:widgetLayout="@null"
-            settings:widgetLayout="@null"
-            settings:controller="com.android.settings.display.DarkUIPreferenceController"
-            settings:searchable="false"/>
-
         <Preference
             android:fragment="com.android.settings.accessibility.MagnificationPreferenceFragment"
             android:key="magnification_preference_screen"
diff --git a/res/xml/accessibility_settings_for_setup_wizard.xml b/res/xml/accessibility_settings_for_setup_wizard.xml
index 78d8f72..a50e7dd 100644
--- a/res/xml/accessibility_settings_for_setup_wizard.xml
+++ b/res/xml/accessibility_settings_for_setup_wizard.xml
@@ -47,4 +47,12 @@
         android:persistent="true"
         android:summary="@string/talkback_summary"/>
 
+    <SwitchPreference
+        android:icon="@drawable/ic_accessibility_animation"
+        android:key="toggle_disable_animations"
+        android:persistent="false"
+        android:summary="@string/accessibility_disable_animations_summary"
+        android:title="@string/accessibility_disable_animations"
+        settings:controller="com.android.settings.accessibility.DisableAnimationsPreferenceController"/>
+
 </PreferenceScreen>
diff --git a/res/xml/battery_saver_settings.xml b/res/xml/battery_saver_settings.xml
index e105920..862bcd7 100644
--- a/res/xml/battery_saver_settings.xml
+++ b/res/xml/battery_saver_settings.xml
@@ -23,6 +23,7 @@
     <com.android.settingslib.widget.MainSwitchPreference
         android:order="-100"
         android:key="battery_saver"
+        android:title="@string/battery_saver_master_switch_title"
         settings:controller="com.android.settings.fuelgauge.batterysaver.BatterySaverButtonPreferenceController"/>
 
     <Preference
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index f29930c..ed1b4d2 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -297,7 +297,7 @@
             android:title="@string/tethering_hardware_offload"
             android:summary="@string/tethering_hardware_offload_summary" />
 
-        <com.android.settingslib.RestrictedSwitchPreference
+        <com.android.settingslib.RestrictedPreference
             android:key="default_usb_configuration"
             android:fragment="com.android.settings.connecteddevice.usb.UsbDefaultFragment"
             android:title="@string/usb_default_label"/>
@@ -648,7 +648,7 @@
             android:title="@string/reset_shortcut_manager_throttling" />
     </PreferenceCategory>
 
-    <com.android.settings.development.autofill.AutofillPreferenceCategory
+    <PreferenceCategory
         android:key="debug_autofill_category"
         android:title="@string/debug_autofill_category"
         settings:searchable="false"
@@ -672,7 +672,7 @@
             android:key="autofill_reset_developer_options"
             android:title="@string/autofill_reset_developer_options" />
 
-    </com.android.settings.development.autofill.AutofillPreferenceCategory>
+    </PreferenceCategory>
 
     <PreferenceCategory
         android:key="storage_category"
@@ -709,4 +709,15 @@
             android:key="location_indicator_settings"
             settings:controller="com.android.settings.location.LocationIndicatorsPreferenceController"/>
     </PreferenceCategory>
+
+    <PreferenceCategory
+        android:key="input_method_category"
+        android:title="@string/input_method_category"
+        android:order="1400">
+
+        <SwitchPreference
+            android:key="stylus_handwriting"
+            android:title="@string/stylus_handwriting"
+            android:summary="@string/stylus_handwriting_summary" />
+    </PreferenceCategory>
 </PreferenceScreen>
diff --git a/res/xml/one_handed_settings.xml b/res/xml/one_handed_settings.xml
index 7406993..ab4d6f7 100644
--- a/res/xml/one_handed_settings.xml
+++ b/res/xml/one_handed_settings.xml
@@ -46,7 +46,7 @@
             android:key="gesture_one_handed_action_pull_screen_down"
             android:title="@string/one_handed_action_pull_down_screen_title"
             android:summary="@string/one_handed_action_pull_down_screen_summary"
-            settings:controller="com.android.settings.gesture_one_handed_mode_footer_textgestures.OneHandedActionPullDownPrefController"/>
+            settings:controller="com.android.settings.gestures.OneHandedActionPullDownPrefController"/>
 
         <com.android.settingslib.widget.SelectorWithWidgetPreference
             android:key="gesture_one_handed_action_show_notification"
diff --git a/res/xml/user_settings.xml b/res/xml/user_settings.xml
index d5e61d0..ab54989 100644
--- a/res/xml/user_settings.xml
+++ b/res/xml/user_settings.xml
@@ -40,13 +40,11 @@
     <com.android.settingslib.RestrictedPreference
         android:key="user_add"
         android:title="@string/user_add_user_or_profile_menu"
-        android:icon="@drawable/ic_add_40dp"
         android:order="20"/>
 
     <com.android.settingslib.RestrictedPreference
         android:key="supervised_user_add"
         android:title="@*android:string/supervised_user_creation_label"
-        android:icon="@*android:drawable/ic_add_supervised_user"
         android:order="25"/>
 
     <com.android.settingslib.RestrictedSwitchPreference
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index ae24168..da21729 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -34,8 +34,6 @@
 import android.hardware.usb.UsbManager;
 import android.net.ConnectivityManager;
 import android.net.EthernetManager;
-import android.net.EthernetManager.InterfaceState;
-import android.net.EthernetManager.Role;
 import android.net.IpConfiguration;
 import android.net.TetheringManager;
 import android.net.wifi.WifiManager;
@@ -650,8 +648,8 @@
     }
 
     private final class EthernetListener implements EthernetManager.InterfaceStateListener {
-        public void onInterfaceStateChanged(@NonNull String iface, @InterfaceState int state,
-                @Role int role, @NonNull IpConfiguration configuration) {
+        public void onInterfaceStateChanged(@NonNull String iface, int state, int role,
+                @NonNull IpConfiguration configuration) {
             if (state == EthernetManager.STATE_LINK_UP) {
                 mAvailableInterfaces.add(iface);
             } else {
diff --git a/src/com/android/settings/biometrics/BiometricNavigationUtils.java b/src/com/android/settings/biometrics/BiometricNavigationUtils.java
index b747faf..32d3a32 100644
--- a/src/com/android/settings/biometrics/BiometricNavigationUtils.java
+++ b/src/com/android/settings/biometrics/BiometricNavigationUtils.java
@@ -37,7 +37,11 @@
  */
 public class BiometricNavigationUtils {
 
-    private final int mUserId = UserHandle.myUserId();
+    private final int mUserId;
+
+    public BiometricNavigationUtils(int userId) {
+        mUserId = userId;
+    }
 
     /**
      * Tries to launch the Settings screen if Quiet Mode is not enabled
diff --git a/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java b/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java
index 617529f..f61f99c 100644
--- a/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java
+++ b/src/com/android/settings/biometrics/BiometricStatusPreferenceController.java
@@ -60,7 +60,7 @@
                 .getSecurityFeatureProvider()
                 .getLockPatternUtils(context);
         mProfileChallengeUserId = Utils.getManagedProfileId(mUm, mUserId);
-        mBiometricNavigationUtils = new BiometricNavigationUtils();
+        mBiometricNavigationUtils = new BiometricNavigationUtils(getUserId());
     }
 
     @Override
diff --git a/src/com/android/settings/biometrics/combination/CombinedBiometricStatusPreferenceController.java b/src/com/android/settings/biometrics/combination/CombinedBiometricStatusPreferenceController.java
index 27e3ae7..ba09e5f 100644
--- a/src/com/android/settings/biometrics/combination/CombinedBiometricStatusPreferenceController.java
+++ b/src/com/android/settings/biometrics/combination/CombinedBiometricStatusPreferenceController.java
@@ -56,7 +56,7 @@
     public CombinedBiometricStatusPreferenceController(
             Context context, String key, Lifecycle lifecycle) {
         super(context, key);
-        mCombinedBiometricStatusUtils = new CombinedBiometricStatusUtils(context);
+        mCombinedBiometricStatusUtils = new CombinedBiometricStatusUtils(context, getUserId());
 
         if (lifecycle != null) {
             lifecycle.addObserver(this);
diff --git a/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtils.java b/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtils.java
index a7554c8..f1e312a 100644
--- a/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtils.java
+++ b/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtils.java
@@ -20,7 +20,6 @@
 import android.hardware.biometrics.BiometricAuthenticator;
 import android.hardware.face.FaceManager;
 import android.hardware.fingerprint.FingerprintManager;
-import android.os.UserHandle;
 
 import androidx.annotation.Nullable;
 
@@ -35,17 +34,18 @@
  */
 public class CombinedBiometricStatusUtils {
 
-    private final int mUserId = UserHandle.myUserId();
+    private final int mUserId;
     private final Context mContext;
     @Nullable
     FingerprintManager mFingerprintManager;
     @Nullable
     FaceManager mFaceManager;
 
-    public CombinedBiometricStatusUtils(Context context) {
+    public CombinedBiometricStatusUtils(Context context, int userId) {
         mContext = context;
         mFingerprintManager = Utils.getFingerprintManagerOrNull(context);
         mFaceManager = Utils.getFaceManagerOrNull(context);
+        mUserId = userId;
     }
 
     /**
diff --git a/src/com/android/settings/biometrics/face/FaceStatusPreferenceController.java b/src/com/android/settings/biometrics/face/FaceStatusPreferenceController.java
index cd0bc15..9b4b433 100644
--- a/src/com/android/settings/biometrics/face/FaceStatusPreferenceController.java
+++ b/src/com/android/settings/biometrics/face/FaceStatusPreferenceController.java
@@ -57,7 +57,7 @@
     public FaceStatusPreferenceController(Context context, String key, Lifecycle lifecycle) {
         super(context, key);
         mFaceManager = Utils.getFaceManagerOrNull(context);
-        mFaceStatusUtils = new FaceStatusUtils(context, mFaceManager);
+        mFaceStatusUtils = new FaceStatusUtils(context, mFaceManager, getUserId());
 
         if (lifecycle != null) {
             lifecycle.addObserver(this);
diff --git a/src/com/android/settings/biometrics/face/FaceStatusUtils.java b/src/com/android/settings/biometrics/face/FaceStatusUtils.java
index dd32708..4e25543 100644
--- a/src/com/android/settings/biometrics/face/FaceStatusUtils.java
+++ b/src/com/android/settings/biometrics/face/FaceStatusUtils.java
@@ -19,7 +19,6 @@
 import android.content.Context;
 import android.hardware.biometrics.BiometricAuthenticator;
 import android.hardware.face.FaceManager;
-import android.os.UserHandle;
 
 import com.android.settings.R;
 import com.android.settings.Settings;
@@ -32,13 +31,14 @@
  */
 public class FaceStatusUtils {
 
-    private final int mUserId = UserHandle.myUserId();
+    private final int mUserId;
     private final Context mContext;
     private final FaceManager mFaceManager;
 
-    public FaceStatusUtils(Context context, FaceManager faceManager) {
+    public FaceStatusUtils(Context context, FaceManager faceManager, int userId) {
         mContext = context;
         mFaceManager = faceManager;
+        mUserId = userId;
     }
 
     /**
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintStatusPreferenceController.java b/src/com/android/settings/biometrics/fingerprint/FingerprintStatusPreferenceController.java
index 646af4d..62edcf0 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintStatusPreferenceController.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintStatusPreferenceController.java
@@ -58,7 +58,7 @@
         super(context, key);
         mFingerprintManager = Utils.getFingerprintManagerOrNull(context);
         mFingerprintStatusUtils =
-                new FingerprintStatusUtils(context, mFingerprintManager);
+                new FingerprintStatusUtils(context, mFingerprintManager, getUserId());
 
         if (lifecycle != null) {
             lifecycle.addObserver(this);
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtils.java b/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtils.java
index 36edd2e..d23195d 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtils.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtils.java
@@ -19,7 +19,6 @@
 import android.content.Context;
 import android.hardware.biometrics.BiometricAuthenticator;
 import android.hardware.fingerprint.FingerprintManager;
-import android.os.UserHandle;
 
 import com.android.settings.R;
 import com.android.settings.Utils;
@@ -31,13 +30,15 @@
  */
 public class FingerprintStatusUtils {
 
-    private final int mUserId = UserHandle.myUserId();
+    private final int mUserId;
     private final Context mContext;
     private final FingerprintManager mFingerprintManager;
 
-    public FingerprintStatusUtils(Context context, FingerprintManager fingerprintManager) {
+    public FingerprintStatusUtils(Context context, FingerprintManager fingerprintManager,
+            int userId) {
         mContext = context;
         mFingerprintManager = fingerprintManager;
+        mUserId = userId;
     }
 
     /**
diff --git a/src/com/android/settings/dashboard/ControllerFutureTask.java b/src/com/android/settings/dashboard/ControllerFutureTask.java
deleted file mode 100644
index 84d11fd..0000000
--- a/src/com/android/settings/dashboard/ControllerFutureTask.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2019 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.dashboard;
-
-import com.android.settingslib.core.AbstractPreferenceController;
-
-import java.util.concurrent.FutureTask;
-
-/**
- *  {@link FutureTask} of the Controller.
- */
-public class ControllerFutureTask extends FutureTask<Void> {
-    private final AbstractPreferenceController mController;
-
-    public ControllerFutureTask(ControllerTask task, Void result) {
-        super(task, result);
-        mController = task.getController();
-    }
-
-    AbstractPreferenceController getController() {
-        return mController;
-    }
-}
diff --git a/src/com/android/settings/dashboard/ControllerTask.java b/src/com/android/settings/dashboard/ControllerTask.java
deleted file mode 100644
index c62e738..0000000
--- a/src/com/android/settings/dashboard/ControllerTask.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2019 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.dashboard;
-
-import android.app.settings.SettingsEnums;
-import android.os.SystemClock;
-import android.text.TextUtils;
-import android.util.Log;
-
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settingslib.core.AbstractPreferenceController;
-import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
-import com.android.settingslib.utils.ThreadUtils;
-
-/**
- * A {@link Runnable} controller task. This task handle the visibility of the controller in the
- * background. Also handle the state updating in the main thread.
- */
-public class ControllerTask implements Runnable {
-    private static final String TAG = "ControllerTask";
-    private static final int CONTROLLER_UPDATESTATE_TIME_THRESHOLD = 50;
-
-    private final AbstractPreferenceController mController;
-    private final PreferenceScreen mScreen;
-    private final int mMetricsCategory;
-    private final MetricsFeatureProvider mMetricsFeature;
-
-    public ControllerTask(AbstractPreferenceController controller, PreferenceScreen screen,
-            MetricsFeatureProvider metricsFeature, int metricsCategory) {
-        mController = controller;
-        mScreen = screen;
-        mMetricsFeature = metricsFeature;
-        mMetricsCategory = metricsCategory;
-    }
-
-    @Override
-    public void run() {
-        if (!mController.isAvailable()) {
-            return;
-        }
-
-        final String key = mController.getPreferenceKey();
-        if (TextUtils.isEmpty(key)) {
-            Log.d(TAG, String.format("Preference key is %s in Controller %s",
-                    key, mController.getClass().getSimpleName()));
-            return;
-        }
-
-        final Preference preference = mScreen.findPreference(key);
-        if (preference == null) {
-            Log.d(TAG, String.format("Cannot find preference with key %s in Controller %s",
-                    key, mController.getClass().getSimpleName()));
-            return;
-        }
-        ThreadUtils.postOnMainThread(() -> {
-            final long t = SystemClock.elapsedRealtime();
-            mController.updateState(preference);
-            final int elapsedTime = (int) (SystemClock.elapsedRealtime() - t);
-            if (elapsedTime > CONTROLLER_UPDATESTATE_TIME_THRESHOLD) {
-                Log.w(TAG, "The updateState took " + elapsedTime + " ms in Controller "
-                        + mController.getClass().getSimpleName());
-                if (mMetricsFeature != null) {
-                    mMetricsFeature.action(SettingsEnums.PAGE_UNKNOWN,
-                            SettingsEnums.ACTION_CONTROLLER_UPDATE_STATE, mMetricsCategory,
-                            mController.getClass().getSimpleName(), elapsedTime);
-                }
-            }
-        });
-    }
-
-    AbstractPreferenceController getController() {
-        return mController;
-    }
-}
diff --git a/src/com/android/settings/dashboard/DashboardFragment.java b/src/com/android/settings/dashboard/DashboardFragment.java
index 8b1d633..26fe1b1 100644
--- a/src/com/android/settings/dashboard/DashboardFragment.java
+++ b/src/com/android/settings/dashboard/DashboardFragment.java
@@ -48,7 +48,6 @@
 import com.android.settingslib.drawer.ProviderTile;
 import com.android.settingslib.drawer.Tile;
 import com.android.settingslib.search.Indexable;
-import com.android.settingslib.utils.ThreadUtils;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -58,7 +57,6 @@
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
-import java.util.concurrent.ExecutionException;
 
 /**
  * Base fragment for dashboard style UI containing a list of static and dynamic setting items.
@@ -222,7 +220,7 @@
         super.onResume();
         updatePreferenceStates();
         writeElapsedTimeMetric(SettingsEnums.ACTION_DASHBOARD_VISIBLE_TIME,
-                "isParalleledControllers:" + isParalleledControllers());
+                "isParalleledControllers:false");
     }
 
     @Override
@@ -349,14 +347,6 @@
     }
 
     /**
-     * @return {@code true} if the underlying controllers should be executed in parallel.
-     * Override this function to enable/disable the behavior.
-     */
-    protected boolean isParalleledControllers() {
-        return false;
-    }
-
-    /**
      * Get current PreferenceController(s)
      */
     protected Collection<List<AbstractPreferenceController>> getPreferenceControllers() {
@@ -395,36 +385,6 @@
     }
 
     /**
-     * Use parallel method to update state of each preference managed by PreferenceController.
-     */
-    @VisibleForTesting
-    // To use this parallel approach will cause the side effect of the UI flicker. Such as
-    // the thumb sliding of the toggle button.
-    void updatePreferenceStatesInParallel() {
-        final PreferenceScreen screen = getPreferenceScreen();
-        final Collection<List<AbstractPreferenceController>> controllerLists =
-                mPreferenceControllers.values();
-        final List<ControllerFutureTask> taskList = new ArrayList<>();
-        for (List<AbstractPreferenceController> controllerList : controllerLists) {
-            for (AbstractPreferenceController controller : controllerList) {
-                final ControllerFutureTask task = new ControllerFutureTask(
-                        new ControllerTask(controller, screen, mMetricsFeatureProvider,
-                                getMetricsCategory()), null /* result */);
-                taskList.add(task);
-                ThreadUtils.postOnBackgroundThread(task);
-            }
-        }
-
-        for (ControllerFutureTask task : taskList) {
-            try {
-                task.get();
-            } catch (InterruptedException | ExecutionException e) {
-                Log.w(TAG, task.getController().getPreferenceKey() + " " + e.getMessage());
-            }
-        }
-    }
-
-    /**
      * Refresh all preference items, including both static prefs from xml, and dynamic items from
      * DashboardCategory.
      */
diff --git a/src/com/android/settings/development/DefaultUsbConfigurationPreferenceController.java b/src/com/android/settings/development/DefaultUsbConfigurationPreferenceController.java
index 87ca40f..bbe46b3 100644
--- a/src/com/android/settings/development/DefaultUsbConfigurationPreferenceController.java
+++ b/src/com/android/settings/development/DefaultUsbConfigurationPreferenceController.java
@@ -25,7 +25,7 @@
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settingslib.RestrictedSwitchPreference;
+import com.android.settingslib.RestrictedPreference;
 import com.android.settingslib.development.DeveloperOptionsPreferenceController;
 
 public class DefaultUsbConfigurationPreferenceController extends
@@ -33,7 +33,7 @@
 
     private static final String PREFERENCE_KEY = "default_usb_configuration";
 
-    private RestrictedSwitchPreference mPreference;
+    private RestrictedPreference mPreference;
 
     public DefaultUsbConfigurationPreferenceController(Context context) {
         super(context);
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 025c51f..57114e2 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -47,6 +47,7 @@
 import com.android.settings.Utils;
 import com.android.settings.core.SubSettingLauncher;
 import com.android.settings.dashboard.RestrictedDashboardFragment;
+import com.android.settings.development.autofill.AutofillCategoryController;
 import com.android.settings.development.autofill.AutofillLoggingLevelPreferenceController;
 import com.android.settings.development.autofill.AutofillResetOptionsPreferenceController;
 import com.android.settings.development.bluetooth.AbstractBluetoothDialogPreferenceController;
@@ -566,6 +567,7 @@
         controllers.add(new DefaultLaunchPreferenceController(context, "density"));
         controllers.add(new DefaultLaunchPreferenceController(context, "background_check"));
         controllers.add(new DefaultLaunchPreferenceController(context, "inactive_apps"));
+        controllers.add(new AutofillCategoryController(context, lifecycle));
         controllers.add(new AutofillLoggingLevelPreferenceController(context, lifecycle));
         controllers.add(new AutofillResetOptionsPreferenceController(context));
         controllers.add(new BluetoothCodecDialogPreferenceController(context, lifecycle,
@@ -582,6 +584,7 @@
                 bluetoothA2dpConfigStore, fragment));
         controllers.add(new SharedDataPreferenceController(context));
         controllers.add(new OverlaySettingsPreferenceController(context));
+        controllers.add(new StylusHandwritingPreferenceController(context));
 
         return controllers;
     }
diff --git a/src/com/android/settings/development/StylusHandwritingPreferenceController.java b/src/com/android/settings/development/StylusHandwritingPreferenceController.java
new file mode 100644
index 0000000..69b5bad
--- /dev/null
+++ b/src/com/android/settings/development/StylusHandwritingPreferenceController.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreference;
+
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+class StylusHandwritingPreferenceController extends DeveloperOptionsPreferenceController
+        implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
+
+    static final int SETTING_VALUE_ON = 1;
+    static final int SETTING_VALUE_OFF = 0;
+
+    private static final String STYLUS_HANDWRITING_OPTIONS_KEY = "stylus_handwriting";
+
+    StylusHandwritingPreferenceController(Context context) {
+        super(context);
+    }
+
+    @Override
+    public String getPreferenceKey() {
+        return STYLUS_HANDWRITING_OPTIONS_KEY;
+    }
+
+    @Override
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        final boolean isEnabled = (Boolean) newValue;
+        Settings.Global.putInt(mContext.getContentResolver(),
+                Settings.Global.STYLUS_HANDWRITING_ENABLED,
+                isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
+
+        return true;
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        final int enable = Settings.Global.getInt(mContext.getContentResolver(),
+                Settings.Global.STYLUS_HANDWRITING_ENABLED, SETTING_VALUE_OFF);
+        ((SwitchPreference) mPreference).setChecked(enable != SETTING_VALUE_OFF);
+    }
+
+    @Override
+    protected void onDeveloperOptionsSwitchDisabled() {
+        super.onDeveloperOptionsSwitchDisabled();
+        Settings.Global.putInt(mContext.getContentResolver(),
+                Settings.Global.STYLUS_HANDWRITING_ENABLED, SETTING_VALUE_OFF);
+        ((SwitchPreference) mPreference).setChecked(false);
+    }
+}
diff --git a/src/com/android/settings/development/autofill/AutofillCategoryController.java b/src/com/android/settings/development/autofill/AutofillCategoryController.java
new file mode 100644
index 0000000..91b3b9c
--- /dev/null
+++ b/src/com/android/settings/development/autofill/AutofillCategoryController.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development.autofill;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.database.ContentObserver;
+import android.net.Uri;
+import android.os.Handler;
+import android.os.Looper;
+import android.provider.Settings;
+import android.util.Log;
+import android.view.autofill.AutofillManager;
+
+import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settingslib.core.lifecycle.LifecycleObserver;
+import com.android.settingslib.core.lifecycle.events.OnStart;
+import com.android.settingslib.core.lifecycle.events.OnStop;
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+/**
+ * Controller class for observing the state of AutofillManager.
+ */
+public class AutofillCategoryController extends DeveloperOptionsPreferenceController implements
+        LifecycleObserver, OnStart, OnStop {
+
+    private static final String TAG = "AutofillCategoryController";
+
+    private static final String CATEGORY_KEY = "debug_autofill_category";
+    private static final long DELAYED_MESSAGE_TIME_MS = 2000;
+
+    private ContentResolver mContentResolver;
+    private ContentObserver mSettingsObserver;
+    private final Handler mHandler = new Handler(Looper.getMainLooper());
+
+    public AutofillCategoryController(Context context, Lifecycle lifecycle) {
+        super(context);
+
+        if (lifecycle != null) {
+            lifecycle.addObserver(this);
+        }
+
+        mSettingsObserver = new ContentObserver(mHandler) {
+            @Override
+            public void onChange(boolean selfChange, Uri uri, int userId) {
+                // We cannot apply the change yet because AutofillManager.isEnabled() state is
+                // updated by a ContentObserver as well and there's no guarantee of which observer
+                // is called first - hence, it's possible that the state didn't change here yet.
+                mHandler.postDelayed(
+                        () -> mPreference.notifyDependencyChange(shouldDisableDependents()),
+                        DELAYED_MESSAGE_TIME_MS);
+            }
+        };
+        mContentResolver = context.getContentResolver();
+    }
+
+    @Override
+    public String getPreferenceKey() {
+        return CATEGORY_KEY;
+    }
+
+    @Override
+    public void onStart() {
+        mContentResolver.registerContentObserver(
+                Settings.Secure.getUriFor(Settings.Secure.AUTOFILL_SERVICE), false,
+                mSettingsObserver);
+
+    }
+
+    @Override
+    public void onStop() {
+        mContentResolver.unregisterContentObserver(mSettingsObserver);
+    }
+
+    // PreferenceCategory.isEnabled() always return false, so we rather not change that logic
+    // decide whether the children should be shown using isAutofillEnabled() instead.
+    private boolean isAutofillEnabled() {
+        final AutofillManager afm = mContext.getSystemService(AutofillManager.class);
+        final boolean enabled = afm != null && afm.isEnabled();
+        Log.v(TAG, "isAutofillEnabled(): " + enabled);
+        return enabled;
+    }
+
+    private boolean shouldDisableDependents() {
+        final boolean shouldIt = !isAutofillEnabled();
+        Log.v(TAG, "shouldDisableDependents(): " + shouldIt);
+        return shouldIt;
+    }
+}
diff --git a/src/com/android/settings/development/autofill/AutofillPreferenceCategory.java b/src/com/android/settings/development/autofill/AutofillPreferenceCategory.java
deleted file mode 100644
index cbfbdd3..0000000
--- a/src/com/android/settings/development/autofill/AutofillPreferenceCategory.java
+++ /dev/null
@@ -1,86 +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.development.autofill;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.database.ContentObserver;
-import android.net.Uri;
-import android.os.Handler;
-import android.os.Looper;
-import android.provider.Settings;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.autofill.AutofillManager;
-
-import androidx.preference.PreferenceCategory;
-
-public final class AutofillPreferenceCategory extends PreferenceCategory {
-
-    private static final String TAG = "AutofillPreferenceCategory";
-    private static final long DELAYED_MESSAGE_TIME_MS = 2000;
-
-    private final ContentResolver mContentResolver;
-    private final ContentObserver mSettingsObserver;
-    private final Handler mHandler = new Handler(Looper.getMainLooper());
-
-    public AutofillPreferenceCategory(Context context, AttributeSet attrs) {
-        super(context, attrs);
-
-        mSettingsObserver = new ContentObserver(mHandler) {
-            @Override
-            public void onChange(boolean selfChange, Uri uri, int userId) {
-                // We cannot apply the change yet because AutofillManager.isEnabled() state is
-                // updated by a ContentObserver as well and there's no guarantee of which observer
-                // is called first - hence, it's possible that the state didn't change here yet.
-                mHandler.postDelayed(() -> notifyDependencyChange(shouldDisableDependents()),
-                        DELAYED_MESSAGE_TIME_MS);
-            }
-        };
-        mContentResolver = context.getContentResolver();
-    }
-
-    @Override
-    public void onAttached() {
-        super.onAttached();
-
-        mContentResolver.registerContentObserver(
-                Settings.Secure.getUriFor(Settings.Secure.AUTOFILL_SERVICE), false,
-                mSettingsObserver);
-    }
-
-    @Override
-    public void onDetached() {
-        mContentResolver.unregisterContentObserver(mSettingsObserver);
-
-        super.onDetached();
-    }
-
-    // PreferenceCategory.isEnabled() always return false, so we rather not change that logic
-    // decide whether the children should be shown using isAutofillEnabled() instead.
-    private boolean isAutofillEnabled() {
-        final AutofillManager afm = getContext().getSystemService(AutofillManager.class);
-        final boolean enabled = afm != null && afm.isEnabled();
-        Log.v(TAG, "isAutofillEnabled(): " + enabled);
-        return enabled;
-    }
-
-    @Override
-    public boolean shouldDisableDependents() {
-        final boolean shouldIt = !isAutofillEnabled();
-        Log.v(TAG, "shouldDisableDependents(): " + shouldIt);
-        return shouldIt;
-    }
-}
diff --git a/src/com/android/settings/display/ScreenResolutionFragment.java b/src/com/android/settings/display/ScreenResolutionFragment.java
index 3195772..3b08ae7 100644
--- a/src/com/android/settings/display/ScreenResolutionFragment.java
+++ b/src/com/android/settings/display/ScreenResolutionFragment.java
@@ -36,7 +36,9 @@
 import com.android.settings.widget.RadioButtonPickerFragment;
 import com.android.settingslib.search.SearchIndexable;
 import com.android.settingslib.widget.CandidateInfo;
+import com.android.settingslib.widget.FooterPreference;
 import com.android.settingslib.widget.IllustrationPreference;
+import com.android.settingslib.widget.SelectorWithWidgetPreference;
 
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -55,6 +57,7 @@
     private Display mDefaultDisplay;
     private String[] mScreenResolutionOptions;
     private Set<Point> mResolutions;
+    private String[] mScreenResolutionSummaries;
 
     private IllustrationPreference mImagePreference;
 
@@ -67,6 +70,8 @@
         mResources = context.getResources();
         mScreenResolutionOptions =
                 mResources.getStringArray(R.array.config_screen_resolution_options_strings);
+        mScreenResolutionSummaries =
+                mResources.getStringArray(R.array.config_screen_resolution_summaries_strings);
         mResolutions = getAllSupportedResolution();
         mImagePreference = new IllustrationPreference(context);
     }
@@ -80,6 +85,24 @@
     protected void addStaticPreferences(PreferenceScreen screen) {
         updateIllustrationImage(mImagePreference);
         screen.addPreference(mImagePreference);
+
+        final FooterPreference footerPreference = new FooterPreference(screen.getContext());
+        footerPreference.setTitle(R.string.screen_resolution_footer);
+        footerPreference.setSelectable(false);
+        footerPreference.setLayoutResource(R.layout.preference_footer);
+        screen.addPreference(footerPreference);
+    }
+
+    @Override
+    public void bindPreferenceExtra(
+            SelectorWithWidgetPreference pref,
+            String key,
+            CandidateInfo info,
+            String defaultKey,
+            String systemDefaultKey) {
+        final ScreenResolutionCandidateInfo candidateInfo = (ScreenResolutionCandidateInfo) info;
+        final CharSequence summary = candidateInfo.loadSummary();
+        if (summary != null) pref.setSummary(summary);
     }
 
     @Override
@@ -90,6 +113,7 @@
             candidates.add(
                     new ScreenResolutionCandidateInfo(
                             mScreenResolutionOptions[i],
+                            mScreenResolutionSummaries[i],
                             mScreenResolutionOptions[i],
                             true /* enabled */));
         }
@@ -134,9 +158,9 @@
     /** Get the key corresponding to the resolution. */
     @VisibleForTesting
     String getKeyForResolution(int width) {
-        return width == FHD_WIDTH
-                ? mScreenResolutionOptions[FHD_INDEX]
-                : width == QHD_WIDTH ? mScreenResolutionOptions[QHD_INDEX] : null;
+        return width == FHD_WIDTH ? mScreenResolutionOptions[FHD_INDEX]
+                : width == QHD_WIDTH ? mScreenResolutionOptions[QHD_INDEX]
+                : null;
     }
 
     @Override
@@ -175,13 +199,17 @@
         return SettingsEnums.SCREEN_RESOLUTION;
     }
 
-    static class ScreenResolutionCandidateInfo extends CandidateInfo {
+    /** This is an extension of the CandidateInfo class, which adds summary information. */
+    public static class ScreenResolutionCandidateInfo extends CandidateInfo {
         private final CharSequence mLabel;
+        private final CharSequence mSummary;
         private final String mKey;
 
-        ScreenResolutionCandidateInfo(CharSequence label, String key, boolean enabled) {
+        ScreenResolutionCandidateInfo(
+                CharSequence label, CharSequence summary, String key, boolean enabled) {
             super(enabled);
             mLabel = label;
+            mSummary = summary;
             mKey = key;
         }
 
@@ -190,6 +218,11 @@
             return mLabel;
         }
 
+        /** It is the summary for radio options. */
+        public CharSequence loadSummary() {
+            return mSummary;
+        }
+
         @Override
         public Drawable loadIcon() {
             return null;
diff --git a/src/com/android/settings/dream/DreamAdapter.java b/src/com/android/settings/dream/DreamAdapter.java
index 44f77e3..f196500 100644
--- a/src/com/android/settings/dream/DreamAdapter.java
+++ b/src/com/android/settings/dream/DreamAdapter.java
@@ -84,6 +84,9 @@
                 mPreviewView.setImageDrawable(previewImage);
                 mPreviewView.setClipToOutline(true);
                 mPreviewPlaceholderView.setVisibility(View.GONE);
+            } else {
+                mPreviewView.setImageDrawable(null);
+                mPreviewPlaceholderView.setVisibility(View.VISIBLE);
             }
 
             final Drawable icon = item.isActive()
@@ -91,7 +94,7 @@
                     : item.getIcon();
             if (icon instanceof VectorDrawable) {
                 icon.setTintList(
-                        mContext.getColorStateList(R.color.dream_card_text_color_state_list));
+                        mContext.getColorStateList(R.color.dream_card_icon_color_state_list));
             }
             final int iconSize = mContext.getResources().getDimensionPixelSize(
                     R.dimen.dream_item_icon_size);
diff --git a/src/com/android/settings/flashlight/FlashlightHandleActivity.java b/src/com/android/settings/flashlight/FlashlightHandleActivity.java
index 5894965..0847d49 100644
--- a/src/com/android/settings/flashlight/FlashlightHandleActivity.java
+++ b/src/com/android/settings/flashlight/FlashlightHandleActivity.java
@@ -21,12 +21,13 @@
 import android.content.Intent;
 import android.os.Bundle;
 import android.provider.Settings;
+import android.util.Log;
 
 import com.android.settings.R;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settingslib.search.Indexable;
-import com.android.settingslib.search.SearchIndexableRaw;
 import com.android.settingslib.search.SearchIndexable;
+import com.android.settingslib.search.SearchIndexableRaw;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -39,6 +40,9 @@
 
     public static final String EXTRA_FALLBACK_TO_HOMEPAGE = "fallback_to_homepage";
 
+    private static final String TAG = "FlashlightActivity";
+    private static final String DATA_KEY = "flashlight";
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -69,10 +73,20 @@
                     data.intentTargetPackage = context.getPackageName();
                     data.intentTargetClass = FlashlightHandleActivity.class.getName();
                     data.intentAction = Intent.ACTION_MAIN;
-                    data.key = "flashlight";
+                    data.key = DATA_KEY;
                     result.add(data);
 
                     return result;
                 }
+
+                @Override
+                public List<String> getNonIndexableKeys(Context context) {
+                    List<String> keys = super.getNonIndexableKeys(context);
+                    if (!FlashlightSlice.isFlashlightAvailable(context)) {
+                        Log.i(TAG, "Flashlight is unavailable");
+                        keys.add(DATA_KEY);
+                    }
+                    return keys;
+                }
             };
 }
diff --git a/src/com/android/settings/flashlight/FlashlightSlice.java b/src/com/android/settings/flashlight/FlashlightSlice.java
index eaf059a..5feaf4f 100644
--- a/src/com/android/settings/flashlight/FlashlightSlice.java
+++ b/src/com/android/settings/flashlight/FlashlightSlice.java
@@ -39,7 +39,6 @@
 import androidx.slice.builders.ListBuilder.RowBuilder;
 import androidx.slice.builders.SliceAction;
 
-import com.android.internal.annotations.VisibleForTesting;
 import com.android.settings.R;
 import com.android.settings.Utils;
 import com.android.settings.slices.CustomSliceRegistry;
@@ -138,7 +137,6 @@
         return null;
     }
 
-    @VisibleForTesting
     static boolean isFlashlightAvailable(Context context) {
         int defaultAvailability = 0;
         try {
diff --git a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverButtonPreferenceController.java b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverButtonPreferenceController.java
index 2979151..d24f1b2 100644
--- a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverButtonPreferenceController.java
+++ b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverButtonPreferenceController.java
@@ -95,7 +95,6 @@
     public void displayPreference(PreferenceScreen screen) {
         super.displayPreference(screen);
         mPreference = screen.findPreference(getPreferenceKey());
-        mPreference.setTitle(mContext.getString(R.string.battery_saver_master_switch_title));
         mPreference.addOnSwitchChangeListener(this);
         mPreference.updateStatus(isChecked());
     }
@@ -113,7 +112,6 @@
     @Override
     public boolean setChecked(boolean stateOn) {
         // This screen already shows a warning, so we don't need another warning.
-        mPreference.updateStatus(isChecked());
         return BatterySaverUtils.setPowerSaveMode(mContext, stateOn,
                 false /* needFirstTimeWarning */);
     }
diff --git a/src/com/android/settings/network/UiccSlotUtil.java b/src/com/android/settings/network/UiccSlotUtil.java
index d28d93a..9a157d6 100644
--- a/src/com/android/settings/network/UiccSlotUtil.java
+++ b/src/com/android/settings/network/UiccSlotUtil.java
@@ -20,11 +20,13 @@
 import android.content.Context;
 import android.provider.Settings;
 import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 import android.telephony.UiccSlotInfo;
 import android.telephony.UiccSlotMapping;
 import android.util.Log;
 
+import com.android.internal.annotations.VisibleForTesting;
 import com.android.settingslib.utils.ThreadUtils;
 
 import com.google.common.collect.ImmutableList;
@@ -33,6 +35,7 @@
 import java.lang.annotation.RetentionPolicy;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Comparator;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
@@ -45,6 +48,7 @@
 
     private static final long DEFAULT_WAIT_AFTER_SWITCH_TIMEOUT_MILLIS = 25 * 1000L;
 
+    public static final int INVALID_LOGICAL_SLOT_ID = -1;
     public static final int INVALID_PHYSICAL_SLOT_ID = -1;
     public static final int INVALID_PORT_ID = -1;
 
@@ -113,21 +117,27 @@
         }
         TelephonyManager telMgr = context.getSystemService(TelephonyManager.class);
         int inactiveRemovableSlot = getInactiveRemovableSlot(telMgr.getUiccSlotsInfo(), slotId);
-        Log.i(TAG, "The InactiveRemovableSlot: " + inactiveRemovableSlot);
-
-        Collection<UiccSlotMapping> uiccSlotMappings = telMgr.getSimSlotMapping();
-        Log.i(TAG, "The SimSlotMapping: " + uiccSlotMappings);
-
+        Log.d(TAG, "The InactiveRemovableSlot: " + inactiveRemovableSlot);
         if (inactiveRemovableSlot == INVALID_PHYSICAL_SLOT_ID) {
             // The slot is invalid slot id, then to skip this.
             // The slot is active, then the sim can enable directly.
             return;
         }
 
+        Collection<UiccSlotMapping> uiccSlotMappings = telMgr.getSimSlotMapping();
+        Log.d(TAG, "The SimSlotMapping: " + uiccSlotMappings);
+
+        SubscriptionManager subscriptionManager = context.getSystemService(
+                SubscriptionManager.class);
+        int excludedLogicalSlotIndex = getExcludedLogicalSlotIndex(uiccSlotMappings,
+                SubscriptionUtil.getActiveSubscriptions(subscriptionManager), removedSubInfo,
+                telMgr.isMultiSimEnabled());
         performSwitchToSlot(telMgr,
                 prepareUiccSlotMappings(uiccSlotMappings,
-                        inactiveRemovableSlot, /*removable sim's port Id*/ 0, removedSubInfo,
-                        telMgr.isMultiSimEnabled()),
+                        /*slot is psim*/ true,
+                        inactiveRemovableSlot,
+                        /*removable sim's port Id*/ TelephonyManager.DEFAULT_PORT_INDEX,
+                        excludedLogicalSlotIndex),
                 context);
     }
 
@@ -151,16 +161,21 @@
         }
         TelephonyManager telMgr = context.getSystemService(TelephonyManager.class);
         Collection<UiccSlotMapping> uiccSlotMappings = telMgr.getSimSlotMapping();
-        Log.i(TAG, "The SimSlotMapping: " + uiccSlotMappings);
+        Log.d(TAG, "The SimSlotMapping: " + uiccSlotMappings);
 
         if (isTargetSlotActive(uiccSlotMappings, physicalSlotId, port)) {
-            Log.i(TAG, "The slot is active, then the sim can enable directly.");
+            Log.d(TAG, "The slot is active, then the sim can enable directly.");
             return;
         }
 
+        SubscriptionManager subscriptionManager = context.getSystemService(
+                SubscriptionManager.class);
+        int excludedLogicalSlotIndex = getExcludedLogicalSlotIndex(uiccSlotMappings,
+                SubscriptionUtil.getActiveSubscriptions(subscriptionManager), removedSubInfo,
+                telMgr.isMultiSimEnabled());
         performSwitchToSlot(telMgr,
-                prepareUiccSlotMappings(uiccSlotMappings,
-                        physicalSlotId, port, removedSubInfo, telMgr.isMultiSimEnabled()),
+                prepareUiccSlotMappings(uiccSlotMappings, /*slot is not psim*/ false,
+                        physicalSlotId, port, excludedLogicalSlotIndex),
                 context);
     }
 
@@ -251,42 +266,111 @@
         return INVALID_PHYSICAL_SLOT_ID;
     }
 
-    private static Collection<UiccSlotMapping> prepareUiccSlotMappings(
-            Collection<UiccSlotMapping> uiccSlotMappings, int physicalSlotId, int port,
-            SubscriptionInfo removedSubInfo, boolean isMultiSimEnabled) {
+    // Device |                                        |Slot   |
+    // Working|                                        |Mapping|
+    // State  |Type                                    |Mode   |Friendly name
+    //--------------------------------------------------------------------------
+    // Single |SIM pSIM [RIL 0]                        |1      |pSIM active
+    // Single |SIM MEP Port #0 [RIL0]                  |2      |eSIM Port0 active
+    // Single |SIM MEP Port #1 [RIL0]                  |2.1    |eSIM Port1 active
+    // DSDS   |pSIM [RIL 0] + MEP Port #0 [RIL 1]      |3      |pSIM+Port0
+    // DSDS   |pSIM [RIL 0] + MEP Port #1 [RIL 1]      |3.1    |pSIM+Port1
+    // DSDS   |MEP Port #0 [RIL 0] + MEP Port #1 [RIL1]|3.2    |Dual-Ports-A
+    // DSDS   |MEP Port #1 [RIL 0] + MEP Port #0 [RIL1]|4      |Dual-Ports-B
+    //
+    // The rules are:
+    // 1. pSIM's logical slots always is [RIL 0].
+    // 2. assign the new active port to the same stack that will be de-activated
+    //    For example: mode#3->mode#4
+
+    @VisibleForTesting
+    static Collection<UiccSlotMapping> prepareUiccSlotMappings(
+            Collection<UiccSlotMapping> uiccSlotMappings, boolean isPsim, int physicalSlotId,
+            int port, int removedLogicalSlotId) {
+        if (removedLogicalSlotId == INVALID_LOGICAL_SLOT_ID) {
+            Log.d(TAG, "There is no removedLogicalSlotId. Do nothing.");
+            return uiccSlotMappings;
+        }
+        Log.d(TAG,
+                String.format(
+                        "Create new SimSlotMapping. Remove the UiccSlotMapping of logicalSlot%d"
+                                + ", and insert PhysicalSlotId%d-Port%d",
+                        removedLogicalSlotId, physicalSlotId, port));
         Collection<UiccSlotMapping> newUiccSlotMappings = new ArrayList<>();
-        if (!isMultiSimEnabled) {
-            // In the 'SS mode', the port is 0.
-            newUiccSlotMappings.add(new UiccSlotMapping(port, physicalSlotId, 0));
-        } else if (removedSubInfo != null) {
-            // DSDS+MEP
-            // The target slot+port is not active, but the all of logical slots are full. It
-            // needs to replace one of logical slots.
-            Log.i(TAG,
-                    String.format(
-                            "Start to set SimSlotMapping from subId%d(LogicalSlot%d-Port%d) to "
-                                    + "PhysicalSlotId%d-Port%d",
-                            removedSubInfo.getSubscriptionId(), removedSubInfo.getSimSlotIndex(),
-                            removedSubInfo.getPortIndex(), physicalSlotId, port));
-            newUiccSlotMappings =
-                    uiccSlotMappings.stream().map(uiccSlotMapping -> {
-                        if (uiccSlotMapping.getLogicalSlotIndex()
-                                == removedSubInfo.getSimSlotIndex()
-                                && uiccSlotMapping.getPortIndex()
-                                == removedSubInfo.getPortIndex()) {
-                            return new UiccSlotMapping(port, physicalSlotId,
-                                    uiccSlotMapping.getLogicalSlotIndex());
-                        }
-                        return uiccSlotMapping;
-                    }).collect(Collectors.toList());
-        } else {
-            // DSDS+no MEP
-            // The removable slot should be in UiccSlotMapping.
-            newUiccSlotMappings = uiccSlotMappings;
-            Log.i(TAG, "The removedSubInfo is null");
+        int logicalSlotIndex = 0;
+        if (isPsim) {
+            // The target slot is psim. The psim is always the first index at LogicalSlot.
+            newUiccSlotMappings.add(
+                    new UiccSlotMapping(port, physicalSlotId, logicalSlotIndex++));
+        }
+        Collection<UiccSlotMapping> tempUiccSlotMappings =
+                uiccSlotMappings.stream()
+                        .sorted(Comparator.comparingInt(UiccSlotMapping::getLogicalSlotIndex))
+                        .collect(Collectors.toList());
+        for (UiccSlotMapping uiccSlotMapping : tempUiccSlotMappings) {
+            if (uiccSlotMapping.getLogicalSlotIndex() == removedLogicalSlotId) {
+                if (!isPsim) {
+                    // Replace this uiccSlotMapping
+                    newUiccSlotMappings.add(new UiccSlotMapping(port, physicalSlotId,
+                            uiccSlotMapping.getLogicalSlotIndex()));
+                }
+                continue;
+            }
+
+            // If the psim is inserted, then change the logicalSlotIndex for another
+            // uiccSlotMappings.
+            newUiccSlotMappings.add(isPsim
+                    ? new UiccSlotMapping(uiccSlotMapping.getPortIndex(),
+                    uiccSlotMapping.getPhysicalSlotIndex(), logicalSlotIndex++)
+                    : uiccSlotMapping);
         }
 
-        Log.i(TAG, "The SimSlotMapping: " + newUiccSlotMappings);
+        Log.d(TAG, "The new SimSlotMapping: " + newUiccSlotMappings);
         return newUiccSlotMappings;
     }
+
+    /**
+     * To get the excluded logical slot index from uiccSlotMapping list. If the sim which is
+     * enabled by user does not have the corresponding slot, then it needs to do the
+     * SimSlotMapping changed. This method can find the logical slot index of the corresponding slot
+     * before the Frameworks do the SimSlotMapping changed.
+     *
+     * @param uiccSlotMappings The uiccSlotMapping list from the Telephony Frameworks.
+     * @param activeSubInfos The active subscriptionInfo list.
+     * @param removedSubInfo The removed sim card which is selected by the user. If the user
+     *                       don't select removed sim , then the value is null.
+     * @param isMultiSimEnabled whether the device is in the DSDS mode or not.
+     * @return The logical slot index of removed slot. If it can't find the removed slot, it
+     * returns {@link #INVALID_LOGICAL_SLOT_ID}.
+     */
+    @VisibleForTesting
+    static int getExcludedLogicalSlotIndex(Collection<UiccSlotMapping> uiccSlotMappings,
+            Collection<SubscriptionInfo> activeSubInfos, SubscriptionInfo removedSubInfo,
+            boolean isMultiSimEnabled) {
+        if (!isMultiSimEnabled) {
+            Log.i(TAG, "In the ss mode.");
+            return 0;
+        }
+        if (removedSubInfo != null) {
+            // Use removedSubInfo's logicalSlotIndex
+            Log.i(TAG, "The removedSubInfo is not null");
+            return removedSubInfo.getSimSlotIndex();
+        }
+        // If it needs to do simSlotMapping when user enables sim and there is an empty slot which
+        // there is no enabled sim in this slot, then the empty slot can be removed.
+        Log.i(TAG, "The removedSubInfo is null");
+        return uiccSlotMappings.stream()
+                .filter(uiccSlotMapping -> {
+                    // find the empty slots.
+                    for (SubscriptionInfo subInfo : activeSubInfos) {
+                        if (subInfo.getSimSlotIndex() == uiccSlotMapping.getLogicalSlotIndex()) {
+                            return false;
+                        }
+                    }
+                    return true;
+                })
+                .mapToInt(uiccSlotMapping -> uiccSlotMapping.getLogicalSlotIndex())
+                .findFirst()
+                .orElse(INVALID_LOGICAL_SLOT_ID);
+    }
 }
diff --git a/src/com/android/settings/safetycenter/BiometricsSafetySource.java b/src/com/android/settings/safetycenter/BiometricsSafetySource.java
index 59408c7..c302915 100644
--- a/src/com/android/settings/safetycenter/BiometricsSafetySource.java
+++ b/src/com/android/settings/safetycenter/BiometricsSafetySource.java
@@ -22,6 +22,7 @@
 import android.hardware.face.FaceManager;
 import android.hardware.fingerprint.FingerprintManager;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.safetycenter.SafetyEvent;
 import android.safetycenter.SafetySourceData;
 import android.safetycenter.SafetySourceStatus;
@@ -47,9 +48,12 @@
             return;
         }
 
-        final BiometricNavigationUtils biometricNavigationUtils = new BiometricNavigationUtils();
+        final int userId = UserHandle.myUserId();
+
+        final BiometricNavigationUtils biometricNavigationUtils = new BiometricNavigationUtils(
+                userId);
         final CombinedBiometricStatusUtils combinedBiometricStatusUtils =
-                new CombinedBiometricStatusUtils(context);
+                new CombinedBiometricStatusUtils(context, userId);
 
         if (combinedBiometricStatusUtils.isAvailable()) {
             final RestrictedLockUtils.EnforcedAdmin disablingAdmin =
@@ -66,7 +70,7 @@
         }
 
         final FaceManager faceManager = Utils.getFaceManagerOrNull(context);
-        final FaceStatusUtils faceStatusUtils = new FaceStatusUtils(context, faceManager);
+        final FaceStatusUtils faceStatusUtils = new FaceStatusUtils(context, faceManager, userId);
 
         if (faceStatusUtils.isAvailable()) {
             final RestrictedLockUtils.EnforcedAdmin disablingAdmin =
@@ -85,7 +89,7 @@
 
         final FingerprintManager fingerprintManager = Utils.getFingerprintManagerOrNull(context);
         final FingerprintStatusUtils fingerprintStatusUtils = new FingerprintStatusUtils(context,
-                fingerprintManager);
+                fingerprintManager, userId);
 
         if (fingerprintStatusUtils.isAvailable()) {
             final RestrictedLockUtils.EnforcedAdmin disablingAdmin =
diff --git a/src/com/android/settings/safetycenter/LockScreenSafetySource.java b/src/com/android/settings/safetycenter/LockScreenSafetySource.java
index ad0bd3a..6cd7fa5 100644
--- a/src/com/android/settings/safetycenter/LockScreenSafetySource.java
+++ b/src/com/android/settings/safetycenter/LockScreenSafetySource.java
@@ -96,6 +96,10 @@
                 context,
                 new ScreenLockPreferenceDetailsUtils(context, SettingsEnums.SAFETY_CENTER),
                 new SafetyEvent.Builder(SAFETY_EVENT_TYPE_SOURCE_STATE_CHANGED).build());
+
+        // Also send refreshed safety center data for biometrics, since changing lockscreen settings
+        // can unset biometrics.
+        BiometricsSafetySource.onBiometricsChanged(context);
     }
 
     private static IconAction createGearMenuIconAction(Context context,
@@ -126,7 +130,7 @@
                 NO_SCREEN_LOCK_ISSUE_ID,
                 context.getString(R.string.no_screen_lock_issue_title),
                 context.getString(R.string.no_screen_lock_issue_summary),
-                SafetySourceStatus.STATUS_LEVEL_RECOMMENDATION,
+                SafetySourceIssue.SEVERITY_LEVEL_RECOMMENDATION,
                 NO_SCREEN_LOCK_ISSUE_TYPE_ID)
                 .setIssueCategory(SafetySourceIssue.ISSUE_CATEGORY_DEVICE)
                 .addAction(action).build();
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index 64a65a4..45829f4 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.users;
 
+import static com.android.settingslib.Utils.getColorAttrDefaultColor;
+
 import android.app.Activity;
 import android.app.ActivityManager;
 import android.app.Dialog;
@@ -31,7 +33,9 @@
 import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
+import android.graphics.BlendMode;
 import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
 import android.net.Uri;
 import android.os.AsyncTask;
 import android.os.Bundle;
@@ -46,6 +50,7 @@
 import android.text.TextUtils;
 import android.util.Log;
 import android.util.SparseArray;
+import android.view.Gravity;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
@@ -1123,7 +1128,8 @@
                 && WizardManagerHelper.isDeviceProvisioned(context)
                 && mUserCaps.mUserSwitcherEnabled) {
             mAddGuest.setVisible(true);
-            mAddGuest.setIcon(getEncircledDefaultIcon());
+            Drawable icon = context.getDrawable(R.drawable.ic_account_circle);
+            mAddGuest.setIcon(centerAndTint(icon));
             mAddGuest.setSelectable(true);
             if (mGuestUserAutoCreated && mGuestCreationScheduled.get()) {
                 mAddGuest.setTitle(com.android.settingslib.R.string.user_guest);
@@ -1140,11 +1146,15 @@
 
     private void updateAddUser(Context context) {
         updateAddUserCommon(context, mAddUser, mUserCaps.mCanAddRestrictedProfile);
+        Drawable icon = context.getDrawable(R.drawable.ic_account_circle_filled);
+        mAddUser.setIcon(centerAndTint(icon));
     }
 
     private void updateAddSupervisedUser(Context context) {
         if (!TextUtils.isEmpty(mConfigSupervisedUserCreationPackage)) {
             updateAddUserCommon(context, mAddSupervisedUser, false);
+            Drawable icon = context.getDrawable(R.drawable.ic_add_supervised_user);
+            mAddSupervisedUser.setIcon(centerAndTint(icon));
         } else {
             mAddSupervisedUser.setVisible(false);
         }
@@ -1162,6 +1172,7 @@
                             || (canAddRestrictedProfile
                             && mUserManager.canAddMoreUsers(UserManager.USER_TYPE_FULL_RESTRICTED));
             addUser.setEnabled(canAddMoreUsers && !mAddingUser && canSwitchUserNow());
+
             if (!canAddMoreUsers) {
                 addUser.setSummary(
                         getString(R.string.user_add_max_count, getRealUsersCount()));
@@ -1177,6 +1188,20 @@
         }
     }
 
+    private Drawable centerAndTint(Drawable icon) {
+        icon.setTintBlendMode(BlendMode.SRC_IN);
+        icon.setTint(getColorAttrDefaultColor(getContext(), android.R.attr.textColorPrimary));
+
+        Drawable bg = getContext().getDrawable(R.drawable.user_avatar_bg).mutate();
+        LayerDrawable ld = new LayerDrawable(new Drawable[] {bg, icon});
+        int size = getContext().getResources().getDimensionPixelSize(
+                R.dimen.multiple_users_avatar_size);
+        ld.setLayerSize(1, size, size);
+        ld.setLayerGravity(1, Gravity.CENTER);
+
+        return ld;
+    }
+
     /**
      * @return number of non-guest non-managed users
      */
diff --git a/src/com/android/settings/wifi/dpp/WifiDppBaseActivity.java b/src/com/android/settings/wifi/dpp/WifiDppBaseActivity.java
index f55960b..938d224 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppBaseActivity.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppBaseActivity.java
@@ -26,6 +26,8 @@
 import com.android.settings.SetupWizardUtils;
 import com.android.settings.core.InstrumentedActivity;
 
+import com.google.android.setupdesign.util.ThemeHelper;
+
 public abstract class WifiDppBaseActivity extends InstrumentedActivity {
     protected FragmentManager mFragmentManager;
 
@@ -35,6 +37,8 @@
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
+        applyTheme();
+
         setContentView(R.layout.wifi_dpp_activity);
         mFragmentManager = getSupportFragmentManager();
 
@@ -45,8 +49,18 @@
 
     @Override
     protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
-        final int new_resid = SetupWizardUtils.getTheme(this, getIntent());
-        theme.applyStyle(R.style.SetupWizardPartnerResource, /* force */ true);
-        super.onApplyThemeResource(theme, new_resid, first);
+        theme.applyStyle(R.style.SetupWizardPartnerResource, true);
+        super.onApplyThemeResource(theme, resid, first);
+    }
+
+    private void applyTheme() {
+        if (ThemeHelper.trySetDynamicColor(this)) {
+            final int appliedTheme = ThemeHelper.isSetupWizardDayNightEnabled(this)
+                    ? R.style.SudDynamicColorThemeSettings_SetupWizard_DayNight
+                    : R.style.SudDynamicColorThemeSettings_SetupWizard;
+            setTheme(appliedTheme);
+        } else {
+            setTheme(SetupWizardUtils.getTheme(this, getIntent()));
+        }
     }
 }
diff --git a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
index a926360..404cdd3 100644
--- a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
+++ b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
@@ -375,13 +375,20 @@
         super.onPause();
         if (mWifiP2pManager != null && mChannel != null) {
             mWifiP2pManager.stopPeerDiscovery(mChannel, null);
+        }
+        getActivity().unregisterReceiver(mReceiver);
+    }
+
+    @Override
+    public void onStop() {
+        super.onStop();
+        if (mWifiP2pManager != null && mChannel != null) {
             if (!mLastGroupFormed) {
                 // Close the channel when p2p doesn't connected.
                 mChannel.close();
                 mChannel = null;
             }
         }
-        getActivity().unregisterReceiver(mReceiver);
     }
 
     @Override
diff --git a/tests/robotests/src/com/android/settings/dashboard/ControllerFutureTaskTest.java b/tests/robotests/src/com/android/settings/dashboard/ControllerFutureTaskTest.java
deleted file mode 100644
index c66f2b5..0000000
--- a/tests/robotests/src/com/android/settings/dashboard/ControllerFutureTaskTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2019 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.dashboard;
-
-import static com.android.settingslib.core.instrumentation.Instrumentable.METRICS_CATEGORY_UNKNOWN;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.content.Context;
-
-import androidx.preference.PreferenceManager;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.core.BasePreferenceController;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-@RunWith(RobolectricTestRunner.class)
-public class ControllerFutureTaskTest {
-    private static final String KEY = "my_key";
-
-    private Context mContext;
-    private TestPreferenceController mTestController;
-    private PreferenceScreen mScreen;
-
-    @Before
-    public void setUp() {
-        mContext = RuntimeEnvironment.application;
-        mTestController = new TestPreferenceController(mContext, KEY);
-        final PreferenceManager preferenceManager = new PreferenceManager(mContext);
-        mScreen = preferenceManager.createPreferenceScreen(mContext);
-    }
-
-    @Test
-    public void getController_addTask_checkControllerKey() {
-        final ControllerFutureTask futureTask = new ControllerFutureTask(
-                new ControllerTask(mTestController, mScreen, null /* metricsFeature */,
-                        METRICS_CATEGORY_UNKNOWN), null /* result */);
-
-        assertThat(futureTask.getController().getPreferenceKey()).isEqualTo(KEY);
-    }
-
-
-    static class TestPreferenceController extends BasePreferenceController {
-        TestPreferenceController(Context context, String preferenceKey) {
-            super(context, preferenceKey);
-        }
-
-        @Override
-        public int getAvailabilityStatus() {
-            return AVAILABLE;
-        }
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/dashboard/ControllerTaskTest.java b/tests/robotests/src/com/android/settings/dashboard/ControllerTaskTest.java
deleted file mode 100644
index 17ab79c..0000000
--- a/tests/robotests/src/com/android/settings/dashboard/ControllerTaskTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2019 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.dashboard;
-
-import static com.android.settingslib.core.instrumentation.Instrumentable.METRICS_CATEGORY_UNKNOWN;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-
-import android.content.Context;
-
-import androidx.preference.Preference;
-import androidx.preference.PreferenceManager;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settingslib.core.AbstractPreferenceController;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-@RunWith(RobolectricTestRunner.class)
-public class ControllerTaskTest {
-    private static final String KEY = "my_key";
-
-    private Context mContext;
-    private PreferenceScreen mScreen;
-    private TestPreferenceController mTestController;
-    private ControllerTask mControllerTask;
-
-    @Before
-    public void setUp() {
-        mContext = RuntimeEnvironment.application;
-        final PreferenceManager preferenceManager = new PreferenceManager(mContext);
-        mScreen = preferenceManager.createPreferenceScreen(mContext);
-        mTestController = spy(new TestPreferenceController(mContext));
-        mControllerTask = new ControllerTask(mTestController, mScreen, null /* metricsFeature */,
-                METRICS_CATEGORY_UNKNOWN);
-    }
-
-    @Test
-    public void doRun_controlNotAvailable_noRunUpdateState() {
-        mTestController.setAvailable(false);
-
-        mControllerTask.run();
-
-        verify(mTestController, never()).updateState(any(Preference.class));
-    }
-
-    @Test
-    public void doRun_emptyKey_noRunUpdateState() {
-        mTestController.setKey("");
-
-        mControllerTask.run();
-
-        verify(mTestController, never()).updateState(any(Preference.class));
-    }
-
-    @Test
-    public void doRun_preferenceNotExist_noRunUpdateState() {
-        mTestController.setKey(KEY);
-
-        mControllerTask.run();
-
-        verify(mTestController, never()).updateState(any(Preference.class));
-    }
-
-    @Test
-    public void doRun_executeUpdateState() {
-        mTestController.setKey(KEY);
-        final Preference preference = new Preference(mContext);
-        preference.setKey(KEY);
-        mScreen.addPreference(preference);
-
-        mControllerTask.run();
-
-        verify(mTestController).updateState(any(Preference.class));
-    }
-
-    static class TestPreferenceController extends AbstractPreferenceController {
-        private boolean mAvailable;
-        private String mKey;
-
-        TestPreferenceController(Context context) {
-            super(context);
-            mAvailable = true;
-        }
-
-        @Override
-        public boolean isAvailable() {
-            return mAvailable;
-        }
-
-        @Override
-        public String getPreferenceKey() {
-            return mKey;
-        }
-
-        void setAvailable(boolean available) {
-            mAvailable = available;
-        }
-
-        void setKey(String key) {
-            mKey = key;
-        }
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
index aa5f980..894a6c5 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
@@ -390,7 +390,6 @@
         private final ContentResolver mContentResolver;
 
         public final PreferenceScreen mScreen;
-        private boolean mIsParalleled;
 
         public TestFragment(Context context) {
             mContext = context;
@@ -398,7 +397,6 @@
             mScreen = mock(PreferenceScreen.class);
             mContentResolver = mock(ContentResolver.class);
             mControllers = new ArrayList<>();
-            mIsParalleled = true;
 
             when(mPreferenceManager.getContext()).thenReturn(mContext);
             ReflectionHelpers.setField(
@@ -445,13 +443,6 @@
             return mContentResolver;
         }
 
-        protected boolean isParalleledControllers() {
-            return mIsParalleled;
-        }
-
-        void setUsingControllerEnhancement(boolean isParalleled) {
-            mIsParalleled = isParalleled;
-        }
     }
 
     private static class TestDynamicDataObserver extends DynamicDataObserver {
diff --git a/tests/robotests/src/com/android/settings/development/DefaultUsbConfigurationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/DefaultUsbConfigurationPreferenceControllerTest.java
index c9b13e27..a386473 100644
--- a/tests/robotests/src/com/android/settings/development/DefaultUsbConfigurationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/DefaultUsbConfigurationPreferenceControllerTest.java
@@ -32,7 +32,7 @@
 import androidx.preference.PreferenceScreen;
 
 import com.android.settingslib.RestrictedLockUtils;
-import com.android.settingslib.RestrictedSwitchPreference;
+import com.android.settingslib.RestrictedPreference;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -48,7 +48,7 @@
     private static final ComponentName TEST_COMPONENT_NAME = new ComponentName("test", "test");
 
     @Mock
-    private RestrictedSwitchPreference mPreference;
+    private RestrictedPreference mPreference;
     @Mock
     private PreferenceScreen mPreferenceScreen;
     @Mock
diff --git a/tests/robotests/src/com/android/settings/development/StylusHandwritingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/StylusHandwritingPreferenceControllerTest.java
new file mode 100644
index 0000000..12b5fe9
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/StylusHandwritingPreferenceControllerTest.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development;
+
+import static com.android.settings.development.StylusHandwritingPreferenceController.SETTING_VALUE_OFF;
+import static com.android.settings.development.StylusHandwritingPreferenceController.SETTING_VALUE_ON;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.provider.Settings;
+
+import androidx.preference.PreferenceScreen;
+import androidx.preference.SwitchPreference;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class StylusHandwritingPreferenceControllerTest {
+
+    @Mock
+    private SwitchPreference mPreference;
+    @Mock
+    private PreferenceScreen mPreferenceScreen;
+
+    private Context mContext;
+    private StylusHandwritingPreferenceController mController;
+
+    @Before
+    public void setup() {
+        MockitoAnnotations.initMocks(this);
+        mContext = RuntimeEnvironment.application;
+        mController = new StylusHandwritingPreferenceController(mContext);
+        when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
+            .thenReturn(mPreference);
+        mController.displayPreference(mPreferenceScreen);
+    }
+
+    @Test
+    public void onPreferenceChange_settingEnabled_stylusHandwritingShouldBeOn() {
+        mController.onPreferenceChange(mPreference, true /* new value */);
+
+        final int mode = Settings.Global.getInt(mContext.getContentResolver(),
+                Settings.Global.STYLUS_HANDWRITING_ENABLED, -1 /* default */);
+
+        assertThat(mode).isEqualTo(SETTING_VALUE_ON);
+    }
+
+    @Test
+    public void onPreferenceChange_settingEnabled_stylusHandwritingShouldBeOff() {
+        mController.onPreferenceChange(mPreference, false /* new value */);
+
+        final int mode = Settings.Global.getInt(mContext.getContentResolver(),
+                Settings.Global.STYLUS_HANDWRITING_ENABLED, -1 /* default */);
+
+        assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
+    }
+
+    @Test
+    public void updateState_settingDisabled_preferenceShouldNotBeChecked() {
+        Settings.Global.putInt(mContext.getContentResolver(),
+                Settings.Global.STYLUS_HANDWRITING_ENABLED, SETTING_VALUE_OFF);
+        mController.updateState(mPreference);
+
+        verify(mPreference).setChecked(false);
+    }
+
+    @Test
+    public void updateState_settingEnabled_preferenceShouldBeChecked() {
+        Settings.Global.putInt(mContext.getContentResolver(),
+                Settings.Global.STYLUS_HANDWRITING_ENABLED, SETTING_VALUE_ON);
+        mController.updateState(mPreference);
+
+        verify(mPreference).setChecked(true);
+    }
+
+    @Test
+    public void onDeveloperOptionsSwitchDisabled_shouldDisablePreference() {
+        mController.onDeveloperOptionsSwitchDisabled();
+
+        final int mode = Settings.Global.getInt(mContext.getContentResolver(),
+                Settings.Global.STYLUS_HANDWRITING_ENABLED, -1 /* default */);
+
+        assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
+        verify(mPreference).setChecked(false);
+        verify(mPreference).setEnabled(false);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batterysaver/BatterySaverButtonPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batterysaver/BatterySaverButtonPreferenceControllerTest.java
index f9ccff9..7398e5c 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/batterysaver/BatterySaverButtonPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/batterysaver/BatterySaverButtonPreferenceControllerTest.java
@@ -75,7 +75,7 @@
     public void updateState_lowPowerOn_preferenceIsChecked() {
         when(mPowerManager.isPowerSaveMode()).thenReturn(true);
 
-        mController.onSwitchChanged(null, mPowerManager.isPowerSaveMode());
+        mPreference.updateStatus(mPowerManager.isPowerSaveMode());
 
         assertThat(mPreference.isChecked()).isTrue();
     }
@@ -84,7 +84,7 @@
     public void testUpdateState_lowPowerOff_preferenceIsUnchecked() {
         when(mPowerManager.isPowerSaveMode()).thenReturn(false);
 
-        mController.onSwitchChanged(null, mPowerManager.isPowerSaveMode());
+        mPreference.updateStatus(mPowerManager.isPowerSaveMode());
 
         assertThat(mPreference.isChecked()).isFalse();
     }
diff --git a/tests/robotests/src/com/android/settings/wifi/p2p/WifiP2pSettingsTest.java b/tests/robotests/src/com/android/settings/wifi/p2p/WifiP2pSettingsTest.java
index 332cf14..448c109 100644
--- a/tests/robotests/src/com/android/settings/wifi/p2p/WifiP2pSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/p2p/WifiP2pSettingsTest.java
@@ -320,11 +320,17 @@
     }
 
     @Test
+    public void onStop_notLastGroupFormed_shouldCloseChannel() {
+        mFragment.onStop();
+
+        assertThat(mFragment.mChannel).isNull();
+    }
+
+    @Test
     public void peerDiscovery_whenOnPause_shouldStop() {
         mFragment.onPause();
 
         verify(mWifiP2pManager, times(1)).stopPeerDiscovery(any(), any());
-        assertThat(mFragment.mChannel).isNull();
     }
 
     @Test
@@ -332,7 +338,6 @@
         mFragment.onPause();
 
         verify(mWifiP2pManager, times(1)).stopPeerDiscovery(any(), any());
-        assertThat(mFragment.mChannel).isNull();
 
         mFragment.onResume();
         assertThat(mFragment.mChannel).isNotNull();
diff --git a/tests/unit/src/com/android/settings/biometrics/BiometricNavigationUtilsTest.java b/tests/unit/src/com/android/settings/biometrics/BiometricNavigationUtilsTest.java
index c767c32..395f88f 100644
--- a/tests/unit/src/com/android/settings/biometrics/BiometricNavigationUtilsTest.java
+++ b/tests/unit/src/com/android/settings/biometrics/BiometricNavigationUtilsTest.java
@@ -64,7 +64,7 @@
         mContext = spy(ApplicationProvider.getApplicationContext());
         when(mContext.getSystemService(UserManager.class)).thenReturn(mUserManager);
         doNothing().when(mContext).startActivity(any());
-        mBiometricNavigationUtils = new BiometricNavigationUtils();
+        mBiometricNavigationUtils = new BiometricNavigationUtils(UserHandle.myUserId());
     }
 
     @Test
diff --git a/tests/unit/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtilsTest.java b/tests/unit/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtilsTest.java
index 55b3fae..7d89079 100644
--- a/tests/unit/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtilsTest.java
+++ b/tests/unit/src/com/android/settings/biometrics/combination/CombinedBiometricStatusUtilsTest.java
@@ -56,7 +56,8 @@
 
     private static final ComponentName COMPONENT_NAME =
             new ComponentName("package", "class");
-    private static final UserHandle USER_HANDLE = new UserHandle(UserHandle.myUserId());
+    private static final int USER_ID = UserHandle.myUserId();
+    private static final UserHandle USER_HANDLE = new UserHandle(USER_ID);;
 
 
     @Mock
@@ -85,7 +86,8 @@
         when(mApplicationContext.getSystemService(Context.DEVICE_POLICY_SERVICE))
                 .thenReturn(mDevicePolicyManager);
         when(mApplicationContext.getSystemService(Context.FACE_SERVICE)).thenReturn(mFaceManager);
-        mCombinedBiometricStatusUtils = new CombinedBiometricStatusUtils(mApplicationContext);
+        mCombinedBiometricStatusUtils = new CombinedBiometricStatusUtils(
+                mApplicationContext, USER_ID);
     }
 
     @Test
diff --git a/tests/unit/src/com/android/settings/biometrics/face/FaceStatusUtilsTest.java b/tests/unit/src/com/android/settings/biometrics/face/FaceStatusUtilsTest.java
index f670fad..8697da7 100644
--- a/tests/unit/src/com/android/settings/biometrics/face/FaceStatusUtilsTest.java
+++ b/tests/unit/src/com/android/settings/biometrics/face/FaceStatusUtilsTest.java
@@ -49,7 +49,8 @@
 
     private static final ComponentName COMPONENT_NAME =
             new ComponentName("package", "class");
-    private static final UserHandle USER_HANDLE = new UserHandle(UserHandle.myUserId());
+    private static final int USER_ID = UserHandle.myUserId();
+    private static final UserHandle USER_HANDLE = new UserHandle(USER_ID);
 
 
     @Mock
@@ -78,7 +79,7 @@
         when(mApplicationContext.getSystemService(Context.DEVICE_POLICY_SERVICE))
                 .thenReturn(mDevicePolicyManager);
         when(mApplicationContext.getSystemService(Context.FACE_SERVICE)).thenReturn(mFaceManager);
-        mFaceStatusUtils = new FaceStatusUtils(mApplicationContext, mFaceManager);
+        mFaceStatusUtils = new FaceStatusUtils(mApplicationContext, mFaceManager, USER_ID);
     }
 
     @Test
diff --git a/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtilsTest.java b/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtilsTest.java
index b4abb5d..cbe4298 100644
--- a/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtilsTest.java
+++ b/tests/unit/src/com/android/settings/biometrics/fingerprint/FingerprintStatusUtilsTest.java
@@ -52,7 +52,8 @@
 
     private static final ComponentName COMPONENT_NAME =
             new ComponentName("package", "class");
-    private static final UserHandle USER_HANDLE = new UserHandle(UserHandle.myUserId());
+    private static final int USER_ID = UserHandle.myUserId();
+    private static final UserHandle USER_HANDLE = new UserHandle(USER_ID);
 
 
     @Mock
@@ -82,7 +83,7 @@
                 .thenReturn(mDevicePolicyManager);
         when(mApplicationContext.getSystemService(Context.FACE_SERVICE)).thenReturn(mFaceManager);
         mFingerprintStatusUtils =
-                new FingerprintStatusUtils(mApplicationContext, mFingerprintManager);
+                new FingerprintStatusUtils(mApplicationContext, mFingerprintManager, USER_ID);
     }
 
     @Test
diff --git a/tests/unit/src/com/android/settings/display/ScreenResolutionFragmentTest.java b/tests/unit/src/com/android/settings/display/ScreenResolutionFragmentTest.java
index 225a1d9..b7d37df 100644
--- a/tests/unit/src/com/android/settings/display/ScreenResolutionFragmentTest.java
+++ b/tests/unit/src/com/android/settings/display/ScreenResolutionFragmentTest.java
@@ -18,6 +18,7 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 
@@ -28,6 +29,8 @@
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 
+import com.android.settingslib.widget.SelectorWithWidgetPreference;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -87,4 +90,19 @@
 
         verify(mFragment).setDisplayMode(QHD_WIDTH);
     }
+
+    @Test
+    @UiThreadTest
+    public void bindPreferenceExtra_setSummary() {
+        mFragment.onAttach(mContext);
+        SelectorWithWidgetPreference preference = new SelectorWithWidgetPreference(mContext);
+        ScreenResolutionFragment.ScreenResolutionCandidateInfo candidates =
+                mock(ScreenResolutionFragment.ScreenResolutionCandidateInfo.class);
+        CharSequence summary = "test summary";
+        doReturn(summary).when(candidates).loadSummary();
+
+        mFragment.bindPreferenceExtra(preference, "com.example.test", candidates, null, null);
+
+        assertThat(preference.getSummary().toString().contentEquals(summary)).isTrue();
+    }
 }
diff --git a/tests/unit/src/com/android/settings/network/UiccSlotUtilTest.java b/tests/unit/src/com/android/settings/network/UiccSlotUtilTest.java
index 1a6879d..cc9bdfc 100644
--- a/tests/unit/src/com/android/settings/network/UiccSlotUtilTest.java
+++ b/tests/unit/src/com/android/settings/network/UiccSlotUtilTest.java
@@ -24,9 +24,11 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
+import android.telephony.SubscriptionInfo;
 import android.telephony.TelephonyManager;
 import android.telephony.UiccPortInfo;
 import android.telephony.UiccSlotInfo;
+import android.telephony.UiccSlotMapping;
 
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -39,8 +41,12 @@
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
 
 @RunWith(AndroidJUnit4.class)
 public class UiccSlotUtilTest {
@@ -48,6 +54,9 @@
     @Mock
     private TelephonyManager mTelephonyManager;
 
+    private static final int ESIM_PHYSICAL_SLOT = 0;
+    private static final int PSIM_PHYSICAL_SLOT = 1;
+
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
@@ -58,7 +67,7 @@
 
     @Test
     public void getSlotInfos_oneSimSlotDevice_returnTheCorrectSlotInfoList() {
-        when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(oneSimSlotDevice_ActivePsim());
+        when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(oneSimSlotDeviceActivePsim());
         ImmutableList<UiccSlotInfo> testUiccSlotInfos =
                 UiccSlotUtil.getSlotInfos(mTelephonyManager);
 
@@ -68,7 +77,7 @@
     @Test
     public void getSlotInfos_twoSimSlotsDevice_returnTheCorrectSlotInfoList() {
         when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
-                twoSimSlotsDevice_ActivePsimActiveEsim());
+                twoSimSlotsDeviceActivePsimActiveEsim());
         ImmutableList<UiccSlotInfo> testUiccSlotInfos =
                 UiccSlotUtil.getSlotInfos(mTelephonyManager);
 
@@ -78,7 +87,7 @@
     @Test
     public void getEsimSlotId_twoSimSlotsDeviceAndEsimIsSlot0_returnTheCorrectEsimSlot() {
         when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
-                twoSimSlotsDevice_ActiveEsimActivePsim());
+                twoSimSlotsDeviceActiveEsimActivePsim());
         int testSlot = UiccSlotUtil.getEsimSlotId(mContext);
 
         assertThat(testSlot).isEqualTo(0);
@@ -87,7 +96,7 @@
     @Test
     public void getEsimSlotId_twoSimSlotsDeviceAndEsimIsSlot1_returnTheCorrectEsimSlot() {
         when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
-                twoSimSlotsDevice_ActivePsimActiveEsim());
+                twoSimSlotsDeviceActivePsimActiveEsim());
         int testSlot = UiccSlotUtil.getEsimSlotId(mContext);
 
         assertThat(testSlot).isEqualTo(1);
@@ -96,12 +105,558 @@
     @Test
     public void getEsimSlotId_noEimSlotDevice_returnTheCorrectEsimSlot() {
         when(mTelephonyManager.getUiccSlotsInfo()).thenReturn(
-                oneSimSlotDevice_ActivePsim());
+                oneSimSlotDeviceActivePsim());
         int testSlot = UiccSlotUtil.getEsimSlotId(mContext);
 
         assertThat(testSlot).isEqualTo(-1);
     }
 
+    @Test
+    public void prepareUiccSlotMappings_fromPsimActiveToEsimPort0Active_esimPort0Active() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingSsModePsimActive();
+        Collection<UiccSlotMapping> verifyUiccSlotMappings =
+                createUiccSlotMappingSsModeEsimPort0Active();
+        int removedLogicalSlotIndex = 0;
+
+        Collection<UiccSlotMapping> testUiccSlotMappings = UiccSlotUtil.prepareUiccSlotMappings(
+                uiccSlotMappings, false, ESIM_PHYSICAL_SLOT, 0, removedLogicalSlotIndex);
+
+        compareTwoUiccSlotMappings(testUiccSlotMappings, verifyUiccSlotMappings);
+    }
+
+    @Test
+    public void prepareUiccSlotMappings_fromEsimPort0ActiveToPsimActive_psimActive() {
+        Collection<UiccSlotMapping> uiccSlotMappings =
+                createUiccSlotMappingSsModeEsimPort0Active();
+        Collection<UiccSlotMapping> verifyUiccSlotMappings =
+                createUiccSlotMappingSsModePsimActive();
+        int removedLogicalSlotIndex = 0;
+
+        Collection<UiccSlotMapping> testUiccSlotMappings = UiccSlotUtil.prepareUiccSlotMappings(
+                uiccSlotMappings, true, PSIM_PHYSICAL_SLOT, 0, removedLogicalSlotIndex);
+
+        compareTwoUiccSlotMappings(testUiccSlotMappings, verifyUiccSlotMappings);
+    }
+
+    @Test
+    public void prepareUiccSlotMappings_fromPsimAndPort0ToPsimAndPort1_psimAndPort1() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingPsimAndPort0();
+        Collection<UiccSlotMapping> verifyUiccSlotMappings =
+                createUiccSlotMappingPsimAndPort1();
+        int removedLogicalSlotIndex = 1;
+
+        Collection<UiccSlotMapping> testUiccSlotMappings = UiccSlotUtil.prepareUiccSlotMappings(
+                uiccSlotMappings, false, ESIM_PHYSICAL_SLOT, 1, removedLogicalSlotIndex);
+
+        compareTwoUiccSlotMappings(testUiccSlotMappings, verifyUiccSlotMappings);
+    }
+
+    @Test
+    public void prepareUiccSlotMappings_fromPsimAndPort1ToPsimAndPort0_psimAndPort0() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingPsimAndPort1();
+        Collection<UiccSlotMapping> verifyUiccSlotMappings =
+                createUiccSlotMappingPsimAndPort0();
+        int removedLogicalSlotIndex = 1;
+
+        Collection<UiccSlotMapping> testUiccSlotMappings = UiccSlotUtil.prepareUiccSlotMappings(
+                uiccSlotMappings, false, ESIM_PHYSICAL_SLOT, 0, removedLogicalSlotIndex);
+
+        compareTwoUiccSlotMappings(testUiccSlotMappings, verifyUiccSlotMappings);
+    }
+
+    @Test
+    public void prepareUiccSlotMappings_fromPsimAndPort0ToDualPortsB_dualPortsB() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingPsimAndPort0();
+        Collection<UiccSlotMapping> verifyUiccSlotMappings =
+                createUiccSlotMappingDualPortsB();
+        int removedLogicalSlotIndex = 0;
+
+        Collection<UiccSlotMapping> testUiccSlotMappings = UiccSlotUtil.prepareUiccSlotMappings(
+                uiccSlotMappings, false, ESIM_PHYSICAL_SLOT, 1, removedLogicalSlotIndex);
+
+        compareTwoUiccSlotMappings(testUiccSlotMappings, verifyUiccSlotMappings);
+    }
+
+    @Test
+    public void prepareUiccSlotMappings_fromPsimAndPort1ToDualPortsA_dualPortsA() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingPsimAndPort1();
+        Collection<UiccSlotMapping> verifyUiccSlotMappings =
+                createUiccSlotMappingDualPortsA();
+        int removedLogicalSlotIndex = 0;
+
+        Collection<UiccSlotMapping> testUiccSlotMappings = UiccSlotUtil.prepareUiccSlotMappings(
+                uiccSlotMappings, false, ESIM_PHYSICAL_SLOT, 0, removedLogicalSlotIndex);
+
+        compareTwoUiccSlotMappings(testUiccSlotMappings, verifyUiccSlotMappings);
+    }
+
+    @Test
+    public void prepareUiccSlotMappings_noPsimAndFromPsimAndPort0ToDualPortsB_dualPortsB() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingPsimAndPort0();
+        Collection<UiccSlotMapping> verifyUiccSlotMappings =
+                createUiccSlotMappingDualPortsB();
+        int removedLogicalSlotIndex = 0;
+
+        Collection<UiccSlotMapping> testUiccSlotMappings = UiccSlotUtil.prepareUiccSlotMappings(
+                uiccSlotMappings, false, ESIM_PHYSICAL_SLOT, 1, removedLogicalSlotIndex);
+
+        compareTwoUiccSlotMappings(testUiccSlotMappings, verifyUiccSlotMappings);
+    }
+
+    @Test
+    public void prepareUiccSlotMappings_noPsimAndFromPsimAndPort1ToDualPortsA_dualPortsA() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingPsimAndPort1();
+        Collection<UiccSlotMapping> verifyUiccSlotMappings =
+                createUiccSlotMappingDualPortsA();
+        int removedLogicalSlotIndex = 0;
+
+        Collection<UiccSlotMapping> testUiccSlotMappings = UiccSlotUtil.prepareUiccSlotMappings(
+                uiccSlotMappings, false, ESIM_PHYSICAL_SLOT, 0, removedLogicalSlotIndex);
+
+        compareTwoUiccSlotMappings(testUiccSlotMappings, verifyUiccSlotMappings);
+    }
+
+    @Test
+    public void prepareUiccSlotMappings_oneEsimAndFromDualPortsAToPsimAndPort1_psimAndPort1() {
+        // There is only one enabled esimPort1 before user enables the psim.
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingDualPortsA();
+        Collection<UiccSlotMapping> verifyUiccSlotMappings =
+                createUiccSlotMappingPsimAndPort1();
+        int removedLogicalSlotIndex = 0;
+
+        Collection<UiccSlotMapping> testUiccSlotMappings = UiccSlotUtil.prepareUiccSlotMappings(
+                uiccSlotMappings, true, PSIM_PHYSICAL_SLOT, 0, removedLogicalSlotIndex);
+
+        compareTwoUiccSlotMappings(testUiccSlotMappings, verifyUiccSlotMappings);
+    }
+
+    @Test
+    public void prepareUiccSlotMappings_oneEsimAndFromDualPortsAToPsimAndPort0_psimAndPort0() {
+        // There is only one enabled esimPort0 before user enables the psim.
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingDualPortsA();
+        Collection<UiccSlotMapping> verifyUiccSlotMappings =
+                createUiccSlotMappingPsimAndPort0();
+        int removedLogicalSlotIndex = 1;
+
+        Collection<UiccSlotMapping> testUiccSlotMappings = UiccSlotUtil.prepareUiccSlotMappings(
+                uiccSlotMappings, true, PSIM_PHYSICAL_SLOT, 0, removedLogicalSlotIndex);
+
+        compareTwoUiccSlotMappings(testUiccSlotMappings, verifyUiccSlotMappings);
+    }
+
+    @Test
+    public void prepareUiccSlotMappings_oneEsimAndFromDualPortsBToPsimAndPort1_psimAndPort1() {
+        // There is only one enabled esimPort1 before user enables the psim.
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingDualPortsB();
+        Collection<UiccSlotMapping> verifyUiccSlotMappings =
+                createUiccSlotMappingPsimAndPort1();
+        int removedLogicalSlotIndex = 1;
+
+        Collection<UiccSlotMapping> testUiccSlotMappings = UiccSlotUtil.prepareUiccSlotMappings(
+                uiccSlotMappings, true, PSIM_PHYSICAL_SLOT, 0, removedLogicalSlotIndex);
+
+        compareTwoUiccSlotMappings(testUiccSlotMappings, verifyUiccSlotMappings);
+    }
+
+    @Test
+    public void prepareUiccSlotMappings_oneEsimAndFromDualPortsBToPsimAndPort0_psimAndPort0() {
+        // There is only one enabled esimPort0 before user enables the psim.
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingDualPortsB();
+        Collection<UiccSlotMapping> verifyUiccSlotMappings =
+                createUiccSlotMappingPsimAndPort0();
+        int removedLogicalSlotIndex = 0;
+
+        Collection<UiccSlotMapping> testUiccSlotMappings = UiccSlotUtil.prepareUiccSlotMappings(
+                uiccSlotMappings, true, PSIM_PHYSICAL_SLOT, 0, removedLogicalSlotIndex);
+
+        compareTwoUiccSlotMappings(testUiccSlotMappings, verifyUiccSlotMappings);
+    }
+
+    @Test
+    public void prepareUiccSlotMappings_fromDualPortsAToPsimAndPort1_psimAndPort1() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingDualPortsA();
+        Collection<UiccSlotMapping> verifyUiccSlotMappings =
+                createUiccSlotMappingPsimAndPort1();
+        int removedLogicalSlotIndex = 0;
+
+        Collection<UiccSlotMapping> testUiccSlotMappings = UiccSlotUtil.prepareUiccSlotMappings(
+                uiccSlotMappings, true, PSIM_PHYSICAL_SLOT, 0, removedLogicalSlotIndex);
+
+        compareTwoUiccSlotMappings(testUiccSlotMappings, verifyUiccSlotMappings);
+    }
+
+    @Test
+    public void prepareUiccSlotMappings_fromDualPortsAToPsimAndPort0_psimAndPort0() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingDualPortsA();
+        Collection<UiccSlotMapping> verifyUiccSlotMappings =
+                createUiccSlotMappingPsimAndPort0();
+        int removedLogicalSlotIndex = 1;
+
+        Collection<UiccSlotMapping> testUiccSlotMappings = UiccSlotUtil.prepareUiccSlotMappings(
+                uiccSlotMappings, true, PSIM_PHYSICAL_SLOT, 0, removedLogicalSlotIndex);
+
+        compareTwoUiccSlotMappings(testUiccSlotMappings, verifyUiccSlotMappings);
+    }
+
+    @Test
+    public void prepareUiccSlotMappings_fromDualPortsBToPsimAndPort1_psimAndPort1() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingDualPortsB();
+        Collection<UiccSlotMapping> verifyUiccSlotMappings =
+                createUiccSlotMappingPsimAndPort1();
+        int removedLogicalSlotIndex = 1;
+
+        Collection<UiccSlotMapping> testUiccSlotMappings = UiccSlotUtil.prepareUiccSlotMappings(
+                uiccSlotMappings, true, PSIM_PHYSICAL_SLOT, 0, removedLogicalSlotIndex);
+
+        compareTwoUiccSlotMappings(testUiccSlotMappings, verifyUiccSlotMappings);
+    }
+
+    @Test
+    public void prepareUiccSlotMappings_fromDualPortsBToPsimAndPort0_psimAndPort0() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingDualPortsB();
+        Collection<UiccSlotMapping> verifyUiccSlotMappings =
+                createUiccSlotMappingPsimAndPort0();
+        int removedLogicalSlotIndex = 0;
+
+        Collection<UiccSlotMapping> testUiccSlotMappings = UiccSlotUtil.prepareUiccSlotMappings(
+                uiccSlotMappings, true, PSIM_PHYSICAL_SLOT, 0, removedLogicalSlotIndex);
+
+        compareTwoUiccSlotMappings(testUiccSlotMappings, verifyUiccSlotMappings);
+    }
+
+    @Test
+    public void getExcludedLogicalSlotIndex_fromPsimActiveToEsimPort0Active_logicalSlot0() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingSsModePsimActive();
+        Collection<SubscriptionInfo> activeSubscriptionInfoList =
+                createActiveSubscriptionInfoListOneSim(0, 0);
+        SubscriptionInfo removedSubInfo = null;
+        int verifyExcludedLogicalSlotIndex = 0;
+
+        int testExcludedLogicalSlotIndex = UiccSlotUtil.getExcludedLogicalSlotIndex(
+                uiccSlotMappings, activeSubscriptionInfoList, removedSubInfo, false);
+
+        assertThat(testExcludedLogicalSlotIndex).isEqualTo(verifyExcludedLogicalSlotIndex);
+    }
+
+    @Test
+    public void getExcludedLogicalSlotIndex_fromEsimPort0ActiveToPsimActive_logicalSlot0() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingSsModeEsimPort0Active();
+        Collection<SubscriptionInfo> activeSubscriptionInfoList =
+                createActiveSubscriptionInfoListOneSim(0, 0);
+        SubscriptionInfo removedSubInfo = null;
+        int verifyExcludedLogicalSlotIndex = 0;
+
+        int testExcludedLogicalSlotIndex = UiccSlotUtil.getExcludedLogicalSlotIndex(
+                uiccSlotMappings, activeSubscriptionInfoList, removedSubInfo, false);
+
+        assertThat(testExcludedLogicalSlotIndex).isEqualTo(verifyExcludedLogicalSlotIndex);
+    }
+
+    @Test
+    public void getExcludedLogicalSlotIndex_fromPsimAndPort0ToPsimAndPort1_logicalSlot1() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingPsimAndPort0();
+        Collection<SubscriptionInfo> activeSubscriptionInfoList =
+                createActiveSubscriptionInfoListTwoSims(0, 0, 1, 0);
+        SubscriptionInfo removedSubInfo = createSubscriptionInfo(1, 0);
+        int verifyExcludedLogicalSlotIndex = 1;
+
+        int testExcludedLogicalSlotIndex = UiccSlotUtil.getExcludedLogicalSlotIndex(
+                uiccSlotMappings, activeSubscriptionInfoList, removedSubInfo, true);
+
+        assertThat(testExcludedLogicalSlotIndex).isEqualTo(verifyExcludedLogicalSlotIndex);
+    }
+
+    @Test
+    public void getExcludedLogicalSlotIndex_fromPsimAndPort1ToPsimAndPort0_logicalSlot1() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingPsimAndPort1();
+        Collection<SubscriptionInfo> activeSubscriptionInfoList =
+                createActiveSubscriptionInfoListTwoSims(0, 0, 1, 1);
+        SubscriptionInfo removedSubInfo = createSubscriptionInfo(1, 1);
+        int verifyExcludedLogicalSlotIndex = 1;
+
+        int testExcludedLogicalSlotIndex = UiccSlotUtil.getExcludedLogicalSlotIndex(
+                uiccSlotMappings, activeSubscriptionInfoList, removedSubInfo, true);
+
+        assertThat(testExcludedLogicalSlotIndex).isEqualTo(verifyExcludedLogicalSlotIndex);
+    }
+
+    @Test
+    public void getExcludedLogicalSlotIndex_fromPsimAndPort0ToDualPortsB_logicalSlot0() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingPsimAndPort0();
+        Collection<SubscriptionInfo> activeSubscriptionInfoList =
+                createActiveSubscriptionInfoListTwoSims(0, 0, 1, 0);
+        SubscriptionInfo removedSubInfo = createSubscriptionInfo(0, 0);
+        int verifyExcludedLogicalSlotIndex = 0;
+
+        int testExcludedLogicalSlotIndex = UiccSlotUtil.getExcludedLogicalSlotIndex(
+                uiccSlotMappings, activeSubscriptionInfoList, removedSubInfo, true);
+
+        assertThat(testExcludedLogicalSlotIndex).isEqualTo(verifyExcludedLogicalSlotIndex);
+    }
+
+    @Test
+    public void getExcludedLogicalSlotIndex_fromPsimAndPort1ToDualPortsA_logicalSlot0() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingPsimAndPort1();
+        Collection<SubscriptionInfo> activeSubscriptionInfoList =
+                createActiveSubscriptionInfoListTwoSims(0, 0, 1, 1);
+        SubscriptionInfo removedSubInfo = createSubscriptionInfo(0, 0);
+        int verifyExcludedLogicalSlotIndex = 0;
+
+        int testExcludedLogicalSlotIndex = UiccSlotUtil.getExcludedLogicalSlotIndex(
+                uiccSlotMappings, activeSubscriptionInfoList, removedSubInfo, true);
+
+        assertThat(testExcludedLogicalSlotIndex).isEqualTo(verifyExcludedLogicalSlotIndex);
+    }
+
+    @Test
+    public void getExcludedLogicalSlotIndex_noPsimAndFromPsimAndPort0ToDualPortsB_logicalSlot0() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingPsimAndPort0();
+        Collection<SubscriptionInfo> activeSubscriptionInfoList =
+                createActiveSubscriptionInfoListOneSim(1, 0);
+        SubscriptionInfo removedSubInfo = null;
+        int verifyExcludedLogicalSlotIndex = 0;
+
+        int testExcludedLogicalSlotIndex = UiccSlotUtil.getExcludedLogicalSlotIndex(
+                uiccSlotMappings, activeSubscriptionInfoList, removedSubInfo, true);
+
+        assertThat(testExcludedLogicalSlotIndex).isEqualTo(verifyExcludedLogicalSlotIndex);
+    }
+
+    @Test
+    public void getExcludedLogicalSlotIndex_noPsimAndFromPsimAndPort1ToDualPortsA_logicalSlot0() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingPsimAndPort1();
+        Collection<SubscriptionInfo> activeSubscriptionInfoList =
+                createActiveSubscriptionInfoListOneSim(1, 1);
+        SubscriptionInfo removedSubInfo = null;
+        int verifyExcludedLogicalSlotIndex = 0;
+
+        int testExcludedLogicalSlotIndex = UiccSlotUtil.getExcludedLogicalSlotIndex(
+                uiccSlotMappings, activeSubscriptionInfoList, removedSubInfo, true);
+
+        assertThat(testExcludedLogicalSlotIndex).isEqualTo(verifyExcludedLogicalSlotIndex);
+    }
+
+    @Test
+    public void getExcludedLogicalSlotIndex_oneEsimAndFromDualPortsAToPsimAndPort1_logicalSlot0() {
+        // There is only one enabled esimPort1 before user enables the psim.
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingDualPortsA();
+        Collection<SubscriptionInfo> activeSubscriptionInfoList =
+                createActiveSubscriptionInfoListOneSim(1, 1);
+        SubscriptionInfo removedSubInfo = null;
+        int verifyExcludedLogicalSlotIndex = 0;
+
+        int testExcludedLogicalSlotIndex = UiccSlotUtil.getExcludedLogicalSlotIndex(
+                uiccSlotMappings, activeSubscriptionInfoList, removedSubInfo, true);
+
+        assertThat(testExcludedLogicalSlotIndex).isEqualTo(verifyExcludedLogicalSlotIndex);
+    }
+
+    @Test
+    public void getExcludedLogicalSlotIndex_oneEsimAndFromDualPortsAToPsimAndPort0_logicalSlot1() {
+        // There is only one enabled esimPort0 before user enables the psim.
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingPsimAndPort1();
+        Collection<SubscriptionInfo> activeSubscriptionInfoList =
+                createActiveSubscriptionInfoListOneSim(0, 0);
+        SubscriptionInfo removedSubInfo = null;
+        int verifyExcludedLogicalSlotIndex = 1;
+
+        int testExcludedLogicalSlotIndex = UiccSlotUtil.getExcludedLogicalSlotIndex(
+                uiccSlotMappings, activeSubscriptionInfoList, removedSubInfo, true);
+
+        assertThat(testExcludedLogicalSlotIndex).isEqualTo(verifyExcludedLogicalSlotIndex);
+    }
+
+    @Test
+    public void getExcludedLogicalSlotIndex_oneEsimAndFromDualPortsBToPsimAndPort1_logicalSlot1() {
+        // There is only one enabled esimPort1 before user enables the psim.
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingPsimAndPort1();
+        Collection<SubscriptionInfo> activeSubscriptionInfoList =
+                createActiveSubscriptionInfoListOneSim(0, 1);
+        SubscriptionInfo removedSubInfo = null;
+        int verifyExcludedLogicalSlotIndex = 1;
+
+        int testExcludedLogicalSlotIndex = UiccSlotUtil.getExcludedLogicalSlotIndex(
+                uiccSlotMappings, activeSubscriptionInfoList, removedSubInfo, true);
+
+        assertThat(testExcludedLogicalSlotIndex).isEqualTo(verifyExcludedLogicalSlotIndex);
+    }
+
+    @Test
+    public void getExcludedLogicalSlotIndex_oneEsimAndFromDualPortsBToPsimAndPort0_logicalSlot0() {
+        // There is only one enabled esimPort0 before user enables the psim.
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingPsimAndPort1();
+        Collection<SubscriptionInfo> activeSubscriptionInfoList =
+                createActiveSubscriptionInfoListOneSim(1, 0);
+        SubscriptionInfo removedSubInfo = null;
+        int verifyExcludedLogicalSlotIndex = 0;
+
+        int testExcludedLogicalSlotIndex = UiccSlotUtil.getExcludedLogicalSlotIndex(
+                uiccSlotMappings, activeSubscriptionInfoList, removedSubInfo, true);
+
+        assertThat(testExcludedLogicalSlotIndex).isEqualTo(verifyExcludedLogicalSlotIndex);
+    }
+
+    @Test
+    public void getExcludedLogicalSlotIndex_fromDualPortsAToPsimAndPort1_logicalSlot0() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingDualPortsA();
+        Collection<SubscriptionInfo> activeSubscriptionInfoList =
+                createActiveSubscriptionInfoListTwoSims(0, 0, 1, 1);
+        SubscriptionInfo removedSubInfo = createSubscriptionInfo(0, 0);
+        int verifyExcludedLogicalSlotIndex = 0;
+
+        int testExcludedLogicalSlotIndex = UiccSlotUtil.getExcludedLogicalSlotIndex(
+                uiccSlotMappings, activeSubscriptionInfoList, removedSubInfo, true);
+
+        assertThat(testExcludedLogicalSlotIndex).isEqualTo(verifyExcludedLogicalSlotIndex);
+    }
+
+    @Test
+    public void getExcludedLogicalSlotIndex_fromDualPortsAToPsimAndPort0_logicalSlot1() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingDualPortsA();
+        Collection<SubscriptionInfo> activeSubscriptionInfoList =
+                createActiveSubscriptionInfoListTwoSims(0, 0, 1, 1);
+        SubscriptionInfo removedSubInfo = createSubscriptionInfo(1, 1);
+        int verifyExcludedLogicalSlotIndex = 1;
+
+        int testExcludedLogicalSlotIndex = UiccSlotUtil.getExcludedLogicalSlotIndex(
+                uiccSlotMappings, activeSubscriptionInfoList, removedSubInfo, true);
+
+        assertThat(testExcludedLogicalSlotIndex).isEqualTo(verifyExcludedLogicalSlotIndex);
+    }
+
+    @Test
+    public void getExcludedLogicalSlotIndex_fromDualPortsBToPsimAndPort1_logicalSlot1() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingDualPortsB();
+        Collection<SubscriptionInfo> activeSubscriptionInfoList =
+                createActiveSubscriptionInfoListTwoSims(0, 1, 1, 0);
+        SubscriptionInfo removedSubInfo = createSubscriptionInfo(1, 0);
+        int verifyExcludedLogicalSlotIndex = 1;
+
+        int testExcludedLogicalSlotIndex = UiccSlotUtil.getExcludedLogicalSlotIndex(
+                uiccSlotMappings, activeSubscriptionInfoList, removedSubInfo, true);
+
+        assertThat(testExcludedLogicalSlotIndex).isEqualTo(verifyExcludedLogicalSlotIndex);
+    }
+
+    @Test
+    public void getExcludedLogicalSlotIndex_fromDualPortsBToPsimAndPort0_logicalSlot0() {
+        Collection<UiccSlotMapping> uiccSlotMappings = createUiccSlotMappingDualPortsB();
+        Collection<SubscriptionInfo> activeSubscriptionInfoList =
+                createActiveSubscriptionInfoListTwoSims(0, 1, 1, 0);
+        SubscriptionInfo removedSubInfo = createSubscriptionInfo(0, 1);
+        int verifyExcludedLogicalSlotIndex = 0;
+
+        int testExcludedLogicalSlotIndex = UiccSlotUtil.getExcludedLogicalSlotIndex(
+                uiccSlotMappings, activeSubscriptionInfoList, removedSubInfo, true);
+
+        assertThat(testExcludedLogicalSlotIndex).isEqualTo(verifyExcludedLogicalSlotIndex);
+    }
+
+    private void compareTwoUiccSlotMappings(Collection<UiccSlotMapping> testUiccSlotMappings,
+            Collection<UiccSlotMapping> verifyUiccSlotMappings) {
+        assertThat(testUiccSlotMappings.size()).isEqualTo(verifyUiccSlotMappings.size());
+        Iterator<UiccSlotMapping> testIterator = testUiccSlotMappings.iterator();
+        Iterator<UiccSlotMapping> verifyIterator = verifyUiccSlotMappings.iterator();
+        while (testIterator.hasNext()) {
+            UiccSlotMapping testUiccSlotMapping = testIterator.next();
+            UiccSlotMapping verifyUiccSlotMapping = verifyIterator.next();
+            assertThat(testUiccSlotMapping.getLogicalSlotIndex()).isEqualTo(
+                    verifyUiccSlotMapping.getLogicalSlotIndex());
+            assertThat(testUiccSlotMapping.getPortIndex()).isEqualTo(
+                    verifyUiccSlotMapping.getPortIndex());
+            assertThat(testUiccSlotMapping.getPhysicalSlotIndex()).isEqualTo(
+                    verifyUiccSlotMapping.getPhysicalSlotIndex());
+        }
+    }
+
+    private SubscriptionInfo createSubscriptionInfo(int logicalSlotIndex, int portIndex) {
+        return new SubscriptionInfo(
+                0, "", logicalSlotIndex, "", "", 0, 0, "", 0, null, "", "", "",
+                true /* isEmbedded */,
+                null, "", 25,
+                false, null, false, 0, 0, 0, null, null, true, portIndex);
+    }
+
+    private List<SubscriptionInfo> createActiveSubscriptionInfoListOneSim(int logicalSlotIndex,
+            int portIndex) {
+        List<SubscriptionInfo> subscriptionInfoList = new ArrayList<>();
+        subscriptionInfoList.add(createSubscriptionInfo(logicalSlotIndex, portIndex));
+
+        return subscriptionInfoList;
+    }
+
+    private List<SubscriptionInfo> createActiveSubscriptionInfoListTwoSims(int logicalSlotIndex1,
+            int portIndex1, int logicalSlotIndex2, int portIndex2) {
+        List<SubscriptionInfo> subscriptionInfoList = new ArrayList<>();
+        subscriptionInfoList.add(createSubscriptionInfo(logicalSlotIndex1, portIndex1));
+        subscriptionInfoList.add(createSubscriptionInfo(logicalSlotIndex2, portIndex2));
+        return subscriptionInfoList;
+    }
+
+    // Device |                                        |Slot   |
+    // Working|                                        |Mapping|
+    // State  |Type                                    |Mode   |Friendly name
+    //--------------------------------------------------------------------------
+    // Single |SIM pSIM [RIL 0]                        |1      |pSIM active
+    // Single |SIM MEP Port #0 [RIL0]                  |2      |eSIM Port0 active
+    // Single |SIM MEP Port #1 [RIL0]                  |2.1    |eSIM Port1 active
+    // DSDS   |pSIM [RIL 0] + MEP Port #0 [RIL 1]      |3      |pSIM+Port0
+    // DSDS   |pSIM [RIL 0] + MEP Port #1 [RIL 1]      |3.1    |pSIM+Port1
+    // DSDS   |MEP Port #0 [RIL 0] + MEP Port #1 [RIL1]|3.2    |Dual-Ports-A
+    // DSDS   |MEP Port #1 [RIL 0] + MEP Port #0 [RIL1]|4      |Dual-Ports-B
+    private List<UiccSlotMapping> createUiccSlotMappingSsModePsimActive() {
+        List<UiccSlotMapping> slotMap = new ArrayList<>();
+        slotMap.add(new UiccSlotMapping(0, PSIM_PHYSICAL_SLOT, 0));
+
+        return slotMap;
+    }
+
+    private List<UiccSlotMapping> createUiccSlotMappingSsModeEsimPort0Active() {
+        List<UiccSlotMapping> slotMap = new ArrayList<>();
+        slotMap.add(new UiccSlotMapping(0, ESIM_PHYSICAL_SLOT, 0));
+
+        return slotMap;
+    }
+
+    private List<UiccSlotMapping> createUiccSlotMappingSsModeEsimPort1Active() {
+        List<UiccSlotMapping> slotMap = new ArrayList<>();
+        slotMap.add(new UiccSlotMapping(1, ESIM_PHYSICAL_SLOT, 0));
+
+        return slotMap;
+    }
+
+    private List<UiccSlotMapping> createUiccSlotMappingPsimAndPort0() {
+        List<UiccSlotMapping> slotMap = new ArrayList<>();
+        slotMap.add(new UiccSlotMapping(0, PSIM_PHYSICAL_SLOT, 0));
+        slotMap.add(new UiccSlotMapping(0, ESIM_PHYSICAL_SLOT, 1));
+
+        return slotMap;
+    }
+
+    private List<UiccSlotMapping> createUiccSlotMappingPsimAndPort1() {
+        List<UiccSlotMapping> slotMap = new ArrayList<>();
+        slotMap.add(new UiccSlotMapping(0, PSIM_PHYSICAL_SLOT, 0));
+        slotMap.add(new UiccSlotMapping(1, ESIM_PHYSICAL_SLOT, 1));
+
+        return slotMap;
+    }
+
+    private List<UiccSlotMapping> createUiccSlotMappingDualPortsA() {
+        List<UiccSlotMapping> slotMap = new ArrayList<>();
+        slotMap.add(new UiccSlotMapping(0, ESIM_PHYSICAL_SLOT, 0));
+        slotMap.add(new UiccSlotMapping(1, ESIM_PHYSICAL_SLOT, 1));
+
+        return slotMap;
+    }
+
+    private List<UiccSlotMapping> createUiccSlotMappingDualPortsB() {
+        List<UiccSlotMapping> slotMap = new ArrayList<>();
+        slotMap.add(new UiccSlotMapping(1, ESIM_PHYSICAL_SLOT, 0));
+        slotMap.add(new UiccSlotMapping(0, ESIM_PHYSICAL_SLOT, 1));
+
+        return slotMap;
+    }
+
     /**
      * The "oneSimSlotDevice" has below cases
      * 1) The device is one psim slot and no esim slot
@@ -112,27 +667,27 @@
      * 2) The device is two psim slots
      */
 
-    private UiccSlotInfo[] oneSimSlotDevice_ActivePsim() {
+    private UiccSlotInfo[] oneSimSlotDeviceActivePsim() {
         return new UiccSlotInfo[]{createUiccSlotInfo(false, true, 0, true)};
     }
 
-    private UiccSlotInfo[] oneSimSlotDevice_ActiveEsim() {
+    private UiccSlotInfo[] oneSimSlotDeviceActiveEsim() {
         return new UiccSlotInfo[]{createUiccSlotInfo(true, false, 1, true)};
     }
 
-    private UiccSlotInfo[] twoSimSlotsDevice_ActivePsimActiveEsim() {
+    private UiccSlotInfo[] twoSimSlotsDeviceActivePsimActiveEsim() {
         return new UiccSlotInfo[]{
                 createUiccSlotInfo(false, true, 0, true),
                 createUiccSlotInfo(true, false, 1, true)};
     }
 
-    private UiccSlotInfo[] twoSimSlotsDevice_ActiveEsimActivePsim() {
+    private UiccSlotInfo[] twoSimSlotsDeviceActiveEsimActivePsim() {
         return new UiccSlotInfo[]{
                 createUiccSlotInfo(true, false, 0, true),
                 createUiccSlotInfo(false, true, 1, true)};
     }
 
-    private UiccSlotInfo[] twoSimSlotsDevice_twoActiveEsims() {
+    private UiccSlotInfo[] twoSimSlotsDeviceTwoActiveEsims() {
         // device supports MEP, so device can enable two esims.
         // If device has psim slot, the UiccSlotInfo of psim always be in UiccSlotInfo[].
         return new UiccSlotInfo[]{
@@ -140,19 +695,19 @@
                 createUiccSlotInfoForEsimMep(0, true, 1, true)};
     }
 
-    private UiccSlotInfo[] twoSimSlotsDevice_ActivePsimInactiveEsim() {
+    private UiccSlotInfo[] twoSimSlotsDeviceActivePsimInactiveEsim() {
         return new UiccSlotInfo[]{
                 createUiccSlotInfo(false, true, 0, true),
                 createUiccSlotInfo(true, false, -1, false)};
     }
 
-    private UiccSlotInfo[] twoSimSlotsDevice_InactivePsimActiveEsim() {
+    private UiccSlotInfo[] twoSimSlotsDeviceInactivePsimActiveEsim() {
         return new UiccSlotInfo[]{
                 createUiccSlotInfo(false, true, 0, false),
                 createUiccSlotInfo(true, false, 1, true)};
     }
 
-    private UiccSlotInfo[] twoSimSlotsDevice_NoInsertPsimActiveEsim() {
+    private UiccSlotInfo[] twoSimSlotsDeviceNoInsertPsimActiveEsim() {
         return new UiccSlotInfo[]{
                 createUiccSlotInfo(false, true, -1, false),
                 createUiccSlotInfo(true, false, 1, true)};
diff --git a/tests/unit/src/com/android/settings/safetycenter/LockScreenSafetySourceTest.java b/tests/unit/src/com/android/settings/safetycenter/LockScreenSafetySourceTest.java
index db2702d..ea36b6b 100644
--- a/tests/unit/src/com/android/settings/safetycenter/LockScreenSafetySourceTest.java
+++ b/tests/unit/src/com/android/settings/safetycenter/LockScreenSafetySourceTest.java
@@ -22,6 +22,7 @@
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -117,12 +118,9 @@
 
         LockScreenSafetySource.setSafetySourceData(mApplicationContext,
                 mScreenLockPreferenceDetailsUtils, EVENT_SOURCE_STATE_CHANGED);
-        ArgumentCaptor<String> idCaptor = ArgumentCaptor.forClass(String.class);
-        verify(mSafetyCenterManagerWrapper).setSafetySourceData(
-                any(), idCaptor.capture(), any(), any());
-        String safetySourceId = idCaptor.getValue();
 
-        assertThat(safetySourceId).isEqualTo(LockScreenSafetySource.SAFETY_SOURCE_ID);
+        verify(mSafetyCenterManagerWrapper).setSafetySourceData(
+                any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), any(), any());
     }
 
     @Test
@@ -132,12 +130,9 @@
 
         LockScreenSafetySource.setSafetySourceData(mApplicationContext,
                 mScreenLockPreferenceDetailsUtils, EVENT_SOURCE_STATE_CHANGED);
-        ArgumentCaptor<SafetyEvent> eventCaptor = ArgumentCaptor.forClass(SafetyEvent.class);
-        verify(mSafetyCenterManagerWrapper).setSafetySourceData(
-                any(), any(), any(), eventCaptor.capture());
-        SafetyEvent safetyEvent = eventCaptor.getValue();
 
-        assertThat(safetyEvent).isEqualTo(EVENT_SOURCE_STATE_CHANGED);
+        verify(mSafetyCenterManagerWrapper).setSafetySourceData(
+                any(), any(), any(), eq(EVENT_SOURCE_STATE_CHANGED));
     }
 
     @Test
@@ -176,7 +171,7 @@
 
         ArgumentCaptor<SafetySourceData> captor = ArgumentCaptor.forClass(SafetySourceData.class);
         verify(mSafetyCenterManagerWrapper).setSafetySourceData(
-                any(), any(), captor.capture(), any());
+                any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
         SafetySourceData safetySourceData = captor.getValue();
         SafetySourceStatus safetySourceStatus = safetySourceData.getStatus();
 
@@ -195,7 +190,7 @@
 
         ArgumentCaptor<SafetySourceData> captor = ArgumentCaptor.forClass(SafetySourceData.class);
         verify(mSafetyCenterManagerWrapper).setSafetySourceData(
-                any(), any(), captor.capture(), any());
+                any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
         SafetySourceData safetySourceData = captor.getValue();
         SafetySourceStatus safetySourceStatus = safetySourceData.getStatus();
 
@@ -221,7 +216,7 @@
     }
 
     @Test
-    public void setSafetySourceData_whenLockPatternIsNotSecure_setIssue() {
+    public void setSafetySourceData_whenLockPatternIsNotSecure_setsIssue() {
         whenScreenLockIsEnabled();
         when(mSafetyCenterManagerWrapper.isEnabled(mApplicationContext)).thenReturn(true);
         when(mScreenLockPreferenceDetailsUtils.isLockPatternSecure()).thenReturn(false);
@@ -231,7 +226,7 @@
 
         ArgumentCaptor<SafetySourceData> captor = ArgumentCaptor.forClass(SafetySourceData.class);
         verify(mSafetyCenterManagerWrapper).setSafetySourceData(
-                any(), any(), captor.capture(), any());
+                any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
         SafetySourceData safetySourceData = captor.getValue();
 
         assertThat(safetySourceData.getIssues()).hasSize(1);
@@ -244,7 +239,7 @@
                 ResourcesUtils.getResourcesString(mApplicationContext,
                         "no_screen_lock_issue_summary"));
         assertThat(issue.getSeverityLevel()).isEqualTo(
-                SafetySourceStatus.STATUS_LEVEL_RECOMMENDATION);
+                SafetySourceIssue.SEVERITY_LEVEL_RECOMMENDATION);
         assertThat(issue.getIssueTypeId()).isEqualTo(
                 LockScreenSafetySource.NO_SCREEN_LOCK_ISSUE_TYPE_ID);
         assertThat(issue.getIssueCategory()).isEqualTo(SafetySourceIssue.ISSUE_CATEGORY_DEVICE);
@@ -270,7 +265,7 @@
 
         ArgumentCaptor<SafetySourceData> captor = ArgumentCaptor.forClass(SafetySourceData.class);
         verify(mSafetyCenterManagerWrapper).setSafetySourceData(
-                any(), any(), captor.capture(), any());
+                any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
         SafetySourceData safetySourceData = captor.getValue();
         SafetySourceStatus safetySourceStatus = safetySourceData.getStatus();
 
@@ -289,7 +284,7 @@
 
         ArgumentCaptor<SafetySourceData> captor = ArgumentCaptor.forClass(SafetySourceData.class);
         verify(mSafetyCenterManagerWrapper).setSafetySourceData(
-                any(), any(), captor.capture(), any());
+                any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
         SafetySourceData safetySourceData = captor.getValue();
         SafetySourceStatus safetySourceStatus = safetySourceData.getStatus();
 
@@ -311,7 +306,7 @@
         final ArgumentCaptor<SafetySourceData> captor = ArgumentCaptor.forClass(
                 SafetySourceData.class);
         verify(mSafetyCenterManagerWrapper).setSafetySourceData(
-                any(), any(), captor.capture(), any());
+                any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
         final IconAction iconAction = captor.getValue().getStatus().getIconAction();
 
         assertThat(iconAction.getIconType()).isEqualTo(IconAction.ICON_TYPE_GEAR);
@@ -330,7 +325,7 @@
 
         ArgumentCaptor<SafetySourceData> captor = ArgumentCaptor.forClass(SafetySourceData.class);
         verify(mSafetyCenterManagerWrapper).setSafetySourceData(
-                any(), any(), captor.capture(), any());
+                any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), captor.capture(), any());
         SafetySourceData safetySourceData = captor.getValue();
         SafetySourceStatus safetySourceStatus = safetySourceData.getStatus();
 
@@ -338,13 +333,16 @@
     }
 
     @Test
-    public void onLockScreenChange_whenSafetyCenterEnabled_setData() {
+    public void onLockScreenChange_whenSafetyCenterEnabled_setsLockscreenAndBiometricData() {
         whenScreenLockIsEnabled();
         when(mSafetyCenterManagerWrapper.isEnabled(mApplicationContext)).thenReturn(true);
 
         LockScreenSafetySource.onLockScreenChange(mApplicationContext);
 
-        verify(mSafetyCenterManagerWrapper).setSafetySourceData(any(), any(), any(), any());
+        verify(mSafetyCenterManagerWrapper).setSafetySourceData(
+                any(), eq(LockScreenSafetySource.SAFETY_SOURCE_ID), any(), any());
+        verify(mSafetyCenterManagerWrapper).setSafetySourceData(
+                any(), eq(BiometricsSafetySource.SAFETY_SOURCE_ID), any(), any());
     }
 
     @Test