Merge "Add a few native setting items to safety page"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e107cb7..4064a47 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2824,16 +2824,12 @@
     <string name="night_display_status_title">Status</string>
     <!-- Night display screen, setting the color temperature of the display. [CHAR LIMIT=30] -->
     <string name="night_display_temperature_title">Intensity</string>
-    <!-- Display settings screen, summary format of night display when off. [CHAR LIMIT=NONE] -->
-    <string name="night_display_summary_off">Off / <xliff:g name="auto_mode_summary" example="Never turn on automatically">%1$s</xliff:g></string>
     <!-- Display settings screen, summary of night display when off and will *never* turn on automatically. [CHAR LIMIT=NONE] -->
     <string name="night_display_summary_off_auto_mode_never">Will never turn on automatically</string>
          <!-- Display settings screen, summary format of night display when off and will turn on automatically at a user defined time. [CHAR LIMIT=NONE] -->
     <string name="night_display_summary_off_auto_mode_custom">Will turn on automatically at <xliff:g name="time" example="6 AM">%1$s</xliff:g></string>
     <!-- Display settings screen, summary of night display when off and will turn on automatically at sunset. [CHAR LIMIT=NONE] -->
     <string name="night_display_summary_off_auto_mode_twilight">Will turn on automatically at sunset</string>
-    <!-- Display settings screen, summary format of night display when on. [CHAR LIMIT=NONE] -->
-    <string name="night_display_summary_on">On / <xliff:g name="auto_mode_summary" example="Never turn off automatically">%1$s</xliff:g></string>
     <!-- Display settings screen, summary of night display when on and will *never* turn off automatically. [CHAR LIMIT=NONE] -->
     <string name="night_display_summary_on_auto_mode_never">Will never turn off automatically</string>
     <!-- Display settings screen, summary format of night display when on and will turn off automatically at a user defined time. [CHAR LIMIT=NONE] -->
@@ -2882,16 +2878,12 @@
     <string name="dark_ui_auto_mode_custom">Turns on at custom time</string>
     <!-- Dark UI screen, setting option name controlling the current activation status. [CHAR LIMIT=30] -->
     <string name="dark_ui_status_title">Status</string>
-    <!-- Display settings screen, summary format of Dark UI when off. [CHAR LIMIT=NONE] -->
-    <string name="dark_ui_summary_off">Off / <xliff:g name="auto_mode_summary" example="Never turn on automatically">%1$s</xliff:g></string>
     <!-- Display settings screen, summary of Dark UI when off and will *never* turn on automatically. [CHAR LIMIT=NONE] -->
     <string name="dark_ui_summary_off_auto_mode_never">Will never turn on automatically</string>
     <!-- Display settings screen, summary of Dark UI when off and will turn on automatically at sunset. [CHAR LIMIT=NONE] -->
     <string name="dark_ui_summary_off_auto_mode_auto">Will turn on automatically at sunset</string>
         <!-- Display settings screen, summary format of night display when off and will turn on automatically at a user defined time. [CHAR LIMIT=NONE] -->
     <string name="dark_ui_summary_off_auto_mode_custom">Will turn on automatically at <xliff:g name="time" example="6 AM">%1$s</xliff:g></string>
-    <!-- Display settings screen, summary format of Dark UI when on. [CHAR LIMIT=NONE] -->
-    <string name="dark_ui_summary_on">On / <xliff:g name="auto_mode_summary" example="Never turn off automatically">%1$s</xliff:g></string>
     <!-- Display settings screen, summary of Dark UI when on and will *never* turn off automatically. [CHAR LIMIT=NONE] -->
     <string name="dark_ui_summary_on_auto_mode_never">Will never turn off automatically</string>
     <!-- Display settings screen, summary of Dark UI when on and will turn off automatically at sunrise. [CHAR LIMIT=NONE] -->
@@ -4952,6 +4944,8 @@
     <string name="audio_and_captions_category_title">Audio &amp; on-screen text</string>
     <!-- Title for the accessibility preference category of display services and settings. [CHAR LIMIT=50] -->
     <string name="display_category_title">Display</string>
+    <!-- Title for the accessibility text options page. [CHAR LIMIT=50] -->
+    <string name="accessibility_text_and_display_title">Text and display</string>
     <!-- Title for the accessibility preference category of interaction control services and settings. [CHAR LIMIT=50] -->
     <string name="interaction_control_category_title">Interaction controls</string>
     <!-- Title for the accessibility preference category of services downloaded by the user. [CHAR LIMIT=50] -->
@@ -10868,7 +10862,7 @@
     <string name="dark_ui_mode">Dark theme</string>
 
     <!-- [CHAR LIMIT=60] Summary string on dark theme explaining why the toggle is disabled while the setting is still on-->
-    <string name="dark_ui_mode_disabled_summary_dark_theme_on">On / Temporarily disabled due to Battery Saver</string>
+    <string name="dark_ui_mode_disabled_summary_dark_theme_on">Temporarily disabled due to Battery Saver</string>
 
     <!-- [CHAR LIMIT=60] Summary string on dark theme explaining why the toggle is disabled while the setting is off-->
     <string name="dark_ui_mode_disabled_summary_dark_theme_off">Temporarily turned on due to Battery Saver</string>
@@ -12578,4 +12572,6 @@
     <string name="category_name_color">Color</string>
     <!-- Others category name [CHAR LIMIT=none] -->
     <string name="category_name_others">Others</string>
+    <!-- General category name [CHAR LIMIT=none] -->
+    <string name="category_name_general">General</string>
 </resources>
diff --git a/res/values/styles_preference.xml b/res/values/styles_preference.xml
index b88a9fb..6453458 100644
--- a/res/values/styles_preference.xml
+++ b/res/values/styles_preference.xml
@@ -25,16 +25,9 @@
         <item name="slicePreferenceStyle">@style/SlicePreference</item>
         <item name="seekBarPreferenceStyle">@style/SettingsSeekBarPreference</item>
         <item name="twoStateButtonPreferenceStyle">@style/TwoStateButtonPreference</item>
-        <item name="preferenceCategoryTitleTextAppearance">@style/TextAppearance.CategoryTitle
-        </item>
-        <item name="preferenceCategoryStyle">@style/SettingsCategoryPreference</item>
-        <!-- For preference category color -->
-        <item name="preferenceCategoryTitleTextColor">?android:attr/textColorSecondary</item>
         <item name="preferenceFragmentCompatStyle">@style/SettingsPreferenceFragmentStyle</item>
     </style>
 
-    <style name="SettingsCategoryPreference" parent="Preference.Category.Material" />
-
     <style name="PreferenceTheme.SetupWizard">
         <item name="preferenceFragmentCompatStyle">@style/SetupWizardPreferenceFragmentStyle</item>
         <item name="preferenceStyle">@style/Preference.Material</item>
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 6781e28..6efd884 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -45,52 +45,19 @@
         android:title="@string/display_category_title">
 
         <Preference
-            android:fragment="com.android.settings.display.ToggleFontSizePreferenceFragment"
-            android:key="font_size_preference_screen"
+            android:fragment="com.android.settings.accessibility.TextAndDisplayFragment"
+            android:key="text_and_display_preference_screen"
             android:persistent="false"
-            android:title="@string/title_font_size"
-            settings:controller="com.android.settings.display.FontSizePreferenceController"
-            settings:searchable="false"/>
+            android:title="@string/accessibility_text_and_display_title"
+            settings:searchable="true"/>
 
-     <com.android.settings.display.ScreenZoomPreference
-            android:fragment="com.android.settings.display.ScreenZoomSettings"
-            android:key="accessibility_settings_screen_zoom"
-            android:persistent="false"
-            android:title="@string/screen_zoom_title"
-            settings:searchable="false"/>
-
-       <SwitchPreference
-            android:key="dark_ui_mode_accessibility"
-            android:persistent="false"
-            android:title="@string/dark_ui_mode"
-            settings:controller="com.android.settings.display.DarkUIPreferenceController"
-            settings:searchable="false"/>
-
-       <Preference
+        <Preference
             android:fragment="com.android.settings.accessibility.MagnificationPreferenceFragment"
             android:icon="@drawable/ic_accessibility_magnification"
             android:key="magnification_preference_screen"
             android:persistent="false"
             android:title="@string/accessibility_screen_magnification_title"
             settings:controller="com.android.settings.accessibility.MagnificationPreferenceController"/>
-
-        <SwitchPreference
-            android:key="toggle_large_pointer_icon"
-            android:persistent="false"
-            android:title="@string/accessibility_toggle_large_pointer_icon_title"
-            settings:controller="com.android.settings.accessibility.LargePointerIconPreferenceController"/>
-
-        <SwitchPreference
-            android:key="toggle_disable_animations"
-            android:persistent="false"
-            android:title="@string/accessibility_disable_animations"
-            settings:controller="com.android.settings.accessibility.DisableAnimationsPreferenceController"/>
-
-        <SwitchPreference
-            android:key="toggle_force_bold_text"
-            android:persistent="false"
-            android:title="@string/force_bold_text"
-            settings:controller="com.android.settings.accessibility.FontWeightAdjustmentPreferenceController"/>
     </PreferenceCategory>
 
     <PreferenceCategory
@@ -203,42 +170,12 @@
         settings:initialExpandedChildrenCount="1">
 
         <SwitchPreference
-            android:key="toggle_high_text_contrast_preference"
-            android:persistent="false"
-            android:title="@string/accessibility_toggle_high_text_contrast_preference_title"
-            settings:controller="com.android.settings.accessibility.HighTextContrastPreferenceController"/>
-
-        <Preference
-            android:fragment="com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment"
-            android:icon="@drawable/ic_daltonizer"
-            android:key="daltonizer_preference"
-            android:persistent="false"
-            android:title="@string/accessibility_display_daltonizer_preference_title"
-            settings:controller="com.android.settings.accessibility.DaltonizerPreferenceController"/>
-
-        <Preference
-            android:fragment="com.android.settings.accessibility.ToggleColorInversionPreferenceFragment"
-            android:icon="@drawable/ic_color_inversion"
-            android:key="toggle_inversion_preference"
-            android:persistent="false"
-            android:title="@string/accessibility_display_inversion_preference_title"
-            settings:controller="com.android.settings.accessibility.ColorInversionPreferenceController"/>
-
-        <SwitchPreference
             android:key="accessibility_shortcut_preference"
             android:persistent="false"
             android:title="@string/accessibility_shortcut_service_on_lock_screen_title"
             android:summary="@string/accessibility_shortcut_description"
             settings:controller="com.android.settings.accessibility.AccessibilityShortcutPreferenceController"/>
 
-        <!--TODO(b/170973645): Get icon-->
-        <Preference
-            android:fragment="com.android.settings.accessibility.ToggleReduceBrightColorsPreferenceFragment"
-            android:key="reduce_bright_colors_preference"
-            android:persistent="false"
-            android:title="@string/reduce_bright_colors_preference_title"
-            settings:controller="com.android.settings.accessibility.ReduceBrightColorsPreferenceController"/>
-
     </PreferenceCategory>
 
 </PreferenceScreen>
diff --git a/res/xml/accessibility_text_and_display.xml b/res/xml/accessibility_text_and_display.xml
new file mode 100644
index 0000000..7dce826
--- /dev/null
+++ b/res/xml/accessibility_text_and_display.xml
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:settings="http://schemas.android.com/apk/res-auto"
+    android:key="accessibility_text_and_display"
+    android:persistent="false"
+    android:title="@string/accessibility_text_and_display_title">
+
+    <SwitchPreference
+        android:key="toggle_high_text_contrast_preference"
+        android:persistent="false"
+        android:title="@string/accessibility_toggle_high_text_contrast_preference_title"
+        settings:controller="com.android.settings.accessibility.HighTextContrastPreferenceController"/>
+
+    <SwitchPreference
+        android:key="dark_ui_mode_accessibility"
+        android:persistent="false"
+        android:title="@string/dark_ui_mode"
+        settings:controller="com.android.settings.display.DarkUIPreferenceController"
+        settings:searchable="false"/>
+
+    <Preference
+        android:fragment="com.android.settings.accessibility.ToggleDaltonizerPreferenceFragment"
+        android:icon="@drawable/ic_daltonizer"
+        android:key="daltonizer_preference"
+        android:persistent="false"
+        android:title="@string/accessibility_display_daltonizer_preference_title"
+        settings:controller="com.android.settings.accessibility.DaltonizerPreferenceController"/>
+
+    <Preference
+        android:fragment="com.android.settings.accessibility.ToggleColorInversionPreferenceFragment"
+        android:icon="@drawable/ic_color_inversion"
+        android:key="toggle_inversion_preference"
+        android:persistent="false"
+        android:title="@string/accessibility_display_inversion_preference_title"
+        settings:controller="com.android.settings.accessibility.ColorInversionPreferenceController"/>
+
+    <!--TODO(b/170973645): Get icon-->
+    <Preference
+        android:fragment="com.android.settings.accessibility.ToggleReduceBrightColorsPreferenceFragment"
+        android:key="reduce_bright_colors_preference"
+        android:persistent="false"
+        android:title="@string/reduce_bright_colors_preference_title"
+        settings:controller="com.android.settings.accessibility.ReduceBrightColorsPreferenceController"/>
+
+    <SwitchPreference
+        android:key="toggle_disable_animations"
+        android:persistent="false"
+        android:title="@string/accessibility_disable_animations"
+        settings:controller="com.android.settings.accessibility.DisableAnimationsPreferenceController"/>
+
+    <com.android.settings.display.ScreenZoomPreference
+        android:fragment="com.android.settings.display.ScreenZoomSettings"
+        android:key="accessibility_settings_screen_zoom"
+        android:persistent="false"
+        android:title="@string/screen_zoom_title"
+        settings:searchable="false"/>
+
+    <Preference
+        android:fragment="com.android.settings.display.ToggleFontSizePreferenceFragment"
+        android:key="font_size_preference_screen"
+        android:persistent="false"
+        android:title="@string/title_font_size"
+        settings:controller="com.android.settings.display.FontSizePreferenceController"
+        settings:searchable="false"/>
+
+    <SwitchPreference
+        android:key="toggle_force_bold_text"
+        android:persistent="false"
+        android:title="@string/force_bold_text"
+        settings:controller="com.android.settings.accessibility.FontWeightAdjustmentPreferenceController"/>
+
+    <SwitchPreference
+        android:key="toggle_large_pointer_icon"
+        android:persistent="false"
+        android:title="@string/accessibility_toggle_large_pointer_icon_title"
+        settings:controller="com.android.settings.accessibility.LargePointerIconPreferenceController"/>
+
+    <PreferenceCategory
+        android:key="experimental_category"
+        android:persistent="false"
+        android:title="@string/experimental_category_title"
+        settings:initialExpandedChildrenCount="1">
+    </PreferenceCategory>
+</PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/display_settings_v2.xml b/res/xml/display_settings_v2.xml
index 4edc335..0b43914 100644
--- a/res/xml/display_settings_v2.xml
+++ b/res/xml/display_settings_v2.xml
@@ -33,10 +33,9 @@
             <intent android:action="com.android.intent.action.SHOW_BRIGHTNESS_DIALOG"/>
         </com.android.settingslib.RestrictedPreference>
 
-        <Preference
+        <com.android.settings.widget.PrimarySwitchPreference
             android:key="auto_brightness_entry"
             android:title="@string/auto_brightness_title"
-            android:summary="@string/summary_placeholder"
             android:fragment="com.android.settings.display.AutoBrightnessSettings"
             settings:controller="com.android.settings.display.AutoBrightnessPreferenceController"/>
     </PreferenceCategory>
@@ -103,7 +102,7 @@
     </PreferenceCategory>
 
     <PreferenceCategory
-        android:title="@string/category_name_others">
+        android:title="@string/category_name_general">
 
         <SwitchPreference
             android:key="auto_rotate"
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index e5bc3f5..4709c66 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -29,7 +29,6 @@
 import android.content.pm.ResolveInfo;
 import android.content.pm.ServiceInfo;
 import android.graphics.drawable.Drawable;
-import android.hardware.display.ColorDisplayManager;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
@@ -43,7 +42,6 @@
 import androidx.core.content.ContextCompat;
 import androidx.preference.Preference;
 import androidx.preference.PreferenceCategory;
-import androidx.preference.SwitchPreference;
 
 import com.android.internal.accessibility.AccessibilityShortcutController;
 import com.android.internal.content.PackageMonitor;
@@ -51,7 +49,6 @@
 import com.android.settings.Utils;
 import com.android.settings.accessibility.AccessibilityUtil.AccessibilityServiceFragmentType;
 import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.display.DarkUIPreferenceController;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
 import com.android.settingslib.RestrictedLockUtilsInternal;
@@ -82,23 +79,14 @@
     private static final String CATEGORY_EXPERIMENTAL = "experimental_category";
     private static final String CATEGORY_DOWNLOADED_SERVICES = "user_installed_services_category";
 
-    private static final String[] CATEGORIES = new String[] {
+    private static final String[] CATEGORIES = new String[]{
             CATEGORY_SCREEN_READER, CATEGORY_AUDIO_AND_CAPTIONS, CATEGORY_DISPLAY,
             CATEGORY_INTERACTION_CONTROL, CATEGORY_EXPERIMENTAL, CATEGORY_DOWNLOADED_SERVICES
     };
 
     // Preferences
-    private static final String TOGGLE_INVERSION_PREFERENCE =
-            "toggle_inversion_preference";
-    private static final String TOGGLE_LARGE_POINTER_ICON =
-            "toggle_large_pointer_icon";
-    private static final String TOGGLE_DISABLE_ANIMATIONS = "toggle_disable_animations";
     private static final String DISPLAY_MAGNIFICATION_PREFERENCE_SCREEN =
             "magnification_preference_screen";
-    private static final String DISPLAY_DALTONIZER_PREFERENCE_SCREEN =
-            "daltonizer_preference";
-    private static final String DISPLAY_REDUCE_BRIGHT_COLORS_PREFERENCE_SCREEN =
-            "reduce_bright_colors_preference";
 
     // Extras passed to sub-fragments.
     static final String EXTRA_PREFERENCE_KEY = "preference_key";
@@ -167,13 +155,7 @@
     private final Map<ComponentName, PreferenceCategory> mPreBundledServiceComponentToCategoryMap =
             new ArrayMap<>();
 
-    private SwitchPreference mToggleLargePointerIconPreference;
-    private SwitchPreference mToggleDisableAnimationsPreference;
     private Preference mDisplayMagnificationPreferenceScreen;
-    private Preference mDisplayDaltonizerPreferenceScreen;
-    private Preference mToggleInversionPreference;
-    private Preference mReduceBrightColorsPreference;
-
 
     /**
      * Check if the color transforms are color accelerated. Some transforms are experimental only
@@ -226,7 +208,6 @@
     @Override
     public void onAttach(Context context) {
         super.onAttach(context);
-        use(DarkUIPreferenceController.class).setParentFragment(this);
         use(AccessibilityHearingAidPreferenceController.class)
                 .setFragmentManager(getFragmentManager());
     }
@@ -259,8 +240,8 @@
     /**
      * Returns the summary for the current state of this accessibilityService.
      *
-     * @param context A valid context
-     * @param info The accessibilityService's info
+     * @param context        A valid context
+     * @param info           The accessibilityService's info
      * @param serviceEnabled Whether the accessibility service is enabled.
      * @return The service summary
      */
@@ -299,8 +280,8 @@
     /**
      * Returns the description for the current state of this accessibilityService.
      *
-     * @param context A valid context
-     * @param info The accessibilityService's info
+     * @param context        A valid context
+     * @param info           The accessibilityService's info
      * @param serviceEnabled Whether the accessibility service is enabled.
      * @return The service description
      */
@@ -325,24 +306,9 @@
             mCategoryToPrefCategoryMap.put(CATEGORIES[i], prefCategory);
         }
 
-        // Display inversion.
-        mToggleInversionPreference = findPreference(TOGGLE_INVERSION_PREFERENCE);
-
-        // Large pointer icon.
-        mToggleLargePointerIconPreference = findPreference(TOGGLE_LARGE_POINTER_ICON);
-
-        mToggleDisableAnimationsPreference = findPreference(TOGGLE_DISABLE_ANIMATIONS);
-
         // Display magnification.
         mDisplayMagnificationPreferenceScreen = findPreference(
                 DISPLAY_MAGNIFICATION_PREFERENCE_SCREEN);
-
-        // Display color adjustments.
-        mDisplayDaltonizerPreferenceScreen = findPreference(DISPLAY_DALTONIZER_PREFERENCE_SCREEN);
-
-        // Reduce brightness.
-        mReduceBrightColorsPreference =
-                findPreference(DISPLAY_REDUCE_BRIGHT_COLORS_PREFERENCE_SCREEN);
     }
 
     private void updateAllPreferences() {
@@ -392,13 +358,13 @@
 
         // Update the order of all the category according to the order defined in xml file.
         updateCategoryOrderFromArray(CATEGORY_SCREEN_READER,
-            R.array.config_order_screen_reader_services);
+                R.array.config_order_screen_reader_services);
         updateCategoryOrderFromArray(CATEGORY_AUDIO_AND_CAPTIONS,
-            R.array.config_order_audio_and_caption_services);
+                R.array.config_order_audio_and_caption_services);
         updateCategoryOrderFromArray(CATEGORY_INTERACTION_CONTROL,
-            R.array.config_order_interaction_control_services);
+                R.array.config_order_interaction_control_services);
         updateCategoryOrderFromArray(CATEGORY_DISPLAY,
-            R.array.config_order_display_services);
+                R.array.config_order_display_services);
 
         // Need to check each time when updateServicePreferences() called.
         if (downloadedServicesCategory.getPreferenceCount() == 0) {
@@ -468,7 +434,7 @@
      * key with the string array of preference order which is defined in the xml.
      *
      * @param categoryKey The key of the category need to update the order
-     * @param key The key of the string array which defines the order of category
+     * @param key         The key of the string array which defines the order of category
      */
     private void updateCategoryOrderFromArray(String categoryKey, int key) {
         String[] services = getResources().getStringArray(key);
@@ -486,39 +452,11 @@
         }
     }
 
+    /**
+     * Updates preferences related to system configurations.
+     */
     protected void updateSystemPreferences() {
-        // Move color inversion and color correction preferences to Display category if device
-        // supports HWC hardware-accelerated color transform.
-        if (ColorDisplayManager.isColorTransformAccelerated(getContext())) {
-            PreferenceCategory experimentalCategory =
-                    mCategoryToPrefCategoryMap.get(CATEGORY_EXPERIMENTAL);
-            PreferenceCategory displayCategory =
-                    mCategoryToPrefCategoryMap.get(CATEGORY_DISPLAY);
-            experimentalCategory.removePreference(mToggleInversionPreference);
-            experimentalCategory.removePreference(mDisplayDaltonizerPreferenceScreen);
-            experimentalCategory.removePreference(mReduceBrightColorsPreference);
-            mDisplayMagnificationPreferenceScreen.setSummary(
-                    ToggleScreenMagnificationPreferenceFragment.getServiceSummary(getContext()));
-            mDisplayDaltonizerPreferenceScreen.setOrder(
-                    mDisplayMagnificationPreferenceScreen.getOrder() + 1);
-            mDisplayDaltonizerPreferenceScreen.setSummary(AccessibilityUtil.getSummary(
-                    getContext(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED));
-            mToggleInversionPreference.setOrder(
-                    mDisplayDaltonizerPreferenceScreen.getOrder() + 1);
-            mToggleLargePointerIconPreference.setOrder(
-                    mToggleInversionPreference.getOrder() + 1);
-            mToggleDisableAnimationsPreference.setOrder(
-                    mToggleLargePointerIconPreference.getOrder() + 1);
-            mToggleInversionPreference.setSummary(AccessibilityUtil.getSummary(
-                    getContext(), Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED));
-            mReduceBrightColorsPreference.setOrder(
-                    mToggleDisableAnimationsPreference.getOrder() + 1);
-            mReduceBrightColorsPreference.setSummary(AccessibilityUtil.getSummary(
-                    getContext(), Settings.Secure.REDUCE_BRIGHT_COLORS_ACTIVATED));
-            displayCategory.addPreference(mToggleInversionPreference);
-            displayCategory.addPreference(mDisplayDaltonizerPreferenceScreen);
-            displayCategory.addPreference(mReduceBrightColorsPreference);
-        }
+        // Do nothing.
     }
 
     public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
diff --git a/src/com/android/settings/accessibility/TextAndDisplayFragment.java b/src/com/android/settings/accessibility/TextAndDisplayFragment.java
new file mode 100644
index 0000000..b496e3d
--- /dev/null
+++ b/src/com/android/settings/accessibility/TextAndDisplayFragment.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2021 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.app.settings.SettingsEnums;
+import android.content.Context;
+import android.hardware.display.ColorDisplayManager;
+import android.os.Bundle;
+import android.provider.Settings;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceCategory;
+import androidx.preference.SwitchPreference;
+
+import com.android.settings.R;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.display.DarkUIPreferenceController;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.search.SearchIndexable;
+
+/** Accessibility settings for text and display. */
+@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
+public class TextAndDisplayFragment extends DashboardFragment {
+
+    private static final String TAG = "TextAndDisplayFragment";
+
+    private static final String CATEGORY_EXPERIMENTAL = "experimental_category";
+
+    // Preferences
+    private static final String DISPLAY_DALTONIZER_PREFERENCE_SCREEN = "daltonizer_preference";
+    private static final String TOGGLE_INVERSION_PREFERENCE = "toggle_inversion_preference";
+    private static final String DISPLAY_REDUCE_BRIGHT_COLORS_PREFERENCE_SCREEN =
+            "reduce_bright_colors_preference";
+    private static final String TOGGLE_DISABLE_ANIMATIONS = "toggle_disable_animations";
+    private static final String TOGGLE_LARGE_POINTER_ICON = "toggle_large_pointer_icon";
+
+    private Preference mDisplayDaltonizerPreferenceScreen;
+    private Preference mToggleInversionPreference;
+    private Preference mReduceBrightColorsPreference;
+    private SwitchPreference mToggleDisableAnimationsPreference;
+    private SwitchPreference mToggleLargePointerIconPreference;
+
+    @Override
+    public int getMetricsCategory() {
+        return SettingsEnums.ACCESSIBILITY_TEXT_AND_DISPLAY;
+    }
+
+
+    @Override
+    public void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        initializeAllPreferences();
+        updateSystemPreferences();
+    }
+
+    @Override
+    public void onAttach(Context context) {
+        super.onAttach(context);
+        use(DarkUIPreferenceController.class).setParentFragment(this);
+    }
+
+    @Override
+    protected int getPreferenceScreenResId() {
+        return R.xml.accessibility_text_and_display;
+    }
+
+    @Override
+    protected String getLogTag() {
+        return TAG;
+    }
+
+    private void initializeAllPreferences() {
+        // Display color adjustments.
+        mDisplayDaltonizerPreferenceScreen = findPreference(DISPLAY_DALTONIZER_PREFERENCE_SCREEN);
+
+        // Display inversion.
+        mToggleInversionPreference = findPreference(TOGGLE_INVERSION_PREFERENCE);
+
+        // Reduce brightness.
+        mReduceBrightColorsPreference =
+                findPreference(DISPLAY_REDUCE_BRIGHT_COLORS_PREFERENCE_SCREEN);
+
+        // Disable animation.
+        mToggleDisableAnimationsPreference = findPreference(TOGGLE_DISABLE_ANIMATIONS);
+
+        // Large pointer icon.
+        mToggleLargePointerIconPreference = findPreference(TOGGLE_LARGE_POINTER_ICON);
+    }
+
+    /**
+     * Updates preferences related to system configurations.
+     */
+    private void updateSystemPreferences() {
+        final PreferenceCategory experimentalCategory = getPreferenceScreen().findPreference(
+                CATEGORY_EXPERIMENTAL);
+        if (ColorDisplayManager.isColorTransformAccelerated(getContext())) {
+            mDisplayDaltonizerPreferenceScreen.setSummary(AccessibilityUtil.getSummary(
+                    getContext(), Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED));
+            mToggleInversionPreference.setSummary(AccessibilityUtil.getSummary(
+                    getContext(), Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED));
+            mReduceBrightColorsPreference.setSummary(AccessibilityUtil.getSummary(
+                    getContext(), Settings.Secure.REDUCE_BRIGHT_COLORS_ACTIVATED));
+            getPreferenceScreen().removePreference(experimentalCategory);
+        } else {
+            // Move following preferences to experimental category if device don't supports HWC
+            // hardware-accelerated color transform.
+            getPreferenceScreen().removePreference(mDisplayDaltonizerPreferenceScreen);
+            getPreferenceScreen().removePreference(mToggleInversionPreference);
+            getPreferenceScreen().removePreference(mReduceBrightColorsPreference);
+            getPreferenceScreen().removePreference(mToggleDisableAnimationsPreference);
+            getPreferenceScreen().removePreference(mToggleLargePointerIconPreference);
+            experimentalCategory.addPreference(mDisplayDaltonizerPreferenceScreen);
+            experimentalCategory.addPreference(mToggleInversionPreference);
+            experimentalCategory.addPreference(mReduceBrightColorsPreference);
+            experimentalCategory.addPreference(mToggleDisableAnimationsPreference);
+            experimentalCategory.addPreference(mToggleLargePointerIconPreference);
+        }
+    }
+
+    public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+            new BaseSearchIndexProvider(R.xml.accessibility_text_and_display);
+}
diff --git a/src/com/android/settings/display/NightDisplayPreferenceController.java b/src/com/android/settings/display/NightDisplayPreferenceController.java
index 0198007..003373c 100644
--- a/src/com/android/settings/display/NightDisplayPreferenceController.java
+++ b/src/com/android/settings/display/NightDisplayPreferenceController.java
@@ -17,6 +17,7 @@
 import android.hardware.display.ColorDisplayManager;
 import android.hardware.display.NightDisplayListener;
 
+import androidx.preference.Preference;
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.R;
@@ -32,6 +33,7 @@
 
     private final ColorDisplayManager mColorDisplayManager;
     private final NightDisplayListener mNightDisplayListener;
+    private final NightDisplayTimeFormatter mTimeFormatter;
     private PrimarySwitchPreference mPreference;
 
     public NightDisplayPreferenceController(Context context, String key) {
@@ -39,6 +41,7 @@
 
         mColorDisplayManager = context.getSystemService(ColorDisplayManager.class);
         mNightDisplayListener = new NightDisplayListener(context);
+        mTimeFormatter = new NightDisplayTimeFormatter(context);
     }
 
     public static boolean isSuggestionComplete(Context context) {
@@ -87,6 +90,12 @@
     }
 
     @Override
+    public void updateState(Preference preference) {
+        super.updateState(preference);
+        preference.setSummary(mTimeFormatter.getAutoModeSummary(mContext, mColorDisplayManager));
+    }
+
+    @Override
     public void onActivated(boolean activated) {
         updateState(mPreference);
     }
diff --git a/src/com/android/settings/display/NightDisplayTimeFormatter.java b/src/com/android/settings/display/NightDisplayTimeFormatter.java
index 1449ac1..aa715de 100644
--- a/src/com/android/settings/display/NightDisplayTimeFormatter.java
+++ b/src/com/android/settings/display/NightDisplayTimeFormatter.java
@@ -17,8 +17,8 @@
 package com.android.settings.display;
 
 import android.content.Context;
-
 import android.hardware.display.ColorDisplayManager;
+
 import com.android.settings.R;
 
 import java.text.DateFormat;
@@ -45,13 +45,6 @@
         return mTimeFormatter.format(c.getTime());
     }
 
-    public String getAutoModeTimeSummary(Context context, ColorDisplayManager manager) {
-        final int summaryFormatResId =
-                manager.isNightDisplayActivated() ? R.string.night_display_summary_on
-                        : R.string.night_display_summary_off;
-        return context.getString(summaryFormatResId, getAutoModeSummary(context, manager));
-    }
-
     public String getAutoModeSummary(Context context, ColorDisplayManager manager) {
         final boolean isActivated = manager.isNightDisplayActivated();
         final int autoMode = manager.getNightDisplayAutoMode();
diff --git a/src/com/android/settings/display/darkmode/DarkModePreference.java b/src/com/android/settings/display/darkmode/DarkModePreference.java
index baaa1f7..c69bb01 100644
--- a/src/com/android/settings/display/darkmode/DarkModePreference.java
+++ b/src/com/android/settings/display/darkmode/DarkModePreference.java
@@ -74,10 +74,10 @@
             return;
         }
         final int mode = mUiModeManager.getNightMode();
-        String detail;
+        String summary;
 
         if (mode == UiModeManager.MODE_NIGHT_AUTO) {
-            detail = getContext().getString(active
+            summary = getContext().getString(active
                     ? R.string.dark_ui_summary_on_auto_mode_auto
                     : R.string.dark_ui_summary_off_auto_mode_auto);
         } else if (mode == UiModeManager.MODE_NIGHT_CUSTOM) {
@@ -85,17 +85,14 @@
                     ? mUiModeManager.getCustomNightModeEnd()
                     : mUiModeManager.getCustomNightModeStart();
             final String timeStr = mFormat.of(time);
-            detail = getContext().getString(active
+            summary = getContext().getString(active
                     ? R.string.dark_ui_summary_on_auto_mode_custom
                     : R.string.dark_ui_summary_off_auto_mode_custom, timeStr);
         } else {
-            detail = getContext().getString(active
+            summary = getContext().getString(active
                     ? R.string.dark_ui_summary_on_auto_mode_never
                     : R.string.dark_ui_summary_off_auto_mode_never);
         }
-        String summary = getContext().getString(active
-                ? R.string.dark_ui_summary_on
-                : R.string.dark_ui_summary_off, detail);
 
         setSummary(summary);
     }
diff --git a/src/com/android/settings/overlay/FeatureFactory.java b/src/com/android/settings/overlay/FeatureFactory.java
index b9aa68a..a15075e 100644
--- a/src/com/android/settings/overlay/FeatureFactory.java
+++ b/src/com/android/settings/overlay/FeatureFactory.java
@@ -41,6 +41,7 @@
 import com.android.settings.security.SecurityFeatureProvider;
 import com.android.settings.slices.SlicesFeatureProvider;
 import com.android.settings.users.UserFeatureProvider;
+import com.android.settings.wifi.WifiTrackerLibProvider;
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 
 /**
@@ -143,6 +144,11 @@
 
     public abstract FaceFeatureProvider getFaceFeatureProvider();
 
+    /**
+     * Gets implementation for the WifiTrackerLib.
+     */
+    public abstract WifiTrackerLibProvider getWifiTrackerLibProvider();
+
     public static final class FactoryNotFoundException extends RuntimeException {
         public FactoryNotFoundException(Throwable throwable) {
             super("Unable to create factory. Did you misconfigure Proguard?", throwable);
diff --git a/src/com/android/settings/overlay/FeatureFactoryImpl.java b/src/com/android/settings/overlay/FeatureFactoryImpl.java
index d4d396f..ebbe87c 100644
--- a/src/com/android/settings/overlay/FeatureFactoryImpl.java
+++ b/src/com/android/settings/overlay/FeatureFactoryImpl.java
@@ -62,6 +62,8 @@
 import com.android.settings.slices.SlicesFeatureProviderImpl;
 import com.android.settings.users.UserFeatureProvider;
 import com.android.settings.users.UserFeatureProviderImpl;
+import com.android.settings.wifi.WifiTrackerLibProvider;
+import com.android.settings.wifi.WifiTrackerLibProviderImpl;
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 
 /**
@@ -90,6 +92,7 @@
     private BluetoothFeatureProvider mBluetoothFeatureProvider;
     private AwareFeatureProvider mAwareFeatureProvider;
     private FaceFeatureProvider mFaceFeatureProvider;
+    private WifiTrackerLibProvider mWifiTrackerLibProvider;
 
     @Override
     public SupportFeatureProvider getSupportFeatureProvider(Context context) {
@@ -278,4 +281,12 @@
         }
         return mFaceFeatureProvider;
     }
+
+    @Override
+    public WifiTrackerLibProvider getWifiTrackerLibProvider() {
+        if (mWifiTrackerLibProvider == null) {
+            mWifiTrackerLibProvider = new WifiTrackerLibProviderImpl();
+        }
+        return mWifiTrackerLibProvider;
+    }
 }
diff --git a/src/com/android/settings/slices/SettingsSliceProvider.java b/src/com/android/settings/slices/SettingsSliceProvider.java
index 0c6205f..7c487ba 100644
--- a/src/com/android/settings/slices/SettingsSliceProvider.java
+++ b/src/com/android/settings/slices/SettingsSliceProvider.java
@@ -343,7 +343,7 @@
         final Intent settingsIntent = new Intent(Settings.ACTION_SETTINGS)
                 .setPackage(Utils.SETTINGS_PACKAGE_NAME);
         final PendingIntent noOpIntent = PendingIntent.getActivity(getContext(),
-                0 /* requestCode */, settingsIntent, 0 /* flags */);
+                0 /* requestCode */, settingsIntent, PendingIntent.FLAG_IMMUTABLE);
         return noOpIntent;
     }
 
diff --git a/src/com/android/settings/wifi/ConfigureWifiEntryFragment.java b/src/com/android/settings/wifi/ConfigureWifiEntryFragment.java
index 881aaea..c36a298 100644
--- a/src/com/android/settings/wifi/ConfigureWifiEntryFragment.java
+++ b/src/com/android/settings/wifi/ConfigureWifiEntryFragment.java
@@ -21,9 +21,6 @@
 import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.content.Intent;
-import android.net.ConnectivityManager;
-import android.net.NetworkScoreManager;
-import android.net.wifi.WifiManager;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.HandlerThread;
@@ -40,6 +37,7 @@
 
 import com.android.settings.R;
 import com.android.settings.core.InstrumentedFragment;
+import com.android.settings.overlay.FeatureFactory;
 import com.android.settings.wifi.details2.WifiNetworkDetailsFragment2;
 import com.android.wifitrackerlib.NetworkDetailsTracker;
 import com.android.wifitrackerlib.WifiEntry;
@@ -222,17 +220,17 @@
             }
         };
 
-        mNetworkDetailsTracker = NetworkDetailsTracker.createNetworkDetailsTracker(
-                getSettingsLifecycle(),
-                context,
-                context.getSystemService(WifiManager.class),
-                context.getSystemService(ConnectivityManager.class),
-                context.getSystemService(NetworkScoreManager.class),
-                new Handler(Looper.getMainLooper()),
-                mWorkerThread.getThreadHandler(),
-                elapsedRealtimeClock,
-                MAX_SCAN_AGE_MILLIS,
-                SCAN_INTERVAL_MILLIS,
-                getArguments().getString(WifiNetworkDetailsFragment2.KEY_CHOSEN_WIFIENTRY_KEY));
+        mNetworkDetailsTracker = FeatureFactory.getFactory(context)
+                .getWifiTrackerLibProvider()
+                .createNetworkDetailsTracker(
+                        getSettingsLifecycle(),
+                        context,
+                        new Handler(Looper.getMainLooper()),
+                        mWorkerThread.getThreadHandler(),
+                        elapsedRealtimeClock,
+                        MAX_SCAN_AGE_MILLIS,
+                        SCAN_INTERVAL_MILLIS,
+                        getArguments().getString(
+                                WifiNetworkDetailsFragment2.KEY_CHOSEN_WIFIENTRY_KEY));
     }
 }
diff --git a/src/com/android/settings/wifi/NetworkRequestDialogFragment.java b/src/com/android/settings/wifi/NetworkRequestDialogFragment.java
index 887f09f..11f3612 100644
--- a/src/com/android/settings/wifi/NetworkRequestDialogFragment.java
+++ b/src/com/android/settings/wifi/NetworkRequestDialogFragment.java
@@ -24,11 +24,8 @@
 import android.content.Context;
 import android.content.DialogInterface;
 import android.graphics.drawable.Drawable;
-import android.net.ConnectivityManager;
-import android.net.NetworkScoreManager;
 import android.net.wifi.ScanResult;
 import android.net.wifi.WifiConfiguration;
-import android.net.wifi.WifiManager;
 import android.net.wifi.WifiManager.NetworkRequestMatchCallback;
 import android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback;
 import android.os.Bundle;
@@ -54,6 +51,7 @@
 import androidx.preference.internal.PreferenceImageView;
 
 import com.android.settings.R;
+import com.android.settings.overlay.FeatureFactory;
 import com.android.settingslib.Utils;
 import com.android.wifitrackerlib.WifiEntry;
 import com.android.wifitrackerlib.WifiPickerTracker;
@@ -113,16 +111,15 @@
             }
         };
         final Context context = getContext();
-        mWifiPickerTracker = new WifiPickerTracker(getSettingsLifecycle(), context,
-                context.getSystemService(WifiManager.class),
-                context.getSystemService(ConnectivityManager.class),
-                context.getSystemService(NetworkScoreManager.class),
-                new Handler(Looper.getMainLooper()),
-                mWorkerThread.getThreadHandler(),
-                elapsedRealtimeClock,
-                MAX_SCAN_AGE_MILLIS,
-                SCAN_INTERVAL_MILLIS,
-                this);
+        mWifiPickerTracker = FeatureFactory.getFactory(context)
+                .getWifiTrackerLibProvider()
+                .createWifiPickerTracker(getSettingsLifecycle(), context,
+                        new Handler(Looper.getMainLooper()),
+                        mWorkerThread.getThreadHandler(),
+                        elapsedRealtimeClock,
+                        MAX_SCAN_AGE_MILLIS,
+                        SCAN_INTERVAL_MILLIS,
+                        this);
     }
 
     @Override
diff --git a/src/com/android/settings/wifi/WifiConnectionPreferenceController.java b/src/com/android/settings/wifi/WifiConnectionPreferenceController.java
index 13d5082..3b2669c 100644
--- a/src/com/android/settings/wifi/WifiConnectionPreferenceController.java
+++ b/src/com/android/settings/wifi/WifiConnectionPreferenceController.java
@@ -17,9 +17,6 @@
 package com.android.settings.wifi;
 
 import android.content.Context;
-import android.net.ConnectivityManager;
-import android.net.NetworkScoreManager;
-import android.net.wifi.WifiManager;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.HandlerThread;
@@ -36,6 +33,7 @@
 
 import com.android.settings.R;
 import com.android.settings.core.SubSettingLauncher;
+import com.android.settings.overlay.FeatureFactory;
 import com.android.settings.wifi.details2.WifiNetworkDetailsFragment2;
 import com.android.settingslib.core.AbstractPreferenceController;
 import com.android.settingslib.core.lifecycle.Lifecycle;
@@ -115,16 +113,15 @@
                 return SystemClock.elapsedRealtime();
             }
         };
-        mWifiPickerTracker = new WifiPickerTracker(lifecycle, context,
-                context.getSystemService(WifiManager.class),
-                context.getSystemService(ConnectivityManager.class),
-                context.getSystemService(NetworkScoreManager.class),
-                new Handler(Looper.getMainLooper()),
-                mWorkerThread.getThreadHandler(),
-                elapsedRealtimeClock,
-                MAX_SCAN_AGE_MILLIS,
-                SCAN_INTERVAL_MILLIS,
-                this);
+        mWifiPickerTracker = FeatureFactory.getFactory(context)
+                .getWifiTrackerLibProvider()
+                .createWifiPickerTracker(lifecycle, context,
+                        new Handler(Looper.getMainLooper()),
+                        mWorkerThread.getThreadHandler(),
+                        elapsedRealtimeClock,
+                        MAX_SCAN_AGE_MILLIS,
+                        SCAN_INTERVAL_MILLIS,
+                        this);
     }
 
     /**
diff --git a/src/com/android/settings/wifi/WifiDialogActivity.java b/src/com/android/settings/wifi/WifiDialogActivity.java
index 000ed3e..1c5a8ed 100644
--- a/src/com/android/settings/wifi/WifiDialogActivity.java
+++ b/src/com/android/settings/wifi/WifiDialogActivity.java
@@ -18,9 +18,7 @@
 
 import android.content.DialogInterface;
 import android.content.Intent;
-import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
-import android.net.NetworkScoreManager;
 import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiManager;
 import android.net.wifi.WifiManager.ActionListener;
@@ -38,6 +36,7 @@
 
 import com.android.settings.R;
 import com.android.settings.SetupWizardUtils;
+import com.android.settings.overlay.FeatureFactory;
 import com.android.settings.wifi.dpp.WifiDppUtils;
 import com.android.settingslib.core.lifecycle.ObservableActivity;
 import com.android.settingslib.wifi.AccessPoint;
@@ -124,18 +123,17 @@
                     return SystemClock.elapsedRealtime();
                 }
             };
-            mNetworkDetailsTracker = NetworkDetailsTracker.createNetworkDetailsTracker(
-                    getLifecycle(),
-                    this,
-                    getSystemService(WifiManager.class),
-                    getSystemService(ConnectivityManager.class),
-                    getSystemService(NetworkScoreManager.class),
-                    new Handler(Looper.getMainLooper()),
-                    mWorkerThread.getThreadHandler(),
-                    elapsedRealtimeClock,
-                    MAX_SCAN_AGE_MILLIS,
-                    SCAN_INTERVAL_MILLIS,
-                    mIntent.getStringExtra(KEY_CHOSEN_WIFIENTRY_KEY));
+            mNetworkDetailsTracker = FeatureFactory.getFactory(this)
+                    .getWifiTrackerLibProvider()
+                    .createNetworkDetailsTracker(
+                            getLifecycle(),
+                            this,
+                            new Handler(Looper.getMainLooper()),
+                            mWorkerThread.getThreadHandler(),
+                            elapsedRealtimeClock,
+                            MAX_SCAN_AGE_MILLIS,
+                            SCAN_INTERVAL_MILLIS,
+                            mIntent.getStringExtra(KEY_CHOSEN_WIFIENTRY_KEY));
         } else {
             final Bundle accessPointState = mIntent.getBundleExtra(KEY_ACCESS_POINT_STATE);
             if (accessPointState != null) {
diff --git a/src/com/android/settings/wifi/WifiPickerTrackerHelper.java b/src/com/android/settings/wifi/WifiPickerTrackerHelper.java
index 60a4a01..c20f355 100644
--- a/src/com/android/settings/wifi/WifiPickerTrackerHelper.java
+++ b/src/com/android/settings/wifi/WifiPickerTrackerHelper.java
@@ -17,9 +17,6 @@
 package com.android.settings.wifi;
 
 import android.content.Context;
-import android.net.ConnectivityManager;
-import android.net.NetworkScoreManager;
-import android.net.wifi.WifiManager;
 import android.os.Handler;
 import android.os.HandlerThread;
 import android.os.Looper;
@@ -34,6 +31,7 @@
 import androidx.lifecycle.OnLifecycleEvent;
 
 import com.android.internal.annotations.VisibleForTesting;
+import com.android.settings.overlay.FeatureFactory;
 import com.android.wifitrackerlib.MergedCarrierEntry;
 import com.android.wifitrackerlib.WifiEntry;
 import com.android.wifitrackerlib.WifiPickerTracker;
@@ -72,16 +70,16 @@
                 Process.THREAD_PRIORITY_BACKGROUND);
         mWorkerThread.start();
 
-        mWifiPickerTracker = new WifiPickerTracker(lifecycle, context,
-                context.getSystemService(WifiManager.class),
-                context.getSystemService(ConnectivityManager.class),
-                context.getSystemService(NetworkScoreManager.class),
+        mWifiPickerTracker =  FeatureFactory.getFactory(context)
+                .getWifiTrackerLibProvider()
+                .createWifiPickerTracker(lifecycle, context,
                 new Handler(Looper.getMainLooper()),
                 mWorkerThread.getThreadHandler(),
                 ELAPSED_REALTIME_CLOCK,
                 MAX_SCAN_AGE_MILLIS,
                 SCAN_INTERVAL_MILLIS,
                 listener);
+
     }
 
     @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 2804393..cf8242b 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -27,8 +27,6 @@
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
-import android.net.ConnectivityManager;
-import android.net.NetworkScoreManager;
 import android.net.NetworkTemplate;
 import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiManager;
@@ -66,6 +64,7 @@
 import com.android.settings.datausage.DataUsagePreference;
 import com.android.settings.datausage.DataUsageUtils;
 import com.android.settings.location.ScanningSettings;
+import com.android.settings.overlay.FeatureFactory;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settings.widget.SwitchBarController;
 import com.android.settings.wifi.details2.WifiNetworkDetailsFragment2;
@@ -283,16 +282,15 @@
                 return SystemClock.elapsedRealtime();
             }
         };
-        mWifiPickerTracker = new WifiPickerTracker(getSettingsLifecycle(), context,
-                context.getSystemService(WifiManager.class),
-                context.getSystemService(ConnectivityManager.class),
-                context.getSystemService(NetworkScoreManager.class),
-                new Handler(Looper.getMainLooper()),
-                mWorkerThread.getThreadHandler(),
-                elapsedRealtimeClock,
-                MAX_SCAN_AGE_MILLIS,
-                SCAN_INTERVAL_MILLIS,
-                this);
+        mWifiPickerTracker = FeatureFactory.getFactory(context)
+                .getWifiTrackerLibProvider()
+                .createWifiPickerTracker(getSettingsLifecycle(), context,
+                        new Handler(Looper.getMainLooper()),
+                        mWorkerThread.getThreadHandler(),
+                        elapsedRealtimeClock,
+                        MAX_SCAN_AGE_MILLIS,
+                        SCAN_INTERVAL_MILLIS,
+                        this);
 
         final Activity activity = getActivity();
 
diff --git a/src/com/android/settings/wifi/WifiTrackerLibProvider.java b/src/com/android/settings/wifi/WifiTrackerLibProvider.java
new file mode 100644
index 0000000..10b3373
--- /dev/null
+++ b/src/com/android/settings/wifi/WifiTrackerLibProvider.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2020 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.wifi;
+
+import android.content.Context;
+import android.os.Handler;
+
+import androidx.lifecycle.Lifecycle;
+
+import com.android.wifitrackerlib.NetworkDetailsTracker;
+import com.android.wifitrackerlib.WifiPickerTracker;
+
+import java.time.Clock;
+
+/**
+ * Provides the objects instances from the AOSP WifiTrackerLib.
+ */
+public interface WifiTrackerLibProvider {
+
+    /** Create a new instance of WifiPickerTracker */
+    WifiPickerTracker createWifiPickerTracker(
+            Lifecycle lifecycle, Context context,
+            Handler mainHandler, Handler workerHandler, Clock clock,
+            long maxScanAgeMillis, long scanIntervalMillis,
+            WifiPickerTracker.WifiPickerTrackerCallback listener);
+
+    /** Create a new instance of NetworkDetailsTracker */
+    NetworkDetailsTracker createNetworkDetailsTracker(
+            Lifecycle lifecycle, Context context,
+            Handler mainHandler, Handler workerHandler, Clock clock,
+            long maxScanAgeMillis, long scanIntervalMillis,
+            String key);
+
+}
diff --git a/src/com/android/settings/wifi/WifiTrackerLibProviderImpl.java b/src/com/android/settings/wifi/WifiTrackerLibProviderImpl.java
new file mode 100644
index 0000000..f835409
--- /dev/null
+++ b/src/com/android/settings/wifi/WifiTrackerLibProviderImpl.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2020 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.wifi;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.NetworkScoreManager;
+import android.net.wifi.WifiManager;
+import android.os.Handler;
+
+import androidx.lifecycle.Lifecycle;
+
+import com.android.wifitrackerlib.NetworkDetailsTracker;
+import com.android.wifitrackerlib.WifiPickerTracker;
+
+import java.time.Clock;
+
+/**
+ * Implementation of AOSP WifiTrackerLibProvider.
+ */
+public class WifiTrackerLibProviderImpl implements WifiTrackerLibProvider {
+
+    /**
+     * Create an instance of WifiPickerTracker.
+     */
+    @Override
+    public WifiPickerTracker createWifiPickerTracker(
+            Lifecycle lifecycle, Context context,
+            Handler mainHandler, Handler workerHandler, Clock clock,
+            long maxScanAgeMillis, long scanIntervalMillis,
+            WifiPickerTracker.WifiPickerTrackerCallback listener) {
+        return new WifiPickerTracker(
+                lifecycle, context,
+                context.getSystemService(WifiManager.class),
+                context.getSystemService(ConnectivityManager.class),
+                context.getSystemService(NetworkScoreManager.class),
+                mainHandler, workerHandler, clock,
+                maxScanAgeMillis, scanIntervalMillis,
+                listener);
+    }
+
+    /**
+     * Create an instance of NetworkDetailsTracker.
+     */
+    @Override
+    public NetworkDetailsTracker createNetworkDetailsTracker(
+            Lifecycle lifecycle, Context context,
+            Handler mainHandler, Handler workerHandler, Clock clock,
+            long maxScanAgeMillis, long scanIntervalMillis,
+            String key) {
+        return NetworkDetailsTracker.createNetworkDetailsTracker(
+                lifecycle, context,
+                context.getSystemService(WifiManager.class),
+                context.getSystemService(ConnectivityManager.class),
+                context.getSystemService(NetworkScoreManager.class),
+                mainHandler, workerHandler, clock,
+                maxScanAgeMillis, scanIntervalMillis,
+                key);
+    }
+}
diff --git a/src/com/android/settings/wifi/addappnetworks/AddAppNetworksFragment.java b/src/com/android/settings/wifi/addappnetworks/AddAppNetworksFragment.java
index 3921488..46f4414 100644
--- a/src/com/android/settings/wifi/addappnetworks/AddAppNetworksFragment.java
+++ b/src/com/android/settings/wifi/addappnetworks/AddAppNetworksFragment.java
@@ -24,8 +24,6 @@
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.graphics.drawable.Drawable;
-import android.net.ConnectivityManager;
-import android.net.NetworkScoreManager;
 import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiConfiguration.KeyMgmt;
 import android.net.wifi.WifiManager;
@@ -60,6 +58,7 @@
 import com.android.settings.R;
 import com.android.settings.Utils;
 import com.android.settings.core.InstrumentedFragment;
+import com.android.settings.overlay.FeatureFactory;
 import com.android.wifitrackerlib.WifiEntry;
 import com.android.wifitrackerlib.WifiPickerTracker;
 
@@ -191,16 +190,15 @@
                 return SystemClock.elapsedRealtime();
             }
         };
-        mWifiPickerTracker = new WifiPickerTracker(getSettingsLifecycle(), mActivity,
-                mActivity.getSystemService(WifiManager.class),
-                mActivity.getSystemService(ConnectivityManager.class),
-                mActivity.getSystemService(NetworkScoreManager.class),
-                new Handler(Looper.getMainLooper()),
-                mWorkerThread.getThreadHandler(),
-                elapsedRealtimeClock,
-                MAX_SCAN_AGE_MILLIS,
-                SCAN_INTERVAL_MILLIS,
-                this);
+        mWifiPickerTracker = FeatureFactory.getFactory(mActivity.getApplicationContext())
+                .getWifiTrackerLibProvider()
+                .createWifiPickerTracker(getSettingsLifecycle(), mActivity,
+                        new Handler(Looper.getMainLooper()),
+                        mWorkerThread.getThreadHandler(),
+                        elapsedRealtimeClock,
+                        MAX_SCAN_AGE_MILLIS,
+                        SCAN_INTERVAL_MILLIS,
+                        this);
         return inflater.inflate(R.layout.wifi_add_app_networks, container, false);
     }
 
diff --git a/src/com/android/settings/wifi/details2/WifiNetworkDetailsFragment2.java b/src/com/android/settings/wifi/details2/WifiNetworkDetailsFragment2.java
index d0708ea..b154a9b 100644
--- a/src/com/android/settings/wifi/details2/WifiNetworkDetailsFragment2.java
+++ b/src/com/android/settings/wifi/details2/WifiNetworkDetailsFragment2.java
@@ -22,7 +22,6 @@
 import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.net.ConnectivityManager;
-import android.net.NetworkScoreManager;
 import android.net.wifi.WifiManager;
 import android.os.Handler;
 import android.os.HandlerThread;
@@ -42,6 +41,7 @@
 import com.android.settings.R;
 import com.android.settings.Utils;
 import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.overlay.FeatureFactory;
 import com.android.settings.wifi.WifiConfigUiBase2;
 import com.android.settings.wifi.WifiDialog2;
 import com.android.settingslib.RestrictedLockUtils;
@@ -239,18 +239,17 @@
             }
         };
 
-        mNetworkDetailsTracker = NetworkDetailsTracker.createNetworkDetailsTracker(
-                getSettingsLifecycle(),
-                context,
-                context.getSystemService(WifiManager.class),
-                context.getSystemService(ConnectivityManager.class),
-                context.getSystemService(NetworkScoreManager.class),
-                new Handler(Looper.getMainLooper()),
-                mWorkerThread.getThreadHandler(),
-                elapsedRealtimeClock,
-                MAX_SCAN_AGE_MILLIS,
-                SCAN_INTERVAL_MILLIS,
-                getArguments().getString(KEY_CHOSEN_WIFIENTRY_KEY));
+        mNetworkDetailsTracker = FeatureFactory.getFactory(context)
+                .getWifiTrackerLibProvider()
+                .createNetworkDetailsTracker(
+                        getSettingsLifecycle(),
+                        context,
+                        new Handler(Looper.getMainLooper()),
+                        mWorkerThread.getThreadHandler(),
+                        elapsedRealtimeClock,
+                        MAX_SCAN_AGE_MILLIS,
+                        SCAN_INTERVAL_MILLIS,
+                        getArguments().getString(KEY_CHOSEN_WIFIENTRY_KEY));
     }
 
     /**
diff --git a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
index cee3ccd..5c80024 100644
--- a/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
+++ b/src/com/android/settings/wifi/dpp/WifiDppQrCodeScannerFragment.java
@@ -25,8 +25,6 @@
 import android.graphics.Matrix;
 import android.graphics.Rect;
 import android.graphics.SurfaceTexture;
-import android.net.ConnectivityManager;
-import android.net.NetworkScoreManager;
 import android.net.wifi.EasyConnectStatusCallback;
 import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiManager;
@@ -57,6 +55,7 @@
 import androidx.lifecycle.ViewModelProviders;
 
 import com.android.settings.R;
+import com.android.settings.overlay.FeatureFactory;
 import com.android.settings.wifi.qrcode.QrCamera;
 import com.android.settings.wifi.qrcode.QrDecorateView;
 import com.android.wifitrackerlib.WifiEntry;
@@ -363,16 +362,15 @@
             }
         };
         final Context context = getContext();
-        mWifiPickerTracker = new WifiPickerTracker(getSettingsLifecycle(), context,
-                context.getSystemService(WifiManager.class),
-                context.getSystemService(ConnectivityManager.class),
-                context.getSystemService(NetworkScoreManager.class),
-                new Handler(Looper.getMainLooper()),
-                mWorkerThread.getThreadHandler(),
-                elapsedRealtimeClock,
-                MAX_SCAN_AGE_MILLIS,
-                SCAN_INTERVAL_MILLIS,
-                null /* listener */);
+        mWifiPickerTracker = FeatureFactory.getFactory(context)
+                .getWifiTrackerLibProvider()
+                .createWifiPickerTracker(getSettingsLifecycle(), context,
+                        new Handler(Looper.getMainLooper()),
+                        mWorkerThread.getThreadHandler(),
+                        elapsedRealtimeClock,
+                        MAX_SCAN_AGE_MILLIS,
+                        SCAN_INTERVAL_MILLIS,
+                        null /* listener */);
 
         // setTitle for TalkBack
         if (mIsConfiguratorMode) {
diff --git a/src/com/android/settings/wifi/slice/WifiScanWorker.java b/src/com/android/settings/wifi/slice/WifiScanWorker.java
index a87b36a..78b0d33 100644
--- a/src/com/android/settings/wifi/slice/WifiScanWorker.java
+++ b/src/com/android/settings/wifi/slice/WifiScanWorker.java
@@ -19,8 +19,6 @@
 import static com.android.settings.wifi.slice.WifiSlice.DEFAULT_EXPANDED_ROW_COUNT;
 
 import android.content.Context;
-import android.net.ConnectivityManager;
-import android.net.NetworkScoreManager;
 import android.net.Uri;
 import android.net.wifi.WifiManager;
 import android.os.HandlerThread;
@@ -34,6 +32,7 @@
 import androidx.lifecycle.LifecycleOwner;
 import androidx.lifecycle.LifecycleRegistry;
 
+import com.android.settings.overlay.FeatureFactory;
 import com.android.settings.slices.SliceBackgroundWorker;
 import com.android.settingslib.utils.ThreadUtils;
 import com.android.wifitrackerlib.MergedCarrierEntry;
@@ -79,16 +78,15 @@
                 return SystemClock.elapsedRealtime();
             }
         };
-        mWifiPickerTracker = new WifiPickerTracker(getLifecycle(), context,
-                context.getSystemService(WifiManager.class),
-                context.getSystemService(ConnectivityManager.class),
-                context.getSystemService(NetworkScoreManager.class),
-                ThreadUtils.getUiThreadHandler(),
-                mWorkerThread.getThreadHandler(),
-                elapsedRealtimeClock,
-                MAX_SCAN_AGE_MILLIS,
-                SCAN_INTERVAL_MILLIS,
-                this);
+        mWifiPickerTracker = FeatureFactory.getFactory(context)
+                .getWifiTrackerLibProvider()
+                .createWifiPickerTracker(getLifecycle(), context,
+                        ThreadUtils.getUiThreadHandler(),
+                        mWorkerThread.getThreadHandler(),
+                        elapsedRealtimeClock,
+                        MAX_SCAN_AGE_MILLIS,
+                        SCAN_INTERVAL_MILLIS,
+                        this);
 
         mLifecycleRegistry.markState(Lifecycle.State.INITIALIZED);
         mLifecycleRegistry.markState(Lifecycle.State.CREATED);
diff --git a/tests/robotests/src/com/android/settings/accessibility/TextAndDisplayFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/TextAndDisplayFragmentTest.java
new file mode 100644
index 0000000..96756ecd
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/TextAndDisplayFragmentTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2021 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.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.settings.R;
+import com.android.settings.testutils.XmlTestUtils;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+
+import java.util.List;
+
+@RunWith(RobolectricTestRunner.class)
+public class TextAndDisplayFragmentTest {
+
+    private Context mContext = ApplicationProvider.getApplicationContext();
+
+    @Test
+    public void getNonIndexableKeys_existInXmlLayout() {
+        final List<String> niks = TextAndDisplayFragment.SEARCH_INDEX_DATA_PROVIDER
+                .getNonIndexableKeys(mContext);
+        final List<String> keys =
+                XmlTestUtils.getKeysFromPreferenceXml(mContext,
+                        R.xml.accessibility_text_and_display);
+
+        assertThat(keys).containsAtLeastElementsIn(niks);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/slices/SettingsSliceProviderTest.java b/tests/robotests/src/com/android/settings/slices/SettingsSliceProviderTest.java
index b5c6c44..c2c67e3 100644
--- a/tests/robotests/src/com/android/settings/slices/SettingsSliceProviderTest.java
+++ b/tests/robotests/src/com/android/settings/slices/SettingsSliceProviderTest.java
@@ -565,7 +565,8 @@
         final Intent settingsIntent = new Intent(Settings.ACTION_SETTINGS)
                 .setPackage(Utils.SETTINGS_PACKAGE_NAME);
         PendingIntent settingsPendingIntent =
-                PendingIntent.getActivity(mContext, 0, settingsIntent, 0);
+                PendingIntent.getActivity(mContext, 0, settingsIntent,
+                        PendingIntent.FLAG_IMMUTABLE);
 
         assertThat(pendingIntent).isEqualTo(settingsPendingIntent);
     }
diff --git a/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java b/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
index 2c68269..6fb2eae 100644
--- a/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
+++ b/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
@@ -43,6 +43,7 @@
 import com.android.settings.security.SecurityFeatureProvider;
 import com.android.settings.slices.SlicesFeatureProvider;
 import com.android.settings.users.UserFeatureProvider;
+import com.android.settings.wifi.WifiTrackerLibProvider;
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 
 import org.mockito.Answers;
@@ -77,6 +78,8 @@
     public SearchFeatureProvider searchFeatureProvider;
     public ContextualCardFeatureProvider mContextualCardFeatureProvider;
 
+    public WifiTrackerLibProvider wifiTrackerLibProvider;
+
     /**
      * Call this in {@code @Before} method of the test class to use fake factory.
      */
@@ -120,6 +123,7 @@
         mBluetoothFeatureProvider = mock(BluetoothFeatureProvider.class);
         mAwareFeatureProvider = mock(AwareFeatureProvider.class);
         mFaceFeatureProvider = mock(FaceFeatureProvider.class);
+        wifiTrackerLibProvider = mock(WifiTrackerLibProvider.class);
     }
 
     @Override
@@ -231,4 +235,9 @@
     public FaceFeatureProvider getFaceFeatureProvider() {
         return mFaceFeatureProvider;
     }
+
+    @Override
+    public WifiTrackerLibProvider getWifiTrackerLibProvider() {
+        return wifiTrackerLibProvider;
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/wifi/addappnetworks/AddAppNetworksFragmentTest.java b/tests/robotests/src/com/android/settings/wifi/addappnetworks/AddAppNetworksFragmentTest.java
index 70c7810..24d4c47 100644
--- a/tests/robotests/src/com/android/settings/wifi/addappnetworks/AddAppNetworksFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/addappnetworks/AddAppNetworksFragmentTest.java
@@ -20,6 +20,7 @@
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyLong;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
@@ -41,6 +42,7 @@
 import androidx.fragment.app.FragmentActivity;
 
 import com.android.settings.R;
+import com.android.settings.testutils.FakeFeatureFactory;
 import com.android.wifitrackerlib.WifiEntry;
 import com.android.wifitrackerlib.WifiPickerTracker;
 
@@ -82,6 +84,8 @@
     @Mock
     private WifiEntry mWifiEntry;
 
+    private FakeFeatureFactory mFakeFeatureFactory;
+
     @Mock
     private WifiPickerTracker mWifiPickerTracker;
 
@@ -106,6 +110,8 @@
         mSavedWpaConfigurationEntry = generateRegularWifiConfiguration(FAKE_NEW_SAVED_WPA_SSID,
                 WifiConfiguration.KeyMgmt.WPA_PSK, "\"1234567890\"");
 
+        mFakeFeatureFactory = FakeFeatureFactory.setupForTest();
+
         mAddAppNetworksFragment.mWifiPickerTracker = mWifiPickerTracker;
         setUpOneScannedNetworkWithScanedLevel4();
     }
@@ -485,6 +491,9 @@
     }
 
     private void setupFragment() {
+        when(mFakeFeatureFactory.wifiTrackerLibProvider.createWifiPickerTracker(
+                any(), any(), any(), any(), any(), anyLong(), anyLong(), any()))
+                .thenReturn(mWifiPickerTracker);
         FragmentController.setupFragment(mAddAppNetworksFragment);
     }
 
diff --git a/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java b/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java
index f9450db..076ce2b 100644
--- a/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java
+++ b/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java
@@ -22,6 +22,7 @@
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyLong;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
@@ -50,9 +51,11 @@
 
 import com.android.settings.Utils;
 import com.android.settings.network.telephony.NetworkProviderWorker;
+import com.android.settings.testutils.FakeFeatureFactory;
 import com.android.settings.testutils.ResourcesUtils;
 import com.android.settings.wifi.slice.WifiSliceItem;
 import com.android.wifitrackerlib.WifiEntry;
+import com.android.wifitrackerlib.WifiPickerTracker;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -100,12 +103,22 @@
     @Mock
     GridRowBuilder mMockGridRowBuilderAllNetworkUnavailable;
 
+    private FakeFeatureFactory mFeatureFactory;
+    @Mock
+    private WifiPickerTracker mWifiPickerTracker;
+
     @Before
     @UiThreadTest
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mContext = spy(ApplicationProvider.getApplicationContext());
 
+        mFeatureFactory = FakeFeatureFactory.setupForTest();
+        when(mFeatureFactory.wifiTrackerLibProvider
+                .createWifiPickerTracker(
+                        any(), any(), any(), any(), any(), anyLong(), anyLong(), any()))
+                .thenReturn(mWifiPickerTracker);
+
         when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
         when(mContext.getSystemService(ConnectivityManager.class)).thenReturn(mConnectivityManager);
         when(mContext.getSystemService(TelephonyManager.class)).thenReturn(mTelephonyManager);
diff --git a/tests/unit/src/com/android/settings/testutils/FakeFeatureFactory.java b/tests/unit/src/com/android/settings/testutils/FakeFeatureFactory.java
index 47851b9..d20fc12 100644
--- a/tests/unit/src/com/android/settings/testutils/FakeFeatureFactory.java
+++ b/tests/unit/src/com/android/settings/testutils/FakeFeatureFactory.java
@@ -41,6 +41,7 @@
 import com.android.settings.security.SecurityFeatureProvider;
 import com.android.settings.slices.SlicesFeatureProvider;
 import com.android.settings.users.UserFeatureProvider;
+import com.android.settings.wifi.WifiTrackerLibProvider;
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 
 /**
@@ -72,6 +73,8 @@
     public SearchFeatureProvider searchFeatureProvider;
     public ContextualCardFeatureProvider mContextualCardFeatureProvider;
 
+    public WifiTrackerLibProvider wifiTrackerLibProvider;
+
     /**
      * Call this in {@code @Before} method of the test class to use fake factory.
      */
@@ -106,6 +109,7 @@
         mBluetoothFeatureProvider = mock(BluetoothFeatureProvider.class);
         mAwareFeatureProvider = mock(AwareFeatureProvider.class);
         mFaceFeatureProvider = mock(FaceFeatureProvider.class);
+        wifiTrackerLibProvider = mock(WifiTrackerLibProvider.class);
     }
 
     @Override
@@ -217,4 +221,9 @@
     public FaceFeatureProvider getFaceFeatureProvider() {
         return mFaceFeatureProvider;
     }
+
+    @Override
+    public WifiTrackerLibProvider getWifiTrackerLibProvider() {
+        return wifiTrackerLibProvider;
+    }
 }
diff --git a/tests/unit/src/com/android/settings/wifi/WifiPickerTrackerHelperTest.java b/tests/unit/src/com/android/settings/wifi/WifiPickerTrackerHelperTest.java
index 851b115..2991550 100644
--- a/tests/unit/src/com/android/settings/wifi/WifiPickerTrackerHelperTest.java
+++ b/tests/unit/src/com/android/settings/wifi/WifiPickerTrackerHelperTest.java
@@ -18,6 +18,8 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyLong;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
@@ -29,6 +31,7 @@
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 
+import com.android.settings.testutils.FakeFeatureFactory;
 import com.android.wifitrackerlib.MergedCarrierEntry;
 import com.android.wifitrackerlib.WifiEntry;
 import com.android.wifitrackerlib.WifiPickerTracker;
@@ -55,8 +58,15 @@
 
     private WifiPickerTrackerHelper mWifiPickerTrackerHelper;
 
+    private FakeFeatureFactory mFeatureFactory;
+
     @Before
     public void setUp() {
+        mFeatureFactory = FakeFeatureFactory.setupForTest();
+        when(mFeatureFactory.wifiTrackerLibProvider
+                .createWifiPickerTracker(
+                        any(), any(), any(), any(), any(), anyLong(), anyLong(), any()))
+                .thenReturn(mWifiPickerTracker);
         mWifiPickerTrackerHelper = new WifiPickerTrackerHelper(mock(Lifecycle.class),
                 ApplicationProvider.getApplicationContext(), null);
     }