Merge "Refine Settings textColor" into udc-dev
diff --git a/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml b/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml
deleted file mode 100644
index 11bb0ae..0000000
--- a/res/layout-land/wifi_dpp_qrcode_scanner_fragment.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright (C) 2018 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<com.google.android.setupdesign.GlifLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:icon="@drawable/ic_scan_32dp"
-    app:sudDescriptionText="@string/wifi_dpp_scan_qr_code_join_unknown_network">
-
-    <LinearLayout
-        style="@style/SudContentFrame"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:gravity="center_horizontal"
-        android:orientation="vertical">
-
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:gravity="center"
-            android:orientation="vertical">
-
-            <FrameLayout
-                android:layout_width="@dimen/qrcode_preview_size"
-                android:layout_height="@dimen/qrcode_preview_size"
-                android:clipChildren="true">
-                <TextureView
-                    android:id="@+id/preview_view"
-                    android:layout_width="wrap_content"
-                    android:layout_height="match_parent"/>
-                <com.android.settingslib.qrcode.QrDecorateView
-                    android:id="@+id/decorate_view"
-                    android:layout_width="wrap_content"
-                    android:layout_height="match_parent"/>
-            </FrameLayout>
-
-            <TextView
-                android:id="@+id/error_message"
-                style="@style/TextAppearance.ErrorText"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="16dp"
-                android:layout_marginStart="?attr/sudMarginStart"
-                android:layout_marginEnd="?attr/sudMarginEnd"
-                android:textAlignment="center"
-                android:visibility="invisible"/>
-
-        </LinearLayout>
-
-    </LinearLayout>
-
-</com.google.android.setupdesign.GlifLayout>
-
diff --git a/res/layout/wifi_dpp_qrcode_scanner_fragment.xml b/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
index dd96d7e..84470ba 100644
--- a/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
+++ b/res/layout/wifi_dpp_qrcode_scanner_fragment.xml
@@ -36,19 +36,31 @@
             android:gravity="center"
             android:orientation="vertical">
 
-            <FrameLayout
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:clipChildren="true">
-                <TextureView
-                    android:id="@+id/preview_view"
-                    android:layout_width="match_parent"
-                    android:layout_height="@dimen/qrcode_preview_size"/>
-                <com.android.settingslib.qrcode.QrDecorateView
-                    android:id="@+id/decorate_view"
-                    android:layout_width="match_parent"
-                    android:layout_height="@dimen/qrcode_preview_size"/>
-            </FrameLayout>
+            <androidx.constraintlayout.widget.ConstraintLayout
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:maxWidth="@dimen/qrcode_preview_size"
+                android:maxHeight="@dimen/qrcode_preview_size">
+
+                <FrameLayout
+                    android:layout_width="0dp"
+                    android:layout_height="0dp"
+                    app:layout_constraintDimensionRatio="1:1"
+                    app:layout_constraintTop_toTopOf="parent"
+                    app:layout_constraintStart_toStartOf="parent"
+                    app:layout_constraintEnd_toEndOf="parent"
+                    android:clipChildren="true">
+                    <TextureView
+                        android:id="@+id/preview_view"
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"/>
+                    <com.android.settingslib.qrcode.QrDecorateView
+                        android:id="@+id/decorate_view"
+                        android:layout_width="match_parent"
+                        android:layout_height="match_parent"/>
+                </FrameLayout>
+
+            </androidx.constraintlayout.widget.ConstraintLayout>
 
             <TextView
                 android:id="@+id/error_message"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5f40087..b12f390 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -818,6 +818,10 @@
     <string name="biometric_settings_intro_with_fingerprint">You can unlock with your watch when your fingerprint isn\u2019t recognized.</string>
      <!-- Introduction shown in face page to explain that watch unlock can be used if face isn't recognized. [CHAR LIMIT=NONE]-->
     <string name="biometric_settings_intro_with_face">You can unlock with your watch when your face isn\u2019t recognized.</string>
+    <string name="biometric_settings_use_fingerprint_or_watch_for"> Use fingerprint or watch to</string>
+    <string name="biometric_settings_use_face_or_watch_for"> Use face or watch to</string>
+    <string name="biometric_settings_use_face_fingerprint_or_watch_for"> Use face, fingerprint, or watch to</string>
+    <string name="biometric_settings_use_watch_for"> Use watch to</string>
     <!-- Message for a biometric preference toggle, indicating that an action can only be performed by using Face Unlock or Watch Unlock. [CHAR LIMIT=50] -->
     <string name="biometric_settings_use_face_or_watch_preference_summary">Using face or watch</string>
     <!-- Message for a biometric preference toggle, indicating that an action can only be performed by using Fingerprint Unlock or Watch Unlock. [CHAR LIMIT=50] -->
@@ -5175,7 +5179,7 @@
     <!-- Title for the battery limited temporarily tip [CHAR LIMIT=NONE] -->
     <string name="battery_tip_limited_temporarily_title">Charging optimized to protect your battery</string>
     <!-- Summary for the battery limited temporarily tip [CHAR LIMIT=NONE] -->
-    <string name="battery_tip_limited_temporarily_summary">To help extend your batter\'s lifespan, charging is optimized</string>
+    <string name="battery_tip_limited_temporarily_summary">To help extend your battery\'s lifespan, charging is optimized</string>
     <!-- Title for the battery dock defender future bypass tip [CHAR LIMIT=NONE] -->
     <string name="battery_tip_dock_defender_future_bypass_title">Charging optimized to protect your battery</string>
     <!-- Summary for the battery dock defender future bypass tip [CHAR LIMIT=NONE] -->
diff --git a/res/xml/accounts_work_dashboard_settings_credman.xml b/res/xml/accounts_work_dashboard_settings_credman.xml
index 1529920..bb9976e 100644
--- a/res/xml/accounts_work_dashboard_settings_credman.xml
+++ b/res/xml/accounts_work_dashboard_settings_credman.xml
@@ -28,8 +28,8 @@
         android:title="@string/credman_chosen_app_title">
 
         <com.android.settings.widget.GearPreference
-            android:fragment="com.android.settings.applications.credentials.DefaultCombinedPicker"
-            android:key="default_credman_autofill_main"
+            android:fragment="com.android.settings.applications.credentials.DefaultCombinedPickerWork"
+            android:key="default_credman_autofill_main_work"
             android:title="@string/credman_chosen_app_title"
             settings:searchable="false">
             <extra
diff --git a/res/xml/flash_notifications_settings.xml b/res/xml/flash_notifications_settings.xml
index 63937b1..85cc2cb 100644
--- a/res/xml/flash_notifications_settings.xml
+++ b/res/xml/flash_notifications_settings.xml
@@ -27,7 +27,8 @@
     <com.android.settingslib.widget.IllustrationPreference
         android:key="flash_notifications_illustration"
         settings:searchable="false"
-        settings:lottie_rawRes="@drawable/flash_notifications_illustration" />
+        settings:lottie_rawRes="@drawable/flash_notifications_illustration"
+        settings:controller="com.android.settings.accessibility.FlashNotificationIllustrationPreferenceController"/>
 
     <SwitchPreference
         android:key="camera_flash_notification_preference"
diff --git a/src/com/android/settings/SettingsApplication.java b/src/com/android/settings/SettingsApplication.java
index 49cb85e..7d8055d 100644
--- a/src/com/android/settings/SettingsApplication.java
+++ b/src/com/android/settings/SettingsApplication.java
@@ -22,9 +22,8 @@
 import android.provider.Settings;
 import android.util.FeatureFlagUtils;
 
-import androidx.window.embedding.SplitController;
-
 import com.android.settings.activityembedding.ActivityEmbeddingRulesController;
+import com.android.settings.activityembedding.ActivityEmbeddingUtils;
 import com.android.settings.core.instrumentation.ElapsedTimeUtils;
 import com.android.settings.homepage.SettingsHomepageActivity;
 import com.android.settings.spa.SettingsSpaEnvironment;
@@ -53,7 +52,7 @@
         setSpaEnvironment();
 
         if (FeatureFlagUtils.isEnabled(this, FeatureFlagUtils.SETTINGS_SUPPORT_LARGE_SCREEN)
-                && SplitController.getInstance(this).isSplitSupported()) {
+                && ActivityEmbeddingUtils.isSettingsSplitEnabled(this)) {
             if (WizardManagerHelper.isUserSetupComplete(this)) {
                 new ActivityEmbeddingRulesController(this).initRules();
             } else {
diff --git a/src/com/android/settings/SettingsInitialize.java b/src/com/android/settings/SettingsInitialize.java
index 1d23523..37a564b 100644
--- a/src/com/android/settings/SettingsInitialize.java
+++ b/src/com/android/settings/SettingsInitialize.java
@@ -37,9 +37,9 @@
 import android.util.Log;
 
 import androidx.annotation.VisibleForTesting;
-import androidx.window.embedding.SplitController;
 
 import com.android.settings.Settings.CreateShortcutActivity;
+import com.android.settings.activityembedding.ActivityEmbeddingUtils;
 import com.android.settings.homepage.DeepLinkHomepageActivity;
 import com.android.settings.search.SearchStateReceiver;
 import com.android.settingslib.utils.ThreadUtils;
@@ -166,7 +166,7 @@
                 DeepLinkHomepageActivity.class);
         final ComponentName searchStateReceiver = new ComponentName(context,
                 SearchStateReceiver.class);
-        final int enableState = SplitController.getInstance(context).isSplitSupported()
+        final int enableState = ActivityEmbeddingUtils.isSettingsSplitEnabled(context)
                 ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
                 : PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
         pm.setComponentEnabledSetting(deepLinkHome, enableState, PackageManager.DONT_KILL_APP);
diff --git a/src/com/android/settings/accessibility/FlashNotificationIllustrationPreferenceController.java b/src/com/android/settings/accessibility/FlashNotificationIllustrationPreferenceController.java
new file mode 100644
index 0000000..9332f45
--- /dev/null
+++ b/src/com/android/settings/accessibility/FlashNotificationIllustrationPreferenceController.java
@@ -0,0 +1,46 @@
+/*
+ * 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.accessibility;
+
+import android.content.Context;
+import android.os.SystemProperties;
+import android.util.ArraySet;
+
+import com.android.settings.core.BasePreferenceController;
+
+import java.util.Collections;
+import java.util.Set;
+
+/** Preference controller for illustration in flash notifications page. */
+public class FlashNotificationIllustrationPreferenceController extends BasePreferenceController {
+
+    public FlashNotificationIllustrationPreferenceController(Context context,
+            String preferenceKey) {
+        super(context, preferenceKey);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        // TODO(b/280748155): Update tablet illustration when it's available. Hide it for now.
+        String characteristics = SystemProperties.get("ro.build.characteristics");
+        String[] characteristicsSplit = characteristics.split(",");
+        Set<String> productCharacteristics = new ArraySet<>(characteristicsSplit.length);
+        Collections.addAll(productCharacteristics, characteristicsSplit);
+        final boolean isTablet = productCharacteristics.contains("tablet");
+        return isTablet ? UNSUPPORTED_ON_DEVICE : AVAILABLE;
+    }
+}
diff --git a/src/com/android/settings/accounts/AccountDashboardFragment.java b/src/com/android/settings/accounts/AccountDashboardFragment.java
index e4c2031..7816fd7 100644
--- a/src/com/android/settings/accounts/AccountDashboardFragment.java
+++ b/src/com/android/settings/accounts/AccountDashboardFragment.java
@@ -86,7 +86,7 @@
                     forceUpdatePreferences();
                 }
             };
-            cmpp.init(this, getFragmentManager(), getIntent(), delegate);
+            cmpp.init(this, getFragmentManager(), getIntent(), delegate, /*isWorkProfile=*/false);
         } else {
             getSettingsLifecycle().addObserver(use(PasswordsPreferenceController.class));
         }
diff --git a/src/com/android/settings/accounts/AccountPersonalDashboardFragment.java b/src/com/android/settings/accounts/AccountPersonalDashboardFragment.java
index 32c3c13..cd1cd5c 100644
--- a/src/com/android/settings/accounts/AccountPersonalDashboardFragment.java
+++ b/src/com/android/settings/accounts/AccountPersonalDashboardFragment.java
@@ -78,7 +78,7 @@
                     forceUpdatePreferences();
                 }
             };
-            cmpp.init(this, getFragmentManager(), getIntent(), delegate);
+            cmpp.init(this, getFragmentManager(), getIntent(), delegate, /*isWorkProfile=*/false);
         } else {
             getSettingsLifecycle().addObserver(use(PasswordsPreferenceController.class));
         }
diff --git a/src/com/android/settings/accounts/AccountWorkProfileDashboardFragment.java b/src/com/android/settings/accounts/AccountWorkProfileDashboardFragment.java
index 39146c7..f0da2fb 100644
--- a/src/com/android/settings/accounts/AccountWorkProfileDashboardFragment.java
+++ b/src/com/android/settings/accounts/AccountWorkProfileDashboardFragment.java
@@ -78,7 +78,7 @@
                     forceUpdatePreferences();
                 }
             };
-            cmpp.init(this, getFragmentManager(), getIntent(), delegate);
+            cmpp.init(this, getFragmentManager(), getIntent(), delegate, /*isWorkProfile=*/true);
         } else {
             getSettingsLifecycle().addObserver(use(PasswordsPreferenceController.class));
         }
diff --git a/src/com/android/settings/activityembedding/ActivityEmbeddingUtils.java b/src/com/android/settings/activityembedding/ActivityEmbeddingUtils.java
index a0dac5a..ae890f8 100644
--- a/src/com/android/settings/activityembedding/ActivityEmbeddingUtils.java
+++ b/src/com/android/settings/activityembedding/ActivityEmbeddingUtils.java
@@ -18,6 +18,7 @@
 
 import android.app.Activity;
 import android.content.Context;
+import android.os.SystemProperties;
 import android.util.DisplayMetrics;
 import android.util.FeatureFlagUtils;
 import android.util.Log;
@@ -39,6 +40,21 @@
     private static final int MIN_SMALLEST_SCREEN_SPLIT_WIDTH_DP = 600;
     // The minimum width of the activity to show the regular homepage layout.
     private static final float MIN_REGULAR_HOMEPAGE_LAYOUT_WIDTH_DP = 380f;
+
+    /**
+     * Indicates whether to enable large screen optimization if the device supports
+     * the Activity Embedding split feature.
+     * <p>
+     * Note that the large screen optimization won't be enabled if the device doesn't support the
+     * Activity Embedding feature regardless of this property value.
+     *
+     * @see androidx.window.embedding.SplitController#getSplitSupportStatus
+     * @see androidx.window.embedding.SplitController.SplitSupportStatus#SPLIT_AVAILABLE
+     * @see androidx.window.embedding.SplitController.SplitSupportStatus#SPLIT_UNAVAILABLE
+     */
+    private static final boolean SHOULD_ENABLE_LARGE_SCREEN_OPTIMIZATION =
+            SystemProperties.getBoolean("persist.settings.large_screen_opt.enabled", true);
+
     private static final String TAG = "ActivityEmbeddingUtils";
 
     /** Get the smallest width dp of the window when the split should be used. */
@@ -62,18 +78,35 @@
         return context.getResources().getFloat(R.dimen.config_activity_embed_split_ratio);
     }
 
-    /** Whether to support embedding activity feature. */
+    /**
+     * Returns {@code true} to indicate that Settings app support the Activity Embedding feature on
+     * this device. Returns {@code false}, otherwise.
+     */
+    public static boolean isSettingsSplitEnabled(Context context) {
+        return SHOULD_ENABLE_LARGE_SCREEN_OPTIMIZATION
+                && SplitController.getInstance(context).getSplitSupportStatus()
+                == SplitController.SplitSupportStatus.SPLIT_AVAILABLE;
+    }
+
+    /**
+     * Checks whether to support embedding activity feature with following conditions:
+     * <ul>
+     *     <li>Whether {@link #isSettingsSplitEnabled(Context)}</li>
+     *     <li>Whether {@link FeatureFlagUtils#SETTINGS_SUPPORT_LARGE_SCREEN} is enabled</li>
+     *     <li>Whether User setup is completed</li>
+     * </ul>
+     */
     public static boolean isEmbeddingActivityEnabled(Context context) {
         boolean isFlagEnabled = FeatureFlagUtils.isEnabled(context,
                 FeatureFlagUtils.SETTINGS_SUPPORT_LARGE_SCREEN);
-        boolean isSplitSupported = SplitController.getInstance(context).isSplitSupported();
+        boolean isSettingsSplitSupported = isSettingsSplitEnabled(context);
         boolean isUserSetupComplete = WizardManagerHelper.isUserSetupComplete(context);
 
         Log.d(TAG, "isFlagEnabled = " + isFlagEnabled);
-        Log.d(TAG, "isSplitSupported = " + isSplitSupported);
+        Log.d(TAG, "isSettingsSplitSupported = " + isSettingsSplitSupported);
         Log.d(TAG, "isUserSetupComplete = " + isUserSetupComplete);
 
-        return isFlagEnabled && isSplitSupported && isUserSetupComplete;
+        return isFlagEnabled && isSettingsSplitSupported && isUserSetupComplete;
     }
 
     /** Whether to show the regular or simplified homepage layout. */
diff --git a/src/com/android/settings/applications/credentials/CombinedProviderInfo.java b/src/com/android/settings/applications/credentials/CombinedProviderInfo.java
index 89a13ef..1fd3075 100644
--- a/src/com/android/settings/applications/credentials/CombinedProviderInfo.java
+++ b/src/com/android/settings/applications/credentials/CombinedProviderInfo.java
@@ -26,6 +26,7 @@
 import android.graphics.drawable.Drawable;
 import android.service.autofill.AutofillServiceInfo;
 import android.text.TextUtils;
+import android.util.IconDrawableFactory;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -83,11 +84,12 @@
 
     /** Returns the app icon. */
     @Nullable
-    public Drawable getAppIcon(@NonNull Context context) {
+    public Drawable getAppIcon(@NonNull Context context, int userId) {
+        IconDrawableFactory factory = IconDrawableFactory.newInstance(context);
         Drawable icon = null;
         ServiceInfo brandingService = getBrandingService();
         if (brandingService != null) {
-            icon = brandingService.loadIcon(context.getPackageManager());
+            icon = factory.getBadgedIcon(brandingService, getApplicationInfo(), userId);
         }
 
         // If the branding service gave us a icon then use that.
@@ -95,8 +97,8 @@
             return icon;
         }
 
-        // Otherwise fallback to the app label and then the package name.
-        return getApplicationInfo().loadIcon(context.getPackageManager());
+        // Otherwise fallback to the app icon and then the package name.
+        return factory.getBadgedIcon(getApplicationInfo(), userId);
     }
 
     /** Returns the app name. */
diff --git a/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java b/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java
index 9d86c58a..e906e48 100644
--- a/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java
+++ b/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java
@@ -41,6 +41,7 @@
 import android.os.Handler;
 import android.os.OutcomeReceiver;
 import android.os.UserHandle;
+import android.os.UserManager;
 import android.provider.Settings;
 import android.service.autofill.AutofillServiceInfo;
 import android.text.TextUtils;
@@ -110,6 +111,7 @@
     private @Nullable PreferenceScreen mPreferenceScreen = null;
 
     private boolean mVisibility = false;
+    private boolean mIsWorkProfile = false;
 
     public CredentialManagerPreferenceController(Context context, String preferenceKey) {
         super(context, preferenceKey);
@@ -169,14 +171,17 @@
      * @param fragmentManager the fragment manager to use
      * @param intent the intent used to start the activity
      * @param delegate the delegate to send results back to
+     * @param isWorkProfile whether this controller is under a work profile user
      */
     public void init(
             DashboardFragment fragment,
             FragmentManager fragmentManager,
             @Nullable Intent launchIntent,
-            @NonNull Delegate delegate) {
+            @NonNull Delegate delegate,
+            boolean isWorkProfile) {
         fragment.getSettingsLifecycle().addObserver(this);
         mFragmentManager = fragmentManager;
+        mIsWorkProfile = isWorkProfile;
         setDelegate(delegate);
         verifyReceivedIntent(launchIntent);
     }
@@ -420,7 +425,7 @@
                 continue;
             }
 
-            Drawable icon = combinedInfo.getAppIcon(context);
+            Drawable icon = combinedInfo.getAppIcon(context, getUser());
             CharSequence title = combinedInfo.getAppName(context);
 
             // Build the pref and add it to the output & group.
@@ -681,9 +686,12 @@
         return new ConfirmationDialogFragment(host, packageName, appName);
     }
 
-    private int getUser() {
-        UserHandle workUser = getWorkProfileUser();
-        return workUser != null ? workUser.getIdentifier() : UserHandle.myUserId();
+    protected int getUser() {
+        if (mIsWorkProfile) {
+            UserHandle workProfile = Utils.getManagedProfile(UserManager.get(mContext));
+            return workProfile.getIdentifier();
+        }
+        return UserHandle.myUserId();
     }
 
     /** Called when the dialog button is clicked. */
diff --git a/src/com/android/settings/applications/credentials/DefaultCombinedPicker.java b/src/com/android/settings/applications/credentials/DefaultCombinedPicker.java
index 634be4c..b8d104c 100644
--- a/src/com/android/settings/applications/credentials/DefaultCombinedPicker.java
+++ b/src/com/android/settings/applications/credentials/DefaultCombinedPicker.java
@@ -47,9 +47,7 @@
 import com.android.settingslib.widget.CandidateInfo;
 
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 public class DefaultCombinedPicker extends DefaultAppPickerFragment {
 
@@ -65,6 +63,7 @@
     private DialogInterface.OnClickListener mCancelListener;
 
     private CredentialManager mCredentialManager;
+    private int mIntentSenderUserId = -1;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
@@ -79,9 +78,11 @@
                     };
             // If mCancelListener is not null, fragment is started from
             // ACTION_REQUEST_SET_AUTOFILL_SERVICE and we should always use the calling uid.
-            mUserId = UserHandle.myUserId();
+            mIntentSenderUserId = UserHandle.myUserId();
         }
 
+        getUser();
+
         mSettingsPackageMonitor.register(activity, activity.getMainLooper(), false);
         update();
     }
@@ -167,7 +168,7 @@
                 Settings.Secure.getStringForUser(
                         getActivity().getContentResolver(),
                         Settings.Secure.AUTOFILL_SERVICE_SEARCH_URI,
-                        mUserId);
+                        getUser());
         if (TextUtils.isEmpty(searchUri)) {
             return null;
         }
@@ -177,7 +178,7 @@
         final Preference preference = new Preference(context);
         preference.setOnPreferenceClickListener(
                 p -> {
-                    context.startActivityAsUser(addNewServiceIntent, UserHandle.of(mUserId));
+                    context.startActivityAsUser(addNewServiceIntent, UserHandle.of(getUser()));
                     return true;
                 });
         preference.setTitle(R.string.print_menu_item_add_service);
@@ -212,17 +213,17 @@
     private List<CombinedProviderInfo> getAllProviders() {
         final Context context = getContext();
         final List<AutofillServiceInfo> autofillProviders =
-                AutofillServiceInfo.getAvailableServices(context, mUserId);
+                AutofillServiceInfo.getAvailableServices(context, getUser());
 
         final CredentialManager service = getCredentialProviderService();
         final List<CredentialProviderInfo> credManProviders = new ArrayList<>();
         if (service != null) {
             credManProviders.addAll(
                     service.getCredentialProviderServices(
-                            mUserId, CredentialManager.PROVIDER_FILTER_USER_PROVIDERS_ONLY));
+                            getUser(), CredentialManager.PROVIDER_FILTER_USER_PROVIDERS_ONLY));
         }
 
-        final String selectedAutofillProvider = getSelectedAutofillProvider(context, mUserId);
+        final String selectedAutofillProvider = getSelectedAutofillProvider(context, getUser());
         return CombinedProviderInfo.buildMergedList(
                 autofillProviders, credManProviders, selectedAutofillProvider);
     }
@@ -244,7 +245,7 @@
                         new DefaultAppInfo(
                                 context,
                                 mPm,
-                                mUserId,
+                                getUser(),
                                 cpi.getApplicationInfo(),
                                 cpi.getSettingsSubtitle(),
                                 true));
@@ -253,7 +254,7 @@
                         new DefaultAppInfo(
                                 context,
                                 mPm,
-                                mUserId,
+                                getUser(),
                                 brandingService,
                                 cpi.getSettingsSubtitle(),
                                 true));
@@ -350,7 +351,7 @@
         }
 
         Settings.Secure.putStringForUser(
-                getContext().getContentResolver(), AUTOFILL_SETTING, autofillProvider, mUserId);
+                getContext().getContentResolver(), AUTOFILL_SETTING, autofillProvider, getUser());
 
         final CredentialManager service = getCredentialProviderService();
         if (service == null) {
@@ -362,19 +363,24 @@
         final List<String> credManProviders = new ArrayList<>();
         for (CredentialProviderInfo cpi :
                 service.getCredentialProviderServices(
-                        mUserId, CredentialManager.PROVIDER_FILTER_USER_PROVIDERS_ONLY)) {
+                        getUser(), CredentialManager.PROVIDER_FILTER_USER_PROVIDERS_ONLY)) {
 
-            if (cpi.isEnabled()) {
+            if (cpi.isEnabled() && !cpi.isPrimary()) {
                 credManProviders.add(cpi.getServiceInfo().getComponentName().flattenToString());
             }
         }
 
         credManProviders.addAll(primaryCredManProviders);
 
+        // If there is no provider then clear all the providers.
+        if (TextUtils.isEmpty(autofillProvider) && primaryCredManProviders.isEmpty()) {
+            credManProviders.clear();
+        }
+
         service.setEnabledProviders(
                 primaryCredManProviders,
                 credManProviders,
-                mUserId,
+                getUser(),
                 ContextCompat.getMainExecutor(getContext()),
                 new OutcomeReceiver<Void, SetEnabledProvidersException>() {
                     @Override
@@ -388,4 +394,11 @@
                     }
                 });
     }
+
+    protected int getUser() {
+        if (mIntentSenderUserId >= 0) {
+            return mIntentSenderUserId;
+        }
+        return UserHandle.myUserId();
+    }
 }
diff --git a/src/com/android/settings/applications/credentials/DefaultCombinedPickerWork.java b/src/com/android/settings/applications/credentials/DefaultCombinedPickerWork.java
new file mode 100644
index 0000000..9808502
--- /dev/null
+++ b/src/com/android/settings/applications/credentials/DefaultCombinedPickerWork.java
@@ -0,0 +1,31 @@
+/*
+ * 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.applications.credentials;
+
+import android.os.UserHandle;
+import android.os.UserManager;
+
+import com.android.settings.Utils;
+
+public class DefaultCombinedPickerWork extends DefaultCombinedPicker {
+
+    @Override
+    protected int getUser() {
+        UserHandle workProfile = Utils.getManagedProfile(UserManager.get(getContext()));
+        return workProfile.getIdentifier();
+    }
+}
diff --git a/src/com/android/settings/applications/credentials/DefaultCombinedPreferenceController.java b/src/com/android/settings/applications/credentials/DefaultCombinedPreferenceController.java
index 64d4f0d..34881ab 100644
--- a/src/com/android/settings/applications/credentials/DefaultCombinedPreferenceController.java
+++ b/src/com/android/settings/applications/credentials/DefaultCombinedPreferenceController.java
@@ -24,6 +24,7 @@
 import android.content.pm.ServiceInfo;
 import android.credentials.CredentialManager;
 import android.credentials.CredentialProviderInfo;
+import android.os.UserHandle;
 import android.provider.Settings;
 import android.service.autofill.AutofillService;
 import android.service.autofill.AutofillServiceInfo;
@@ -75,13 +76,13 @@
             return null;
         }
         final AutofillSettingIntentProvider intentProvider =
-                new AutofillSettingIntentProvider(mContext, mUserId, info.getKey());
+                new AutofillSettingIntentProvider(mContext, getUser(), info.getKey());
         return intentProvider.getIntent();
     }
 
     @Override
     protected DefaultAppInfo getDefaultAppInfo() {
-        List<CombinedProviderInfo> providers = getAllProviders(mUserId);
+        List<CombinedProviderInfo> providers = getAllProviders(getUser());
         CombinedProviderInfo topProvider = CombinedProviderInfo.getTopProvider(providers);
         if (topProvider != null) {
             ServiceInfo brandingService = topProvider.getBrandingService();
@@ -89,7 +90,7 @@
                 return new DefaultAppInfo(
                         mContext,
                         mPackageManager,
-                        mUserId,
+                        getUser(),
                         topProvider.getApplicationInfo(),
                         topProvider.getSettingsSubtitle(),
                         true);
@@ -97,7 +98,7 @@
                 return new DefaultAppInfo(
                         mContext,
                         mPackageManager,
-                        mUserId,
+                        getUser(),
                         brandingService,
                         topProvider.getSettingsSubtitle(),
                         true);
@@ -178,4 +179,8 @@
             return null;
         }
     }
+
+    protected int getUser() {
+        return UserHandle.myUserId();
+    }
 }
diff --git a/src/com/android/settings/applications/credentials/DefaultWorkCombinedPreferenceController.java b/src/com/android/settings/applications/credentials/DefaultWorkCombinedPreferenceController.java
index 0990f3b..74bf9026 100644
--- a/src/com/android/settings/applications/credentials/DefaultWorkCombinedPreferenceController.java
+++ b/src/com/android/settings/applications/credentials/DefaultWorkCombinedPreferenceController.java
@@ -44,7 +44,7 @@
 
     @Override
     public String getPreferenceKey() {
-        return "default_autofill_work";
+        return "default_credman_autofill_main_work";
     }
 
     @Override
@@ -81,4 +81,9 @@
     protected void startActivity(Intent intent) {
         mContext.startActivityAsUser(intent, mUserHandle);
     }
+
+    @Override
+    protected int getUser() {
+        return mUserHandle.getIdentifier();
+    }
 }
diff --git a/src/com/android/settings/biometrics/BiometricEnrollActivity.java b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
index 4d05946..ebbe2e8 100644
--- a/src/com/android/settings/biometrics/BiometricEnrollActivity.java
+++ b/src/com/android/settings/biometrics/BiometricEnrollActivity.java
@@ -326,8 +326,8 @@
             }
         }
 
-        boolean canUseFace = mIsFaceEnrollable;
-        boolean canUseFingerprint = mIsFingerprintEnrollable;
+        boolean canUseFace = mHasFeatureFace;
+        boolean canUseFingerprint = mHasFeatureFingerprint;
         if (mParentalOptionsRequired) {
             if (mParentalOptions == null) {
                 throw new IllegalStateException("consent options required, but not set");
@@ -345,10 +345,12 @@
         } else if (canUseFace || canUseFingerprint) {
             if (mGkPwHandle == null) {
                 setOrConfirmCredentialsNow();
-            } else if (canUseFingerprint) {
+            } else if (canUseFingerprint && mIsFingerprintEnrollable) {
                 launchFingerprintOnlyEnroll();
-            } else {
+            } else if (canUseFace && mIsFaceEnrollable) {
                 launchFaceOnlyEnroll();
+            } else {
+                setOrConfirmCredentialsNow();
             }
         } else { // no modalities available
             if (mParentalOptionsRequired) {
diff --git a/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtils.java b/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtils.java
index 4ff2b87..8f9da54 100644
--- a/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtils.java
+++ b/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtils.java
@@ -268,6 +268,30 @@
         }
     }
 
+    /**
+     * Returns the preference title of how to use biometrics when active unlock is enabled.
+     */
+    public String getUseBiometricTitleForActiveUnlock() {
+        final boolean faceAllowed = Utils.hasFaceHardware(mContext);
+        final boolean fingerprintAllowed = Utils.hasFingerprintHardware(mContext);
+
+        return mContext.getString(getUseBiometricTitleRes(faceAllowed, fingerprintAllowed));
+    }
+
+    @StringRes
+    private static int getUseBiometricTitleRes(
+            boolean isFaceAllowed, boolean isFingerprintAllowed) {
+        if (isFaceAllowed && isFingerprintAllowed) {
+            return R.string.biometric_settings_use_face_fingerprint_or_watch_for;
+        } else if (isFaceAllowed) {
+            return R.string.biometric_settings_use_face_or_watch_for;
+        } else if (isFingerprintAllowed) {
+            return R.string.biometric_settings_use_fingerprint_or_watch_for;
+        } else {
+            return R.string.biometric_settings_use_watch_for;
+        }
+    }
+
     private static String getFlagState() {
         return DeviceConfig.getProperty(DeviceConfig.NAMESPACE_REMOTE_AUTH, CONFIG_FLAG_NAME);
     }
diff --git a/src/com/android/settings/biometrics/combination/CombinedBiometricSettings.java b/src/com/android/settings/biometrics/combination/CombinedBiometricSettings.java
index d0e986f..671a5b6 100644
--- a/src/com/android/settings/biometrics/combination/CombinedBiometricSettings.java
+++ b/src/com/android/settings/biometrics/combination/CombinedBiometricSettings.java
@@ -46,6 +46,7 @@
     private static final String KEY_UNLOCK_PHONE = "biometric_settings_biometric_keyguard";
     private static final String KEY_USE_IN_APPS = "biometric_settings_biometric_app";
     private static final String KEY_INTRO_PREFERENCE = "biometric_intro";
+    private static final String KEY_USE_BIOMETRIC_PREFERENCE = "biometric_ways_to_use";
 
     private ActiveUnlockStatusUtils mActiveUnlockStatusUtils;
     private CombinedBiometricStatusUtils mCombinedBiometricStatusUtils;
@@ -83,6 +84,11 @@
         if (introPreference != null) {
             introPreference.setTitle(mActiveUnlockStatusUtils.getIntroForActiveUnlock());
         }
+        final Preference useBiometricPreference = findPreference(KEY_USE_BIOMETRIC_PREFERENCE);
+        if (useBiometricPreference != null) {
+            useBiometricPreference.setTitle(
+                    mActiveUnlockStatusUtils.getUseBiometricTitleForActiveUnlock());
+        }
         getActivity().setTitle(mActiveUnlockStatusUtils.getTitleForActiveUnlock());
     }
 
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java
index 208fba7..a18839f 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java
@@ -327,7 +327,7 @@
     }
 
     /**
-     * Disable the Le Audio profile, VCP, and CSIP for each of the Le Audio devices.
+     * Disable the Le Audio profile for each of the Le Audio devices.
      *
      * @param profile the LeAudio profile
      */
@@ -336,20 +336,12 @@
             Log.e(TAG, "There is no the LE profile or no device in mProfileDeviceMap. Do nothing.");
             return;
         }
-        LocalBluetoothProfile vcp = mProfileManager.getVolumeControlProfile();
-        LocalBluetoothProfile csip = mProfileManager.getCsipSetCoordinatorProfile();
 
         for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) {
             Log.d(TAG,
                     "device:" + leAudioDevice.getDevice().getAnonymizedAddress()
                             + "disable LE profile");
             profile.setEnabled(leAudioDevice.getDevice(), false);
-            if (vcp != null) {
-                vcp.setEnabled(leAudioDevice.getDevice(), false);
-            }
-            if (csip != null) {
-                csip.setEnabled(leAudioDevice.getDevice(), false);
-            }
         }
 
         if (!SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false)) {
@@ -360,7 +352,7 @@
     }
 
     /**
-     * Enable the Le Audio profile, VCP, and CSIP for each of the Le Audio devices.
+     * Enable the Le Audio profile for each of the Le Audio devices.
      *
      * @param profile the LeAudio profile
      */
@@ -376,19 +368,11 @@
             disableProfileBeforeUserEnablesLeAudio(mProfileManager.getHeadsetProfile());
         }
 
-        LocalBluetoothProfile vcp = mProfileManager.getVolumeControlProfile();
-        LocalBluetoothProfile csip = mProfileManager.getCsipSetCoordinatorProfile();
         for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) {
             Log.d(TAG,
                     "device:" + leAudioDevice.getDevice().getAnonymizedAddress()
                             + "enable LE profile");
             profile.setEnabled(leAudioDevice.getDevice(), true);
-            if (vcp != null) {
-                vcp.setEnabled(leAudioDevice.getDevice(), true);
-            }
-            if (csip != null) {
-                csip.setEnabled(leAudioDevice.getDevice(), true);
-            }
         }
     }
 
diff --git a/src/com/android/settings/homepage/SettingsHomepageActivity.java b/src/com/android/settings/homepage/SettingsHomepageActivity.java
index 7713e27..03bc1b3 100644
--- a/src/com/android/settings/homepage/SettingsHomepageActivity.java
+++ b/src/com/android/settings/homepage/SettingsHomepageActivity.java
@@ -58,7 +58,6 @@
 import androidx.fragment.app.FragmentManager;
 import androidx.fragment.app.FragmentTransaction;
 import androidx.window.embedding.ActivityEmbeddingController;
-import androidx.window.embedding.SplitController;
 import androidx.window.embedding.SplitRule;
 
 import com.android.settings.R;
@@ -429,7 +428,7 @@
 
     private boolean shouldLaunchDeepLinkIntentToRight() {
         if (!FeatureFlagUtils.isEnabled(this, FeatureFlagUtils.SETTINGS_SUPPORT_LARGE_SCREEN)
-                || !SplitController.getInstance(this).isSplitSupported()) {
+                || !ActivityEmbeddingUtils.isSettingsSplitEnabled(this)) {
             return false;
         }
 
diff --git a/src/com/android/settings/password/ChooseLockPattern.java b/src/com/android/settings/password/ChooseLockPattern.java
index 707eebf..dc36220 100644
--- a/src/com/android/settings/password/ChooseLockPattern.java
+++ b/src/com/android/settings/password/ChooseLockPattern.java
@@ -798,7 +798,12 @@
             // If the stage changed, announce the header for accessibility. This
             // is a no-op when accessibility is disabled.
             if (previousStage != stage || announceAlways) {
-                mHeaderText.announceForAccessibility(mHeaderText.getText());
+                if (stage == Stage.NeedToConfirm) {
+                    // If the Stage is NeedToConfirm, move the a11y focus to the header.
+                    mHeaderText.requestAccessibilityFocus();
+                } else {
+                    mHeaderText.announceForAccessibility(mHeaderText.getText());
+                }
             }
         }
 
diff --git a/tests/robotests/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtilsTest.java b/tests/robotests/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtilsTest.java
index d420f78..e5eac12 100644
--- a/tests/robotests/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/biometrics/activeunlock/ActiveUnlockStatusUtilsTest.java
@@ -222,4 +222,44 @@
                 .isEqualTo(mApplicationContext.getString(
                         R.string.biometric_settings_use_face_or_watch_preference_summary));
     }
+
+    @Test
+    public void getUseBiometricTitle_faceAndFingerprintEnabled_returnsFaceFingerprintOrWatch() {
+        when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
+        when(mFaceManager.isHardwareDetected()).thenReturn(true);
+
+        assertThat(mActiveUnlockStatusUtils.getUseBiometricTitleForActiveUnlock())
+                .isEqualTo(mApplicationContext.getString(
+                        R.string.biometric_settings_use_face_fingerprint_or_watch_for));
+    }
+
+    @Test
+    public void getUseBiometricTitle_fingerprintEnabled_returnsFingerprintOrWatch() {
+        when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
+        when(mFaceManager.isHardwareDetected()).thenReturn(false);
+
+        assertThat(mActiveUnlockStatusUtils.getUseBiometricTitleForActiveUnlock())
+                .isEqualTo(mApplicationContext.getString(
+                        R.string.biometric_settings_use_fingerprint_or_watch_for));
+    }
+
+    @Test
+    public void getUseBiometricTitle_faceEnabled_returnsFaceOrWatch() {
+        when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
+        when(mFaceManager.isHardwareDetected()).thenReturn(true);
+
+        assertThat(mActiveUnlockStatusUtils.getUseBiometricTitleForActiveUnlock())
+                .isEqualTo(mApplicationContext.getString(
+                        R.string.biometric_settings_use_face_or_watch_for));
+    }
+
+    @Test
+    public void getUseBiometricTitle_withoutFaceOrFingerprint_returnsWatch() {
+        when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
+        when(mFaceManager.isHardwareDetected()).thenReturn(false);
+
+        assertThat(mActiveUnlockStatusUtils.getUseBiometricTitleForActiveUnlock())
+                .isEqualTo(mApplicationContext.getString(
+                        R.string.biometric_settings_use_watch_for));
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoDialogControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoDialogControllerTest.java
index a396a92..89cc6d9 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoDialogControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoDialogControllerTest.java
@@ -39,7 +39,6 @@
 import android.telephony.TelephonyManager;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -197,11 +196,10 @@
     }
 
     @Test
-    @Ignore
     public void populateImeiInfo_emptyImei_shouldSetMeid_imeiSetToEmptyString() {
         doReturn(true).when(mController).isCdmaLteEnabled();
         when(mTelephonyManager.getPhoneType()).thenReturn(TelephonyManager.PHONE_TYPE_CDMA);
-        when(mTelephonyManager.getImei(anyInt())).thenReturn(null);
+        when(mTelephonyManager.getImei(anyInt())).thenReturn("");
 
         mController.populateImeiInfo();