Merge "Don't crash when recreating ZenModeTimePickerFragment" into main
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 5072e67..c01d162 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1385,40 +1385,6 @@
         </activity>
 
         <activity
-            android:name=".notification.zen.ZenSuggestionActivity"
-            android:label="@string/zen_mode_settings_title"
-            android:icon="@drawable/ic_suggestion_dnd"
-            android:exported="true"
-            android:theme="@android:style/Theme.NoDisplay">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="com.android.settings.suggested.category.ZEN" />
-            </intent-filter>
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="com.android.settings.suggested.category.FIRST_IMPRESSION" />
-            </intent-filter>
-
-            <meta-data android:name="com.android.settings.dismiss"
-                       android:value="0" />
-            <meta-data android:name="com.android.settings.title"
-                       android:resource="@string/zen_suggestion_title" />
-            <meta-data android:name="com.android.settings.summary"
-                       android:resource="@string/zen_suggestion_summary" />
-        </activity>
-
-        <activity
-            android:name=".notification.zen.ZenOnboardingActivity"
-            android:label="@string/zen_onboarding_dnd_visual_disturbances_header"
-            android:icon="@drawable/ic_notifications"
-            android:theme="@*android:style/Theme.DeviceDefault.Settings.Dialog.NoActionBar"
-            android:exported="true">
-            <intent-filter android:priority="1">
-                <action android:name="android.settings.ZEN_MODE_ONBOARDING" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
-        <activity
             android:name="Settings$ZenModeAutomationSettingsActivity"
             android:label="@string/zen_mode_automation_settings_title"
             android:icon="@drawable/ic_notifications"
diff --git a/aconfig/catalyst/display.aconfig b/aconfig/catalyst/display.aconfig
new file mode 100644
index 0000000..f722f74
--- /dev/null
+++ b/aconfig/catalyst/display.aconfig
@@ -0,0 +1,9 @@
+package: "com.android.settings.flags"
+container: "system"
+
+flag {
+  name: "catalyst_display_settings_screen"
+  namespace: "android_settings"
+  description: "Flag for Display"
+  bug: "323791114"
+}
diff --git a/res/drawable-night/accessibility_captioning_banner.xml b/res/drawable-night/accessibility_captioning_banner.xml
new file mode 100644
index 0000000..39b6060
--- /dev/null
+++ b/res/drawable-night/accessibility_captioning_banner.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2024 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="412dp"
+        android:height="300dp"
+        android:viewportWidth="412"
+        android:viewportHeight="300">
+    <group>
+        <clip-path
+            android:pathData="M0,0h412v300h-412z"/>
+        <path
+            android:pathData="M383.9,300H28.1C12.6,300 0,287.4 0,271.9V28.1C0,12.6 12.6,0 28.1,0H383.9C399.4,0 412,12.6 412,28.1V271.9C412,287.4 399.4,300 383.9,300Z"
+            android:fillColor="#000000"/>
+        <path
+            android:pathData="M132.8,179.6H79.2V188.1H132.8V179.6Z"
+            android:fillColor="#669DF6"/>
+        <path
+            android:pathData="M172.9,179.6H142.5V188.1H172.9V179.6Z"
+            android:fillColor="#669DF6"/>
+        <path
+            android:pathData="M158.4,195.5H79.2V204H158.4V195.5Z"
+            android:fillColor="#669DF6"/>
+        <path
+            android:pathData="M202.2,195.5H168.1V204H202.2V195.5Z"
+            android:fillColor="#669DF6"/>
+        <path
+            android:pathData="M246,195.5H211.9V204H246V195.5Z"
+            android:fillColor="#669DF6"/>
+        <path
+            android:pathData="M255.8,179.6H182.7V188.1H255.8V179.6Z"
+            android:fillColor="#669DF6"/>
+        <path
+            android:pathData="M292.3,179.6H265.5V188.1H292.3V179.6Z"
+            android:fillColor="#669DF6"/>
+        <path
+            android:pathData="M328.9,179.6H302.1V188.1H328.9V179.6Z"
+            android:fillColor="#669DF6"/>
+        <path
+            android:pathData="M142.7,67.9H131.2C129.6,67.9 128.3,69.2 128.3,70.8H67.8C59.9,70.8 53.4,77.3 53.4,85.2V217.6C53.4,225.5 59.9,232 67.8,232H344.2C352.1,232 358.6,225.5 358.6,217.6V85.2C358.6,77.3 352.1,70.8 344.2,70.8H203.1C203.1,69.2 201.8,67.9 200.2,67.9H171.4C169.8,67.9 168.5,69.2 168.5,70.8H145.5C145.5,69.2 144.3,67.9 142.7,67.9ZM344.2,73.7C350.6,73.7 355.7,78.9 355.7,85.2V217.6C355.7,223.9 350.5,229.1 344.2,229.1H67.8C61.4,229.1 56.3,223.9 56.3,217.6V85.2C56.3,78.9 61.5,73.7 67.8,73.7H344.2Z"
+            android:fillColor="#80868B"/>
+    </group>
+</vector>
diff --git a/res/layout/modes_edit_name.xml b/res/layout/modes_edit_name.xml
index 498fe4c..ed8b3c9 100644
--- a/res/layout/modes_edit_name.xml
+++ b/res/layout/modes_edit_name.xml
@@ -15,23 +15,37 @@
   limitations under the License.
   -->
 
+<!-- Theme.AppCompat.DayNight is in the parent View so that it's merged with the Theme.Settings
+     theme below. An AppCompat descendant (which Theme.Settings isn't) is necessary to inflate
+     TextInputLayout. -->
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:theme="@style/Theme.AppCompat.DayNight"
     android:paddingStart="?android:attr/listPreferredItemPaddingStart"
-    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
-    android:paddingBottom="8dp">
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
 
-    <EditText
+    <com.google.android.material.textfield.TextInputLayout
+        android:id="@+id/edit_input_layout"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:id="@android:id/edit"
-        android:minHeight="48dp"
-        android:maxLines="1"
-        android:inputType="text|textCapSentences"
-        android:imeOptions="actionDone"
-        android:selectAllOnFocus="true"
-        android:hint="@string/zen_mode_edit_name_hint" />
+        android:theme="@style/Theme.Settings"
+        style="?attr/textInputFilledStyle"
+        app:endIconMode="clear_text"
+        app:errorEnabled="true"
+        android:hint="@string/zen_mode_edit_name_hint">
 
-</LinearLayout>
\ No newline at end of file
+        <com.google.android.material.textfield.TextInputEditText
+            android:id="@android:id/edit"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:maxLines="1"
+            android:inputType="text|textCapSentences"
+            android:imeOptions="actionDone"
+            android:selectAllOnFocus="true" />
+
+    </com.google.android.material.textfield.TextInputLayout>
+
+</LinearLayout>
diff --git a/res/layout/zen_onboarding.xml b/res/layout/zen_onboarding.xml
deleted file mode 100644
index 27922c6..0000000
--- a/res/layout/zen_onboarding.xml
+++ /dev/null
@@ -1,138 +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.
--->
-<RelativeLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content">
-
-    <RelativeLayout
-        android:id="@+id/zen_onboarding_choices"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:paddingLeft="24dp"
-        android:paddingRight="24dp"
-        android:paddingTop="18dp">
-
-        <TextView
-            android:id="@+id/header"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="@string/zen_onboarding_dnd_visual_disturbances_header"
-            android:textAppearance="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle" />
-
-        <LinearLayout
-            android:id="@+id/zen_onboarding_new_setting"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@+id/header"
-            android:layout_centerHorizontal="true"
-            android:layout_marginTop="22dp"
-            android:orientation="horizontal">
-
-            <RadioButton
-                android:id="@+id/zen_onboarding_new_setting_button"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:paddingHorizontal="8dp"
-                android:minHeight="48dp"/>
-
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:orientation="vertical">
-
-                <TextView
-                    android:id="@+id/zen_onboarding_new_setting_title"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:text="@string/zen_onboarding_new_setting_title"
-                    android:textAppearance="?android:attr/textAppearanceListItem" />
-
-                <TextView
-                    android:id="@+id/zen_onboarding_new_setting_summary"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:text="@string/zen_onboarding_new_setting_summary" />
-            </LinearLayout>
-
-        </LinearLayout>
-
-        <LinearLayout
-            android:id="@+id/zen_onboarding_current_setting"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@+id/zen_onboarding_new_setting"
-            android:layout_centerHorizontal="true"
-            android:layout_marginTop="10dp"
-            android:orientation="horizontal">
-
-            <RadioButton
-                android:id="@+id/zen_onboarding_current_setting_button"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:paddingHorizontal="8dp"
-                android:minHeight="48dp"/>
-
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:orientation="vertical">
-
-                <TextView
-                    android:id="@+id/zen_onboarding_current_setting_title"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:text="@string/zen_onboarding_current_setting_title"
-                    android:textAppearance="?android:attr/textAppearanceListItem" />
-
-                <TextView
-                    android:id="@+id/zen_onboarding_current_setting_summary"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:text="@string/zen_onboarding_current_setting_summary" />
-            </LinearLayout>
-        </LinearLayout>
-    </RelativeLayout>
-
-    <RelativeLayout
-        android:id="@+id/buttons"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_below="@+id/zen_onboarding_choices"
-        android:layout_marginLeft="8dp"
-        android:layout_marginTop="20dp"
-        android:layout_marginBottom="10dp">
-
-        <Button
-            android:id="@+id/settings"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="@string/zen_onboarding_settings"
-            android:layout_alignParentStart="true"
-            style="@style/TextAppearance.ZenOnboardingButton"
-            android:onClick="launchSettings" />
-
-        <Button
-            android:id="@+id/ok"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignParentEnd="true"
-            android:text="@string/zen_onboarding_ok"
-            style="@style/TextAppearance.ZenOnboardingButton"
-            android:onClick="save" />
-    </RelativeLayout>
-</RelativeLayout>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d752338..600c08c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1446,6 +1446,12 @@
     <string name="private_space_category_lock">Lock</string>
     <!-- The title of the category for settings related to hiding the private space  [CHAR LIMIT=20] -->
     <string name="private_space_category_hide">Hide</string>
+    <!-- Header on pattern confirm screen inside private space settings when separate lock set for private space [CHAR LIMIT=50] -->
+    <string name="private_space_confirm_your_pattern_header">Confirm your private space pattern</string>
+     <!-- Header on PIN confirm screen inside private space settings when separate lock set for private space [CHAR LIMIT=50] -->
+    <string name="private_space_confirm_your_pin_header">Re-enter your private space PIN</string>
+     <!-- Header on password confirm screen inside private space when separate lock set for private space[CHAR LIMIT=50] -->
+    <string name="private_space_confirm_your_password_header">Re-enter your private space password</string>
 
     <!-- Text shown when "Add fingerprint" button is disabled -->
     <string name="fingerprint_add_max">You can add up to <xliff:g id="count" example="5">%d</xliff:g> fingerprints</string>
@@ -8451,28 +8457,6 @@
     <!-- Do not disturb custom settings duration header [CHAR LIMIT=40]-->
     <string name="zen_custom_settings_duration_header">Duration</string>
 
-    <!-- Do not disturb settings, messages, events and reminders title [CHAR LIMIT=100]-->
-    <string name="zen_msg_event_reminder_title">Messages, events &amp; reminders</string>
-    <!-- Do not disturb settings, messages, events and reminders footer [CHAR LIMIT=NONE]-->
-    <string name="zen_msg_event_reminder_footer">When Do Not Disturb is on, messages, reminders, and events will be muted, except for the items you allow above. You can adjust messages settings to allow your friends, family, or other contacts to reach you.</string>
-
-    <!-- Do not disturb onboarding dialog, accept new settings [CHAR LIMIT=30]-->
-    <string name="zen_onboarding_ok">Done</string>
-    <!-- Do not disturb onboarding dialog, on click user goes to dnd settings page [CHAR LIMIT=30]-->
-    <string name="zen_onboarding_settings">Settings</string>
-
-    <!-- Do not disturb onboarding dialog, title for radio button [CHAR LIMIT=80]-->
-    <string name="zen_onboarding_new_setting_title">No visuals or sound from notifications</string>
-    <!-- Do not disturb onboarding dialog, title for radio button [CHAR LIMIT=80]-->
-    <string name="zen_onboarding_current_setting_title">No sound from notifications</string>
-    <!-- Do not disturb onboarding dialog, secondary text for radio button [CHAR LIMIT=NONE]-->
-    <string name="zen_onboarding_new_setting_summary">You won\u2019t see or hear notifications. Calls from starred contacts and repeat callers are allowed.</string>
-    <!-- Do not disturb onboarding dialog, secondary text for radio button [CHAR LIMIT=NONE]-->
-    <string name="zen_onboarding_current_setting_summary">(Current setting)</string>
-
-    <!-- Do not disturb onboarding dialog, header prompt for settings [CHAR LIMIT=80]-->
-    <string name="zen_onboarding_dnd_visual_disturbances_header">Change Do Not Disturb notification settings?</string>
-
     <!-- Work Sounds: Work sound settings section header.  [CHAR LIMIT=50] -->
     <string name="sound_work_settings">Work profile sounds</string>
 
@@ -9607,6 +9591,9 @@
     <!-- Modes: Hint for the EditText for editing a mode's name [CHAR LIMIT=30] -->
     <string name="zen_mode_edit_name_hint">Mode name</string>
 
+    <!-- Modes: Error message when editing a mode's name and the name is empty [CHAR LIMIT=40] -->
+    <string name="zen_mode_edit_name_empty_error">Mode name cannot be empty</string>
+
     <!-- Modes: Text shown above the list of icons in the mode editor. [CHAR LIMIT=40] -->
     <string name="zen_mode_edit_choose_icon_title">Choose an icon</string>
 
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 64c8904..4f20d8c 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -73,6 +73,9 @@
         <item name="notification_importance_button_background_color_selected">?androidprv:attr/materialColorSecondaryContainer</item>
         <item name="notification_importance_button_border_color_selected">?androidprv:attr/materialColorOnSecondaryContainer</item>
         <item name="notification_importance_button_foreground_color_selected">?androidprv:attr/materialColorOnSecondaryContainer</item>
+
+        <!-- For AppCompat widgets, e.g. TextInputLayout -->
+        <item name="colorAccent">?android:attr/colorAccent</item>
     </style>
 
     <!-- Variant of the settings theme with no action bar. -->
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 18e6455..fcc5ce3 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -120,37 +120,14 @@
             settings:controller="com.android.settings.inputmethod.PointerTouchpadPreferenceController"
             settings:searchable="true"/>
 
-    </PreferenceCategory>
-
-    <PreferenceCategory
-        android:key="physical_keyboard_options_category"
-        android:persistent="false"
-        android:title="@string/keyboard_category_title">
-
-        <SwitchPreferenceCompat
+        <Preference
             android:icon="@drawable/ic_sticky_keys"
-            android:key="toggle_keyboard_sticky_keys"
+            android:key="physical_keyboard_a11y"
+            android:title="@string/keyboard_a11y_settings"
+            android:summary="@string/keyboard_a11y_settings_summary"
             android:persistent="false"
-            android:summary="@string/sticky_keys_summary"
-            android:title="@string/sticky_keys"
-            settings:controller="com.android.settings.accessibility.KeyboardStickyKeyPreferenceController"
-            settings:searchable="true" />
-
-        <SwitchPreferenceCompat
-            android:icon="@drawable/ic_bounce_keys"
-            android:key="toggle_keyboard_bounce_keys"
-            android:persistent="false"
-            android:title="@string/bounce_keys"
-            settings:controller="com.android.settings.accessibility.KeyboardBounceKeyPreferenceController"
-            settings:searchable="true" />
-
-        <SwitchPreferenceCompat
-            android:icon="@drawable/ic_slow_keys"
-            android:key="toggle_keyboard_slow_keys"
-            android:persistent="false"
-            android:title="@string/slow_keys"
-            settings:controller="com.android.settings.accessibility.KeyboardSlowKeyPreferenceController"
-            settings:searchable="true" />
+            android:fragment="com.android.settings.inputmethod.PhysicalKeyboardA11yFragment"
+            settings:controller="com.android.settings.inputmethod.PhysicalKeyboardA11yPreferenceController" />
     </PreferenceCategory>
 
     <PreferenceCategory
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 57a5380..a9144ea 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -1505,17 +1505,18 @@
      * @return biometric status when mandatory biometrics authentication is requested
      */
     public static BiometricStatus requestBiometricAuthenticationForMandatoryBiometrics(
-            @NonNull Context context,
-            boolean biometricsAuthenticationRequested, int userId) {
+            @NonNull Context context, boolean biometricsAuthenticationRequested, int userId) {
         final BiometricManager biometricManager = context.getSystemService(BiometricManager.class);
         if (biometricManager == null) {
             Log.e(TAG, "Biometric Manager is null.");
             return BiometricStatus.NOT_ACTIVE;
         }
-        final int status = biometricManager.canAuthenticate(userId,
-                BiometricManager.Authenticators.MANDATORY_BIOMETRICS);
         if (android.hardware.biometrics.Flags.mandatoryBiometrics()
                 && !biometricsAuthenticationRequested) {
+            final UserManager userManager = context.getSystemService(
+                    UserManager.class);
+            final int status = biometricManager.canAuthenticate(getEffectiveUserId(
+                    userManager, userId), BiometricManager.Authenticators.MANDATORY_BIOMETRICS);
             switch(status) {
                 case BiometricManager.BIOMETRIC_SUCCESS:
                     return BiometricStatus.OK;
@@ -1544,8 +1545,10 @@
      */
     public static void launchBiometricPromptForMandatoryBiometrics(@NonNull Fragment fragment,
             int requestCode, int userId, boolean hideBackground) {
+        final UserManager userManager = (UserManager) fragment.getContext().getSystemService(
+                UserManager.class);
         fragment.startActivityForResult(getIntentForBiometricAuthentication(fragment.getResources(),
-                userId, hideBackground), requestCode);
+                getEffectiveUserId(userManager, userId), hideBackground), requestCode);
     }
 
     /**
@@ -1561,21 +1564,32 @@
      */
     public static void launchBiometricPromptForMandatoryBiometrics(@NonNull Activity activity,
             int requestCode, int userId, boolean hideBackground) {
+        final UserManager userManager = activity.getSystemService(UserManager.class);
         activity.startActivityForResult(getIntentForBiometricAuthentication(
-                activity.getResources(), userId, hideBackground), requestCode);
+                activity.getResources(), getEffectiveUserId(userManager, userId),
+                hideBackground), requestCode);
     }
 
-    private static Intent getIntentForBiometricAuthentication(Resources resources, int userId,
-            boolean hideBackground) {
+    private static int getEffectiveUserId(UserManager userManager, int userId) {
+        if (userManager != null) {
+            return userManager.getCredentialOwnerProfile(userId);
+        }
+        return userId;
+    }
+
+    private static Intent getIntentForBiometricAuthentication(Resources resources,
+            int effectiveUserId, boolean hideBackground) {
         final Intent intent = new Intent();
-        intent.putExtra(BIOMETRIC_PROMPT_AUTHENTICATORS,
-                BiometricManager.Authenticators.MANDATORY_BIOMETRICS);
+        if (android.hardware.biometrics.Flags.mandatoryBiometrics()) {
+            intent.putExtra(BIOMETRIC_PROMPT_AUTHENTICATORS,
+                    BiometricManager.Authenticators.MANDATORY_BIOMETRICS);
+        }
         intent.putExtra(BIOMETRIC_PROMPT_NEGATIVE_BUTTON_TEXT,
                 resources.getString(R.string.cancel));
         intent.putExtra(KeyguardManager.EXTRA_DESCRIPTION,
                 resources.getString(R.string.mandatory_biometrics_prompt_description));
         intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_ALLOW_ANY_USER, true);
-        intent.putExtra(EXTRA_USER_ID, userId);
+        intent.putExtra(EXTRA_USER_ID, effectiveUserId);
         intent.putExtra(BIOMETRIC_PROMPT_HIDE_BACKGROUND, hideBackground);
         intent.setClassName(SETTINGS_PACKAGE_NAME,
                 ConfirmDeviceCredentialActivity.InternalActivity.class.getName());
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index db8f937..801d3ee 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -30,7 +30,6 @@
 import android.provider.Settings;
 import android.text.TextUtils;
 import android.util.ArrayMap;
-import android.view.InputDevice;
 import android.view.accessibility.AccessibilityManager;
 
 import androidx.annotation.NonNull;
@@ -45,7 +44,6 @@
 import com.android.settings.accessibility.AccessibilityUtil.AccessibilityServiceFragmentType;
 import com.android.settings.dashboard.DashboardFragment;
 import com.android.settings.development.Enable16kUtils;
-import com.android.settings.inputmethod.PhysicalKeyboardFragment;
 import com.android.settings.overlay.FeatureFactory;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settingslib.RestrictedPreference;
@@ -73,14 +71,12 @@
     private static final String CATEGORY_DISPLAY = "display_category";
     @VisibleForTesting
     static final String CATEGORY_DOWNLOADED_SERVICES = "user_installed_services_category";
-    private static final String CATEGORY_KEYBOARD_OPTIONS = "physical_keyboard_options_category";
     @VisibleForTesting
     static final String CATEGORY_INTERACTION_CONTROL = "interaction_control_category";
 
     private static final String[] CATEGORIES = new String[]{
             CATEGORY_SCREEN_READER, CATEGORY_CAPTIONS, CATEGORY_AUDIO, CATEGORY_DISPLAY,
-            CATEGORY_SPEECH, CATEGORY_INTERACTION_CONTROL,
-            CATEGORY_KEYBOARD_OPTIONS, CATEGORY_DOWNLOADED_SERVICES
+            CATEGORY_SPEECH, CATEGORY_INTERACTION_CONTROL, CATEGORY_DOWNLOADED_SERVICES
     };
 
     // Extras passed to sub-fragments.
@@ -275,7 +271,7 @@
      * @return The service summary
      */
     public static CharSequence getServiceSummary(Context context, AccessibilityServiceInfo info,
-                                                 boolean serviceEnabled) {
+            boolean serviceEnabled) {
         if (serviceEnabled && info.crashed) {
             return context.getText(R.string.accessibility_summary_state_stopped);
         }
@@ -461,7 +457,6 @@
         // Hide category if it is empty.
         updatePreferenceCategoryVisibility(CATEGORY_SCREEN_READER);
         updatePreferenceCategoryVisibility(CATEGORY_SPEECH);
-        updatePreferenceCategoryVisibility(CATEGORY_KEYBOARD_OPTIONS);
     }
 
     /**
@@ -556,9 +551,7 @@
     /**
      * Updates preferences related to system configurations.
      */
-    protected void updateSystemPreferences() {
-        updateKeyboardPreferencesVisibility();
-    }
+    protected void updateSystemPreferences() {}
 
     private void updatePreferencesState() {
         final List<AbstractPreferenceController> controllers = new ArrayList<>();
@@ -567,53 +560,6 @@
                 findPreference(controller.getPreferenceKey())));
     }
 
-    private void updateKeyboardPreferencesVisibility() {
-        if (!mCategoryToPrefCategoryMap.containsKey(CATEGORY_KEYBOARD_OPTIONS)) {
-            return;
-        }
-        boolean isVisible = isAnyHardKeyboardsExist()
-                && isAnyKeyboardPreferenceAvailable();
-        mCategoryToPrefCategoryMap.get(CATEGORY_KEYBOARD_OPTIONS).setVisible(
-                isVisible);
-        if (isVisible) {
-            //set summary here.
-            findPreference(KeyboardBounceKeyPreferenceController.PREF_KEY).setSummary(
-                    getContext().getString(R.string.bounce_keys_summary,
-                            PhysicalKeyboardFragment.BOUNCE_KEYS_THRESHOLD));
-            findPreference(KeyboardSlowKeyPreferenceController.PREF_KEY).setSummary(
-                    getContext().getString(R.string.slow_keys_summary,
-                            PhysicalKeyboardFragment.SLOW_KEYS_THRESHOLD));
-        }
-    }
-
-    static boolean isAnyHardKeyboardsExist() {
-        for (int deviceId : InputDevice.getDeviceIds()) {
-            final InputDevice device = InputDevice.getDevice(deviceId);
-            if (device != null && !device.isVirtual() && device.isFullKeyboard()) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private boolean isAnyKeyboardPreferenceAvailable() {
-        for (List<AbstractPreferenceController> controllerList : getPreferenceControllers()) {
-            for (AbstractPreferenceController controller : controllerList) {
-                if (controller.getPreferenceKey().equals(
-                        KeyboardBounceKeyPreferenceController.PREF_KEY)
-                        || controller.getPreferenceKey().equals(
-                        KeyboardSlowKeyPreferenceController.PREF_KEY)
-                        || controller.getPreferenceKey().equals(
-                        KeyboardStickyKeyPreferenceController.PREF_KEY)) {
-                    if (controller.isAvailable()) {
-                        return true;
-                    }
-                }
-            }
-        }
-        return false;
-    }
-
     public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
             new BaseSearchIndexProvider(R.xml.accessibility_settings) {
                 @Override
@@ -671,10 +617,12 @@
             };
 
     @Override
-    public void onInputDeviceAdded(int deviceId) {}
+    public void onInputDeviceAdded(int deviceId) {
+    }
 
     @Override
-    public void onInputDeviceRemoved(int deviceId) {}
+    public void onInputDeviceRemoved(int deviceId) {
+    }
 
     @Override
     public void onInputDeviceChanged(int deviceId) {
diff --git a/src/com/android/settings/accessibility/KeyboardBounceKeyPreferenceController.java b/src/com/android/settings/accessibility/KeyboardBounceKeyPreferenceController.java
deleted file mode 100644
index 840caa6..0000000
--- a/src/com/android/settings/accessibility/KeyboardBounceKeyPreferenceController.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-
-import android.content.Context;
-import android.hardware.input.InputSettings;
-import android.util.Log;
-
-import androidx.annotation.NonNull;
-
-import com.android.settings.R;
-import com.android.settings.core.TogglePreferenceController;
-import com.android.settings.inputmethod.PhysicalKeyboardFragment;
-
-import java.util.List;
-
-/**
- * A toggle preference controller for keyboard bounce key.
- */
-public class KeyboardBounceKeyPreferenceController extends TogglePreferenceController {
-    private static final String TAG = "BounceKeyPrefController";
-    static final String PREF_KEY = "toggle_keyboard_bounce_keys";
-
-    public KeyboardBounceKeyPreferenceController(Context context, String preferenceKey) {
-        super(context, preferenceKey);
-    }
-
-    @Override
-    public int getAvailabilityStatus() {
-        return InputSettings.isAccessibilityBounceKeysFeatureEnabled()
-                ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
-    }
-
-    @Override
-    public boolean isChecked() {
-        return InputSettings.isAccessibilityBounceKeysEnabled(mContext);
-    }
-
-    @Override
-    public boolean setChecked(boolean isChecked) {
-        InputSettings.setAccessibilityBounceKeysThreshold(mContext,
-                isChecked ? PhysicalKeyboardFragment.BOUNCE_KEYS_THRESHOLD
-                        : 0);
-        return true;
-    }
-
-    @Override
-    public int getSliceHighlightMenuRes() {
-        return R.string.menu_key_accessibility;
-    }
-
-    @Override
-    public void updateNonIndexableKeys(@NonNull List<String> keys) {
-        super.updateNonIndexableKeys(keys);
-
-        if (Flags.fixA11ySettingsSearch() && !AccessibilitySettings.isAnyHardKeyboardsExist()) {
-            if (keys.contains(getPreferenceKey())) {
-                Log.w(TAG, "Skipping updateNonIndexableKeys, key already in list.");
-                return;
-            }
-            keys.add(getPreferenceKey());
-        }
-    }
-}
diff --git a/src/com/android/settings/accessibility/KeyboardSlowKeyPreferenceController.java b/src/com/android/settings/accessibility/KeyboardSlowKeyPreferenceController.java
deleted file mode 100644
index bb9d950..0000000
--- a/src/com/android/settings/accessibility/KeyboardSlowKeyPreferenceController.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-
-import android.content.Context;
-import android.hardware.input.InputSettings;
-import android.util.Log;
-
-import androidx.annotation.NonNull;
-
-import com.android.settings.R;
-import com.android.settings.core.TogglePreferenceController;
-import com.android.settings.inputmethod.PhysicalKeyboardFragment;
-
-import java.util.List;
-
-/**
- * A toggle preference controller for keyboard slow key.
- */
-public class KeyboardSlowKeyPreferenceController extends TogglePreferenceController {
-    private static final String TAG = "SlowKeyPrefController";
-
-    static final String PREF_KEY = "toggle_keyboard_slow_keys";
-
-    public KeyboardSlowKeyPreferenceController(Context context, String preferenceKey) {
-        super(context, preferenceKey);
-    }
-
-    @Override
-    public int getAvailabilityStatus() {
-        return InputSettings.isAccessibilitySlowKeysFeatureFlagEnabled()
-                ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
-    }
-
-    @Override
-    public boolean isChecked() {
-        return InputSettings.isAccessibilitySlowKeysEnabled(mContext);
-    }
-
-    @Override
-    public boolean setChecked(boolean isChecked) {
-        InputSettings.setAccessibilitySlowKeysThreshold(mContext,
-                isChecked ? PhysicalKeyboardFragment.SLOW_KEYS_THRESHOLD
-                        : 0);
-        return true;
-    }
-
-    @Override
-    public int getSliceHighlightMenuRes() {
-        return R.string.menu_key_accessibility;
-    }
-
-    @Override
-    public void updateNonIndexableKeys(@NonNull List<String> keys) {
-        super.updateNonIndexableKeys(keys);
-
-        if (Flags.fixA11ySettingsSearch() && !AccessibilitySettings.isAnyHardKeyboardsExist()) {
-            if (keys.contains(getPreferenceKey())) {
-                Log.w(TAG, "Skipping updateNonIndexableKeys, key already in list.");
-                return;
-            }
-            keys.add(getPreferenceKey());
-        }
-    }
-}
diff --git a/src/com/android/settings/accessibility/KeyboardStickyKeyPreferenceController.java b/src/com/android/settings/accessibility/KeyboardStickyKeyPreferenceController.java
deleted file mode 100644
index c896c9c..0000000
--- a/src/com/android/settings/accessibility/KeyboardStickyKeyPreferenceController.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-
-import android.content.Context;
-import android.hardware.input.InputSettings;
-import android.util.Log;
-
-import androidx.annotation.NonNull;
-
-import com.android.settings.R;
-import com.android.settings.core.TogglePreferenceController;
-
-import java.util.List;
-
-/**
- * A toggle preference controller for keyboard sticky key.
- */
-public class KeyboardStickyKeyPreferenceController extends TogglePreferenceController {
-    private static final String TAG = "StickyKeyPrefController";
-    static final String PREF_KEY = "toggle_keyboard_sticky_keys";
-
-    public KeyboardStickyKeyPreferenceController(Context context, String preferenceKey) {
-        super(context, preferenceKey);
-    }
-
-    @Override
-    public int getAvailabilityStatus() {
-        return InputSettings.isAccessibilityStickyKeysFeatureEnabled()
-                ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
-    }
-
-    @Override
-    public boolean isChecked() {
-        return InputSettings.isAccessibilityStickyKeysEnabled(mContext);
-    }
-
-    @Override
-    public boolean setChecked(boolean isChecked) {
-        InputSettings.setAccessibilityStickyKeysEnabled(mContext, isChecked);
-        return true;
-    }
-
-    @Override
-    public int getSliceHighlightMenuRes() {
-        return R.string.menu_key_accessibility;
-    }
-
-    @Override
-    public void updateNonIndexableKeys(@NonNull List<String> keys) {
-        super.updateNonIndexableKeys(keys);
-
-        if (Flags.fixA11ySettingsSearch() && !AccessibilitySettings.isAnyHardKeyboardsExist()) {
-            if (keys.contains(getPreferenceKey())) {
-                Log.w(TAG, "Skipping updateNonIndexableKeys, key already in list.");
-                return;
-            }
-            keys.add(getPreferenceKey());
-        }
-    }
-}
diff --git a/src/com/android/settings/dashboard/suggestions/SuggestionFeatureProviderImpl.java b/src/com/android/settings/dashboard/suggestions/SuggestionFeatureProviderImpl.java
index 5e8e374..c8ce7d8 100644
--- a/src/com/android/settings/dashboard/suggestions/SuggestionFeatureProviderImpl.java
+++ b/src/com/android/settings/dashboard/suggestions/SuggestionFeatureProviderImpl.java
@@ -30,8 +30,6 @@
 import com.android.settings.biometrics.fingerprint.FingerprintSuggestionActivity;
 import com.android.settings.display.NightDisplayPreferenceController;
 import com.android.settings.flags.Flags;
-import com.android.settings.notification.zen.ZenOnboardingActivity;
-import com.android.settings.notification.zen.ZenSuggestionActivity;
 import com.android.settings.password.ScreenLockSuggestionActivity;
 import com.android.settings.wallpaper.StyleSuggestionActivity;
 import com.android.settings.wallpaper.WallpaperSuggestionActivity;
@@ -72,8 +70,6 @@
             return WifiCallingSuggestionActivity.isSuggestionComplete(context);
         } else if (className.equals(NightDisplaySuggestionActivity.class.getName())) {
             return NightDisplayPreferenceController.isSuggestionComplete(context);
-        } else if (className.equals(ZenSuggestionActivity.class.getName())) {
-            return ZenOnboardingActivity.isSuggestionComplete(context);
         }
         return false;
     }
diff --git a/src/com/android/settings/inputmethod/PhysicalKeyboardA11yPreferenceController.java b/src/com/android/settings/inputmethod/PhysicalKeyboardA11yPreferenceController.java
new file mode 100644
index 0000000..41be5b9
--- /dev/null
+++ b/src/com/android/settings/inputmethod/PhysicalKeyboardA11yPreferenceController.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.inputmethod;
+
+import static com.android.settings.keyboard.Flags.keyboardAndTouchpadA11yNewPageEnabled;
+
+import android.content.Context;
+import android.view.InputDevice;
+
+import com.android.settings.core.BasePreferenceController;
+
+/** Controller that shows and updates the Physical Keyboard a11y preference. */
+public class PhysicalKeyboardA11yPreferenceController extends BasePreferenceController {
+
+
+    public PhysicalKeyboardA11yPreferenceController(Context context,
+            String preferenceKey) {
+        super(context, preferenceKey);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return keyboardAndTouchpadA11yNewPageEnabled()
+                && isAnyHardKeyboardsExist() ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
+    }
+
+    private static boolean isAnyHardKeyboardsExist() {
+        for (int deviceId : InputDevice.getDeviceIds()) {
+            final InputDevice device = InputDevice.getDevice(deviceId);
+            if (device != null && !device.isVirtual() && device.isFullKeyboard()) {
+                return true;
+            }
+        }
+        return false;
+    }
+}
diff --git a/src/com/android/settings/network/telephony/MobileNetworkUtils.java b/src/com/android/settings/network/telephony/MobileNetworkUtils.java
index 235418e..82083b5 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkUtils.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkUtils.java
@@ -610,12 +610,8 @@
     }
 
     public static CharSequence getCurrentCarrierNameForDisplay(Context context) {
-        final SubscriptionInfo subInfo = getSubscriptionInfo(context,
+        return getCurrentCarrierNameForDisplay(context,
                 SubscriptionManager.getDefaultSubscriptionId());
-        if (subInfo != null) {
-            return subInfo.getCarrierName();
-        }
-        return getOperatorNameFromTelephonyManager(context);
     }
 
     private static @Nullable SubscriptionInfo getSubscriptionInfo(Context context, int subId) {
diff --git a/src/com/android/settings/network/telephony/SatelliteSetting.java b/src/com/android/settings/network/telephony/SatelliteSetting.java
index df58048..16c56f0 100644
--- a/src/com/android/settings/network/telephony/SatelliteSetting.java
+++ b/src/com/android/settings/network/telephony/SatelliteSetting.java
@@ -195,19 +195,19 @@
 
             final String[] link = new String[1];
             link[0] = readSatelliteMoreInfoString(mSubId);
-            footerPreference.setLearnMoreAction(view -> {
-                if (!link[0].isEmpty()) {
-                    Intent helpIntent = HelpUtils.getHelpIntent(mActivity, link[0],
-                            this.getClass().getName());
-                    if (helpIntent != null) {
-                        mActivity.startActivityForResult(helpIntent, /*requestCode=*/ 0);
+            if (link[0] != null && !link[0].isEmpty()) {
+                footerPreference.setLearnMoreAction(view -> {
+                    if (!link[0].isEmpty()) {
+                        Intent helpIntent = HelpUtils.getHelpIntent(mActivity, link[0],
+                                this.getClass().getName());
+                        if (helpIntent != null) {
+                            mActivity.startActivityForResult(helpIntent, /*requestCode=*/ 0);
+                        }
                     }
-                }
-            });
-            footerPreference.setLearnMoreText(
-                    getResources().getString(R.string.more_about_satellite_messaging));
-
-            // TODO : b/320467418 add rounded rectangle border line to footer preference.
+                });
+                footerPreference.setLearnMoreText(
+                        getResources().getString(R.string.more_about_satellite_messaging));
+            }
         }
     }
 
diff --git a/src/com/android/settings/network/telephony/VideoCallingPreferenceController.kt b/src/com/android/settings/network/telephony/VideoCallingPreferenceController.kt
index e6b3f31..f73bcda 100644
--- a/src/com/android/settings/network/telephony/VideoCallingPreferenceController.kt
+++ b/src/com/android/settings/network/telephony/VideoCallingPreferenceController.kt
@@ -44,12 +44,12 @@
     context: Context,
     key: String,
     private val callStateRepository: CallStateRepository = CallStateRepository(context),
+    private val videoCallingRepository: VideoCallingRepository = VideoCallingRepository(context),
 ) : TogglePreferenceController(context, key), On4gLteUpdateListener {
 
     private var subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID
     private var preference: TwoStatePreference? = null
     private var callingPreferenceCategoryController: CallingPreferenceCategoryController? = null
-    private val repository = VideoCallingRepository(context)
 
     private var videoCallEditable = false
     private var isInCall = false
@@ -71,14 +71,18 @@
     override fun displayPreference(screen: PreferenceScreen) {
         super.displayPreference(screen)
         preference = screen.findPreference(preferenceKey)
+        Log.d(TAG, "init ui")
+        preference?.isVisible = false
+        callingPreferenceCategoryController?.updateChildVisible(preferenceKey, false)
     }
 
     override fun onViewCreated(viewLifecycleOwner: LifecycleOwner) {
-        repository.isVideoCallReadyFlow(subId).collectLatestWithLifecycle(viewLifecycleOwner) {
-            isReady ->
-            preference?.isVisible = isReady
-            callingPreferenceCategoryController?.updateChildVisible(preferenceKey, isReady)
-        }
+        videoCallingRepository.isVideoCallReadyFlow(subId)
+            .collectLatestWithLifecycle(viewLifecycleOwner) { isReady ->
+                Log.d(TAG, "isVideoCallReadyFlow: update visible")
+                preference?.isVisible = isReady
+                callingPreferenceCategoryController?.updateChildVisible(preferenceKey, isReady)
+            }
         callStateRepository.callStateFlow(subId).collectLatestWithLifecycle(viewLifecycleOwner) {
             callState ->
             isInCall = callState != TelephonyManager.CALL_STATE_IDLE
@@ -129,10 +133,10 @@
 
         class VideoCallingSearchItem(private val context: Context) :
             MobileNetworkSettingsSearchItem {
-            private val repository = VideoCallingRepository(context)
+            private val videoCallingRepository = VideoCallingRepository(context)
 
             private fun isAvailable(subId: Int): Boolean = runBlocking {
-                repository.isVideoCallReadyFlow(subId).first()
+                videoCallingRepository.isVideoCallReadyFlow(subId).first()
             }
 
             override fun getSearchResult(subId: Int): MobileNetworkSettingsSearchResult? {
diff --git a/src/com/android/settings/notification/NotificationAccessConfirmationActivity.java b/src/com/android/settings/notification/NotificationAccessConfirmationActivity.java
index 3f300c0..1adeb64 100644
--- a/src/com/android/settings/notification/NotificationAccessConfirmationActivity.java
+++ b/src/com/android/settings/notification/NotificationAccessConfirmationActivity.java
@@ -30,13 +30,15 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.content.Intent;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageItemInfo;
 import android.content.pm.PackageManager;
-import android.content.pm.ServiceInfo;
+import android.content.pm.ResolveInfo;
 import android.os.Bundle;
 import android.os.UserHandle;
 import android.os.UserManager;
+import android.service.notification.NotificationListenerService;
 import android.text.TextUtils;
 import android.util.Slog;
 import android.view.WindowManager;
@@ -49,6 +51,8 @@
 import com.android.internal.app.AlertController;
 import com.android.settings.R;
 
+import java.util.List;
+
 /** @hide */
 public class NotificationAccessConfirmationActivity extends Activity
         implements DialogInterface {
@@ -113,6 +117,31 @@
             return;
         }
 
+        // Check NLS service info.
+        String requiredPermission = Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE;
+        Intent NLSIntent = new Intent(NotificationListenerService.SERVICE_INTERFACE);
+        List<ResolveInfo> matchedServiceList = getPackageManager().queryIntentServicesAsUser(
+                NLSIntent, /* flags */ 0, mUserId);
+        boolean hasNLSIntentFilter = false;
+        for (ResolveInfo service : matchedServiceList) {
+            if (service.serviceInfo.packageName.equals(mComponentName.getPackageName())) {
+                if (!requiredPermission.equals(service.serviceInfo.permission)) {
+                    Slog.e(LOG_TAG, "Service " + mComponentName + " lacks permission "
+                            + requiredPermission);
+                    finish();
+                    return;
+                }
+                hasNLSIntentFilter = true;
+                break;
+            }
+        }
+        if (!hasNLSIntentFilter) {
+            Slog.e(LOG_TAG, "Service " + mComponentName + " lacks an intent-filter action "
+                    + "for android.service.notification.NotificationListenerService.");
+            finish();
+            return;
+        }
+
         AlertController.AlertParams p = new AlertController.AlertParams(this);
         p.mTitle = getString(
                 R.string.notification_listener_security_warning_title,
@@ -147,19 +176,6 @@
     }
 
     private void onAllow() {
-        String requiredPermission = Manifest.permission.BIND_NOTIFICATION_LISTENER_SERVICE;
-        try {
-            ServiceInfo serviceInfo = getPackageManager().getServiceInfo(mComponentName, 0);
-            if (!requiredPermission.equals(serviceInfo.permission)) {
-                Slog.e(LOG_TAG,
-                        "Service " + mComponentName + " lacks permission " + requiredPermission);
-                return;
-            }
-        } catch (PackageManager.NameNotFoundException e) {
-            Slog.e(LOG_TAG, "Failed to get service info for " + mComponentName, e);
-            return;
-        }
-
         mNm.setNotificationListenerAccessGranted(mComponentName, true);
 
         finish();
@@ -171,12 +187,6 @@
     }
 
     @Override
-    public void onBackPressed() {
-        // Suppress finishing the activity on back button press,
-        // consistently with the permission dialog behavior
-    }
-
-    @Override
     public void cancel() {
         finish();
     }
diff --git a/src/com/android/settings/notification/modes/ZenModeEditNamePreferenceController.java b/src/com/android/settings/notification/modes/ZenModeEditNamePreferenceController.java
index 78cbfe0..6b490d6 100644
--- a/src/com/android/settings/notification/modes/ZenModeEditNamePreferenceController.java
+++ b/src/com/android/settings/notification/modes/ZenModeEditNamePreferenceController.java
@@ -17,9 +17,11 @@
 package com.android.settings.notification.modes;
 
 import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
 
 import android.content.Context;
 import android.text.Editable;
+import android.text.TextUtils;
 import android.text.TextWatcher;
 import android.widget.EditText;
 
@@ -28,14 +30,18 @@
 import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
 
+import com.android.settings.R;
 import com.android.settingslib.notification.modes.ZenMode;
 import com.android.settingslib.widget.LayoutPreference;
 
+import com.google.android.material.textfield.TextInputLayout;
+
 import java.util.function.Consumer;
 
 class ZenModeEditNamePreferenceController extends AbstractZenModePreferenceController {
 
     private final Consumer<String> mModeNameSetter;
+    @Nullable private TextInputLayout mInputLayout;
     @Nullable private EditText mEditText;
     private boolean mIsSettingText;
 
@@ -50,7 +56,8 @@
         super.displayPreference(screen);
         if (mEditText == null) {
             LayoutPreference pref = checkNotNull(screen.findPreference(getPreferenceKey()));
-            mEditText = pref.findViewById(android.R.id.edit);
+            mInputLayout = checkNotNull(pref.findViewById(R.id.edit_input_layout));
+            mEditText = checkNotNull(pref.findViewById(android.R.id.edit));
 
             mEditText.addTextChangedListener(new TextWatcher() {
                 @Override
@@ -61,9 +68,11 @@
 
                 @Override
                 public void afterTextChanged(Editable s) {
-                    if (!mIsSettingText) {
-                        mModeNameSetter.accept(s.toString());
+                    if (mIsSettingText) {
+                        return;
                     }
+                    mModeNameSetter.accept(s.toString());
+                    updateErrorState(s.toString());
                 }
             });
         }
@@ -79,9 +88,20 @@
                 if (!modeName.equals(currentText)) {
                     mEditText.setText(modeName);
                 }
+                updateErrorState(modeName);
             } finally {
                 mIsSettingText = false;
             }
         }
     }
+
+    private void updateErrorState(String currentName) {
+        checkState(mInputLayout != null);
+        if (TextUtils.isEmpty(currentName)) {
+            mInputLayout.setError(
+                    mContext.getString(R.string.zen_mode_edit_name_empty_error));
+        } else {
+            mInputLayout.setError(null);
+        }
+    }
 }
diff --git a/src/com/android/settings/notification/modes/ZenModeNotifVisFragment.java b/src/com/android/settings/notification/modes/ZenModeNotifVisFragment.java
index d1bd493..3e51462 100644
--- a/src/com/android/settings/notification/modes/ZenModeNotifVisFragment.java
+++ b/src/com/android/settings/notification/modes/ZenModeNotifVisFragment.java
@@ -38,7 +38,8 @@
         prefControllers.add(new ZenModeNotifVisPreferenceController(context,
                 "zen_effect_light", ZenPolicy.VISUAL_EFFECT_LIGHTS, null, mBackend));
         prefControllers.add(new ZenModeNotifVisPreferenceController(context,
-                "zen_effect_peek", ZenPolicy.VISUAL_EFFECT_PEEK, null, mBackend));
+                "zen_effect_peek", ZenPolicy.VISUAL_EFFECT_PEEK,
+                new int[] {ZenPolicy.VISUAL_EFFECT_NOTIFICATION_LIST}, mBackend));
         prefControllers.add(new ZenModeNotifVisPreferenceController(context,
                 "zen_effect_status", ZenPolicy.VISUAL_EFFECT_STATUS_BAR,
                 new int[] {ZenPolicy.VISUAL_EFFECT_NOTIFICATION_LIST}, mBackend));
diff --git a/src/com/android/settings/notification/zen/ZenModeBackend.java b/src/com/android/settings/notification/zen/ZenModeBackend.java
index c85b06b..2eb87c5 100644
--- a/src/com/android/settings/notification/zen/ZenModeBackend.java
+++ b/src/com/android/settings/notification/zen/ZenModeBackend.java
@@ -172,9 +172,6 @@
     }
 
     protected void saveVisualEffectsPolicy(int category, boolean suppress) {
-        Settings.Secure.putInt(mContext.getContentResolver(),
-                Settings.Secure.ZEN_SETTINGS_UPDATED, 1);
-
         int suppressedEffects = getNewSuppressedEffects(suppress, category);
         savePolicy(mPolicy.priorityCategories, mPolicy.priorityCallSenders,
                 mPolicy.priorityMessageSenders, suppressedEffects,
diff --git a/src/com/android/settings/notification/zen/ZenOnboardingActivity.java b/src/com/android/settings/notification/zen/ZenOnboardingActivity.java
deleted file mode 100644
index 151341c..0000000
--- a/src/com/android/settings/notification/zen/ZenOnboardingActivity.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.notification.zen;
-
-import android.app.Activity;
-import android.app.Flags;
-import android.app.NotificationManager;
-import android.app.NotificationManager.Policy;
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.os.Bundle;
-import android.provider.Settings;
-import android.text.format.DateUtils;
-import android.util.Log;
-import android.view.View;
-import android.widget.RadioButton;
-
-import androidx.annotation.VisibleForTesting;
-
-import com.android.internal.logging.MetricsLogger;
-import com.android.settings.R;
-import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
-import com.android.settings.overlay.FeatureFactory;
-
-public class ZenOnboardingActivity extends Activity {
-
-    private static final String TAG = "ZenOnboardingActivity";
-
-    @VisibleForTesting
-    static final String PREF_KEY_SUGGESTION_FIRST_DISPLAY_TIME =
-            "pref_zen_suggestion_first_display_time_ms";
-    @VisibleForTesting
-    static final long ALWAYS_SHOW_THRESHOLD = DateUtils.DAY_IN_MILLIS * 14;
-
-    View mNewSetting;
-    View mKeepCurrentSetting;
-    RadioButton mNewSettingButton;
-    RadioButton mKeepCurrentSettingButton;
-
-    private NotificationManager mNm;
-    private MetricsLogger mMetrics;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setNotificationManager(getSystemService(NotificationManager.class));
-        setMetricsLogger(new MetricsLogger());
-
-        Context context = getApplicationContext();
-        Settings.Secure.putInt(context.getContentResolver(),
-                Settings.Secure.ZEN_SETTINGS_SUGGESTION_VIEWED, 1);
-
-        setupUI();
-    }
-
-    @VisibleForTesting
-    protected void setupUI() {
-        setContentView(R.layout.zen_onboarding);
-
-        mNewSetting = findViewById(R.id.zen_onboarding_new_setting);
-        mKeepCurrentSetting = findViewById(R.id.zen_onboarding_current_setting);
-        mNewSettingButton = findViewById(R.id.zen_onboarding_new_setting_button);
-        mKeepCurrentSettingButton = findViewById(R.id.zen_onboarding_current_setting_button);
-
-        View.OnClickListener newSettingClickListener = new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                mKeepCurrentSettingButton.setChecked(false);
-                mNewSettingButton.setChecked(true);
-            }
-        };
-
-        View.OnClickListener currentSettingClickListener = new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                mKeepCurrentSettingButton.setChecked(true);
-                mNewSettingButton.setChecked(false);
-            }
-        };
-
-        mNewSetting.setOnClickListener(newSettingClickListener);
-        mNewSettingButton.setOnClickListener(newSettingClickListener);
-
-        mKeepCurrentSetting.setOnClickListener(currentSettingClickListener);
-        mKeepCurrentSettingButton.setOnClickListener(currentSettingClickListener);
-
-        mKeepCurrentSettingButton.setChecked(true);
-        mMetrics.visible(SettingsEnums.SETTINGS_ZEN_ONBOARDING);
-    }
-
-    @VisibleForTesting
-    protected void setNotificationManager(NotificationManager nm) {
-        mNm = nm;
-    }
-
-    @VisibleForTesting
-    protected void setMetricsLogger(MetricsLogger ml) {
-        mMetrics = ml;
-    }
-
-    public void launchSettings(View button) {
-        mMetrics.action(SettingsEnums.ACTION_ZEN_ONBOARDING_SETTINGS);
-        Intent settings = new Intent(Settings.ACTION_ZEN_MODE_SETTINGS)
-                .setPackage(getPackageName());
-        settings.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
-        startActivity(settings);
-    }
-
-    public void save(View button) {
-        NotificationManager.Policy policy = mNm.getNotificationPolicy();
-
-        if (mNewSettingButton.isChecked()) {
-            NotificationManager.Policy newPolicy = new NotificationManager.Policy(
-                    Policy.PRIORITY_CATEGORY_REPEAT_CALLERS | policy.priorityCategories,
-                    Policy.PRIORITY_SENDERS_STARRED,
-                    policy.priorityMessageSenders,
-                    NotificationManager.Policy.getAllSuppressedVisualEffects());
-            if (Flags.modesApi()) {
-                mNm.setNotificationPolicy(newPolicy, /* fromUser= */ true);
-            } else {
-                mNm.setNotificationPolicy(newPolicy);
-            }
-            mMetrics.action(SettingsEnums.ACTION_ZEN_ONBOARDING_OK);
-        } else {
-            mMetrics.action(SettingsEnums.ACTION_ZEN_ONBOARDING_KEEP_CURRENT_SETTINGS);
-        }
-
-        Settings.Secure.putInt(getApplicationContext().getContentResolver(),
-                Settings.Secure.ZEN_SETTINGS_UPDATED, 1);
-
-        finishAndRemoveTask();
-    }
-
-    public static boolean isSuggestionComplete(Context context) {
-        if (wasZenUpdated(context)) {
-            return true;
-        }
-
-        if (showSuggestion(context) || withinShowTimeThreshold(context)) {
-            return false;
-        }
-
-        return true;
-    }
-
-    private static boolean wasZenUpdated(Context context) {
-        // ZEN_SETTINGS_UPDATED is true for:
-        // - fresh P+ device
-        // - if zen visual effects values were changed by the user in Settings
-        NotificationManager nm = context.getSystemService(NotificationManager.class);
-        if (NotificationManager.Policy.areAllVisualEffectsSuppressed(
-                nm.getNotificationPolicy().suppressedVisualEffects)) {
-            Settings.Secure.putInt(context.getContentResolver(),
-                    Settings.Secure.ZEN_SETTINGS_UPDATED, 1);
-        }
-        return Settings.Secure.getInt(context.getContentResolver(),
-                Settings.Secure.ZEN_SETTINGS_UPDATED, 0) != 0;
-    }
-
-    private static boolean showSuggestion(Context context) {
-        // SHOW_ZEN_SETTINGS_SUGGESTION is by default true, but false when:
-        // - user manually turns on dnd
-
-        // SHOW_ZEN_SETTINGS_SUGGESTION is also true when:
-        // - automatic rule has started DND and user has not seen the first use dialog
-        return Settings.Secure.getInt(context.getContentResolver(),
-                Settings.Secure.SHOW_ZEN_SETTINGS_SUGGESTION, 0) != 0;
-
-    }
-
-    private static boolean withinShowTimeThreshold(Context context) {
-        final SuggestionFeatureProvider featureProvider =
-                FeatureFactory.getFeatureFactory().getSuggestionFeatureProvider();
-        final SharedPreferences prefs = featureProvider.getSharedPrefs(context);
-        final long currentTimeMs = System.currentTimeMillis();
-        final long firstDisplayTimeMs;
-
-        if (!prefs.contains(PREF_KEY_SUGGESTION_FIRST_DISPLAY_TIME)) {
-            firstDisplayTimeMs = currentTimeMs;
-            prefs.edit().putLong(PREF_KEY_SUGGESTION_FIRST_DISPLAY_TIME, currentTimeMs).commit();
-        } else {
-            firstDisplayTimeMs = prefs.getLong(PREF_KEY_SUGGESTION_FIRST_DISPLAY_TIME, -1);
-        }
-
-        final long showTimeMs = firstDisplayTimeMs + ALWAYS_SHOW_THRESHOLD;
-        final boolean stillShow = currentTimeMs < showTimeMs;
-
-        Log.d(TAG, "still show zen suggestion based on time: " + stillShow + " showTimeMs="
-            + showTimeMs);
-        return stillShow;
-    }
-}
diff --git a/src/com/android/settings/notification/zen/ZenSuggestionActivity.java b/src/com/android/settings/notification/zen/ZenSuggestionActivity.java
deleted file mode 100644
index b535a3e..0000000
--- a/src/com/android/settings/notification/zen/ZenSuggestionActivity.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.android.settings.notification.zen;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.provider.Settings;
-
-public class ZenSuggestionActivity extends Activity {
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        // start up zen settings activity
-        Intent settingsIntent = new Intent(Settings.ACTION_ZEN_MODE_SETTINGS)
-                .setPackage(getPackageName());
-        startActivity(settingsIntent);
-
-        // start up onboarding activity
-        Intent onboardingActivity = new Intent(Settings.ZEN_MODE_ONBOARDING)
-                .setPackage(getPackageName());
-        startActivity(onboardingActivity);
-
-        finish();
-    }
-}
diff --git a/src/com/android/settings/password/ConfirmLockPassword.java b/src/com/android/settings/password/ConfirmLockPassword.java
index ead79d7..2665c37 100644
--- a/src/com/android/settings/password/ConfirmLockPassword.java
+++ b/src/com/android/settings/password/ConfirmLockPassword.java
@@ -39,6 +39,7 @@
 import android.os.Handler;
 import android.os.Looper;
 import android.os.SystemClock;
+import android.os.UserHandle;
 import android.os.UserManager;
 import android.text.Editable;
 import android.text.InputType;
@@ -65,6 +66,7 @@
 import com.android.internal.widget.TextViewInputDisabler;
 import com.android.settings.R;
 import com.android.settings.SetupRedactionInterstitial;
+import com.android.settings.Utils;
 import com.android.settingslib.animation.AppearAnimationUtils;
 import com.android.settingslib.animation.DisappearAnimationUtils;
 
@@ -290,6 +292,14 @@
                         CONFIRM_WORK_PROFILE_PIN_HEADER,
                         () -> getString(R.string.lockpassword_confirm_your_work_pin_header));
             }
+            if (android.multiuser.Flags.showCustomUnlockTitleInsidePrivateProfile()
+                    && Utils.isPrivateProfile(mEffectiveUserId, getActivity())
+                    && !UserManager.get(getActivity())
+                    .isQuietModeEnabled(UserHandle.of(mEffectiveUserId))) {
+                return mIsAlpha ? getString(R.string.private_space_confirm_your_password_header)
+                        : getString(R.string.private_space_confirm_your_pin_header);
+            }
+
             return mIsAlpha ? getString(R.string.lockpassword_confirm_your_password_header)
                     : getString(R.string.lockpassword_confirm_your_pin_header);
         }
diff --git a/src/com/android/settings/password/ConfirmLockPattern.java b/src/com/android/settings/password/ConfirmLockPattern.java
index 28d790e..784e898 100644
--- a/src/com/android/settings/password/ConfirmLockPattern.java
+++ b/src/com/android/settings/password/ConfirmLockPattern.java
@@ -34,6 +34,7 @@
 import android.os.Bundle;
 import android.os.CountDownTimer;
 import android.os.SystemClock;
+import android.os.UserHandle;
 import android.os.UserManager;
 import android.text.TextUtils;
 import android.util.Log;
@@ -55,6 +56,7 @@
 import com.android.internal.widget.LockscreenCredential;
 import com.android.settings.R;
 import com.android.settings.SetupRedactionInterstitial;
+import com.android.settings.Utils;
 import com.android.settingslib.animation.AppearAnimationCreator;
 import com.android.settingslib.animation.AppearAnimationUtils;
 import com.android.settingslib.animation.DisappearAnimationUtils;
@@ -422,6 +424,12 @@
                         CONFIRM_WORK_PROFILE_PATTERN_HEADER,
                         () -> getString(R.string.lockpassword_confirm_your_work_pattern_header));
             }
+            if (android.multiuser.Flags.showCustomUnlockTitleInsidePrivateProfile()
+                    && Utils.isPrivateProfile(mEffectiveUserId, getActivity())
+                    && !UserManager.get(getActivity())
+                    .isQuietModeEnabled(UserHandle.of(mEffectiveUserId))) {
+                return getString(R.string.private_space_confirm_your_pattern_header);
+            }
 
             return getString(R.string.lockpassword_confirm_your_pattern_header);
         }
diff --git a/src/com/android/settings/search/CustomSiteMapRegistry.java b/src/com/android/settings/search/CustomSiteMapRegistry.java
index dc19782..de536dc 100644
--- a/src/com/android/settings/search/CustomSiteMapRegistry.java
+++ b/src/com/android/settings/search/CustomSiteMapRegistry.java
@@ -16,6 +16,7 @@
 
 package com.android.settings.search;
 
+import android.app.Flags;
 import android.util.ArrayMap;
 
 import com.android.settings.backup.UserBackupSettingsActivity;
@@ -55,8 +56,10 @@
                 ConnectedDeviceDashboardFragment.class.getName());
         CUSTOM_SITE_MAP.put(UserBackupSettingsActivity.class.getName(),
                 SystemDashboardFragment.class.getName());
-        CUSTOM_SITE_MAP.put(ZenModeBlockedEffectsSettings.class.getName(),
-                ZenModeRestrictNotificationsSettings.class.getName());
+        if (!Flags.modesUi()) {
+            CUSTOM_SITE_MAP.put(ZenModeBlockedEffectsSettings.class.getName(),
+                    ZenModeRestrictNotificationsSettings.class.getName());
+        }
         CUSTOM_SITE_MAP.put(GestureNavigationSettingsFragment.class.getName(),
                 SystemNavigationGestureSettings.class.getName());
     }
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index a0137df..3188240 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -1834,6 +1834,24 @@
                             MultiUserSwitchBarController.class.getName();
 
                     rawData.add(allowMultipleUsersResult);
+
+                    SearchIndexableRaw addUserData = new SearchIndexableRaw(context);
+                    addUserData.key = KEY_ADD_USER;
+
+                    // Dynamically set the title of addUser preference
+                    final UserCapabilities userCaps = UserCapabilities.create(context);
+                    if (!userCaps.mCanAddRestrictedProfile) {
+                        addUserData.title = context.getString(
+                                com.android.settingslib.R.string.user_add_user);
+                    } else {
+                        addUserData.title = context.getString(
+                                R.string.user_add_user_or_profile_menu);
+                    }
+                    addUserData.screenTitle = context.getString(R.string.user_settings_title);
+                    addUserData.iconResId = R.drawable.ic_add_40dp;
+
+                    rawData.add(addUserData);
+
                     return rawData;
                 }
 
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
index 97e41b4..4723b0e 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
@@ -276,8 +276,10 @@
             }
         }
         if (canFindNetwork) {
+            Log.e(TAG, "WiFi DPP check connection no matched security");
             return R.string.wifi_dpp_check_connection_no_matched_security;
         }
+        Log.e(TAG, "WiFi DPP check connection no matched SSID");
         return R.string.wifi_dpp_check_connection_no_matched_ssid;
     }
 
diff --git a/tests/robotests/src/com/android/settings/UtilsTest.java b/tests/robotests/src/com/android/settings/UtilsTest.java
index 107a1b3..8f4b83e 100644
--- a/tests/robotests/src/com/android/settings/UtilsTest.java
+++ b/tests/robotests/src/com/android/settings/UtilsTest.java
@@ -564,6 +564,8 @@
     @Test
     @EnableFlags(Flags.FLAG_MANDATORY_BIOMETRICS)
     public void testRequestBiometricAuthentication_biometricManagerReturnsSuccessForDifferentUser_shouldReturnError() {
+        when(mContext.getSystemService(UserManager.class)).thenReturn(mMockUserManager);
+        when(mMockUserManager.getCredentialOwnerProfile(USER_ID)).thenReturn(USER_ID);
         when(mBiometricManager.canAuthenticate(anyInt(),
                 eq(BiometricManager.Authenticators.MANDATORY_BIOMETRICS)))
                 .thenReturn(BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE);
@@ -579,6 +581,8 @@
     @EnableFlags(Flags.FLAG_MANDATORY_BIOMETRICS)
     public void testLaunchBiometricPrompt_checkIntentValues() {
         when(mFragment.getContext()).thenReturn(mContext);
+        when(mContext.getSystemService(UserManager.class)).thenReturn(mMockUserManager);
+        when(mMockUserManager.getCredentialOwnerProfile(USER_ID)).thenReturn(USER_ID);
 
         final int requestCode = 1;
         final ArgumentCaptor<Intent> intentArgumentCaptor = ArgumentCaptor.forClass(Intent.class);
diff --git a/tests/robotests/src/com/android/settings/accessibility/KeyboardBounceKeyPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/KeyboardBounceKeyPreferenceControllerTest.java
deleted file mode 100644
index bf6efd0..0000000
--- a/tests/robotests/src/com/android/settings/accessibility/KeyboardBounceKeyPreferenceControllerTest.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-import static com.android.settings.accessibility.AccessibilityUtil.State.OFF;
-import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-
-import android.content.Context;
-import android.platform.test.annotations.EnableFlags;
-import android.platform.test.flag.junit.SetFlagsRule;
-import android.provider.Settings;
-
-import androidx.preference.PreferenceManager;
-import androidx.preference.PreferenceScreen;
-import androidx.preference.SwitchPreference;
-import androidx.test.core.app.ApplicationProvider;
-
-import com.android.settings.core.BasePreferenceController;
-
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@RunWith(RobolectricTestRunner.class)
-public class KeyboardBounceKeyPreferenceControllerTest {
-    private static final String KEY_ACCESSIBILITY_BOUNCE_KEYS =
-            Settings.Secure.ACCESSIBILITY_BOUNCE_KEYS;
-    private static final int UNKNOWN = -1;
-
-    @Rule
-    public final SetFlagsRule mSetFlagRule = new SetFlagsRule();
-    private final Context mContext = ApplicationProvider.getApplicationContext();
-    private final SwitchPreference mSwitchPreference = spy(new SwitchPreference(mContext));
-    private final KeyboardBounceKeyPreferenceController mController =
-            new KeyboardBounceKeyPreferenceController(mContext,
-                    KeyboardBounceKeyPreferenceController.PREF_KEY);
-
-    @Before
-    public void setUp() {
-        final PreferenceManager preferenceManager = new PreferenceManager(mContext);
-        final PreferenceScreen screen = preferenceManager.createPreferenceScreen(mContext);
-        mSwitchPreference.setKey(KeyboardBounceKeyPreferenceController.PREF_KEY);
-        screen.addPreference(mSwitchPreference);
-        mController.displayPreference(screen);
-    }
-
-    @Test
-    public void getAvailabilityStatus_byDefault_shouldReturnAvailable() {
-        assertThat(mController.getAvailabilityStatus()).isEqualTo(
-                BasePreferenceController.AVAILABLE);
-    }
-
-    @Test
-    public void isChecked_disableBounceKey_onResumeShouldReturnFalse() {
-        Settings.Secure.putInt(mContext.getContentResolver(), KEY_ACCESSIBILITY_BOUNCE_KEYS, OFF);
-
-        mController.updateState(mSwitchPreference);
-
-        assertThat(mController.isChecked()).isFalse();
-        assertThat(mSwitchPreference.isChecked()).isFalse();
-    }
-
-    @Test
-    public void isChecked_enableBounceKey_onResumeShouldReturnTrue() {
-        Settings.Secure.putInt(mContext.getContentResolver(), KEY_ACCESSIBILITY_BOUNCE_KEYS, ON);
-
-        mController.updateState(mSwitchPreference);
-
-        assertThat(mController.isChecked()).isTrue();
-        assertThat(mSwitchPreference.isChecked()).isTrue();
-    }
-
-    @Test
-    public void performClick_enableBounceKey_shouldReturnTrue() {
-        Settings.Secure.putInt(mContext.getContentResolver(), KEY_ACCESSIBILITY_BOUNCE_KEYS, OFF);
-
-        mController.updateState(mSwitchPreference);
-
-        mSwitchPreference.performClick();
-
-        verify(mSwitchPreference).setChecked(true);
-        assertThat(mController.isChecked()).isTrue();
-        assertThat(mSwitchPreference.isChecked()).isTrue();
-    }
-
-    @Test
-    public void performClick_disableBounceKey_shouldReturnFalse() {
-        Settings.Secure.putInt(mContext.getContentResolver(), KEY_ACCESSIBILITY_BOUNCE_KEYS, ON);
-
-        mController.updateState(mSwitchPreference);
-
-        mSwitchPreference.performClick();
-
-        verify(mSwitchPreference).setChecked(false);
-        assertThat(mController.isChecked()).isFalse();
-        assertThat(mSwitchPreference.isChecked()).isFalse();
-    }
-
-    @Test
-    public void setChecked_setFalse_shouldDisableBounceKey() {
-        mController.setChecked(false);
-
-        assertThat(Settings.Secure.getInt(
-                mContext.getContentResolver(), KEY_ACCESSIBILITY_BOUNCE_KEYS, UNKNOWN)).isEqualTo(
-                OFF);
-    }
-
-    @Test
-    public void setChecked_setTrue_shouldEnableBounceKey() {
-        mController.setChecked(true);
-
-        assertThat(Settings.Secure.getInt(
-                mContext.getContentResolver(), KEY_ACCESSIBILITY_BOUNCE_KEYS,
-                UNKNOWN)).isNotEqualTo(OFF);
-    }
-
-    @Test
-    @EnableFlags(Flags.FLAG_FIX_A11Y_SETTINGS_SEARCH)
-    public void updateNonIndexableKeys_physicalKeyboardExists_returnEmptyList() {
-        Assume.assumeTrue(AccessibilitySettings.isAnyHardKeyboardsExist());
-
-        List<String> nonIndexableKeys = new ArrayList<>();
-        mController.updateNonIndexableKeys(nonIndexableKeys);
-
-        assertThat(nonIndexableKeys).isEmpty();
-    }
-
-    @Test
-    @EnableFlags(Flags.FLAG_FIX_A11Y_SETTINGS_SEARCH)
-    public void updateNonIndexableKeys_noPhysicalKeyboard_returnPreKey() {
-        Assume.assumeFalse(AccessibilitySettings.isAnyHardKeyboardsExist());
-
-        List<String> nonIndexableKeys = new ArrayList<>();
-        mController.updateNonIndexableKeys(nonIndexableKeys);
-
-        assertThat(nonIndexableKeys).contains(mController.getPreferenceKey());
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/accessibility/KeyboardSlowKeyPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/KeyboardSlowKeyPreferenceControllerTest.java
deleted file mode 100644
index 2721a64..0000000
--- a/tests/robotests/src/com/android/settings/accessibility/KeyboardSlowKeyPreferenceControllerTest.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-import static com.android.settings.accessibility.AccessibilityUtil.State.OFF;
-import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-
-import android.content.Context;
-import android.platform.test.annotations.EnableFlags;
-import android.platform.test.flag.junit.SetFlagsRule;
-import android.provider.Settings;
-
-import androidx.preference.PreferenceManager;
-import androidx.preference.PreferenceScreen;
-import androidx.preference.SwitchPreference;
-import androidx.test.core.app.ApplicationProvider;
-
-import com.android.settings.core.BasePreferenceController;
-
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@RunWith(RobolectricTestRunner.class)
-public class KeyboardSlowKeyPreferenceControllerTest {
-    private static final String KEY_ACCESSIBILITY_SLOW_KEYS =
-            Settings.Secure.ACCESSIBILITY_SLOW_KEYS;
-    private static final int UNKNOWN = -1;
-
-    @Rule
-    public final SetFlagsRule mSetFlagRule = new SetFlagsRule();
-    private final Context mContext = ApplicationProvider.getApplicationContext();
-    private final SwitchPreference mSwitchPreference = spy(new SwitchPreference(mContext));
-    private final KeyboardSlowKeyPreferenceController mController =
-            new KeyboardSlowKeyPreferenceController(mContext,
-                    KeyboardSlowKeyPreferenceController.PREF_KEY);
-
-    @Before
-    public void setUp() {
-        final PreferenceManager preferenceManager = new PreferenceManager(mContext);
-        final PreferenceScreen screen = preferenceManager.createPreferenceScreen(mContext);
-        mSwitchPreference.setKey(KeyboardSlowKeyPreferenceController.PREF_KEY);
-        screen.addPreference(mSwitchPreference);
-        mController.displayPreference(screen);
-    }
-
-    @Test
-    public void getAvailabilityStatus_byDefault_shouldReturnAvailable() {
-        assertThat(mController.getAvailabilityStatus()).isEqualTo(
-                BasePreferenceController.AVAILABLE);
-    }
-
-    @Test
-    public void isChecked_disableSlowKey_onResumeShouldReturnFalse() {
-        Settings.Secure.putInt(mContext.getContentResolver(), KEY_ACCESSIBILITY_SLOW_KEYS, OFF);
-
-        mController.updateState(mSwitchPreference);
-
-        assertThat(mController.isChecked()).isFalse();
-        assertThat(mSwitchPreference.isChecked()).isFalse();
-    }
-
-    @Test
-    public void isChecked_enableSlowKey_onResumeShouldReturnTrue() {
-        Settings.Secure.putInt(mContext.getContentResolver(), KEY_ACCESSIBILITY_SLOW_KEYS, ON);
-
-        mController.updateState(mSwitchPreference);
-
-        assertThat(mController.isChecked()).isTrue();
-        assertThat(mSwitchPreference.isChecked()).isTrue();
-    }
-
-    @Test
-    public void performClick_enableSlowKey_shouldReturnTrue() {
-        Settings.Secure.putInt(mContext.getContentResolver(), KEY_ACCESSIBILITY_SLOW_KEYS, OFF);
-
-        mController.updateState(mSwitchPreference);
-
-        mSwitchPreference.performClick();
-
-        verify(mSwitchPreference).setChecked(true);
-        assertThat(mController.isChecked()).isTrue();
-        assertThat(mSwitchPreference.isChecked()).isTrue();
-    }
-
-    @Test
-    public void performClick_disableSlowKey_shouldReturnFalse() {
-        Settings.Secure.putInt(mContext.getContentResolver(), KEY_ACCESSIBILITY_SLOW_KEYS, ON);
-
-        mController.updateState(mSwitchPreference);
-
-        mSwitchPreference.performClick();
-
-        verify(mSwitchPreference).setChecked(false);
-        assertThat(mController.isChecked()).isFalse();
-        assertThat(mSwitchPreference.isChecked()).isFalse();
-    }
-
-    @Test
-    public void setChecked_setFalse_shouldDisableSlowKey() {
-        mController.setChecked(false);
-
-        assertThat(Settings.Secure.getInt(
-                mContext.getContentResolver(), KEY_ACCESSIBILITY_SLOW_KEYS, UNKNOWN)).isEqualTo(
-                OFF);
-    }
-
-    @Test
-    public void setChecked_setTrue_shouldEnableSlowKey() {
-        mController.setChecked(true);
-
-        assertThat(Settings.Secure.getInt(
-                mContext.getContentResolver(), KEY_ACCESSIBILITY_SLOW_KEYS, UNKNOWN)).isNotEqualTo(
-                OFF);
-    }
-
-    @Test
-    @EnableFlags(Flags.FLAG_FIX_A11Y_SETTINGS_SEARCH)
-    public void updateNonIndexableKeys_physicalKeyboardExists_returnEmptyList() {
-        Assume.assumeTrue(AccessibilitySettings.isAnyHardKeyboardsExist());
-
-        List<String> nonIndexableKeys = new ArrayList<>();
-        mController.updateNonIndexableKeys(nonIndexableKeys);
-
-        assertThat(nonIndexableKeys).isEmpty();
-    }
-
-    @Test
-    @EnableFlags(Flags.FLAG_FIX_A11Y_SETTINGS_SEARCH)
-    public void updateNonIndexableKeys_noPhysicalKeyboard_returnPreKey() {
-        Assume.assumeFalse(AccessibilitySettings.isAnyHardKeyboardsExist());
-
-        List<String> nonIndexableKeys = new ArrayList<>();
-        mController.updateNonIndexableKeys(nonIndexableKeys);
-
-        assertThat(nonIndexableKeys).contains(mController.getPreferenceKey());
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/accessibility/KeyboardStickyKeyPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/KeyboardStickyKeyPreferenceControllerTest.java
deleted file mode 100644
index 0001e85..0000000
--- a/tests/robotests/src/com/android/settings/accessibility/KeyboardStickyKeyPreferenceControllerTest.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-import static com.android.settings.accessibility.AccessibilityUtil.State.OFF;
-import static com.android.settings.accessibility.AccessibilityUtil.State.ON;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-
-import android.content.Context;
-import android.platform.test.annotations.EnableFlags;
-import android.platform.test.flag.junit.SetFlagsRule;
-import android.provider.Settings;
-
-import androidx.preference.PreferenceManager;
-import androidx.preference.PreferenceScreen;
-import androidx.preference.SwitchPreference;
-import androidx.test.core.app.ApplicationProvider;
-
-import com.android.settings.core.BasePreferenceController;
-
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@RunWith(RobolectricTestRunner.class)
-public class KeyboardStickyKeyPreferenceControllerTest {
-    private static final String KEY_ACCESSIBILITY_STICKY_KEYS =
-            Settings.Secure.ACCESSIBILITY_STICKY_KEYS;
-    private static final int UNKNOWN = -1;
-
-    @Rule
-    public final SetFlagsRule mSetFlagRule = new SetFlagsRule();
-    private final Context mContext = ApplicationProvider.getApplicationContext();
-    private final SwitchPreference mSwitchPreference = spy(new SwitchPreference(mContext));
-    private final KeyboardStickyKeyPreferenceController mController =
-            new KeyboardStickyKeyPreferenceController(mContext,
-                    KeyboardStickyKeyPreferenceController.PREF_KEY);
-
-    @Before
-    public void setUp() {
-        final PreferenceManager preferenceManager = new PreferenceManager(mContext);
-        final PreferenceScreen screen = preferenceManager.createPreferenceScreen(mContext);
-        mSwitchPreference.setKey(KeyboardStickyKeyPreferenceController.PREF_KEY);
-        screen.addPreference(mSwitchPreference);
-        mController.displayPreference(screen);
-    }
-
-    @Test
-    public void getAvailabilityStatus_byDefault_shouldReturnAvailable() {
-        assertThat(mController.getAvailabilityStatus()).isEqualTo(
-                BasePreferenceController.AVAILABLE);
-    }
-
-    @Test
-    public void isChecked_disableStickyKey_onResumeShouldReturnFalse() {
-        Settings.Secure.putInt(mContext.getContentResolver(), KEY_ACCESSIBILITY_STICKY_KEYS, OFF);
-
-        mController.updateState(mSwitchPreference);
-
-        assertThat(mController.isChecked()).isFalse();
-        assertThat(mSwitchPreference.isChecked()).isFalse();
-    }
-
-    @Test
-    public void isChecked_enableStickyKey_onResumeShouldReturnTrue() {
-        Settings.Secure.putInt(mContext.getContentResolver(), KEY_ACCESSIBILITY_STICKY_KEYS, ON);
-
-        mController.updateState(mSwitchPreference);
-
-        assertThat(mController.isChecked()).isTrue();
-        assertThat(mSwitchPreference.isChecked()).isTrue();
-    }
-
-    @Test
-    public void performClick_enableStickyKey_shouldReturnTrue() {
-        Settings.Secure.putInt(mContext.getContentResolver(), KEY_ACCESSIBILITY_STICKY_KEYS, OFF);
-
-        mController.updateState(mSwitchPreference);
-
-        mSwitchPreference.performClick();
-
-        verify(mSwitchPreference).setChecked(true);
-        assertThat(mController.isChecked()).isTrue();
-        assertThat(mSwitchPreference.isChecked()).isTrue();
-    }
-
-    @Test
-    public void performClick_disableStickyKey_shouldReturnFalse() {
-        Settings.Secure.putInt(mContext.getContentResolver(), KEY_ACCESSIBILITY_STICKY_KEYS, ON);
-
-        mController.updateState(mSwitchPreference);
-
-        mSwitchPreference.performClick();
-
-        verify(mSwitchPreference).setChecked(false);
-        assertThat(mController.isChecked()).isFalse();
-        assertThat(mSwitchPreference.isChecked()).isFalse();
-    }
-
-    @Test
-    public void setChecked_setFalse_shouldDisableStickyKey() {
-        mController.setChecked(false);
-
-        assertThat(Settings.Secure.getInt(
-            mContext.getContentResolver(), KEY_ACCESSIBILITY_STICKY_KEYS, UNKNOWN)).isEqualTo(OFF);
-    }
-
-    @Test
-    public void setChecked_setTrue_shouldEnableStickyKey() {
-        mController.setChecked(true);
-
-        assertThat(Settings.Secure.getInt(
-            mContext.getContentResolver(), KEY_ACCESSIBILITY_STICKY_KEYS, UNKNOWN)).isEqualTo(ON);
-    }
-
-    @Test
-    @EnableFlags(Flags.FLAG_FIX_A11Y_SETTINGS_SEARCH)
-    public void updateNonIndexableKeys_physicalKeyboardExists_returnEmptyList() {
-        Assume.assumeTrue(AccessibilitySettings.isAnyHardKeyboardsExist());
-
-        List<String> nonIndexableKeys = new ArrayList<>();
-        mController.updateNonIndexableKeys(nonIndexableKeys);
-
-        assertThat(nonIndexableKeys).isEmpty();
-    }
-
-    @Test
-    @EnableFlags(Flags.FLAG_FIX_A11Y_SETTINGS_SEARCH)
-    public void updateNonIndexableKeys_noPhysicalKeyboard_returnPreKey() {
-        Assume.assumeFalse(AccessibilitySettings.isAnyHardKeyboardsExist());
-
-        List<String> nonIndexableKeys = new ArrayList<>();
-        mController.updateNonIndexableKeys(nonIndexableKeys);
-
-        assertThat(nonIndexableKeys).contains(mController.getPreferenceKey());
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/inputmethod/PhysicalKeyboardA11yPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/inputmethod/PhysicalKeyboardA11yPreferenceControllerTest.java
new file mode 100644
index 0000000..5c6dd14
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/inputmethod/PhysicalKeyboardA11yPreferenceControllerTest.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.inputmethod;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.platform.test.annotations.EnableFlags;
+import android.platform.test.flag.junit.SetFlagsRule;
+import android.view.InputDevice;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.keyboard.Flags;
+import com.android.settings.testutils.shadow.ShadowInputDevice;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnit;
+import org.mockito.junit.MockitoRule;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.annotation.Config;
+
+/** Tests for {@link PhysicalKeyboardA11yPreferenceController} */
+@RunWith(RobolectricTestRunner.class)
+@Config(shadows = {
+        com.android.settings.testutils.shadow.ShadowInputDevice.class,
+})
+public class PhysicalKeyboardA11yPreferenceControllerTest {
+    @Rule
+    public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
+    @Rule
+    public MockitoRule rule = MockitoJUnit.rule();
+    private static final String PREFERENCE_KEY = "physical_keyboard_a11y";
+    private Context mContext;
+    private PhysicalKeyboardA11yPreferenceController mController;
+    @Mock
+    InputDevice mInputDevice;
+
+    @Before
+    public void setUp() {
+        mContext = ApplicationProvider.getApplicationContext();
+        mController = new PhysicalKeyboardA11yPreferenceController(mContext, PREFERENCE_KEY);
+    }
+
+    @Test
+    @EnableFlags(Flags.FLAG_KEYBOARD_AND_TOUCHPAD_A11Y_NEW_PAGE_ENABLED)
+    public void getAvailabilityStatus_expected() {
+        int deviceId = 1;
+        ShadowInputDevice.sDeviceIds = new int[]{deviceId};
+        when(mInputDevice.isVirtual()).thenReturn(false);
+        when(mInputDevice.isFullKeyboard()).thenReturn(true);
+
+        ShadowInputDevice.addDevice(deviceId, mInputDevice);
+
+        assertThat(InputDevice.getDeviceIds()).isNotEmpty();
+        assertThat(mController.getAvailabilityStatus())
+                .isEqualTo(BasePreferenceController.AVAILABLE);
+
+    }
+
+    @Test
+    @EnableFlags(Flags.FLAG_KEYBOARD_AND_TOUCHPAD_A11Y_NEW_PAGE_ENABLED)
+    public void getAvailabilityStatus_deviceIsNotAsExpected_unavailable() {
+        int deviceId = 1;
+        ShadowInputDevice.sDeviceIds = new int[]{deviceId};
+        when(mInputDevice.isVirtual()).thenReturn(true);
+        when(mInputDevice.isFullKeyboard()).thenReturn(false);
+
+        ShadowInputDevice.addDevice(deviceId, mInputDevice);
+
+        assertThat(InputDevice.getDeviceIds()).isNotEmpty();
+        assertThat(mController.getAvailabilityStatus())
+                .isEqualTo(BasePreferenceController.CONDITIONALLY_UNAVAILABLE);
+
+    }
+
+}
diff --git a/tests/robotests/src/com/android/settings/notification/NotificationAccessConfirmationActivityTest.java b/tests/robotests/src/com/android/settings/notification/NotificationAccessConfirmationActivityTest.java
index 9b510fb..0a95361 100644
--- a/tests/robotests/src/com/android/settings/notification/NotificationAccessConfirmationActivityTest.java
+++ b/tests/robotests/src/com/android/settings/notification/NotificationAccessConfirmationActivityTest.java
@@ -31,8 +31,6 @@
 
 import androidx.annotation.Nullable;
 
-import com.android.settings.R;
-
 import com.google.common.base.Strings;
 
 import org.junit.Test;
@@ -45,15 +43,14 @@
 public class NotificationAccessConfirmationActivityTest {
 
     @Test
-    public void start_showsDialog() {
+    public void start_withMissingIntentFilter_finishes() {
         ComponentName cn = new ComponentName("com.example", "com.example.SomeService");
         installPackage(cn.getPackageName(), "X");
 
         NotificationAccessConfirmationActivity activity = startActivityWithIntent(cn);
 
-        assertThat(activity.isFinishing()).isFalse();
-        assertThat(getDialogText(activity)).isEqualTo(
-                activity.getString(R.string.notification_listener_security_warning_summary, "X"));
+        assertThat(getDialogText(activity)).isNull();
+        assertThat(activity.isFinishing()).isTrue();
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/notification/modes/ZenModeEditNamePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/modes/ZenModeEditNamePreferenceControllerTest.java
index 795de50..caaa1a5 100644
--- a/tests/robotests/src/com/android/settings/notification/modes/ZenModeEditNamePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/modes/ZenModeEditNamePreferenceControllerTest.java
@@ -35,6 +35,8 @@
 import com.android.settingslib.notification.modes.ZenMode;
 import com.android.settingslib.widget.LayoutPreference;
 
+import com.google.android.material.textfield.TextInputLayout;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -55,6 +57,7 @@
 
     private ZenModeEditNamePreferenceController mController;
     private LayoutPreference mPreference;
+    private TextInputLayout mTextInputLayout;
     private EditText mEditText;
     @Mock private Consumer<String> mNameSetter;
 
@@ -64,12 +67,15 @@
 
         Context context = RuntimeEnvironment.application;
         PreferenceManager preferenceManager = new PreferenceManager(context);
+
+        // Inflation is a test in itself, because it will crash if the Theme isn't set correctly.
         PreferenceScreen preferenceScreen = preferenceManager.inflateFromResource(context,
                 R.xml.modes_edit_name_icon, null);
         mPreference = preferenceScreen.findPreference("name");
 
         mController = new ZenModeEditNamePreferenceController(context, "name", mNameSetter);
         mController.displayPreference(preferenceScreen);
+        mTextInputLayout = mPreference.findViewById(R.id.edit_input_layout);
         mEditText = mPreference.findViewById(android.R.id.edit);
         assertThat(mEditText).isNotNull();
     }
@@ -88,11 +94,24 @@
     public void onEditText_callsNameSetter() {
         ZenMode mode = new TestModeBuilder().setName("A fancy name").build();
         mController.updateState(mPreference, mode);
-        EditText editText = mPreference.findViewById(android.R.id.edit);
 
-        editText.setText("An even fancier name");
+        mEditText.setText("An even fancier name");
 
         verify(mNameSetter).accept("An even fancier name");
         verifyNoMoreInteractions(mNameSetter);
     }
+
+    @Test
+    public void onEditText_emptyText_showsError() {
+        ZenMode mode = new TestModeBuilder().setName("Default name").build();
+        mController.updateState(mPreference, mode);
+
+        mEditText.setText("");
+
+        assertThat(mTextInputLayout.getError()).isNotNull();
+
+        mEditText.setText("this is fine");
+
+        assertThat(mTextInputLayout.getError()).isNull();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/notification/zen/ZenOnboardingActivityTest.java b/tests/robotests/src/com/android/settings/notification/zen/ZenOnboardingActivityTest.java
deleted file mode 100644
index 01360fd..0000000
--- a/tests/robotests/src/com/android/settings/notification/zen/ZenOnboardingActivityTest.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.settings.notification.zen;
-
-import static android.app.NotificationManager.Policy.PRIORITY_CATEGORY_ALARMS;
-import static android.app.NotificationManager.Policy.PRIORITY_CATEGORY_REPEAT_CALLERS;
-import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_ON;
-
-import static com.android.settings.notification.zen.ZenOnboardingActivity.ALWAYS_SHOW_THRESHOLD;
-import static com.android.settings.notification.zen.ZenOnboardingActivity.PREF_KEY_SUGGESTION_FIRST_DISPLAY_TIME;
-import static com.android.settings.notification.zen.ZenOnboardingActivity.isSuggestionComplete;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyBoolean;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.app.Flags;
-import android.app.NotificationManager;
-import android.app.NotificationManager.Policy;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.provider.Settings;
-
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.testutils.FakeFeatureFactory;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.Robolectric;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.shadows.ShadowApplication;
-
-@RunWith(RobolectricTestRunner.class)
-public class ZenOnboardingActivityTest {
-
-    @Mock
-    private MetricsLogger mMetricsLogger;
-    @Mock
-    private NotificationManager mNm;
-
-    private ZenOnboardingActivity mActivity;
-
-    private Context mContext;
-    private FakeFeatureFactory mFeatureFactory;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        ShadowApplication shadowApplication = ShadowApplication.getInstance();
-        shadowApplication.setSystemService(Context.NOTIFICATION_SERVICE, mNm);
-
-        mActivity = Robolectric.buildActivity(ZenOnboardingActivity.class)
-                .create()
-                .get();
-        mActivity.setNotificationManager(mNm);
-        mActivity.setMetricsLogger(mMetricsLogger);
-
-        mActivity.setupUI();
-
-        mContext = RuntimeEnvironment.application;
-        mFeatureFactory = FakeFeatureFactory.setupForTest();
-        when(mFeatureFactory.suggestionsFeatureProvider.getSharedPrefs(any(Context.class)))
-                .thenReturn(getSharedPreferences());
-    }
-
-    @Test
-    public void loadUiRecordsEvent() {
-        verify(mMetricsLogger).visible(MetricsEvent.SETTINGS_ZEN_ONBOARDING);
-    }
-
-    @Test
-    public void saveNewSetting() {
-        Policy policy = new Policy(PRIORITY_CATEGORY_ALARMS, 0, 0, SUPPRESSED_EFFECT_SCREEN_ON);
-        when(mNm.getNotificationPolicy()).thenReturn(policy);
-
-        mActivity.mNewSetting.performClick();
-        mActivity.save(null);
-
-        verify(mMetricsLogger).action(MetricsEvent.ACTION_ZEN_ONBOARDING_OK);
-
-        ArgumentCaptor<Policy> captor = ArgumentCaptor.forClass(Policy.class);
-        if (android.app.Flags.modesApi()) {
-            verify(mNm).setNotificationPolicy(captor.capture(), eq(true));
-        } else {
-            verify(mNm).setNotificationPolicy(captor.capture());
-        }
-
-        Policy actual = captor.getValue();
-        assertThat(actual.priorityCategories).isEqualTo(PRIORITY_CATEGORY_ALARMS
-                | PRIORITY_CATEGORY_REPEAT_CALLERS);
-        assertThat(actual.priorityCallSenders).isEqualTo(Policy.PRIORITY_SENDERS_STARRED);
-        assertThat(actual.priorityMessageSenders).isEqualTo(Policy.PRIORITY_SENDERS_ANY);
-        assertThat(actual.suppressedVisualEffects).isEqualTo(
-                Policy.getAllSuppressedVisualEffects());
-    }
-
-    @Test
-    public void keepCurrentSetting() {
-        Policy policy = new Policy(PRIORITY_CATEGORY_ALARMS, 0, 0, SUPPRESSED_EFFECT_SCREEN_ON);
-        when(mNm.getNotificationPolicy()).thenReturn(policy);
-
-        mActivity.mKeepCurrentSetting.performClick();
-        mActivity.save(null);
-
-        verify(mMetricsLogger).action(MetricsEvent.ACTION_ZEN_ONBOARDING_KEEP_CURRENT_SETTINGS);
-        if (Flags.modesApi()) {
-            verify(mNm, never()).setNotificationPolicy(any(), anyBoolean());
-        } else {
-            verify(mNm, never()).setNotificationPolicy(any());
-        }
-    }
-
-    @Test
-    public void isSuggestionComplete_zenUpdated() {
-        Policy policy = new Policy(0, 0, 0, 0);
-        when(mNm.getNotificationPolicy()).thenReturn(policy);
-
-        setZenUpdated(true);
-        setShowSettingsSuggestion(false);
-        setWithinTimeThreshold(true);
-        assertThat(isSuggestionComplete(mContext)).isTrue();
-    }
-
-    @Test
-    public void isSuggestionComplete_withinTimeThreshold() {
-        Policy policy = new Policy(0, 0, 0, 0);
-        when(mNm.getNotificationPolicy()).thenReturn(policy);
-
-        setZenUpdated(false);
-        setShowSettingsSuggestion(false);
-        setWithinTimeThreshold(true);
-        assertThat(isSuggestionComplete(mContext)).isFalse();
-    }
-
-    @Test
-    public void isSuggestionComplete_showSettingsSuggestionTrue() {
-        Policy policy = new Policy(0, 0, 0, 0);
-        when(mNm.getNotificationPolicy()).thenReturn(policy);
-
-        setZenUpdated(false);
-        setShowSettingsSuggestion(true);
-        setWithinTimeThreshold(false);
-        assertThat(isSuggestionComplete(mContext)).isFalse();
-    }
-
-    @Test
-    public void isSuggestionComplete_showSettingsSuggestionFalse_notWithinTimeThreshold() {
-        Policy policy = new Policy(0, 0, 0, 0);
-        when(mNm.getNotificationPolicy()).thenReturn(policy);
-
-        setZenUpdated(false);
-        setShowSettingsSuggestion(false);
-        setWithinTimeThreshold(false);
-        assertThat(isSuggestionComplete(mContext)).isTrue();
-    }
-
-
-    @Test
-    public void isSuggestionComplete_visualEffectsUpdated() {
-        // all values suppressed
-        Policy policy = new Policy(0, 0, 0, 511);
-        when(mNm.getNotificationPolicy()).thenReturn(policy);
-
-        setZenUpdated(false);
-        setShowSettingsSuggestion(true);
-        setWithinTimeThreshold(true);
-        assertThat(isSuggestionComplete(mContext)).isTrue();
-        assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
-                Settings.Secure.ZEN_SETTINGS_UPDATED, -1)).isEqualTo(1);
-    }
-
-
-    private void setZenUpdated(boolean updated) {
-        int zenUpdated = updated ? 1 : 0;
-
-        Settings.Secure.putInt(mContext.getContentResolver(),
-                Settings.Secure.ZEN_SETTINGS_UPDATED, zenUpdated);
-    }
-
-    private void setWithinTimeThreshold(boolean withinTime) {
-        long firstTime = System.currentTimeMillis();
-
-        if (withinTime) {
-            firstTime -= ALWAYS_SHOW_THRESHOLD / 2;
-        } else {
-            firstTime -= ALWAYS_SHOW_THRESHOLD * 2;
-        }
-
-        getSharedPreferences().edit().putLong(PREF_KEY_SUGGESTION_FIRST_DISPLAY_TIME,
-               firstTime).commit();
-    }
-
-    private void setShowSettingsSuggestion(boolean show) {
-        int showZenSuggestion = 0;
-        if (show) {
-            showZenSuggestion = 1;
-        }
-
-        Settings.Secure.putInt(mContext.getContentResolver(),
-                Settings.Secure.SHOW_ZEN_SETTINGS_SUGGESTION, showZenSuggestion);
-    }
-
-    private SharedPreferences getSharedPreferences() {
-        return mContext.getSharedPreferences("test_zen_sugg", Context.MODE_PRIVATE);
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/suggestions/SettingsSuggestionsTest.java b/tests/robotests/src/com/android/settings/suggestions/SettingsSuggestionsTest.java
index 9f02f1f..ee1872d 100644
--- a/tests/robotests/src/com/android/settings/suggestions/SettingsSuggestionsTest.java
+++ b/tests/robotests/src/com/android/settings/suggestions/SettingsSuggestionsTest.java
@@ -29,7 +29,6 @@
 import com.android.settings.Settings;
 import com.android.settings.biometrics.fingerprint.FingerprintEnrollSuggestionActivity;
 import com.android.settings.biometrics.fingerprint.FingerprintSuggestionActivity;
-import com.android.settings.notification.zen.ZenSuggestionActivity;
 import com.android.settings.wallpaper.WallpaperSuggestionActivity;
 import com.android.settings.wifi.calling.WifiCallingSuggestionActivity;
 
@@ -81,14 +80,6 @@
                 R.string.night_display_suggestion_summary);
     }
 
-    @Test
-    public void zenSuggestion_isValid() {
-        assertSuggestionEquals(
-                ZenSuggestionActivity.class.getName(),
-                R.string.zen_suggestion_title,
-                R.string.zen_suggestion_summary);
-    }
-
     private void assertSuggestionEquals(String activityName, @StringRes int titleRes,
             @StringRes int summaryRes) {
 
diff --git a/tests/robotests/src/com/android/settings/users/UserSettingsTest.java b/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
index 85db0bd..754c429 100644
--- a/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/users/UserSettingsTest.java
@@ -37,6 +37,7 @@
 import static org.mockito.Mockito.when;
 import static org.robolectric.Shadows.shadowOf;
 
+import android.app.admin.DevicePolicyManager;
 import android.app.settings.SettingsEnums;
 import android.content.ComponentName;
 import android.content.Context;
@@ -112,6 +113,7 @@
     private static final String KEY_USER_GUEST = "user_guest";
     private static final String KEY_ALLOW_MULTIPLE_USERS = "allow_multiple_users";
     private static final String KEY_USER_SETTINGS_SCREEN = "user_settings_screen";
+    private static final String KEY_ADD_USER = "user_add";
     private static final int ACTIVE_USER_ID = 0;
     private static final int INACTIVE_ADMIN_USER_ID = 1;
     private static final int INACTIVE_SECONDARY_USER_ID = 14;
@@ -130,6 +132,8 @@
     @Mock
     private PreferenceManager mMockPreferenceManager;
     @Mock
+    private DevicePolicyManager mDevicePolicyManager;
+    @Mock
     private UserPreference mMePreference;
     @Mock
     private RestrictedPreference mAddUserPreference;
@@ -222,7 +226,7 @@
 
     @Test
     public void testGetRawDataToIndex_returnAllIndexablePreferences() {
-        String[] expectedKeys = {KEY_ALLOW_MULTIPLE_USERS, KEY_USER_SETTINGS_SCREEN};
+        String[] expectedKeys = {KEY_ALLOW_MULTIPLE_USERS, KEY_USER_SETTINGS_SCREEN, KEY_ADD_USER};
         List<String> keysResultList = new ArrayList<>();
         ShadowUserManager.getShadow().setSupportsMultipleUsers(true);
         List<SearchIndexableRaw> rawData =
@@ -236,6 +240,54 @@
     }
 
     @Test
+    public void testGetRawDataToIndex_addRestrictedProfileAllowed_addUserTitleIsCorrect() {
+        ShadowUserManager.getShadow().setSupportsMultipleUsers(true);
+        SettingsShadowResources.overrideResource(
+                com.android.settings.R.bool.config_offer_restricted_profiles,
+                Boolean.TRUE);
+        when(mUserManager.hasBaseUserRestriction(UserManager.DISALLOW_ADD_USER, mContext.getUser()))
+                .thenReturn(false);
+        ShadowUserManager.getShadow().setUserTypeEnabled(UserManager.USER_TYPE_FULL_RESTRICTED,
+                true);
+        when(mContext.getSystemService(Context.DEVICE_POLICY_SERVICE))
+                .thenReturn(mDevicePolicyManager);
+        when(mDevicePolicyManager.isDeviceManaged()).thenReturn(false);
+
+        List<SearchIndexableRaw> rawData =
+                UserSettings.SEARCH_INDEX_DATA_PROVIDER.getRawDataToIndex(mContext, true);
+
+        String title = null;
+        for (SearchIndexableRaw rawDataItem : rawData) {
+            if (rawDataItem.key.equals(KEY_ADD_USER)) {
+                title = rawDataItem.title;
+            }
+        }
+
+        assertThat(title).isEqualTo(mContext.getString(
+                com.android.settings.R.string.user_add_user_or_profile_menu));
+    }
+
+    @Test
+    public void testGetRawDataToIndex_addRestrictedProfileDisallowed_addUserTitleIsCorrect() {
+        ShadowUserManager.getShadow().setSupportsMultipleUsers(true);
+        SettingsShadowResources.overrideResource(
+                com.android.settings.R.bool.config_offer_restricted_profiles,
+                Boolean.FALSE);
+        List<SearchIndexableRaw> rawData =
+                UserSettings.SEARCH_INDEX_DATA_PROVIDER.getRawDataToIndex(mContext, true);
+
+        String title = null;
+        for (SearchIndexableRaw rawDataItem : rawData) {
+            if (rawDataItem.key.equals(KEY_ADD_USER)) {
+                title = rawDataItem.title;
+            }
+        }
+
+        assertThat(title).isEqualTo(mContext.getString(
+                com.android.settingslib.R.string.user_add_user));
+    }
+
+    @Test
     public void testAssignDefaultPhoto_hasDefaultUserIconSize() {
         doReturn(mUserManager).when(mContext).getSystemService(Context.USER_SERVICE);
         int size = 100;
diff --git a/tests/spa_unit/src/com/android/settings/network/telephony/VideoCallingPreferenceControllerTest.kt b/tests/spa_unit/src/com/android/settings/network/telephony/VideoCallingPreferenceControllerTest.kt
index 4babfaa..b9bda77 100644
--- a/tests/spa_unit/src/com/android/settings/network/telephony/VideoCallingPreferenceControllerTest.kt
+++ b/tests/spa_unit/src/com/android/settings/network/telephony/VideoCallingPreferenceControllerTest.kt
@@ -47,6 +47,8 @@
     private val context: Context = ApplicationProvider.getApplicationContext()
 
     private val mockCallStateRepository = mock<CallStateRepository> {}
+    private val mockVideoCallingRepository = mock<VideoCallingRepository> {}
+
 
     private var controller =
         spy(
@@ -54,6 +56,7 @@
                 context = context,
                 key = TEST_KEY,
                 callStateRepository = mockCallStateRepository,
+                videoCallingRepository = mockVideoCallingRepository
             )
         ) {
             on { queryImsState(SUB_ID) } doReturn mockVtQueryImsState
@@ -70,6 +73,42 @@
         controller.displayPreference(preferenceScreen)
     }
 
+
+    @Test
+    fun displayPreference_uiInitState_isHidden() {
+        assertThat(preference.isVisible).isFalse()
+    }
+
+    @Test
+    fun onViewCreated_videoCallIsNotReady_isHidden() = runBlocking {
+        mockVideoCallingRepository.stub {
+            on { isVideoCallReadyFlow(SUB_ID) } doReturn flowOf(false)
+        }
+        mockCallStateRepository.stub {
+            on { callStateFlow(SUB_ID) } doReturn flowOf(TelephonyManager.CALL_STATE_IDLE)
+        }
+
+        controller.onViewCreated(TestLifecycleOwner())
+        delay(100)
+
+        assertThat(preference.isVisible).isFalse()
+    }
+
+    @Test
+    fun onViewCreated_videoCallIsNotReady_isShown() = runBlocking {
+        mockVideoCallingRepository.stub {
+            on { isVideoCallReadyFlow(SUB_ID) } doReturn flowOf(true)
+        }
+        mockCallStateRepository.stub {
+            on { callStateFlow(SUB_ID) } doReturn flowOf(TelephonyManager.CALL_STATE_IDLE)
+        }
+
+        controller.onViewCreated(TestLifecycleOwner())
+        delay(100)
+
+        assertThat(preference.isVisible).isTrue()
+    }
+
     @Test
     fun updateState_4gLteOff_disabledAndUnchecked() {
         mockQueryVoLteState.stub { on { isEnabledByUser } doReturn false }
@@ -82,6 +121,9 @@
 
     @Test
     fun updateState_4gLteOnWithoutCall_enabledAndChecked() = runBlocking {
+        mockVideoCallingRepository.stub {
+            on { isVideoCallReadyFlow(SUB_ID) } doReturn flowOf(true)
+        }
         mockVtQueryImsState.stub {
             on { isEnabledByUser } doReturn true
             on { isAllowUserControl } doReturn true
@@ -101,6 +143,9 @@
 
     @Test
     fun updateState_4gLteOnWithCall_disabledAndChecked() = runBlocking {
+        mockVideoCallingRepository.stub {
+            on { isVideoCallReadyFlow(SUB_ID) } doReturn flowOf(true)
+        }
         mockVtQueryImsState.stub {
             on { isEnabledByUser } doReturn true
             on { isAllowUserControl } doReturn true
diff --git a/tests/unit/src/com/android/settings/search/CustomSiteMapRegistryTest.java b/tests/unit/src/com/android/settings/search/CustomSiteMapRegistryTest.java
index a6ed5c7..b4d4fcf 100644
--- a/tests/unit/src/com/android/settings/search/CustomSiteMapRegistryTest.java
+++ b/tests/unit/src/com/android/settings/search/CustomSiteMapRegistryTest.java
@@ -18,6 +18,12 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import android.app.Flags;
+import android.platform.test.annotations.RequiresFlagsDisabled;
+import android.platform.test.annotations.RequiresFlagsEnabled;
+import android.platform.test.flag.junit.CheckFlagsRule;
+import android.platform.test.flag.junit.DeviceFlagsValueProvider;
+
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 
 import com.android.settings.backup.UserBackupSettingsActivity;
@@ -35,12 +41,16 @@
 import com.android.settings.security.screenlock.ScreenLockSettings;
 import com.android.settings.system.SystemDashboardFragment;
 
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
 @RunWith(AndroidJUnit4.class)
 public class CustomSiteMapRegistryTest {
 
+    @Rule
+    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
+
     @Test
     public void shouldContainScreenLockSettingsPairs() {
         assertThat(CustomSiteMapRegistry.CUSTOM_SITE_MAP.get(ScreenLockSettings.class.getName()))
@@ -75,13 +85,21 @@
     }
 
     @Test
+    @RequiresFlagsDisabled(Flags.FLAG_MODES_UI)
     public void shouldContainZenModeBlockedEffectsSettingsPairs() {
-        assertThat(CustomSiteMapRegistry.CUSTOM_SITE_MAP.get(
-                ZenModeBlockedEffectsSettings.class.getName())).isEqualTo(
+        assertThat(CustomSiteMapRegistry.CUSTOM_SITE_MAP).containsEntry(
+                ZenModeBlockedEffectsSettings.class.getName(),
                 ZenModeRestrictNotificationsSettings.class.getName());
     }
 
     @Test
+    @RequiresFlagsEnabled(Flags.FLAG_MODES_UI)
+    public void shouldNotContainZenModeBlockedEffectsSettingsPairs() {
+        assertThat(CustomSiteMapRegistry.CUSTOM_SITE_MAP)
+                .doesNotContainKey(ZenModeBlockedEffectsSettings.class.getName());
+    }
+
+    @Test
     public void shouldContainGestureNavigationSettingsFragmentPairs() {
         assertThat(CustomSiteMapRegistry.CUSTOM_SITE_MAP.get(
                 GestureNavigationSettingsFragment.class.getName())).isEqualTo(