Merge "Disable MTP transcoding by default" into sc-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 81a5ea8..f3066ce 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -3662,6 +3662,14 @@
         </receiver>
 
         <receiver
+            android:name=".sim.receivers.SuwFinishReceiver"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="com.google.android.setupwizard.SETUP_WIZARD_FINISHED" />
+            </intent-filter>
+        </receiver>
+
+        <receiver
             android:name=".sim.receivers.SimCompleteBootReceiver"
             android:exported="true">
             <intent-filter>
diff --git a/res/layout/panel_layout.xml b/res/layout/panel_layout.xml
index 5f33c32..ac7a72b 100644
--- a/res/layout/panel_layout.xml
+++ b/res/layout/panel_layout.xml
@@ -48,11 +48,13 @@
             </LinearLayout>
 
             <LinearLayout
+                android:id="@+id/header_layout"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_marginStart="16dp"
                 android:layout_marginEnd="16dp"
                 android:orientation="vertical">
+
                 <TextView
                     android:id="@+id/header_title"
                     android:layout_width="wrap_content"
@@ -67,8 +69,7 @@
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:ellipsize="end"
-                    android:maxLines="1" />
-
+                    android:maxLines="1"/>
             </LinearLayout>
         </LinearLayout>
 
diff --git a/res/layout/search_bar.xml b/res/layout/search_bar.xml
index 75b43f0..63f1c95 100644
--- a/res/layout/search_bar.xml
+++ b/res/layout/search_bar.xml
@@ -17,14 +17,12 @@
 
 <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:layout_marginTop="@dimen/search_bar_margin"
     android:layout_marginStart="@dimen/search_bar_margin"
     android:layout_marginEnd="@dimen/search_bar_margin"
-    android:layout_marginBottom="@dimen/search_bar_margin_bottom"
-    app:layout_scrollFlags="scroll|enterAlways">
+    android:layout_marginBottom="@dimen/search_bar_margin_bottom">
 
     <com.google.android.material.card.MaterialCardView
         android:id="@+id/search_bar"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 8a811c0..bc86338 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5254,6 +5254,8 @@
     <string name="accessibility_summary_state_stopped">Not working. Tap for info.</string>
     <!-- Accessibility service's description when enabled but not running (like maybe it crashed). -->
     <string name="accessibility_description_state_stopped">This service is malfunctioning.</string>
+    <!-- Title for the accessibility shortcuts settings page. [CHAR LIMIT=50] -->
+    <string name="accessibility_shortcuts_settings_title">Accessibility shortcuts</string>
 
     <!-- Title for the preference to show a tile for a particular feature in the Quick Settings pane. [CHAR LIMIT=NONE] -->
     <string name="enable_quick_setting">Show in Quick Settings</string>
@@ -12142,6 +12144,10 @@
     <string name="switch_to_removable_notification_no_carrier_name">Switched to another carrier</string>
     <!-- Message in a push notification indicating that the user's phone has connected to a different mobile network. [CHAR LIMIT=NONE] -->
     <string name="network_changed_notification_text">Your mobile network has changed</string>
+    <!-- Title on a push notification indicating that the user's device is capable of DSDS. [CHAR LIMIT=NONE] -->
+    <string name="dsds_notification_after_suw_title">Set up your other SIM</string>
+    <!-- Message in a push notification indicating that the user's device is capable of DSDS. [CHAR LIMIT=NONE] -->
+    <string name="dsds_notification_after_suw_text">Choose your active SIM or use 2 SIMs at once</string>
 
     <!-- Strings for choose SIM activity -->
     <!--  The title text of choose SIM activity. [CHAR LIMIT=NONE] -->
@@ -12580,8 +12586,10 @@
     <string name="view_airplane_safe_networks">View airplane mode networks</string>
     <!-- Text of message for viewing the networks that are available in airplane mode. [CHAR LIMIT=60] -->
     <string name="viewing_airplane_mode_networks">Viewing airplane mode networks</string>
-    <!-- Label text to turn off airplane mode. [CHAR LIMIT=40] -->
-    <string name="turn_off_airplane_mode">Turn off airplane mode</string>
+    <!-- Slice title text for turning on networks (e.g. Wi-Fi). [CHAR LIMIT=40] -->
+    <string name="turn_on_networks">Turn on networks</string>
+    <!-- Slice title text for turning off networks (e.g. Wi-Fi). [CHAR LIMIT=40] -->
+    <string name="turn_off_networks">Turn off networks</string>
     <!-- Title for interrupting the voice call alert. [CHAR_LIMIT=NONE] -->
     <string name="reset_your_internet_title">Reset your internet?</string>
     <!-- Description for interrupting the voice call alert. [CHAR_LIMIT=NONE] -->
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 69fa93e..bed02c8 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -221,7 +221,6 @@
         <item name="colorPrimaryDark">@*android:color/primary_dark_device_default_settings_light</item>
         <item name="android:windowLightStatusBar">true</item>
         <item name="android:navigationBarDividerColor">@*android:color/ripple_material_light</item>
-        <item name="android:navigationBarColor">@android:color/transparent</item>
     </style>
 
     <style name="Theme.Settings.ContextualCard" parent="Theme.Settings.Home">
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 36125b3..eff9e1d 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -29,15 +29,7 @@
     <PreferenceCategory
         android:key="screen_reader_category"
         android:persistent="false"
-        android:title="@string/screen_reader_category_title">
-
-        <Preference
-            android:fragment="com.android.settings.tts.TextToSpeechSettings"
-            android:key="tts_settings_preference"
-            android:persistent="false"
-            android:title="@string/tts_settings_title"
-            settings:controller="com.android.settings.language.TtsPreferenceController"/>
-    </PreferenceCategory>
+        android:title="@string/screen_reader_category_title"/>
 
     <PreferenceCategory
         android:key="display_category"
@@ -129,6 +121,25 @@
 
     </PreferenceCategory>
 
+    <!-- TODO(b/174829936): Add title for shortcuts settings category. -->
+    <PreferenceCategory android:persistent="false">
+
+        <Preference
+            android:fragment="com.android.settings.accessibility.ShortcutsSettingsFragment"
+            android:key="accessibility_shortcuts_preference_screen"
+            android:persistent="false"
+            android:title="@string/accessibility_shortcuts_settings_title"
+            settings:searchable="true"/>
+
+        <Preference
+            android:fragment="com.android.settings.tts.TextToSpeechSettings"
+            android:key="tts_settings_preference"
+            android:persistent="false"
+            android:title="@string/tts_settings_title"
+            settings:controller="com.android.settings.language.TtsPreferenceController"/>
+
+    </PreferenceCategory>
+
     <PreferenceCategory
         android:key="experimental_category"
         android:persistent="false"
diff --git a/res/xml/accessibility_shortcuts_settings.xml b/res/xml/accessibility_shortcuts_settings.xml
new file mode 100644
index 0000000..35314e7
--- /dev/null
+++ b/res/xml/accessibility_shortcuts_settings.xml
@@ -0,0 +1,30 @@
+<?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_shortcuts_settings"
+    android:persistent="false"
+    android:title="@string/accessibility_shortcuts_settings_title">
+
+    <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"/>
+</PreferenceScreen>
diff --git a/res/xml/app_info_settings_v2.xml b/res/xml/app_info_settings_v2.xml
new file mode 100644
index 0000000..805df59
--- /dev/null
+++ b/res/xml/app_info_settings_v2.xml
@@ -0,0 +1,191 @@
+<?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="installed_app_detail_settings_screen">
+
+    <com.android.settingslib.widget.LayoutPreference
+        android:key="header_view"
+        android:layout="@layout/settings_entity_header"
+        android:selectable="false"
+        android:order="-10000"
+        settings:allowDividerBelow="true"/>
+
+    <com.android.settingslib.widget.LayoutPreference
+        android:key="instant_app_buttons"
+        android:layout="@layout/instant_app_buttons"
+        android:selectable="false"
+        android:order="-9999"
+        settings:allowDividerAbove="true"
+        settings:allowDividerBelow="true"/>
+
+    <com.android.settingslib.widget.ActionButtonsPreference
+        android:key="action_buttons"
+        android:order="-9998" />
+
+    <!-- Add SpacePreference to draw divider -->
+    <com.android.settings.applications.SpacePreference
+        android:layout_height="0dp"
+        android:order="-9997"
+        settings:allowDividerAbove="true" />
+
+    <Preference
+        android:key="app_settings_link"
+        android:title="@string/app_settings_link"
+        settings:controller="com.android.settings.applications.appinfo.AppSettingPreferenceController" />
+
+    <Preference
+        android:key="notification_settings"
+        android:title="@string/notifications_label"
+        settings:controller="com.android.settings.applications.appinfo.AppNotificationPreferenceController" />
+
+    <com.android.settings.widget.FixedLineSummaryPreference
+        android:key="permission_settings"
+        android:title="@string/permissions_label"
+        android:summary="@string/summary_placeholder"
+        settings:summaryLineCount="1"
+        settings:controller="com.android.settings.applications.appinfo.AppPermissionPreferenceController" />
+
+    <Preference
+        android:key="storage_settings"
+        android:title="@string/storage_settings_for_app"
+        android:summary="@string/summary_placeholder"
+        settings:controller="com.android.settings.applications.appinfo.AppStoragePreferenceController" />
+
+    <com.android.settings.applications.AppDomainsPreference
+        android:key="instant_app_launch_supported_domain_urls"
+        android:title="@string/app_launch_supported_domain_urls_title"
+        android:selectable="true"
+        settings:controller="com.android.settings.applications.appinfo.InstantAppDomainsPreferenceController" />
+
+    <Preference
+        android:key="data_settings"
+        android:title="@string/data_usage_app_summary_title"
+        android:summary="@string/summary_placeholder"
+        settings:controller="com.android.settings.applications.appinfo.AppDataUsagePreferenceController" />
+
+    <Preference
+        android:key="time_spent_in_app"
+        android:title="@string/time_spent_in_app_pref_title"
+        settings:controller="com.android.settings.applications.appinfo.TimeSpentInAppPreferenceController" />
+
+    <Preference
+        android:key="battery"
+        android:title="@string/power_usage_summary_title"
+        android:summary="@string/summary_placeholder" />
+
+    <Preference
+        android:key="preferred_settings"
+        android:title="@string/launch_by_default"
+        android:summary="@string/summary_placeholder"
+        android:selectable="true"
+        settings:controller="com.android.settings.applications.appinfo.AppOpenByDefaultPreferenceController" />
+
+    <Preference
+        android:key="memory"
+        android:title="@string/memory_settings_title"
+        android:summary="@string/summary_placeholder"
+        android:enabled="false" />
+
+    <!-- Default apps shortcuts -->
+    <Preference
+        android:key="default_home"
+        android:title="@string/home_app"
+        android:summary="@string/summary_placeholder" />
+
+    <Preference
+        android:key="default_browser"
+        android:title="@string/default_browser_title"
+        android:summary="@string/summary_placeholder" />
+
+    <Preference
+        android:key="default_phone_app"
+        android:title="@string/default_phone_title"
+        android:summary="@string/default_phone_title" />
+
+    <Preference
+        android:key="default_emergency_app"
+        android:title="@string/default_emergency_app"
+        android:summary="@string/summary_placeholder" />
+
+    <Preference
+        android:key="default_sms_app"
+        android:title="@string/sms_application_title"
+        android:summary="@string/summary_placeholder" />
+
+    <!-- Advanced apps settings -->
+    <PreferenceCategory
+        android:key="advanced_app_info"
+        android:title="@string/advanced_apps"
+        settings:controller="com.android.settings.applications.appinfo.AdvancedAppInfoPreferenceCategoryController">
+
+        <Preference
+            android:key="system_alert_window"
+            android:title="@string/draw_overlay"
+            android:summary="@string/summary_placeholder"
+            settings:controller="com.android.settings.applications.appinfo.DrawOverlayDetailPreferenceController" />
+
+        <Preference
+            android:key="write_settings_apps"
+            android:title="@string/write_settings"
+            android:summary="@string/summary_placeholder"
+            settings:controller="com.android.settings.applications.appinfo.WriteSystemSettingsPreferenceController" />
+
+        <Preference
+            android:key="picture_in_picture"
+            android:title="@string/picture_in_picture_app_detail_title"
+            android:summary="@string/summary_placeholder"
+            settings:controller="com.android.settings.applications.specialaccess.pictureinpicture.PictureInPictureDetailPreferenceController" />
+
+        <Preference
+            android:key="install_other_apps"
+            android:title="@string/install_other_apps"
+            android:summary="@string/summary_placeholder"
+            settings:controller="com.android.settings.applications.appinfo.ExternalSourceDetailPreferenceController" />
+
+        <Preference
+            android:key="interact_across_profiles"
+            android:title="@string/interact_across_profiles_title"
+            android:summary="@string/summary_placeholder"
+            settings:controller="com.android.settings.applications.specialaccess.interactacrossprofiles.InteractAcrossProfilesDetailsPreferenceController" />
+
+    </PreferenceCategory>
+
+    <!-- App installer info -->
+    <PreferenceCategory
+        android:key="app_installer"
+        android:title="@string/app_install_details_group_title"
+        settings:controller="com.android.settings.applications.appinfo.AppInstallerPreferenceCategoryController">
+
+        <Preference
+            android:key="app_info_store"
+            android:title="@string/app_install_details_title"
+            settings:controller="com.android.settings.applications.appinfo.AppInstallerInfoPreferenceController" />
+
+    </PreferenceCategory>
+
+    <Preference
+        android:key="app_version"
+        android:selectable="false"
+        android:order="9999"
+        settings:controller="com.android.settings.applications.appinfo.AppVersionPreferenceController"
+        settings:allowDividerAbove="true"
+        settings:enableCopying="true"/>
+
+</PreferenceScreen>
diff --git a/res/xml/app_storage_settings.xml b/res/xml/app_storage_settings.xml
index 376f09e..6092dbb 100644
--- a/res/xml/app_storage_settings.xml
+++ b/res/xml/app_storage_settings.xml
@@ -42,7 +42,7 @@
     <PreferenceCategory
         android:key="storage_category"
         android:title="@string/app_info_storage_title"
-        settings:allowDividerBelow="false">
+        settings:allowDividerAbove="true">
 
         <Preference
             android:key="app_size"
diff --git a/res/xml/power_usage_detail.xml b/res/xml/power_usage_detail.xml
index 945ceed..95c1038 100644
--- a/res/xml/power_usage_detail.xml
+++ b/res/xml/power_usage_detail.xml
@@ -31,7 +31,8 @@
         android:order="-9999"/>
 
     <PreferenceCategory
-        android:title="@string/battery_detail_manage_title">
+        android:title="@string/battery_detail_manage_title"
+        settings:allowDividerAbove="true">
 
         <com.android.settingslib.RestrictedPreference
             android:key="background_activity"
diff --git a/res/xml/power_usage_summary.xml b/res/xml/power_usage_summary.xml
index 6161d79..f683f3c 100644
--- a/res/xml/power_usage_summary.xml
+++ b/res/xml/power_usage_summary.xml
@@ -32,7 +32,6 @@
         android:fragment="com.android.settings.fuelgauge.PowerUsageAdvanced"
         android:key="battery_usage_summary"
         android:title="@string/advanced_battery_preference_title"
-        android:icon="@drawable/ic_chevron_right_24dp"
         settings:searchable="false" />
 
     <com.android.settings.widget.CardPreference
diff --git a/src/com/android/settings/ProxySelector.java b/src/com/android/settings/ProxySelector.java
index 625369e..0b6f16a 100644
--- a/src/com/android/settings/ProxySelector.java
+++ b/src/com/android/settings/ProxySelector.java
@@ -41,6 +41,7 @@
 
 import androidx.appcompat.app.AlertDialog;
 
+import com.android.net.module.util.ProxyUtils;
 import com.android.settings.SettingsPreferenceFragment.SettingsDialogFragment;
 import com.android.settings.core.InstrumentedFragment;
 
@@ -151,7 +152,7 @@
         if (proxy != null) {
             hostname = proxy.getHost();
             port = proxy.getPort();
-            exclList = proxy.getExclusionListAsString();
+            exclList = ProxyUtils.exclusionListAsString(proxy.getExclusionList());
         }
 
         if (hostname == null) {
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 4709c66..582111f 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -372,6 +372,9 @@
         } else {
             getPreferenceScreen().addPreference(downloadedServicesCategory);
         }
+
+        // Hide screen reader category if it is empty.
+        updatePreferenceCategoryVisibility(CATEGORY_SCREEN_READER);
     }
 
     private List<RestrictedPreference> getInstalledAccessibilityList(Context context) {
@@ -453,6 +456,16 @@
     }
 
     /**
+     * Updates the visibility of a category according to its child preference count.
+     *
+     * @param categoryKey The key of the category which needs to check
+     */
+    private void updatePreferenceCategoryVisibility(String categoryKey) {
+        final PreferenceCategory category = mCategoryToPrefCategoryMap.get(categoryKey);
+        category.setVisible(category.getPreferenceCount() != 0);
+    }
+
+    /**
      * Updates preferences related to system configurations.
      */
     protected void updateSystemPreferences() {
diff --git a/src/com/android/settings/accessibility/ShortcutsSettingsFragment.java b/src/com/android/settings/accessibility/ShortcutsSettingsFragment.java
new file mode 100644
index 0000000..91e16f6
--- /dev/null
+++ b/src/com/android/settings/accessibility/ShortcutsSettingsFragment.java
@@ -0,0 +1,48 @@
+/*
+ * 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 com.android.settings.R;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+
+/** Accessibility settings for accessibility shortcuts. */
+public class ShortcutsSettingsFragment extends DashboardFragment {
+
+    private static final String TAG = "ShortcutsSettingsFragment";
+
+    @Override
+    public int getMetricsCategory() {
+        return SettingsEnums.ACCESSIBILITY_SHORTCUTS_SETTINGS;
+    }
+
+    @Override
+    protected int getPreferenceScreenResId() {
+        return R.xml.accessibility_shortcuts_settings;
+    }
+
+    @Override
+    protected String getLogTag() {
+        return TAG;
+    }
+
+    public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+            new BaseSearchIndexProvider(R.xml.accessibility_shortcuts_settings);
+
+}
diff --git a/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java b/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
index 6817bd6..f584408 100755
--- a/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
+++ b/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
@@ -35,6 +35,7 @@
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.text.TextUtils;
+import android.util.FeatureFlagUtils;
 import android.util.Log;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -48,6 +49,7 @@
 import com.android.settings.applications.manageapplications.ManageApplications;
 import com.android.settings.applications.specialaccess.interactacrossprofiles.InteractAcrossProfilesDetailsPreferenceController;
 import com.android.settings.applications.specialaccess.pictureinpicture.PictureInPictureDetailPreferenceController;
+import com.android.settings.core.FeatureFlags;
 import com.android.settings.core.SubSettingLauncher;
 import com.android.settings.dashboard.DashboardFragment;
 import com.android.settingslib.RestrictedLockUtilsInternal;
@@ -245,6 +247,9 @@
 
     @Override
     protected int getPreferenceScreenResId() {
+        if (FeatureFlagUtils.isEnabled(getContext(), FeatureFlags.SILKY_HOME)) {
+            return R.xml.app_info_settings_v2;
+        }
         return R.xml.app_info_settings;
     }
 
diff --git a/src/com/android/settings/display/ScreenTimeoutSettings.java b/src/com/android/settings/display/ScreenTimeoutSettings.java
index a90c886..b518646 100644
--- a/src/com/android/settings/display/ScreenTimeoutSettings.java
+++ b/src/com/android/settings/display/ScreenTimeoutSettings.java
@@ -158,7 +158,7 @@
             screen.addPreference(pref);
         }
 
-        if (isScreenAttentionAvailable()) {
+        if (isScreenAttentionAvailable(getContext())) {
             mAdaptiveSleepPermissionController.addToScreen(screen);
             mAdaptiveSleepController.addToScreen(screen);
             screen.addPreference(mPrivacyPreference);
@@ -199,11 +199,6 @@
         return R.string.help_url_adaptive_sleep;
     }
 
-    private boolean isScreenAttentionAvailable() {
-        return getResources().getBoolean(
-                com.android.internal.R.bool.config_adaptive_sleep_available);
-    }
-
     private Long getMaxScreenTimeout(Context context) {
         if (context == null) {
             return Long.MAX_VALUE;
@@ -239,6 +234,11 @@
         }
     }
 
+    private static boolean isScreenAttentionAvailable(Context context) {
+        return context.getResources().getBoolean(
+                com.android.internal.R.bool.config_adaptive_sleep_available);
+    }
+
     private static class TimeoutCandidateInfo extends CandidateInfo {
         private final CharSequence mLabel;
         private final String mKey;
@@ -269,11 +269,13 @@
             new BaseSearchIndexProvider(R.xml.screen_timeout_settings) {
                 public List<SearchIndexableRaw> getRawDataToIndex(Context context,
                         boolean enabled) {
+                    if (!isScreenAttentionAvailable(context)) {
+                        return null;
+                    }
                     final Resources res = context.getResources();
                     final SearchIndexableRaw data = new SearchIndexableRaw(context);
                     data.title = res.getString(R.string.adaptive_sleep_title);
                     data.key = AdaptiveSleepPreferenceController.PREFERENCE_KEY;
-                    data.screenTitle = res.getString(R.string.screen_timeout_title);
                     data.keywords = res.getString(R.string.adaptive_sleep_title);
 
                     final List<SearchIndexableRaw> result = new ArrayList<>(1);
diff --git a/src/com/android/settings/homepage/SettingsHomepageActivity.java b/src/com/android/settings/homepage/SettingsHomepageActivity.java
index 2259441..aa7b2d1 100644
--- a/src/com/android/settings/homepage/SettingsHomepageActivity.java
+++ b/src/com/android/settings/homepage/SettingsHomepageActivity.java
@@ -46,11 +46,7 @@
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-
         setContentView(R.layout.settings_homepage_container);
-        final View root = findViewById(R.id.settings_homepage_container);
-        root.setSystemUiVisibility(
-                View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
 
         final View appBar = findViewById(R.id.app_bar_container);
         appBar.setMinimumHeight(getSearchBoxHeight());
diff --git a/src/com/android/settings/network/AirplaneSafeNetworksSlice.java b/src/com/android/settings/network/AirplaneSafeNetworksSlice.java
index fbef282..763e0c7 100644
--- a/src/com/android/settings/network/AirplaneSafeNetworksSlice.java
+++ b/src/com/android/settings/network/AirplaneSafeNetworksSlice.java
@@ -23,6 +23,7 @@
 import android.content.IntentFilter;
 import android.graphics.Color;
 import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.net.wifi.WifiManager;
 import android.util.Log;
@@ -33,6 +34,7 @@
 import androidx.slice.builders.ListBuilder;
 import androidx.slice.builders.ListBuilder.RowBuilder;
 import androidx.slice.builders.SliceAction;
+import androidx.slice.core.SliceHints;
 
 import com.android.settings.AirplaneModeEnabler;
 import com.android.settings.R;
@@ -41,7 +43,6 @@
 import com.android.settings.slices.CustomSliceable;
 import com.android.settings.slices.SliceBackgroundWorker;
 import com.android.settings.slices.SliceBroadcastReceiver;
-import com.android.settingslib.WirelessUtils;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -49,7 +50,6 @@
 /**
  * {@link CustomSliceable} for airplane-safe networks, used by generic clients.
  */
-// TODO(b/173413889): Need to update the slice to Button style.
 public class AirplaneSafeNetworksSlice implements CustomSliceable,
         AirplaneModeEnabler.OnAirplaneModeChangedListener {
 
@@ -60,26 +60,29 @@
     /**
      * Annotation for different action of the slice.
      *
-     * {@code VIEW_AIRPLANE_SAFE_NETWORKS} for action of turning on Wi-Fi.
-     * {@code TURN_OFF_AIRPLANE_MODE} for action of turning off Airplane Mode.
+     * {@code TURN_ON_NETWORKS} for action of turning on Wi-Fi networks.
+     * {@code TURN_OFF_NETWORKS} for action of turning off Wi-Fi networks.
      */
     @Retention(RetentionPolicy.SOURCE)
     @IntDef(value = {
-            Action.VIEW_AIRPLANE_SAFE_NETWORKS,
-            Action.TURN_OFF_AIRPLANE_MODE,
+            Action.TURN_ON_NETWORKS,
+            Action.TURN_OFF_NETWORKS,
     })
     public @interface Action {
-        int VIEW_AIRPLANE_SAFE_NETWORKS = 1;
-        int TURN_OFF_AIRPLANE_MODE = 2;
+        int TURN_ON_NETWORKS = 1;
+        int TURN_OFF_NETWORKS = 2;
     }
 
     private final Context mContext;
     private final AirplaneModeEnabler mAirplaneModeEnabler;
     private final WifiManager mWifiManager;
 
+    private boolean mIsAirplaneModeOn;
+
     public AirplaneSafeNetworksSlice(Context context) {
         mContext = context;
         mAirplaneModeEnabler = new AirplaneModeEnabler(context, this);
+        mIsAirplaneModeOn = mAirplaneModeEnabler.isAirplaneModeOn();
         mWifiManager = mContext.getSystemService(WifiManager.class);
     }
 
@@ -89,15 +92,14 @@
 
     @Override
     public Slice getSlice() {
-        if (!WirelessUtils.isAirplaneModeOn(mContext)) {
-            return null;
+        final ListBuilder listBuilder = new ListBuilder(mContext, getUri(), ListBuilder.INFINITY);
+        if (mIsAirplaneModeOn) {
+            listBuilder.addRow(new RowBuilder()
+                    .setTitle(getTitle())
+                    .addEndItem(getEndIcon(), SliceHints.ICON_IMAGE)
+                    .setPrimaryAction(getSliceAction()));
         }
-
-        return new ListBuilder(mContext, getUri(), ListBuilder.INFINITY)
-                .addRow(new RowBuilder()
-                        .setTitle(getTitle())
-                        .setPrimaryAction(getSliceAction()))
-                .build();
+        return listBuilder.build();
     }
 
     @Override
@@ -108,21 +110,22 @@
     @Override
     public void onNotifyChange(Intent intent) {
         final int action = intent.getIntExtra(ACTION_INTENT_EXTRA, 0);
-        if (action == Action.VIEW_AIRPLANE_SAFE_NETWORKS) {
+        if (action == Action.TURN_ON_NETWORKS) {
             if (!mWifiManager.isWifiEnabled()) {
-                logd("Action: turn on WiFi");
+                logd("Action: turn on Wi-Fi networks");
                 mWifiManager.setWifiEnabled(true);
             }
-        } else if (action == Action.TURN_OFF_AIRPLANE_MODE) {
-            if (WirelessUtils.isAirplaneModeOn(mContext)) {
-                logd("Action: turn off Airplane mode");
-                mAirplaneModeEnabler.setAirplaneMode(false);
+        } else if (action == Action.TURN_OFF_NETWORKS) {
+            if (mWifiManager.isWifiEnabled()) {
+                logd("Action: turn off Wi-Fi networks");
+                mWifiManager.setWifiEnabled(false);
             }
         }
     }
 
     @Override
     public void onAirplaneModeChanged(boolean isAirplaneModeOn) {
+        mIsAirplaneModeOn = isAirplaneModeOn;
         final AirplaneSafeNetworksWorker worker = SliceBackgroundWorker.getInstance(getUri());
         if (worker != null) {
             worker.updateSlice();
@@ -140,15 +143,26 @@
     @Action
     private int getAction() {
         return mWifiManager.isWifiEnabled()
-                ? Action.TURN_OFF_AIRPLANE_MODE
-                : Action.VIEW_AIRPLANE_SAFE_NETWORKS;
+                ? Action.TURN_OFF_NETWORKS
+                : Action.TURN_ON_NETWORKS;
     }
 
     private String getTitle() {
         return mContext.getText(
-                (getAction() == Action.VIEW_AIRPLANE_SAFE_NETWORKS)
-                        ? R.string.view_airplane_safe_networks
-                        : R.string.turn_off_airplane_mode).toString();
+                (getAction() == Action.TURN_ON_NETWORKS)
+                        ? R.string.turn_on_networks
+                        : R.string.turn_off_networks).toString();
+    }
+
+    private IconCompat getEndIcon() {
+        final Drawable drawable = mContext.getDrawable(
+                (getAction() == Action.TURN_ON_NETWORKS) ? R.drawable.ic_airplane_safe_networks_24dp
+                        : R.drawable.ic_airplanemode_active);
+        if (drawable == null) {
+            return Utils.createIconWithDrawable(new ColorDrawable(Color.TRANSPARENT));
+        }
+        drawable.setTintList(Utils.getColorAttr(mContext, android.R.attr.colorAccent));
+        return Utils.createIconWithDrawable(drawable);
     }
 
     private SliceAction getSliceAction() {
@@ -156,8 +170,7 @@
                 0 /* requestCode */, getIntent(),
                 PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
         final IconCompat icon = Utils.createIconWithDrawable(new ColorDrawable(Color.TRANSPARENT));
-        return SliceAction.createDeeplink(pendingIntent, icon, ListBuilder.ACTION_WITH_LABEL,
-                getTitle());
+        return SliceAction.create(pendingIntent, icon, ListBuilder.ACTION_WITH_LABEL, getTitle());
     }
 
     @Override
diff --git a/src/com/android/settings/network/InternetPreferenceController.java b/src/com/android/settings/network/InternetPreferenceController.java
index 0e95e2d..25ec912 100644
--- a/src/com/android/settings/network/InternetPreferenceController.java
+++ b/src/com/android/settings/network/InternetPreferenceController.java
@@ -177,6 +177,7 @@
         if (subInfo == null) {
             return;
         }
-        mPreference.setSummary(subInfo.getDisplayName());
+        mPreference.setSummary(SubscriptionUtil.getUniqueSubscriptionDisplayName(
+                subInfo, mContext));
     }
 }
diff --git a/src/com/android/settings/network/OWNERS b/src/com/android/settings/network/OWNERS
index 991ad43..4f17e3f 100644
--- a/src/com/android/settings/network/OWNERS
+++ b/src/com/android/settings/network/OWNERS
@@ -6,5 +6,6 @@
 leechou@google.com
 songferngwang@google.com
 tomhsu@google.com
+zoeychen@google.com
 
 # Emergency approvers in case the above are not available
diff --git a/src/com/android/settings/network/ProviderModelSlice.java b/src/com/android/settings/network/ProviderModelSlice.java
index 48c3dc0..24077dd 100644
--- a/src/com/android/settings/network/ProviderModelSlice.java
+++ b/src/com/android/settings/network/ProviderModelSlice.java
@@ -26,7 +26,6 @@
 import android.content.Intent;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
-import android.provider.Settings;
 import android.telephony.SubscriptionManager;
 import android.util.Log;
 
@@ -87,9 +86,6 @@
         final ListBuilder listBuilder = mHelper.createListBuilder(getUri());
         if (mHelper.isAirplaneModeEnabled() && !mWifiManager.isWifiEnabled()) {
             log("Airplane mode is enabled.");
-            listBuilder.setHeader(mHelper.createHeader(Settings.ACTION_AIRPLANE_MODE_SETTINGS));
-            listBuilder.addGridRow(mHelper.createMessageGridRow(R.string.condition_airplane_title,
-                    Settings.ACTION_AIRPLANE_MODE_SETTINGS));
             return listBuilder.build();
         }
 
@@ -182,8 +178,9 @@
         }
         final int defaultSubId = subscriptionManager.getDefaultDataSubscriptionId();
         log("defaultSubId:" + defaultSubId);
-        if (!SubscriptionManager.isUsableSubscriptionId(defaultSubId)) {
-            return; // No subscription - do nothing.
+
+        if (!defaultSubscriptionIsUsable(defaultSubId)) {
+            return;
         }
 
         boolean isToggleAction = intent.hasExtra(EXTRA_TOGGLE_STATE);
@@ -194,10 +191,14 @@
             MobileNetworkUtils.setMobileDataEnabled(mContext, defaultSubId, newState,
                     false /* disableOtherSubscriptions */);
         }
-        doCarrierNetworkAction(isToggleAction, newState);
+
+        final boolean isDataEnabled =
+                isToggleAction ? newState : MobileNetworkUtils.isMobileDataEnabled(mContext);
+        doCarrierNetworkAction(isToggleAction, isDataEnabled);
     }
 
-    private void doCarrierNetworkAction(boolean isToggleAction, boolean isDataEnabled) {
+    @VisibleForTesting
+    void doCarrierNetworkAction(boolean isToggleAction, boolean isDataEnabled) {
         final NetworkProviderWorker worker = getWorker();
         if (worker == null) {
             return;
@@ -208,7 +209,7 @@
             return;
         }
 
-        if (MobileNetworkUtils.isMobileDataEnabled(mContext)) {
+        if (isDataEnabled) {
             worker.connectCarrierNetwork();
         }
     }
@@ -258,4 +259,12 @@
                 .setTitle(mContext.getText(R.string.ethernet))
                 .setSubtitle(mContext.getText(R.string.cannot_switch_networks_while_connected));
     }
+
+    /**
+     * Wrap the subscriptionManager call for test mocking.
+     */
+    @VisibleForTesting
+    protected boolean defaultSubscriptionIsUsable(int defaultSubId) {
+        return SubscriptionManager.isUsableSubscriptionId(defaultSubId);
+    }
 }
diff --git a/src/com/android/settings/network/SubscriptionUtil.java b/src/com/android/settings/network/SubscriptionUtil.java
index a0f2df4..aa70459 100644
--- a/src/com/android/settings/network/SubscriptionUtil.java
+++ b/src/com/android/settings/network/SubscriptionUtil.java
@@ -242,12 +242,14 @@
             public CharSequence uniqueName;
         }
 
-        final SubscriptionManager subscriptionManager =
-                context.getSystemService(SubscriptionManager.class);
         // Map of SubscriptionId to DisplayName
         final Supplier<Stream<DisplayInfo>> originalInfos =
-                () -> getActiveSubscriptions(subscriptionManager)
+                () -> getAvailableSubscriptions(context)
                 .stream()
+                .filter(i -> {
+                    // Filter out null values.
+                    return (i != null && i.getDisplayName() != null);
+                })
                 .map(i -> {
                     DisplayInfo info = new DisplayInfo();
                     info.subscriptionInfo = i;
diff --git a/src/com/android/settings/network/telephony/BackupCallingPreferenceController.java b/src/com/android/settings/network/telephony/BackupCallingPreferenceController.java
index daa4670..2c6c963 100644
--- a/src/com/android/settings/network/telephony/BackupCallingPreferenceController.java
+++ b/src/com/android/settings/network/telephony/BackupCallingPreferenceController.java
@@ -30,6 +30,7 @@
 import androidx.preference.SwitchPreference;
 
 import com.android.settings.R;
+import com.android.settings.network.SubscriptionUtil;
 
 import java.util.Objects;
 
@@ -119,7 +120,8 @@
 
     private String getLatestSummary() {
         SubscriptionInfo subInfo = getSubscriptionInfo();
-        return Objects.toString((subInfo == null) ? null : subInfo.getDisplayName(), "");
+        return Objects.toString((subInfo == null) ? null
+                : SubscriptionUtil.getUniqueSubscriptionDisplayName(subInfo, mContext), "");
     }
 
     private void updateSummary(String displayName) {
diff --git a/src/com/android/settings/network/telephony/DataDuringCallsPreferenceController.java b/src/com/android/settings/network/telephony/DataDuringCallsPreferenceController.java
index 1cd0e8e..110c582 100644
--- a/src/com/android/settings/network/telephony/DataDuringCallsPreferenceController.java
+++ b/src/com/android/settings/network/telephony/DataDuringCallsPreferenceController.java
@@ -96,7 +96,7 @@
 
     @Override
     public boolean setChecked(boolean isChecked) {
-        mManager.setMobileDataPolicyEnabledStatus(
+        mManager.setMobileDataPolicyEnabled(
                 TelephonyManager.MOBILE_DATA_POLICY_DATA_ON_NON_DEFAULT_DURING_VOICE_CALL,
                 isChecked);
         return true;
diff --git a/src/com/android/settings/network/telephony/MmsMessagePreferenceController.java b/src/com/android/settings/network/telephony/MmsMessagePreferenceController.java
index e3db5eb..85d6e73 100644
--- a/src/com/android/settings/network/telephony/MmsMessagePreferenceController.java
+++ b/src/com/android/settings/network/telephony/MmsMessagePreferenceController.java
@@ -88,7 +88,7 @@
 
     @Override
     public boolean setChecked(boolean isChecked) {
-        mTelephonyManager.setMobileDataPolicyEnabledStatus(
+        mTelephonyManager.setMobileDataPolicyEnabled(
                 TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED, isChecked);
         return isChecked == mTelephonyManager.isMobileDataPolicyEnabled(
                 TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED);
diff --git a/src/com/android/settings/network/telephony/NetworkProviderBackupCallingPreferenceController.java b/src/com/android/settings/network/telephony/NetworkProviderBackupCallingPreferenceController.java
index f6a7d93..b66cea6 100644
--- a/src/com/android/settings/network/telephony/NetworkProviderBackupCallingPreferenceController.java
+++ b/src/com/android/settings/network/telephony/NetworkProviderBackupCallingPreferenceController.java
@@ -104,7 +104,7 @@
         }
         SwitchPreference pref = new SwitchPreference(mContext);
         prefCtrl.updateState(pref);
-        pref.setTitle(subInfo.getDisplayName());
+        pref.setTitle(SubscriptionUtil.getUniqueSubscriptionDisplayName(subInfo, mContext));
         return pref;
     }
 
diff --git a/src/com/android/settings/panel/InternetConnectivityPanel.java b/src/com/android/settings/panel/InternetConnectivityPanel.java
index 7bafe97..c90d22b 100644
--- a/src/com/android/settings/panel/InternetConnectivityPanel.java
+++ b/src/com/android/settings/panel/InternetConnectivityPanel.java
@@ -19,6 +19,7 @@
 import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
 import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
 
+import static com.android.settings.network.InternetUpdater.INTERNET_APM;
 import static com.android.settings.network.InternetUpdater.INTERNET_APM_NETWORKS;
 import static com.android.settings.network.NetworkProviderSettings.ACTION_NETWORK_PROVIDER_SETTINGS;
 
@@ -83,6 +84,9 @@
         mInternetUpdater.onPause();
     }
 
+    /**
+     * @return a string for the title of the Panel.
+     */
     @Override
     public CharSequence getTitle() {
         if (mIsProviderModelEnabled) {
@@ -93,10 +97,21 @@
         return mContext.getText(R.string.internet_connectivity_panel_title);
     }
 
+    /**
+     * @return a string for the subtitle of the Panel.
+     */
+    @Override
+    public CharSequence getSubTitle() {
+        if (mIsProviderModelEnabled && mInternetType == INTERNET_APM) {
+            return mContext.getText(R.string.condition_airplane_title);
+        }
+        return null;
+    }
+
     @Override
     public List<Uri> getSlices() {
         final List<Uri> uris = new ArrayList<>();
-        if (Utils.isProviderModelEnabled(mContext)) {
+        if (mIsProviderModelEnabled) {
             uris.add(CustomSliceRegistry.PROVIDER_MODEL_SLICE_URI);
             uris.add(CustomSliceRegistry.AIRPLANE_SAFE_NETWORKS_SLICE_URI);
         } else {
@@ -109,18 +124,21 @@
 
     @Override
     public Intent getSeeMoreIntent() {
-        return new Intent(Utils.isProviderModelEnabled(mContext)
+        return new Intent(mIsProviderModelEnabled
                 ? ACTION_NETWORK_PROVIDER_SETTINGS : Settings.ACTION_WIRELESS_SETTINGS)
                 .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
     }
 
     @Override
     public boolean isCustomizedButtonUsed() {
-        return Utils.isProviderModelEnabled(mContext);
+        return mIsProviderModelEnabled;
     }
 
     @Override
     public CharSequence getCustomizedButtonTitle() {
+        if (mInternetType == INTERNET_APM) {
+            return null;
+        }
         return mContext.getText(R.string.settings_button);
     }
 
@@ -145,18 +163,35 @@
      * @param internetType the internet type
      */
     public void onInternetTypeChanged(@InternetUpdater.InternetType int internetType) {
-        final boolean needRefresh = internetType != mInternetType
-                && (internetType == INTERNET_APM_NETWORKS
-                || mInternetType == INTERNET_APM_NETWORKS);
-        mInternetType = internetType;
-        if (needRefresh) {
-            refresh();
+        if (internetType == mInternetType) {
+            return;
         }
-    }
 
-    private void refresh() {
+        final boolean changeToApm = (internetType == INTERNET_APM);
+        final boolean changeFromApm = (mInternetType == INTERNET_APM);
+        final boolean changeWithApmNetworks =
+                (internetType == INTERNET_APM_NETWORKS || mInternetType == INTERNET_APM_NETWORKS);
+        mInternetType = internetType;
+
         if (mCallback != null) {
-            mCallback.onTitleChanged();
+            if (changeToApm) {
+                // The internet type is changed to the airplane mode.
+                //   Title: Internet
+                //   Sub-Title: Airplane mode is on
+                //   Settings button: Hide
+                mCallback.onHeaderChanged();
+                mCallback.onCustomizedButtonStateChanged();
+            } else if (changeFromApm) {
+                // The internet type is changed from the airplane mode.
+                //   Title: Internet
+                //   Settings button: Show
+                mCallback.onTitleChanged();
+                mCallback.onCustomizedButtonStateChanged();
+            } else if (changeWithApmNetworks) {
+                // The internet type is changed with the airplane mode networks.
+                //   Title: Airplane mode networks / Internet
+                mCallback.onTitleChanged();
+            }
         }
     }
 }
diff --git a/src/com/android/settings/panel/PanelFragment.java b/src/com/android/settings/panel/PanelFragment.java
index 503b34a..e7c1bef 100644
--- a/src/com/android/settings/panel/PanelFragment.java
+++ b/src/com/android/settings/panel/PanelFragment.java
@@ -26,6 +26,7 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.text.TextUtils;
+import android.view.Gravity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -94,6 +95,7 @@
     private LinearLayout mPanelHeader;
     private ImageView mTitleIcon;
     private LinearLayout mTitleGroup;
+    private LinearLayout mHeaderLayout;
     private TextView mHeaderTitle;
     private TextView mHeaderSubtitle;
     private int mMaxHeight;
@@ -202,6 +204,7 @@
         mPanelHeader = mLayoutView.findViewById(R.id.panel_header);
         mTitleIcon = mLayoutView.findViewById(R.id.title_icon);
         mTitleGroup = mLayoutView.findViewById(R.id.title_group);
+        mHeaderLayout = mLayoutView.findViewById(R.id.header_layout);
         mHeaderTitle = mLayoutView.findViewById(R.id.header_title);
         mHeaderSubtitle = mLayoutView.findViewById(R.id.header_subtitle);
         mFooterDivider = mLayoutView.findViewById(R.id.footer_divider);
@@ -239,13 +242,12 @@
 
         final IconCompat icon = mPanel.getIcon();
         final CharSequence title = mPanel.getTitle();
+        final CharSequence subtitle = mPanel.getSubTitle();
 
-        if (icon != null) {
-            enablePanelHeader(icon, title);
+        if (icon != null || (subtitle != null && subtitle.length() > 0)) {
+            enablePanelHeader(icon, title, subtitle);
         } else {
-            mTitleView.setVisibility(View.VISIBLE);
-            mPanelHeader.setVisibility(View.GONE);
-            mTitleView.setText(title);
+            enableTitle(title);
         }
 
         mFooterDivider.setVisibility(View.GONE);
@@ -254,13 +256,7 @@
         mDoneButton.setOnClickListener(getCloseListener());
 
         if (mPanel.isCustomizedButtonUsed()) {
-            final CharSequence customTitle = mPanel.getCustomizedButtonTitle();
-            if (TextUtils.isEmpty(customTitle)) {
-                mSeeMoreButton.setVisibility(View.GONE);
-            } else {
-                mSeeMoreButton.setVisibility(View.VISIBLE);
-                mSeeMoreButton.setText(customTitle);
-            }
+            enableCustomizedButton();
         } else if (mPanel.getSeeMoreIntent() == null) {
             // If getSeeMoreIntent() is null hide the mSeeMoreButton.
             mSeeMoreButton.setVisibility(View.GONE);
@@ -275,14 +271,16 @@
                 0 /* value */);
     }
 
-    private void enablePanelHeader(IconCompat icon, CharSequence title) {
+    private void enablePanelHeader(IconCompat icon, CharSequence title, CharSequence subtitle) {
         mTitleView.setVisibility(View.GONE);
         mPanelHeader.setVisibility(View.VISIBLE);
         mPanelHeader.setAccessibilityPaneTitle(title);
         mHeaderTitle.setText(title);
-        mHeaderSubtitle.setText(mPanel.getSubTitle());
+        mHeaderSubtitle.setText(subtitle);
+        mHeaderSubtitle.setAccessibilityPaneTitle(subtitle);
         if (icon != null) {
             mTitleGroup.setVisibility(View.VISIBLE);
+            mHeaderLayout.setGravity(Gravity.LEFT);
             mTitleIcon.setImageIcon(icon.toIcon(getContext()));
             if (mPanel.getHeaderIconIntent() != null) {
                 mTitleIcon.setOnClickListener(getHeaderIconListener());
@@ -295,6 +293,24 @@
             }
         } else {
             mTitleGroup.setVisibility(View.GONE);
+            mHeaderLayout.setGravity(Gravity.CENTER_HORIZONTAL);
+        }
+    }
+
+    private void enableTitle(CharSequence title) {
+        mPanelHeader.setVisibility(View.GONE);
+        mTitleView.setVisibility(View.VISIBLE);
+        mTitleView.setAccessibilityPaneTitle(title);
+        mTitleView.setText(title);
+    }
+
+    private void enableCustomizedButton() {
+        final CharSequence customTitle = mPanel.getCustomizedButtonTitle();
+        if (TextUtils.isEmpty(customTitle)) {
+            mSeeMoreButton.setVisibility(View.GONE);
+        } else {
+            mSeeMoreButton.setVisibility(View.VISIBLE);
+            mSeeMoreButton.setText(customTitle);
         }
     }
 
@@ -487,24 +503,14 @@
         @Override
         public void onCustomizedButtonStateChanged() {
             ThreadUtils.postOnMainThread(() -> {
-                mSeeMoreButton.setVisibility(
-                        mPanel.isCustomizedButtonUsed() ? View.VISIBLE : View.GONE);
-                mSeeMoreButton.setText(mPanel.getCustomizedButtonTitle());
+                enableCustomizedButton();
             });
         }
 
         @Override
         public void onHeaderChanged() {
             ThreadUtils.postOnMainThread(() -> {
-                final IconCompat icon = mPanel.getIcon();
-                if (icon != null) {
-                    mTitleIcon.setImageIcon(icon.toIcon(getContext()));
-                    mTitleGroup.setVisibility(View.VISIBLE);
-                } else {
-                    mTitleGroup.setVisibility(View.GONE);
-                }
-                mHeaderTitle.setText(mPanel.getTitle());
-                mHeaderSubtitle.setText(mPanel.getSubTitle());
+                enablePanelHeader(mPanel.getIcon(), mPanel.getTitle(), mPanel.getSubTitle());
             });
         }
 
@@ -517,7 +523,7 @@
         @Override
         public void onTitleChanged() {
             ThreadUtils.postOnMainThread(() -> {
-                mTitleView.setText(mPanel.getTitle());
+                enableTitle(mPanel.getTitle());
             });
         }
 
diff --git a/src/com/android/settings/security/CredentialStorage.java b/src/com/android/settings/security/CredentialStorage.java
index 2e3e2ed..53a1a59 100644
--- a/src/com/android/settings/security/CredentialStorage.java
+++ b/src/com/android/settings/security/CredentialStorage.java
@@ -44,6 +44,7 @@
 
 import com.android.internal.widget.LockPatternUtils;
 import com.android.settings.R;
+import com.android.settings.core.HideNonSystemOverlayMixin;
 import com.android.settings.password.ChooseLockSettingsHelper;
 import com.android.settings.vpn2.VpnUtils;
 
@@ -75,6 +76,7 @@
     protected void onCreate(Bundle savedState) {
         super.onCreate(savedState);
         mUtils = new LockPatternUtils(this);
+        getLifecycle().addObserver(new HideNonSystemOverlayMixin(this));
     }
 
     @Override
diff --git a/src/com/android/settings/sim/SimActivationNotifier.java b/src/com/android/settings/sim/SimActivationNotifier.java
index a38816a..735cb46 100644
--- a/src/com/android/settings/sim/SimActivationNotifier.java
+++ b/src/com/android/settings/sim/SimActivationNotifier.java
@@ -66,12 +66,15 @@
             value = {
                 NotificationType.NETWORK_CONFIG,
                 NotificationType.SWITCH_TO_REMOVABLE_SLOT,
+                NotificationType.ENABLE_DSDS,
             })
     public @interface NotificationType {
         // The notification to remind users to config network Settings.
         int NETWORK_CONFIG = 1;
         // The notification to notify users that the device is switched to the removable slot.
         int SWITCH_TO_REMOVABLE_SLOT = 2;
+        // The notification to notify users that the device is capable of DSDS.
+        int ENABLE_DSDS = 3;
     }
 
     private final Context mContext;
@@ -120,8 +123,8 @@
             return;
         }
 
-        CharSequence displayName = SubscriptionUtil.getUniqueSubscriptionDisplayName(
-                activeRemovableSub, mContext);
+        CharSequence displayName =
+                SubscriptionUtil.getUniqueSubscriptionDisplayName(activeRemovableSub, mContext);
         String carrierName =
                 TextUtils.isEmpty(displayName)
                         ? mContext.getString(R.string.sim_card_label)
@@ -135,7 +138,8 @@
                 TaskStackBuilder.create(mContext).addNextIntent(clickIntent);
         PendingIntent contentIntent =
                 stackBuilder.getPendingIntent(
-                        0 /* requestCode */, PendingIntent.FLAG_UPDATE_CURRENT);
+                        0 /* requestCode */,
+                        PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
 
         Notification.Builder builder =
                 new Notification.Builder(mContext, SIM_SETUP_CHANNEL_ID)
@@ -155,7 +159,8 @@
                 TaskStackBuilder.create(mContext).addNextIntent(clickIntent);
         PendingIntent contentIntent =
                 stackBuilder.getPendingIntent(
-                        0 /* requestCode */, PendingIntent.FLAG_UPDATE_CURRENT);
+                        0 /* requestCode */,
+                        PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
         String titleText =
                 TextUtils.isEmpty(carrierName)
                         ? mContext.getString(
@@ -178,6 +183,33 @@
         mNotificationManager.notify(SWITCH_TO_REMOVABLE_SLOT_NOTIFICATION_ID, builder.build());
     }
 
+    /** Sends a push notification for enabling DSDS. */
+    public void sendEnableDsdsNotification() {
+        Intent parentIntent = new Intent(mContext, Settings.MobileNetworkListActivity.class);
+
+        Intent clickIntent = new Intent(mContext, DsdsDialogActivity.class);
+
+        TaskStackBuilder stackBuilder =
+                TaskStackBuilder.create(mContext)
+                        .addNextIntentWithParentStack(parentIntent)
+                        .addNextIntent(clickIntent);
+        PendingIntent contentIntent =
+                stackBuilder.getPendingIntent(
+                        0 /* requestCode */,
+                        PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
+
+        Notification.Builder builder =
+                new Notification.Builder(mContext, SIM_SETUP_CHANNEL_ID)
+                        .setContentTitle(
+                                mContext.getString(R.string.dsds_notification_after_suw_title))
+                        .setContentText(
+                                mContext.getString(R.string.dsds_notification_after_suw_text))
+                        .setContentIntent(contentIntent)
+                        .setSmallIcon(R.drawable.ic_sim_alert)
+                        .setAutoCancel(true);
+        mNotificationManager.notify(SIM_ACTIVATION_NOTIFICATION_ID, builder.build());
+    }
+
     @Nullable
     private SubscriptionInfo getActiveRemovableSub() {
         SubscriptionManager subscriptionManager =
diff --git a/src/com/android/settings/sim/SimNotificationService.java b/src/com/android/settings/sim/SimNotificationService.java
index 0f52c8b..42b5e58 100644
--- a/src/com/android/settings/sim/SimNotificationService.java
+++ b/src/com/android/settings/sim/SimNotificationService.java
@@ -71,6 +71,9 @@
             case SimActivationNotifier.NotificationType.SWITCH_TO_REMOVABLE_SLOT:
                 new SimActivationNotifier(this).sendSwitchedToRemovableSlotNotification();
                 break;
+            case SimActivationNotifier.NotificationType.ENABLE_DSDS:
+                new SimActivationNotifier(this).sendEnableDsdsNotification();
+                break;
             default:
                 Log.e(TAG, "Invalid notification type: " + notificationType);
                 break;
diff --git a/src/com/android/settings/sim/receivers/SimSlotChangeHandler.java b/src/com/android/settings/sim/receivers/SimSlotChangeHandler.java
index c092428..fe44389 100644
--- a/src/com/android/settings/sim/receivers/SimSlotChangeHandler.java
+++ b/src/com/android/settings/sim/receivers/SimSlotChangeHandler.java
@@ -50,7 +50,13 @@
     private static final String TAG = "SimSlotChangeHandler";
 
     private static final String EUICC_PREFS = "euicc_prefs";
+    // Shared preference keys
     private static final String KEY_REMOVABLE_SLOT_STATE = "removable_slot_state";
+    private static final String KEY_SUW_PSIM_ACTION = "suw_psim_action";
+    // User's last removable SIM insertion / removal action during SUW.
+    private static final int LAST_USER_ACTION_IN_SUW_NONE = 0;
+    private static final int LAST_USER_ACTION_IN_SUW_INSERT = 1;
+    private static final int LAST_USER_ACTION_IN_SUW_REMOVE = 2;
 
     private static volatile SimSlotChangeHandler sSlotChangeHandler;
 
@@ -107,6 +113,47 @@
         Log.i(TAG, "Do nothing on slot status changes.");
     }
 
+    void onSuwFinish(Context context) {
+        init(context);
+
+        if (Looper.myLooper() == Looper.getMainLooper()) {
+            throw new IllegalStateException("Cannot be called from main thread.");
+        }
+
+        if (mTelMgr.getActiveModemCount() > 1) {
+            Log.i(TAG, "The device is already in DSDS mode. Do nothing.");
+            return;
+        }
+
+        UiccSlotInfo removableSlotInfo = getRemovableUiccSlotInfo();
+        if (removableSlotInfo == null) {
+            Log.e(TAG, "Unable to find the removable slot. Do nothing.");
+            return;
+        }
+
+        boolean embeddedSimExist = getGroupedEmbeddedSubscriptions().size() != 0;
+        int removableSlotAction = getSuwRemovableSlotAction(mContext);
+        setSuwRemovableSlotAction(mContext, LAST_USER_ACTION_IN_SUW_NONE);
+
+        if (embeddedSimExist
+                && removableSlotInfo.getCardStateInfo() == UiccSlotInfo.CARD_STATE_INFO_PRESENT) {
+            if (mTelMgr.isMultiSimSupported() == TelephonyManager.MULTISIM_ALLOWED) {
+                Log.i(TAG, "DSDS condition satisfied. Show notification.");
+                SimNotificationService.scheduleSimNotification(
+                        mContext, SimActivationNotifier.NotificationType.ENABLE_DSDS);
+            } else if (removableSlotAction == LAST_USER_ACTION_IN_SUW_INSERT) {
+                Log.i(
+                        TAG,
+                        "Both removable SIM and eSIM are present. DSDS condition doesn't"
+                            + " satisfied. User inserted pSIM during SUW. Show choose SIM"
+                            + " screen.");
+                startChooseSimActivity(true);
+            }
+        } else if (removableSlotAction == LAST_USER_ACTION_IN_SUW_REMOVE) {
+            handleSimRemove(removableSlotInfo);
+        }
+    }
+
     private void init(Context context) {
         mSubMgr =
                 (SubscriptionManager)
@@ -116,11 +163,11 @@
     }
 
     private void handleSimInsert(UiccSlotInfo removableSlotInfo) {
-        Log.i(TAG, "Detect SIM inserted.");
+        Log.i(TAG, "Handle SIM inserted.");
 
         if (!isSuwFinished(mContext)) {
-            // TODO(b/170508680): Store the action and handle it after SUW is finished.
             Log.i(TAG, "Still in SUW. Handle SIM insertion after SUW is finished");
+            setSuwRemovableSlotAction(mContext, LAST_USER_ACTION_IN_SUW_INSERT);
             return;
         }
 
@@ -156,11 +203,11 @@
     }
 
     private void handleSimRemove(UiccSlotInfo removableSlotInfo) {
-        Log.i(TAG, "Detect SIM removed.");
+        Log.i(TAG, "Handle SIM removed.");
 
         if (!isSuwFinished(mContext)) {
-            // TODO(b/170508680): Store the action and handle it after SUW is finished.
             Log.i(TAG, "Still in SUW. Handle SIM removal after SUW is finished");
+            setSuwRemovableSlotAction(mContext, LAST_USER_ACTION_IN_SUW_REMOVE);
             return;
         }
 
@@ -195,6 +242,16 @@
         prefs.edit().putInt(KEY_REMOVABLE_SLOT_STATE, state).apply();
     }
 
+    private int getSuwRemovableSlotAction(Context context) {
+        final SharedPreferences prefs = context.getSharedPreferences(EUICC_PREFS, MODE_PRIVATE);
+        return prefs.getInt(KEY_SUW_PSIM_ACTION, LAST_USER_ACTION_IN_SUW_NONE);
+    }
+
+    private void setSuwRemovableSlotAction(Context context, int action) {
+        final SharedPreferences prefs = context.getSharedPreferences(EUICC_PREFS, MODE_PRIVATE);
+        prefs.edit().putInt(KEY_SUW_PSIM_ACTION, action).apply();
+    }
+
     @Nullable
     private UiccSlotInfo getRemovableUiccSlotInfo() {
         UiccSlotInfo[] slotInfos = mTelMgr.getUiccSlotsInfo();
diff --git a/src/com/android/settings/sim/receivers/SimSlotChangeReceiver.java b/src/com/android/settings/sim/receivers/SimSlotChangeReceiver.java
index 563b4ef..f2c7c65 100644
--- a/src/com/android/settings/sim/receivers/SimSlotChangeReceiver.java
+++ b/src/com/android/settings/sim/receivers/SimSlotChangeReceiver.java
@@ -52,10 +52,9 @@
         ThreadUtils.postOnBackgroundThread(
                 () -> {
                     synchronized (mLock) {
-                        if (!shouldHandleSlotChange(context)) {
-                            return;
+                        if (shouldHandleSlotChange(context)) {
+                            mSlotChangeHandler.onSlotsStatusChange(context.getApplicationContext());
                         }
-                        mSlotChangeHandler.onSlotsStatusChange(context.getApplicationContext());
                     }
                     ThreadUtils.postOnMainThread(pendingResult::finish);
                 });
diff --git a/src/com/android/settings/sim/receivers/SuwFinishReceiver.java b/src/com/android/settings/sim/receivers/SuwFinishReceiver.java
new file mode 100644
index 0000000..7facbe2
--- /dev/null
+++ b/src/com/android/settings/sim/receivers/SuwFinishReceiver.java
@@ -0,0 +1,51 @@
+/*
+ * 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.sim.receivers;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+import com.android.settings.R;
+import com.android.settingslib.utils.ThreadUtils;
+
+/** The receiver when SUW is finished. */
+public class SuwFinishReceiver extends BroadcastReceiver {
+    private static final String TAG = "SuwFinishReceiver";
+
+    private final SimSlotChangeHandler mSlotChangeHandler = SimSlotChangeHandler.get();
+    private final Object mLock = new Object();
+
+    @Override
+    public void onReceive(Context context, Intent intent) {
+        if (!context.getResources().getBoolean(R.bool.config_handle_sim_slot_change)) {
+            Log.i(TAG, "The flag is off. Ignore SUW finish event.");
+            return;
+        }
+
+        final BroadcastReceiver.PendingResult pendingResult = goAsync();
+        ThreadUtils.postOnBackgroundThread(
+                () -> {
+                    synchronized (mLock) {
+                        Log.i(TAG, "Detected SUW finished. Checking slot events.");
+                        mSlotChangeHandler.onSuwFinish(context.getApplicationContext());
+                    }
+                    ThreadUtils.postOnMainThread(pendingResult::finish);
+                });
+    }
+}
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index cfee53c..65e45b7 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -67,6 +67,7 @@
 
 import androidx.annotation.VisibleForTesting;
 
+import com.android.net.module.util.ProxyUtils;
 import com.android.settings.ProxySelector;
 import com.android.settings.R;
 import com.android.settings.network.SubscriptionUtil;
@@ -1408,7 +1409,8 @@
                 if (proxyProperties != null) {
                     mProxyHostView.setText(proxyProperties.getHost());
                     mProxyPortView.setText(Integer.toString(proxyProperties.getPort()));
-                    mProxyExclusionListView.setText(proxyProperties.getExclusionListAsString());
+                    mProxyExclusionListView.setText(
+                            ProxyUtils.exclusionListAsString(proxyProperties.getExclusionList()));
                 }
             }
         } else if (mProxySettingsSpinner.getSelectedItemPosition() == PROXY_PAC) {
diff --git a/src/com/android/settings/wifi/WifiConfigController2.java b/src/com/android/settings/wifi/WifiConfigController2.java
index 62f2352..49f1b21 100644
--- a/src/com/android/settings/wifi/WifiConfigController2.java
+++ b/src/com/android/settings/wifi/WifiConfigController2.java
@@ -65,6 +65,7 @@
 
 import androidx.annotation.VisibleForTesting;
 
+import com.android.net.module.util.ProxyUtils;
 import com.android.settings.ProxySelector;
 import com.android.settings.R;
 import com.android.settings.network.SubscriptionUtil;
@@ -1372,7 +1373,8 @@
                 if (proxyProperties != null) {
                     mProxyHostView.setText(proxyProperties.getHost());
                     mProxyPortView.setText(Integer.toString(proxyProperties.getPort()));
-                    mProxyExclusionListView.setText(proxyProperties.getExclusionListAsString());
+                    mProxyExclusionListView.setText(
+                            ProxyUtils.exclusionListAsString(proxyProperties.getExclusionList()));
                 }
             }
         } else if (mProxySettingsSpinner.getSelectedItemPosition() == PROXY_PAC) {
diff --git a/tests/robotests/src/com/android/settings/SettingsActivityTest.java b/tests/robotests/src/com/android/settings/SettingsActivityTest.java
index ada4c0e..89f8449 100644
--- a/tests/robotests/src/com/android/settings/SettingsActivityTest.java
+++ b/tests/robotests/src/com/android/settings/SettingsActivityTest.java
@@ -37,6 +37,7 @@
 
 import com.android.settings.core.OnActivityResultListener;
 import com.android.settings.testutils.FakeFeatureFactory;
+import com.android.settings.testutils.shadow.ShadowUserManager;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -46,11 +47,13 @@
 import org.robolectric.Robolectric;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
 
 import java.util.ArrayList;
 import java.util.List;
 
 @RunWith(RobolectricTestRunner.class)
+@Config(shadows = ShadowUserManager.class)
 public class SettingsActivityTest {
 
     @Mock
diff --git a/tests/robotests/src/com/android/settings/accessibility/ShortcutsSettingsFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/ShortcutsSettingsFragmentTest.java
new file mode 100644
index 0000000..12b568f
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/accessibility/ShortcutsSettingsFragmentTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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;
+
+/** Tests for {@link ShortcutsSettingsFragment}. */
+@RunWith(RobolectricTestRunner.class)
+public class ShortcutsSettingsFragmentTest {
+
+    private Context mContext = ApplicationProvider.getApplicationContext();
+
+    @Test
+    public void getNonIndexableKeys_existInXmlLayout() {
+        final List<String> niks = ShortcutsSettingsFragment.SEARCH_INDEX_DATA_PROVIDER
+                .getNonIndexableKeys(mContext);
+        final List<String> keys =
+                XmlTestUtils.getKeysFromPreferenceXml(mContext,
+                        R.xml.accessibility_shortcuts_settings);
+
+        assertThat(keys).containsAtLeastElementsIn(niks);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/accounts/AvatarViewMixinTest.java b/tests/robotests/src/com/android/settings/accounts/AvatarViewMixinTest.java
index 80f21fc..02b318f 100644
--- a/tests/robotests/src/com/android/settings/accounts/AvatarViewMixinTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AvatarViewMixinTest.java
@@ -43,6 +43,7 @@
 
 import com.android.settings.homepage.SettingsHomepageActivity;
 import com.android.settings.homepage.contextualcards.slices.BatteryFixSliceTest;
+import com.android.settings.testutils.shadow.ShadowUserManager;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -61,6 +62,7 @@
 import org.robolectric.shadows.ShadowPackageManager;
 
 @RunWith(RobolectricTestRunner.class)
+@Config(shadows = ShadowUserManager.class)
 public class AvatarViewMixinTest {
     private static final String FAKE_ACCOUNT = "test@domain.com";
     private static final String FAKE_DOMAIN = "domain.com";
diff --git a/tests/robotests/src/com/android/settings/accounts/TopLevelAccountEntryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accounts/TopLevelAccountEntryPreferenceControllerTest.java
index 1cd5fb1..3a67d7f 100644
--- a/tests/robotests/src/com/android/settings/accounts/TopLevelAccountEntryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/TopLevelAccountEntryPreferenceControllerTest.java
@@ -48,15 +48,12 @@
         mController = new TopLevelAccountEntryPreferenceController(mContext, "test_key");
         LABELS = ShadowAuthenticationHelper.getLabels();
         TYPES = ShadowAuthenticationHelper.getTypes();
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
     }
 
     @After
     public void tearDown() {
         ShadowAuthenticationHelper.reset();
-
-        if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
-            FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
-        }
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java b/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java
index b6ef32c..a662be8 100644
--- a/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java
+++ b/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java
@@ -35,8 +35,10 @@
 import android.os.IBinder;
 import android.os.RemoteException;
 import android.os.UserHandle;
+import android.util.FeatureFlagUtils;
 
 import com.android.settings.R;
+import com.android.settings.core.FeatureFlags;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -81,6 +83,7 @@
         when(mBackupManager.getCurrentTransport()).thenReturn("test_transport");
         mBackupSettingsHelper = new BackupSettingsHelper(mContext);
         mUserManager = Shadow.extract(mContext.getSystemService(Context.USER_SERVICE));
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/TopLevelConnectedDevicesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/TopLevelConnectedDevicesPreferenceControllerTest.java
index 232bc16..b1f9ed1 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/TopLevelConnectedDevicesPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/TopLevelConnectedDevicesPreferenceControllerTest.java
@@ -27,7 +27,6 @@
 import com.android.settings.R;
 import com.android.settings.core.FeatureFlags;
 
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -47,13 +46,7 @@
     public void setUp() {
         mContext = RuntimeEnvironment.application;
         mController = new TopLevelConnectedDevicesPreferenceController(mContext, "test_key");
-    }
-
-    @After
-    public void tearDown() {
-        if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
-            FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
-        }
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java
index a0024c0..1e6bc41 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java
@@ -77,7 +77,6 @@
 import com.android.settingslib.drawer.Tile;
 import com.android.settingslib.drawer.TileUtils;
 
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -147,13 +146,7 @@
                 .thenReturn(new ResolveInfo());
         mFeatureFactory = FakeFeatureFactory.setupForTest();
         mImpl = new DashboardFeatureProviderImpl(mContext);
-    }
-
-    @After
-    public void tearDown() {
-        if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
-            FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
-        }
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/TopLevelStoragePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/TopLevelStoragePreferenceControllerTest.java
index e19066a..7e6be9b 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/TopLevelStoragePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/TopLevelStoragePreferenceControllerTest.java
@@ -36,7 +36,6 @@
 import com.android.settings.core.FeatureFlags;
 import com.android.settingslib.deviceinfo.StorageManagerVolumeProvider;
 
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -69,13 +68,7 @@
         when(mStorageManagerVolumeProvider.getVolumes()).thenReturn(mVolumes);
 
         mController = new TopLevelStoragePreferenceController(mContext, "test_key");
-    }
-
-    @After
-    public void tearDown() {
-        if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
-            FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
-        }
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/aboutphone/TopLevelAboutDevicePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/aboutphone/TopLevelAboutDevicePreferenceControllerTest.java
index 16c77a4..d20beab 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/aboutphone/TopLevelAboutDevicePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/aboutphone/TopLevelAboutDevicePreferenceControllerTest.java
@@ -27,7 +27,6 @@
 
 import com.android.settings.core.FeatureFlags;
 
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -44,13 +43,7 @@
     public void setUp() {
         mContext = RuntimeEnvironment.application;
         mController = new TopLevelAboutDevicePreferenceController(mContext, "test_key");
-    }
-
-    @After
-    public void teardown() {
-        if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
-            FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
-        }
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java b/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java
index 621ddfa..efc45e0 100644
--- a/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/display/ScreenTimeoutSettingsTest.java
@@ -87,6 +87,7 @@
                 com.android.internal.R.bool.config_adaptive_sleep_available);
 
         doReturn(null).when(mContext).getSystemService(DevicePolicyManager.class);
+        doReturn(mResources).when(mContext).getResources();
 
         doReturn(mResources).when(mSettings).getResources();
         doReturn(mContext).when(mSettings).getContext();
diff --git a/tests/robotests/src/com/android/settings/display/TopLevelDisplayPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/TopLevelDisplayPreferenceControllerTest.java
index a52ad71..864d2b9 100644
--- a/tests/robotests/src/com/android/settings/display/TopLevelDisplayPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/TopLevelDisplayPreferenceControllerTest.java
@@ -36,7 +36,6 @@
 import com.android.settings.R;
 import com.android.settings.core.FeatureFlags;
 
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -66,13 +65,7 @@
         when(mContext.getString(R.string.config_wallpaper_picker_class)).thenReturn("cls");
 
         mController = new TopLevelDisplayPreferenceController(mContext, "test_key");
-    }
-
-    @After
-    public void tearDown() {
-        if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
-            FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
-        }
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/TopLevelBatteryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/TopLevelBatteryPreferenceControllerTest.java
index 6d2298b..f2677ce 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/TopLevelBatteryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/TopLevelBatteryPreferenceControllerTest.java
@@ -27,7 +27,6 @@
 import com.android.settings.R;
 import com.android.settings.core.FeatureFlags;
 
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -44,13 +43,7 @@
     public void setUp() {
         mContext = RuntimeEnvironment.application;
         mController = new TopLevelBatteryPreferenceController(mContext, "test_key");
-    }
-
-    @After
-    public void tearDown() {
-        if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
-            FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
-        }
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/gestures/GesturesSettingsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/gestures/GesturesSettingsPreferenceControllerTest.java
index 1e84207..df1dfd0 100644
--- a/tests/robotests/src/com/android/settings/gestures/GesturesSettingsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/gestures/GesturesSettingsPreferenceControllerTest.java
@@ -28,10 +28,12 @@
 import android.content.ContentResolver;
 import android.content.Context;
 import android.provider.Settings;
+import android.util.FeatureFlagUtils;
 
 import androidx.preference.Preference;
 
 import com.android.settings.R;
+import com.android.settings.core.FeatureFlags;
 import com.android.settings.testutils.FakeFeatureFactory;
 import com.android.settings.testutils.shadow.ShadowSecureSettings;
 import com.android.settingslib.core.AbstractPreferenceController;
@@ -65,6 +67,7 @@
         MockitoAnnotations.initMocks(this);
         FakeFeatureFactory.setupForTest();
         mController = new GesturesSettingPreferenceController(mActivity);
+        FeatureFlagUtils.setEnabled(RuntimeEnvironment.application, FeatureFlags.SILKY_HOME, false);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java b/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java
index bae4432..40315d2 100644
--- a/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/SettingsHomepageActivityTest.java
@@ -26,11 +26,13 @@
 import static org.mockito.Mockito.when;
 
 import android.os.Build;
+import android.util.FeatureFlagUtils;
 import android.view.Window;
 import android.view.WindowManager;
 import android.widget.FrameLayout;
 
 import com.android.settings.R;
+import com.android.settings.core.FeatureFlags;
 import com.android.settings.core.HideNonSystemOverlayMixin;
 import com.android.settings.homepage.contextualcards.slices.BatteryFixSliceTest;
 
@@ -41,6 +43,7 @@
 import org.mockito.MockitoAnnotations;
 import org.robolectric.Robolectric;
 import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
 import org.robolectric.android.controller.ActivityController;
 import org.robolectric.annotation.Config;
 import org.robolectric.util.ReflectionHelpers;
@@ -51,6 +54,7 @@
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
+        FeatureFlagUtils.setEnabled(RuntimeEnvironment.application, FeatureFlags.SILKY_HOME, false);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/location/TopLevelLocationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/location/TopLevelLocationPreferenceControllerTest.java
index 2fa7413..f5bc961 100644
--- a/tests/robotests/src/com/android/settings/location/TopLevelLocationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/location/TopLevelLocationPreferenceControllerTest.java
@@ -25,7 +25,6 @@
 import com.android.settings.R;
 import com.android.settings.core.FeatureFlags;
 
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -44,13 +43,7 @@
         mContext = RuntimeEnvironment.application;
         mController = new TopLevelLocationPreferenceController(mContext, PREFERENCE_KEY);
         mLocationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
-    }
-
-    @After
-    public void tearDown() {
-        if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
-            FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
-        }
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java b/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java
index 6de83a6..097ebaf 100644
--- a/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/MobileNetworkSummaryControllerTest.java
@@ -104,6 +104,7 @@
 
     @After
     public void tearDown() {
+        SubscriptionUtil.setActiveSubscriptionsForTesting(null);
         SubscriptionUtil.setAvailableSubscriptionsForTesting(null);
     }
 
@@ -269,7 +270,8 @@
         when(sub1.getDisplayName()).thenReturn("sub1");
         when(sub2.getDisplayName()).thenReturn("sub2");
 
-        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1));
+        when(mSubscriptionManager.getAvailableSubscriptionInfoList()).thenReturn(
+                Arrays.asList(sub1));
         SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1));
         mController.displayPreference(mPreferenceScreen);
         mController.onResume();
diff --git a/tests/robotests/src/com/android/settings/network/TopLevelNetworkEntryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/TopLevelNetworkEntryPreferenceControllerTest.java
index 857b3eb..fc01c68 100644
--- a/tests/robotests/src/com/android/settings/network/TopLevelNetworkEntryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/TopLevelNetworkEntryPreferenceControllerTest.java
@@ -74,15 +74,12 @@
                 mMobileNetworkPreferenceController);
         ReflectionHelpers.setField(mController, "mTetherPreferenceController",
                 mTetherPreferenceController);
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
     }
 
     @After
     public void tearDown() {
         ShadowUtils.reset();
-
-        if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
-            FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
-        }
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java b/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java
index 4526886..d0df92e 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java
@@ -45,8 +45,10 @@
 import androidx.fragment.app.FragmentActivity;
 
 import com.android.settings.R;
+import com.android.settings.network.SubscriptionUtil;
 import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
 
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -109,8 +111,15 @@
         mSubscriptionInfoList.add(mSubscriptionInfo);
         when(mSubscriptionMgr.getAvailableSubscriptionInfoList()).thenReturn(
                 mSubscriptionInfoList);
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(mSubscriptionInfoList);
     }
 
+    @After
+    public void tearDown() {
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(null);
+    }
+
+
     @Test
     @Ignore
     public void dialog_subscriptionMissing_noCrash() {
diff --git a/tests/robotests/src/com/android/settings/panel/InternetConnectivityPanelTest.java b/tests/robotests/src/com/android/settings/panel/InternetConnectivityPanelTest.java
deleted file mode 100644
index eb82d31..0000000
--- a/tests/robotests/src/com/android/settings/panel/InternetConnectivityPanelTest.java
+++ /dev/null
@@ -1,83 +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.panel;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.net.Uri;
-import android.os.SystemProperties;
-
-import com.android.settings.network.AirplaneModePreferenceController;
-import com.android.settings.slices.CustomSliceRegistry;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-import java.util.List;
-
-@RunWith(RobolectricTestRunner.class)
-
-public class InternetConnectivityPanelTest {
-
-    private InternetConnectivityPanel mPanel;
-    private static final String SETTINGS_PROVIDER_MODEL =
-            "persist.sys.fflag.override.settings_provider_model";
-    private boolean mSettingsProviderModelState;
-
-    @Before
-    public void setUp() {
-        mPanel = InternetConnectivityPanel.create(RuntimeEnvironment.application);
-        mSettingsProviderModelState = SystemProperties.getBoolean(SETTINGS_PROVIDER_MODEL, false);
-    }
-
-    @After
-    public void tearDown() {
-        SystemProperties.set(SETTINGS_PROVIDER_MODEL,
-                mSettingsProviderModelState ? "true" : "false");
-    }
-
-    @Test
-    public void getSlices_providerModelDisabled_containsNecessarySlices() {
-        SystemProperties.set(SETTINGS_PROVIDER_MODEL, "false");
-        final List<Uri> uris = mPanel.getSlices();
-
-        assertThat(uris).containsExactly(
-                AirplaneModePreferenceController.SLICE_URI,
-                CustomSliceRegistry.MOBILE_DATA_SLICE_URI,
-                CustomSliceRegistry.WIFI_SLICE_URI);
-    }
-
-    @Test
-    public void getSlices_providerModelEnabled_containsNecessarySlices() {
-        SystemProperties.set(SETTINGS_PROVIDER_MODEL, "true");
-        final List<Uri> uris = mPanel.getSlices();
-
-        assertThat(uris).containsExactly(
-                CustomSliceRegistry.PROVIDER_MODEL_SLICE_URI,
-                CustomSliceRegistry.AIRPLANE_SAFE_NETWORKS_SLICE_URI);
-    }
-
-    @Test
-    public void getSeeMoreIntent_notNull() {
-        assertThat(mPanel.getSeeMoreIntent()).isNotNull();
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/password/ChooseLockGenericTest.java b/tests/robotests/src/com/android/settings/password/ChooseLockGenericTest.java
index 03ce25a..634b9a8 100644
--- a/tests/robotests/src/com/android/settings/password/ChooseLockGenericTest.java
+++ b/tests/robotests/src/com/android/settings/password/ChooseLockGenericTest.java
@@ -45,6 +45,7 @@
 import android.content.Intent;
 import android.os.Bundle;
 import android.provider.Settings.Global;
+import android.util.FeatureFlagUtils;
 
 import androidx.annotation.Nullable;
 import androidx.preference.Preference;
@@ -53,6 +54,7 @@
 import com.android.internal.widget.LockscreenCredential;
 import com.android.settings.R;
 import com.android.settings.biometrics.BiometricEnrollBase;
+import com.android.settings.core.FeatureFlags;
 import com.android.settings.password.ChooseLockGeneric.ChooseLockGenericFragment;
 import com.android.settings.search.SearchFeatureProvider;
 import com.android.settings.testutils.shadow.ShadowLockPatternUtils;
@@ -68,6 +70,7 @@
 import org.junit.runner.RunWith;
 import org.robolectric.Robolectric;
 import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
 import org.robolectric.shadows.ShadowApplication;
 import org.robolectric.shadows.ShadowPersistentDataBlockManager;
@@ -90,6 +93,7 @@
     public void setUp() {
         Global.putInt(application.getContentResolver(), Global.DEVICE_PROVISIONED, 1);
         mFragment = new ChooseLockGenericFragment();
+        FeatureFlagUtils.setEnabled(RuntimeEnvironment.application, FeatureFlags.SILKY_HOME, false);
     }
 
     @After
diff --git a/tests/robotests/src/com/android/settings/security/TopLevelSecurityEntryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/security/TopLevelSecurityEntryPreferenceControllerTest.java
index 33d22d4..05abc40 100644
--- a/tests/robotests/src/com/android/settings/security/TopLevelSecurityEntryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/security/TopLevelSecurityEntryPreferenceControllerTest.java
@@ -30,7 +30,6 @@
 import com.android.settings.R;
 import com.android.settings.core.FeatureFlags;
 
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -58,13 +57,7 @@
         when(mContext.getSystemService(Context.FACE_SERVICE))
                 .thenReturn(mFaceManager);
         mController = new TopLevelSecurityEntryPreferenceController(mContext, "test_key");
-    }
-
-    @After
-    public void tearDown() {
-        if (FeatureFlagUtils.isEnabled(mContext, FeatureFlags.SILKY_HOME)) {
-            FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
-        }
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/sim/PreferredSimDialogFragmentTest.java b/tests/robotests/src/com/android/settings/sim/PreferredSimDialogFragmentTest.java
index 62c2fc5..9bdbbcf 100644
--- a/tests/robotests/src/com/android/settings/sim/PreferredSimDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/sim/PreferredSimDialogFragmentTest.java
@@ -75,6 +75,7 @@
 
     @Test
     public void onCreateDialog_twoSimsSelectFirst_correctMessage() {
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(mSim1, mSim2));
         SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(mSim1, mSim2));
         mIntent.putExtra(PREFERRED_SIM, 0);
 
@@ -87,6 +88,7 @@
 
     @Test
     public void onCreateDialog_twoSimsSelectSecond_correctMessage() {
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(mSim1, mSim2));
         SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(mSim1, mSim2));
         mIntent.putExtra(PREFERRED_SIM, 1);
 
@@ -99,6 +101,7 @@
 
     @Test
     public void onClick_yesClicked_callsOnSubscriptionSelected() {
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(mSim1, mSim2));
         mIntent.putExtra(PREFERRED_SIM, 0);
 
         final AlertDialog alertDialog = startDialog();
@@ -113,6 +116,7 @@
 
     @Test
     public void onClick_noClicked_doesNotCallOnSubscriptionSelected() {
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(mSim1, mSim2));
         mIntent.putExtra(PREFERRED_SIM, 0);
 
         final AlertDialog alertDialog = startDialog();
diff --git a/tests/robotests/src/com/android/settings/sim/SimSelectNotificationTest.java b/tests/robotests/src/com/android/settings/sim/SimSelectNotificationTest.java
index d6a1326..a6d3354 100644
--- a/tests/robotests/src/com/android/settings/sim/SimSelectNotificationTest.java
+++ b/tests/robotests/src/com/android/settings/sim/SimSelectNotificationTest.java
@@ -130,6 +130,7 @@
 
         when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mTelephonyManager);
         when(mTelephonyManager.isDataEnabledForApn(TYPE_MMS)).thenReturn(false);
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(mSubInfo));
         SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(mSubInfo));
         when(mSubscriptionManager.isActiveSubscriptionId(mSubId)).thenReturn(true);
         when(mSubscriptionManager.getActiveSubscriptionInfo(mSubId)).thenReturn(mSubInfo);
diff --git a/tests/robotests/src/com/android/settings/system/ResetPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/system/ResetPreferenceControllerTest.java
index 0d34a76..e80e77a 100644
--- a/tests/robotests/src/com/android/settings/system/ResetPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/system/ResetPreferenceControllerTest.java
@@ -21,8 +21,10 @@
 import android.content.pm.UserInfo;
 import android.os.UserHandle;
 import android.provider.Settings;
+import android.util.FeatureFlagUtils;
 
 import com.android.settings.R;
+import com.android.settings.core.FeatureFlags;
 import com.android.settings.testutils.shadow.ShadowUserManager;
 
 import org.junit.Before;
@@ -47,6 +49,7 @@
         mContext = RuntimeEnvironment.application;
         mController = new ResetPreferenceController(mContext, KEY_RESET_DASHBOARD);
         mShadowUserManager = ShadowUserManager.getShadow();
+        FeatureFlagUtils.setEnabled(mContext, FeatureFlags.SILKY_HOME, false);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiConfigController2Test.java b/tests/robotests/src/com/android/settings/wifi/WifiConfigController2Test.java
index 80091e6..22e18bb 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiConfigController2Test.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiConfigController2Test.java
@@ -49,6 +49,7 @@
 import android.widget.TextView;
 
 import com.android.settings.R;
+import com.android.settings.network.SubscriptionUtil;
 import com.android.settings.testutils.shadow.ShadowConnectivityManager;
 import com.android.settings.wifi.details2.WifiPrivacyPreferenceController2;
 import com.android.wifitrackerlib.WifiEntry;
@@ -834,6 +835,7 @@
         when(subscriptionInfo.getDisplayName()).thenReturn("FAKE-CARRIER");
         when(subscriptionInfo.getCarrierId()).thenReturn(carrierId);
         when(subscriptionInfo.getCarrierName()).thenReturn("FAKE-CARRIER");
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(subscriptionInfo));
         mShadowSubscriptionManager.setActiveSubscriptionInfoList(Arrays.asList(subscriptionInfo));
         mController = new TestWifiConfigController2(mConfigUiBase, mView, mWifiEntry,
                 WifiConfigUiBase2.MODE_CONNECT);
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java b/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
index 305f41d..455e9f1 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
@@ -49,6 +49,7 @@
 import android.widget.TextView;
 
 import com.android.settings.R;
+import com.android.settings.network.SubscriptionUtil;
 import com.android.settings.testutils.shadow.ShadowConnectivityManager;
 import com.android.settingslib.wifi.AccessPoint;
 
@@ -629,6 +630,7 @@
         when(subscriptionInfo.getDisplayName()).thenReturn("FAKE-CARRIER");
         when(subscriptionInfo.getCarrierId()).thenReturn(carrierId);
         when(subscriptionInfo.getCarrierName()).thenReturn("FAKE-CARRIER");
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(subscriptionInfo));
         mShadowSubscriptionManager.setActiveSubscriptionInfoList(Arrays.asList(subscriptionInfo));
         mController = new TestWifiConfigController(mConfigUiBase, mView, mAccessPoint,
                 WifiConfigUiBase.MODE_CONNECT);
diff --git a/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSettingsTest.java b/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSettingsTest.java
index 0159f49..d7f75e1 100644
--- a/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSettingsTest.java
@@ -125,6 +125,8 @@
         when(info1.getDisplayName()).thenReturn(DISPLAY_NAME1);
         when(info2.getDisplayName()).thenReturn(DISPLAY_NAME2);
 
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(new ArrayList<>(
+                Arrays.asList(info1, info2)));
         SubscriptionUtil.setActiveSubscriptionsForTesting(new ArrayList<>(
                 Arrays.asList(info1, info2)));
 
diff --git a/tests/unit/src/com/android/settings/network/AirplaneSafeNetworksSliceTest.java b/tests/unit/src/com/android/settings/network/AirplaneSafeNetworksSliceTest.java
index a344ab6..a90b89d 100644
--- a/tests/unit/src/com/android/settings/network/AirplaneSafeNetworksSliceTest.java
+++ b/tests/unit/src/com/android/settings/network/AirplaneSafeNetworksSliceTest.java
@@ -34,7 +34,6 @@
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 
-import com.android.settings.testutils.AirplaneModeRule;
 import com.android.settings.testutils.ResourcesUtils;
 
 import org.junit.Before;
@@ -50,8 +49,6 @@
 
     @Rule
     public MockitoRule mMocks = MockitoJUnit.rule();
-    @Rule
-    public AirplaneModeRule mAirplaneModeRule = new AirplaneModeRule();
     @Mock
     private WifiManager mWifiManager;
 
@@ -67,18 +64,18 @@
         SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
 
         mAirplaneSafeNetworksSlice = new AirplaneSafeNetworksSlice(mContext);
+        mAirplaneSafeNetworksSlice.onAirplaneModeChanged(true);
     }
 
     @Test
-    public void getSlice_airplaneModeOff_shouldBeNull() {
-        mAirplaneModeRule.setAirplaneMode(false);
+    public void getSlice_airplaneModeOff_shouldBeNotNull() {
+        mAirplaneSafeNetworksSlice.onAirplaneModeChanged(false);
 
-        assertThat(mAirplaneSafeNetworksSlice.getSlice()).isNull();
+        assertThat(mAirplaneSafeNetworksSlice.getSlice()).isNotNull();
     }
 
     @Test
-    public void getSlice_wifiDisabled_shouldShowViewAirplaneSafeNetworks() {
-        mAirplaneModeRule.setAirplaneMode(true);
+    public void getSlice_wifiDisabled_shouldShowTurnOnNetworks() {
         when(mWifiManager.isWifiEnabled()).thenReturn(false);
 
         final Slice slice = mAirplaneSafeNetworksSlice.getSlice();
@@ -87,12 +84,11 @@
         final SliceItem sliceTitle =
                 SliceMetadata.from(mContext, slice).getListContent().getHeader().getTitleItem();
         assertThat(sliceTitle.getText()).isEqualTo(
-                ResourcesUtils.getResourcesString(mContext, "view_airplane_safe_networks"));
+                ResourcesUtils.getResourcesString(mContext, "turn_on_networks"));
     }
 
     @Test
-    public void getSlice_wifiEnabled_shouldShowTurnOffAirplaneMode() {
-        mAirplaneModeRule.setAirplaneMode(true);
+    public void getSlice_wifiEnabled_shouldShowTurnOffNetworks() {
         when(mWifiManager.isWifiEnabled()).thenReturn(true);
 
         final Slice slice = mAirplaneSafeNetworksSlice.getSlice();
@@ -101,12 +97,11 @@
         final SliceItem sliceTitle =
                 SliceMetadata.from(mContext, slice).getListContent().getHeader().getTitleItem();
         assertThat(sliceTitle.getText()).isEqualTo(
-                ResourcesUtils.getResourcesString(mContext, "turn_off_airplane_mode"));
+                ResourcesUtils.getResourcesString(mContext, "turn_off_networks"));
     }
 
     @Test
-    public void onNotifyChange_viewAirplaneSafeNetworks_shouldSetWifiEnabled() {
-        mAirplaneModeRule.setAirplaneMode(true);
+    public void onNotifyChange_turnOnNetworks_shouldSetWifiEnabled() {
         when(mWifiManager.isWifiEnabled()).thenReturn(false);
         Intent intent = mAirplaneSafeNetworksSlice.getIntent();
 
@@ -116,13 +111,12 @@
     }
 
     @Test
-    public void onNotifyChange_turnOffAirplaneMode_shouldSetAirplaneModeOff() {
-        mAirplaneModeRule.setAirplaneMode(true);
+    public void onNotifyChange_turnOffNetworks_shouldSetWifiDisabled() {
         when(mWifiManager.isWifiEnabled()).thenReturn(true);
         Intent intent = mAirplaneSafeNetworksSlice.getIntent();
 
         mAirplaneSafeNetworksSlice.onNotifyChange(intent);
 
-        assertThat(mAirplaneModeRule.isAirplaneModeOn()).isFalse();
+        verify(mWifiManager).setWifiEnabled(false);
     }
 }
diff --git a/tests/unit/src/com/android/settings/network/NetworkProviderCallsSmsControllerTest.java b/tests/unit/src/com/android/settings/network/NetworkProviderCallsSmsControllerTest.java
index 8444f11..16433c3 100644
--- a/tests/unit/src/com/android/settings/network/NetworkProviderCallsSmsControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/NetworkProviderCallsSmsControllerTest.java
@@ -17,9 +17,13 @@
 package com.android.settings.network;
 
 import static androidx.lifecycle.Lifecycle.Event;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
 
 import android.content.Context;
 import android.os.Looper;
@@ -27,19 +31,17 @@
 import android.telephony.SubscriptionManager;
 import android.text.TextUtils;
 
-import com.android.settings.testutils.ResourcesUtils;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-import com.android.settingslib.RestrictedPreference;
-
 import androidx.lifecycle.LifecycleOwner;
 import androidx.lifecycle.LifecycleRegistry;
-import androidx.preference.PreferenceCategory;
 import androidx.preference.PreferenceManager;
 import androidx.preference.PreferenceScreen;
 import androidx.test.annotation.UiThreadTest;
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
-import androidx.test.InstrumentationRegistry;
+
+import com.android.settings.testutils.ResourcesUtils;
+import com.android.settingslib.RestrictedPreference;
+import com.android.settingslib.core.lifecycle.Lifecycle;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -50,9 +52,6 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
 
 @RunWith(AndroidJUnit4.class)
 public class NetworkProviderCallsSmsControllerTest {
@@ -156,6 +155,7 @@
     @UiThreadTest
     public void getSummary_noSim_returnNoSim() {
         when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(new ArrayList<>());
+        when(mSubscriptionManager.getAvailableSubscriptionInfoList()).thenReturn(new ArrayList<>());
         displayPreferenceWithLifecycle();
 
         assertTrue(TextUtils.equals(mController.getSummary(),
@@ -169,6 +169,8 @@
                 mSubscriptionInfo1);
         when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(
                 Arrays.asList(mSubscriptionInfo1));
+        when(mSubscriptionManager.getAvailableSubscriptionInfoList()).thenReturn(
+                Arrays.asList(mSubscriptionInfo1));
         displayPreferenceWithLifecycle();
 
         final StringBuilder summary = new StringBuilder();
@@ -188,6 +190,8 @@
         setupSubscriptionInfoList(SUB_ID_2, DISPLAY_NAME_2, mSubscriptionInfo2);
         when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(
                 Arrays.asList(mSubscriptionInfo1, mSubscriptionInfo2));
+        when(mSubscriptionManager.getAvailableSubscriptionInfoList()).thenReturn(
+                Arrays.asList(mSubscriptionInfo1, mSubscriptionInfo2));
         displayPreferenceWithLifecycle();
 
         final StringBuilder summary = new StringBuilder();
@@ -209,6 +213,8 @@
         setupSubscriptionInfoList(SUB_ID_1, DISPLAY_NAME_1, mSubscriptionInfo1);
         when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(
                 Arrays.asList(mSubscriptionInfo1));
+        when(mSubscriptionManager.getAvailableSubscriptionInfoList()).thenReturn(
+                Arrays.asList(mSubscriptionInfo1));
         displayPreferenceWithLifecycle();
 
         assertThat(mPreference.getSummary()).isEqualTo(DISPLAY_NAME_1);
@@ -221,6 +227,8 @@
         setupSubscriptionInfoList(SUB_ID_2, DISPLAY_NAME_2, mSubscriptionInfo2);
         when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(
                 Arrays.asList(mSubscriptionInfo1, mSubscriptionInfo2));
+        when(mSubscriptionManager.getAvailableSubscriptionInfoList()).thenReturn(
+                Arrays.asList(mSubscriptionInfo1, mSubscriptionInfo2));
         displayPreferenceWithLifecycle();
 
         final StringBuilder summary = new StringBuilder();
@@ -240,6 +248,8 @@
         setupSubscriptionInfoList(SUB_ID_2, DISPLAY_NAME_2, mSubscriptionInfo2);
         when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(
                 Arrays.asList(mSubscriptionInfo1, mSubscriptionInfo2));
+        when(mSubscriptionManager.getAvailableSubscriptionInfoList()).thenReturn(
+                Arrays.asList(mSubscriptionInfo1, mSubscriptionInfo2));
         displayPreferenceWithLifecycle();
 
         final StringBuilder summary = new StringBuilder();
@@ -267,6 +277,8 @@
         setupSubscriptionInfoList(SUB_ID_2, DISPLAY_NAME_2, mSubscriptionInfo2);
         when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(
                 Arrays.asList(mSubscriptionInfo1, mSubscriptionInfo2));
+        when(mSubscriptionManager.getAvailableSubscriptionInfoList()).thenReturn(
+                Arrays.asList(mSubscriptionInfo1, mSubscriptionInfo2));
         displayPreferenceWithLifecycle();
 
         final StringBuilder summary = new StringBuilder();
@@ -294,6 +306,8 @@
         setupSubscriptionInfoList(SUB_ID_2, DISPLAY_NAME_2, mSubscriptionInfo2);
         when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(
                 Arrays.asList(mSubscriptionInfo1, mSubscriptionInfo2));
+        when(mSubscriptionManager.getAvailableSubscriptionInfoList()).thenReturn(
+                Arrays.asList(mSubscriptionInfo1, mSubscriptionInfo2));
         displayPreferenceWithLifecycle();
 
         final StringBuilder summary = new StringBuilder();
diff --git a/tests/unit/src/com/android/settings/network/ProviderModelSliceHelperTest.java b/tests/unit/src/com/android/settings/network/ProviderModelSliceHelperTest.java
index bee48d1..72e9be4 100644
--- a/tests/unit/src/com/android/settings/network/ProviderModelSliceHelperTest.java
+++ b/tests/unit/src/com/android/settings/network/ProviderModelSliceHelperTest.java
@@ -177,7 +177,7 @@
         when(mDefaultDataSubscriptionInfo.getDisplayName()).thenReturn(expectDisplayName);
         when(mSubscriptionManager.getActiveSubscriptionInfo(defaultDataSubId)).thenReturn(
                 mDefaultDataSubscriptionInfo);
-        when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(
+        when(mSubscriptionManager.getAvailableSubscriptionInfoList()).thenReturn(
                 Arrays.asList(mDefaultDataSubscriptionInfo));
 
         when(mServiceState.getState()).thenReturn(ServiceState.STATE_IN_SERVICE);
@@ -207,7 +207,7 @@
         when(mDefaultDataSubscriptionInfo.getDisplayName()).thenReturn(expectDisplayName);
         when(mSubscriptionManager.getActiveSubscriptionInfo(defaultDataSubId)).thenReturn(
                 mDefaultDataSubscriptionInfo);
-        when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(
+        when(mSubscriptionManager.getAvailableSubscriptionInfoList()).thenReturn(
                 Arrays.asList(mDefaultDataSubscriptionInfo));
         when(mServiceState.getState()).thenReturn(ServiceState.STATE_IN_SERVICE);
         mBundle.putBoolean(CarrierConfigManager.KEY_INFLATE_SIGNAL_STRENGTH_BOOL, false);
diff --git a/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java b/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java
index 9f70bcf..476d854 100644
--- a/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java
+++ b/tests/unit/src/com/android/settings/network/ProviderModelSliceTest.java
@@ -16,8 +16,6 @@
 
 package com.android.settings.network;
 
-import static android.app.slice.Slice.EXTRA_TOGGLE_STATE;
-
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.any;
@@ -25,6 +23,7 @@
 import static org.mockito.ArgumentMatchers.anyLong;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
@@ -132,7 +131,8 @@
         SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
         mMockNetworkProviderWorker = spy(new MockNetworkProviderWorker(mContext,
                 PROVIDER_MODEL_SLICE_URI));
-        mMockProviderModelSlice = new MockProviderModelSlice(mContext, mMockNetworkProviderWorker);
+        mMockProviderModelSlice = spy(new MockProviderModelSlice(
+                mContext, mMockNetworkProviderWorker));
         mListBuilder = spy(new ListBuilder(mContext, PROVIDER_MODEL_SLICE_URI,
                 ListBuilder.INFINITY).setAccentColor(-1));
         when(mProviderModelSliceHelper.createListBuilder(PROVIDER_MODEL_SLICE_URI)).thenReturn(
@@ -386,32 +386,34 @@
     }
 
     @Test
-    public void onNotifyChange_intentToggleActionOn_shouldSetCarrierNetworkEnabledTrue() {
-        Intent intent = mMockProviderModelSlice.getBroadcastIntent(mContext).getIntent();
-        intent.putExtra(EXTRA_TOGGLE_STATE, true);
-
-        mMockProviderModelSlice.onNotifyChange(intent);
+    public void doCarrierNetworkAction_toggleActionSetDataEnabled_setCarrierNetworkEnabledTrue() {
+        mMockProviderModelSlice.doCarrierNetworkAction(true /* isToggleAction */,
+                true /* isDataEnabled */);
 
         verify(mMockNetworkProviderWorker).setCarrierNetworkEnabled(true);
     }
 
     @Test
-    public void onNotifyChange_intentToggleActionOff_shouldSetCarrierNetworkEnabledFalse() {
-        Intent intent = mMockProviderModelSlice.getBroadcastIntent(mContext).getIntent();
-        intent.putExtra(EXTRA_TOGGLE_STATE, false);
-
-        mMockProviderModelSlice.onNotifyChange(intent);
+    public void doCarrierNetworkAction_toggleActionSetDataDisabled_setCarrierNetworkEnabledFalse() {
+        mMockProviderModelSlice.doCarrierNetworkAction(true /* isToggleAction */,
+                false /* isDataEnabled */);
 
         verify(mMockNetworkProviderWorker).setCarrierNetworkEnabled(false);
     }
 
     @Test
-    public void onNotifyChange_intentPrimaryAction_shouldConnectCarrierNetwork() {
-        when(mTelephonyManager.isDataEnabled()).thenReturn(true);
-        Intent intent = mMockProviderModelSlice.getBroadcastIntent(mContext).getIntent();
-
-        mMockProviderModelSlice.onNotifyChange(intent);
+    public void doCarrierNetworkAction_primaryActionAndDataEnabled_connectCarrierNetwork() {
+        mMockProviderModelSlice.doCarrierNetworkAction(false /* isToggleAction */,
+                true /* isDataEnabled */);
 
         verify(mMockNetworkProviderWorker).connectCarrierNetwork();
     }
+
+    @Test
+    public void doCarrierNetworkAction_primaryActionAndDataDisabled_notConnectCarrierNetwork() {
+        mMockProviderModelSlice.doCarrierNetworkAction(false /* isToggleAction */,
+                false /* isDataEnabled */);
+
+        verify(mMockNetworkProviderWorker, never()).connectCarrierNetwork();
+    }
 }
diff --git a/tests/unit/src/com/android/settings/network/SubscriptionUtilTest.java b/tests/unit/src/com/android/settings/network/SubscriptionUtilTest.java
index 8c99b40..c0e5205 100644
--- a/tests/unit/src/com/android/settings/network/SubscriptionUtilTest.java
+++ b/tests/unit/src/com/android/settings/network/SubscriptionUtilTest.java
@@ -48,7 +48,7 @@
     private static final int SUBID_1 = 1;
     private static final int SUBID_2 = 2;
     private static final int SUBID_3 = 3;
-    private static final CharSequence CARRIER_1 = "carrier1";
+    private static final CharSequence CARRIER_1 = "carrier1111111";
     private static final CharSequence CARRIER_2 = "carrier2";
 
     private Context mContext;
@@ -94,6 +94,8 @@
         final SubscriptionInfo info2 = mock(SubscriptionInfo.class);
         when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info1, info2));
 
+        // // TODO remove this line.
+        // when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info1, info2));
         final List<SubscriptionInfo> subs = SubscriptionUtil.getAvailableSubscriptions(mContext);
 
         assertThat(subs).isNotNull();
@@ -143,8 +145,9 @@
         when(info2.getSubscriptionId()).thenReturn(SUBID_2);
         when(info1.getDisplayName()).thenReturn(CARRIER_1);
         when(info2.getDisplayName()).thenReturn(CARRIER_2);
-        when(mSubMgr.getActiveSubscriptionInfoList()).thenReturn(
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(
                 Arrays.asList(info1, info2));
+            // Arrays.asList(info2));
 
         // Each subscription has a unique last 4 digits of the phone number.
         TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
@@ -172,7 +175,7 @@
         when(info2.getSubscriptionId()).thenReturn(SUBID_2);
         when(info1.getDisplayName()).thenReturn(CARRIER_1);
         when(info2.getDisplayName()).thenReturn(CARRIER_1);
-        when(mSubMgr.getActiveSubscriptionInfoList()).thenReturn(
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(
                 Arrays.asList(info1, info2));
 
         // Each subscription has a unique last 4 digits of the phone number.
@@ -201,8 +204,7 @@
         when(info2.getSubscriptionId()).thenReturn(SUBID_2);
         when(info1.getDisplayName()).thenReturn(CARRIER_1);
         when(info2.getDisplayName()).thenReturn(CARRIER_1);
-        when(mSubMgr.getActiveSubscriptionInfoList()).thenReturn(
-                Arrays.asList(info1, info2));
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info1, info2));
 
         // The subscriptions' phone numbers cannot be revealed to the user.
         TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
@@ -234,7 +236,7 @@
         when(info1.getDisplayName()).thenReturn(CARRIER_1);
         when(info2.getDisplayName()).thenReturn(CARRIER_1);
         when(info3.getDisplayName()).thenReturn(CARRIER_1);
-        when(mSubMgr.getActiveSubscriptionInfoList()).thenReturn(
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(
                 Arrays.asList(info1, info2, info3));
 
         // Subscription 1 has a unique phone number, but subscriptions 2 and 3 share the same
@@ -265,8 +267,7 @@
         final SubscriptionInfo info1 = mock(SubscriptionInfo.class);
         when(info1.getSubscriptionId()).thenReturn(SUBID_1);
         when(info1.getDisplayName()).thenReturn(CARRIER_1);
-        when(mSubMgr.getActiveSubscriptionInfoList()).thenReturn(
-                Arrays.asList(info1));
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info1));
 
         TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
         when(sub1Telmgr.getLine1Number()).thenReturn("1112223333");
@@ -288,8 +289,7 @@
         when(info2.getSubscriptionId()).thenReturn(SUBID_2);
         when(info1.getDisplayName()).thenReturn(CARRIER_1);
         when(info2.getDisplayName()).thenReturn(CARRIER_1);
-        when(mSubMgr.getActiveSubscriptionInfoList()).thenReturn(
-                Arrays.asList(info1, info2));
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info1, info2));
 
         // Each subscription has a unique last 4 digits of the phone number.
         TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
@@ -318,8 +318,7 @@
         when(info2.getSubscriptionId()).thenReturn(SUBID_2);
         when(info1.getDisplayName()).thenReturn(CARRIER_1);
         when(info2.getDisplayName()).thenReturn(CARRIER_1);
-        when(mSubMgr.getActiveSubscriptionInfoList()).thenReturn(
-                Arrays.asList(info1, info2));
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info1, info2));
 
         // Both subscriptions have a the same 4 digits of the phone number.
         TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
@@ -345,8 +344,7 @@
         final SubscriptionInfo info1 = mock(SubscriptionInfo.class);
         when(info1.getSubscriptionId()).thenReturn(SUBID_1);
         when(info1.getDisplayName()).thenReturn(CARRIER_1);
-        when(mSubMgr.getActiveSubscriptionInfoList()).thenReturn(
-                Arrays.asList(info1));
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info1));
 
         TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
         when(sub1Telmgr.getLine1Number()).thenReturn("1112223333");
@@ -366,8 +364,7 @@
         final SubscriptionInfo info1 = mock(SubscriptionInfo.class);
         when(info1.getSubscriptionId()).thenReturn(SUBID_1);
         when(info1.getDisplayName()).thenReturn(CARRIER_1);
-        when(mSubMgr.getActiveSubscriptionInfoList()).thenReturn(
-                Arrays.asList(info1));
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info1));
 
         TelephonyManager sub1Telmgr = mock(TelephonyManager.class);
         when(sub1Telmgr.getLine1Number()).thenReturn("1112223333");
diff --git a/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java
index f3e084c..ef3f130 100644
--- a/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java
@@ -272,6 +272,7 @@
     @UiThreadTest
     public void onSubscriptionsChanged_subscriptionReplaced_preferencesChanged() {
         final List<SubscriptionInfo> subs = setupMockSubscriptions(3);
+        doReturn(subs).when(mSubscriptionManager).getAvailableSubscriptionInfoList();
 
         // Start out with only sub1 and sub2.
         SubscriptionUtil.setActiveSubscriptionsForTesting(subs.subList(0, 2));
@@ -388,6 +389,7 @@
         final List<SubscriptionInfo> sub = setupMockSubscriptions(1);
         doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
+        doReturn(sub).when(mSubscriptionManager).getAvailableSubscriptionInfoList();
 
         mController.onResume();
         mController.displayPreference(mPreferenceScreen);
@@ -402,6 +404,7 @@
         final List<SubscriptionInfo> sub = setupMockSubscriptions(2);
         doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
+        doReturn(sub).when(mSubscriptionManager).getAvailableSubscriptionInfoList();
 
         mController.onResume();
         mController.displayPreference(mPreferenceScreen);
@@ -530,6 +533,7 @@
         final List<SubscriptionInfo> sub = setupMockSubscriptions(2);
         doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
+        doReturn(sub).when(mSubscriptionManager).getAvailableSubscriptionInfoList();
         Intent intent = new Intent(TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED);
 
         mController.onResume();
@@ -548,6 +552,7 @@
         final int subId = sub.get(0).getSubscriptionId();
         doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
+        doReturn(sub).when(mSubscriptionManager).getAvailableSubscriptionInfoList();
         Intent intent = new Intent(TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED);
 
         mController.onResume();
diff --git a/tests/unit/src/com/android/settings/network/telephony/DefaultSubscriptionControllerTest.java b/tests/unit/src/com/android/settings/network/telephony/DefaultSubscriptionControllerTest.java
index 282704d..93621d9 100644
--- a/tests/unit/src/com/android/settings/network/telephony/DefaultSubscriptionControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/telephony/DefaultSubscriptionControllerTest.java
@@ -54,7 +54,7 @@
 @RunWith(AndroidJUnit4.class)
 public class DefaultSubscriptionControllerTest {
     @Mock
-    private SubscriptionManager mManager;
+    private SubscriptionManager mSubMgr;
     @Mock
     private TelecomManager mTelecomManager;
 
@@ -68,7 +68,7 @@
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mContext = spy(ApplicationProvider.getApplicationContext());
-        when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mManager);
+        when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubMgr);
         when(mContext.getSystemService(TelecomManager.class)).thenReturn(mTelecomManager);
 
         final String key = "prefkey";
@@ -123,6 +123,7 @@
         final SubscriptionInfo sub1 = createMockSub(111, "sub1");
         final SubscriptionInfo sub2 = createMockSub(222, "sub2");
         SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(sub1, sub2));
         mController.setDefaultSubscription(sub1.getSubscriptionId());
 
         mController.displayPreference(mScreen);
@@ -152,6 +153,7 @@
         final SubscriptionInfo sub1 = createMockSub(111, "sub1");
         final SubscriptionInfo sub2 = createMockSub(222, "sub2");
         SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(sub1, sub2));
         mController.setDefaultSubscription(sub2.getSubscriptionId());
 
         mController.displayPreference(mScreen);
@@ -186,6 +188,8 @@
         when(sub2.isOpportunistic()).thenReturn(true);
 
         SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1, sub2, sub3));
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(
+                Arrays.asList(sub1, sub2, sub3));
         mController.setDefaultSubscription(sub1.getSubscriptionId());
 
         mController.displayPreference(mScreen);
@@ -240,6 +244,7 @@
 
         // Start with only one sub active, so the pref is not available
         SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1));
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(sub1));
         mController.setDefaultSubscription(sub1.getSubscriptionId());
 
         mController.displayPreference(mScreen);
@@ -261,6 +266,7 @@
         final SubscriptionInfo sub1 = createMockSub(111, "sub1");
         final SubscriptionInfo sub2 = createMockSub(222, "sub2");
         SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(sub1, sub2));
         mController.setDefaultSubscription(sub1.getSubscriptionId());
 
         mController.displayPreference(mScreen);
@@ -296,6 +302,7 @@
         final SubscriptionInfo sub1 = createMockSub(111, "sub1");
         final SubscriptionInfo sub2 = createMockSub(222, "sub2");
         SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1));
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(sub1));
         mController.setDefaultSubscription(sub1.getSubscriptionId());
 
         mController.displayPreference(mScreen);
@@ -303,6 +310,7 @@
         assertThat(mListPreference.isVisible()).isFalse();
 
         SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(sub1, sub2));
         mController.onSubscriptionsChanged();
 
         assertThat(mController.isAvailable()).isTrue();
@@ -315,12 +323,15 @@
         final SubscriptionInfo sub2 = createMockSub(222, "sub2");
         final SubscriptionInfo sub3 = createMockSub(333, "sub3");
         SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(sub1, sub2));
         mController.setDefaultSubscription(sub1.getSubscriptionId());
 
         mController.displayPreference(mScreen);
         assertThat(mListPreference.getEntries().length).isEqualTo(3);
 
         SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(sub1, sub2, sub3));
+        when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(
+                Arrays.asList(sub1, sub2, sub3));
         mController.onSubscriptionsChanged();
 
         assertThat(mController.isAvailable()).isTrue();
diff --git a/tests/unit/src/com/android/settings/network/telephony/MmsMessagePreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/telephony/MmsMessagePreferenceControllerTest.java
index 67f5f1a..a0219a0 100644
--- a/tests/unit/src/com/android/settings/network/telephony/MmsMessagePreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/telephony/MmsMessagePreferenceControllerTest.java
@@ -111,11 +111,11 @@
     @Test
     public void setChecked_setDataIntoSubscriptionManager() {
         mController.setChecked(true);
-        verify(mTelephonyManager).setMobileDataPolicyEnabledStatus(
+        verify(mTelephonyManager).setMobileDataPolicyEnabled(
                 TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED, true);
 
         mController.setChecked(false);
-        verify(mTelephonyManager).setMobileDataPolicyEnabledStatus(
+        verify(mTelephonyManager).setMobileDataPolicyEnabled(
                 TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED, false);
     }
 }
diff --git a/tests/unit/src/com/android/settings/network/telephony/NetworkProviderWifiCallingGroupTest.java b/tests/unit/src/com/android/settings/network/telephony/NetworkProviderWifiCallingGroupTest.java
index ed6f161..660772e 100644
--- a/tests/unit/src/com/android/settings/network/telephony/NetworkProviderWifiCallingGroupTest.java
+++ b/tests/unit/src/com/android/settings/network/telephony/NetworkProviderWifiCallingGroupTest.java
@@ -39,15 +39,15 @@
 import android.telephony.TelephonyManager;
 import android.util.FeatureFlagUtils;
 
-import com.android.settings.network.ims.MockWfcQueryImsState;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-
 import androidx.preference.PreferenceCategory;
 import androidx.preference.PreferenceManager;
 import androidx.preference.PreferenceScreen;
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 
+import com.android.settings.network.ims.MockWfcQueryImsState;
+import com.android.settingslib.core.lifecycle.Lifecycle;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -132,10 +132,8 @@
 
     @Test
     public void shouldShowWifiCallingForSub_invalidSubId_returnFalse() {
-        when(mSubscriptionManager.getActiveSubscriptionInfo(SUB_ID)).thenReturn(null);
-
-        assertThat(mNetworkProviderWifiCallingGroup.shouldShowWifiCallingForSub(SUB_ID))
-                .isEqualTo(false);
+        assertThat(mNetworkProviderWifiCallingGroup.shouldShowWifiCallingForSub(
+                SubscriptionManager.INVALID_SUBSCRIPTION_ID)).isEqualTo(false);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/network/telephony/WifiCallingPreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/telephony/WifiCallingPreferenceControllerTest.java
similarity index 74%
rename from tests/robotests/src/com/android/settings/network/telephony/WifiCallingPreferenceControllerTest.java
rename to tests/unit/src/com/android/settings/network/telephony/WifiCallingPreferenceControllerTest.java
index dbfd3b2..5827516 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/WifiCallingPreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/telephony/WifiCallingPreferenceControllerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 The Android Open Source Project
+ * 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.
@@ -19,8 +19,6 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.junit.Assert.assertNull;
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.when;
 
@@ -35,11 +33,16 @@
 import android.telephony.ims.ImsMmTelManager;
 
 import androidx.preference.Preference;
+import androidx.preference.PreferenceManager;
 import androidx.preference.PreferenceScreen;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.core.app.ApplicationProvider;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
 
 import com.android.internal.R;
 import com.android.settings.core.BasePreferenceController;
 import com.android.settings.network.ims.MockWifiCallingQueryImsState;
+import com.android.settings.network.ims.WifiCallingQueryImsState;
 
 import org.junit.Before;
 import org.junit.Ignore;
@@ -47,62 +50,57 @@
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
 
-@RunWith(RobolectricTestRunner.class)
+@RunWith(AndroidJUnit4.class)
 public class WifiCallingPreferenceControllerTest {
     private static final int SUB_ID = 2;
-
+    @Mock
+    private SubscriptionManager mSubscriptionManager;
     @Mock
     private CarrierConfigManager mCarrierConfigManager;
     @Mock
     private TelephonyManager mTelephonyManager;
     @Mock
     private ImsMmTelManager mImsMmTelManager;
-    @Mock
-    private PreferenceScreen mPreferenceScreen;
+
+    private PreferenceScreen mScreen;
+    private PreferenceManager mPreferenceManager;
 
     private MockWifiCallingQueryImsState mQueryImsState;
 
-    private WifiCallingPreferenceController mController;
+    private TestWifiCallingPreferenceController mController;
     private Preference mPreference;
     private Context mContext;
     private PersistableBundle mCarrierConfig;
 
     @Before
+    @UiThreadTest
     public void setUp() {
         MockitoAnnotations.initMocks(this);
 
-        mContext = spy(RuntimeEnvironment.application);
+        mContext = spy(ApplicationProvider.getApplicationContext());
+        when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
 
         mQueryImsState = new MockWifiCallingQueryImsState(mContext, SUB_ID);
         mQueryImsState.setIsEnabledByUser(true);
         mQueryImsState.setIsProvisionedOnDevice(true);
 
-        mPreference = new Preference(mContext);
-        mController = spy(new WifiCallingPreferenceController(mContext, "wifi_calling") {
-            @Override
-            protected ImsMmTelManager getImsMmTelManager(int subId) {
-                return mImsMmTelManager;
-            }
-        });
+        mController = new TestWifiCallingPreferenceController(mContext, "wifi_calling");
         mController.mCarrierConfigManager = mCarrierConfigManager;
         mController.init(SUB_ID);
         mController.mCallState = TelephonyManager.CALL_STATE_IDLE;
-        doReturn(mQueryImsState).when(mController).queryImsState(anyInt());
-        mPreference.setKey(mController.getPreferenceKey());
-
-        when(mController.getTelephonyManager(mContext, SUB_ID)).thenReturn(mTelephonyManager);
-
         mCarrierConfig = new PersistableBundle();
         when(mCarrierConfigManager.getConfigForSubId(SUB_ID)).thenReturn(mCarrierConfig);
 
-        when(mPreferenceScreen.findPreference(mController.getPreferenceKey())).thenReturn(
-                mPreference);
+        mPreferenceManager = new PreferenceManager(mContext);
+        mScreen = mPreferenceManager.createPreferenceScreen(mContext);
+        mPreference = new Preference(mContext);
+        mPreference.setKey(mController.getPreferenceKey());
+        mScreen.addPreference(mPreference);
     }
 
     @Test
+    @UiThreadTest
     public void updateState_noSimCallManager_setCorrectSummary() {
         mController.mSimCallManager = null;
         mQueryImsState.setIsEnabledByUser(true);
@@ -118,6 +116,7 @@
     }
 
     @Test
+    @UiThreadTest
     public void updateState_notCallIdle_disable() {
         mController.mCallState = TelephonyManager.CALL_STATE_RINGING;
 
@@ -127,6 +126,7 @@
     }
 
     @Test
+    @UiThreadTest
     public void updateState_invalidPhoneAccountHandle_shouldNotCrash() {
         mController.mSimCallManager = new PhoneAccountHandle(null /* invalid */, "");
 
@@ -135,6 +135,7 @@
     }
 
     @Test
+    @UiThreadTest
     public void updateState_wfcNonRoamingByConfig() {
         assertNull(mController.mSimCallManager);
         mCarrierConfig.putBoolean(
@@ -154,6 +155,7 @@
     }
 
     @Test
+    @UiThreadTest
     public void updateState_wfcRoamingByConfig() {
         assertNull(mController.mSimCallManager);
         // useWfcHomeModeForRoaming is false by default. In order to check wfc in roaming mode. We
@@ -171,12 +173,15 @@
     }
 
     @Test
+    @UiThreadTest
     public void displayPreference_notAvailable_setPreferenceInvisible() {
         mController.init(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
+        when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(null);
 
-        mController.displayPreference(mPreferenceScreen);
+        mController.displayPreference(mScreen);
 
-        assertThat(mPreferenceScreen.isVisible()).isFalse();
+        assertThat(mController.getPreferenceKey()).isEqualTo("wifi_calling");
+        assertThat(mScreen.findPreference(mController.getPreferenceKey()).isVisible()).isFalse();
     }
 
     @Test
@@ -184,16 +189,39 @@
     public void displayPreference_available_setsSubscriptionIdOnIntent() {
         final Intent intent = new Intent();
         mPreference.setIntent(intent);
-        mController.displayPreference(mPreferenceScreen);
+        mController.displayPreference(mScreen);
         assertThat(intent.getIntExtra(Settings.EXTRA_SUB_ID,
                 SubscriptionManager.INVALID_SUBSCRIPTION_ID)).isEqualTo(SUB_ID);
     }
 
     @Test
+    @UiThreadTest
     public void getAvailabilityStatus_noWiFiCalling_shouldReturnUnsupported() {
         mController.init(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
+        when(mSubscriptionManager.getActiveSubscriptionInfoList()).thenReturn(null);
 
         assertThat(mController.getAvailabilityStatus()).isEqualTo(
                 BasePreferenceController.UNSUPPORTED_ON_DEVICE);
     }
+
+    private class TestWifiCallingPreferenceController extends WifiCallingPreferenceController {
+        TestWifiCallingPreferenceController(Context context, String preferenceKey) {
+            super(context, preferenceKey);
+        }
+
+        @Override
+        protected ImsMmTelManager getImsMmTelManager(int subId) {
+            return mImsMmTelManager;
+        }
+
+        @Override
+        protected TelephonyManager getTelephonyManager(Context context, int subId) {
+            return mTelephonyManager;
+        }
+
+        @Override
+        protected WifiCallingQueryImsState queryImsState(int subId) {
+            return mQueryImsState;
+        }
+    }
 }
diff --git a/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java b/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java
index e8f694b..a4d4ad1 100644
--- a/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java
+++ b/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java
@@ -18,6 +18,9 @@
 
 import static com.android.settings.network.InternetUpdater.INTERNET_APM;
 import static com.android.settings.network.InternetUpdater.INTERNET_APM_NETWORKS;
+import static com.android.settings.network.InternetUpdater.INTERNET_CELLULAR;
+import static com.android.settings.network.InternetUpdater.INTERNET_ETHERNET;
+import static com.android.settings.network.InternetUpdater.INTERNET_WIFI;
 
 import static com.google.common.truth.Truth.assertThat;
 
@@ -26,10 +29,13 @@
 import static org.mockito.Mockito.verify;
 
 import android.content.Context;
+import android.net.Uri;
 
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 
+import com.android.settings.network.AirplaneModePreferenceController;
+import com.android.settings.slices.CustomSliceRegistry;
 import com.android.settings.testutils.ResourcesUtils;
 
 import org.junit.Before;
@@ -40,6 +46,8 @@
 import org.mockito.junit.MockitoJUnit;
 import org.mockito.junit.MockitoRule;
 
+import java.util.List;
+
 @RunWith(AndroidJUnit4.class)
 public class InternetConnectivityPanelTest {
 
@@ -47,6 +55,10 @@
             ApplicationProvider.getApplicationContext(), "provider_internet_settings");
     public static final String TITLE_APM_NETWORKS = ResourcesUtils.getResourcesString(
             ApplicationProvider.getApplicationContext(), "airplane_mode_network_panel_title");
+    public static final String SUBTITLE_APM_IS_ON = ResourcesUtils.getResourcesString(
+            ApplicationProvider.getApplicationContext(), "condition_airplane_title");
+    public static final String BUTTON_SETTINGS = ResourcesUtils.getResourcesString(
+            ApplicationProvider.getApplicationContext(), "settings_button");
 
     @Rule
     public final MockitoRule mMocks = MockitoJUnit.rule();
@@ -66,30 +78,147 @@
     }
 
     @Test
-    public void getTitle_internetTypeChangedFromApmToApmNetworks_verifyTitleChanged() {
+    public void getTitle_internetApmNetworks_shouldBeApmNetworks() {
+        mPanel.onInternetTypeChanged(INTERNET_APM_NETWORKS);
+
+        assertThat(mPanel.getTitle()).isEqualTo(TITLE_APM_NETWORKS);
+    }
+
+    @Test
+    public void getTitle_notInternetApmNetworks_shouldBeInternet() {
         mPanel.onInternetTypeChanged(INTERNET_APM);
 
         assertThat(mPanel.getTitle()).isEqualTo(TITLE_INTERNET);
 
+        mPanel.onInternetTypeChanged(INTERNET_WIFI);
+
+        assertThat(mPanel.getTitle()).isEqualTo(TITLE_INTERNET);
+
+        mPanel.onInternetTypeChanged(INTERNET_CELLULAR);
+
+        assertThat(mPanel.getTitle()).isEqualTo(TITLE_INTERNET);
+
+        mPanel.onInternetTypeChanged(INTERNET_ETHERNET);
+
+        assertThat(mPanel.getTitle()).isEqualTo(TITLE_INTERNET);
+    }
+
+    @Test
+    public void getSubTitle_internetApm_shouldBeApmIsOn() {
+        mPanel.onInternetTypeChanged(INTERNET_APM);
+
+        assertThat(mPanel.getSubTitle()).isEqualTo(SUBTITLE_APM_IS_ON);
+    }
+
+    @Test
+    public void getSubTitle_notinternetApm_shouldBeNull() {
+        mPanel.onInternetTypeChanged(INTERNET_APM_NETWORKS);
+
+        assertThat(mPanel.getSubTitle()).isNull();
+
+        mPanel.onInternetTypeChanged(INTERNET_WIFI);
+
+        assertThat(mPanel.getSubTitle()).isNull();
+
+        mPanel.onInternetTypeChanged(INTERNET_CELLULAR);
+
+        assertThat(mPanel.getSubTitle()).isNull();
+
+        mPanel.onInternetTypeChanged(INTERNET_ETHERNET);
+
+        assertThat(mPanel.getSubTitle()).isNull();
+    }
+
+    @Test
+    public void getCustomizedButtonTitle_internetApm_shouldBeNull() {
+        mPanel.onInternetTypeChanged(INTERNET_APM);
+
+        assertThat(mPanel.getCustomizedButtonTitle()).isNull();
+    }
+
+    @Test
+    public void getCustomizedButtonTitle_notInternetApm_shouldBeSettings() {
+        mPanel.onInternetTypeChanged(INTERNET_APM_NETWORKS);
+
+        assertThat(mPanel.getCustomizedButtonTitle()).isEqualTo(BUTTON_SETTINGS);
+
+        mPanel.onInternetTypeChanged(INTERNET_WIFI);
+
+        assertThat(mPanel.getCustomizedButtonTitle()).isEqualTo(BUTTON_SETTINGS);
+
+        mPanel.onInternetTypeChanged(INTERNET_CELLULAR);
+
+        assertThat(mPanel.getCustomizedButtonTitle()).isEqualTo(BUTTON_SETTINGS);
+
+        mPanel.onInternetTypeChanged(INTERNET_ETHERNET);
+
+        assertThat(mPanel.getCustomizedButtonTitle()).isEqualTo(BUTTON_SETTINGS);
+    }
+
+    @Test
+    public void getSlices_providerModelDisabled_containsNecessarySlices() {
+        mPanel.mIsProviderModelEnabled = false;
+        final List<Uri> uris = mPanel.getSlices();
+
+        assertThat(uris).containsExactly(
+                AirplaneModePreferenceController.SLICE_URI,
+                CustomSliceRegistry.MOBILE_DATA_SLICE_URI,
+                CustomSliceRegistry.WIFI_SLICE_URI);
+    }
+
+    @Test
+    public void getSlices_providerModelEnabled_containsNecessarySlices() {
+        final List<Uri> uris = mPanel.getSlices();
+
+        assertThat(uris).containsExactly(
+                CustomSliceRegistry.PROVIDER_MODEL_SLICE_URI,
+                CustomSliceRegistry.AIRPLANE_SAFE_NETWORKS_SLICE_URI);
+    }
+
+    @Test
+    public void getSeeMoreIntent_notNull() {
+        assertThat(mPanel.getSeeMoreIntent()).isNotNull();
+    }
+
+    @Test
+    public void onInternetTypeChanged_internetTypeChangedToApm_changeHeaderAndHideSettings() {
+        mPanel.onInternetTypeChanged(INTERNET_APM_NETWORKS);
+        clearInvocations(mPanelContentCallback);
+
+        mPanel.onInternetTypeChanged(INTERNET_APM);
+
+        verify(mPanelContentCallback).onHeaderChanged();
+        verify(mPanelContentCallback).onCustomizedButtonStateChanged();
+    }
+
+    @Test
+    public void onInternetTypeChanged_internetTypeChangedFomApm_changeTitleAndShowSettings() {
+        mPanel.onInternetTypeChanged(INTERNET_APM);
         clearInvocations(mPanelContentCallback);
 
         mPanel.onInternetTypeChanged(INTERNET_APM_NETWORKS);
 
-        assertThat(mPanel.getTitle()).isEqualTo(TITLE_APM_NETWORKS);
+        verify(mPanelContentCallback).onTitleChanged();
+        verify(mPanelContentCallback).onCustomizedButtonStateChanged();
+    }
+
+    @Test
+    public void onInternetTypeChanged_internetTypeChangedToApmNetworks_changeTitle() {
+        mPanel.onInternetTypeChanged(INTERNET_WIFI);
+        clearInvocations(mPanelContentCallback);
+
+        mPanel.onInternetTypeChanged(INTERNET_APM_NETWORKS);
+
         verify(mPanelContentCallback).onTitleChanged();
     }
 
     @Test
-    public void getTitle_internetTypeChangedFromApmNetworksToApm_verifyTitleChanged() {
+    public void onInternetTypeChanged_internetTypeChangedFromApmNetworks_changeTitle() {
         mPanel.onInternetTypeChanged(INTERNET_APM_NETWORKS);
-
-        assertThat(mPanel.getTitle()).isEqualTo(TITLE_APM_NETWORKS);
-
         clearInvocations(mPanelContentCallback);
 
-        mPanel.onInternetTypeChanged(INTERNET_APM);
+        mPanel.onInternetTypeChanged(INTERNET_WIFI);
 
-        assertThat(mPanel.getTitle()).isEqualTo(TITLE_INTERNET);
         verify(mPanelContentCallback).onTitleChanged();
     }
 }