Merge "Fix test cases failed in WinscopeTraceTest" into udc-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 1f03afb..6fe6832 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -4875,7 +4875,7 @@
             android:excludeFromRecents="true"
             android:resizeableActivity="false"
             android:theme="@android:style/Theme.NoDisplay"
-            android:label="@string/note_task_button_label"
+            android:label="@string/note_task_shortcut_label"
             android:icon="@drawable/ic_note_task_shortcut_widget">
 
             <intent-filter>
diff --git a/res/drawable/ic_note_task_shortcut_widget.xml b/res/drawable/ic_note_task_shortcut_widget.xml
index e37c22a..ce1f51a 100644
--- a/res/drawable/ic_note_task_shortcut_widget.xml
+++ b/res/drawable/ic_note_task_shortcut_widget.xml
@@ -14,18 +14,20 @@
   ~ limitations under the License.
   -->
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
-    android:viewportHeight="24"
-    android:viewportWidth="24">
-    <path
-        android:fillAlpha="1"
-        android:fillColor="#636C6F"
-        android:fillType="nonZero"
-        android:pathData="M17.6258,4.96L19.0358,6.37L7.4058,18.01L5.9958,16.6L17.6258,4.96ZM16.1358,3.62L4.1258,15.63L3.0158,19.83C2.9058,20.45 3.3858,21 3.9958,21C4.0558,21 4.1058,21 4.1658,20.99L8.3658,19.88L20.3758,7.86C20.7758,7.46 20.9958,6.93 20.9958,6.37C20.9958,5.81 20.7758,5.28 20.3758,4.88L19.1058,3.61C18.7158,3.22 18.1858,3 17.6258,3C17.0658,3 16.5358,3.22 16.1358,3.62Z" />
-    <path
-        android:fillAlpha="1"
-        android:fillColor="#636C6F"
-        android:fillType="nonZero"
-        android:pathData="M20.1936,15.3369C20.3748,16.3837 19.9151,17.5414 18.8846,18.7597C19.1546,18.872 19.4576,18.9452 19.7724,18.9867C20.0839,19.0278 20.3683,19.0325 20.5749,19.0266C20.6772,19.0236 20.7578,19.0181 20.8101,19.0138C20.8362,19.0116 20.855,19.0097 20.8657,19.0085L20.8754,19.0074L20.875,19.0075C21.4217,18.9385 21.9214,19.325 21.9918,19.8718C22.0624,20.4195 21.6756,20.9208 21.1279,20.9914L21,19.9996C21.1279,20.9914 21.1265,20.9916 21.1265,20.9916L21.1249,20.9918L21.1211,20.9923L21.1107,20.9935L21.0795,20.997C21.0542,20.9998 21.0199,21.0032 20.9775,21.0067C20.8929,21.0138 20.7753,21.0216 20.6323,21.0257C20.3481,21.0339 19.9533,21.0279 19.5109,20.9695C18.873,20.8854 18.0393,20.6793 17.3106,20.1662C16.9605,20.3559 16.5876,20.4952 16.2299,20.6003C15.5742,20.7927 14.8754,20.8968 14.2534,20.9534C13.6801,21.0055 13.4553,21.0037 13.1015,21.0008C13.0689,21.0005 13.0352,21.0002 13,21H12.8594C12.8214,21.0002 12.785,21.0006 12.7504,21.0009C12.6524,21.0019 12.5683,21.0027 12.5,21H12.0562C12.0277,21.0003 12.0054,21.0006 11.9926,21.001L11.9751,21H9L11,19H11.9795C11.9929,18.9997 12.0064,18.9997 12.0199,19H12.4117C12.4534,18.9996 12.4864,18.9995 12.5,19H12.9675C12.977,18.9999 12.9878,18.9999 13,19C13.0446,19.0003 13.0859,19.0007 13.1249,19.0011C13.4259,19.0038 13.591,19.0054 14.0723,18.9616C14.6201,18.9118 15.1795,18.8242 15.6665,18.6813C15.753,18.6559 15.8346,18.6295 15.9114,18.6022C15.0315,17.2981 14.7125,16.1044 15.015,15.0829C15.4095,13.7511 16.6784,13.2418 17.7026,13.2864C18.7262,13.3309 19.954,13.9529 20.1936,15.3369ZM16.9327,15.6508C16.873,15.8523 16.8651,16.3878 17.4697,17.334C18.2007,16.4284 18.2585,15.8839 18.2229,15.6781C18.1939,15.5108 18.0297,15.3025 17.6157,15.2845C17.2025,15.2665 16.9885,15.4626 16.9327,15.6508Z" />
-</vector>
+    android:width="48dp"
+    android:height="48dp"
+    android:viewportWidth="48"
+    android:viewportHeight="48">
+
+    <group>
+        <path
+            android:fillColor="#0B57D0"
+            android:pathData="M48 24C48 10.7452 37.2548 0 24 0C10.7452 0 0 10.7452 0 24C0 37.2548 10.7452 48 24 48C37.2548 48 48 37.2548 48 24Z" />
+        <path
+            android:fillColor="#ffffff"
+            android:pathData="M37.692 16.8L36 15.108C35.556 14.652 34.944 14.4 34.308 14.4C33.672 14.4 33.06 14.652 32.616 15.108L23.268 24.456L20.508 27.216L19.248 32.28C19.212 32.352 19.2 32.448 19.2 32.532C19.2 33.12 19.68 33.6 20.268 33.6C20.352 33.6 20.448 33.588 20.532 33.564L25.596 32.304L28.356 29.544L37.704 20.196C38.148 19.74 38.4 19.128 38.4 18.492C38.4 17.856 38.148 17.244 37.692 16.8ZM26.652 27.852L25.452 29.052L23.76 27.36L24.96 26.16L34.308 16.8L36 18.492L26.652 27.852Z" />
+        <path
+            android:fillColor="#ffffff"
+            android:pathData="M17.825 33.6C12.257 33.6 10.2 31.9581 10.2 28.7351C10.2 25.8284 12.727 24.4472 16.656 23.8703C17.95 23.6802 18.6125 23.137 18.6125 22.5654C18.6125 20.9818 15.415 21.0788 14.4 21.0324V18.6C14.4 18.6 17.95 18.6 19.65 19.8923C20.5181 20.5521 21 21.4125 21 22.7149C21 24.5027 19.7375 25.9099 16.656 26.1633C14.6206 26.3307 12.6 26.9351 12.6 28.7351C12.6 30.3527 14.616 31.1676 18.6 31.1676L17.825 33.6Z" />
+    </group>
+</vector>
\ No newline at end of file
diff --git a/res/layout/accessibility_launch_activity_preference.xml b/res/layout/accessibility_launch_activity_preference.xml
index 5ec6bea..6791206 100644
--- a/res/layout/accessibility_launch_activity_preference.xml
+++ b/res/layout/accessibility_launch_activity_preference.xml
@@ -34,7 +34,7 @@
         <TextView
             android:id="@android:id/title"
             android:layout_height="wrap_content"
-            android:layout_width="wrap_content"
+            android:layout_width="match_parent"
             android:layout_gravity="center_vertical"
             android:paddingVertical="@dimen/settingslib_switch_title_margin"
             android:ellipsize="end"
diff --git a/res/layout/notification_channel_panel.xml b/res/layout/notification_channel_panel.xml
index 14e10cc..7e944ac 100644
--- a/res/layout/notification_channel_panel.xml
+++ b/res/layout/notification_channel_panel.xml
@@ -19,6 +19,7 @@
     android:layout_height="@dimen/notif_channel_panel_max_height"
     android:maxHeight="@dimen/notif_channel_panel_max_height"
     android:background="@drawable/settings_panel_background"
+    android:fitsSystemWindows="true"
     android:orientation="vertical"
     android:layout_width="match_parent">
 
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1ee64a4..4f67a35 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -361,7 +361,7 @@
     <string name="desc_app_locale_disclaimer">Language may differ from languages available in the app. Some apps may not support this setting.</string>
 
     <!-- Description for introduction of the locale selection supported of app list [CHAR LIMIT=NONE]-->
-    <string name="desc_app_locale_selection_supported">Only apps that support language selection are shown here.</string>
+    <string name="desc_app_locale_selection_supported">Set the language for each app.</string>
 
     <!-- Description for the introduction to language picker activity. [CHAR LIMIT=NONE]-->
     <string name="desc_introduction_of_language_picker">Your system, apps, and websites use the first supported language from your preferred languages.</string>
@@ -5164,7 +5164,7 @@
     <!-- Title when early heads up is solved [CHAR LIMIT=NONE] -->
     <string name="battery_tip_early_heads_up_done_title">Battery Saver on</string>
     <!-- Accessibility description for battery saver learn more link [CHAR LIMIT=NONE] -->
-    <string name="battery_saver_link_a11y">Learn more about Battery saver</string>
+    <string name="battery_saver_link_a11y">Learn more about Battery Saver</string>
     <!-- Summary when early heads up is solved [CHAR LIMIT=NONE] -->
     <string name="battery_tip_early_heads_up_done_summary">Some features may be limited</string>
     <!-- Title for the battery high usage tip [CHAR LIMIT=NONE] -->
@@ -5472,9 +5472,9 @@
     <!-- [CHAR_LIMIT=NONE] Device screen on time category for a selected slot -->
     <string name="screen_time_category_for_slot">Screen time for <xliff:g id="slot">%s</xliff:g></string>
     <!-- [CHAR_LIMIT=NONE] The spinner item text in the battery usage breakdown. -->
-    <string name="battery_usage_spinner_by_apps">By apps</string>
+    <string name="battery_usage_spinner_view_by_apps">View by apps</string>
     <!-- [CHAR_LIMIT=NONE] The spinner item text in the battery usage breakdown. -->
-    <string name="battery_usage_spinner_by_systems">By systems</string>
+    <string name="battery_usage_spinner_view_by_systems">View by systems</string>
     <!-- [CHAR_LIMIT=NONE] Less than some percentage, e.g. < 1% -->
     <string name="battery_usage_less_than_percent">&lt; <xliff:g id="percentage">%1$s</xliff:g></string>
     <!-- Process Stats strings -->
@@ -9139,13 +9139,13 @@
     <string name="filter_manage_external_storage">Can access all files</string>
 
     <!-- Manage full screen intent permission title [CHAR LIMIT=40] -->
-    <string name="full_screen_intent_title">Show full screen notifications</string>
+    <string name="full_screen_intent_title">Full screen notifications</string>
 
     <!-- Label for setting that allows apps to send full screen intents. [CHAR LIMIT=NONE] -->
-    <string name="permit_full_screen_intent">Allow app to show full screen notifications when the device is locked</string>
+    <string name="permit_full_screen_intent">Allow full screen notifications from this app</string>
 
     <!-- Description for setting that allows apps to send full screen intents. [CHAR LIMIT=NONE] -->
-    <string name="footer_description_full_screen_intent">Allow the app to show notifications that take up the full screen when the device is locked. Apps may use these to highlight alarms, incoming calls, or other urgent notifications.</string>
+    <string name="footer_description_full_screen_intent">Allow this app to show notifications that take up the full screen when the device is locked. Apps may use these to highlight alarms, incoming calls, or other urgent notifications.</string>
 
     <!-- Media management apps settings title [CHAR LIMIT=40] -->
     <string name="media_management_apps_title">Media management apps</string>
@@ -12060,5 +12060,5 @@
     <string name="dock_multi_instances_not_supported_text">"This app can only be opened in 1 window"</string>
 
     <!-- [CHAR LIMIT=30] Label used to open Note Task -->
-    <string name="note_task_button_label">Notetaking</string>
+    <string name="note_task_shortcut_label">Note shortcut</string>
 </resources>
diff --git a/res/xml/security_settings_fingerprint.xml b/res/xml/security_settings_fingerprint.xml
index a4ce545..0156ef9 100644
--- a/res/xml/security_settings_fingerprint.xml
+++ b/res/xml/security_settings_fingerprint.xml
@@ -20,9 +20,20 @@
     android:title="@string/security_settings_fingerprint_preference_title">
 
     <PreferenceCategory
+        android:key="security_settings_fingerprints_enrolled"
+        settings:controller="com.android.settings.biometrics.fingerprint.FingerprintsEnrolledCategoryPreferenceController">
+    </PreferenceCategory>
+
+    <androidx.preference.Preference
+        android:key="key_fingerprint_add"
+        android:title="@string/fingerprint_add_title"
+        android:icon="@drawable/ic_add_24dp"/>
+
+    <PreferenceCategory
         android:key="security_settings_fingerprint_unlock_category"
         android:title="@string/security_settings_fingerprint_settings_preferences_category"
-        settings:controller="com.android.settings.biometrics.fingerprint.FingerprintUnlockCategoryPreferenceController">
+        settings:controller="com.android.settings.biometrics.fingerprint.FingerprintUnlockCategoryController"
+        settings:isPreferenceVisible="false">
 
         <com.android.settingslib.RestrictedSwitchPreference
             android:key="security_settings_require_screen_on_to_auth"
@@ -32,4 +43,8 @@
             settings:controller="com.android.settings.biometrics.fingerprint.FingerprintSettingsRequireScreenOnToAuthPreferenceController" />
     </PreferenceCategory>
 
+    <PreferenceCategory
+        android:key="security_settings_fingerprint_footer">
+    </PreferenceCategory>
+
 </PreferenceScreen>
diff --git a/src/com/android/settings/accessibility/PaletteListPreference.java b/src/com/android/settings/accessibility/PaletteListPreference.java
index 4e10b93..eec8b5a 100644
--- a/src/com/android/settings/accessibility/PaletteListPreference.java
+++ b/src/com/android/settings/accessibility/PaletteListPreference.java
@@ -34,6 +34,7 @@
 
 import androidx.annotation.ColorInt;
 import androidx.annotation.IntDef;
+import androidx.core.text.TextUtilsCompat;
 import androidx.preference.Preference;
 import androidx.preference.PreferenceViewHolder;
 
@@ -49,6 +50,7 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Locale;
 import java.util.stream.Collectors;
 
 /** Preference that easier preview by matching name to color. */
@@ -156,10 +158,11 @@
         mGradientColors.set(Position.END, color);
 
         final GradientDrawable gradientDrawable = new GradientDrawable();
+        final Locale locale = Locale.getDefault();
         final Orientation orientation =
-                rootView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL
-                        ? Orientation.RIGHT_LEFT
-                        : Orientation.LEFT_RIGHT;
+                TextUtilsCompat.getLayoutDirectionFromLocale(locale) == View.LAYOUT_DIRECTION_RTL
+                    ? Orientation.RIGHT_LEFT
+                    : Orientation.LEFT_RIGHT;
         gradientDrawable.setOrientation(orientation);
         gradientDrawable.setColors(Ints.toArray(mGradientColors), Floats.toArray(mGradientOffsets));
 
diff --git a/src/com/android/settings/applications/AppStateLocaleBridge.java b/src/com/android/settings/applications/AppStateLocaleBridge.java
index 2fea004..a50d617 100644
--- a/src/com/android/settings/applications/AppStateLocaleBridge.java
+++ b/src/com/android/settings/applications/AppStateLocaleBridge.java
@@ -83,7 +83,7 @@
                         Log.d(TAG, "[" + entry.info.packageName + "]" + " has No extra info.");
                         return false;
                     }
-                    return (Boolean) entry.extraInfo;
+                    return entry.extraInfo == Boolean.TRUE;
                 }
             };
 
diff --git a/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java b/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java
index c627df3..f19fb91 100644
--- a/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java
+++ b/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java
@@ -23,6 +23,7 @@
 import android.app.Activity;
 import android.app.Dialog;
 import android.content.ComponentName;
+import android.content.ContentResolver;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
@@ -33,9 +34,11 @@
 import android.credentials.CredentialManager;
 import android.credentials.CredentialProviderInfo;
 import android.credentials.SetEnabledProvidersException;
+import android.database.ContentObserver;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.Bundle;
+import android.os.Handler;
 import android.os.OutcomeReceiver;
 import android.os.UserHandle;
 import android.provider.DeviceConfig;
@@ -59,10 +62,12 @@
 import androidx.preference.SwitchPreference;
 
 import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.content.PackageMonitor;
 import com.android.settings.R;
 import com.android.settings.Utils;
 import com.android.settings.core.BasePreferenceController;
 import com.android.settings.dashboard.DashboardFragment;
+import com.android.settingslib.utils.ThreadUtils;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -89,10 +94,12 @@
     private final Executor mExecutor;
     private final Map<String, SwitchPreference> mPrefs = new HashMap<>(); // key is package name
     private final List<ServiceInfo> mPendingServiceInfos = new ArrayList<>();
+    private final Handler mHandler = new Handler();
 
     private @Nullable FragmentManager mFragmentManager = null;
     private @Nullable Delegate mDelegate = null;
     private @Nullable String mFlagOverrideForTest = null;
+    private @Nullable PreferenceScreen mPreferenceScreen = null;
 
     public CredentialManagerPreferenceController(Context context, String preferenceKey) {
         super(context, preferenceKey);
@@ -103,6 +110,7 @@
         mExecutor = ContextCompat.getMainExecutor(mContext);
         mCredentialManager =
                 getCredentialManager(context, preferenceKey.equals("credentials_test"));
+        new SettingContentObserver(mHandler).register(context.getContentResolver());
     }
 
     private @Nullable CredentialManager getCredentialManager(Context context, boolean isTest) {
@@ -241,6 +249,25 @@
         update();
     }
 
+    private void update() {
+        if (mCredentialManager == null) {
+            return;
+        }
+
+        setAvailableServices(
+                mCredentialManager.getCredentialProviderServices(
+                        getUser(), CredentialManager.PROVIDER_FILTER_USER_PROVIDERS_ONLY),
+                null);
+    }
+
+    private void updateFromExternal() {
+        update();
+
+        if (mPreferenceScreen != null) {
+            displayPreference(mPreferenceScreen);
+        }
+    }
+
     @VisibleForTesting
     void setAvailableServices(
             List<CredentialProviderInfo> availableServices,
@@ -276,6 +303,7 @@
         // Since the UI is being cleared, clear any refs.
         mPrefs.clear();
 
+        mPreferenceScreen = screen;
         PreferenceGroup group = screen.findPreference(getPreferenceKey());
         Context context = screen.getContext();
         mPrefs.putAll(buildPreferenceList(context, group));
@@ -348,6 +376,10 @@
         Map<String, List<CredentialProviderInfo>> groupedInfos = new HashMap<>();
         for (CredentialProviderInfo cpi : mServices) {
             String packageName = cpi.getServiceInfo().packageName;
+            if (isProviderHiddenBecauseOfAutofill(packageName)) {
+                continue;
+            }
+
             if (!groupedInfos.containsKey(packageName)) {
                 groupedInfos.put(packageName, new ArrayList<>());
             }
@@ -551,6 +583,23 @@
         return new NewProviderConfirmationDialogFragment(host, packageName, appName);
     }
 
+    /** If the provider is also the autofill provider then hide it. */
+    @VisibleForTesting
+    public boolean isProviderHiddenBecauseOfAutofill(String packageName) {
+        final String autofillService = Settings.Secure.getStringForUser(
+                mContext.getContentResolver(),
+                Settings.Secure.AUTOFILL_SERVICE,
+                getUser());
+        if (autofillService == null || TextUtils.isEmpty(autofillService)) {
+            return false;
+        }
+        if (packageName == null || TextUtils.isEmpty(packageName)) {
+            return false;
+        }
+
+        return autofillService.startsWith(packageName);
+    }
+
     @VisibleForTesting
     void completeEnableProviderDialogBox(
             int whichButton, String packageName, boolean setActivityResult) {
@@ -655,20 +704,6 @@
         }
     };
 
-    /**
-     * Update the data in this UI.
-     */
-    private void update() {
-        if (mCredentialManager == null) {
-            return;
-        }
-
-        setAvailableServices(
-                mCredentialManager.getCredentialProviderServices(
-                        getUser(), CredentialManager.PROVIDER_FILTER_USER_PROVIDERS_ONLY),
-                null);
-    }
-
     /** Dialog fragment parent class. */
     private abstract static class CredentialManagerDialogFragment extends DialogFragment
             implements DialogInterface.OnClickListener {
@@ -790,4 +825,28 @@
             getDialogHost().onDialogClick(which);
         }
     }
+
+    /** Updates the list if setting content changes. */
+    private final class SettingContentObserver extends ContentObserver {
+
+        private final Uri mAutofillService =
+                Settings.Secure.getUriFor(Settings.Secure.AUTOFILL_SERVICE);
+
+        private final Uri mCredentialService =
+                Settings.Secure.getUriFor(Settings.Secure.CREDENTIAL_SERVICE);
+
+        public SettingContentObserver(Handler handler) {
+            super(handler);
+        }
+
+        public void register(ContentResolver contentResolver) {
+            contentResolver.registerContentObserver(mAutofillService, false, this, getUser());
+            contentResolver.registerContentObserver(mCredentialService, false, this, getUser());
+        }
+
+        @Override
+        public void onChange(boolean selfChange, Uri uri) {
+            updateFromExternal();
+        }
+    }
 }
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
index 40a719a..a5e5f57 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
@@ -171,8 +171,12 @@
         private static final String KEY_IS_ENROLLING = "is_enrolled";
         private static final String KEY_REQUIRE_SCREEN_ON_TO_AUTH =
                 "security_settings_require_screen_on_to_auth";
+        private static final String KEY_FINGERPRINTS_ENROLLED_CATEGORY =
+                "security_settings_fingerprints_enrolled";
         private static final String KEY_FINGERPRINT_UNLOCK_CATEGORY =
                 "security_settings_fingerprint_unlock_category";
+        private static final String KEY_FINGERPRINT_UNLOCK_FOOTER =
+                "security_settings_fingerprint_footer";
 
         private static final int MSG_REFRESH_FINGERPRINT_TEMPLATES = 1000;
         private static final int MSG_FINGER_AUTH_SUCCESS = 1001;
@@ -189,10 +193,15 @@
         protected static final boolean DEBUG = false;
 
         private List<AbstractPreferenceController> mControllers;
+        private FingerprintUnlockCategoryController
+                mFingerprintUnlockCategoryPreferenceController;
         private FingerprintSettingsRequireScreenOnToAuthPreferenceController
                 mRequireScreenOnToAuthPreferenceController;
+        private Preference mAddFingerprintPreference;
         private RestrictedSwitchPreference mRequireScreenOnToAuthPreference;
+        private PreferenceCategory mFingerprintsEnrolledCategory;
         private PreferenceCategory mFingerprintUnlockCategory;
+        private PreferenceCategory mFingerprintUnlockFooter;
 
         private FingerprintManager mFingerprintManager;
         private FingerprintUpdater mFingerprintUpdater;
@@ -259,9 +268,6 @@
                     }
 
                     private void updateDialog() {
-                        if (isSfps()) {
-                            setRequireScreenOnToAuthVisibility();
-                        }
                         RenameDialog renameDialog = (RenameDialog) getFragmentManager().
                                 findFragmentByTag(RenameDialog.class.getName());
                         if (renameDialog != null) {
@@ -277,7 +283,8 @@
                     case MSG_REFRESH_FINGERPRINT_TEMPLATES:
                         removeFingerprintPreference(msg.arg1);
                         updateAddPreference();
-                        retryFingerprint();
+                        updateFingerprintUnlockCategoryVisibility();
+                        updatePreferences();
                         break;
                     case MSG_FINGER_AUTH_SUCCESS:
                         highlightFingerprintItem(msg.arg1);
@@ -423,6 +430,9 @@
                     addFirstFingerprint(null);
                 }
             }
+            final PreferenceScreen root = getPreferenceScreen();
+            root.removeAll();
+            addPreferencesFromResource(getPreferenceScreenResId());
             updateFooterColumns(activity);
         }
 
@@ -512,48 +522,33 @@
          */
         private PreferenceScreen createPreferenceHierarchy() {
             PreferenceScreen root = getPreferenceScreen();
-            if (root != null) {
-                root.removeAll();
-            }
-            final String fpPrefKey = addFingerprintItemPreferences(root);
-            if (isSfps()) {
-                scrollToPreference(fpPrefKey);
-            }
-            addPreferencesFromResource(getPreferenceScreenResId());
-            mRequireScreenOnToAuthPreference = findPreference(KEY_REQUIRE_SCREEN_ON_TO_AUTH);
-            mFingerprintUnlockCategory = findPreference(KEY_FINGERPRINT_UNLOCK_CATEGORY);
-            for (AbstractPreferenceController controller : mControllers) {
-                ((FingerprintSettingsPreferenceController) controller).setUserId(mUserId);
-            }
-            mRequireScreenOnToAuthPreference.setChecked(
-                    mRequireScreenOnToAuthPreferenceController.isChecked());
-            mRequireScreenOnToAuthPreference.setOnPreferenceChangeListener(
-                    (preference, newValue) -> {
-                        boolean isChecked = ((SwitchPreference) preference).isChecked();
-                        mRequireScreenOnToAuthPreferenceController.setChecked(!isChecked);
-                        return true;
-                    });
-            mFingerprintUnlockCategory.setVisible(false);
-            if (isSfps()) {
-                setRequireScreenOnToAuthVisibility();
-            }
+            addFingerprintPreferences(root);
             setPreferenceScreen(root);
             return root;
         }
 
-        private void setRequireScreenOnToAuthVisibility() {
-            int fingerprintsEnrolled = mFingerprintManager.getEnrolledFingerprints(mUserId).size();
-            final boolean removalInProgress = mRemovalSidecar.inProgress();
-            // Removing last remaining fingerprint
-            if (fingerprintsEnrolled == 0 && removalInProgress) {
-                mFingerprintUnlockCategory.setVisible(false);
-            } else {
-                mFingerprintUnlockCategory.setVisible(true);
+        private void addFingerprintPreferences(PreferenceGroup root) {
+            final String fpPrefKey = addFingerprintItemPreferences(root);
+            if (isSfps()) {
+                scrollToPreference(fpPrefKey);
+                addFingerprintUnlockCategory();
             }
+            for (AbstractPreferenceController controller : mControllers) {
+                if (controller instanceof FingerprintSettingsPreferenceController) {
+                    ((FingerprintSettingsPreferenceController) controller).setUserId(mUserId);
+                } else if (controller instanceof FingerprintUnlockCategoryController) {
+                    ((FingerprintUnlockCategoryController) controller).setUserId(mUserId);
+                }
+            }
+            createFooterPreference(root);
         }
 
         private String addFingerprintItemPreferences(PreferenceGroup root) {
-            root.removeAll();
+            mFingerprintsEnrolledCategory = findPreference(KEY_FINGERPRINTS_ENROLLED_CATEGORY);
+            if (mFingerprintsEnrolledCategory != null) {
+                mFingerprintsEnrolledCategory.removeAll();
+            }
+
             String keyToReturn = KEY_FINGERPRINT_ADD;
             final List<Fingerprint> items = mFingerprintManager.getEnrolledFingerprints(mUserId);
             final int fingerprintCount = items.size();
@@ -576,22 +571,46 @@
                 if (mFingerprintsRenaming.containsKey(item.getBiometricId())) {
                     pref.setTitle(mFingerprintsRenaming.get(item.getBiometricId()));
                 }
-                root.addPreference(pref);
+                mFingerprintsEnrolledCategory.addPreference(pref);
                 pref.setOnPreferenceChangeListener(this);
             }
-
-            Preference addPreference = new Preference(root.getContext());
-            addPreference.setKey(KEY_FINGERPRINT_ADD);
-            addPreference.setTitle(R.string.fingerprint_add_title);
-            addPreference.setIcon(R.drawable.ic_add_24dp);
-            root.addPreference(addPreference);
-            addPreference.setOnPreferenceChangeListener(this);
-            updateAddPreference();
-            createFooterPreference(root);
-
+            mAddFingerprintPreference = findPreference(KEY_FINGERPRINT_ADD);
+            setupAddFingerprintPreference();
             return keyToReturn;
         }
 
+        private void setupAddFingerprintPreference() {
+            mAddFingerprintPreference.setOnPreferenceChangeListener(this);
+            updateAddPreference();
+        }
+
+        private void addFingerprintUnlockCategory() {
+            mFingerprintUnlockCategory = findPreference(KEY_FINGERPRINT_UNLOCK_CATEGORY);
+            setupFingerprintUnlockCategoryPreferences();
+            updateFingerprintUnlockCategoryVisibility();
+        }
+
+        private void updateFingerprintUnlockCategoryVisibility() {
+            final boolean mFingerprintUnlockCategoryAvailable =
+                    mFingerprintUnlockCategoryPreferenceController.isAvailable();
+            if (mFingerprintUnlockCategory.isVisible() != mFingerprintUnlockCategoryAvailable) {
+                mFingerprintUnlockCategory.setVisible(
+                        mFingerprintUnlockCategoryAvailable);
+            }
+        }
+
+        private void setupFingerprintUnlockCategoryPreferences() {
+            mRequireScreenOnToAuthPreference = findPreference(KEY_REQUIRE_SCREEN_ON_TO_AUTH);
+            mRequireScreenOnToAuthPreference.setChecked(
+                    mRequireScreenOnToAuthPreferenceController.isChecked());
+            mRequireScreenOnToAuthPreference.setOnPreferenceChangeListener(
+                    (preference, newValue) -> {
+                        final boolean isChecked = ((SwitchPreference) preference).isChecked();
+                        mRequireScreenOnToAuthPreferenceController.setChecked(!isChecked);
+                        return true;
+                    });
+        }
+
         private void updateAddPreference() {
             if (getActivity() == null) {
                 return; // Activity went away
@@ -612,8 +631,8 @@
             final boolean removalInProgress = mRemovalSidecar.inProgress();
             CharSequence maxSummary = tooMany ?
                     getContext().getString(R.string.fingerprint_add_max, max) : "";
-            addPreference.setSummary(maxSummary);
-            addPreference.setEnabled(!tooMany && !removalInProgress && mToken != null);
+            mAddFingerprintPreference.setSummary(maxSummary);
+            mAddFingerprintPreference.setEnabled(!tooMany && !removalInProgress && mToken != null);
         }
 
         private void createFooterPreference(PreferenceGroup root) {
@@ -621,6 +640,10 @@
             if (context == null) {
                 return;
             }
+            mFingerprintUnlockFooter = findPreference(KEY_FINGERPRINT_UNLOCK_FOOTER);
+            if (mFingerprintUnlockFooter != null) {
+                mFingerprintUnlockFooter.removeAll();
+            }
             for (int i = 0; i < mFooterColumns.size(); ++i) {
                 final FooterColumn column = mFooterColumns.get(i);
                 final FooterPreference footer = new FooterPreference.Builder(context)
@@ -634,7 +657,7 @@
                         footer.setLearnMoreText(column.mLearnMoreOverrideText);
                     }
                 }
-                root.addPreference(footer);
+                mFingerprintUnlockFooter.addPreference(footer);
             }
         }
 
@@ -815,11 +838,17 @@
 
         private List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
             final List<AbstractPreferenceController> controllers = new ArrayList<>();
+            mFingerprintUnlockCategoryPreferenceController =
+                    new FingerprintUnlockCategoryController(
+                            context,
+                            KEY_FINGERPRINT_UNLOCK_CATEGORY
+                    );
             mRequireScreenOnToAuthPreferenceController =
                     new FingerprintSettingsRequireScreenOnToAuthPreferenceController(
                             context,
                             KEY_REQUIRE_SCREEN_ON_TO_AUTH
                     );
+            controllers.add(mFingerprintUnlockCategoryPreferenceController);
             controllers.add(mRequireScreenOnToAuthPreferenceController);
             return controllers;
         }
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsRequireScreenOnToAuthPreferenceController.java b/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsRequireScreenOnToAuthPreferenceController.java
index 52e6d13..87396dd 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsRequireScreenOnToAuthPreferenceController.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsRequireScreenOnToAuthPreferenceController.java
@@ -94,7 +94,7 @@
                 && mFingerprintManager.isHardwareDetected()
                 && mFingerprintManager.isPowerbuttonFps()) {
             return mFingerprintManager.hasEnrolledTemplates(getUserId())
-                    ? AVAILABLE : DISABLED_DEPENDENT_SETTING;
+                    ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
         } else {
             return UNSUPPORTED_ON_DEVICE;
         }
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintUnlockCategoryController.java b/src/com/android/settings/biometrics/fingerprint/FingerprintUnlockCategoryController.java
new file mode 100644
index 0000000..674a0df
--- /dev/null
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintUnlockCategoryController.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2023 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.biometrics.fingerprint;
+
+import android.content.Context;
+import android.hardware.fingerprint.FingerprintManager;
+
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.settings.Utils;
+import com.android.settings.core.BasePreferenceController;
+
+/**
+ * Preference controller that controls the fingerprint unlock features to be shown / be hidden.
+ */
+public class FingerprintUnlockCategoryController extends BasePreferenceController {
+    private static final String TAG = "FingerprintUnlockCategoryPreferenceController";
+
+    private int mUserId;
+    @VisibleForTesting
+    protected FingerprintManager mFingerprintManager;
+
+    public FingerprintUnlockCategoryController(Context context, String key) {
+        super(context, key);
+        mFingerprintManager = Utils.getFingerprintManagerOrNull(context);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        if (mFingerprintManager != null
+                && mFingerprintManager.isHardwareDetected()
+                && mFingerprintManager.isPowerbuttonFps()) {
+            return mFingerprintManager.hasEnrolledTemplates(getUserId())
+                    ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
+        } else {
+            return UNSUPPORTED_ON_DEVICE;
+        }
+    }
+
+    public void setUserId(int userId) {
+        mUserId = userId;
+    }
+
+    protected int getUserId() {
+        return mUserId;
+    }
+}
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintsEnrolledCategoryPreferenceController.java b/src/com/android/settings/biometrics/fingerprint/FingerprintsEnrolledCategoryPreferenceController.java
new file mode 100644
index 0000000..53d5379
--- /dev/null
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintsEnrolledCategoryPreferenceController.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2023 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.biometrics.fingerprint;
+
+import android.content.Context;
+import android.hardware.fingerprint.FingerprintManager;
+
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.settings.Utils;
+import com.android.settings.core.BasePreferenceController;
+
+/**
+ * Preference controller that controls the enrolled fingerprints to be shown / be hidden.
+ */
+public class FingerprintsEnrolledCategoryPreferenceController extends BasePreferenceController {
+    private static final String TAG = "FingerprintsEnrolledCategoryPreferenceController";
+
+    private int mUserId;
+    @VisibleForTesting
+    protected FingerprintManager mFingerprintManager;
+
+    public FingerprintsEnrolledCategoryPreferenceController(Context context, String key) {
+        super(context, key);
+        mFingerprintManager = Utils.getFingerprintManagerOrNull(context);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        if (mFingerprintManager != null
+                && mFingerprintManager.isHardwareDetected()) {
+            return mFingerprintManager.hasEnrolledTemplates(getUserId())
+                    ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
+        } else {
+            return UNSUPPORTED_ON_DEVICE;
+        }
+    }
+
+    public void setUserId(int userId) {
+        mUserId = userId;
+    }
+
+    protected int getUserId() {
+        return mUserId;
+    }
+}
diff --git a/src/com/android/settings/bluetooth/BluetoothEnabler.java b/src/com/android/settings/bluetooth/BluetoothEnabler.java
index 483e46a..de49ce1 100644
--- a/src/com/android/settings/bluetooth/BluetoothEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothEnabler.java
@@ -223,7 +223,6 @@
         mSwitchController.setDisabledByAdmin(admin);
         if (admin != null) {
             mSwitchController.setChecked(false);
-            mSwitchController.setEnabled(false);
         }
         return admin != null;
     }
diff --git a/src/com/android/settings/fuelgauge/batteryusage/BatteryUsageBreakdownController.java b/src/com/android/settings/fuelgauge/batteryusage/BatteryUsageBreakdownController.java
index c272a49..b262dee 100644
--- a/src/com/android/settings/fuelgauge/batteryusage/BatteryUsageBreakdownController.java
+++ b/src/com/android/settings/fuelgauge/batteryusage/BatteryUsageBreakdownController.java
@@ -177,8 +177,8 @@
         mAppListPreferenceGroup.setOrderingAsAdded(false);
         mSpinnerPreference.initializeSpinner(
                 new String[]{
-                        mPrefContext.getString(R.string.battery_usage_spinner_by_apps),
-                        mPrefContext.getString(R.string.battery_usage_spinner_by_systems)
+                        mPrefContext.getString(R.string.battery_usage_spinner_view_by_apps),
+                        mPrefContext.getString(R.string.battery_usage_spinner_view_by_systems)
                 },
                 new AdapterView.OnItemSelectedListener() {
                     @Override
diff --git a/src/com/android/settings/localepicker/LocaleDialogFragment.java b/src/com/android/settings/localepicker/LocaleDialogFragment.java
index 2ee2e8b..9e274d6 100644
--- a/src/com/android/settings/localepicker/LocaleDialogFragment.java
+++ b/src/com/android/settings/localepicker/LocaleDialogFragment.java
@@ -37,6 +37,8 @@
 import com.android.settings.R;
 import com.android.settings.RestrictedSettingsFragment;
 import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 
 /**
  * Create a dialog for system locale events.
@@ -143,6 +145,7 @@
         private final int mDialogType;
         private final LocaleStore.LocaleInfo mLocaleInfo;
         private final ResultReceiver mResultReceiver;
+        private final MetricsFeatureProvider mMetricsFeatureProvider;
 
         LocaleDialogController(
                 @NonNull Context context, @NonNull LocaleDialogFragment dialogFragment) {
@@ -152,6 +155,8 @@
             mLocaleInfo = (LocaleStore.LocaleInfo) arguments.getSerializable(
                     ARG_TARGET_LOCALE);
             mResultReceiver = (ResultReceiver) arguments.getParcelable(ARG_RESULT_RECEIVER);
+            mMetricsFeatureProvider = FeatureFactory.getFactory(
+                    mContext).getMetricsFeatureProvider();
         }
 
         LocaleDialogController(@NonNull LocaleDialogFragment dialogFragment) {
@@ -163,11 +168,15 @@
             if (mResultReceiver != null && mDialogType == DIALOG_CONFIRM_SYSTEM_DEFAULT) {
                 Bundle bundle = new Bundle();
                 bundle.putInt(ARG_DIALOG_TYPE, DIALOG_CONFIRM_SYSTEM_DEFAULT);
+                boolean changed = false;
                 if (which == DialogInterface.BUTTON_POSITIVE) {
+                    changed = true;
                     mResultReceiver.send(Activity.RESULT_OK, bundle);
                 } else if (which == DialogInterface.BUTTON_NEGATIVE) {
                     mResultReceiver.send(Activity.RESULT_CANCELED, bundle);
                 }
+                mMetricsFeatureProvider.action(mContext,
+                        SettingsEnums.ACTION_CHANGE_LANGUAGE, changed);
             }
         }
 
diff --git a/src/com/android/settings/localepicker/LocaleHelperPreferenceController.java b/src/com/android/settings/localepicker/LocaleHelperPreferenceController.java
index a639c9d..1227683 100644
--- a/src/com/android/settings/localepicker/LocaleHelperPreferenceController.java
+++ b/src/com/android/settings/localepicker/LocaleHelperPreferenceController.java
@@ -16,6 +16,7 @@
 
 package com.android.settings.localepicker;
 
+import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.content.Intent;
 import android.util.Log;
@@ -24,8 +25,10 @@
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.R;
+import com.android.settings.overlay.FeatureFactory;
 import com.android.settingslib.HelpUtils;
 import com.android.settingslib.core.AbstractPreferenceController;
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 import com.android.settingslib.widget.FooterPreference;
 
 /**
@@ -36,8 +39,11 @@
 
     private static final String KEY_FOOTER_LANGUAGE_PICKER = "footer_languages_picker";
 
+    private final MetricsFeatureProvider mMetricsFeatureProvider;
+
     public LocaleHelperPreferenceController(Context context) {
         super(context);
+        mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
     }
 
     @Override
@@ -72,6 +78,7 @@
                 mContext.getString(R.string.link_locale_picker_footer_learn_more),
                 mContext.getClass().getName());
         if (intent != null) {
+            mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_LANGUAGES_LEARN_MORE);
             mContext.startActivity(intent);
         } else {
             Log.w(TAG, "HelpIntent is null");
diff --git a/src/com/android/settings/location/LocationSwitchBarController.java b/src/com/android/settings/location/LocationSwitchBarController.java
index c84014f..b150b1d 100644
--- a/src/com/android/settings/location/LocationSwitchBarController.java
+++ b/src/com/android/settings/location/LocationSwitchBarController.java
@@ -15,6 +15,7 @@
 
 import android.content.Context;
 import android.os.UserHandle;
+import android.os.UserManager;
 import android.widget.Switch;
 
 import com.android.settings.widget.SettingsMainSwitchBar;
@@ -75,8 +76,12 @@
         // only, it would be re-enabled again if the switch bar is not disabled.
         if (!hasBaseUserRestriction && admin != null) {
             mSwitchBar.setDisabledByAdmin(admin);
+        } else if (restricted) {
+            RestrictedLockUtils.EnforcedAdmin enforcedAdmin = RestrictedLockUtils.EnforcedAdmin
+                    .createDefaultEnforcedAdminWithRestriction(UserManager.DISALLOW_SHARE_LOCATION);
+            mSwitchBar.setDisabledByAdmin(enforcedAdmin);
         } else {
-            mSwitchBar.setEnabled(!restricted);
+            mSwitchBar.setEnabled(true);
         }
 
         if (enabled != mSwitchBar.isChecked()) {
diff --git a/src/com/android/settings/notetask/shortcut/CreateNoteTaskShortcutActivity.kt b/src/com/android/settings/notetask/shortcut/CreateNoteTaskShortcutActivity.kt
index b984622..d3d7510 100644
--- a/src/com/android/settings/notetask/shortcut/CreateNoteTaskShortcutActivity.kt
+++ b/src/com/android/settings/notetask/shortcut/CreateNoteTaskShortcutActivity.kt
@@ -37,6 +37,11 @@
  * shortcut will appear in the widget picker. If the shortcut is selected, the Activity here will be
  * launched, creating a new shortcut for [CreateNoteTaskShortcutActivity], and will finish.
  *
+ * IMPORTANT! The shortcut package name and class should be synchronized with SystemUI controller:
+ * [com.android.systemui.notetask.NoteTaskController#SETTINGS_CREATE_NOTE_TASK_SHORTCUT_COMPONENT].
+ *
+ * Changing the package name or class is a breaking change.
+ *
  * @see <a
  *   href="https://developer.android.com/develop/ui/views/launch/shortcuts/creating-shortcuts#custom-pinned">Creating
  *   a custom shortcut activity</a>
@@ -81,9 +86,16 @@
                 setPackage(systemUiComponent.packageName)
             }
 
-            return ShortcutInfo.Builder(context, SHORTCUT_ID)
+            // Creates a System UI context. That will let the ownership with SystemUI and allows it
+            // to perform updates such as enabling or updating the badge override package.
+            val systemUiContext = context.createPackageContext(
+                    systemUiComponent.packageName,
+                    /* flags */ 0,
+            )
+
+            return ShortcutInfo.Builder(systemUiContext, SHORTCUT_ID)
                     .setIntent(intent)
-                    .setShortLabel(context.getString(R.string.note_task_button_label))
+                    .setShortLabel(context.getString(R.string.note_task_shortcut_label))
                     .setLongLived(true)
                     .setIcon(icon)
                     .setExtras(extras)
diff --git a/src/com/android/settings/notification/app/ChannelPanelActivity.java b/src/com/android/settings/notification/app/ChannelPanelActivity.java
index 9889183..dda1c65 100644
--- a/src/com/android/settings/notification/app/ChannelPanelActivity.java
+++ b/src/com/android/settings/notification/app/ChannelPanelActivity.java
@@ -28,10 +28,13 @@
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.core.view.ViewCompat;
+import androidx.core.view.WindowInsetsControllerCompat;
 import androidx.fragment.app.FragmentActivity;
 import androidx.fragment.app.FragmentManager;
 
 import com.android.settings.R;
+import com.android.settings.Utils;
 import com.android.settings.core.SubSettingLauncher;
 import com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin;
 
@@ -99,7 +102,7 @@
 
         findViewById(R.id.done).setOnClickListener(v -> finish());
         findViewById(R.id.see_more).setOnClickListener(v -> launchFullSettings());
-
+        setupNavigationBar();
         mPanelFragment = callingIntent.hasExtra(Settings.EXTRA_CONVERSATION_ID)
                 ? new ConversationNotificationSettings()
                 : new ChannelNotificationSettings();
@@ -107,4 +110,27 @@
         fragmentManager.beginTransaction().replace(
                 android.R.id.list_container, mPanelFragment).commit();
     }
+
+    /**
+     * Adjust bottom edge and color.
+     */
+    private void setupNavigationBar() {
+        // Extend the panel all the way to the bottom of the screen, as opposed to sitting on top of
+        // the navigation bar.
+        ViewCompat.setOnApplyWindowInsetsListener(getWindow().getDecorView(),
+                (v, windowInsets) -> {
+                    v.setPadding(v.getPaddingLeft(), v.getPaddingTop(), v.getPaddingRight(), 0);
+                    return windowInsets; // propagate down to panel layout root element
+                });
+
+        // When using 3-button navigation in light mode, the system picks white navigation buttons
+        // which are not sufficiently contrasted from the panel background.
+        WindowInsetsControllerCompat windowInsetsController =
+                ViewCompat.getWindowInsetsController(getWindow().getDecorView());
+
+        if (windowInsetsController != null) {
+            boolean forceNavigationButtonsDark = !Utils.isNightMode(this);
+            windowInsetsController.setAppearanceLightNavigationBars(forceNavigationButtonsDark);
+        }
+    }
 }
diff --git a/src/com/android/settings/widget/SettingsMainSwitchBar.java b/src/com/android/settings/widget/SettingsMainSwitchBar.java
index 5ad16d7..8b8a9ba 100644
--- a/src/com/android/settings/widget/SettingsMainSwitchBar.java
+++ b/src/com/android/settings/widget/SettingsMainSwitchBar.java
@@ -21,14 +21,12 @@
 import android.content.Context;
 import android.util.AttributeSet;
 import android.view.View;
-import android.widget.ImageView;
 import android.widget.Switch;
 
 import com.android.settings.overlay.FeatureFactory;
 import com.android.settingslib.RestrictedLockUtils;
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 import com.android.settingslib.widget.MainSwitchBar;
-import com.android.settingslib.widget.R;
 
 /**
  * A {@link MainSwitchBar} with a customized Switch and provides the metrics feature.
@@ -47,7 +45,6 @@
         boolean onBeforeCheckedChanged(Switch switchView, boolean isChecked);
     }
 
-    private ImageView mRestrictedIcon;
     private EnforcedAdmin mEnforcedAdmin;
     private boolean mDisabledByAdmin;
 
@@ -74,14 +71,6 @@
         mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
 
         addOnSwitchChangeListener((switchView, isChecked) -> logMetrics(isChecked));
-
-        mRestrictedIcon = findViewById(R.id.restricted_icon);
-        mRestrictedIcon.setOnClickListener((View v) -> {
-            if (mDisabledByAdmin) {
-                RestrictedLockUtils.sendShowAdminSupportDetailsIntent(context, mEnforcedAdmin);
-                onRestrictedIconClick();
-            }
-        });
     }
 
     /**
@@ -95,12 +84,9 @@
             mDisabledByAdmin = true;
             mTextView.setEnabled(false);
             mSwitch.setEnabled(false);
-            mSwitch.setVisibility(View.GONE);
-            mRestrictedIcon.setVisibility(View.VISIBLE);
         } else {
             mDisabledByAdmin = false;
             mSwitch.setVisibility(View.VISIBLE);
-            mRestrictedIcon.setVisibility(View.GONE);
             setEnabled(isEnabled());
         }
     }
@@ -120,11 +106,12 @@
 
     @Override
     public boolean performClick() {
-        return getDelegatingView().performClick();
-    }
+        if (mDisabledByAdmin) {
+            performRestrictedClick();
+            return true;
+        }
 
-    protected void onRestrictedIconClick() {
-        mMetricsFeatureProvider.clicked(mMetricsCategory, "switch_bar|restricted");
+        return mSwitch.performClick();
     }
 
     @Override
@@ -157,11 +144,12 @@
         mMetricsCategory = category;
     }
 
-    private View getDelegatingView() {
-        return mDisabledByAdmin ? mRestrictedIcon : mSwitch;
-    }
-
     private void logMetrics(boolean isChecked) {
         mMetricsFeatureProvider.changed(mMetricsCategory, "switch_bar", isChecked ? 1 : 0);
     }
+
+    private void performRestrictedClick() {
+        RestrictedLockUtils.sendShowAdminSupportDetailsIntent(getContext(), mEnforcedAdmin);
+        mMetricsFeatureProvider.clicked(mMetricsCategory, "switch_bar|restricted");
+    }
 }
diff --git a/src/com/android/settings/wifi/tether/WifiTetherSettings.java b/src/com/android/settings/wifi/tether/WifiTetherSettings.java
index 2774be6..4ce59b9 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherSettings.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherSettings.java
@@ -80,11 +80,14 @@
     @VisibleForTesting
     SettingsMainSwitchBar mMainSwitchBar;
     private WifiTetherSwitchBarController mSwitchBarController;
-    private WifiTetherSSIDPreferenceController mSSIDPreferenceController;
-    private WifiTetherPasswordPreferenceController mPasswordPreferenceController;
+    @VisibleForTesting
+    WifiTetherSSIDPreferenceController mSSIDPreferenceController;
+    @VisibleForTesting
+    WifiTetherPasswordPreferenceController mPasswordPreferenceController;
     private WifiTetherSecurityPreferenceController mSecurityPreferenceController;
     private WifiTetherMaximizeCompatibilityPreferenceController mMaxCompatibilityPrefController;
-    private WifiTetherAutoOffPreferenceController mWifiTetherAutoOffPreferenceController;
+    @VisibleForTesting
+    WifiTetherAutoOffPreferenceController mWifiTetherAutoOffPreferenceController;
 
     private boolean mUnavailable;
     private WifiRestriction mWifiRestriction;
@@ -269,10 +272,12 @@
         setLoading(restarting, false);
     }
 
-    private SoftApConfiguration buildNewConfig() {
-        SoftApConfiguration.Builder configBuilder = new SoftApConfiguration.Builder();
+    @VisibleForTesting
+    SoftApConfiguration buildNewConfig() {
+        SoftApConfiguration currentConfig = mWifiTetherViewModel.getSoftApConfiguration();
+        SoftApConfiguration.Builder configBuilder = new SoftApConfiguration.Builder(currentConfig);
         int securityType = (mWifiTetherViewModel.isSpeedFeatureAvailable())
-                ? mWifiTetherViewModel.getSoftApConfiguration().getSecurityType()
+                ? currentConfig.getSecurityType()
                 : mSecurityPreferenceController.getSecurityType();
         configBuilder.setSsid(mSSIDPreferenceController.getSSID());
         if (securityType != SoftApConfiguration.SECURITY_TYPE_OPEN) {
diff --git a/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsRequireScreenOnToAuthPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsRequireScreenOnToAuthPreferenceControllerTest.java
index b6df62e..ebfa6d5 100644
--- a/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsRequireScreenOnToAuthPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsRequireScreenOnToAuthPreferenceControllerTest.java
@@ -17,7 +17,7 @@
 package com.android.settings.biometrics.fingerprint;
 
 import static com.android.settings.core.BasePreferenceController.AVAILABLE;
-import static com.android.settings.core.BasePreferenceController.DISABLED_DEPENDENT_SETTING;
+import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
 import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
 
 import static com.google.common.truth.Truth.assertThat;
@@ -103,15 +103,15 @@
     }
 
     @Test
-    public void isAvailable_isDisabled_whenSfpsHardwareDetected_AndNoEnrolledFingerprints() {
+    public void isUnavailable_isDisabled_whenSfpsHardwareDetected_AndNoEnrolledFingerprints() {
         assertThat(mController.isAvailable()).isEqualTo(false);
         assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
         configure_hardwareDetected_isSfps_hasEnrolledTemplates(
                 true /* isHardwareDetected */,
                 true /* isPowerbuttonFps */,
                 false /* hasEnrolledTemplates */);
-        assertThat(mController.isAvailable()).isEqualTo(true);
-        assertThat(mController.getAvailabilityStatus()).isEqualTo(DISABLED_DEPENDENT_SETTING);
+        assertThat(mController.isAvailable()).isEqualTo(false);
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
     }
 
     @Test
@@ -122,7 +122,7 @@
                 false /* isHardwareDetected */,
                 true /* isPowerbuttonFps */,
                 true /* hasEnrolledTemplates */);
-        assertThat(mController.isAvailable()).isFalse();
+        assertThat(mController.isAvailable()).isEqualTo(false);
         assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
     }
 
diff --git a/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsUnlockCategoryControllerTest.java b/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsUnlockCategoryControllerTest.java
new file mode 100644
index 0000000..7b6a70e
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsUnlockCategoryControllerTest.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2023 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.biometrics.fingerprint;
+
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
+import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.hardware.fingerprint.FingerprintManager;
+
+import com.android.settings.testutils.shadow.ShadowUtils;
+import com.android.settingslib.RestrictedSwitchPreference;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+import org.robolectric.util.ReflectionHelpers;
+
+@RunWith(RobolectricTestRunner.class)
+@Config(shadows = {ShadowUtils.class})
+public class FingerprintSettingsUnlockCategoryControllerTest {
+
+    @Mock
+    private FingerprintManager mFingerprintManager;
+    @Mock
+    private PackageManager mPackageManager;
+    @Mock
+    private RestrictedSwitchPreference mPreference;
+
+    private Context mContext;
+    private FingerprintSettingsRequireScreenOnToAuthPreferenceController mController;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mContext = spy(RuntimeEnvironment.application);
+        when(mContext.getSystemService(eq(Context.FINGERPRINT_SERVICE))).thenReturn(
+                mFingerprintManager);
+        when(mContext.getPackageManager()).thenReturn(mPackageManager);
+
+        mController = spy(new FingerprintSettingsRequireScreenOnToAuthPreferenceController(mContext,
+                "test_key"));
+        ReflectionHelpers.setField(mController, "mFingerprintManager", mFingerprintManager);
+    }
+
+    @After
+    public void tearDown() {
+        ShadowUtils.reset();
+    }
+
+    @Test
+    public void isAvailable_isEnabled_whenSfpsHardwareDetected_AndHasEnrolledFingerprints() {
+        assertThat(mController.isAvailable()).isEqualTo(false);
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+        configure_hardwareDetected_isSfps_hasEnrolledTemplates(
+                true /* isHardwareDetected */,
+                true /* isPowerbuttonFps */,
+                true /* hasEnrolledTemplates */);
+        assertThat(mController.isAvailable()).isEqualTo(true);
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
+    }
+
+    @Test
+    public void isUnavailable_isDisabled_whenSfpsHardwareDetected_AndNoEnrolledFingerprints() {
+        assertThat(mController.isAvailable()).isEqualTo(false);
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+        configure_hardwareDetected_isSfps_hasEnrolledTemplates(
+                true /* isHardwareDetected */,
+                true /* isPowerbuttonFps */,
+                false /* hasEnrolledTemplates */);
+        assertThat(mController.isAvailable()).isEqualTo(false);
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
+    }
+
+    @Test
+    public void isUnavailable_whenHardwareNotDetected() {
+        assertThat(mController.isAvailable()).isFalse();
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+        configure_hardwareDetected_isSfps_hasEnrolledTemplates(
+                false /* isHardwareDetected */,
+                true /* isPowerbuttonFps */,
+                true /* hasEnrolledTemplates */);
+        assertThat(mController.isAvailable()).isEqualTo(false);
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+    }
+
+    @Test
+    public void isUnavailable_onNonSfpsDevice() {
+        assertThat(mController.isAvailable()).isFalse();
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+        configure_hardwareDetected_isSfps_hasEnrolledTemplates(
+                true /* isHardwareDetected */,
+                false /* isPowerbuttonFps */,
+                true /* hasEnrolledTemplates */);
+        assertThat(mController.isAvailable()).isFalse();
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+    }
+
+    private void configure_hardwareDetected_isSfps_hasEnrolledTemplates(
+            boolean isHardwareDetected, boolean isPowerbuttonFps, boolean hasEnrolledTemplates) {
+        when(mFingerprintManager.isHardwareDetected()).thenReturn(isHardwareDetected);
+        when(mFingerprintManager.isPowerbuttonFps()).thenReturn(isPowerbuttonFps);
+        when(mFingerprintManager.hasEnrolledTemplates(anyInt())).thenReturn(hasEnrolledTemplates);
+    }
+
+}
diff --git a/tests/robotests/src/com/android/settings/location/LocationSwitchBarControllerTest.java b/tests/robotests/src/com/android/settings/location/LocationSwitchBarControllerTest.java
index 348f64d..50f618f 100644
--- a/tests/robotests/src/com/android/settings/location/LocationSwitchBarControllerTest.java
+++ b/tests/robotests/src/com/android/settings/location/LocationSwitchBarControllerTest.java
@@ -23,6 +23,7 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
+import android.os.UserManager;
 import android.provider.Settings;
 import android.widget.Switch;
 
@@ -109,13 +110,25 @@
     }
 
     @Test
+    public void onLocationModeChanged_Restricted_shouldDisableSwitchByAdmin() {
+        final RestrictedLockUtils.EnforcedAdmin admin = RestrictedLockUtils.EnforcedAdmin
+                .createDefaultEnforcedAdminWithRestriction(UserManager.DISALLOW_SHARE_LOCATION);
+        doReturn(null).when(mEnabler).getShareLocationEnforcedAdmin(anyInt());
+        doReturn(false).when(mEnabler).hasShareLocationRestriction(anyInt());
+
+        mController.onLocationModeChanged(Settings.Secure.LOCATION_MODE_BATTERY_SAVING, true);
+
+        verify(mSwitchBar).setDisabledByAdmin(admin);
+    }
+
+    @Test
     public void onLocationModeChanged_Restricted_shouldDisableSwitch() {
         doReturn(null).when(mEnabler).getShareLocationEnforcedAdmin(anyInt());
         doReturn(true).when(mEnabler).hasShareLocationRestriction(anyInt());
 
-        mController.onLocationModeChanged(Settings.Secure.LOCATION_MODE_BATTERY_SAVING, true);
+        mController.onLocationModeChanged(Settings.Secure.LOCATION_MODE_BATTERY_SAVING, false);
 
-        verify(mSwitchBar).setEnabled(false);
+        verify(mSwitchBar).setEnabled(true);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/widget/SettingsMainSwitchBarTest.java b/tests/robotests/src/com/android/settings/widget/SettingsMainSwitchBarTest.java
new file mode 100644
index 0000000..dc69d8e
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/widget/SettingsMainSwitchBarTest.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2023 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.widget;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+import android.widget.TextView;
+
+import com.android.settingslib.R;
+import com.android.settingslib.RestrictedLockUtils;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class SettingsMainSwitchBarTest {
+
+    private SettingsMainSwitchBar mMainSwitchBar;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        final Context context = RuntimeEnvironment.application;
+        mMainSwitchBar = new SettingsMainSwitchBar(context);
+    }
+
+    @Test
+    public void disabledByAdmin_shouldBeDisabled() {
+        mMainSwitchBar.setDisabledByAdmin(new RestrictedLockUtils.EnforcedAdmin());
+
+        TextView title = (TextView) mMainSwitchBar.findViewById(R.id.switch_text);
+        assertThat(title.isEnabled()).isFalse();
+        assertThat(mMainSwitchBar.getSwitch().isEnabled()).isFalse();
+    }
+
+    @Test
+    public void disabledByAdmin_setNull_shouldBeEnabled() {
+        mMainSwitchBar.setDisabledByAdmin(null);
+
+        TextView title = (TextView) mMainSwitchBar.findViewById(R.id.switch_text);
+        assertThat(title.isEnabled()).isTrue();
+        assertThat(mMainSwitchBar.getSwitch().isEnabled()).isTrue();
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
index 0a54c88..fe663ab 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
@@ -16,10 +16,12 @@
 
 package com.android.settings.wifi.tether;
 
+import static android.net.wifi.SoftApConfiguration.SECURITY_TYPE_WPA3_SAE;
 import static android.view.View.INVISIBLE;
 import static android.view.View.VISIBLE;
 
 import static com.android.settings.wifi.WifiUtils.setCanShowWifiHotspotCached;
+import static com.android.settings.wifi.repository.WifiHotspotRepository.BAND_2GHZ_5GHZ_6GHZ;
 import static com.android.settings.wifi.tether.WifiTetherSettings.KEY_WIFI_HOTSPOT_SECURITY;
 import static com.android.settings.wifi.tether.WifiTetherSettings.KEY_WIFI_HOTSPOT_SPEED;
 
@@ -41,6 +43,7 @@
 import android.content.res.Resources;
 import android.net.ConnectivityManager;
 import android.net.TetheringManager;
+import android.net.wifi.SoftApConfiguration;
 import android.net.wifi.WifiManager;
 import android.os.Bundle;
 import android.os.UserManager;
@@ -84,6 +87,8 @@
 
     private static final int XML_RES = R.xml.wifi_tether_settings;
     private static final String[] WIFI_REGEXS = {"wifi_regexs"};
+    private static final String SSID = "ssid";
+    private static final String PASSWORD = "password";
 
     @Rule
     public final MockitoRule mMockitoRule = MockitoJUnit.rule();
@@ -117,6 +122,12 @@
     private LiveData<Integer> mSpeedSummary;
     @Mock
     private SettingsMainSwitchBar mMainSwitchBar;
+    @Mock
+    private WifiTetherSSIDPreferenceController mSSIDPreferenceController;
+    @Mock
+    private WifiTetherPasswordPreferenceController mPasswordPreferenceController;
+    @Mock
+    private WifiTetherAutoOffPreferenceController mWifiTetherAutoOffPreferenceController;
 
     private WifiTetherSettings mSettings;
 
@@ -143,6 +154,12 @@
 
         mSettings = spy(new WifiTetherSettings(mWifiRestriction));
         mSettings.mMainSwitchBar = mMainSwitchBar;
+        mSettings.mSSIDPreferenceController = mSSIDPreferenceController;
+        when(mSSIDPreferenceController.getSSID()).thenReturn(SSID);
+        mSettings.mPasswordPreferenceController = mPasswordPreferenceController;
+        when(mPasswordPreferenceController.getPasswordValidated(anyInt())).thenReturn(PASSWORD);
+        mSettings.mWifiTetherAutoOffPreferenceController = mWifiTetherAutoOffPreferenceController;
+        when(mWifiTetherAutoOffPreferenceController.isEnabled()).thenReturn(true);
         mSettings.mWifiTetherViewModel = mWifiTetherViewModel;
         when(mSettings.findPreference(KEY_WIFI_HOTSPOT_SECURITY)).thenReturn(mWifiHotspotSecurity);
         when(mSettings.findPreference(KEY_WIFI_HOTSPOT_SPEED)).thenReturn(mWifiHotspotSpeed);
@@ -327,6 +344,22 @@
     }
 
     @Test
+    public void buildNewConfig_speedFeatureIsAvailableAndPasswordChanged_bandShouldNotBeLost() {
+        String newPassword = "new" + PASSWORD;
+        SoftApConfiguration currentConfig = new SoftApConfiguration.Builder()
+                .setPassphrase(PASSWORD, SECURITY_TYPE_WPA3_SAE)
+                .setBand(BAND_2GHZ_5GHZ_6GHZ)
+                .build();
+        when(mWifiTetherViewModel.getSoftApConfiguration()).thenReturn(currentConfig);
+        when(mWifiTetherViewModel.isSpeedFeatureAvailable()).thenReturn(true);
+        when(mPasswordPreferenceController.getPasswordValidated(anyInt())).thenReturn(newPassword);
+
+        SoftApConfiguration newConfig = mSettings.buildNewConfig();
+
+        assertThat(newConfig.getBand()).isEqualTo(currentConfig.getBand());
+    }
+
+    @Test
     public void onRestartingChanged_restartingFalse_setLoadingFalse() {
         doNothing().when(mSettings).setLoading(anyBoolean(), anyBoolean());
 
diff --git a/tests/unit/src/com/android/settings/applications/credentials/CredentialManagerPreferenceControllerTest.java b/tests/unit/src/com/android/settings/applications/credentials/CredentialManagerPreferenceControllerTest.java
index 2a2aaee..3145cce 100644
--- a/tests/unit/src/com/android/settings/applications/credentials/CredentialManagerPreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/applications/credentials/CredentialManagerPreferenceControllerTest.java
@@ -123,6 +123,25 @@
     }
 
     @Test
+    public void verifyHiddenIfAutofillSelectedProvider() {
+        CredentialManagerPreferenceController controller =
+                createControllerWithServices(Collections.emptyList());
+
+        // Set the autofill provider.
+        Settings.Secure.putStringForUser(mContext.getContentResolver(),
+                Settings.Secure.AUTOFILL_SERVICE, "com.example.test/AutofillClass",
+                UserHandle.myUserId());
+
+        // Verify the error cases
+        assertThat(controller.isProviderHiddenBecauseOfAutofill(null)).isFalse();
+        assertThat(controller.isProviderHiddenBecauseOfAutofill("")).isFalse();
+        assertThat(controller.isProviderHiddenBecauseOfAutofill("test")).isFalse();
+
+        // Verify the example.
+        assertThat(controller.isProviderHiddenBecauseOfAutofill("com.example.test")).isTrue();
+    }
+
+    @Test
     public void displayPreference_noServices_noPreferencesAdded_useAutofillUri() {
         Settings.Secure.putStringForUser(
                 mContext.getContentResolver(),
diff --git a/tests/unit/src/com/android/settings/localepicker/LocaleDialogFragmentTest.java b/tests/unit/src/com/android/settings/localepicker/LocaleDialogFragmentTest.java
index 5b10adf..b0998c0 100644
--- a/tests/unit/src/com/android/settings/localepicker/LocaleDialogFragmentTest.java
+++ b/tests/unit/src/com/android/settings/localepicker/LocaleDialogFragmentTest.java
@@ -38,6 +38,7 @@
 import androidx.test.core.app.ApplicationProvider;
 
 import com.android.internal.app.LocaleStore;
+import com.android.settings.testutils.FakeFeatureFactory;
 import com.android.settings.testutils.ResourcesUtils;
 
 import org.junit.Before;
@@ -55,11 +56,13 @@
 
     private Context mContext;
     private LocaleDialogFragment mDialogFragment;
+    private FakeFeatureFactory mFeatureFactory;
 
     @Before
     public void setUp() throws Exception {
         mContext = ApplicationProvider.getApplicationContext();
         mDialogFragment = new LocaleDialogFragment();
+        mFeatureFactory = FakeFeatureFactory.setupForTest();
     }
 
     private void setArgument(
@@ -112,6 +115,8 @@
         controller.onClick(null, DialogInterface.BUTTON_POSITIVE);
 
         verify(resultReceiver).send(eq(Activity.RESULT_OK), any());
+        verify(mFeatureFactory.metricsFeatureProvider).action(
+                mContext, SettingsEnums.ACTION_CHANGE_LANGUAGE, true);
     }
 
     @Test
@@ -124,6 +129,8 @@
         controller.onClick(null, DialogInterface.BUTTON_NEGATIVE);
 
         verify(resultReceiver).send(eq(Activity.RESULT_CANCELED), any());
+        verify(mFeatureFactory.metricsFeatureProvider).action(
+                mContext, SettingsEnums.ACTION_CHANGE_LANGUAGE, false);
     }
 
     @Test
diff --git a/tests/unit/src/com/android/settings/localepicker/LocaleHelperPreferenceControllerTest.java b/tests/unit/src/com/android/settings/localepicker/LocaleHelperPreferenceControllerTest.java
index 31b8e79..5ac367e 100644
--- a/tests/unit/src/com/android/settings/localepicker/LocaleHelperPreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/localepicker/LocaleHelperPreferenceControllerTest.java
@@ -19,12 +19,14 @@
 import static org.mockito.Mockito.anyString;
 import static org.mockito.Mockito.verify;
 
+import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.os.Looper;
 
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 
+import com.android.settings.testutils.FakeFeatureFactory;
 import com.android.settingslib.widget.FooterPreference;
 
 import org.junit.Before;
@@ -37,6 +39,7 @@
 public class LocaleHelperPreferenceControllerTest {
     private Context mContext;
     private LocaleHelperPreferenceController mLocaleHelperPreferenceController;
+    private FakeFeatureFactory mFeatureFactory;
 
     @Mock
     private FooterPreference mMockFooterPreference;
@@ -49,11 +52,16 @@
         }
         mContext = ApplicationProvider.getApplicationContext();
         mLocaleHelperPreferenceController = new LocaleHelperPreferenceController(mContext);
+        mFeatureFactory = FakeFeatureFactory.setupForTest();
     }
 
     @Test
     public void updateFooterPreference_setFooterPreference_hasClickAction() {
         mLocaleHelperPreferenceController.updateFooterPreference(mMockFooterPreference);
         verify(mMockFooterPreference).setLearnMoreText(anyString());
+        mMockFooterPreference.setLearnMoreAction(v -> {
+            verify(mFeatureFactory.metricsFeatureProvider).action(
+                    mContext, SettingsEnums.ACTION_LANGUAGES_LEARN_MORE);
+        });
     }
 }