Merge "Import translations. DO NOT MERGE"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index af690d9..6b9c637 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -191,12 +191,6 @@
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.VOICE_LAUNCH" />
             </intent-filter>
-            <intent-filter>
-                <action android:name="com.android.settings.action.SETTINGS"/>
-            </intent-filter>
-            <meta-data android:name="com.android.settings.order" android:value="11"/>
-            <meta-data android:name="com.android.settings.category"
-                android:value="com.android.settings.category.ia.homepage"/>
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                 android:value="com.android.settings.network.NetworkDashboardFragment"/>
             <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
@@ -213,14 +207,8 @@
                 <action android:name="android.settings.BLUETOOTH_SETTINGS" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
-            <intent-filter>
-                <action android:name="com.android.settings.action.SETTINGS"/>
-            </intent-filter>
-            <meta-data android:name="com.android.settings.order" android:value="10"/>
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                 android:value="com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment"/>
-            <meta-data android:name="com.android.settings.category"
-                android:value="com.android.settings.category.ia.homepage"/>
             <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
                 android:value="true" />
         </activity>
@@ -897,18 +885,10 @@
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.android.settings.SHORTCUT" />
             </intent-filter>
-            <intent-filter>
-                <action android:name="com.android.settings.action.SETTINGS" />
-            </intent-filter>
-            <meta-data android:name="com.android.settings.order" android:value="7"/>
-            <meta-data android:name="com.android.settings.category"
-                android:value="com.android.settings.category.ia.homepage" />
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                 android:value="com.android.settings.DisplaySettings" />
             <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
                 android:value="true" />
-            <meta-data android:name="com.android.settings.summary"
-                android:resource="@string/display_dashboard_summary"/>
         </activity>
 
         <activity
@@ -1262,12 +1242,6 @@
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.VOICE_LAUNCH" />
             </intent-filter>
-            <intent-filter>
-                <action android:name="com.android.settings.action.SETTINGS" />
-            </intent-filter>
-            <meta-data android:name="com.android.settings.order" android:value="4"/>
-            <meta-data android:name="com.android.settings.category"
-                       android:value="com.android.settings.category.ia.homepage" />
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                 android:value="com.android.settings.security.SecuritySettings" />
             <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
@@ -1431,18 +1405,10 @@
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.android.settings.SHORTCUT" />
             </intent-filter>
-            <intent-filter>
-                <action android:name="com.android.settings.action.SETTINGS" />
-            </intent-filter>
-            <meta-data android:name="com.android.settings.order" android:value="2"/>
-            <meta-data android:name="com.android.settings.category"
-                android:value="com.android.settings.category.ia.homepage" />
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                 android:value="com.android.settings.accessibility.AccessibilitySettings" />
             <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
                 android:value="true" />
-            <meta-data android:name="com.android.settings.summary"
-                android:resource="@string/accessibility_settings_summary" />
         </activity>
 
         <activity android:name=".accessibility.AccessibilitySettingsForSetupWizardActivity"
@@ -1772,14 +1738,6 @@
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.android.settings.SHORTCUT" />
             </intent-filter>
-            <intent-filter>
-                <action android:name="com.android.settings.action.SETTINGS" />
-            </intent-filter>
-            <meta-data android:name="com.android.settings.order" android:value="5"/>
-            <meta-data android:name="com.android.settings.category"
-                android:value="com.android.settings.category.ia.homepage" />
-            <meta-data android:name="com.android.settings.title"
-                android:resource="@string/storage_usb_settings" />
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                 android:value="com.android.settings.deviceinfo.StorageSettings" />
             <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
@@ -2171,12 +2129,6 @@
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.android.settings.SHORTCUT" />
             </intent-filter>
-            <intent-filter>
-                <action android:name="com.android.settings.action.SETTINGS" />
-            </intent-filter>
-            <meta-data android:name="com.android.settings.order" android:value="8"/>
-            <meta-data android:name="com.android.settings.category"
-                android:value="com.android.settings.category.ia.homepage" />
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                 android:value="com.android.settings.fuelgauge.PowerUsageSummary" />
         </activity>
@@ -2545,18 +2497,10 @@
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.android.settings.SHORTCUT" />
             </intent-filter>
-            <intent-filter>
-                <action android:name="com.android.settings.action.SETTINGS" />
-            </intent-filter>
-            <meta-data android:name="com.android.settings.order" android:value="6"/>
-            <meta-data android:name="com.android.settings.category"
-                       android:value="com.android.settings.category.ia.homepage" />
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                 android:value="com.android.settings.notification.SoundSettings" />
             <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
                 android:value="true" />
-            <meta-data android:name="com.android.settings.summary"
-                android:resource="@string/sound_dashboard_summary"/>
         </activity>
 
         <!-- Show apps for which application-level notification settings are applicable -->
@@ -2954,13 +2898,8 @@
             <intent-filter>
                 <action android:name="com.android.settings.action.SETTINGS"/>
             </intent-filter>
-            <meta-data android:name="com.android.settings.order" android:value="9"/>
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                        android:value="com.android.settings.applications.AppAndNotificationDashboardFragment"/>
-            <meta-data android:name="com.android.settings.category"
-                       android:value="com.android.settings.category.ia.homepage"/>
-            <meta-data android:name="com.android.settings.summary"
-                       android:resource="@string/app_and_notification_dashboard_summary"/>
         </activity>
 
         <activity
@@ -2969,9 +2908,6 @@
             android:icon="@drawable/ic_homepage_accounts"
             android:taskAffinity="com.android.settings"
             android:parentActivityName="Settings">
-            <intent-filter>
-                <action android:name="com.android.settings.action.SETTINGS"/>
-            </intent-filter>
             <intent-filter android:priority="1">
                 <action android:name="android.settings.SYNC_SETTINGS" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -2980,11 +2916,8 @@
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.android.settings.SHORTCUT" />
             </intent-filter>
-            <meta-data android:name="com.android.settings.order" android:value="3"/>
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                        android:value="com.android.settings.accounts.AccountDashboardFragment"/>
-            <meta-data android:name="com.android.settings.category"
-                       android:value="com.android.settings.category.ia.homepage"/>
             <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
                        android:value="true" />
         </activity>
@@ -2995,20 +2928,12 @@
             android:icon="@drawable/ic_homepage_system_dashboard"
             android:taskAffinity="com.android.settings"
             android:parentActivityName="Settings">
-            <intent-filter>
-                <action android:name="com.android.settings.action.SETTINGS"/>
-            </intent-filter>
             <intent-filter android:priority="70">
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.android.settings.SHORTCUT" />
             </intent-filter>
-            <meta-data android:name="com.android.settings.order" android:value="-1"/>
-            <meta-data android:name="com.android.settings.category"
-                       android:value="com.android.settings.category.ia.homepage"/>
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                        android:value="com.android.settings.system.SystemDashboardFragment"/>
-            <meta-data android:name="com.android.settings.summary"
-                       android:resource="@string/system_dashboard_summary"/>
         </activity>
 
         <activity android:name=".support.SupportDashboardActivity"
@@ -3017,17 +2942,9 @@
                   android:theme="@android:style/Theme.DeviceDefault.Light.Panel"
                   android:enabled="@bool/config_support_enabled">
             <intent-filter>
-                <action android:name="com.android.settings.action.SETTINGS"/>
-            </intent-filter>
-            <intent-filter>
                 <action android:name="com.android.settings.action.SUPPORT_SETTINGS" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
-            <meta-data android:name="com.android.settings.order" android:value="-2"/>
-            <meta-data android:name="com.android.settings.category"
-                       android:value="com.android.settings.category.ia.homepage"/>
-            <meta-data android:name="com.android.settings.summary"
-                       android:resource="@string/support_summary"/>
         </activity>
 
         <service
@@ -3076,6 +2993,7 @@
                 <action android:name="android.service.quicksettings.action.QS_TILE" />
             </intent-filter>
         </service>
+
         <service
             android:name=".development.qstile.DevelopmentTiles$WinscopeTrace"
             android:label="@string/winscope_trace_quick_settings_title"
diff --git a/res/drawable/ic_signal_strength_4g.xml b/res/drawable/ic_signal_strength_4g.xml
new file mode 100644
index 0000000..9062096
--- /dev/null
+++ b/res/drawable/ic_signal_strength_4g.xml
@@ -0,0 +1,28 @@
+<!--
+Copyright (C) 2014 The Android Open Source Project
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="9.208dp"
+    android:height="17dp"
+    android:viewportWidth="13.0"
+    android:viewportHeight="24.0"
+    android:tint="?android:attr/colorControlNormal">
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M4.600000,7.800000l0.700000,0.000000l0.000000,1.300000L4.600000,9.100000L4.600000,11.000000L3.000000,11.000000L3.000000,9.200000L0.100000,9.200000L0.000000,8.100000L3.000000,2.500000l1.700000,0.000000L4.700000,7.800000zM1.600000,7.800000L3.000000,7.800000l0.000000,-3.000000L2.900000,5.000000L1.600000,7.800000z"/>
+    <path
+        android:fillColor="#FFFFFFFF"
+        android:pathData="M11.900000,9.900000c-0.200000,0.400000 -0.600000,0.700000 -1.000000,0.900000s-1.000000,0.400000 -1.800000,0.400000c-0.900000,0.000000 -1.700000,-0.300000 -2.200000,-0.800000S6.100000,9.000000 6.100000,7.900000L6.100000,5.600000c0.000000,-1.100000 0.300000,-1.900000 0.800000,-2.400000S8.100000,2.400000 9.000000,2.400000c1.000000,0.000000 1.700000,0.200000 2.100000,0.700000s0.700000,1.200000 0.700000,2.100000l-1.600000,0.000000c0.000000,-0.500000 -0.100000,-0.900000 -0.200000,-1.100000S9.500000,3.700000 9.000000,3.700000c-0.400000,0.000000 -0.700000,0.200000 -0.900000,0.500000S7.700000,5.000000 7.700000,5.600000l0.000000,2.300000c0.000000,0.700000 0.100000,1.100000 0.300000,1.400000s0.600000,0.500000 1.000000,0.500000c0.300000,0.000000 0.600000,0.000000 0.700000,-0.100000s0.300000,-0.200000 0.400000,-0.300000L10.099999,7.800000L9.000000,7.800000L9.000000,6.600000l2.900000,0.000000L11.900000,9.900000z"/>
+</vector>
\ No newline at end of file
diff --git a/res/xml/gsm_umts_options.xml b/res/xml/gsm_umts_options.xml
index 1d1d4f3..cf56595 100644
--- a/res/xml/gsm_umts_options.xml
+++ b/res/xml/gsm_umts_options.xml
@@ -16,28 +16,6 @@
 -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <com.android.settings.network.telephony.NetworkOperators
-        android:key="network_operators_category_key"
-        android:title="@string/network_operator_category"
-        android:persistent="false">
-
-        <SwitchPreference
-            android:key="button_auto_select_key"
-            android:title="@string/select_automatically"
-            android:persistent="false"/>
-
-        <com.android.settings.network.telephony.NetworkSelectListPreference
-            android:key="button_network_select_key"
-            android:title="@string/network_select_title"
-            android:persistent="false"/>
-
-        <Preference
-            android:key="button_choose_network_key"
-            android:title="@string/choose_network_title"
-            android:fragment="com.android.phone.NetworkSelectSetting" />
-    </com.android.settings.network.telephony.NetworkOperators>
-
     <!--We want separate APN setting from reset of settings because-->
     <!--we want user to change it with caution.-->
     <PreferenceCategory
diff --git a/res/xml/network_setting_fragment.xml b/res/xml/network_setting_fragment.xml
index f6b8bed..459a269 100644
--- a/res/xml/network_setting_fragment.xml
+++ b/res/xml/network_setting_fragment.xml
@@ -117,16 +117,31 @@
         android:dialogTitle="@string/cdma_subscription_dialogtitle"
         settings:controller="com.android.settings.network.telephony.cdma.CdmaSubscriptionPreferenceController"/>
 
-    <!--We want separate APN setting from reset of settings because we want user to change it with caution-->
     <PreferenceCategory
-        android:key="category_cdma_apn_key">
-        <com.android.settingslib.RestrictedPreference
-            android:key="button_cdma_apn_key"
-            android:title="@string/apn_settings"
-            android:persistent="false"
-            settings:controller="com.android.settings.network.telephony.cdma.CdmaApnPreferenceController"/>
+        android:key="network_operators_category_key"
+        android:title="@string/network_operator_category"
+        settings:controller="com.android.settings.widget.PreferenceCategoryController">
+
+        <SwitchPreference
+            android:key="auto_select_key"
+            android:title="@string/select_automatically"
+            settings:controller="com.android.settings.network.telephony.gsm.AutoSelectPreferenceController"/>
+
+        <Preference
+            android:key="choose_network_key"
+            android:title="@string/choose_network_title"
+            android:fragment="com.android.phone.NetworkSelectSetting"
+            settings:controller="com.android.settings.network.telephony.gsm.OpenNetworkSelectPagePreferenceController"/>
     </PreferenceCategory>
 
+    <!--We want separate APN setting from reset of settings because we want user to change it with caution-->
+    <com.android.settingslib.RestrictedPreference
+        android:key="telephony_apn_key"
+        android:persistent="false"
+        android:title="@string/apn_settings"
+        settings:allowDividerAbove="true"
+        settings:controller="com.android.settings.network.telephony.ApnPreferenceController"/>
+
     <Preference
         android:key="carrier_settings_key"
         android:title="@string/carrier_settings_title"
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 4bf7fac..8881fc2 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -61,8 +61,6 @@
 import com.android.settings.core.SubSettingLauncher;
 import com.android.settings.core.gateway.SettingsGateway;
 import com.android.settings.dashboard.DashboardFeatureProvider;
-import com.android.settings.dashboard.DashboardSummary;
-import com.android.settings.homepage.SettingsHomepageActivity;
 import com.android.settings.homepage.TopLevelSettings;
 import com.android.settings.overlay.FeatureFactory;
 import com.android.settings.wfd.WifiDisplaySettings;
@@ -393,14 +391,9 @@
         } else {
             // Show search icon as up affordance if we are displaying the main Dashboard
             mInitialTitleResId = R.string.dashboard_title;
+            switchToFragment(TopLevelSettings.class.getName(), null /* args */, false, false,
+                    mInitialTitleResId, mInitialTitle, false);
 
-            if (SettingsHomepageActivity.isDynamicHomepageEnabled(this)) {
-                switchToFragment(TopLevelSettings.class.getName(), null /* args */, false, false,
-                        mInitialTitleResId, mInitialTitle, false);
-            } else {
-                switchToFragment(DashboardSummary.class.getName(), null /* args */, false, false,
-                        mInitialTitleResId, mInitialTitle, false);
-            }
         }
     }
 
diff --git a/src/com/android/settings/accounts/AccountDashboardFragment.java b/src/com/android/settings/accounts/AccountDashboardFragment.java
index d8b1008..c1499ce 100644
--- a/src/com/android/settings/accounts/AccountDashboardFragment.java
+++ b/src/com/android/settings/accounts/AccountDashboardFragment.java
@@ -18,22 +18,16 @@
 import static android.provider.Settings.EXTRA_AUTHORITIES;
 
 import android.content.Context;
-import android.icu.text.ListFormatter;
-import android.os.UserHandle;
 import android.provider.SearchIndexableResource;
-import android.text.BidiFormatter;
-import android.text.TextUtils;
 
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.settings.R;
 import com.android.settings.SettingsPreferenceFragment;
 import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.dashboard.SummaryLoader;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settings.users.AutoSyncDataPreferenceController;
 import com.android.settings.users.AutoSyncPersonalDataPreferenceController;
 import com.android.settings.users.AutoSyncWorkDataPreferenceController;
-import com.android.settingslib.accounts.AuthenticatorHelper;
 import com.android.settingslib.core.AbstractPreferenceController;
 import com.android.settingslib.search.SearchIndexable;
 
@@ -89,49 +83,6 @@
         return controllers;
     }
 
-    private static class SummaryProvider implements SummaryLoader.SummaryProvider {
-
-        private final Context mContext;
-        private final SummaryLoader mSummaryLoader;
-
-        public SummaryProvider(Context context, SummaryLoader summaryLoader) {
-            mContext = context;
-            mSummaryLoader = summaryLoader;
-        }
-
-        @Override
-        public void setListening(boolean listening) {
-            if (listening) {
-                final AuthenticatorHelper authHelper = new AuthenticatorHelper(mContext,
-                        UserHandle.of(UserHandle.myUserId()), null /* OnAccountsUpdateListener */);
-                final String[] types = authHelper.getEnabledAccountTypes();
-                final BidiFormatter bidiFormatter = BidiFormatter.getInstance();
-                final List<CharSequence> summaries = new ArrayList<>();
-
-                if (types == null || types.length == 0) {
-                    summaries.add(mContext.getString(R.string.account_dashboard_default_summary));
-                } else {
-                    // Show up to 3 account types, ignore any null value
-                    int accountToAdd = Math.min(3, types.length);
-
-                    for (int i = 0; i < types.length && accountToAdd > 0; i++) {
-                        final CharSequence label = authHelper.getLabelForType(mContext, types[i]);
-                        if (TextUtils.isEmpty(label)) {
-                            continue;
-                        }
-
-                        summaries.add(bidiFormatter.unicodeWrap(label));
-                        accountToAdd--;
-                    }
-                }
-                mSummaryLoader.setSummary(this, ListFormatter.getInstance().format(summaries));
-            }
-        }
-    }
-
-    public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY
-            = (activity, summaryLoader) -> new SummaryProvider(activity, summaryLoader);
-
     public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
             new BaseSearchIndexProvider() {
                 @Override
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java b/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
index fb6cd56..1795c07 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
@@ -65,12 +65,10 @@
                 .getBtClassDrawableWithDescription(mContext, mCachedDevice,
                 mContext.getResources().getFraction(R.fraction.bt_battery_scale_fraction, 1, 1));
         String summaryText = mCachedDevice.getConnectionSummary();
-        // If both the hearing aids are connected, two battery status should be shown.
-        final String pairDeviceSummary = mDeviceManager
-            .getHearingAidPairDeviceSummary(mCachedDevice);
-        if (pairDeviceSummary != null) {
-            mHeaderController.setSecondSummary(pairDeviceSummary);
-        }
+        // If both the hearing aids are connected, two device status should be shown.
+        // If Second Summary is unavailable, to set it to null.
+        mHeaderController.setSecondSummary(
+                mDeviceManager.getSubDeviceSummary(mCachedDevice));
         mHeaderController.setLabel(mCachedDevice.getName());
         mHeaderController.setIcon(pair.first);
         mHeaderController.setIconContentDescription(pair.second);
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressController.java b/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressController.java
index 71a415d..987dbe4 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsMacAddressController.java
@@ -51,6 +51,8 @@
 
     @Override
     protected void refresh() {
+        mFooterPreference.setTitle(mContext.getString(
+                R.string.bluetooth_device_mac_address, mCachedDevice.getAddress()));
     }
 
     @Override
diff --git a/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java b/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
index cac4565..a1ce4a6 100644
--- a/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
+++ b/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
@@ -230,9 +230,19 @@
      */
     protected void removePreference(CachedBluetoothDevice cachedDevice) {
         final BluetoothDevice device = cachedDevice.getDevice();
+        final CachedBluetoothDevice subCachedDevice = cachedDevice.getSubDevice();
         if (mPreferenceMap.containsKey(device)) {
             mDevicePreferenceCallback.onDeviceRemoved(mPreferenceMap.get(device));
             mPreferenceMap.remove(device);
+        } else if (subCachedDevice != null) {
+            // When doing remove, to check if preference maps to sub device.
+            // This would happen when connection state is changed in detail page that there is no
+            // callback from SettingsLib.
+            final BluetoothDevice subDevice = subCachedDevice.getDevice();
+            if (mPreferenceMap.containsKey(subDevice)) {
+                mDevicePreferenceCallback.onDeviceRemoved(mPreferenceMap.get(subDevice));
+                mPreferenceMap.remove(subDevice);
+            }
         }
     }
 
diff --git a/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java b/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
index e9b076e..223b78f 100644
--- a/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
+++ b/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java
@@ -15,7 +15,6 @@
  */
 package com.android.settings.connecteddevice;
 
-import android.app.Activity;
 import android.content.Context;
 import android.provider.SearchIndexableResource;
 
@@ -24,7 +23,6 @@
 import com.android.internal.logging.nano.MetricsProto;
 import com.android.settings.R;
 import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.dashboard.SummaryLoader;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settingslib.core.AbstractPreferenceController;
 import com.android.settingslib.core.lifecycle.Lifecycle;
@@ -92,35 +90,6 @@
         use(DiscoverableFooterPreferenceController.class).init(this);
     }
 
-    @VisibleForTesting
-    static class SummaryProvider implements SummaryLoader.SummaryProvider {
-
-        private final Context mContext;
-        private final SummaryLoader mSummaryLoader;
-
-        public SummaryProvider(Context context, SummaryLoader summaryLoader) {
-            mContext = context;
-            mSummaryLoader = summaryLoader;
-        }
-
-        @Override
-        public void setListening(boolean listening) {
-            if (listening) {
-                mSummaryLoader.setSummary(this, mContext.getText(AdvancedConnectedDeviceController.
-                        getConnectedDevicesSummaryResourceId(mContext)));
-            }
-        }
-    }
-
-    public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY
-            = new SummaryLoader.SummaryProviderFactory() {
-        @Override
-        public SummaryLoader.SummaryProvider createSummaryProvider(Activity activity,
-                SummaryLoader summaryLoader) {
-            return new SummaryProvider(activity, summaryLoader);
-        }
-    };
-
     /**
      * For Search.
      */
diff --git a/src/com/android/settings/dashboard/DashboardAdapter.java b/src/com/android/settings/dashboard/DashboardAdapter.java
deleted file mode 100644
index 307f6ba..0000000
--- a/src/com/android/settings/dashboard/DashboardAdapter.java
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * Copyright (C) 2015 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.dashboard;
-
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.Icon;
-import android.os.Bundle;
-import android.service.settings.suggestions.Suggestion;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.fragment.app.FragmentActivity;
-import androidx.recyclerview.widget.DiffUtil;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.R;
-import com.android.settings.R.id;
-import com.android.settings.dashboard.DashboardData.ConditionHeaderData;
-import com.android.settings.dashboard.suggestions.SuggestionAdapter;
-import com.android.settings.homepage.conditional.ConditionAdapter;
-import com.android.settings.homepage.conditional.ConditionManager;
-import com.android.settings.homepage.conditional.ConditionalCard;
-import com.android.settings.overlay.FeatureFactory;
-import com.android.settings.widget.RoundedHomepageIcon;
-import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.core.lifecycle.events.OnSaveInstanceState;
-import com.android.settingslib.drawer.DashboardCategory;
-import com.android.settingslib.drawer.Tile;
-import com.android.settingslib.suggestions.SuggestionControllerMixinCompat;
-import com.android.settingslib.utils.IconCache;
-
-import java.util.List;
-
-public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.DashboardItemHolder>
-        implements SummaryLoader.SummaryConsumer, SuggestionAdapter.Callback, LifecycleObserver,
-        OnSaveInstanceState {
-    public static final String TAG = "DashboardAdapter";
-    private static final String STATE_CATEGORY_LIST = "category_list";
-
-    @VisibleForTesting
-    static final String STATE_CONDITION_EXPANDED = "condition_expanded";
-
-    private final IconCache mCache;
-    private final Context mContext;
-    private final MetricsFeatureProvider mMetricsFeatureProvider;
-    private final DashboardFeatureProvider mDashboardFeatureProvider;
-    private boolean mFirstFrameDrawn;
-    private RecyclerView mRecyclerView;
-    private SuggestionAdapter mSuggestionAdapter;
-    private ConditionManager mConditionManager;
-
-    @VisibleForTesting
-    DashboardData mDashboardData;
-
-    private View.OnClickListener mTileClickListener = new View.OnClickListener() {
-        @Override
-        public void onClick(View v) {
-            //TODO: get rid of setTag/getTag
-            mDashboardFeatureProvider.openTileIntent((FragmentActivity) mContext,
-                    (Tile) v.getTag());
-        }
-    };
-
-    public DashboardAdapter(Context context, Bundle savedInstanceState,
-            ConditionManager conditionManager,
-            SuggestionControllerMixinCompat suggestionControllerMixin, Lifecycle lifecycle) {
-
-        DashboardCategory category = null;
-        boolean conditionExpanded = false;
-
-        mContext = context;
-        final FeatureFactory factory = FeatureFactory.getFactory(context);
-        mMetricsFeatureProvider = factory.getMetricsFeatureProvider();
-        mDashboardFeatureProvider = factory.getDashboardFeatureProvider(context);
-        mCache = new IconCache(context);
-        mConditionManager = conditionManager;
-        mSuggestionAdapter = new SuggestionAdapter(mContext, suggestionControllerMixin,
-                savedInstanceState, this /* callback */, lifecycle);
-
-        setHasStableIds(true);
-
-        if (savedInstanceState != null) {
-            category = savedInstanceState.getParcelable(STATE_CATEGORY_LIST);
-            conditionExpanded = savedInstanceState.getBoolean(
-                    STATE_CONDITION_EXPANDED, conditionExpanded);
-        }
-
-        if (lifecycle != null) {
-            lifecycle.addObserver(this);
-        }
-
-        mDashboardData = new DashboardData.Builder()
-                .setSuggestions(mSuggestionAdapter.getSuggestions())
-                .setCategory(category)
-                .setConditionExpanded(conditionExpanded)
-                .build();
-    }
-
-    public void setSuggestions(List<Suggestion> data) {
-        final DashboardData prevData = mDashboardData;
-        mDashboardData = new DashboardData.Builder(prevData)
-                .setSuggestions(data)
-                .build();
-        notifyDashboardDataChanged(prevData);
-    }
-
-    public void setCategory(DashboardCategory category) {
-        final DashboardData prevData = mDashboardData;
-        Log.d(TAG, "adapter setCategory called");
-        mDashboardData = new DashboardData.Builder(prevData)
-                .setCategory(category)
-                .build();
-        notifyDashboardDataChanged(prevData);
-    }
-
-    public void setConditions(List<ConditionalCard> conditions) {
-        final DashboardData prevData = mDashboardData;
-        Log.d(TAG, "adapter setConditions called");
-        mDashboardData = new DashboardData.Builder(prevData)
-                .setConditions(conditions)
-                .build();
-        notifyDashboardDataChanged(prevData);
-    }
-
-    @Override
-    public void onSuggestionClosed(Suggestion suggestion) {
-        final List<Suggestion> list = mDashboardData.getSuggestions();
-        if (list == null || list.size() == 0 || !list.remove(suggestion)) {
-            return;
-        }
-        if (list.isEmpty()) {
-            // The only suggestion is dismissed, and the the empty suggestion container will
-            // remain as the dashboard item. Need to refresh the dashboard list.
-            setSuggestions(null);
-        } else {
-            setSuggestions(list);
-        }
-    }
-
-    @Override
-    public void notifySummaryChanged(Tile tile) {
-        final int position = mDashboardData.getPositionByTile(tile);
-        if (position != DashboardData.POSITION_NOT_FOUND) {
-            // Since usually tile in parameter and tile in mCategories are same instance,
-            // which is hard to be detected by DiffUtil, so we notifyItemChanged directly.
-            notifyItemChanged(position, mDashboardData.getItemTypeByPosition(position));
-        }
-    }
-
-    @Override
-    public DashboardItemHolder onCreateViewHolder(ViewGroup parent, int viewType) {
-        final View view = LayoutInflater.from(parent.getContext()).inflate(viewType, parent, false);
-        if (viewType == R.layout.condition_header) {
-            return new ConditionHeaderHolder(view);
-        }
-        if (viewType == R.layout.condition_container) {
-            return new ConditionContainerHolder(view);
-        }
-        if (viewType == R.layout.suggestion_container) {
-            return new SuggestionContainerHolder(view);
-        }
-        return new DashboardItemHolder(view);
-    }
-
-    @Override
-    public void onBindViewHolder(DashboardItemHolder holder, int position) {
-        final int type = mDashboardData.getItemTypeByPosition(position);
-        switch (type) {
-            case R.layout.dashboard_tile:
-                final Tile tile = (Tile) mDashboardData.getItemEntityByPosition(position);
-                onBindTile(holder, tile);
-                holder.itemView.setTag(tile);
-                holder.itemView.setOnClickListener(mTileClickListener);
-                break;
-            case R.layout.suggestion_container:
-                onBindSuggestion((SuggestionContainerHolder) holder, position);
-                break;
-            case R.layout.condition_container:
-                onBindCondition((ConditionContainerHolder) holder, position);
-                break;
-            case R.layout.condition_header:
-                onBindConditionHeader((ConditionHeaderHolder) holder,
-                        (ConditionHeaderData) mDashboardData.getItemEntityByPosition(position));
-                break;
-            case R.layout.condition_footer:
-                holder.itemView.setOnClickListener(v -> {
-                    mMetricsFeatureProvider.action(mContext,
-                            MetricsEvent.ACTION_SETTINGS_CONDITION_EXPAND, false);
-                    DashboardData prevData = mDashboardData;
-                    mDashboardData = new DashboardData.Builder(prevData).
-                            setConditionExpanded(false).build();
-                    notifyDashboardDataChanged(prevData);
-                    scrollToTopOfConditions();
-                });
-                break;
-        }
-    }
-
-    @Override
-    public long getItemId(int position) {
-        return mDashboardData.getItemIdByPosition(position);
-    }
-
-    @Override
-    public int getItemViewType(int position) {
-        return mDashboardData.getItemTypeByPosition(position);
-    }
-
-    @Override
-    public int getItemCount() {
-        return mDashboardData.size();
-    }
-
-    @Override
-    public void onAttachedToRecyclerView(RecyclerView recyclerView) {
-        super.onAttachedToRecyclerView(recyclerView);
-        // save the view so that we can scroll it when expanding/collapsing the suggestion and
-        // conditions.
-        mRecyclerView = recyclerView;
-    }
-
-    public Object getItem(long itemId) {
-        return mDashboardData.getItemEntityById(itemId);
-    }
-
-    @VisibleForTesting
-    void notifyDashboardDataChanged(DashboardData prevData) {
-        if (mFirstFrameDrawn && prevData != null) {
-            final DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(new DashboardData
-                    .ItemsDataDiffCallback(prevData.getItemList(), mDashboardData.getItemList()));
-            diffResult.dispatchUpdatesTo(this);
-        } else {
-            mFirstFrameDrawn = true;
-            notifyDataSetChanged();
-        }
-    }
-
-    @VisibleForTesting
-    void onBindConditionHeader(final ConditionHeaderHolder holder, ConditionHeaderData data) {
-        holder.icon.setImageDrawable(data.conditionIcons.get(0));
-        if (data.conditionCount == 1) {
-            holder.title.setText(data.title);
-            holder.summary.setText(null);
-            holder.icons.setVisibility(View.INVISIBLE);
-        } else {
-            holder.title.setText(null);
-            holder.summary.setText(
-                    mContext.getString(R.string.condition_summary, data.conditionCount));
-            updateConditionIcons(data.conditionIcons, holder.icons);
-            holder.icons.setVisibility(View.VISIBLE);
-        }
-
-        holder.itemView.setOnClickListener(v -> {
-            mMetricsFeatureProvider.action(mContext,
-                    MetricsEvent.ACTION_SETTINGS_CONDITION_EXPAND, true);
-            final DashboardData prevData = mDashboardData;
-            mDashboardData = new DashboardData.Builder(prevData)
-                    .setConditionExpanded(true).build();
-            notifyDashboardDataChanged(prevData);
-            scrollToTopOfConditions();
-        });
-    }
-
-    @VisibleForTesting
-    void onBindCondition(final ConditionContainerHolder holder, int position) {
-        final List<ConditionalCard> conditions =
-                (List) mDashboardData.getItemEntityByPosition(position);
-        final ConditionAdapter adapter = new ConditionAdapter(
-                mContext, mConditionManager, conditions,
-                mDashboardData.isConditionExpanded());
-        holder.data.setAdapter(adapter);
-        holder.data.setLayoutManager(new LinearLayoutManager(mContext));
-    }
-
-    @VisibleForTesting
-    void onBindSuggestion(final SuggestionContainerHolder holder, int position) {
-        // If there is suggestions to show, it will be at position 0 as we don't show the suggestion
-        // header anymore.
-        final List<Suggestion> suggestions =
-                (List<Suggestion>) mDashboardData.getItemEntityByPosition(position);
-        if (suggestions != null && suggestions.size() > 0) {
-            mSuggestionAdapter.setSuggestions(suggestions);
-            holder.data.setAdapter(mSuggestionAdapter);
-        }
-        final LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
-        layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
-        holder.data.setLayoutManager(layoutManager);
-    }
-
-    @VisibleForTesting
-    void onBindTile(DashboardItemHolder holder, Tile tile) {
-        Icon tileIcon = tile.getIcon(mContext);
-        Drawable icon = mCache.getIcon(tileIcon);
-        if (!TextUtils.equals(tileIcon.getResPackage(), mContext.getPackageName())
-                && !(icon instanceof RoundedHomepageIcon)) {
-            icon = new RoundedHomepageIcon(mContext, icon);
-            ((RoundedHomepageIcon) icon).setBackgroundColor(mContext, tile);
-            mCache.updateIcon(tileIcon, icon);
-        }
-        holder.icon.setImageDrawable(icon);
-        holder.title.setText(tile.getTitle(mContext));
-        final CharSequence summary = tile.getSummary(mContext);
-        if (!TextUtils.isEmpty(summary)) {
-            holder.summary.setText(summary);
-            holder.summary.setVisibility(View.VISIBLE);
-        } else {
-            holder.summary.setVisibility(View.GONE);
-        }
-    }
-
-    @Override
-    public void onSaveInstanceState(Bundle outState) {
-        final DashboardCategory category = mDashboardData.getCategory();
-        if (category != null) {
-            outState.putParcelable(STATE_CATEGORY_LIST, category);
-        }
-        outState.putBoolean(STATE_CONDITION_EXPANDED, mDashboardData.isConditionExpanded());
-    }
-
-    private void updateConditionIcons(List<Drawable> icons, ViewGroup parent) {
-        if (icons == null || icons.size() < 2) {
-            parent.setVisibility(View.INVISIBLE);
-            return;
-        }
-        final LayoutInflater inflater = LayoutInflater.from(parent.getContext());
-        parent.removeAllViews();
-        for (int i = 1, size = icons.size(); i < size; i++) {
-            ImageView icon = (ImageView) inflater.inflate(
-                    R.layout.condition_header_icon, parent, false);
-            icon.setImageDrawable(icons.get(i));
-            parent.addView(icon);
-        }
-        parent.setVisibility(View.VISIBLE);
-    }
-
-    private void scrollToTopOfConditions() {
-        mRecyclerView.scrollToPosition(mDashboardData.hasSuggestion() ? 1 : 0);
-    }
-
-    public static class DashboardItemHolder extends RecyclerView.ViewHolder {
-        public final ImageView icon;
-        public final TextView title;
-        public final TextView summary;
-
-        public DashboardItemHolder(View itemView) {
-            super(itemView);
-            icon = itemView.findViewById(android.R.id.icon);
-            title = itemView.findViewById(android.R.id.title);
-            summary = itemView.findViewById(android.R.id.summary);
-        }
-    }
-
-    public static class ConditionHeaderHolder extends DashboardItemHolder {
-        public final LinearLayout icons;
-        public final ImageView expandIndicator;
-
-        public ConditionHeaderHolder(View itemView) {
-            super(itemView);
-            icons = itemView.findViewById(id.additional_icons);
-            expandIndicator = itemView.findViewById(id.expand_indicator);
-        }
-    }
-
-    public static class ConditionContainerHolder extends DashboardItemHolder {
-        public final RecyclerView data;
-
-        public ConditionContainerHolder(View itemView) {
-            super(itemView);
-            data = itemView.findViewById(id.data);
-        }
-    }
-
-    public static class SuggestionContainerHolder extends DashboardItemHolder {
-        public final RecyclerView data;
-
-        public SuggestionContainerHolder(View itemView) {
-            super(itemView);
-            data = itemView.findViewById(id.suggestion_list);
-        }
-    }
-
-}
diff --git a/src/com/android/settings/dashboard/DashboardData.java b/src/com/android/settings/dashboard/DashboardData.java
deleted file mode 100644
index 5265b82..0000000
--- a/src/com/android/settings/dashboard/DashboardData.java
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
- * Copyright (C) 2016 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.dashboard;
-
-import android.annotation.IntDef;
-import android.graphics.drawable.Drawable;
-import android.service.settings.suggestions.Suggestion;
-import android.text.TextUtils;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.recyclerview.widget.DiffUtil;
-
-import com.android.settings.R;
-import com.android.settings.homepage.conditional.ConditionalCard;
-import com.android.settingslib.drawer.DashboardCategory;
-import com.android.settingslib.drawer.Tile;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Description about data list used in the DashboardAdapter. In the data list each item can be
- * Condition, suggestion or category tile.
- * <p>
- * ItemsData has inner class Item, which represents the Item in data list.
- */
-public class DashboardData {
-    public static final int POSITION_NOT_FOUND = -1;
-
-    // stable id for different type of items.
-    @VisibleForTesting
-    static final int STABLE_ID_SUGGESTION_CONTAINER = 0;
-    static final int STABLE_ID_SUGGESTION_CONDITION_DIVIDER = 1;
-    @VisibleForTesting
-    static final int STABLE_ID_CONDITION_HEADER = 2;
-    @VisibleForTesting
-    static final int STABLE_ID_CONDITION_FOOTER = 3;
-    @VisibleForTesting
-    static final int STABLE_ID_CONDITION_CONTAINER = 4;
-
-    private final List<Item> mItems;
-    private final DashboardCategory mCategory;
-    private final List<ConditionalCard> mConditions;
-    private final List<Suggestion> mSuggestions;
-    private final boolean mConditionExpanded;
-
-    private DashboardData(Builder builder) {
-        mCategory = builder.mCategory;
-        mConditions = builder.mConditions;
-        mSuggestions = builder.mSuggestions;
-        mConditionExpanded = builder.mConditionExpanded;
-        mItems = new ArrayList<>();
-
-        buildItemsData();
-    }
-
-    public int getItemIdByPosition(int position) {
-        return mItems.get(position).id;
-    }
-
-    public int getItemTypeByPosition(int position) {
-        return mItems.get(position).type;
-    }
-
-    public Object getItemEntityByPosition(int position) {
-        return mItems.get(position).entity;
-    }
-
-    public List<Item> getItemList() {
-        return mItems;
-    }
-
-    public int size() {
-        return mItems.size();
-    }
-
-    public Object getItemEntityById(long id) {
-        for (final Item item : mItems) {
-            if (item.id == id) {
-                return item.entity;
-            }
-        }
-        return null;
-    }
-
-    public DashboardCategory getCategory() {
-        return mCategory;
-    }
-
-    public List<ConditionalCard> getConditions() {
-        return mConditions;
-    }
-
-    public List<Suggestion> getSuggestions() {
-        return mSuggestions;
-    }
-
-    public boolean hasSuggestion() {
-        return sizeOf(mSuggestions) > 0;
-    }
-
-    public boolean isConditionExpanded() {
-        return mConditionExpanded;
-    }
-
-    /**
-     * Find the position of the object in mItems list, using the equals method to compare
-     *
-     * @param entity the object that need to be found in list
-     * @return position of the object, return POSITION_NOT_FOUND if object isn't in the list
-     */
-    public int getPositionByEntity(Object entity) {
-        if (entity == null) return POSITION_NOT_FOUND;
-
-        final int size = mItems.size();
-        for (int i = 0; i < size; i++) {
-            final Object item = mItems.get(i).entity;
-            if (entity.equals(item)) {
-                return i;
-            }
-        }
-
-        return POSITION_NOT_FOUND;
-    }
-
-    /**
-     * Find the position of the Tile object.
-     * <p>
-     * First, try to find the exact identical instance of the tile object, if not found,
-     * then try to find a tile has the same id.
-     *
-     * @param tile tile that need to be found
-     * @return position of the object, return INDEX_NOT_FOUND if object isn't in the list
-     */
-    public int getPositionByTile(Tile tile) {
-        final int size = mItems.size();
-        for (int i = 0; i < size; i++) {
-            final Object entity = mItems.get(i).entity;
-            if (entity == tile) {
-                return i;
-            } else if (entity instanceof Tile && tile.getId() == ((Tile) entity).getId()) {
-                return i;
-            }
-        }
-
-        return POSITION_NOT_FOUND;
-    }
-
-    /**
-     * Add item into list when {@paramref add} is true.
-     *
-     * @param item     maybe {@link ConditionalCard}, {@link Tile}, {@link DashboardCategory}
-     *                 or null
-     * @param type     type of the item, and value is the layout id
-     * @param stableId The stable id for this item
-     * @param add      flag about whether to add item into list
-     */
-    private void addToItemList(Object item, int type, int stableId, boolean add) {
-        if (add) {
-            mItems.add(new Item(item, type, stableId));
-        }
-    }
-
-    /**
-     * Build the mItems list using mConditions, mSuggestions, mCategories data
-     * and mIsShowingAll, mConditionExpanded flag.
-     */
-    private void buildItemsData() {
-        final List<ConditionalCard> conditions = mConditions;
-        final boolean hasConditions = sizeOf(conditions) > 0;
-
-        final List<Suggestion> suggestions = mSuggestions;
-        final boolean hasSuggestions = sizeOf(suggestions) > 0;
-
-        /* Suggestion container. This is the card view that contains the list of suggestions.
-         * This will be added whenever the suggestion list is not empty */
-        addToItemList(suggestions, R.layout.suggestion_container,
-                STABLE_ID_SUGGESTION_CONTAINER, hasSuggestions);
-
-        /* Divider between suggestion and conditions if both are present. */
-        addToItemList(null /* item */, R.layout.horizontal_divider,
-                STABLE_ID_SUGGESTION_CONDITION_DIVIDER, hasSuggestions && hasConditions);
-
-        /* Condition header. This will be present when there is condition and it is collapsed */
-        addToItemList(new ConditionHeaderData(conditions),
-                R.layout.condition_header,
-                STABLE_ID_CONDITION_HEADER, hasConditions && !mConditionExpanded);
-
-        /* Condition container. This is the card view that contains the list of conditions.
-         * This will be added whenever the condition list is not empty and expanded */
-        addToItemList(conditions, R.layout.condition_container,
-                STABLE_ID_CONDITION_CONTAINER, hasConditions && mConditionExpanded);
-
-        /* Condition footer. This will be present when there is condition and it is expanded */
-        addToItemList(null /* item */, R.layout.condition_footer,
-                STABLE_ID_CONDITION_FOOTER, hasConditions && mConditionExpanded);
-
-        if (mCategory != null) {
-            final List<Tile> tiles = mCategory.getTiles();
-            for (int i = 0; i < tiles.size(); i++) {
-                final Tile tile = tiles.get(i);
-                addToItemList(tile, R.layout.dashboard_tile, tile.getId(),
-                        true /* add */);
-            }
-        }
-    }
-
-    private static int sizeOf(List<?> list) {
-        return list == null ? 0 : list.size();
-    }
-
-    /**
-     * Builder used to build the ItemsData
-     */
-    public static class Builder {
-        private DashboardCategory mCategory;
-        private List<ConditionalCard> mConditions;
-        private List<Suggestion> mSuggestions;
-        private boolean mConditionExpanded;
-
-        public Builder() {
-        }
-
-        public Builder(DashboardData dashboardData) {
-            mCategory = dashboardData.mCategory;
-            mConditions = dashboardData.mConditions;
-            mSuggestions = dashboardData.mSuggestions;
-            mConditionExpanded = dashboardData.mConditionExpanded;
-        }
-
-        public Builder setCategory(DashboardCategory category) {
-            this.mCategory = category;
-            return this;
-        }
-
-        public Builder setConditions(List<ConditionalCard> conditions) {
-            this.mConditions = conditions;
-            return this;
-        }
-
-        public Builder setSuggestions(List<Suggestion> suggestions) {
-            this.mSuggestions = suggestions;
-            return this;
-        }
-
-        public Builder setConditionExpanded(boolean expanded) {
-            this.mConditionExpanded = expanded;
-            return this;
-        }
-
-        public DashboardData build() {
-            return new DashboardData(this);
-        }
-    }
-
-    /**
-     * A DiffCallback to calculate the difference between old and new Item
-     * List in DashboardData
-     */
-    public static class ItemsDataDiffCallback extends DiffUtil.Callback {
-        final private List<Item> mOldItems;
-        final private List<Item> mNewItems;
-
-        public ItemsDataDiffCallback(List<Item> oldItems, List<Item> newItems) {
-            mOldItems = oldItems;
-            mNewItems = newItems;
-        }
-
-        @Override
-        public int getOldListSize() {
-            return mOldItems.size();
-        }
-
-        @Override
-        public int getNewListSize() {
-            return mNewItems.size();
-        }
-
-        @Override
-        public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
-            return mOldItems.get(oldItemPosition).id == mNewItems.get(newItemPosition).id;
-        }
-
-        @Override
-        public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
-            return mOldItems.get(oldItemPosition).equals(mNewItems.get(newItemPosition));
-        }
-
-    }
-
-    /**
-     * An item contains the data needed in the DashboardData.
-     */
-    static class Item {
-        // valid types in field type
-        private static final int TYPE_DASHBOARD_TILE = R.layout.dashboard_tile;
-        private static final int TYPE_SUGGESTION_CONTAINER =
-                R.layout.suggestion_container;
-        private static final int TYPE_CONDITION_CONTAINER =
-                R.layout.condition_container;
-        private static final int TYPE_CONDITION_HEADER =
-                R.layout.condition_header;
-        private static final int TYPE_CONDITION_FOOTER =
-                R.layout.condition_footer;
-        private static final int TYPE_SUGGESTION_CONDITION_DIVIDER = R.layout.horizontal_divider;
-
-        @IntDef({TYPE_DASHBOARD_TILE, TYPE_SUGGESTION_CONTAINER, TYPE_CONDITION_CONTAINER,
-                TYPE_CONDITION_HEADER, TYPE_CONDITION_FOOTER, TYPE_SUGGESTION_CONDITION_DIVIDER})
-        @Retention(RetentionPolicy.SOURCE)
-        public @interface ItemTypes {
-        }
-
-        /**
-         * The main data object in item, usually is a {@link Tile}, {@link ConditionalCard}
-         * object. This object can also be null when the
-         * item is an divider line. Please refer to {@link #buildItemsData()} for
-         * detail usage of the Item.
-         */
-        public final Object entity;
-
-        /**
-         * The type of item, value inside is the layout id(e.g. R.layout.dashboard_tile)
-         */
-        @ItemTypes
-        public final int type;
-
-        /**
-         * Id of this item, used in the {@link ItemsDataDiffCallback} to identify the same item.
-         */
-        public final int id;
-
-        public Item(Object entity, @ItemTypes int type, int id) {
-            this.entity = entity;
-            this.type = type;
-            this.id = id;
-        }
-
-        /**
-         * Override it to make comparision in the {@link ItemsDataDiffCallback}
-         *
-         * @param obj object to compared with
-         * @return true if the same object or has equal value.
-         */
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-
-            if (!(obj instanceof Item)) {
-                return false;
-            }
-
-            final Item targetItem = (Item) obj;
-            if (type != targetItem.type || id != targetItem.id) {
-                return false;
-            }
-
-            switch (type) {
-                case TYPE_DASHBOARD_TILE:
-                    final Tile localTile = (Tile) entity;
-                    final Tile targetTile = (Tile) targetItem.entity;
-
-                    // Only check id and summary for dashboard tile
-                    return localTile.getId() == targetTile.getId()
-                            && TextUtils.equals(
-                            localTile.getSummaryReference(),
-                            targetTile.getSummaryReference());
-                case TYPE_SUGGESTION_CONTAINER:
-                case TYPE_CONDITION_CONTAINER:
-                    // Fall through to default
-                default:
-                    return entity == null ? targetItem.entity == null
-                            : entity.equals(targetItem.entity);
-            }
-        }
-    }
-
-    /**
-     * This class contains the data needed to build the suggestion/condition header. The data can
-     * also be used to check the diff in DiffUtil.Callback
-     */
-    public static class ConditionHeaderData {
-        public final List<Drawable> conditionIcons;
-        public final CharSequence title;
-        public final int conditionCount;
-
-        public ConditionHeaderData(List<ConditionalCard> conditions) {
-            conditionCount = sizeOf(conditions);
-            title = conditionCount > 0 ? conditions.get(0).getTitle() : null;
-            conditionIcons = new ArrayList<>();
-            if (conditions == null) {
-                return;
-            }
-            for (ConditionalCard card : conditions) {
-                conditionIcons.add(card.getIcon());
-            }
-        }
-    }
-
-}
diff --git a/src/com/android/settings/dashboard/DashboardFragmentRegistry.java b/src/com/android/settings/dashboard/DashboardFragmentRegistry.java
index 9df4a05..4c371dd 100644
--- a/src/com/android/settings/dashboard/DashboardFragmentRegistry.java
+++ b/src/com/android/settings/dashboard/DashboardFragmentRegistry.java
@@ -30,6 +30,7 @@
 import com.android.settings.display.NightDisplaySettings;
 import com.android.settings.fuelgauge.PowerUsageSummary;
 import com.android.settings.gestures.GestureSettings;
+import com.android.settings.homepage.TopLevelSettings;
 import com.android.settings.language.LanguageAndInputSettings;
 import com.android.settings.network.NetworkDashboardFragment;
 import com.android.settings.notification.ConfigureNotificationSettings;
@@ -61,9 +62,8 @@
 
     static {
         PARENT_TO_CATEGORY_KEY_MAP = new ArrayMap<>();
-        // TODO(b/110405144): Add the mapping when IA.homepage intent-filter is  is removed.
-        //        PARENT_TO_CATEGORY_KEY_MAP.put(TopLevelSettings.class.getName(),
-        //                CategoryKey.CATEGORY_HOMEPAGE);
+        PARENT_TO_CATEGORY_KEY_MAP.put(TopLevelSettings.class.getName(),
+                CategoryKey.CATEGORY_HOMEPAGE);
         PARENT_TO_CATEGORY_KEY_MAP.put(
                 NetworkDashboardFragment.class.getName(), CategoryKey.CATEGORY_NETWORK);
         PARENT_TO_CATEGORY_KEY_MAP.put(ConnectedDeviceDashboardFragment.class.getName(),
diff --git a/src/com/android/settings/dashboard/DashboardItemAnimator.java b/src/com/android/settings/dashboard/DashboardItemAnimator.java
deleted file mode 100644
index 51dd49e..0000000
--- a/src/com/android/settings/dashboard/DashboardItemAnimator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2016 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.dashboard;
-
-import androidx.core.view.ViewCompat;
-import androidx.recyclerview.widget.DefaultItemAnimator;
-import androidx.recyclerview.widget.RecyclerView.ViewHolder;
-
-import com.android.settingslib.drawer.Tile;
-
-public class DashboardItemAnimator extends DefaultItemAnimator {
-
-    @Override
-    public boolean animateChange(ViewHolder oldHolder, ViewHolder newHolder, int fromX, int fromY,
-            int toX, int toY) {
-        final Object tag = oldHolder.itemView.getTag();
-        if (tag instanceof Tile && oldHolder == newHolder) {
-            // When this view has other move animation running, skip this value to avoid
-            // animations interrupt each other.
-            if (!isRunning()) {
-                fromX += ViewCompat.getTranslationX(oldHolder.itemView);
-                fromY += ViewCompat.getTranslationY(oldHolder.itemView);
-            }
-
-            if (fromX == toX && fromY == toY) {
-                dispatchMoveFinished(oldHolder);
-                return false;
-            }
-        }
-        return super.animateChange(oldHolder, newHolder, fromX, fromY, toX, toY);
-    }
-}
diff --git a/src/com/android/settings/dashboard/DashboardSummary.java b/src/com/android/settings/dashboard/DashboardSummary.java
deleted file mode 100644
index 9139695..0000000
--- a/src/com/android/settings/dashboard/DashboardSummary.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Copyright (C) 2014 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.dashboard;
-
-import android.app.Activity;
-import android.content.Context;
-import android.os.Bundle;
-import android.os.Handler;
-import android.service.settings.suggestions.Suggestion;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.annotation.WorkerThread;
-import androidx.loader.app.LoaderManager;
-import androidx.recyclerview.widget.LinearLayoutManager;
-
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.R;
-import com.android.settings.core.InstrumentedFragment;
-import com.android.settings.core.SettingsBaseActivity;
-import com.android.settings.core.SettingsBaseActivity.CategoryListener;
-import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
-import com.android.settings.homepage.conditional.ConditionListener;
-import com.android.settings.homepage.conditional.ConditionManager;
-import com.android.settings.homepage.conditional.FocusRecyclerView;
-import com.android.settings.homepage.conditional.FocusRecyclerView.FocusListener;
-import com.android.settings.overlay.FeatureFactory;
-import com.android.settings.widget.ActionBarShadowController;
-import com.android.settingslib.drawer.CategoryKey;
-import com.android.settingslib.drawer.DashboardCategory;
-import com.android.settingslib.suggestions.SuggestionControllerMixinCompat;
-import com.android.settingslib.utils.ThreadUtils;
-
-import java.util.List;
-
-/**
- * Deprecated in favor of {@link com.android.settings.homepage.TopLevelSettings}
- *
- * @deprecated
- */
-@Deprecated
-public class DashboardSummary extends InstrumentedFragment
-        implements CategoryListener, ConditionListener,
-        FocusListener, SuggestionControllerMixinCompat.SuggestionControllerHost {
-    public static final boolean DEBUG = false;
-    private static final boolean DEBUG_TIMING = false;
-    private static final int MAX_WAIT_MILLIS = 3000;
-    private static final String TAG = "DashboardSummary";
-
-    private static final String STATE_SCROLL_POSITION = "scroll_position";
-    private static final String STATE_CATEGORIES_CHANGE_CALLED = "categories_change_called";
-
-    private final Handler mHandler = new Handler();
-
-    private FocusRecyclerView mDashboard;
-    private DashboardAdapter mAdapter;
-    private SummaryLoader mSummaryLoader;
-    private ConditionManager mConditionManager;
-    private LinearLayoutManager mLayoutManager;
-    private SuggestionControllerMixinCompat mSuggestionControllerMixin;
-    private DashboardFeatureProvider mDashboardFeatureProvider;
-    @VisibleForTesting
-    boolean mIsOnCategoriesChangedCalled;
-    private boolean mOnConditionsChangedCalled;
-
-    private DashboardCategory mStagingCategory;
-    private List<Suggestion> mStagingSuggestions;
-
-    @Override
-    public int getMetricsCategory() {
-        return MetricsEvent.DASHBOARD_SUMMARY;
-    }
-
-    @Override
-    public void onAttach(Context context) {
-        super.onAttach(context);
-        Log.d(TAG, "Creating SuggestionControllerMixinCompat");
-        final SuggestionFeatureProvider suggestionFeatureProvider = FeatureFactory
-                .getFactory(context)
-                .getSuggestionFeatureProvider(context);
-        if (suggestionFeatureProvider.isSuggestionEnabled(context)) {
-            mSuggestionControllerMixin = new SuggestionControllerMixinCompat(
-                    context, this /* host */, getSettingsLifecycle(),
-                    suggestionFeatureProvider.getSuggestionServiceComponent());
-        }
-    }
-
-    @Override
-    public LoaderManager getLoaderManager() {
-        if (!isAdded()) {
-            return null;
-        }
-        return super.getLoaderManager();
-    }
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        long startTime = System.currentTimeMillis();
-        super.onCreate(savedInstanceState);
-        Log.d(TAG, "Starting DashboardSummary");
-        final Activity activity = getActivity();
-        mDashboardFeatureProvider = FeatureFactory.getFactory(activity)
-                .getDashboardFeatureProvider(activity);
-
-        mSummaryLoader = new SummaryLoader(activity, CategoryKey.CATEGORY_HOMEPAGE);
-
-        mConditionManager =
-                new ConditionManager(
-                        activity, this /* listener */);
-        if (savedInstanceState != null) {
-            mIsOnCategoriesChangedCalled =
-                    savedInstanceState.getBoolean(STATE_CATEGORIES_CHANGE_CALLED);
-        }
-        if (DEBUG_TIMING) {
-            Log.d(TAG, "onCreate took " + (System.currentTimeMillis() - startTime) + " ms");
-        }
-    }
-
-    @Override
-    public void onDestroy() {
-        mSummaryLoader.release();
-        super.onDestroy();
-    }
-
-    @Override
-    public void onResume() {
-        long startTime = System.currentTimeMillis();
-        super.onResume();
-
-        ((SettingsBaseActivity) getActivity()).addCategoryListener(this);
-        mSummaryLoader.setListening(true);
-        mConditionManager.startMonitoringStateChange();
-        if (DEBUG_TIMING) {
-            Log.d(TAG, "onResume took " + (System.currentTimeMillis() - startTime) + " ms");
-        }
-    }
-
-    @Override
-    public void onPause() {
-        super.onPause();
-
-        ((SettingsBaseActivity) getActivity()).remCategoryListener(this);
-        mSummaryLoader.setListening(false);
-        mConditionManager.stopMonitoringStateChange();
-    }
-
-    @Override
-    public void onWindowFocusChanged(boolean hasWindowFocus) {
-        long startTime = System.currentTimeMillis();
-        if (hasWindowFocus) {
-            mConditionManager.startMonitoringStateChange();
-        } else {
-            mConditionManager.stopMonitoringStateChange();
-        }
-        if (DEBUG_TIMING) {
-            Log.d(TAG, "onWindowFocusChanged took "
-                    + (System.currentTimeMillis() - startTime) + " ms");
-        }
-    }
-
-    @Override
-    public void onSaveInstanceState(Bundle outState) {
-        super.onSaveInstanceState(outState);
-        if (mLayoutManager == null) {
-            return;
-        }
-        outState.putBoolean(STATE_CATEGORIES_CHANGE_CALLED, mIsOnCategoriesChangedCalled);
-        outState.putInt(STATE_SCROLL_POSITION, mLayoutManager.findFirstVisibleItemPosition());
-    }
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
-        long startTime = System.currentTimeMillis();
-        final View root = inflater.inflate(R.layout.dashboard, container, false);
-        mDashboard = root.findViewById(R.id.dashboard_container);
-        mLayoutManager = new LinearLayoutManager(getContext());
-        mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
-        if (bundle != null) {
-            int scrollPosition = bundle.getInt(STATE_SCROLL_POSITION);
-            mLayoutManager.scrollToPosition(scrollPosition);
-        }
-        mDashboard.setLayoutManager(mLayoutManager);
-        mDashboard.setHasFixedSize(true);
-        mDashboard.setListener(this);
-        mDashboard.setItemAnimator(new DashboardItemAnimator());
-        mAdapter = new DashboardAdapter(getContext(), bundle,
-                mConditionManager,
-                mSuggestionControllerMixin,
-                getSettingsLifecycle());
-        mDashboard.setAdapter(mAdapter);
-        mSummaryLoader.setSummaryConsumer(mAdapter);
-        ActionBarShadowController.attachToRecyclerView(
-                getActivity().findViewById(R.id.search_bar_container), getSettingsLifecycle(),
-                mDashboard);
-        rebuildUI();
-        if (DEBUG_TIMING) {
-            Log.d(TAG, "onCreateView took "
-                    + (System.currentTimeMillis() - startTime) + " ms");
-        }
-        return root;
-    }
-
-    @VisibleForTesting
-    void rebuildUI() {
-        ThreadUtils.postOnBackgroundThread(() -> updateCategory());
-    }
-
-    @Override
-    public void onCategoriesChanged() {
-        // Bypass rebuildUI() on the first call of onCategoriesChanged, since rebuildUI() happens
-        // in onViewCreated as well when app starts. But, on the subsequent calls we need to
-        // rebuildUI() because there might be some changes to suggestions and categories.
-        if (mIsOnCategoriesChangedCalled) {
-            rebuildUI();
-        }
-        mIsOnCategoriesChangedCalled = true;
-    }
-
-    @Override
-    public void onConditionsChanged() {
-        Log.d(TAG, "onConditionsChanged");
-        // Bypass refreshing the conditions on the first call of onConditionsChanged.
-        // onConditionsChanged is called immediately everytime we start listening to the conditions
-        // change when we gain window focus. Since the conditions are passed to the adapter's
-        // constructor when we create the view, the first handling is not necessary.
-        // But, on the subsequent calls we need to handle it because there might be real changes to
-        // conditions.
-        if (mOnConditionsChangedCalled) {
-            final boolean scrollToTop =
-                    mLayoutManager.findFirstCompletelyVisibleItemPosition() <= 1;
-            mAdapter.setConditions(mConditionManager.getDisplayableCards());
-
-            if (scrollToTop) {
-                mDashboard.scrollToPosition(0);
-            }
-        } else {
-            mOnConditionsChangedCalled = true;
-        }
-    }
-
-    @Override
-    public void onSuggestionReady(List<Suggestion> suggestions) {
-        mStagingSuggestions = suggestions;
-        mAdapter.setSuggestions(suggestions);
-        if (mStagingCategory != null) {
-            Log.d(TAG, "Category has loaded, setting category from suggestionReady");
-            mHandler.removeCallbacksAndMessages(null);
-            mAdapter.setCategory(mStagingCategory);
-        }
-    }
-
-    @WorkerThread
-    void updateCategory() {
-        final DashboardCategory category = mDashboardFeatureProvider.getTilesForCategory(
-                CategoryKey.CATEGORY_HOMEPAGE);
-        mSummaryLoader.updateSummaryToCache(category);
-        mStagingCategory = category;
-        if (mSuggestionControllerMixin == null) {
-            ThreadUtils.postOnMainThread(() -> mAdapter.setCategory(mStagingCategory));
-            return;
-        }
-        if (mSuggestionControllerMixin.isSuggestionLoaded()) {
-            Log.d(TAG, "Suggestion has loaded, setting suggestion/category");
-            ThreadUtils.postOnMainThread(() -> {
-                if (mStagingSuggestions != null) {
-                    mAdapter.setSuggestions(mStagingSuggestions);
-                }
-                mAdapter.setCategory(mStagingCategory);
-            });
-        } else {
-            Log.d(TAG, "Suggestion NOT loaded, delaying setCategory by " + MAX_WAIT_MILLIS + "ms");
-            mHandler.postDelayed(() -> mAdapter.setCategory(mStagingCategory), MAX_WAIT_MILLIS);
-        }
-    }
-}
diff --git a/src/com/android/settings/dashboard/SummaryLoader.java b/src/com/android/settings/dashboard/SummaryLoader.java
index cfb64ef..059cb93 100644
--- a/src/com/android/settings/dashboard/SummaryLoader.java
+++ b/src/com/android/settings/dashboard/SummaryLoader.java
@@ -44,7 +44,7 @@
 import java.util.List;
 
 public class SummaryLoader {
-    private static final boolean DEBUG = DashboardSummary.DEBUG;
+    private static final boolean DEBUG = false;
     private static final String TAG = "SummaryLoader";
 
     public static final String SUMMARY_PROVIDER_FACTORY = "SUMMARY_PROVIDER_FACTORY";
diff --git a/src/com/android/settings/dashboard/suggestions/SuggestionAdapter.java b/src/com/android/settings/dashboard/suggestions/SuggestionAdapter.java
deleted file mode 100644
index a210c85..0000000
--- a/src/com/android/settings/dashboard/suggestions/SuggestionAdapter.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * Copyright (C) 2017 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.dashboard.suggestions;
-
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.Typeface;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.Icon;
-import android.os.Bundle;
-import android.service.settings.suggestions.Suggestion;
-import android.text.TextUtils;
-import android.util.DisplayMetrics;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.WindowManager;
-import android.widget.LinearLayout;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.R;
-import com.android.settings.dashboard.DashboardAdapter.DashboardItemHolder;
-import com.android.settings.overlay.FeatureFactory;
-import com.android.settingslib.Utils;
-import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.core.lifecycle.events.OnSaveInstanceState;
-import com.android.settingslib.suggestions.SuggestionControllerMixinCompat;
-import com.android.settingslib.utils.IconCache;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-public class SuggestionAdapter extends RecyclerView.Adapter<DashboardItemHolder> implements
-    LifecycleObserver, OnSaveInstanceState {
-    public static final String TAG = "SuggestionAdapter";
-
-    private static final String STATE_SUGGESTIONS_SHOWN_LOGGED = "suggestions_shown_logged";
-    private static final String STATE_SUGGESTION_LIST = "suggestion_list";
-
-    private final Context mContext;
-    private final MetricsFeatureProvider mMetricsFeatureProvider;
-    private final IconCache mCache;
-    private final ArrayList<String> mSuggestionsShownLogged;
-    private final SuggestionFeatureProvider mSuggestionFeatureProvider;
-    private final SuggestionControllerMixinCompat mSuggestionControllerMixin;
-    private final Callback mCallback;
-    private final CardConfig mConfig;
-
-    private List<Suggestion> mSuggestions;
-
-    public interface Callback {
-        /**
-         * Called when the close button of the suggestion card is clicked.
-         */
-        void onSuggestionClosed(Suggestion suggestion);
-    }
-
-    public SuggestionAdapter(Context context,
-            SuggestionControllerMixinCompat suggestionControllerMixin, Bundle savedInstanceState,
-            Callback callback, Lifecycle lifecycle) {
-        mContext = context;
-        mSuggestionControllerMixin = suggestionControllerMixin;
-        mCache = new IconCache(context);
-        final FeatureFactory factory = FeatureFactory.getFactory(context);
-        mMetricsFeatureProvider = factory.getMetricsFeatureProvider();
-        mSuggestionFeatureProvider = factory.getSuggestionFeatureProvider(context);
-        mCallback = callback;
-        if (savedInstanceState != null) {
-            mSuggestions = savedInstanceState.getParcelableArrayList(STATE_SUGGESTION_LIST);
-            mSuggestionsShownLogged = savedInstanceState.getStringArrayList(
-                STATE_SUGGESTIONS_SHOWN_LOGGED);
-        } else {
-            mSuggestionsShownLogged = new ArrayList<>();
-        }
-
-        if (lifecycle != null) {
-            lifecycle.addObserver(this);
-        }
-        mConfig = CardConfig.get(context);
-
-        setHasStableIds(true);
-    }
-
-    @Override
-    public DashboardItemHolder onCreateViewHolder(ViewGroup parent, int viewType) {
-        return new DashboardItemHolder(LayoutInflater.from(parent.getContext()).inflate(
-                viewType, parent, false));
-    }
-
-    @Override
-    public void onBindViewHolder(DashboardItemHolder holder, int position) {
-        final Suggestion suggestion = mSuggestions.get(position);
-        final String id = suggestion.getId();
-        final int suggestionCount = mSuggestions.size();
-        if (!mSuggestionsShownLogged.contains(id)) {
-            mMetricsFeatureProvider.action(
-                    mContext, MetricsEvent.ACTION_SHOW_SETTINGS_SUGGESTION, id);
-            mSuggestionsShownLogged.add(id);
-        }
-        final Icon icon = suggestion.getIcon();
-        final Drawable drawable = mCache.getIcon(icon);
-        if (drawable != null && (suggestion.getFlags() & Suggestion.FLAG_ICON_TINTABLE) != 0) {
-            drawable.setTintList(Utils.getColorAccent(mContext));
-        }
-        holder.icon.setImageDrawable(drawable);
-        holder.title.setText(suggestion.getTitle());
-        holder.title.setTypeface(Typeface.create(
-            mContext.getString(com.android.internal.R.string.config_headlineFontFamily),
-            Typeface.NORMAL));
-
-        if (suggestionCount == 1) {
-            final CharSequence summary = suggestion.getSummary();
-            if (!TextUtils.isEmpty(summary)) {
-                holder.summary.setText(summary);
-                holder.summary.setVisibility(View.VISIBLE);
-            } else {
-                holder.summary.setVisibility(View.GONE);
-            }
-        } else {
-            mConfig.setCardLayout(holder, position);
-        }
-
-        final View closeButton = holder.itemView.findViewById(R.id.close_button);
-        if (closeButton != null) {
-            closeButton.setOnClickListener(v -> {
-                mSuggestionFeatureProvider.dismissSuggestion(
-                    mContext, mSuggestionControllerMixin, suggestion);
-                if (mCallback != null) {
-                    mCallback.onSuggestionClosed(suggestion);
-                }
-            });
-        }
-
-        View clickHandler = holder.itemView;
-        // If a view with @android:id/primary is defined, use that as the click handler
-        // instead.
-        final View primaryAction = holder.itemView.findViewById(android.R.id.primary);
-        if (primaryAction != null) {
-            clickHandler = primaryAction;
-        }
-        clickHandler.setOnClickListener(v -> {
-            mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_SETTINGS_SUGGESTION, id);
-            try {
-                suggestion.getPendingIntent().send();
-                mSuggestionControllerMixin.launchSuggestion(suggestion);
-            } catch (PendingIntent.CanceledException e) {
-                Log.w(TAG, "Failed to start suggestion " + suggestion.getTitle());
-            }
-        });
-    }
-
-    @Override
-    public long getItemId(int position) {
-        return Objects.hash(mSuggestions.get(position).getId());
-    }
-
-    @Override
-    public int getItemViewType(int position) {
-        final Suggestion suggestion = getSuggestion(position);
-        if ((suggestion.getFlags() & Suggestion.FLAG_HAS_BUTTON) != 0) {
-            return R.layout.suggestion_tile_with_button;
-        }
-        if (getItemCount() == 1) {
-            return R.layout.suggestion_tile;
-        }
-        return R.layout.suggestion_tile_two_cards;
-    }
-
-    @Override
-    public int getItemCount() {
-        return mSuggestions.size();
-    }
-
-    public Suggestion getSuggestion(int position) {
-        final long itemId = getItemId(position);
-        if (mSuggestions == null) {
-            return null;
-        }
-        for (Suggestion suggestion : mSuggestions) {
-            if (Objects.hash(suggestion.getId()) == itemId) {
-                return suggestion;
-            }
-        }
-        return null;
-    }
-
-    public void removeSuggestion(Suggestion suggestion) {
-        final int position = mSuggestions.indexOf(suggestion);
-        mSuggestions.remove(suggestion);
-        notifyItemRemoved(position);
-    }
-
-    @Override
-    public void onSaveInstanceState(Bundle outState) {
-        if (mSuggestions != null) {
-            outState.putParcelableArrayList(STATE_SUGGESTION_LIST,
-                new ArrayList<>(mSuggestions));
-        }
-        outState.putStringArrayList(STATE_SUGGESTIONS_SHOWN_LOGGED, mSuggestionsShownLogged);
-    }
-
-    public void setSuggestions(List<Suggestion> suggestions) {
-        mSuggestions = suggestions;
-    }
-
-    public List<Suggestion> getSuggestions() {
-        return mSuggestions;
-    }
-
-    @VisibleForTesting
-    static class CardConfig {
-        // Card start/end margin
-        private final int mMarginInner;
-        private final int mMarginOuter;
-        private final WindowManager mWindowManager;
-
-        private static CardConfig sConfig;
-
-        private CardConfig(Context context) {
-            mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
-            final Resources res = context.getResources();
-            mMarginInner =
-                res.getDimensionPixelOffset(R.dimen.suggestion_card_inner_margin);
-            mMarginOuter =
-                res.getDimensionPixelOffset(R.dimen.suggestion_card_outer_margin);
-        }
-
-        public static CardConfig get(Context context) {
-            if (sConfig == null) {
-                sConfig = new CardConfig(context);
-            }
-            return sConfig;
-        }
-
-        @VisibleForTesting
-        void setCardLayout(DashboardItemHolder holder, int position) {
-            final LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
-                getWidthForTwoCrads(), LinearLayout.LayoutParams.WRAP_CONTENT);
-            params.setMarginStart(position == 0 ? mMarginOuter : mMarginInner);
-            params.setMarginEnd(position != 0 ? mMarginOuter : 0);
-            holder.itemView.setLayoutParams(params);
-        }
-
-        private int getWidthForTwoCrads() {
-            return (getScreenWidth() - mMarginInner - mMarginOuter * 2) / 2;
-        }
-
-        @VisibleForTesting
-        int getScreenWidth() {
-            final DisplayMetrics metrics = new DisplayMetrics();
-            mWindowManager.getDefaultDisplay().getMetrics(metrics);
-            return metrics.widthPixels;
-        }
-    }
-
-}
diff --git a/src/com/android/settings/deviceinfo/StorageSettings.java b/src/com/android/settings/deviceinfo/StorageSettings.java
index 58188f1..49d5455 100644
--- a/src/com/android/settings/deviceinfo/StorageSettings.java
+++ b/src/com/android/settings/deviceinfo/StorageSettings.java
@@ -51,7 +51,6 @@
 import com.android.settings.SettingsPreferenceFragment;
 import com.android.settings.core.SubSettingLauncher;
 import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
-import com.android.settings.dashboard.SummaryLoader;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settings.search.Indexable;
 import com.android.settings.search.SearchIndexableRaw;
@@ -61,7 +60,6 @@
 import com.android.settingslib.deviceinfo.StorageManagerVolumeProvider;
 import com.android.settingslib.search.SearchIndexable;
 
-import java.text.NumberFormat;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -542,41 +540,6 @@
         }
     }
 
-    private static class SummaryProvider implements SummaryLoader.SummaryProvider {
-        private final Context mContext;
-        private final SummaryLoader mLoader;
-        private final StorageManagerVolumeProvider mStorageManagerVolumeProvider;
-
-        private SummaryProvider(Context context, SummaryLoader loader) {
-            mContext = context;
-            mLoader = loader;
-            final StorageManager storageManager = mContext.getSystemService(StorageManager.class);
-            mStorageManagerVolumeProvider = new StorageManagerVolumeProvider(storageManager);
-        }
-
-        @Override
-        public void setListening(boolean listening) {
-            if (listening) {
-                updateSummary();
-            }
-        }
-
-        private void updateSummary() {
-            // TODO: Register listener.
-            final NumberFormat percentageFormat = NumberFormat.getPercentInstance();
-            final PrivateStorageInfo info = PrivateStorageInfo.getPrivateStorageInfo(
-                    mStorageManagerVolumeProvider);
-            double privateUsedBytes = info.totalBytes - info.freeBytes;
-            mLoader.setSummary(this, mContext.getString(R.string.storage_summary,
-                    percentageFormat.format(privateUsedBytes / info.totalBytes),
-                    Formatter.formatFileSize(mContext, info.freeBytes)));
-        }
-    }
-
-
-    public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY
-            = (activity, summaryLoader) -> new SummaryProvider(activity, summaryLoader);
-
     /** Enable indexing of searchable data */
     public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
             new BaseSearchIndexProvider() {
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
index 054c66b..f7c31e5 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
@@ -17,9 +17,7 @@
 package com.android.settings.fuelgauge;
 
 import static com.android.settings.fuelgauge.BatteryBroadcastReceiver.BatteryUpdateType;
-import static com.android.settings.fuelgauge.TopLevelBatteryPreferenceController.getDashboardLabel;
 
-import android.app.Activity;
 import android.content.Context;
 import android.os.BatteryStats;
 import android.os.Bundle;
@@ -43,7 +41,6 @@
 import com.android.settings.Utils;
 import com.android.settings.applications.LayoutPreference;
 import com.android.settings.core.SubSettingLauncher;
-import com.android.settings.dashboard.SummaryLoader;
 import com.android.settings.fuelgauge.batterytip.BatteryTipLoader;
 import com.android.settings.fuelgauge.batterytip.BatteryTipPreferenceController;
 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
@@ -389,35 +386,6 @@
         restartBatteryTipLoader();
     }
 
-    private static class SummaryProvider implements SummaryLoader.SummaryProvider {
-        private final Context mContext;
-        private final SummaryLoader mLoader;
-        private final BatteryBroadcastReceiver mBatteryBroadcastReceiver;
-
-        private SummaryProvider(Context context, SummaryLoader loader) {
-            mContext = context;
-            mLoader = loader;
-            mBatteryBroadcastReceiver = new BatteryBroadcastReceiver(mContext);
-            mBatteryBroadcastReceiver.setBatteryChangedListener(type -> {
-                BatteryInfo.getBatteryInfo(mContext, new BatteryInfo.Callback() {
-                    @Override
-                    public void onBatteryInfoLoaded(BatteryInfo info) {
-                        mLoader.setSummary(SummaryProvider.this, getDashboardLabel(mContext, info));
-                    }
-                }, true /* shortString */);
-            });
-        }
-
-        @Override
-        public void setListening(boolean listening) {
-            if (listening) {
-                mBatteryBroadcastReceiver.register();
-            } else {
-                mBatteryBroadcastReceiver.unRegister();
-            }
-        }
-    }
-
 
     public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
             new BaseSearchIndexProvider() {
@@ -429,13 +397,4 @@
                     return Collections.singletonList(sir);
                 }
             };
-
-    public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY
-            = new SummaryLoader.SummaryProviderFactory() {
-        @Override
-        public SummaryLoader.SummaryProvider createSummaryProvider(Activity activity,
-                SummaryLoader summaryLoader) {
-            return new SummaryProvider(activity, summaryLoader);
-        }
-    };
 }
diff --git a/src/com/android/settings/homepage/conditional/ConditionAdapter.java b/src/com/android/settings/homepage/conditional/ConditionAdapter.java
deleted file mode 100644
index a87e4bc..0000000
--- a/src/com/android/settings/homepage/conditional/ConditionAdapter.java
+++ /dev/null
@@ -1,130 +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.homepage.conditional;
-
-import android.content.Context;
-import android.text.TextUtils;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.android.internal.logging.nano.MetricsProto;
-import com.android.settings.R;
-import com.android.settings.dashboard.DashboardAdapter;
-import com.android.settings.overlay.FeatureFactory;
-import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
-
-import java.util.List;
-
-public class ConditionAdapter extends RecyclerView.Adapter<DashboardAdapter.DashboardItemHolder> {
-
-    private final Context mContext;
-    private final MetricsFeatureProvider mMetricsFeatureProvider;
-    private final ConditionManager mConditionManager;
-    private final List<ConditionalCard> mConditions;
-    private final boolean mExpanded;
-
-    public ConditionAdapter(Context context, ConditionManager conditionManager,
-            List<ConditionalCard> conditions, boolean expanded) {
-        mContext = context;
-        mConditionManager = conditionManager;
-        mConditions = conditions;
-        mExpanded = expanded;
-        mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
-
-        setHasStableIds(true);
-    }
-
-    @Override
-    public DashboardAdapter.DashboardItemHolder onCreateViewHolder(ViewGroup parent, int viewType) {
-        return new DashboardAdapter.DashboardItemHolder(LayoutInflater.from(parent.getContext())
-                .inflate(viewType, parent, false));
-    }
-
-    @Override
-    public void onBindViewHolder(DashboardAdapter.DashboardItemHolder holder, int position) {
-        final ConditionalCard condition = mConditions.get(position);
-        final boolean isLastItem = position == mConditions.size() - 1;
-        bindViews(condition, holder, isLastItem);
-    }
-
-    @Override
-    public long getItemId(int position) {
-        return mConditions.get(position).getId();
-    }
-
-    @Override
-    public int getItemViewType(int position) {
-        return R.layout.condition_tile;
-    }
-
-    @Override
-    public int getItemCount() {
-        if (mExpanded) {
-            return mConditions.size();
-        }
-        return 0;
-    }
-
-    private void bindViews(final ConditionalCard condition,
-            DashboardAdapter.DashboardItemHolder view, boolean isLastItem) {
-        mMetricsFeatureProvider.visible(mContext, MetricsProto.MetricsEvent.DASHBOARD_SUMMARY,
-                condition.getMetricsConstant());
-        view.itemView.findViewById(R.id.content).setOnClickListener(
-                v -> {
-                    mMetricsFeatureProvider.action(mContext,
-                            MetricsProto.MetricsEvent.ACTION_SETTINGS_CONDITION_CLICK,
-                            condition.getMetricsConstant());
-                    mConditionManager.onPrimaryClick(mContext, condition.getId());
-                });
-        view.icon.setImageDrawable(condition.getIcon());
-        view.title.setText(condition.getTitle());
-        view.summary.setText(condition.getSummary());
-
-        setViewVisibility(view.itemView, R.id.divider, !isLastItem);
-
-        final CharSequence action = condition.getActionText();
-        final boolean hasButtons = !TextUtils.isEmpty(action);
-        setViewVisibility(view.itemView, R.id.buttonBar, hasButtons);
-
-        final Button button = view.itemView.findViewById(R.id.first_action);
-        if (hasButtons) {
-            button.setVisibility(View.VISIBLE);
-            button.setText(action);
-            button.setOnClickListener(v -> {
-                final Context context = v.getContext();
-                mMetricsFeatureProvider.action(
-                        context, MetricsProto.MetricsEvent.ACTION_SETTINGS_CONDITION_BUTTON,
-                        condition.getMetricsConstant());
-                mConditionManager.onActionClick(condition.getId());
-            });
-        } else {
-            button.setVisibility(View.GONE);
-        }
-
-    }
-
-    private void setViewVisibility(View containerView, int viewId, boolean visible) {
-        View view = containerView.findViewById(viewId);
-        if (view != null) {
-            view.setVisibility(visible ? View.VISIBLE : View.GONE);
-        }
-    }
-}
diff --git a/src/com/android/settings/network/NetworkDashboardFragment.java b/src/com/android/settings/network/NetworkDashboardFragment.java
index 0279cfa..9706ba0 100644
--- a/src/com/android/settings/network/NetworkDashboardFragment.java
+++ b/src/com/android/settings/network/NetworkDashboardFragment.java
@@ -15,29 +15,20 @@
  */
 package com.android.settings.network;
 
-import static android.provider.Settings.ACTION_DATA_USAGE_SETTINGS;
 import static com.android.settings.network.MobilePlanPreferenceController
         .MANAGE_MOBILE_PLAN_DIALOG_ID;
 
-import android.app.Activity;
 import android.app.Dialog;
 import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.icu.text.ListFormatter;
 import android.provider.SearchIndexableResource;
-import android.text.BidiFormatter;
-import android.text.TextUtils;
 import android.util.Log;
 
-import androidx.annotation.VisibleForTesting;
 import androidx.appcompat.app.AlertDialog;
 import androidx.fragment.app.Fragment;
 
 import com.android.internal.logging.nano.MetricsProto;
 import com.android.settings.R;
 import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.dashboard.SummaryLoader;
 import com.android.settings.network.MobilePlanPreferenceController.MobilePlanPreferenceHost;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settings.wifi.WifiMasterSwitchPreferenceController;
@@ -48,7 +39,6 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.function.BooleanSupplier;
 import java.util.List;
 
 @SearchIndexable
@@ -153,84 +143,6 @@
         return 0;
     }
 
-    // TODO(b/110405144): Remove SummaryProvider
-    @VisibleForTesting
-    static class SummaryProvider implements SummaryLoader.SummaryProvider {
-
-        private final Context mContext;
-        private final SummaryLoader mSummaryLoader;
-        private final WifiMasterSwitchPreferenceController mWifiPreferenceController;
-        private final MobileNetworkPreferenceController mMobileNetworkPreferenceController;
-        private final TetherPreferenceController mTetherPreferenceController;
-        private final BooleanSupplier mHasDataUsageActivity;
-
-        public SummaryProvider(Context context, SummaryLoader summaryLoader) {
-            this(context, summaryLoader,
-                    new WifiMasterSwitchPreferenceController(context, null),
-                    new MobileNetworkPreferenceController(context),
-                    new TetherPreferenceController(context, null /* lifecycle */),
-                    () -> {
-                        final Intent intent = new Intent(ACTION_DATA_USAGE_SETTINGS);
-                        final PackageManager pm = context.getPackageManager();
-                        return intent.resolveActivity(pm) != null;
-                    });
-        }
-
-        @VisibleForTesting(otherwise = VisibleForTesting.NONE)
-        SummaryProvider(Context context, SummaryLoader summaryLoader,
-                WifiMasterSwitchPreferenceController wifiPreferenceController,
-                MobileNetworkPreferenceController mobileNetworkPreferenceController,
-                TetherPreferenceController tetherPreferenceController,
-                BooleanSupplier hasDataUsageActivity) {
-            mContext = context;
-            mSummaryLoader = summaryLoader;
-            mWifiPreferenceController = wifiPreferenceController;
-            mMobileNetworkPreferenceController = mobileNetworkPreferenceController;
-            mTetherPreferenceController = tetherPreferenceController;
-            mHasDataUsageActivity = hasDataUsageActivity;
-        }
-
-
-        @Override
-        public void setListening(boolean listening) {
-            if (listening) {
-                final String wifiSummary = BidiFormatter.getInstance()
-                    .unicodeWrap(mContext.getString(R.string.wifi_settings_title));
-                final String mobileSummary = mContext.getString(
-                    R.string.network_dashboard_summary_mobile);
-                final String dataUsageSummary = mContext.getString(
-                    R.string.network_dashboard_summary_data_usage);
-                final String hotspotSummary = mContext.getString(
-                    R.string.network_dashboard_summary_hotspot);
-
-                final List<String> summaries = new ArrayList<>();
-                if (mWifiPreferenceController.isAvailable() && !TextUtils.isEmpty(wifiSummary)) {
-                    summaries.add(wifiSummary);
-                }
-                if (mMobileNetworkPreferenceController.isAvailable() && !TextUtils.isEmpty(mobileSummary)) {
-                    summaries.add(mobileSummary);
-                }
-                if (!TextUtils.isEmpty(dataUsageSummary) && mHasDataUsageActivity.getAsBoolean()) {
-                    summaries.add(dataUsageSummary);
-                }
-                if (mTetherPreferenceController.isAvailable() && !TextUtils.isEmpty(hotspotSummary)) {
-                    summaries.add(hotspotSummary);
-                }
-                mSummaryLoader.setSummary(this, ListFormatter.getInstance().format(summaries));
-            }
-        }
-    }
-
-    public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY
-            = new SummaryLoader.SummaryProviderFactory() {
-        @Override
-        public SummaryLoader.SummaryProvider createSummaryProvider(Activity activity,
-                SummaryLoader summaryLoader) {
-            return new SummaryProvider(activity, summaryLoader);
-        }
-    };
-
-
     public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
             new BaseSearchIndexProvider() {
                 @Override
diff --git a/src/com/android/settings/network/telephony/ApnPreferenceController.java b/src/com/android/settings/network/telephony/ApnPreferenceController.java
new file mode 100644
index 0000000..e02d9d4
--- /dev/null
+++ b/src/com/android/settings/network/telephony/ApnPreferenceController.java
@@ -0,0 +1,143 @@
+/*
+ * 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.network.telephony;
+
+import static android.provider.Telephony.Carriers.ENFORCE_MANAGED_URI;
+
+import android.content.Context;
+import android.content.Intent;
+import android.database.ContentObserver;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.PersistableBundle;
+import android.provider.Settings;
+import android.telephony.CarrierConfigManager;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.SettingsActivity;
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.network.ApnSettings;
+import com.android.settingslib.RestrictedLockUtilsInternal;
+import com.android.settingslib.RestrictedPreference;
+import com.android.settingslib.core.lifecycle.LifecycleObserver;
+import com.android.settingslib.core.lifecycle.events.OnStart;
+import com.android.settingslib.core.lifecycle.events.OnStop;
+
+/**
+ * Preference controller for "Apn settings"
+ */
+public class ApnPreferenceController extends BasePreferenceController implements
+        LifecycleObserver, OnStart, OnStop {
+
+    @VisibleForTesting
+    CarrierConfigManager mCarrierConfigManager;
+    private int mSubId;
+    private Preference mPreference;
+    private DpcApnEnforcedObserver mDpcApnEnforcedObserver;
+
+    public ApnPreferenceController(Context context, String key) {
+        super(context, key);
+        mCarrierConfigManager = new CarrierConfigManager(context);
+        mDpcApnEnforcedObserver = new DpcApnEnforcedObserver(new Handler(Looper.getMainLooper()));
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSubId);
+        final boolean isCdmaApn = MobileNetworkUtils.isCdmaOptions(mContext, mSubId)
+                && carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_APN_SETTING_CDMA_BOOL);
+        final boolean isGsmApn = MobileNetworkUtils.isGsmOptions(mContext, mSubId)
+                && carrierConfig.getBoolean(CarrierConfigManager.KEY_APN_EXPAND_BOOL);
+
+        return carrierConfig != null
+                && (isCdmaApn || isGsmApn)
+                ? AVAILABLE
+                : CONDITIONALLY_UNAVAILABLE;
+    }
+
+    @Override
+    public void onStart() {
+        mDpcApnEnforcedObserver.register(mContext);
+    }
+
+    @Override
+    public void onStop() {
+        mDpcApnEnforcedObserver.unRegister(mContext);
+    }
+
+    @Override
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+        mPreference = screen.findPreference(getPreferenceKey());
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        super.updateState(preference);
+        ((RestrictedPreference) mPreference).setDisabledByAdmin(
+                MobileNetworkUtils.isDpcApnEnforced(mContext)
+                        ? RestrictedLockUtilsInternal.getDeviceOwner(mContext)
+                        : null);
+    }
+
+    @Override
+    public boolean handlePreferenceTreeClick(Preference preference) {
+        if (getPreferenceKey().equals(preference.getKey())) {
+            // This activity runs in phone process, we must use intent to start
+            final Intent intent = new Intent(Settings.ACTION_APN_SETTINGS);
+            // This will setup the Home and Search affordance
+            intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_AS_SUBSETTING, true);
+            intent.putExtra(ApnSettings.SUB_ID, mSubId);
+            mContext.startActivity(intent);
+            return true;
+        }
+
+        return false;
+    }
+
+    public void init(int subId) {
+        mSubId = subId;
+    }
+
+    @VisibleForTesting
+    void setPreference(Preference preference) {
+        mPreference = preference;
+    }
+
+    private class DpcApnEnforcedObserver extends ContentObserver {
+        DpcApnEnforcedObserver(Handler handler) {
+            super(handler);
+        }
+
+        public void register(Context context) {
+            context.getContentResolver().registerContentObserver(ENFORCE_MANAGED_URI, false, this);
+
+        }
+
+        public void unRegister(Context context) {
+            context.getContentResolver().unregisterContentObserver(this);
+        }
+
+        @Override
+        public void onChange(boolean selfChange) {
+            updateState(mPreference);
+        }
+    }
+}
diff --git a/src/com/android/settings/network/telephony/GsmUmtsOptions.java b/src/com/android/settings/network/telephony/GsmUmtsOptions.java
deleted file mode 100644
index 9b3df6b..0000000
--- a/src/com/android/settings/network/telephony/GsmUmtsOptions.java
+++ /dev/null
@@ -1,180 +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.network.telephony;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.PersistableBundle;
-import android.provider.Settings;
-import android.telephony.CarrierConfigManager;
-import android.telephony.TelephonyManager;
-
-import androidx.preference.Preference;
-import androidx.preference.PreferenceFragmentCompat;
-import androidx.preference.PreferenceScreen;
-
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneConstants;
-import com.android.settings.R;
-import com.android.settingslib.RestrictedLockUtilsInternal;
-import com.android.settingslib.RestrictedPreference;
-
-/**
- * List of Network-specific settings screens.
- */
-public class GsmUmtsOptions {
-    private static final String LOG_TAG = "GsmUmtsOptions";
-
-    private CarrierConfigManager mCarrierConfigManager;
-    private RestrictedPreference mButtonAPNExpand;
-    private Preference mCategoryAPNExpand;
-    Preference mCarrierSettingPref;
-
-    private NetworkOperators mNetworkOperator;
-
-    private static final String BUTTON_APN_EXPAND_KEY = "button_gsm_apn_key";
-    private static final String CATEGORY_APN_EXPAND_KEY = "category_gsm_apn_key";
-    private static final String BUTTON_CARRIER_SETTINGS_KEY = "carrier_settings_key";
-
-    public static final String EXTRA_SUB_ID = "sub_id";
-    private PreferenceFragmentCompat mPrefFragment;
-    private PreferenceScreen mPrefScreen;
-
-    public GsmUmtsOptions(PreferenceFragmentCompat prefFragment, PreferenceScreen prefScreen,
-            final int subId) {
-        final Context context = prefFragment.getContext();
-        mPrefFragment = prefFragment;
-        mPrefScreen = prefScreen;
-        mCarrierConfigManager = new CarrierConfigManager(context);
-        mPrefFragment.addPreferencesFromResource(R.xml.gsm_umts_options);
-        mButtonAPNExpand = (RestrictedPreference) mPrefScreen.findPreference(BUTTON_APN_EXPAND_KEY);
-        mCategoryAPNExpand = mPrefScreen.findPreference(CATEGORY_APN_EXPAND_KEY);
-        mNetworkOperator = (NetworkOperators) mPrefScreen
-                .findPreference(NetworkOperators.CATEGORY_NETWORK_OPERATORS_KEY);
-        mCarrierSettingPref = mPrefScreen.findPreference(BUTTON_CARRIER_SETTINGS_KEY);
-
-        mNetworkOperator.initialize();
-
-        update(subId);
-    }
-
-    // Unlike mPrefFragment or mPrefScreen, subId  may change during lifecycle of GsmUmtsOptions.
-    // When that happens, we update GsmUmtsOptions with new parameters.
-    protected void update(final int subId) {
-        boolean addAPNExpand = true;
-        boolean addNetworkOperatorsCategory = true;
-        boolean addCarrierSettings = true;
-        final TelephonyManager telephonyManager = TelephonyManager.from(mPrefFragment.getContext())
-                .createForSubscriptionId(subId);
-        //TODO(b/115429509): Get phone from subId
-        Phone phone = null;
-        if (phone == null) return;
-        if (telephonyManager.getPhoneType() != PhoneConstants.PHONE_TYPE_GSM) {
-            log("Not a GSM phone");
-            addAPNExpand = false;
-            mNetworkOperator.setEnabled(false);
-        } else {
-            log("Not a CDMA phone");
-            PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(subId);
-
-            // Determine which options to display. For GSM these are defaulted to true in
-            // CarrierConfigManager, but they maybe overriden by DefaultCarrierConfigService or a
-            // carrier app.
-            // Note: these settings used to be controlled with overlays in
-            // Telephony/res/values/config.xml
-            if (!carrierConfig.getBoolean(CarrierConfigManager.KEY_APN_EXPAND_BOOL)
-                    && mCategoryAPNExpand != null) {
-                addAPNExpand = false;
-            }
-            if (!carrierConfig.getBoolean(
-                    CarrierConfigManager.KEY_OPERATOR_SELECTION_EXPAND_BOOL)) {
-                addNetworkOperatorsCategory = false;
-            }
-
-            if (carrierConfig.getBoolean(CarrierConfigManager.KEY_CSP_ENABLED_BOOL)) {
-                if (phone.isCspPlmnEnabled()) {
-                    log("[CSP] Enabling Operator Selection menu.");
-                    mNetworkOperator.setEnabled(true);
-                } else {
-                    log("[CSP] Disabling Operator Selection menu.");
-                    addNetworkOperatorsCategory = false;
-                }
-            }
-
-            // Read platform settings for carrier settings
-            addCarrierSettings = carrierConfig.getBoolean(
-                    CarrierConfigManager.KEY_CARRIER_SETTINGS_ENABLE_BOOL);
-        }
-
-        // Making no assumptions of whether they are added or removed at this point.
-        // Calling add or remove explicitly to make sure they are updated.
-
-        if (addAPNExpand) {
-            log("update: addAPNExpand");
-            mButtonAPNExpand.setDisabledByAdmin(
-                    MobileNetworkUtils.isDpcApnEnforced(mButtonAPNExpand.getContext())
-                            ? RestrictedLockUtilsInternal.getDeviceOwner(
-                            mButtonAPNExpand.getContext())
-                            : null);
-            mButtonAPNExpand.setOnPreferenceClickListener(
-                    new Preference.OnPreferenceClickListener() {
-                        @Override
-                        public boolean onPreferenceClick(Preference preference) {
-                            MetricsLogger.action(mButtonAPNExpand.getContext(),
-                                    MetricsEvent.ACTION_MOBILE_NETWORK_APN_SETTINGS);
-                            // We need to build the Intent by hand as the Preference Framework
-                            // does not allow to add an Intent with some extras into a Preference
-                            // XML file
-                            final Intent intent = new Intent(Settings.ACTION_APN_SETTINGS);
-                            // This will setup the Home and Search affordance
-                            intent.putExtra(":settings:show_fragment_as_subsetting", true);
-                            intent.putExtra(EXTRA_SUB_ID, subId);
-                            mPrefFragment.startActivity(intent);
-                            return true;
-                        }
-                    });
-            mPrefScreen.addPreference(mCategoryAPNExpand);
-        } else {
-            mPrefScreen.removePreference(mCategoryAPNExpand);
-        }
-
-        if (addNetworkOperatorsCategory) {
-            mPrefScreen.addPreference(mNetworkOperator);
-            mNetworkOperator.update(subId);
-        } else {
-            mPrefScreen.removePreference(mNetworkOperator);
-        }
-
-        if (addCarrierSettings) {
-            mPrefScreen.addPreference(mCarrierSettingPref);
-        } else {
-            mPrefScreen.removePreference(mCarrierSettingPref);
-        }
-
-    }
-
-    protected boolean preferenceTreeClick(Preference preference) {
-        return mNetworkOperator.preferenceTreeClick(preference);
-    }
-
-    protected void log(String s) {
-        android.util.Log.d(LOG_TAG, s);
-    }
-}
-
diff --git a/src/com/android/settings/network/telephony/MobileNetworkFragment.java b/src/com/android/settings/network/telephony/MobileNetworkFragment.java
index 4b1e27a..df6c7ab 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkFragment.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkFragment.java
@@ -16,128 +16,65 @@
 
 package com.android.settings.network.telephony;
 
-import static android.provider.Telephony.Carriers.ENFORCE_MANAGED_URI;
-
-import android.app.ActionBar;
 import android.app.Activity;
-import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.database.ContentObserver;
 import android.os.Bundle;
-import android.os.PersistableBundle;
 import android.os.UserManager;
 import android.provider.SearchIndexableResource;
-import android.telecom.PhoneAccountHandle;
-import android.telecom.TelecomManager;
-import android.telephony.CarrierConfigManager;
-import android.telephony.ServiceState;
-import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
 import android.util.Log;
-import android.view.MenuItem;
 
 import androidx.annotation.VisibleForTesting;
-import androidx.fragment.app.FragmentActivity;
 import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
-import androidx.preference.PreferenceFragmentCompat;
-import androidx.preference.PreferenceScreen;
 
-import com.android.ims.ImsManager;
-import com.android.internal.logging.MetricsLogger;
 import com.android.internal.logging.nano.MetricsProto;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.TelephonyIntents;
 import com.android.settings.R;
-import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.network.telephony.cdma.CdmaApnPreferenceController;
+import com.android.settings.dashboard.RestrictedDashboardFragment;
 import com.android.settings.network.telephony.cdma.CdmaSubscriptionPreferenceController;
 import com.android.settings.network.telephony.cdma.CdmaSystemSelectPreferenceController;
+import com.android.settings.network.telephony.gsm.AutoSelectPreferenceController;
+import com.android.settings.network.telephony.gsm.OpenNetworkSelectPagePreferenceController;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settings.search.Indexable;
+import com.android.settings.widget.PreferenceCategoryController;
 import com.android.settingslib.search.SearchIndexable;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
-public class MobileNetworkFragment extends DashboardFragment implements
-        Preference.OnPreferenceChangeListener {
+public class MobileNetworkFragment extends RestrictedDashboardFragment {
 
-    // debug data
     private static final String LOG_TAG = "NetworkSettings";
-    private static final boolean DBG = true;
     public static final int REQUEST_CODE_EXIT_ECM = 17;
     @VisibleForTesting
     static final String KEY_CLICKED_PREF = "key_clicked_pref";
 
     //String keys for preference lookup
-    private static final String BUTTON_PREFERED_NETWORK_MODE = "preferred_network_mode_key";
-    private static final String BUTTON_ROAMING_KEY = "button_roaming_key";
-    private static final String BUTTON_CDMA_LTE_DATA_SERVICE_KEY = "cdma_lte_data_service_key";
-    private static final String BUTTON_ENABLED_NETWORKS_KEY = "enabled_networks_key";
-    private static final String BUTTON_4G_LTE_KEY = "enhanced_4g_lte";
-    private static final String BUTTON_CELL_BROADCAST_SETTINGS = "cell_broadcast_settings";
-    private static final String BUTTON_CARRIER_SETTINGS_KEY = "carrier_settings_key";
     private static final String BUTTON_CDMA_SYSTEM_SELECT_KEY = "cdma_system_select_key";
     private static final String BUTTON_CDMA_SUBSCRIPTION_KEY = "cdma_subscription_key";
-    private static final String BUTTON_CARRIER_SETTINGS_EUICC_KEY =
-            "carrier_settings_euicc_key";
-    private static final String BUTTON_MOBILE_DATA_ENABLE_KEY = "mobile_data_enable";
-    private static final String BUTTON_DATA_USAGE_KEY = "data_usage_summary";
-    private static final String BUTTON_ADVANCED_OPTIONS_KEY = "advanced_options";
-    private static final String CATEGORY_CALLING_KEY = "calling";
-    private static final String CATEGORY_GSM_APN_EXPAND_KEY = "category_gsm_apn_key";
-    private static final String CATEGORY_CDMA_APN_EXPAND_KEY = "category_cdma_apn_key";
-    private static final String BUTTON_GSM_APN_EXPAND_KEY = "button_gsm_apn_key";
-    private static final String BUTTON_CDMA_APN_EXPAND_KEY = "button_cdma_apn_key";
 
-    private static final String EXTRA_EXIT_ECM_RESULT = "exit_ecm_result";
-    private static final String LEGACY_ACTION_CONFIGURE_PHONE_ACCOUNT =
-            "android.telecom.action.CONNECTION_SERVICE_CONFIGURE";
-
-    private final BroadcastReceiver
-            mPhoneChangeReceiver = new PhoneChangeReceiver();
-    private final ContentObserver
-            mDpcEnforcedContentObserver = new DpcApnEnforcedObserver();
-
-    static final int preferredNetworkMode = Phone.PREFERRED_NT_MODE;
-
-    private SubscriptionManager mSubscriptionManager;
     private TelephonyManager mTelephonyManager;
-    private CarrierConfigManager mCarrierConfigManager;
-    private int mSubId;
+    private int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
 
     private CdmaSystemSelectPreferenceController mCdmaSystemSelectPreferenceController;
     private CdmaSubscriptionPreferenceController mCdmaSubscriptionPreferenceController;
 
-    private static final String iface = "rmnet0"; //TODO: this will go away
-    private List<SubscriptionInfo> mActiveSubInfos;
-
-    private UserManager mUm;
-    private ImsManager mImsMgr;
-    private boolean mOkClicked;
-
-    //GsmUmts options and Cdma options
-    GsmUmtsOptions mGsmUmtsOptions;
-
+    private UserManager mUserManager;
     private String mClickedPrefKey;
-    private boolean mShow4GForLTE;
-    private boolean mIsGlobalCdma;
-    private boolean mOnlyAutoSelectInHomeNW;
-    private boolean mUnavailable;
+
+    public MobileNetworkFragment() {
+        super(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS);
+    }
 
     @Override
     public int getMetricsCategory() {
-        //TODO(b/114749736): add metrics id for it
-        return 0;
+        return MetricsProto.MetricsEvent.MOBILE_NETWORK;
     }
 
     /**
@@ -150,16 +87,9 @@
         if (super.onPreferenceTreeClick(preference)) {
             return true;
         }
-        sendMetricsEventPreferenceClicked(getPreferenceScreen(), preference);
         final String key = preference.getKey();
 
-        /** TODO: Refactor and get rid of the if's using subclasses */
-        if (preference.getKey().equals(BUTTON_4G_LTE_KEY)) {
-            return true;
-        } else if (mGsmUmtsOptions != null &&
-                mGsmUmtsOptions.preferenceTreeClick(preference) == true) {
-            return true;
-        } else if (TextUtils.equals(key, BUTTON_CDMA_SYSTEM_SELECT_KEY)
+        if (TextUtils.equals(key, BUTTON_CDMA_SYSTEM_SELECT_KEY)
                 || TextUtils.equals(key, BUTTON_CDMA_SUBSCRIPTION_KEY)) {
             if (mTelephonyManager.getEmergencyCallbackMode()) {
                 startActivityForResult(
@@ -173,35 +103,6 @@
         return false;
     }
 
-    private final SubscriptionManager.OnSubscriptionsChangedListener
-            mOnSubscriptionsChangeListener
-            = new SubscriptionManager.OnSubscriptionsChangedListener() {
-        @Override
-        public void onSubscriptionsChanged() {
-            if (DBG) log("onSubscriptionsChanged:");
-            initializeSubscriptions();
-        }
-    };
-
-    private void initializeSubscriptions() {
-        final FragmentActivity activity = getActivity();
-        if (activity == null) {
-            // Process preferences in activity only if its not destroyed
-            return;
-        }
-        updatePhone();
-        updateBody();
-        if (DBG) log("initializeSubscriptions:-");
-    }
-
-    private void updatePhone() {
-        if (mSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
-            mImsMgr = ImsManager.getInstance(getContext(),
-                    SubscriptionManager.getPhoneId(mSubId));
-            mTelephonyManager = new TelephonyManager(getContext(), mSubId);
-        }
-    }
-
     @Override
     public void onAttach(Context context) {
         super.onAttach(context);
@@ -210,7 +111,7 @@
 
         use(MobileDataPreferenceController.class).init(getFragmentManager(), mSubId);
         use(RoamingPreferenceController.class).init(getFragmentManager(), mSubId);
-        use(CdmaApnPreferenceController.class).init(mSubId);
+        use(ApnPreferenceController.class).init(mSubId);
         use(CarrierPreferenceController.class).init(mSubId);
         use(DataUsagePreferenceController.class).init(mSubId);
         use(PreferredNetworkModePreferenceController.class).init(mSubId);
@@ -219,6 +120,15 @@
         use(EuiccPreferenceController.class).init(mSubId);
         use(WifiCallingPreferenceController.class).init(mSubId);
 
+        final OpenNetworkSelectPagePreferenceController openNetworkSelectPagePreferenceController =
+                use(OpenNetworkSelectPagePreferenceController.class).init(mSubId);
+        final AutoSelectPreferenceController autoSelectPreferenceController =
+                use(AutoSelectPreferenceController.class)
+                        .init(mSubId)
+                        .addListener(openNetworkSelectPagePreferenceController);
+        use(PreferenceCategoryController.class).setChildren(
+                Arrays.asList(autoSelectPreferenceController));
+
         mCdmaSystemSelectPreferenceController = use(CdmaSystemSelectPreferenceController.class);
         mCdmaSystemSelectPreferenceController.init(getPreferenceManager(), mSubId);
         mCdmaSubscriptionPreferenceController = use(CdmaSubscriptionPreferenceController.class);
@@ -236,33 +146,8 @@
         super.onCreate(icicle);
         final Context context = getContext();
 
-        if (context == null) {
-            Log.e(LOG_TAG, "onCreate:- with no valid activity.");
-            return;
-        }
-
-        mUm = (UserManager) context.getSystemService(Context.USER_SERVICE);
-        mSubscriptionManager = SubscriptionManager.from(context);
-        mTelephonyManager = (TelephonyManager) context.getSystemService(
-                Context.TELEPHONY_SERVICE);
-        mCarrierConfigManager = new CarrierConfigManager(getContext());
-
-        try {
-            Context con = context.createPackageContext("com.android.systemui", 0);
-            int id = con.getResources().getIdentifier("config_show4GForLTE",
-                    "bool", "com.android.systemui");
-            mShow4GForLTE = con.getResources().getBoolean(id);
-        } catch (PackageManager.NameNotFoundException e) {
-            Log.e(LOG_TAG, "NameNotFoundException for show4GFotLTE");
-            mShow4GForLTE = false;
-        }
-
-        // Initialize mActiveSubInfo
-        int max = mSubscriptionManager.getActiveSubscriptionInfoCountMax();
-        mActiveSubInfos = mSubscriptionManager.getActiveSubscriptionInfoList();
-
-        updatePhone();
-        Log.i(LOG_TAG, "onCreate:-");
+        mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
+        mTelephonyManager = TelephonyManager.from(context).createForSubscriptionId(mSubId);
 
         onRestoreInstance(icicle);
     }
@@ -275,81 +160,13 @@
     }
 
     @Override
-    public void onActivityCreated(Bundle savedInstanceState) {
-        super.onActivityCreated(savedInstanceState);
-        if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)
-                || !mUm.isSystemUser()) {
-            mUnavailable = true;
-            //TODO(b/114749736): migrate telephony_disallowed_preference_screen.xml
-        } else {
-            initializeSubscriptions();
-        }
-    }
-
-    private class PhoneChangeReceiver extends BroadcastReceiver {
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            Log.i(LOG_TAG, "onReceive:");
-            if (getActivity() == null || getContext() == null) {
-                // Received broadcast and activity is in the process of being torn down.
-                return;
-            }
-            // When the radio changes (ex: CDMA->GSM), refresh all options.
-            updateBody();
-        }
-    }
-
-    private class DpcApnEnforcedObserver extends ContentObserver {
-        DpcApnEnforcedObserver() {
-            super(null);
-        }
-
-        @Override
-        public void onChange(boolean selfChange) {
-            Log.i(LOG_TAG, "DPC enforced onChange:");
-            if (getActivity() == null || getContext() == null) {
-                // Received content change and activity is in the process of being torn down.
-                return;
-            }
-            updateBody();
-        }
-    }
-
-    @Override
-    public void onResume() {
-        super.onResume();
-        Log.i(LOG_TAG, "onResume:+");
-
-        if (mUnavailable) {
-            Log.i(LOG_TAG, "onResume:- ignore mUnavailable == false");
-            return;
-        }
-
-        // upon resumption from the sub-activity, make sure we re-enable the
-        // preferences.
-        getPreferenceScreen().setEnabled(true);
-
-        mSubscriptionManager.addOnSubscriptionsChangedListener(mOnSubscriptionsChangeListener);
-
-        final Context context = getContext();
-        IntentFilter intentFilter = new IntentFilter(
-                TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED);
-        context.registerReceiver(mPhoneChangeReceiver, intentFilter);
-        context.getContentResolver().registerContentObserver(ENFORCE_MANAGED_URI, false,
-                mDpcEnforcedContentObserver);
-
-        Log.i(LOG_TAG, "onResume:-");
-
-    }
-
-    @Override
     protected int getPreferenceScreenResId() {
         return R.xml.network_setting_fragment;
     }
 
     @Override
     protected String getLogTag() {
-        return null;
+        return LOG_TAG;
     }
 
     @Override
@@ -358,174 +175,6 @@
         outState.putString(KEY_CLICKED_PREF, mClickedPrefKey);
     }
 
-    private boolean hasActiveSubscriptions() {
-        return mSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID;
-    }
-
-    private void updateBodyBasicFields(FragmentActivity activity, PreferenceScreen prefSet,
-            int phoneSubId, boolean hasActiveSubscriptions) {
-        Context context = getContext();
-
-        ActionBar actionBar = activity.getActionBar();
-        if (actionBar != null) {
-            // android.R.id.home will be triggered in onOptionsItemSelected()
-            actionBar.setDisplayHomeAsUpEnabled(true);
-        }
-    }
-
-    private void updateBody() {
-        final FragmentActivity activity = getActivity();
-        final PreferenceScreen prefSet = getPreferenceScreen();
-        final boolean hasActiveSubscriptions = hasActiveSubscriptions();
-
-        if (activity == null) {
-            Log.e(LOG_TAG, "updateBody with no valid activity.");
-            return;
-        }
-
-        if (prefSet == null) {
-            Log.e(LOG_TAG, "updateBody with no null prefSet.");
-            return;
-        }
-
-        updateBodyBasicFields(activity, prefSet, mSubId, hasActiveSubscriptions);
-
-        if (hasActiveSubscriptions) {
-            updateBodyAdvancedFields(activity, prefSet, mSubId, hasActiveSubscriptions);
-        }
-    }
-
-    private void updateBodyAdvancedFields(FragmentActivity activity, PreferenceScreen prefSet,
-            int phoneSubId, boolean hasActiveSubscriptions) {
-        boolean isLteOnCdma = mTelephonyManager.getLteOnCdmaMode()
-                == PhoneConstants.LTE_ON_CDMA_TRUE;
-
-        if (DBG) {
-            log("updateBody: isLteOnCdma=" + isLteOnCdma + " phoneSubId=" + phoneSubId);
-        }
-
-        int settingsNetworkMode = android.provider.Settings.Global.getInt(
-                getContext().getContentResolver(),
-                android.provider.Settings.Global.PREFERRED_NETWORK_MODE + phoneSubId,
-                preferredNetworkMode);
-
-        PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSubId);
-        mIsGlobalCdma = isLteOnCdma
-                && carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_CDMA_CHOICES_BOOL);
-        if (carrierConfig.getBoolean(
-                CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL)) {
-        } else if (carrierConfig.getBoolean(CarrierConfigManager
-                .KEY_HIDE_PREFERRED_NETWORK_TYPE_BOOL)
-                && !mTelephonyManager.getServiceState().getRoaming()
-                && mTelephonyManager.getServiceState().getDataRegState()
-                == ServiceState.STATE_IN_SERVICE) {
-
-            final int phoneType = mTelephonyManager.getPhoneType();
-            if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
-                updateGsmUmtsOptions(this, prefSet, phoneSubId);
-            } else {
-                throw new IllegalStateException("Unexpected phone type: " + phoneType);
-            }
-            // Since pref is being hidden from user, set network mode to default
-            // in case it is currently something else. That is possible if user
-            // changed the setting while roaming and is now back to home network.
-            settingsNetworkMode = preferredNetworkMode;
-        } else if (carrierConfig.getBoolean(CarrierConfigManager.KEY_WORLD_PHONE_BOOL)) {
-            // set the listener for the mButtonPreferredNetworkMode list preference so we can issue
-            // change Preferred Network Mode.
-
-            updateGsmUmtsOptions(this, prefSet, phoneSubId);
-        }
-
-        final boolean missingDataServiceUrl = TextUtils.isEmpty(
-                android.provider.Settings.Global.getString(activity.getContentResolver(),
-                        android.provider.Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL));
-
-        // Enable link to CMAS app settings depending on the value in config.xml.
-        final boolean isCellBroadcastAppLinkEnabled = activity.getResources().getBoolean(
-                com.android.internal.R.bool.config_cellBroadcastAppLinks);
-        if (!mUm.isAdminUser() || !isCellBroadcastAppLinkEnabled
-                || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_CELL_BROADCASTS)) {
-            PreferenceScreen root = getPreferenceScreen();
-            Preference ps = findPreference(BUTTON_CELL_BROADCAST_SETTINGS);
-            if (ps != null) {
-                root.removePreference(ps);
-            }
-        }
-
-        mOnlyAutoSelectInHomeNW = carrierConfig.getBoolean(
-                CarrierConfigManager.KEY_ONLY_AUTO_SELECT_IN_HOME_NETWORK_BOOL);
-        Preference ps;
-        ps = findPreference(BUTTON_CELL_BROADCAST_SETTINGS);
-        if (ps != null) {
-            ps.setEnabled(hasActiveSubscriptions);
-        }
-        ps = findPreference(CATEGORY_GSM_APN_EXPAND_KEY);
-        if (ps != null) {
-            ps.setEnabled(hasActiveSubscriptions);
-        }
-        ps = findPreference(CATEGORY_CDMA_APN_EXPAND_KEY);
-        if (ps != null) {
-            ps.setEnabled(hasActiveSubscriptions);
-        }
-        ps = findPreference(NetworkOperators.CATEGORY_NETWORK_OPERATORS_KEY);
-        if (ps != null) {
-            ps.setEnabled(hasActiveSubscriptions);
-        }
-        ps = findPreference(BUTTON_CARRIER_SETTINGS_KEY);
-        if (ps != null) {
-            ps.setEnabled(hasActiveSubscriptions);
-        }
-        ps = findPreference(CATEGORY_CALLING_KEY);
-        if (ps != null) {
-            ps.setEnabled(hasActiveSubscriptions);
-        }
-        ps = findPreference(NetworkOperators.BUTTON_AUTO_SELECT_KEY);
-        if (ps != null) {
-            ps.setSummary(null);
-            if (mTelephonyManager.getServiceState().getRoaming()) {
-                ps.setEnabled(true);
-            } else {
-                ps.setEnabled(!mOnlyAutoSelectInHomeNW);
-                if (mOnlyAutoSelectInHomeNW) {
-                    ps.setSummary(getResources().getString(
-                            R.string.manual_mode_disallowed_summary,
-                            mTelephonyManager.getSimOperatorName()));
-                }
-            }
-        }
-    }
-
-    @Override
-    public void onPause() {
-        super.onPause();
-        if (DBG) log("onPause:+");
-
-        mSubscriptionManager
-                .removeOnSubscriptionsChangedListener(mOnSubscriptionsChangeListener);
-
-        final Context context = getActivity();
-        context.unregisterReceiver(mPhoneChangeReceiver);
-        context.getContentResolver().unregisterContentObserver(mDpcEnforcedContentObserver);
-        if (DBG) log("onPause:-");
-    }
-
-    /**
-     * Implemented to support onPreferenceChangeListener to look for preference
-     * changes specifically on CLIR.
-     *
-     * @param preference is the preference to be changed, should be mButtonCLIR.
-     * @param objValue should be the value of the selection, NOT its localized
-     * display value.
-     */
-    public boolean onPreferenceChange(Preference preference, Object objValue) {
-        sendMetricsEventPreferenceChanged(getPreferenceScreen(), preference, objValue);
-
-        updateBody();
-        // always let the preference setting proceed.
-        return true;
-    }
-
     @Override
     public void onActivityResult(int requestCode, int resultCode, Intent data) {
         switch (requestCode) {
@@ -545,223 +194,6 @@
         }
     }
 
-    private static void log(String msg) {
-        Log.d(LOG_TAG, msg);
-    }
-
-    private static void loge(String msg) {
-        Log.e(LOG_TAG, msg);
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        final int itemId = item.getItemId();
-        if (itemId == android.R.id.home) {  // See ActionBar#setDisplayHomeAsUpEnabled()
-            // Commenting out "logical up" capability. This is a workaround for issue 5278083.
-            //
-            // Settings app may not launch this activity via UP_ACTIVITY_CLASS but the other
-            // Activity that looks exactly same as UP_ACTIVITY_CLASS ("SubSettings" Activity).
-            // At that moment, this Activity launches UP_ACTIVITY_CLASS on top of the Activity.
-            // which confuses users.
-            // TODO: introduce better mechanism for "up" capability here.
-            /*Intent intent = new Intent(Intent.ACTION_MAIN);
-            intent.setClassName(UP_ACTIVITY_PACKAGE, UP_ACTIVITY_CLASS);
-            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-            startActivity(intent);*/
-            getActivity().finish();
-            return true;
-        }
-        return super.onOptionsItemSelected(item);
-    }
-
-    private boolean isWorldMode() {
-        boolean worldModeOn = false;
-        final String configString = getResources().getString(R.string.config_world_mode);
-
-        if (!TextUtils.isEmpty(configString)) {
-            String[] configArray = configString.split(";");
-            // Check if we have World mode configuration set to True only or config is set to True
-            // and SIM GID value is also set and matches to the current SIM GID.
-            if (configArray != null &&
-                    ((configArray.length == 1 && configArray[0].equalsIgnoreCase("true"))
-                            || (configArray.length == 2 && !TextUtils.isEmpty(configArray[1])
-                            && mTelephonyManager != null
-                            && configArray[1].equalsIgnoreCase(
-                            mTelephonyManager.getGroupIdLevel1())))) {
-                worldModeOn = true;
-            }
-        }
-
-        Log.d(LOG_TAG, "isWorldMode=" + worldModeOn);
-
-        return worldModeOn;
-    }
-
-    private void controlGsmOptions(boolean enable) {
-        PreferenceScreen prefSet = getPreferenceScreen();
-        if (prefSet == null) {
-            return;
-        }
-
-        updateGsmUmtsOptions(this, prefSet, mSubId);
-
-        PreferenceCategory networkOperatorCategory =
-                (PreferenceCategory) prefSet.findPreference(
-                        NetworkOperators.CATEGORY_NETWORK_OPERATORS_KEY);
-        Preference carrierSettings = prefSet.findPreference(BUTTON_CARRIER_SETTINGS_KEY);
-        if (networkOperatorCategory != null) {
-            if (enable) {
-                networkOperatorCategory.setEnabled(true);
-            } else {
-                prefSet.removePreference(networkOperatorCategory);
-            }
-        }
-        if (carrierSettings != null) {
-            prefSet.removePreference(carrierSettings);
-        }
-    }
-
-    private boolean isSupportTdscdma() {
-        if (getResources().getBoolean(R.bool.config_support_tdscdma)) {
-            return true;
-        }
-
-        String operatorNumeric = mTelephonyManager.getServiceState().getOperatorNumeric();
-        String[] numericArray = getResources().getStringArray(
-                R.array.config_support_tdscdma_roaming_on_networks);
-        if (numericArray.length == 0 || operatorNumeric == null) {
-            return false;
-        }
-        for (String numeric : numericArray) {
-            if (operatorNumeric.equals(numeric)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Metrics events related methods. it takes care of all preferences possible in this
-     * fragment(except a few that log on their own). It doesn't only include preferences in
-     * network_setting_fragment.xml, but also those defined in GsmUmtsOptions and CdmaOptions.
-     */
-    private void sendMetricsEventPreferenceClicked(
-            PreferenceScreen preferenceScreen, Preference preference) {
-        final int category = getMetricsEventCategory(preferenceScreen, preference);
-        if (category == MetricsProto.MetricsEvent.VIEW_UNKNOWN) {
-            return;
-        }
-
-        // Send MetricsEvent on click. It includes preferences other than SwitchPreferences,
-        // which send MetricsEvent in onPreferenceChange.
-        // For ListPreferences, we log it here without a value, only indicating it's clicked to
-        // open the list dialog. When a value is chosen, another MetricsEvent is logged with
-        // new value in onPreferenceChange.
-        if (preference == preferenceScreen.findPreference(BUTTON_CDMA_SYSTEM_SELECT_KEY)
-                || preference == preferenceScreen.findPreference(BUTTON_CDMA_SUBSCRIPTION_KEY)
-                || preference == preferenceScreen.findPreference(BUTTON_GSM_APN_EXPAND_KEY)
-                || preference == preferenceScreen.findPreference(BUTTON_CDMA_APN_EXPAND_KEY)
-                || preference == preferenceScreen.findPreference(BUTTON_CARRIER_SETTINGS_KEY)) {
-            MetricsLogger.action(getContext(), category);
-        }
-    }
-
-    private void sendMetricsEventPreferenceChanged(
-            PreferenceScreen preferenceScreen, Preference preference, Object newValue) {
-        final int category = getMetricsEventCategory(preferenceScreen, preference);
-        if (category == MetricsProto.MetricsEvent.VIEW_UNKNOWN) {
-            return;
-        }
-
-        // MetricsEvent logging with new value, for SwitchPreferences and ListPreferences.
-        if (preference == preferenceScreen
-                .findPreference(BUTTON_CDMA_SYSTEM_SELECT_KEY)
-                || preference == preferenceScreen
-                .findPreference(BUTTON_CDMA_SUBSCRIPTION_KEY)) {
-            // Network select preference sends metrics event in its own listener.
-            MetricsLogger.action(getContext(), category, Integer.valueOf((String) newValue));
-        }
-    }
-
-    private int getMetricsEventCategory(
-            PreferenceScreen preferenceScreen, Preference preference) {
-
-        if (preference == null) {
-            return MetricsProto.MetricsEvent.VIEW_UNKNOWN;
-        } else if (preference == preferenceScreen
-                .findPreference(NetworkOperators.BUTTON_AUTO_SELECT_KEY)) {
-            return MetricsProto.MetricsEvent.ACTION_MOBILE_NETWORK_AUTO_SELECT_NETWORK_TOGGLE;
-        } else if (preference == preferenceScreen
-                .findPreference(NetworkOperators.BUTTON_NETWORK_SELECT_KEY)) {
-            return MetricsProto.MetricsEvent.ACTION_MOBILE_NETWORK_MANUAL_SELECT_NETWORK;
-        } else if (preference == preferenceScreen
-                .findPreference(BUTTON_CDMA_SYSTEM_SELECT_KEY)) {
-            return MetricsProto.MetricsEvent.ACTION_MOBILE_NETWORK_CDMA_SYSTEM_SELECT;
-        } else if (preference == preferenceScreen
-                .findPreference(BUTTON_CDMA_SUBSCRIPTION_KEY)) {
-            return MetricsProto.MetricsEvent.ACTION_MOBILE_NETWORK_CDMA_SUBSCRIPTION_SELECT;
-        } else if (preference == preferenceScreen.findPreference(BUTTON_GSM_APN_EXPAND_KEY)
-                || preference == preferenceScreen.findPreference(BUTTON_CDMA_APN_EXPAND_KEY)) {
-            return MetricsProto.MetricsEvent.ACTION_MOBILE_NETWORK_APN_SETTINGS;
-        } else if (preference == preferenceScreen.findPreference(BUTTON_CARRIER_SETTINGS_KEY)) {
-            return MetricsProto.MetricsEvent.ACTION_MOBILE_NETWORK_CARRIER_SETTINGS;
-        } else {
-            return MetricsProto.MetricsEvent.VIEW_UNKNOWN;
-        }
-    }
-
-    private void updateGsmUmtsOptions(PreferenceFragmentCompat prefFragment,
-            PreferenceScreen prefScreen, final int subId) {
-        // We don't want to re-create GsmUmtsOptions if already exists. Otherwise, the
-        // preferences inside it will also be re-created which causes unexpected behavior.
-        // For example, the open dialog gets dismissed or detached after pause / resume.
-        if (mGsmUmtsOptions == null) {
-            mGsmUmtsOptions = new GsmUmtsOptions(prefFragment, prefScreen, subId);
-        } else {
-            mGsmUmtsOptions.update(subId);
-        }
-    }
-
-    private static Intent buildPhoneAccountConfigureIntent(
-            Context context, PhoneAccountHandle accountHandle) {
-        Intent intent = buildConfigureIntent(
-                context, accountHandle, TelecomManager.ACTION_CONFIGURE_PHONE_ACCOUNT);
-
-        if (intent == null) {
-            // If the new configuration didn't work, try the old configuration intent.
-            intent = buildConfigureIntent(
-                    context, accountHandle, LEGACY_ACTION_CONFIGURE_PHONE_ACCOUNT);
-            if (intent != null) {
-                Log.w(MobileNetworkFragment.LOG_TAG,
-                        "Phone account using old configuration intent: " + accountHandle);
-            }
-        }
-        return intent;
-    }
-
-    private static Intent buildConfigureIntent(
-            Context context, PhoneAccountHandle accountHandle, String actionStr) {
-        if (accountHandle == null || accountHandle.getComponentName() == null
-                || TextUtils.isEmpty(accountHandle.getComponentName().getPackageName())) {
-            return null;
-        }
-
-        // Build the settings intent.
-        Intent intent = new Intent(actionStr);
-        intent.setPackage(accountHandle.getComponentName().getPackageName());
-        intent.addCategory(Intent.CATEGORY_DEFAULT);
-        intent.putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, accountHandle);
-
-        // Check to see that the phone account package can handle the setting intent.
-        PackageManager pm = context.getPackageManager();
-        List<ResolveInfo> resolutions = pm.queryIntentActivities(intent, 0);
-        if (resolutions.size() == 0) {
-            intent = null;  // set no intent if the package cannot handle it.
-        }
-
-        return intent;
-    }
-
     //TODO(b/114749736): update search provider
     public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
             new BaseSearchIndexProvider() {
diff --git a/src/com/android/settings/network/telephony/MobileNetworkUtils.java b/src/com/android/settings/network/telephony/MobileNetworkUtils.java
index fca523a..b43cd3a 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkUtils.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkUtils.java
@@ -29,6 +29,8 @@
 import android.provider.Settings;
 import android.telecom.PhoneAccountHandle;
 import android.telecom.TelecomManager;
+import android.telephony.CarrierConfigManager;
+import android.telephony.ServiceState;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
@@ -275,15 +277,43 @@
         return false;
     }
 
+    /**
+     * return {@code true} if we need show Gsm related settings
+     */
     public static boolean isGsmOptions(Context context, int subId) {
         if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
             return false;
         }
+        if (isGsmBasicOptions(context, subId)) {
+            return true;
+        }
+        final int settingsNetworkMode = android.provider.Settings.Global.getInt(
+                context.getContentResolver(),
+                android.provider.Settings.Global.PREFERRED_NETWORK_MODE + subId,
+                Phone.PREFERRED_NT_MODE);
+        if (isWorldMode(context, subId)) {
+            if (settingsNetworkMode == TelephonyManager.NETWORK_MODE_LTE_CDMA_EVDO
+                    || settingsNetworkMode == TelephonyManager.NETWORK_MODE_LTE_GSM_WCDMA) {
+                return true;
+            } else if (settingsNetworkMode == TelephonyManager.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA
+                    && !MobileNetworkUtils.isTdscdmaSupported(context, subId)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    private static boolean isGsmBasicOptions(Context context, int subId) {
         final TelephonyManager telephonyManager = TelephonyManager.from(context)
                 .createForSubscriptionId(subId);
+        final PersistableBundle carrierConfig = context.getSystemService(
+                CarrierConfigManager.class).getConfigForSubId(subId);
 
         if (telephonyManager.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM) {
             return true;
+        } else if (carrierConfig.getBoolean(CarrierConfigManager.KEY_WORLD_PHONE_BOOL)) {
+            return true;
         }
 
         return false;
@@ -318,6 +348,39 @@
         return worldModeOn;
     }
 
+    /**
+     * Return {@code true} if we need show settings for network selection(i.e. Verizon)
+     */
+    public static boolean shouldDisplayNetworkSelectOptions(Context context, int subId) {
+        final TelephonyManager telephonyManager = TelephonyManager.from(context)
+                .createForSubscriptionId(subId);
+        final PersistableBundle carrierConfig = context.getSystemService(
+                CarrierConfigManager.class).getConfigForSubId(subId);
+        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID
+                || !carrierConfig.getBoolean(
+                CarrierConfigManager.KEY_OPERATOR_SELECTION_EXPAND_BOOL)
+                || (carrierConfig.getBoolean(CarrierConfigManager.KEY_CSP_ENABLED_BOOL)
+                && !telephonyManager.isManualNetworkSelectionAllowed())) {
+            return false;
+        }
+
+        if (isGsmBasicOptions(context, subId)) {
+            return true;
+        }
+
+        final int settingsNetworkMode = android.provider.Settings.Global.getInt(
+                context.getContentResolver(),
+                android.provider.Settings.Global.PREFERRED_NETWORK_MODE + subId,
+                Phone.PREFERRED_NT_MODE);
+        if (isWorldMode(context, subId)) {
+            if (settingsNetworkMode == TelephonyManager.NETWORK_MODE_LTE_GSM_WCDMA) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
     public static boolean isShow4GForLTE(Context context) {
         //TODO(b/117882862): move this to framework
         try {
diff --git a/src/com/android/settings/network/telephony/MobileSettingsActivity.java b/src/com/android/settings/network/telephony/MobileSettingsActivity.java
index ec740c9..d712515 100644
--- a/src/com/android/settings/network/telephony/MobileSettingsActivity.java
+++ b/src/com/android/settings/network/telephony/MobileSettingsActivity.java
@@ -16,6 +16,7 @@
 
 package com.android.settings.network.telephony;
 
+import android.app.ActionBar;
 import android.content.Intent;
 import android.os.Bundle;
 import android.telephony.SubscriptionInfo;
@@ -70,6 +71,8 @@
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
+        //TODO(b/114749736): add phone change receiver here: ACTION_RADIO_TECHNOLOGY_CHANGED
+
         setContentView(R.layout.mobile_settings_container);
         setActionBar(findViewById(R.id.mobile_action_bar));
         mSubscriptionManager = getSystemService(SubscriptionManager.class);
@@ -80,6 +83,12 @@
 
         mSubscriptionManager.addOnSubscriptionsChangedListener(mOnSubscriptionsChangeListener);
 
+        final ActionBar actionBar = getActionBar();
+        if (actionBar != null) {
+            // android.R.id.home will be triggered in onOptionsItemSelected()
+            actionBar.setDisplayHomeAsUpEnabled(true);
+        }
+
         updateSubscriptions(savedInstanceState);
     }
 
diff --git a/src/com/android/settings/network/telephony/NetworkOperatorPreference.java b/src/com/android/settings/network/telephony/NetworkOperatorPreference.java
index 4b00613..ad0285f 100644
--- a/src/com/android/settings/network/telephony/NetworkOperatorPreference.java
+++ b/src/com/android/settings/network/telephony/NetworkOperatorPreference.java
@@ -22,17 +22,18 @@
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.LayerDrawable;
 import android.telephony.CellInfo;
+import android.telephony.CellSignalStrength;
 import android.telephony.SignalStrength;
 import android.util.Log;
 import android.view.Gravity;
 
+import androidx.preference.Preference;
+
 import com.android.settings.R;
 import com.android.settingslib.graph.SignalDrawable;
 
 import java.util.List;
 
-import androidx.preference.Preference;
-
 /**
  * A Preference represents a network operator in the NetworkSelectSetting fragment.
  */
@@ -40,21 +41,26 @@
 
     private static final String TAG = "NetworkOperatorPref";
     private static final boolean DBG = false;
+
+    private static final int LEVEL_NONE = -1;
+
     // number of signal strength level
     public static final int NUMBER_OF_LEVELS = SignalStrength.NUM_SIGNAL_STRENGTH_BINS;
     private CellInfo mCellInfo;
     private List<String> mForbiddenPlmns;
-    private int mLevel = -1;
+    private int mLevel = LEVEL_NONE;
+    private boolean mShow4GForLTE;
 
     // The following constants are used to draw signal icon.
     private static final Drawable EMPTY_DRAWABLE = new ColorDrawable(Color.TRANSPARENT);
     private static final int NO_CELL_DATA_CONNECTED_ICON = 0;
 
     public NetworkOperatorPreference(
-            CellInfo cellinfo, Context context, List<String> forbiddenPlmns) {
+            CellInfo cellinfo, Context context, List<String> forbiddenPlmns, boolean show4GForLTE) {
         super(context);
         mCellInfo = cellinfo;
         mForbiddenPlmns = forbiddenPlmns;
+        mShow4GForLTE = show4GForLTE;
         refresh();
     }
 
@@ -72,7 +78,9 @@
             networkTitle += " " + getContext().getResources().getString(R.string.forbidden_network);
         }
         setTitle(networkTitle);
-        int level = mCellInfo.getCellSignalStrength().getLevel();
+
+        final CellSignalStrength signalStrength = mCellInfo.getCellSignalStrength();
+        final int level = signalStrength != null ? signalStrength.getLevel() : LEVEL_NONE;
         if (DBG) Log.d(TAG, "refresh level: " + String.valueOf(level));
         if (mLevel != level) {
             mLevel = level;
@@ -87,15 +95,21 @@
         updateIcon(level);
     }
 
-    private static int getIconIdForCell(CellInfo ci) {
+    private int getIconIdForCell(CellInfo ci) {
         final int type = ci.getCellIdentity().getType();
         switch (type) {
-            case CellInfo.TYPE_GSM: return R.drawable.signal_strength_g;
+            case CellInfo.TYPE_GSM:
+                return R.drawable.signal_strength_g;
             case CellInfo.TYPE_WCDMA: // fall through
-            case CellInfo.TYPE_TDSCDMA: return R.drawable.signal_strength_3g;
-            case CellInfo.TYPE_LTE: return R.drawable.signal_strength_lte;
-            case CellInfo.TYPE_CDMA: return R.drawable.signal_strength_1x;
-            default: return 0;
+            case CellInfo.TYPE_TDSCDMA:
+                return R.drawable.signal_strength_3g;
+            case CellInfo.TYPE_LTE:
+                return mShow4GForLTE
+                        ? R.drawable.ic_signal_strength_4g : R.drawable.signal_strength_lte;
+            case CellInfo.TYPE_CDMA:
+                return R.drawable.signal_strength_1x;
+            default:
+                return 0;
         }
     }
 
@@ -117,7 +131,7 @@
                 iconType == NO_CELL_DATA_CONNECTED_ICON
                         ? EMPTY_DRAWABLE
                         : getContext()
-                        .getResources().getDrawable(iconType, getContext().getTheme());
+                                .getResources().getDrawable(iconType, getContext().getTheme());
 
         // Overlay the two drawables
         Drawable[] layers = {networkDrawable, signalDrawable};
diff --git a/src/com/android/settings/network/telephony/NetworkOperators.java b/src/com/android/settings/network/telephony/NetworkOperators.java
deleted file mode 100644
index 7014820..0000000
--- a/src/com/android/settings/network/telephony/NetworkOperators.java
+++ /dev/null
@@ -1,301 +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.network.telephony;
-
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Handler;
-import android.os.Message;
-import android.telephony.ServiceState;
-import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.widget.Toast;
-
-import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
-import androidx.preference.TwoStatePreference;
-
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.R;
-import com.android.settingslib.utils.ThreadUtils;
-
-/**
- * "Networks" settings UI for the Phone app.
- */
-public class NetworkOperators extends PreferenceCategory
-        implements Preference.OnPreferenceChangeListener {
-
-    private static final String LOG_TAG = "NetworkOperators";
-    private static final boolean DBG = true;
-
-    private static final int EVENT_AUTO_SELECT_DONE = 100;
-    private static final int EVENT_GET_NETWORK_SELECTION_MODE_DONE = 200;
-
-    //String keys for preference lookup
-    public static final String BUTTON_NETWORK_SELECT_KEY = "button_network_select_key";
-    public static final String BUTTON_AUTO_SELECT_KEY = "button_auto_select_key";
-    public static final String BUTTON_CHOOSE_NETWORK_KEY = "button_choose_network_key";
-    public static final String CATEGORY_NETWORK_OPERATORS_KEY = "network_operators_category_key";
-
-    //preference objects
-    private NetworkSelectListPreference mNetworkSelect;
-    private TwoStatePreference mAutoSelect;
-    private Preference mChooseNetwork;
-    private ProgressDialog mProgressDialog;
-
-    private int mSubId;
-    private TelephonyManager mTelephonyManager;
-
-    // There's two sets of Auto-Select UI in this class.
-    // If {@code com.android.internal.R.bool.config_enableNewAutoSelectNetworkUI} set as true
-    // {@link mChooseNetwork} will be used, otherwise {@link mNetworkSelect} will be used.
-    boolean mEnableNewManualSelectNetworkUI;
-
-    public NetworkOperators(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public NetworkOperators(Context context) {
-        super(context);
-    }
-
-    /**
-     * Initialize NetworkOperators instance.
-     */
-    public void initialize() {
-        mEnableNewManualSelectNetworkUI = getContext().getResources().getBoolean(
-                com.android.internal.R.bool.config_enableNewAutoSelectNetworkUI);
-        mAutoSelect = (TwoStatePreference) findPreference(BUTTON_AUTO_SELECT_KEY);
-        mChooseNetwork = findPreference(BUTTON_CHOOSE_NETWORK_KEY);
-        mNetworkSelect = (NetworkSelectListPreference) findPreference(BUTTON_NETWORK_SELECT_KEY);
-        if (mEnableNewManualSelectNetworkUI) {
-            removePreference(mNetworkSelect);
-        } else {
-            removePreference(mChooseNetwork);
-        }
-        mProgressDialog = new ProgressDialog(getContext());
-        mTelephonyManager = TelephonyManager.from(getContext());
-    }
-
-    /**
-     * Update NetworkOperators instance if like subId is updated.
-     *
-     * @param subId Corresponding subscription ID of this network.
-     */
-    protected void update(final int subId) {
-        mSubId = subId;
-        mTelephonyManager = TelephonyManager.from(getContext()).createForSubscriptionId(mSubId);
-
-        if (mAutoSelect != null) {
-            mAutoSelect.setOnPreferenceChangeListener(this);
-        }
-
-        if (mEnableNewManualSelectNetworkUI) {
-            if (mChooseNetwork != null) {
-                ServiceState ss = mTelephonyManager.getServiceState();
-                if (ss != null && ss.getState() == ServiceState.STATE_IN_SERVICE) {
-                    mChooseNetwork.setSummary(mTelephonyManager.getNetworkOperatorName());
-                } else {
-                    mChooseNetwork.setSummary(R.string.network_disconnected);
-                }
-            }
-        } else {
-            if (mNetworkSelect != null) {
-                mNetworkSelect.initialize(mSubId, this, mProgressDialog);
-            }
-        }
-        getNetworkSelectionMode();
-    }
-
-    /**
-     * Implemented to support onPreferenceChangeListener to look for preference
-     * changes specifically on auto select button.
-     *
-     * @param preference is the preference to be changed, should be auto select button.
-     * @param newValue   should be the value of whether autoSelect is checked.
-     */
-    @Override
-    public boolean onPreferenceChange(Preference preference, Object newValue) {
-        if (preference == mAutoSelect) {
-            boolean autoSelect = (Boolean) newValue;
-            if (DBG) logd("onPreferenceChange autoSelect: " + String.valueOf(autoSelect));
-            selectNetworkAutomatic(autoSelect);
-            MetricsLogger.action(getContext(),
-                    MetricsEvent.ACTION_MOBILE_NETWORK_AUTO_SELECT_NETWORK_TOGGLE, autoSelect);
-            return true;
-        }
-        return false;
-    }
-
-    private final Handler mHandler = new Handler() {
-        @Override
-        public void handleMessage(Message msg) {
-            switch (msg.what) {
-                case EVENT_AUTO_SELECT_DONE:
-                    mAutoSelect.setEnabled(true);
-                    dismissProgressBar();
-
-                    boolean isSuccessed = (boolean) msg.obj;
-
-                    if (isSuccessed) {
-                        if (DBG) logd("automatic network selection: succeeded!");
-                        displayNetworkSelectionSucceeded();
-                    } else {
-                        if (DBG) logd("automatic network selection: failed!");
-                        displayNetworkSelectionFailed();
-                    }
-
-                    break;
-                case EVENT_GET_NETWORK_SELECTION_MODE_DONE:
-                    int networkSelectionMode = msg.arg1;
-                    if (networkSelectionMode == TelephonyManager.NETWORK_SELECTION_MODE_UNKNOWN) {
-                        if (DBG) logd("get network selection mode: failed!");
-                    } else {
-                        boolean autoSelect = networkSelectionMode
-                                == TelephonyManager.NETWORK_SELECTION_MODE_AUTO;
-                        if (DBG) {
-                            logd("get network selection mode: "
-                                    + (autoSelect ? "auto" : "manual") + " selection");
-                        }
-                        if (mAutoSelect != null) {
-                            mAutoSelect.setChecked(autoSelect);
-                        }
-                        if (mEnableNewManualSelectNetworkUI) {
-                            if (mChooseNetwork != null) {
-                                mChooseNetwork.setEnabled(!autoSelect);
-                            }
-                        } else {
-                            if (mNetworkSelect != null) {
-                                mNetworkSelect.setEnabled(!autoSelect);
-                            }
-                        }
-                    }
-            }
-            return;
-        }
-    };
-
-    // Used by both mAutoSelect and mNetworkSelect buttons.
-    protected void displayNetworkSelectionFailed() {
-        Toast.makeText(getContext(), R.string.connect_later, Toast.LENGTH_LONG).show();
-    }
-
-    // Used by both mAutoSelect and mNetworkSelect buttons.
-    protected void displayNetworkSelectionSucceeded() {
-        Toast.makeText(getContext(), R.string.registration_done, Toast.LENGTH_LONG).show();
-    }
-
-    private void selectNetworkAutomatic(boolean autoSelect) {
-        if (DBG) logd("selectNetworkAutomatic: " + String.valueOf(autoSelect));
-
-        if (autoSelect) {
-            if (mEnableNewManualSelectNetworkUI) {
-                if (mChooseNetwork != null) {
-                    mChooseNetwork.setEnabled(!autoSelect);
-                }
-            } else {
-                if (mNetworkSelect != null) {
-                    mNetworkSelect.setEnabled(!autoSelect);
-                }
-            }
-            if (DBG) logd("select network automatically...");
-            showAutoSelectProgressBar();
-            mAutoSelect.setEnabled(false);
-            if (SubscriptionManager.isValidSubscriptionId(mSubId)) {
-                ThreadUtils.postOnBackgroundThread(() -> {
-                    mTelephonyManager.setNetworkSelectionModeAutomatic();
-                    // Because TelephonyManager#setNetworkSelectionModeAutomatic doesn't have a
-                    // return value, we query the current network selection mode to tell if the
-                    // TelephonyManager#setNetworkSelectionModeAutomatic is successed.
-                    int networkSelectionMode = mTelephonyManager.getNetworkSelectionMode();
-                    Message msg = mHandler.obtainMessage(EVENT_AUTO_SELECT_DONE);
-                    msg.obj = networkSelectionMode == TelephonyManager.NETWORK_SELECTION_MODE_AUTO;
-                    msg.sendToTarget();
-                });
-            }
-        } else {
-            if (mEnableNewManualSelectNetworkUI) {
-                if (mChooseNetwork != null) {
-                    // Open the choose Network page automatically when user turn off the auto-select
-                    openChooseNetworkPage();
-                }
-            } else {
-                if (mNetworkSelect != null) {
-                    mNetworkSelect.onClick();
-                }
-            }
-        }
-    }
-
-    protected void getNetworkSelectionMode() {
-        if (DBG) logd("getting network selection mode...");
-        ThreadUtils.postOnBackgroundThread(() -> {
-            int networkSelectionMode = mTelephonyManager.getNetworkSelectionMode();
-            Message msg = mHandler.obtainMessage(EVENT_GET_NETWORK_SELECTION_MODE_DONE);
-            msg.arg1 = networkSelectionMode;
-            msg.sendToTarget();
-        });
-    }
-
-    private void dismissProgressBar() {
-        if (mProgressDialog != null && mProgressDialog.isShowing()) {
-            mProgressDialog.dismiss();
-        }
-    }
-
-    private void showAutoSelectProgressBar() {
-        mProgressDialog.setMessage(
-                getContext().getResources().getString(R.string.register_automatically));
-        mProgressDialog.setCanceledOnTouchOutside(false);
-        mProgressDialog.setCancelable(false);
-        mProgressDialog.setIndeterminate(true);
-        mProgressDialog.show();
-    }
-
-    /**
-     * Open the Choose network page via {@alink NetworkSelectSettingActivity}
-     */
-    public void openChooseNetworkPage() {
-        //TODO(b/114749736): Build intent without calling static method
-        Intent intent = new Intent();
-        getContext().startActivity(intent);
-    }
-
-    protected boolean preferenceTreeClick(Preference preference) {
-        if (mEnableNewManualSelectNetworkUI) {
-            if (DBG) logd("enable New AutoSelectNetwork UI");
-            if (preference == mChooseNetwork) {
-                openChooseNetworkPage();
-            }
-            return (preference == mAutoSelect || preference == mChooseNetwork);
-        } else {
-            return (preference == mAutoSelect || preference == mNetworkSelect);
-        }
-    }
-
-    private void logd(String msg) {
-        Log.d(LOG_TAG, "[NetworksList] " + msg);
-    }
-
-    private void loge(String msg) {
-        Log.e(LOG_TAG, "[NetworksList] " + msg);
-    }
-}
diff --git a/src/com/android/settings/network/telephony/NetworkSelectListPreference.java b/src/com/android/settings/network/telephony/NetworkSelectListPreference.java
deleted file mode 100644
index ceb0efa..0000000
--- a/src/com/android/settings/network/telephony/NetworkSelectListPreference.java
+++ /dev/null
@@ -1,506 +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.network.telephony;
-
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.AsyncTask;
-import android.os.Handler;
-import android.os.Message;
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.telephony.CellInfo;
-import android.telephony.CellInfoCdma;
-import android.telephony.CellInfoGsm;
-import android.telephony.CellInfoLte;
-import android.telephony.CellInfoWcdma;
-import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
-import android.text.BidiFormatter;
-import android.text.TextDirectionHeuristics;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.widget.Toast;
-
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.internal.telephony.OperatorInfo;
-import com.android.settings.R;
-import com.android.settingslib.utils.ThreadUtils;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import androidx.preference.ListPreference;
-import androidx.preference.Preference;
-
-
-/**
- * "Networks" preference in "Mobile network" settings UI for the Phone app.
- * It's used to manually search and choose mobile network. Enabled only when
- * autoSelect preference is turned off.
- */
-public class NetworkSelectListPreference extends ListPreference
-        implements DialogInterface.OnCancelListener,
-        Preference.OnPreferenceChangeListener{
-
-    private static final String LOG_TAG = "networkSelect";
-    private static final boolean DBG = true;
-
-    private static final int EVENT_MANUALLY_NETWORK_SELECTION_DONE = 1;
-    private static final int EVENT_NETWORK_SCAN_RESULTS = 2;
-    private static final int EVENT_NETWORK_SCAN_COMPLETED = 3;
-    private static final int EVENT_NETWORK_SCAN_ERROR = 4;
-
-    //dialog ids
-    private static final int DIALOG_NETWORK_SELECTION = 100;
-    private static final int DIALOG_NETWORK_LIST_LOAD = 200;
-
-    private final ExecutorService mNetworkScanExecutor = Executors.newFixedThreadPool(1);
-
-    private List<CellInfo> mCellInfoList;
-    private CellInfo mCellInfo;
-
-    private int mSubId;
-    private TelephonyManager mTelephonyManager;
-    private NetworkScanHelper mNetworkScanHelper;
-    private NetworkOperators mNetworkOperators;
-    private List<String> mForbiddenPlmns;
-
-    private ProgressDialog mProgressDialog;
-    public NetworkSelectListPreference(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public NetworkSelectListPreference(Context context, AttributeSet attrs, int defStyleAttr,
-            int defStyleRes) {
-        super(context, attrs, defStyleAttr, defStyleRes);
-    }
-
-    @Override
-    protected void onClick() {
-        showProgressDialog(DIALOG_NETWORK_LIST_LOAD);
-        TelephonyManager telephonyManager = (TelephonyManager)
-                getContext().getSystemService(Context.TELEPHONY_SERVICE);
-        new AsyncTask<Void, Void, List<String>>() {
-            @Override
-            protected List<String> doInBackground(Void... voids) {
-                String[] forbiddenPlmns = telephonyManager.getForbiddenPlmns();
-                return forbiddenPlmns != null ? Arrays.asList(forbiddenPlmns) : null;
-            }
-
-            @Override
-            protected void onPostExecute(List<String> result) {
-                mForbiddenPlmns = result;
-                loadNetworksList();
-            }
-        }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
-    }
-
-    private final Handler mHandler = new Handler() {
-        @Override
-        public void handleMessage(Message msg) {
-            switch (msg.what) {
-                case EVENT_MANUALLY_NETWORK_SELECTION_DONE:
-                    if (DBG) logd("hideProgressPanel");
-                    dismissProgressDialog();
-
-                    boolean isSuccessed = (boolean) msg.obj;
-                    if (isSuccessed) {
-                        if (DBG) {
-                            logd("manual network selection: succeeded! "
-                                    + getNetworkTitle(mCellInfo));
-                        }
-                        mNetworkOperators.displayNetworkSelectionSucceeded();
-                    } else {
-                        if (DBG) logd("manual network selection: failed!");
-                        mNetworkOperators.displayNetworkSelectionFailed();
-                    }
-                    mNetworkOperators.getNetworkSelectionMode();
-                    break;
-
-                case EVENT_NETWORK_SCAN_RESULTS:
-                    List<CellInfo> results = (List<CellInfo>) msg.obj;
-                    results.removeIf(cellInfo -> cellInfo == null);
-                    mCellInfoList = new ArrayList<>(results);
-                    if (DBG) logd("CALLBACK_SCAN_RESULTS" + mCellInfoList.toString());
-                    break;
-
-                case EVENT_NETWORK_SCAN_COMPLETED:
-                    if (DBG) logd("scan complete, load the cellInfosList");
-                    dismissProgressDialog();
-                    networksListLoaded();
-                    break;
-                case EVENT_NETWORK_SCAN_ERROR:
-                    dismissProgressDialog();
-                    displayNetworkQueryFailed();
-                    mNetworkOperators.getNetworkSelectionMode();
-                    break;
-            }
-            return;
-        }
-    };
-
-    private final NetworkScanHelper.NetworkScanCallback mCallback =
-            new NetworkScanHelper.NetworkScanCallback() {
-                public void onResults(List<CellInfo> results) {
-                    if (DBG) logd("get scan results: " + results.toString());
-                    Message msg = mHandler.obtainMessage(EVENT_NETWORK_SCAN_RESULTS, results);
-                    msg.sendToTarget();
-                }
-
-                public void onComplete() {
-                    if (DBG) logd("network scan completed.");
-                    Message msg = mHandler.obtainMessage(EVENT_NETWORK_SCAN_COMPLETED);
-                    msg.sendToTarget();
-                }
-
-                public void onError(int error) {
-                    if (DBG) logd("network scan error.");
-                    Message msg = mHandler.obtainMessage(EVENT_NETWORK_SCAN_ERROR);
-                    msg.sendToTarget();
-                }
-            };
-
-    @Override
-    //implemented for DialogInterface.OnCancelListener
-    public void onCancel(DialogInterface dialog) {
-        if (DBG) logd("user manually close the dialog");
-        mNetworkScanHelper.stopNetworkQuery();
-
-        // If cancelled, we query NetworkSelectMode and update states of AutoSelect button.
-        mNetworkOperators.getNetworkSelectionMode();
-    }
-
-    //TODO(b/114749736): move this logic to preference controller
-    protected void onDialogClosed(boolean positiveResult) {
-        // If dismissed, we query NetworkSelectMode and update states of AutoSelect button.
-        if (!positiveResult) {
-            mNetworkOperators.getNetworkSelectionMode();
-        }
-    }
-
-    // This initialize method needs to be called for this preference to work properly.
-    protected void initialize(int subId, NetworkOperators networkOperators,
-            ProgressDialog progressDialog) {
-        mSubId = subId;
-        mNetworkOperators = networkOperators;
-        // This preference should share the same progressDialog with networkOperators category.
-        mProgressDialog = progressDialog;
-
-        mTelephonyManager = TelephonyManager.from(getContext()).createForSubscriptionId(mSubId);
-        mNetworkScanHelper = new NetworkScanHelper(
-                mTelephonyManager, mCallback, mNetworkScanExecutor);
-
-        setSummary(mTelephonyManager.getNetworkOperatorName());
-
-        setOnPreferenceChangeListener(this);
-    }
-
-    @Override
-    protected void onPrepareForRemoval() {
-        destroy();
-        super.onPrepareForRemoval();
-    }
-
-    private void destroy() {
-        dismissProgressDialog();
-
-        if (mNetworkScanHelper != null) {
-            mNetworkScanHelper.stopNetworkQuery();
-        }
-
-        mNetworkScanExecutor.shutdown();
-    }
-
-    private void displayEmptyNetworkList() {
-        Toast.makeText(getContext(), R.string.empty_networks_list, Toast.LENGTH_LONG).show();
-    }
-
-    private void displayNetworkQueryFailed() {
-        Toast.makeText(getContext(), R.string.network_query_error, Toast.LENGTH_LONG).show();
-    }
-
-    private void loadNetworksList() {
-        if (DBG) logd("load networks list...");
-        mNetworkScanHelper.startNetworkScan(
-                NetworkScanHelper.NETWORK_SCAN_TYPE_WAIT_FOR_ALL_RESULTS);
-    }
-
-    private void networksListLoaded() {
-        if (DBG) logd("networks list loaded");
-
-        mNetworkOperators.getNetworkSelectionMode();
-        if (mCellInfoList != null) {
-            // create a preference for each item in the list.
-            // just use the operator name instead of the mildly
-            // confusing mcc/mnc.
-            List<CharSequence> networkEntriesList = new ArrayList<>();
-            List<CharSequence> networkEntryValuesList = new ArrayList<>();
-            for (CellInfo cellInfo: mCellInfoList) {
-                // Display each operator name only once.
-                String networkTitle = getNetworkTitle(cellInfo);
-                if (CellInfoUtil.isForbidden(cellInfo, mForbiddenPlmns)) {
-                    networkTitle += " "
-                            + getContext().getResources().getString(R.string.forbidden_network);
-                }
-                networkEntriesList.add(networkTitle);
-                networkEntryValuesList.add(getOperatorNumeric(cellInfo));
-            }
-            setEntries(networkEntriesList.toArray(new CharSequence[networkEntriesList.size()]));
-            setEntryValues(networkEntryValuesList.toArray(
-                    new CharSequence[networkEntryValuesList.size()]));
-
-            super.onClick();
-        } else {
-            displayEmptyNetworkList();
-        }
-    }
-
-    private void dismissProgressDialog() {
-        if (mProgressDialog != null && mProgressDialog.isShowing()) {
-            try {
-                mProgressDialog.dismiss();
-            } catch (IllegalArgumentException ex) {
-                loge("Can't close the progress dialog " + ex);
-            }
-        }
-    }
-
-    private void showProgressDialog(int id) {
-        if (mProgressDialog == null) {
-            mProgressDialog = new ProgressDialog(getContext());
-        } else {
-            // Dismiss progress bar if it's showing now.
-            dismissProgressDialog();
-        }
-
-        switch (id) {
-            case DIALOG_NETWORK_SELECTION:
-                final String networkSelectMsg = getContext().getResources()
-                        .getString(R.string.register_on_network,
-                                getNetworkTitle(mCellInfo));
-                mProgressDialog.setMessage(networkSelectMsg);
-                mProgressDialog.setCanceledOnTouchOutside(false);
-                mProgressDialog.setCancelable(false);
-                mProgressDialog.setIndeterminate(true);
-                break;
-            case DIALOG_NETWORK_LIST_LOAD:
-                mProgressDialog.setMessage(
-                        getContext().getResources().getString(R.string.load_networks_progress));
-                mProgressDialog.setCanceledOnTouchOutside(false);
-                mProgressDialog.setCancelable(true);
-                mProgressDialog.setIndeterminate(false);
-                mProgressDialog.setOnCancelListener(this);
-                break;
-            default:
-        }
-        mProgressDialog.show();
-    }
-
-    /**
-     * Implemented to support onPreferenceChangeListener to look for preference
-     * changes specifically on this button.
-     *
-     * @param preference is the preference to be changed, should be network select button.
-     * @param newValue should be the value of the selection as index of operators.
-     */
-    @Override
-    public boolean onPreferenceChange(Preference preference, Object newValue) {
-        int operatorIndex = findIndexOfValue((String) newValue);
-        mCellInfo = mCellInfoList.get(operatorIndex);
-        if (DBG) logd("selected network: " + mCellInfo.toString());
-
-        MetricsLogger.action(getContext(),
-                MetricsEvent.ACTION_MOBILE_NETWORK_MANUAL_SELECT_NETWORK);
-
-        if (SubscriptionManager.isValidSubscriptionId(mSubId)) {
-            ThreadUtils.postOnBackgroundThread(() -> {
-                final OperatorInfo operatorInfo = getOperatorInfoFromCellInfo(mCellInfo);
-                if (DBG) logd("manually selected network: " + operatorInfo.toString());
-                boolean isSuccessed = mTelephonyManager.setNetworkSelectionModeManual(
-                        operatorInfo, true /* persistSelection */);
-                Message msg = mHandler.obtainMessage(EVENT_MANUALLY_NETWORK_SELECTION_DONE);
-                msg.obj = isSuccessed;
-                msg.sendToTarget();
-            });
-        } else {
-            loge("Error selecting network, subscription Id is invalid " + mSubId);
-        }
-
-        return true;
-    }
-
-    /**
-     * Returns the title of the network obtained in the manual search.
-     *
-     * @param cellInfo contains the information of the network.
-     * @return Long Name if not null/empty, otherwise Short Name if not null/empty,
-     * else MCCMNC string.
-     */
-    private String getNetworkTitle(CellInfo cellInfo) {
-        OperatorInfo ni = getOperatorInfoFromCellInfo(cellInfo);
-
-        if (!TextUtils.isEmpty(ni.getOperatorAlphaLong())) {
-            return ni.getOperatorAlphaLong();
-        } else if (!TextUtils.isEmpty(ni.getOperatorAlphaShort())) {
-            return ni.getOperatorAlphaShort();
-        } else {
-            BidiFormatter bidiFormatter = BidiFormatter.getInstance();
-            return bidiFormatter.unicodeWrap(ni.getOperatorNumeric(), TextDirectionHeuristics.LTR);
-        }
-    }
-
-    /**
-     * Returns the operator numeric (MCCMNC) obtained in the manual search.
-     *
-     * @param cellInfo contains the information of the network.
-     * @return MCCMNC string.
-     */
-    private String getOperatorNumeric(CellInfo cellInfo) {
-        return getOperatorInfoFromCellInfo(cellInfo).getOperatorNumeric();
-    }
-
-    /**
-     * Wrap a cell info into an operator info.
-     */
-    private OperatorInfo getOperatorInfoFromCellInfo(CellInfo cellInfo) {
-        OperatorInfo oi;
-        if (cellInfo instanceof CellInfoLte) {
-            CellInfoLte lte = (CellInfoLte) cellInfo;
-            oi = new OperatorInfo(
-                    (String) lte.getCellIdentity().getOperatorAlphaLong(),
-                    (String) lte.getCellIdentity().getOperatorAlphaShort(),
-                    lte.getCellIdentity().getMobileNetworkOperator());
-        } else if (cellInfo instanceof CellInfoWcdma) {
-            CellInfoWcdma wcdma = (CellInfoWcdma) cellInfo;
-            oi = new OperatorInfo(
-                    (String) wcdma.getCellIdentity().getOperatorAlphaLong(),
-                    (String) wcdma.getCellIdentity().getOperatorAlphaShort(),
-                    wcdma.getCellIdentity().getMobileNetworkOperator());
-        } else if (cellInfo instanceof CellInfoGsm) {
-            CellInfoGsm gsm = (CellInfoGsm) cellInfo;
-            oi = new OperatorInfo(
-                    (String) gsm.getCellIdentity().getOperatorAlphaLong(),
-                    (String) gsm.getCellIdentity().getOperatorAlphaShort(),
-                    gsm.getCellIdentity().getMobileNetworkOperator());
-        } else if (cellInfo instanceof CellInfoCdma) {
-            CellInfoCdma cdma = (CellInfoCdma) cellInfo;
-            oi = new OperatorInfo(
-                    (String) cdma.getCellIdentity().getOperatorAlphaLong(),
-                    (String) cdma.getCellIdentity().getOperatorAlphaShort(),
-                    "" /* operator numeric */);
-        } else {
-            oi = new OperatorInfo("", "", "");
-        }
-        return oi;
-    }
-
-    @Override
-    protected Parcelable onSaveInstanceState() {
-        final Parcelable superState = super.onSaveInstanceState();
-        if (isPersistent()) {
-            // No need to save instance state since it's persistent
-            return superState;
-        }
-
-        final SavedState myState = new SavedState(superState);
-        myState.mDialogListEntries = getEntries();
-        myState.mDialogListEntryValues = getEntryValues();
-        myState.mCellInfoList = mCellInfoList;
-        return myState;
-    }
-
-    @Override
-    protected void onRestoreInstanceState(Parcelable state) {
-        if (state == null || !state.getClass().equals(SavedState.class)) {
-            // Didn't save state for us in onSaveInstanceState
-            super.onRestoreInstanceState(state);
-            return;
-        }
-
-        SavedState myState = (SavedState) state;
-
-        if (getEntries() == null && myState.mDialogListEntries != null) {
-            setEntries(myState.mDialogListEntries);
-        }
-        if (getEntryValues() == null && myState.mDialogListEntryValues != null) {
-            setEntryValues(myState.mDialogListEntryValues);
-        }
-        if (mCellInfoList == null && myState.mCellInfoList != null) {
-            mCellInfoList = myState.mCellInfoList;
-        }
-
-        super.onRestoreInstanceState(myState.getSuperState());
-    }
-
-    /**
-     *  We save entries, entryValues and operatorInfoList into bundle.
-     *  At onCreate of fragment, dialog will be restored if it was open. In this case,
-     *  we need to restore entries, entryValues and operatorInfoList. Without those information,
-     *  onPreferenceChange will fail if user select network from the dialog.
-     */
-    private static class SavedState extends BaseSavedState {
-        CharSequence[] mDialogListEntries;
-        CharSequence[] mDialogListEntryValues;
-        List<CellInfo> mCellInfoList;
-
-        SavedState(Parcel source) {
-            super(source);
-            final ClassLoader boot = Object.class.getClassLoader();
-            mDialogListEntries = source.readCharSequenceArray();
-            mDialogListEntryValues = source.readCharSequenceArray();
-            mCellInfoList = source.readParcelableList(mCellInfoList, boot);
-        }
-
-        @Override
-        public void writeToParcel(Parcel dest, int flags) {
-            super.writeToParcel(dest, flags);
-            dest.writeCharSequenceArray(mDialogListEntries);
-            dest.writeCharSequenceArray(mDialogListEntryValues);
-            dest.writeParcelableList(mCellInfoList, flags);
-        }
-
-        SavedState(Parcelable superState) {
-            super(superState);
-        }
-
-        public static final Parcelable.Creator<SavedState> CREATOR =
-                new Parcelable.Creator<SavedState>() {
-                    public SavedState createFromParcel(Parcel in) {
-                        return new SavedState(in);
-                    }
-
-                    public SavedState[] newArray(int size) {
-                        return new SavedState[size];
-                    }
-                };
-    }
-
-    private void logd(String msg) {
-        Log.d(LOG_TAG, "[NetworksList] " + msg);
-    }
-
-    private void loge(String msg) {
-        Log.e(LOG_TAG, "[NetworksList] " + msg);
-    }
-}
\ No newline at end of file
diff --git a/src/com/android/settings/network/telephony/NetworkSelectSettings.java b/src/com/android/settings/network/telephony/NetworkSelectSettings.java
index 9205188..3e42c70 100644
--- a/src/com/android/settings/network/telephony/NetworkSelectSettings.java
+++ b/src/com/android/settings/network/telephony/NetworkSelectSettings.java
@@ -15,55 +15,50 @@
  */
 package com.android.settings.network.telephony;
 
+import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.MOBILE_NETWORK_SELECT;
+
+import android.app.Activity;
 import android.content.Context;
-import android.os.AsyncTask;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
-import android.provider.SearchIndexableResource;
+import android.os.PersistableBundle;
 import android.telephony.AccessNetworkConstants;
+import android.telephony.CarrierConfigManager;
 import android.telephony.CellIdentity;
 import android.telephony.CellInfo;
 import android.telephony.NetworkRegistrationState;
 import android.telephony.ServiceState;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
-import android.util.Log;
 import android.view.View;
 
+import androidx.annotation.VisibleForTesting;
 import androidx.preference.Preference;
 import androidx.preference.PreferenceCategory;
-import androidx.preference.PreferenceScreen;
 
-import com.android.internal.logging.MetricsLogger;
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.internal.telephony.OperatorInfo;
 import com.android.settings.R;
 import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settings.search.Indexable;
-import com.android.settingslib.search.SearchIndexable;
-import com.android.settingslib.utils.ThreadUtils;
+import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 /**
  * "Choose network" settings UI for the Phone app.
  */
-//TODO(b/115429509): Add test for this file once b/115429509 is not blocked anymore
-@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
 public class NetworkSelectSettings extends DashboardFragment {
 
-    private static final String TAG = "NetworkSelectSetting";
-    private static final boolean DBG = true;
+    private static final String TAG = "NetworkSelectSettings";
 
-    public static final String KEY_SUBSCRIPTION_ID = "subscription_id";
-
-    private static final int EVENT_SET_NETWORK_SELECTION_MANUALLY_DONE = 1;
     private static final int EVENT_NETWORK_SCAN_RESULTS = 2;
     private static final int EVENT_NETWORK_SCAN_ERROR = 3;
     private static final int EVENT_NETWORK_SCAN_COMPLETED = 4;
@@ -72,159 +67,122 @@
             "connected_network_operator_preference";
     private static final String PREF_KEY_NETWORK_OPERATORS = "network_operators_preference";
 
-    // used to add/remove NetworkOperatorsPreference.
-    private PreferenceCategory mNetworkOperatorsPreferences;
-    // used to add/remove connected NetworkOperatorPreference.
-    private PreferenceCategory mConnectedNetworkOperatorsPreference;
-    // manage the progress bar on the top of the page.
+    @VisibleForTesting
+    PreferenceCategory mPreferenceCategory;
+    @VisibleForTesting
+    PreferenceCategory mConnectedPreferenceCategory;
+    @VisibleForTesting
+    NetworkOperatorPreference mSelectedPreference;
     private View mProgressHeader;
     private Preference mStatusMessagePreference;
-    private List<CellInfo> mCellInfoList;
+    @VisibleForTesting
+    List<CellInfo> mCellInfoList;
     private int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
-    private NetworkOperatorPreference mSelectedNetworkOperatorPreference;
-    private TelephonyManager mTelephonyManager;
+    @VisibleForTesting
+    TelephonyManager mTelephonyManager;
     private List<String> mForbiddenPlmns;
-    //Flag indicating whether we have called bind on the service.
-    private boolean mShouldUnbind;
-
-    private final Runnable mUpdateNetworkOperatorsRunnable = () -> {
-        updateNetworkOperatorsPreferenceCategory();
-    };
-
-    /**
-     * Create a new instance of this fragment.
-     */
-    public static NetworkSelectSettings newInstance(int subId) {
-        Bundle args = new Bundle();
-        args.putInt(KEY_SUBSCRIPTION_ID, subId);
-        NetworkSelectSettings
-                fragment = new NetworkSelectSettings();
-        fragment.setArguments(args);
-
-        return fragment;
-    }
+    private boolean mShow4GForLTE = false;
+    private NetworkScanHelper mNetworkScanHelper;
+    private final ExecutorService mNetworkScanExecutor = Executors.newFixedThreadPool(1);
+    private MetricsFeatureProvider mMetricsFeatureProvider;
+    private boolean mUseNewApi;
 
     @Override
     public void onCreate(Bundle icicle) {
-        if (DBG) logd("onCreate");
         super.onCreate(icicle);
 
-        mSubId = getArguments().getInt(KEY_SUBSCRIPTION_ID);
+        mUseNewApi = getContext().getResources().getBoolean(
+                com.android.internal.R.bool.config_enableNewAutoSelectNetworkUI);
+        mSubId = getArguments().getInt(MobileSettingsActivity.KEY_SUBSCRIPTION_ID);
 
-        mConnectedNetworkOperatorsPreference =
+        mConnectedPreferenceCategory =
                 (PreferenceCategory) findPreference(PREF_KEY_CONNECTED_NETWORK_OPERATOR);
-        mNetworkOperatorsPreferences =
+        mPreferenceCategory =
                 (PreferenceCategory) findPreference(PREF_KEY_NETWORK_OPERATORS);
         mStatusMessagePreference = new Preference(getContext());
-        mSelectedNetworkOperatorPreference = null;
+        mSelectedPreference = null;
         mTelephonyManager = TelephonyManager.from(getContext()).createForSubscriptionId(mSubId);
-        setRetainInstance(true);
+        mNetworkScanHelper = new NetworkScanHelper(
+                mTelephonyManager, mCallback, mNetworkScanExecutor);
+        PersistableBundle bundle = ((CarrierConfigManager) getContext().getSystemService(
+                Context.CARRIER_CONFIG_SERVICE)).getConfigForSubId(mSubId);
+        if (bundle != null) {
+            mShow4GForLTE = bundle.getBoolean(
+                    CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL);
+        }
+
+        mMetricsFeatureProvider = FeatureFactory
+                .getFactory(getContext()).getMetricsFeatureProvider();
     }
 
     @Override
     public void onViewCreated(View view, Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
 
-        mProgressHeader = setPinnedHeaderView(R.layout.wifi_progress_header)
-                .findViewById(R.id.progress_bar_animation);
-        setProgressBarVisible(false);
-        forceConfigConnectedNetworkOperatorsPreferenceCategory();
+        final Activity activity = getActivity();
+        if (activity != null) {
+            mProgressHeader = setPinnedHeaderView(R.layout.wifi_progress_header)
+                    .findViewById(R.id.progress_bar_animation);
+            setProgressBarVisible(false);
+        }
+        forceUpdateConnectedPreferenceCategory();
     }
 
     @Override
     public void onStart() {
         super.onStart();
-        new AsyncTask<Void, Void, List<String>>() {
-            @Override
-            protected List<String> doInBackground(Void... voids) {
-                String[] forbiddenPlmns = mTelephonyManager.getForbiddenPlmns();
-                return forbiddenPlmns != null ? Arrays.asList(forbiddenPlmns) : null;
-            }
+        mForbiddenPlmns = Arrays.asList(mTelephonyManager.getForbiddenPlmns());
+        setProgressBarVisible(true);
 
-            @Override
-            protected void onPostExecute(List<String> result) {
-                mForbiddenPlmns = result;
-                bindNetworkQueryService();
-            }
-        }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
-    }
-
-    /**
-     * Invoked on each preference click in this hierarchy, overrides
-     * PreferenceActivity's implementation.  Used to make sure we track the
-     * preference click events.
-     * Since the connected network operator is either faked (when no data connection) or already
-     * connected, we do not allow user to click the connected network operator.
-     */
-    @Override
-    public boolean onPreferenceTreeClick(Preference preference) {
-        if (DBG) logd("User clicked the screen");
-        stopNetworkQuery();
-        setProgressBarVisible(false);
-        if (preference instanceof NetworkOperatorPreference) {
-            // Refresh the last selected item in case users reselect network.
-            if (mSelectedNetworkOperatorPreference != null) {
-                mSelectedNetworkOperatorPreference.setSummary("");
-            }
-
-            mSelectedNetworkOperatorPreference = (NetworkOperatorPreference) preference;
-            CellInfo cellInfo = mSelectedNetworkOperatorPreference.getCellInfo();
-            if (DBG) logd("User click a NetworkOperatorPreference: " + cellInfo.toString());
-
-            // Send metrics event
-            MetricsLogger.action(getContext(),
-                    MetricsEvent.ACTION_MOBILE_NETWORK_MANUAL_SELECT_NETWORK);
-
-            // Connect to the network
-            if (SubscriptionManager.isValidSubscriptionId(mSubId)) {
-                if (DBG) {
-                    logd("Connect to the network: " + CellInfoUtil.getNetworkTitle(cellInfo));
-                }
-                // Set summary as "Connecting" to the selected network.
-                mSelectedNetworkOperatorPreference.setSummary(R.string.network_connecting);
-
-                // Set summary as "Disconnected" to the previously connected network
-                if (mConnectedNetworkOperatorsPreference.getPreferenceCount() > 0) {
-                    NetworkOperatorPreference connectedNetworkOperator = (NetworkOperatorPreference)
-                            (mConnectedNetworkOperatorsPreference.getPreference(0));
-                    if (!CellInfoUtil.getNetworkTitle(cellInfo).equals(
-                            CellInfoUtil.getNetworkTitle(connectedNetworkOperator.getCellInfo()))) {
-                        connectedNetworkOperator.setSummary(R.string.network_disconnected);
-                    }
-                }
-
-                OperatorInfo operatorInfo = CellInfoUtil.getOperatorInfoFromCellInfo(cellInfo);
-                if (DBG) logd("manually selected network operator: " + operatorInfo.toString());
-
-                ThreadUtils.postOnBackgroundThread(() -> {
-                    Message msg = mHandler.obtainMessage(EVENT_SET_NETWORK_SELECTION_MANUALLY_DONE);
-                    msg.obj = mTelephonyManager.setNetworkSelectionModeManual(
-                            operatorInfo.getOperatorNumeric(), true /* persistSelection */);
-                    msg.sendToTarget();
-                });
-
-                setProgressBarVisible(true);
-                return true;
-            } else {
-                loge("Error selecting network. Subscription Id is invalid.");
-                mSelectedNetworkOperatorPreference = null;
-                return false;
-            }
-
+        if (mUseNewApi) {
+            mNetworkScanHelper.startNetworkScan(
+                    NetworkScanHelper.NETWORK_SCAN_TYPE_INCREMENTAL_RESULTS);
         } else {
-            getPreferenceScreen().setEnabled(false);
-            return false;
+            mNetworkScanHelper.startNetworkScan(
+                    NetworkScanHelper.NETWORK_SCAN_TYPE_WAIT_FOR_ALL_RESULTS);
         }
     }
 
     @Override
     public void onStop() {
         super.onStop();
-        if (DBG) logd("onStop");
-        getView().removeCallbacks(mUpdateNetworkOperatorsRunnable);
         stopNetworkQuery();
-        // Unbind the NetworkQueryService
-        unbindNetworkQueryService();
+    }
+
+    @Override
+    public boolean onPreferenceTreeClick(Preference preference) {
+        if (preference != mSelectedPreference) {
+            stopNetworkQuery();
+            setProgressBarVisible(false);
+            // Refresh the last selected item in case users reselect network.
+            if (mSelectedPreference != null) {
+                mSelectedPreference.setSummary(null);
+            }
+
+            mSelectedPreference = (NetworkOperatorPreference) preference;
+            CellInfo cellInfo = mSelectedPreference.getCellInfo();
+
+            mMetricsFeatureProvider.action(getContext(),
+                    MetricsEvent.ACTION_MOBILE_NETWORK_MANUAL_SELECT_NETWORK);
+
+            // Set summary as "Disconnected" to the previously connected network
+            if (mConnectedPreferenceCategory.getPreferenceCount() > 0) {
+                NetworkOperatorPreference connectedNetworkOperator = (NetworkOperatorPreference)
+                        (mConnectedPreferenceCategory.getPreference(0));
+                if (!CellInfoUtil.getNetworkTitle(cellInfo).equals(
+                        CellInfoUtil.getNetworkTitle(connectedNetworkOperator.getCellInfo()))) {
+                    connectedNetworkOperator.setSummary(R.string.network_disconnected);
+                }
+            }
+
+            final OperatorInfo operatorInfo = CellInfoUtil.getOperatorInfoFromCellInfo(cellInfo);
+            final boolean isSuccess = mTelephonyManager.setNetworkSelectionModeManual(
+                    operatorInfo, true /* persistSelection */);
+            mSelectedPreference.setSummary(
+                    isSuccess ? R.string.network_connected : R.string.network_could_not_connect);
+        }
+
+        return true;
     }
 
     @Override
@@ -239,38 +197,18 @@
 
     @Override
     public int getMetricsCategory() {
-        //TODO(b/114749736): add metrics id for this page
-        return 0;
+        return MOBILE_NETWORK_SELECT;
     }
 
     private final Handler mHandler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
             switch (msg.what) {
-                case EVENT_SET_NETWORK_SELECTION_MANUALLY_DONE:
-                    if (DBG) logd("network selection done: hide the progress header");
-                    setProgressBarVisible(false);
-
-                    boolean isSuccessed = (boolean) msg.obj;
-                    if (isSuccessed) {
-                        if (DBG) logd("manual network selection: succeeded! ");
-                        // Set summary as "Connected" to the selected network.
-                        mSelectedNetworkOperatorPreference.setSummary(R.string.network_connected);
-                    } else {
-                        if (DBG) logd("manual network selection: failed! ");
-                        updateNetworkSelection();
-                        // Set summary as "Couldn't connect" to the selected network.
-                        mSelectedNetworkOperatorPreference.setSummary(
-                                R.string.network_could_not_connect);
-                    }
-                    break;
-
                 case EVENT_NETWORK_SCAN_RESULTS:
                     List<CellInfo> results = aggregateCellInfoList((List<CellInfo>) msg.obj);
                     mCellInfoList = new ArrayList<>(results);
-                    if (DBG) logd("after aggregate: " + mCellInfoList.toString());
                     if (mCellInfoList != null && mCellInfoList.size() != 0) {
-                        updateNetworkOperators();
+                        updateAllPreferenceCategory();
                     } else {
                         addMessagePreference(R.string.empty_networks_list);
                     }
@@ -278,15 +216,12 @@
                     break;
 
                 case EVENT_NETWORK_SCAN_ERROR:
-                    int error = msg.arg1;
-                    if (DBG) logd("error while querying available networks " + error);
                     stopNetworkQuery();
                     addMessagePreference(R.string.network_query_error);
                     break;
 
                 case EVENT_NETWORK_SCAN_COMPLETED:
                     stopNetworkQuery();
-                    if (DBG) logd("scan complete");
                     if (mCellInfoList == null) {
                         // In case the scan timeout before getting any results
                         addMessagePreference(R.string.empty_networks_list);
@@ -297,17 +232,24 @@
         }
     };
 
-    private void updateNetworkOperators() {
-        if (DBG) logd("updateNetworkOperators");
-        if (getActivity() != null) {
-            final View view = getView();
-            final Handler handler = view.getHandler();
-            if (handler != null && handler.hasCallbacks(mUpdateNetworkOperatorsRunnable)) {
-                return;
-            }
-            view.post(mUpdateNetworkOperatorsRunnable);
-        }
-    }
+    private final NetworkScanHelper.NetworkScanCallback mCallback =
+            new NetworkScanHelper.NetworkScanCallback() {
+                public void onResults(List<CellInfo> results) {
+                    Message msg = mHandler.obtainMessage(EVENT_NETWORK_SCAN_RESULTS, results);
+                    msg.sendToTarget();
+                }
+
+                public void onComplete() {
+                    Message msg = mHandler.obtainMessage(EVENT_NETWORK_SCAN_COMPLETED);
+                    msg.sendToTarget();
+                }
+
+                public void onError(int error) {
+                    Message msg = mHandler.obtainMessage(EVENT_NETWORK_SCAN_ERROR, error,
+                            0 /* arg2 */);
+                    msg.sendToTarget();
+                }
+            };
 
     /**
      * Update the currently available network operators list, which only contains the unregistered
@@ -317,17 +259,18 @@
      * network operator in the connected network operator category shows "Connected", it will not
      * exist in the available network category.
      */
-    private void updateNetworkOperatorsPreferenceCategory() {
-        mNetworkOperatorsPreferences.removeAll();
+    @VisibleForTesting
+    void updateAllPreferenceCategory() {
+        updateConnectedPreferenceCategory();
 
-        configConnectedNetworkOperatorsPreferenceCategory();
+        mPreferenceCategory.removeAll();
         for (int index = 0; index < mCellInfoList.size(); index++) {
             if (!mCellInfoList.get(index).isRegistered()) {
                 NetworkOperatorPreference pref = new NetworkOperatorPreference(
-                        mCellInfoList.get(index), getContext(), mForbiddenPlmns);
+                        mCellInfoList.get(index), getContext(), mForbiddenPlmns, mShow4GForLTE);
                 pref.setKey(CellInfoUtil.getNetworkTitle(mCellInfoList.get(index)));
                 pref.setOrder(index);
-                mNetworkOperatorsPreferences.addPreference(pref);
+                mPreferenceCategory.addPreference(pref);
             }
         }
     }
@@ -345,41 +288,35 @@
      * - If the device has no data, we will remove the connected network operators list from the
      * screen.
      */
-    private void forceConfigConnectedNetworkOperatorsPreferenceCategory() {
-        if (DBG) logd("Force config ConnectedNetworkOperatorsPreferenceCategory");
+    private void forceUpdateConnectedPreferenceCategory() {
         if (mTelephonyManager.getDataState() == mTelephonyManager.DATA_CONNECTED) {
             // Try to get the network registration states
             ServiceState ss = mTelephonyManager.getServiceState();
             List<NetworkRegistrationState> networkList =
                     ss.getNetworkRegistrationStates(AccessNetworkConstants.TransportType.WWAN);
             if (networkList == null || networkList.size() == 0) {
-                loge("getNetworkRegistrationStates return null");
                 // Remove the connected network operators category
-                removeConnectedNetworkOperatorPreference();
+                mConnectedPreferenceCategory.setVisible(false);
                 return;
             }
             CellIdentity cellIdentity = networkList.get(0).getCellIdentity();
             CellInfo cellInfo = CellInfoUtil.wrapCellInfoWithCellIdentity(cellIdentity);
             if (cellInfo != null) {
-                if (DBG) logd("Currently registered cell: " + cellInfo.toString());
-                NetworkOperatorPreference pref =
-                        new NetworkOperatorPreference(cellInfo, getContext(), mForbiddenPlmns);
+                NetworkOperatorPreference pref = new NetworkOperatorPreference(
+                        cellInfo, getContext(), mForbiddenPlmns, mShow4GForLTE);
                 pref.setTitle(mTelephonyManager.getNetworkOperatorName());
                 pref.setSummary(R.string.network_connected);
                 // Update the signal strength icon, since the default signalStrength value would be
                 // zero (it would be quite confusing why the connected network has no signal)
                 pref.setIcon(NetworkOperatorPreference.NUMBER_OF_LEVELS - 1);
-
-                mConnectedNetworkOperatorsPreference.addPreference(pref);
+                mConnectedPreferenceCategory.addPreference(pref);
             } else {
-                loge("Invalid CellIfno: " + cellInfo.toString());
                 // Remove the connected network operators category
-                removeConnectedNetworkOperatorPreference();
+                mConnectedPreferenceCategory.setVisible(false);
             }
         } else {
-            if (DBG) logd("No currently registered cell");
             // Remove the connected network operators category
-            removeConnectedNetworkOperatorPreference();
+            mConnectedPreferenceCategory.setVisible(false);
         }
     }
 
@@ -388,13 +325,7 @@
      * configured if the category is currently empty or the operator network title of the previous
      * connected network is different from the new one.
      */
-    private void configConnectedNetworkOperatorsPreferenceCategory() {
-        if (DBG) logd("config ConnectedNetworkOperatorsPreferenceCategory");
-        // Remove the category if the CellInfo list is empty or does not have registered cell.
-        if (mCellInfoList.size() == 0) {
-            if (DBG) logd("empty cellinfo list");
-            removeConnectedNetworkOperatorPreference();
-        }
+    private void updateConnectedPreferenceCategory() {
         CellInfo connectedNetworkOperator = null;
         for (CellInfo cellInfo : mCellInfoList) {
             if (cellInfo.isRegistered()) {
@@ -402,60 +333,19 @@
                 break;
             }
         }
-        if (connectedNetworkOperator == null) {
-            if (DBG) logd("no registered network");
-            removeConnectedNetworkOperatorPreference();
-            return;
-        }
 
-        // config the category if it is empty.
-        if (mConnectedNetworkOperatorsPreference.getPreferenceCount() == 0) {
-            if (DBG) logd("ConnectedNetworkSelectList is empty, add one");
+        if (connectedNetworkOperator != null) {
             addConnectedNetworkOperatorPreference(connectedNetworkOperator);
-            return;
         }
-        NetworkOperatorPreference previousConnectedNetworkOperator = (NetworkOperatorPreference)
-                (mConnectedNetworkOperatorsPreference.getPreference(0));
-
-        // config the category if the network title of the previous connected network is different
-        // from the new one.
-        String cTitle = CellInfoUtil.getNetworkTitle(connectedNetworkOperator);
-        String pTitle = CellInfoUtil.getNetworkTitle(
-                previousConnectedNetworkOperator.getCellInfo());
-        if (!cTitle.equals(pTitle)) {
-            if (DBG) logd("reconfig the category: connected network changed");
-            addConnectedNetworkOperatorPreference(connectedNetworkOperator);
-            return;
-        }
-        if (DBG) logd("same network operator is connected, only refresh the connected network");
-        // Otherwise same network operator is connected, only refresh the connected network
-        // operator preference (first and the only one in this category).
-        ((NetworkOperatorPreference) mConnectedNetworkOperatorsPreference.getPreference(0))
-                .refresh();
-        return;
     }
 
-    /**
-     * Creates a Preference for the given {@link CellInfo} and adds it to the
-     * {@link #mConnectedNetworkOperatorsPreference}.
-     */
     private void addConnectedNetworkOperatorPreference(CellInfo cellInfo) {
-        if (DBG) logd("addConnectedNetworkOperatorPreference");
-        // Remove the current ConnectedNetworkOperatorsPreference
-        removeConnectedNetworkOperatorPreference();
-        final NetworkOperatorPreference pref =
-                new NetworkOperatorPreference(cellInfo, getContext(), mForbiddenPlmns);
+        mConnectedPreferenceCategory.removeAll();
+        final NetworkOperatorPreference pref = new NetworkOperatorPreference(
+                cellInfo, getContext(), mForbiddenPlmns, mShow4GForLTE);
         pref.setSummary(R.string.network_connected);
-        mConnectedNetworkOperatorsPreference.addPreference(pref);
-        PreferenceScreen preferenceScreen = getPreferenceScreen();
-        preferenceScreen.addPreference(mConnectedNetworkOperatorsPreference);
-    }
-
-    /** Removes all preferences and hide the {@link #mConnectedNetworkOperatorsPreference}. */
-    private void removeConnectedNetworkOperatorPreference() {
-        mConnectedNetworkOperatorsPreference.removeAll();
-        PreferenceScreen preferenceScreen = getPreferenceScreen();
-        preferenceScreen.removePreference(mConnectedNetworkOperatorsPreference);
+        mConnectedPreferenceCategory.addPreference(pref);
+        mConnectedPreferenceCategory.setVisible(true);
     }
 
     protected void setProgressBarVisible(boolean visible) {
@@ -465,14 +355,11 @@
     }
 
     private void addMessagePreference(int messageId) {
-        if (DBG) logd("remove callback");
-        getView().removeCallbacks(mUpdateNetworkOperatorsRunnable);
         setProgressBarVisible(false);
-        if (DBG) logd("addMessagePreference");
         mStatusMessagePreference.setTitle(messageId);
-        removeConnectedNetworkOperatorPreference();
-        mNetworkOperatorsPreferences.removeAll();
-        mNetworkOperatorsPreferences.addPreference(mStatusMessagePreference);
+        mConnectedPreferenceCategory.setVisible(false);
+        mPreferenceCategory.removeAll();
+        mPreferenceCategory.addPreference(mStatusMessagePreference);
     }
 
     /**
@@ -481,7 +368,6 @@
      * with the strongest signal strength.
      */
     private List<CellInfo> aggregateCellInfoList(List<CellInfo> cellInfoList) {
-        if (DBG) logd("before aggregate: " + cellInfoList.toString());
         Map<String, CellInfo> map = new HashMap<>();
         for (CellInfo cellInfo : cellInfoList) {
             String plmn = CellInfoUtil.getOperatorInfoFromCellInfo(cellInfo).getOperatorNumeric();
@@ -501,57 +387,16 @@
         return new ArrayList<>(map.values());
     }
 
-    private void loadNetworksList() {
-        if (DBG) logd("load networks list...");
-        setProgressBarVisible(true);
-        //TODO(b/114749736): load network list once b/115401728 is done
-    }
-
-    private void bindNetworkQueryService() {
-        if (DBG) logd("bindNetworkQueryService");
-        //TODO(b/114749736): bind service/manager once b/115401728 is done
-        mShouldUnbind = true;
-    }
-
-    private void unbindNetworkQueryService() {
-        if (DBG) logd("unbindNetworkQueryService");
-        if (mShouldUnbind) {
-            if (DBG) logd("mShouldUnbind is true");
-            // unbind the service.
-            //TODO(b/114749736): unbind service/manager once b/115401728 is done
-            mShouldUnbind = false;
+    private void stopNetworkQuery() {
+        setProgressBarVisible(false);
+        if (mNetworkScanHelper != null) {
+            mNetworkScanHelper.stopNetworkQuery();
         }
     }
 
-    private void updateNetworkSelection() {
-        if (DBG) logd("Update notification about no service of user selected operator");
-        //TODO(b/114749736): update network selection once b/115429509 is done
+    @Override
+    public void onDestroy() {
+        mNetworkScanExecutor.shutdown();
+        super.onDestroy();
     }
-
-    private void stopNetworkQuery() {
-        // Stop the network query process
-        //TODO(b/114749736): stop service/manager query once b/115401728 is done
-    }
-
-    private void logd(String msg) {
-        Log.d(TAG, msg);
-    }
-
-    private void loge(String msg) {
-        Log.e(TAG, msg);
-    }
-
-    public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
-            new BaseSearchIndexProvider() {
-                @Override
-                public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
-                        boolean enabled) {
-                    final ArrayList<SearchIndexableResource> result = new ArrayList<>();
-
-                    final SearchIndexableResource sir = new SearchIndexableResource(context);
-                    sir.xmlResId = R.xml.choose_network;
-                    result.add(sir);
-                    return result;
-                }
-            };
 }
diff --git a/src/com/android/settings/network/telephony/cdma/CdmaApnPreferenceController.java b/src/com/android/settings/network/telephony/cdma/CdmaApnPreferenceController.java
deleted file mode 100644
index eaacdb2..0000000
--- a/src/com/android/settings/network/telephony/cdma/CdmaApnPreferenceController.java
+++ /dev/null
@@ -1,87 +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.network.telephony.cdma;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.PersistableBundle;
-import android.provider.Settings;
-import android.telephony.CarrierConfigManager;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.SettingsActivity;
-import com.android.settings.network.ApnSettings;
-import com.android.settings.network.telephony.MobileNetworkUtils;
-import com.android.settingslib.RestrictedLockUtilsInternal;
-import com.android.settingslib.RestrictedPreference;
-
-/**
- * Preference controller for "CDMA Apn"
- */
-public class CdmaApnPreferenceController extends CdmaBasePreferenceController {
-
-    private static final String CATEGORY_KEY = "category_cdma_apn_key";
-    @VisibleForTesting
-    CarrierConfigManager mCarrierConfigManager;
-
-    public CdmaApnPreferenceController(Context context, String key) {
-        super(context, key);
-        mCarrierConfigManager = new CarrierConfigManager(context);
-    }
-
-    @Override
-    public int getAvailabilityStatus() {
-        final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSubId);
-
-        return carrierConfig != null
-                && carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_APN_SETTING_CDMA_BOOL)
-                && MobileNetworkUtils.isCdmaOptions(mContext, mSubId)
-                ? AVAILABLE
-                : CONDITIONALLY_UNAVAILABLE;
-    }
-
-    @Override
-    public void displayPreference(PreferenceScreen screen) {
-        super.displayPreference(screen);
-        if (isAvailable()) {
-            ((RestrictedPreference) mPreference).setDisabledByAdmin(
-                    MobileNetworkUtils.isDpcApnEnforced(mContext)
-                            ? RestrictedLockUtilsInternal.getDeviceOwner(mContext)
-                            : null);
-        } else {
-            screen.findPreference(CATEGORY_KEY).setVisible(false);
-        }
-    }
-
-    @Override
-    public boolean handlePreferenceTreeClick(Preference preference) {
-        if (getPreferenceKey().equals(preference.getKey())) {
-            // This activity runs in phone process, we must use intent to start
-            final Intent intent = new Intent(Settings.ACTION_APN_SETTINGS);
-            // This will setup the Home and Search affordance
-            intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_AS_SUBSETTING, true);
-            intent.putExtra(ApnSettings.SUB_ID, mSubId);
-            mContext.startActivity(intent);
-            return true;
-        }
-
-        return false;
-    }
-}
diff --git a/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceController.java b/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceController.java
new file mode 100644
index 0000000..72f69cd
--- /dev/null
+++ b/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceController.java
@@ -0,0 +1,135 @@
+/*
+ * 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.network.telephony.gsm;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.os.PersistableBundle;
+import android.telephony.CarrierConfigManager;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+
+import androidx.preference.Preference;
+
+import com.android.internal.logging.nano.MetricsProto;
+import com.android.settings.R;
+import com.android.settings.core.SubSettingLauncher;
+import com.android.settings.core.TogglePreferenceController;
+import com.android.settings.network.telephony.MobileNetworkUtils;
+import com.android.settings.network.telephony.MobileSettingsActivity;
+import com.android.settings.network.telephony.NetworkSelectSettings;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Preference controller for "Auto Select Network"
+ */
+public class AutoSelectPreferenceController extends TogglePreferenceController {
+
+    private int mSubId;
+    private TelephonyManager mTelephonyManager;
+    private boolean mOnlyAutoSelectInHome;
+    private List<OnNetworkSelectModeListener> mListeners;
+
+    public AutoSelectPreferenceController(Context context, String key) {
+        super(context, key);
+        mTelephonyManager = context.getSystemService(TelephonyManager.class);
+        mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+        mListeners = new ArrayList<>();
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return MobileNetworkUtils.shouldDisplayNetworkSelectOptions(mContext,mSubId)
+                ? AVAILABLE
+                : CONDITIONALLY_UNAVAILABLE;
+    }
+
+    @Override
+    public boolean isChecked() {
+        return mTelephonyManager.getNetworkSelectionMode()
+                == TelephonyManager.NETWORK_SELECTION_MODE_AUTO;
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        super.updateState(preference);
+
+        preference.setSummary(null);
+        if (mTelephonyManager.getServiceState().getRoaming()) {
+            preference.setEnabled(true);
+        } else {
+            preference.setEnabled(!mOnlyAutoSelectInHome);
+            if (mOnlyAutoSelectInHome) {
+                preference.setSummary(mContext.getString(
+                        R.string.manual_mode_disallowed_summary,
+                        mTelephonyManager.getSimOperatorName()));
+            }
+        }
+    }
+
+    @Override
+    public boolean setChecked(boolean isChecked) {
+        if (isChecked) {
+            mTelephonyManager.setNetworkSelectionModeAutomatic();
+
+            for (OnNetworkSelectModeListener lsn : mListeners) {
+                lsn.onNetworkSelectModeChanged();
+            }
+            // Manually check whether it is successfully
+            return mTelephonyManager.getNetworkSelectionMode()
+                    == TelephonyManager.NETWORK_SELECTION_MODE_AUTO;
+        } else {
+            final Bundle bundle = new Bundle();
+            bundle.putInt(MobileSettingsActivity.KEY_SUBSCRIPTION_ID, mSubId);
+            new SubSettingLauncher(mContext)
+                    .setDestination(NetworkSelectSettings.class.getName())
+                    .setSourceMetricsCategory(MetricsProto.MetricsEvent.MOBILE_NETWORK_SELECT)
+                    .setTitleRes(R.string.choose_network_title)
+                    .setArguments(bundle)
+                    .launch();
+            return false;
+        }
+    }
+
+    public AutoSelectPreferenceController init(int subId) {
+        mSubId = subId;
+        mTelephonyManager = TelephonyManager.from(mContext).createForSubscriptionId(mSubId);
+        final PersistableBundle carrierConfig = mContext.getSystemService(
+                CarrierConfigManager.class).getConfigForSubId(mSubId);
+        mOnlyAutoSelectInHome = carrierConfig.getBoolean(
+                CarrierConfigManager.KEY_ONLY_AUTO_SELECT_IN_HOME_NETWORK_BOOL);
+
+        return this;
+    }
+
+    public AutoSelectPreferenceController addListener(OnNetworkSelectModeListener lsn) {
+        mListeners.add(lsn);
+
+        return this;
+    }
+
+    /**
+     * Callback when network select mode is changed
+     *
+     * @see TelephonyManager#getNetworkSelectionMode()
+     */
+    public interface OnNetworkSelectModeListener {
+        void onNetworkSelectModeChanged();
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceController.java b/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceController.java
new file mode 100644
index 0000000..9ea977c
--- /dev/null
+++ b/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceController.java
@@ -0,0 +1,110 @@
+/*
+ * 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.network.telephony.gsm;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.telephony.ServiceState;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+import android.text.TextUtils;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceScreen;
+
+import com.android.internal.logging.nano.MetricsProto;
+import com.android.settings.R;
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.core.SubSettingLauncher;
+import com.android.settings.network.telephony.MobileNetworkUtils;
+import com.android.settings.network.telephony.MobileSettingsActivity;
+import com.android.settings.network.telephony.NetworkSelectSettings;
+
+/**
+ * Preference controller for "Open network select"
+ */
+public class OpenNetworkSelectPagePreferenceController extends BasePreferenceController implements
+        AutoSelectPreferenceController.OnNetworkSelectModeListener {
+
+    private int mSubId;
+    private TelephonyManager mTelephonyManager;
+    private Preference mPreference;
+
+    public OpenNetworkSelectPagePreferenceController(Context context, String key) {
+        super(context, key);
+        mTelephonyManager = context.getSystemService(TelephonyManager.class);
+        mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        return MobileNetworkUtils.shouldDisplayNetworkSelectOptions(mContext, mSubId)
+                ? AVAILABLE
+                : CONDITIONALLY_UNAVAILABLE;
+    }
+
+    @Override
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+        mPreference = screen.findPreference(getPreferenceKey());
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        super.updateState(preference);
+        preference.setEnabled(mTelephonyManager.getNetworkSelectionMode()
+                != TelephonyManager.NETWORK_SELECTION_MODE_AUTO);
+    }
+
+    @Override
+    public CharSequence getSummary() {
+        final ServiceState ss = mTelephonyManager.getServiceState();
+        if (ss != null && ss.getState() == ServiceState.STATE_IN_SERVICE) {
+            return mTelephonyManager.getNetworkOperatorName();
+        } else {
+            return mContext.getString(R.string.network_disconnected);
+        }
+    }
+
+    @Override
+    public boolean handlePreferenceTreeClick(Preference preference) {
+        if (TextUtils.equals(preference.getKey(), getPreferenceKey())) {
+            final Bundle bundle = new Bundle();
+            bundle.putInt(MobileSettingsActivity.KEY_SUBSCRIPTION_ID, mSubId);
+            new SubSettingLauncher(mContext)
+                    .setDestination(NetworkSelectSettings.class.getName())
+                    .setSourceMetricsCategory(MetricsProto.MetricsEvent.MOBILE_NETWORK_SELECT)
+                    .setTitleRes(R.string.choose_network_title)
+                    .setArguments(bundle)
+                    .launch();
+            return true;
+        }
+
+        return false;
+    }
+
+    public OpenNetworkSelectPagePreferenceController init(int subId) {
+        mSubId = subId;
+        mTelephonyManager = TelephonyManager.from(mContext).createForSubscriptionId(mSubId);
+        return this;
+    }
+
+    @Override
+    public void onNetworkSelectModeChanged() {
+        updateState(mPreference);
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/security/SecuritySettings.java b/src/com/android/settings/security/SecuritySettings.java
index 72dd91b..eb0d6f1 100644
--- a/src/com/android/settings/security/SecuritySettings.java
+++ b/src/com/android/settings/security/SecuritySettings.java
@@ -18,21 +18,16 @@
 import static com.android.settings.security.EncryptionStatusPreferenceController
         .PREF_KEY_ENCRYPTION_SECURITY_PAGE;
 
-import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
-import android.hardware.face.FaceManager;
-import android.hardware.fingerprint.FingerprintManager;
 import android.provider.SearchIndexableResource;
 
 import com.android.internal.logging.nano.MetricsProto;
 import com.android.settings.R;
-import com.android.settings.Utils;
 import com.android.settings.biometrics.face.FaceStatusPreferenceController;
 import com.android.settings.biometrics.fingerprint.FingerprintProfileStatusPreferenceController;
 import com.android.settings.biometrics.fingerprint.FingerprintStatusPreferenceController;
 import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.dashboard.SummaryLoader;
 import com.android.settings.enterprise.EnterprisePrivacyPreferenceController;
 import com.android.settings.location.LocationPreferenceController;
 import com.android.settings.search.BaseSearchIndexProvider;
@@ -166,44 +161,4 @@
                             null /* host*/);
                 }
             };
-
-    static class SummaryProvider implements SummaryLoader.SummaryProvider {
-
-        private final Context mContext;
-        private final SummaryLoader mSummaryLoader;
-
-        public SummaryProvider(Context context, SummaryLoader summaryLoader) {
-            mContext = context;
-            mSummaryLoader = summaryLoader;
-        }
-
-        @Override
-        public void setListening(boolean listening) {
-            if (listening) {
-                final FingerprintManager fpm =
-                        Utils.getFingerprintManagerOrNull(mContext);
-                final FaceManager faceManager =
-                        Utils.getFaceManagerOrNull(mContext);
-                if (faceManager != null && faceManager.isHardwareDetected()) {
-                    mSummaryLoader.setSummary(this,
-                            mContext.getString(R.string.security_dashboard_summary_face));
-                } else if (fpm != null && fpm.isHardwareDetected()) {
-                    mSummaryLoader.setSummary(this,
-                            mContext.getString(R.string.security_dashboard_summary));
-                } else {
-                    mSummaryLoader.setSummary(this, mContext.getString(
-                            R.string.security_dashboard_summary_no_fingerprint));
-                }
-            }
-        }
-    }
-
-    public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY =
-            new SummaryLoader.SummaryProviderFactory() {
-                @Override
-                public SummaryLoader.SummaryProvider createSummaryProvider(Activity activity,
-                        SummaryLoader summaryLoader) {
-                    return new SummaryProvider(activity, summaryLoader);
-                }
-            };
 }
diff --git a/tests/robotests/assets/grandfather_not_implementing_index_provider b/tests/robotests/assets/grandfather_not_implementing_index_provider
index 38108f7..6f4deca 100644
--- a/tests/robotests/assets/grandfather_not_implementing_index_provider
+++ b/tests/robotests/assets/grandfather_not_implementing_index_provider
@@ -50,6 +50,7 @@
 com.android.settings.localepicker.LocaleListEditor
 com.android.settings.network.ApnEditor
 com.android.settings.network.ApnSettings
+com.android.settings.network.telephony.NetworkSelectSettings
 com.android.settings.notification.AppNotificationSettings
 com.android.settings.notification.ChannelGroupNotificationSettings
 com.android.settings.notification.ChannelNotificationSettings
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java
index 3f19ccb..0430e0f 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java
@@ -72,7 +72,7 @@
         FakeFeatureFactory.setupForTest();
         ShadowEntityHeaderController.setUseMock(mHeaderController);
         when(mBluetoothManager.getCachedDeviceManager()).thenReturn(mCachedDeviceManager);
-        when(mCachedDeviceManager.getHearingAidPairDeviceSummary(mCachedDevice)).thenReturn("abc");
+        when(mCachedDeviceManager.getSubDeviceSummary(mCachedDevice)).thenReturn("abc");
         mController =
             new BluetoothDetailsHeaderController(mContext, mFragment, mCachedDevice, mLifecycle,
                 mBluetoothManager);
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java
index 4ede947..19e3bfb 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java
@@ -63,8 +63,12 @@
     @Mock
     private CachedBluetoothDevice mCachedBluetoothDevice;
     @Mock
+    private CachedBluetoothDevice mSubCachedBluetoothDevice;
+    @Mock
     private BluetoothDevice mBluetoothDevice;
     @Mock
+    private BluetoothDevice mSubBluetoothDevice;
+    @Mock
     private SettingsActivity mSettingsActivity;
     @Mock
     private LocalBluetoothManager mLocalManager;
@@ -86,6 +90,7 @@
         mCachedDevices.add(mCachedBluetoothDevice);
         doReturn(mContext).when(mDashboardFragment).getContext();
         when(mCachedBluetoothDevice.getDevice()).thenReturn(mBluetoothDevice);
+        when(mSubCachedBluetoothDevice.getDevice()).thenReturn(mSubBluetoothDevice);
         when(mLocalManager.getCachedDeviceManager()).thenReturn(mCachedDeviceManager);
         when(mCachedDeviceManager.getCachedDevicesCopy()).thenReturn(mCachedDevices);
 
@@ -147,6 +152,20 @@
     }
 
     @Test
+    public void testRemovePreference_subDeviceExist_removePreference() {
+        when(mCachedBluetoothDevice.getSubDevice()).thenReturn(mSubCachedBluetoothDevice);
+        mBluetoothDeviceUpdater.mPreferenceMap.put(mSubBluetoothDevice, mPreference);
+
+        assertThat(mBluetoothDeviceUpdater.mPreferenceMap.
+                containsKey(mSubBluetoothDevice)).isTrue();
+        mBluetoothDeviceUpdater.removePreference(mCachedBluetoothDevice);
+
+        verify(mDevicePreferenceCallback).onDeviceRemoved(mPreference);
+        assertThat(mBluetoothDeviceUpdater.mPreferenceMap.
+                containsKey(mSubBluetoothDevice)).isFalse();
+    }
+
+    @Test
     public void testDeviceProfilesListener_click_startBluetoothDeviceDetailPage() {
         doReturn(mSettingsActivity).when(mDashboardFragment).getContext();
 
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterTest.java
deleted file mode 100644
index f544f09..0000000
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterTest.java
+++ /dev/null
@@ -1,282 +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.dashboard;
-
-import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_TITLE;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.reset;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.pm.ActivityInfo;
-import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.Icon;
-import android.os.Bundle;
-import android.service.settings.suggestions.Suggestion;
-import android.util.DisplayMetrics;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.WindowManager;
-import android.widget.TextView;
-
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.android.settings.R;
-import com.android.settings.SettingsActivity;
-import com.android.settings.dashboard.suggestions.SuggestionAdapter;
-import com.android.settings.homepage.conditional.ConditionManager;
-import com.android.settings.homepage.conditional.ConditionalCard;
-import com.android.settings.testutils.FakeFeatureFactory;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settings.testutils.shadow.SettingsShadowResources;
-import com.android.settings.widget.RoundedHomepageIcon;
-import com.android.settingslib.drawer.CategoryKey;
-import com.android.settingslib.drawer.Tile;
-import com.android.settingslib.utils.IconCache;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-import org.robolectric.util.ReflectionHelpers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@RunWith(SettingsRobolectricTestRunner.class)
-@Config(shadows = SettingsShadowResources.SettingsShadowTheme.class)
-public class DashboardAdapterTest {
-
-    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
-    private SettingsActivity mContext;
-    @Mock
-    private ConditionalCard mCondition;
-    @Mock
-    private Resources mResources;
-    @Mock
-    private WindowManager mWindowManager;
-    @Mock
-    private ConditionManager mConditionManager;
-
-    private ActivityInfo mActivityInfo;
-    private DashboardAdapter mDashboardAdapter;
-    private List<ConditionalCard> mConditionList;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        FakeFeatureFactory.setupForTest();
-        mActivityInfo = new ActivityInfo();
-        mActivityInfo.packageName = "pkg";
-        mActivityInfo.name = "class";
-        mActivityInfo.metaData = new Bundle();
-        mActivityInfo.metaData.putString(META_DATA_PREFERENCE_TITLE, "test-title");
-
-        when(mContext.getSystemService(Context.WINDOW_SERVICE)).thenReturn(mWindowManager);
-        when(mContext.getResources()).thenReturn(mResources);
-        when(mResources.getQuantityString(any(int.class), any(int.class), any())).thenReturn("");
-
-        mConditionList = new ArrayList<>();
-        mConditionList.add(mCondition);
-        mDashboardAdapter = new DashboardAdapter(mContext, null /* savedInstanceState */,
-                mConditionManager, null /* suggestionControllerMixin */, null /* lifecycle */);
-    }
-
-    @Test
-    public void onSuggestionClosed_notOnlySuggestion_updateSuggestionOnly() {
-        final DashboardAdapter adapter =
-                spy(new DashboardAdapter(mContext, null /* savedInstanceState */,
-                        mConditionManager,
-                        null /* suggestionControllerMixin */,
-                        null /* lifecycle */));
-        final List<Suggestion> suggestions = makeSuggestions("pkg1", "pkg2", "pkg3");
-        adapter.setSuggestions(suggestions);
-
-        final RecyclerView data = mock(RecyclerView.class);
-        when(data.getResources()).thenReturn(mResources);
-        when(data.getContext()).thenReturn(mContext);
-        when(mResources.getDisplayMetrics()).thenReturn(mock(DisplayMetrics.class));
-        final View itemView = mock(View.class);
-        when(itemView.findViewById(R.id.suggestion_list)).thenReturn(data);
-        when(itemView.findViewById(android.R.id.summary)).thenReturn(mock(TextView.class));
-        when(itemView.findViewById(android.R.id.title)).thenReturn(mock(TextView.class));
-        final DashboardAdapter.SuggestionContainerHolder holder =
-                new DashboardAdapter.SuggestionContainerHolder(itemView);
-
-        adapter.onBindSuggestion(holder, 0);
-
-        reset(adapter); // clear interactions tracking
-
-        final Suggestion suggestionToRemove = suggestions.get(1);
-        adapter.onSuggestionClosed(suggestionToRemove);
-
-        assertThat(suggestions.size()).isEqualTo(2);
-        assertThat(suggestions.contains(suggestionToRemove)).isFalse();
-        verify(adapter).notifyDashboardDataChanged(any());
-    }
-
-    @Test
-    public void onSuggestionClosed_onlySuggestion_updateDashboardData() {
-        final DashboardAdapter adapter =
-                spy(new DashboardAdapter(mContext, null /* savedInstanceState */,
-                        mConditionManager,
-                        null /* suggestionControllerMixin */, null /* lifecycle */));
-        final List<Suggestion> suggestions = makeSuggestions("pkg1");
-        adapter.setSuggestions(suggestions);
-        final DashboardData dashboardData = adapter.mDashboardData;
-        reset(adapter); // clear interactions tracking
-
-        adapter.onSuggestionClosed(suggestions.get(0));
-
-        assertThat(adapter.mDashboardData).isNotEqualTo(dashboardData);
-        verify(adapter).notifyDashboardDataChanged(any());
-    }
-
-    @Test
-    public void onSuggestionClosed_notInSuggestionList_shouldNotUpdateSuggestionList() {
-        final DashboardAdapter adapter =
-                spy(new DashboardAdapter(mContext, null /* savedInstanceState */,
-                        mConditionManager,
-                        null /* suggestionControllerMixin */, null /* lifecycle */));
-        final List<Suggestion> suggestions = makeSuggestions("pkg1");
-        adapter.setSuggestions(suggestions);
-
-        reset(adapter); // clear interactions tracking
-
-        adapter.onSuggestionClosed(mock(Suggestion.class));
-
-        verify(adapter, never()).setSuggestions(any());
-    }
-
-    @Test
-    public void onBindSuggestion_shouldSetSuggestionAdapterAndNoCrash() {
-        mDashboardAdapter = new DashboardAdapter(mContext, null /* savedInstanceState */,
-                mConditionManager, null /* suggestionControllerMixin */, null /* lifecycle */);
-        final List<Suggestion> suggestions = makeSuggestions("pkg1");
-
-        mDashboardAdapter.setSuggestions(suggestions);
-
-        final RecyclerView data = mock(RecyclerView.class);
-        when(data.getResources()).thenReturn(mResources);
-        when(data.getContext()).thenReturn(mContext);
-        when(mResources.getDisplayMetrics()).thenReturn(mock(DisplayMetrics.class));
-        final View itemView = mock(View.class);
-        when(itemView.findViewById(R.id.suggestion_list)).thenReturn(data);
-        when(itemView.findViewById(android.R.id.summary)).thenReturn(mock(TextView.class));
-        when(itemView.findViewById(android.R.id.title)).thenReturn(mock(TextView.class));
-        final DashboardAdapter.SuggestionContainerHolder holder =
-                new DashboardAdapter.SuggestionContainerHolder(itemView);
-
-        mDashboardAdapter.onBindSuggestion(holder, 0);
-
-        verify(data).setAdapter(any(SuggestionAdapter.class));
-        // should not crash
-    }
-
-    @Test
-    public void onBindTile_internalTile_shouldNotUseGenericBackgroundIcon() {
-        final Context context = RuntimeEnvironment.application;
-        final View view = LayoutInflater.from(context).inflate(R.layout.dashboard_tile, null);
-        final DashboardAdapter.DashboardItemHolder holder =
-                new DashboardAdapter.DashboardItemHolder(view);
-        final Tile tile = spy(new Tile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE));
-        doReturn(Icon.createWithResource(context, R.drawable.ic_settings))
-                .when(tile).getIcon(context);
-        final IconCache iconCache = mock(IconCache.class);
-        when(iconCache.getIcon(tile.getIcon(context)))
-                .thenReturn(context.getDrawable(R.drawable.ic_settings));
-
-        mDashboardAdapter = new DashboardAdapter(context, null /* savedInstanceState */,
-                mConditionManager, null /* suggestionControllerMixin */, null /* lifecycle */);
-        ReflectionHelpers.setField(mDashboardAdapter, "mCache", iconCache);
-        mDashboardAdapter.onBindTile(holder, tile);
-
-        verify(iconCache, never()).updateIcon(any(Icon.class), any(Drawable.class));
-    }
-
-    @Test
-    public void onBindTile_externalTile_shouldUpdateIcon() {
-        final Context context = spy(RuntimeEnvironment.application);
-        final View view = LayoutInflater.from(context).inflate(R.layout.dashboard_tile, null);
-        final DashboardAdapter.DashboardItemHolder holder =
-                new DashboardAdapter.DashboardItemHolder(view);
-        final Tile tile = spy(new Tile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE));
-        final Icon icon = Icon.createWithResource(context, R.drawable.ic_settings);
-        doReturn(icon).when(tile).getIcon(context);
-
-        final IconCache iconCache = new IconCache(context);
-
-        mDashboardAdapter = new DashboardAdapter(context, null /* savedInstanceState */,
-                mConditionManager,
-                null /* suggestionControllerMixin */, null /* lifecycle */);
-        ReflectionHelpers.setField(mDashboardAdapter, "mCache", iconCache);
-
-        doReturn("another.package").when(context).getPackageName();
-        mDashboardAdapter.onBindTile(holder, tile);
-
-        assertThat(iconCache.getIcon(tile.getIcon(context)))
-                .isInstanceOf(RoundedHomepageIcon.class);
-    }
-
-    @Test
-    public void onBindTile_externalTile_usingRoundedHomepageIcon_shouldNotUpdateIcon() {
-        final Context context = RuntimeEnvironment.application;
-        final View view = LayoutInflater.from(context).inflate(R.layout.dashboard_tile, null);
-        final DashboardAdapter.DashboardItemHolder holder =
-                new DashboardAdapter.DashboardItemHolder(view);
-        final Tile tile = spy(new Tile(mActivityInfo, CategoryKey.CATEGORY_HOMEPAGE));
-        doReturn(mock(Icon.class)).when(tile).getIcon(context);
-        when(tile.getIcon(context).getResPackage()).thenReturn("another.package");
-
-        final IconCache iconCache = mock(IconCache.class);
-        when(iconCache.getIcon(tile.getIcon(context))).thenReturn(mock(RoundedHomepageIcon.class));
-
-        mDashboardAdapter = new DashboardAdapter(context, null /* savedInstanceState */,
-                mConditionManager, null /* suggestionControllerMixin */, null /* lifecycle */);
-        ReflectionHelpers.setField(mDashboardAdapter, "mCache", iconCache);
-
-        mDashboardAdapter.onBindTile(holder, tile);
-
-        verify(iconCache, never()).updateIcon(eq(tile.getIcon(context)),
-                any(RoundedHomepageIcon.class));
-    }
-
-    private List<Suggestion> makeSuggestions(String... pkgNames) {
-        final List<Suggestion> suggestions = new ArrayList<>();
-        for (String pkgName : pkgNames) {
-            final Suggestion suggestion = new Suggestion.Builder(pkgName)
-                    .setPendingIntent(mock(PendingIntent.class))
-                    .build();
-            suggestions.add(suggestion);
-        }
-        return suggestions;
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardDataTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardDataTest.java
deleted file mode 100644
index 73b1734..0000000
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardDataTest.java
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * Copyright (C) 2016 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.dashboard;
-
-import static com.android.settings.dashboard.DashboardData.STABLE_ID_CONDITION_CONTAINER;
-import static com.android.settings.dashboard.DashboardData.STABLE_ID_CONDITION_FOOTER;
-import static com.android.settings.dashboard.DashboardData.STABLE_ID_SUGGESTION_CONDITION_DIVIDER;
-import static com.android.settings.dashboard.DashboardData.STABLE_ID_SUGGESTION_CONTAINER;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import android.app.PendingIntent;
-import android.service.settings.suggestions.Suggestion;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.DiffUtil;
-import androidx.recyclerview.widget.ListUpdateCallback;
-
-import com.android.settings.homepage.conditional.AirplaneModeConditionCard;
-import com.android.settings.homepage.conditional.ConditionalCard;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settingslib.drawer.CategoryKey;
-import com.android.settingslib.drawer.DashboardCategory;
-import com.android.settingslib.drawer.Tile;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-@RunWith(SettingsRobolectricTestRunner.class)
-public class DashboardDataTest {
-
-    private static final String TEST_SUGGESTION_TITLE = "Use fingerprint";
-    private static final int TEST_TILE_ID = 12345;
-
-    private DashboardData mDashboardDataWithOneConditions;
-    private DashboardData mDashboardDataWithTwoConditions;
-    private DashboardData mDashboardDataWithNoItems;
-    private DashboardCategory mDashboardCategory;
-    @Mock
-    private Tile mTestCategoryTile;
-    @Mock
-    private ConditionalCard mTestCondition;
-    @Mock
-    private ConditionalCard mSecondCondition; // condition used to test insert in DiffUtil
-    private Suggestion mTestSuggestion;
-
-    @Before
-    public void SetUp() {
-        MockitoAnnotations.initMocks(this);
-
-        mDashboardCategory = new DashboardCategory(CategoryKey.CATEGORY_HOMEPAGE);
-
-        // Build suggestions
-        final List<Suggestion> suggestions = new ArrayList<>();
-        mTestSuggestion = new Suggestion.Builder("pkg")
-                .setTitle(TEST_SUGGESTION_TITLE)
-                .setPendingIntent(mock(PendingIntent.class))
-                .build();
-        suggestions.add(mTestSuggestion);
-
-        // Build oneItemConditions
-        final List<ConditionalCard> oneItemConditions = new ArrayList<>();
-        oneItemConditions.add(mTestCondition);
-
-        // Build twoItemConditions
-        final List<ConditionalCard> twoItemsConditions = new ArrayList<>();
-        twoItemsConditions.add(mTestCondition);
-        twoItemsConditions.add(mSecondCondition);
-
-        // Build category
-        when(mTestCategoryTile.getId()).thenReturn(TEST_TILE_ID);
-
-        mDashboardCategory.addTile(mTestCategoryTile);
-
-        // Build DashboardData
-        mDashboardDataWithOneConditions = new DashboardData.Builder()
-                .setConditions(oneItemConditions)
-                .setCategory(mDashboardCategory)
-                .setSuggestions(suggestions)
-                .setConditionExpanded(true)
-                .build();
-
-        mDashboardDataWithTwoConditions = new DashboardData.Builder()
-                .setConditions(twoItemsConditions)
-                .setCategory(mDashboardCategory)
-                .setSuggestions(suggestions)
-                .setConditionExpanded(true)
-                .build();
-
-        mDashboardDataWithNoItems = new DashboardData.Builder()
-                .setConditions(null)
-                .setCategory(null)
-                .setSuggestions(null)
-                .build();
-    }
-
-    @Test
-    public void testBuildItemsData_shouldSetstableId() {
-        final List<DashboardData.Item> items = mDashboardDataWithOneConditions.getItemList();
-
-        // suggestion, separator, condition, footer, 1 tile
-        assertThat(items).hasSize(5);
-
-        assertThat(items.get(0).id).isEqualTo(STABLE_ID_SUGGESTION_CONTAINER);
-        assertThat(items.get(1).id).isEqualTo(STABLE_ID_SUGGESTION_CONDITION_DIVIDER);
-        assertThat(items.get(2).id).isEqualTo(STABLE_ID_CONDITION_CONTAINER);
-        assertThat(items.get(3).id).isEqualTo(STABLE_ID_CONDITION_FOOTER);
-        assertThat(items.get(4).id).isEqualTo(TEST_TILE_ID);
-    }
-
-    @Test
-    public void testBuildItemsData_containsAllData() {
-        final Object[] expectedObjects = {
-                mDashboardDataWithOneConditions.getSuggestions(),
-                null /* divider */,
-                mDashboardDataWithOneConditions.getConditions(),
-                null /* footer */, mTestCategoryTile};
-        final int expectedSize = expectedObjects.length;
-
-        assertThat(mDashboardDataWithOneConditions.getItemList()).hasSize(expectedSize);
-
-        for (int i = 0; i < expectedSize; i++) {
-            final Object item = mDashboardDataWithOneConditions.getItemEntityByPosition(i);
-            if (item instanceof List) {
-                assertThat(item).isEqualTo(expectedObjects[i]);
-            } else if (item instanceof DashboardData.ConditionHeaderData) {
-                DashboardData.ConditionHeaderData i1 = (DashboardData.ConditionHeaderData) item;
-                DashboardData.ConditionHeaderData i2 =
-                        (DashboardData.ConditionHeaderData) expectedObjects[i];
-                assertThat(i1.title).isEqualTo(i2.title);
-                assertThat(i1.conditionCount).isEqualTo(i2.conditionCount);
-            } else {
-                assertThat(item).isSameAs(expectedObjects[i]);
-            }
-        }
-    }
-
-    @Test
-    public void testGetPositionByEntity_selfInstance_returnPositionFound() {
-        final int position = mDashboardDataWithOneConditions
-                .getPositionByEntity(mDashboardDataWithOneConditions.getConditions());
-        assertThat(position).isNotEqualTo(DashboardData.POSITION_NOT_FOUND);
-    }
-
-    @Test
-    public void testGetPositionByEntity_notExisted_returnNotFound() {
-        final ConditionalCard condition = mock(AirplaneModeConditionCard.class);
-        final int position = mDashboardDataWithOneConditions.getPositionByEntity(condition);
-        assertThat(position).isEqualTo(DashboardData.POSITION_NOT_FOUND);
-    }
-
-    @Test
-    public void testGetPositionByTile_selfInstance_returnPositionFound() {
-        final int position = mDashboardDataWithOneConditions.getPositionByTile(mTestCategoryTile);
-        assertThat(position).isNotEqualTo(DashboardData.POSITION_NOT_FOUND);
-    }
-
-    @Test
-    public void testGetPositionByTile_equalTitle_returnPositionFound() {
-        final Tile tile = mock(Tile.class);
-        when(tile.getId()).thenReturn(TEST_TILE_ID);
-
-        final int position = mDashboardDataWithOneConditions.getPositionByTile(tile);
-
-        assertThat(position).isNotEqualTo(DashboardData.POSITION_NOT_FOUND);
-    }
-
-    @Test
-    public void testGetPositionByTile_notExisted_returnNotFound() {
-        final Tile tile = mock(Tile.class);
-        when(tile.getId()).thenReturn(123);
-        final int position = mDashboardDataWithOneConditions.getPositionByTile(tile);
-        assertThat(position).isEqualTo(DashboardData.POSITION_NOT_FOUND);
-    }
-
-    @Test
-    public void testDiffUtil_DataEqual_noResultData() {
-        List<ListUpdateResult.ResultData> testResultData = new ArrayList<>();
-        testDiffUtil(mDashboardDataWithOneConditions,
-                mDashboardDataWithOneConditions, testResultData);
-    }
-
-    @Test
-    public void testDiffUtil_InsertOneCondition_ResultDataOneChanged() {
-        final List<ListUpdateResult.ResultData> testResultData = new ArrayList<>();
-        // Item in position 3 is the condition container containing the list of conditions, which
-        // gets 1 more item
-        testResultData.add(new ListUpdateResult.ResultData(
-                ListUpdateResult.ResultData.TYPE_OPERATION_CHANGE, 2, 1));
-
-        testDiffUtil(mDashboardDataWithOneConditions,
-                mDashboardDataWithTwoConditions, testResultData);
-    }
-
-    @Test
-    public void testDiffUtil_RemoveOneSuggestion_causeItemRemoveAndChange() {
-        final List<ListUpdateResult.ResultData> testResultData = new ArrayList<>();
-        // removed suggestion and the divider
-        testResultData.add(new ListUpdateResult.ResultData(
-                ListUpdateResult.ResultData.TYPE_OPERATION_REMOVE, 0, 2));
-        testResultData.add(new ListUpdateResult.ResultData(
-                ListUpdateResult.ResultData.TYPE_OPERATION_CHANGE, 2, 1));
-        // Build DashboardData
-        final List<ConditionalCard> oneItemConditions = new ArrayList<>();
-
-        oneItemConditions.add(mTestCondition);
-        final List<Suggestion> suggestions = new ArrayList<>();
-        suggestions.add(mTestSuggestion);
-
-        final DashboardData oldData = new DashboardData.Builder()
-                .setConditions(oneItemConditions)
-                .setCategory(mDashboardCategory)
-                .setSuggestions(suggestions)
-                .setConditionExpanded(false)
-                .build();
-        final DashboardData newData = new DashboardData.Builder()
-                .setConditions(oneItemConditions)
-                .setSuggestions(null)
-                .setCategory(mDashboardCategory)
-                .setConditionExpanded(false)
-                .build();
-
-        testDiffUtil(oldData, newData, testResultData);
-    }
-
-    @Test
-    public void testDiffUtil_DeleteAllData_ResultDataOneDeleted() {
-        final List<ListUpdateResult.ResultData> testResultData = new ArrayList<>();
-        testResultData.add(new ListUpdateResult.ResultData(
-                ListUpdateResult.ResultData.TYPE_OPERATION_REMOVE, 0, 5));
-
-        testDiffUtil(mDashboardDataWithOneConditions, mDashboardDataWithNoItems, testResultData);
-    }
-
-    @Test
-    public void testDiffUtil_typeSuggestedContainer_ResultDataNothingChanged() {
-        final List<ListUpdateResult.ResultData> testResultData = new ArrayList<>();
-
-        DashboardData prevData = new DashboardData.Builder()
-                .setConditions(null)
-                .setCategory(null)
-                .setSuggestions(Collections.singletonList(mTestSuggestion))
-                .build();
-        DashboardData currentData = new DashboardData.Builder()
-                .setConditions(null)
-                .setCategory(null)
-                .setSuggestions(Collections.singletonList(mTestSuggestion))
-                .build();
-        testDiffUtil(prevData, currentData, testResultData);
-    }
-
-    /**
-     * Test when using the
-     * {@link com.android.settings.dashboard.DashboardData.ItemsDataDiffCallback}
-     * to transfer List from {@paramref baseDashboardData} to {@paramref diffDashboardData},
-     * whether
-     * the transform data result is equals to {@paramref testResultData}
-     * <p>
-     * The steps are described below:
-     * 1. Calculate a {@link androidx.recyclerview.widget.DiffUtil.DiffResult} from
-     * {@paramref baseDashboardData} to {@paramref diffDashboardData}
-     * <p>
-     * 2. Dispatch the {@link androidx.recyclerview.widget.DiffUtil.DiffResult} calculated from step
-     * 1
-     * into {@link ListUpdateResult}
-     * <p>
-     * 3. Get result data(a.k.a. baseResultData) from {@link ListUpdateResult} and compare it to
-     * {@paramref testResultData}
-     * <p>
-     * Because baseResultData and {@paramref testResultData} don't have sequence. When do the
-     * comparison, we will sort them first and then compare the inside data from them one by one.
-     */
-    private void testDiffUtil(DashboardData baseDashboardData, DashboardData diffDashboardData,
-            List<ListUpdateResult.ResultData> testResultData) {
-        final DiffUtil.DiffResult diffUtilResult = DiffUtil.calculateDiff(
-                new DashboardData.ItemsDataDiffCallback(
-                        baseDashboardData.getItemList(), diffDashboardData.getItemList()));
-
-        // Dispatch to listUpdateResult, then listUpdateResult will have result data
-        final ListUpdateResult listUpdateResult = new ListUpdateResult();
-        diffUtilResult.dispatchUpdatesTo(listUpdateResult);
-
-        final List<ListUpdateResult.ResultData> baseResultData = listUpdateResult.getResultData();
-        assertThat(testResultData.size()).isEqualTo(baseResultData.size());
-
-        // Sort them so we can compare them one by one using a for loop
-        Collections.sort(baseResultData);
-        Collections.sort(testResultData);
-        final int size = baseResultData.size();
-        for (int i = 0; i < size; i++) {
-            // Refer to equals method in ResultData
-            assertThat(baseResultData.get(i)).isEqualTo(testResultData.get(i));
-        }
-    }
-
-    /**
-     * This class contains the result about how the changes made to convert one
-     * list to another list. It implements ListUpdateCallback to record the result data.
-     */
-    private static class ListUpdateResult implements ListUpdateCallback {
-        final private List<ResultData> mResultData;
-
-        public ListUpdateResult() {
-            mResultData = new ArrayList<>();
-        }
-
-        private List<ResultData> getResultData() {
-            return mResultData;
-        }
-
-        @Override
-        public void onInserted(int position, int count) {
-            mResultData.add(new ResultData(ResultData.TYPE_OPERATION_INSERT, position, count));
-        }
-
-        @Override
-        public void onRemoved(int position, int count) {
-            mResultData.add(new ResultData(ResultData.TYPE_OPERATION_REMOVE, position, count));
-        }
-
-        @Override
-        public void onMoved(int fromPosition, int toPosition) {
-            mResultData.add(
-                    new ResultData(ResultData.TYPE_OPERATION_MOVE, fromPosition, toPosition));
-        }
-
-        @Override
-        public void onChanged(int position, int count, Object payload) {
-            mResultData.add(new ResultData(ResultData.TYPE_OPERATION_CHANGE, position, count));
-        }
-
-        /**
-         * This class contains general type and field to record the operation data generated
-         * in {@link ListUpdateCallback}. Please refer to {@link ListUpdateCallback} for more info.
-         * <p>
-         * The following are examples about the data stored in this class:
-         * <p>
-         * "The data starts from position(arg1) with count number(arg2) is changed(operation)"
-         * or "The data is moved(operation) from position1(arg1) to position2(arg2)"
-         */
-        private static class ResultData implements Comparable<ResultData> {
-
-            private static final int TYPE_OPERATION_INSERT = 0;
-            private static final int TYPE_OPERATION_REMOVE = 1;
-            private static final int TYPE_OPERATION_MOVE = 2;
-            private static final int TYPE_OPERATION_CHANGE = 3;
-
-            private final int operation;
-            private final int arg1;
-            private final int arg2;
-
-            private ResultData(int operation, int arg1, int arg2) {
-                this.operation = operation;
-                this.arg1 = arg1;
-                this.arg2 = arg2;
-            }
-
-            @Override
-            public boolean equals(Object obj) {
-                if (this == obj) {
-                    return true;
-                }
-
-                if (!(obj instanceof ResultData)) {
-                    return false;
-                }
-
-                ResultData targetData = (ResultData) obj;
-
-                return operation == targetData.operation && arg1 == targetData.arg1
-                        && arg2 == targetData.arg2;
-            }
-
-            @Override
-            public int compareTo(@NonNull ResultData resultData) {
-                if (this.operation != resultData.operation) {
-                    return operation - resultData.operation;
-                }
-
-                if (arg1 != resultData.arg1) {
-                    return arg1 - resultData.arg1;
-                }
-
-                return arg2 - resultData.arg2;
-            }
-
-            @Override
-            public String toString() {
-                return "op:" + operation + ",arg1:" + arg1 + ",arg2:" + arg2;
-            }
-        }
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardItemAnimatorTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardItemAnimatorTest.java
deleted file mode 100644
index 646643b..0000000
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardItemAnimatorTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2016 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.dashboard;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.content.pm.ActivityInfo;
-import android.view.View;
-import android.widget.TextView;
-
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settingslib.drawer.CategoryKey;
-import com.android.settingslib.drawer.Tile;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RuntimeEnvironment;
-
-@RunWith(SettingsRobolectricTestRunner.class)
-public class DashboardItemAnimatorTest {
-
-    private DashboardItemAnimator mDashboardItemAnimator;
-    private ViewHolder mViewHolder;
-
-    @Before
-    public void SetUp() {
-        mDashboardItemAnimator = new DashboardItemAnimator();
-        mViewHolder = new ViewHolder(new TextView(RuntimeEnvironment.application));
-        final ActivityInfo activityInfo = new ActivityInfo();
-        activityInfo.packageName = "pkg";
-        activityInfo.name = "class";
-        mViewHolder.itemView.setTag(new Tile(activityInfo, CategoryKey.CATEGORY_HOMEPAGE));
-    }
-
-    @Test
-    public void testAnimateChange_NoPositionChange_NoPendingAnimation() {
-        final boolean hasPendingAnimation =
-                mDashboardItemAnimator.animateChange(mViewHolder, mViewHolder, 0, 1, 0, 1);
-        assertThat(hasPendingAnimation).isFalse();
-    }
-
-    @Test
-    public void testAnimateChange_HasPositionChange_HasPendingAnimation() {
-        final boolean hasPendingAnimation =
-                mDashboardItemAnimator.animateChange(mViewHolder, mViewHolder, 0, 0, 1, 1);
-        assertThat(hasPendingAnimation).isTrue();
-    }
-
-    @Test
-    public void testAnimateChange_HasRunningAnimationWhileNoPositionChange_NoPendingAnimation() {
-        // Set pending move animations
-        mDashboardItemAnimator.animateMove(mViewHolder, 0, 0, 1, 1);
-
-        final boolean hasPendingAnimation =
-                mDashboardItemAnimator.animateChange(mViewHolder, mViewHolder, 0, 1, 0, 1);
-        assertThat(hasPendingAnimation).isFalse();
-    }
-
-    // Sample viewholder to use for test
-    static final class ViewHolder extends RecyclerView.ViewHolder {
-
-        ViewHolder(View itemView) {
-            super(itemView);
-        }
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardSummaryTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardSummaryTest.java
deleted file mode 100644
index a4fba72..0000000
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardSummaryTest.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (C) 2017 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.dashboard;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.nullable;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-
-import androidx.fragment.app.FragmentActivity;
-import androidx.recyclerview.widget.LinearLayoutManager;
-
-import com.android.settings.homepage.conditional.ConditionManager;
-import com.android.settings.homepage.conditional.FocusRecyclerView;
-import com.android.settings.testutils.FakeFeatureFactory;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settingslib.drawer.CategoryKey;
-import com.android.settingslib.drawer.DashboardCategory;
-import com.android.settingslib.suggestions.SuggestionControllerMixinCompat;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.util.ReflectionHelpers;
-
-@RunWith(SettingsRobolectricTestRunner.class)
-public class DashboardSummaryTest {
-
-    @Mock
-    private DashboardAdapter mAdapter;
-    @Mock
-    private DashboardFeatureProvider mDashboardFeatureProvider;
-    @Mock
-    private FocusRecyclerView mDashboard;
-    @Mock
-    private LinearLayoutManager mLayoutManager;
-    @Mock
-    private ConditionManager mConditionManager;
-    @Mock
-    private SummaryLoader mSummaryLoader;
-    @Mock
-    private SuggestionControllerMixinCompat mSuggestionControllerMixin;
-
-    private Context mContext;
-    private DashboardSummary mSummary;
-    private FakeFeatureFactory mFeatureFactory;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        mFeatureFactory = FakeFeatureFactory.setupForTest();
-        mContext = RuntimeEnvironment.application;
-        mSummary = spy(new DashboardSummary());
-        ReflectionHelpers.setField(mSummary, "mAdapter", mAdapter);
-        ReflectionHelpers.setField(mSummary, "mDashboardFeatureProvider",
-                mDashboardFeatureProvider);
-        ReflectionHelpers.setField(mSummary, "mDashboard", mDashboard);
-        ReflectionHelpers.setField(mSummary, "mLayoutManager", mLayoutManager);
-        ReflectionHelpers.setField(mSummary, "mConditionManager", mConditionManager);
-        ReflectionHelpers.setField(mSummary, "mSummaryLoader", mSummaryLoader);
-    }
-
-    @Test
-    public void onAttach_suggestionDisabled_shouldNotStartSuggestionControllerMixin() {
-        when(mFeatureFactory.suggestionsFeatureProvider.isSuggestionEnabled(any(Context.class)))
-                .thenReturn(false);
-
-        mSummary.onAttach(mContext);
-        final SuggestionControllerMixinCompat mixin = ReflectionHelpers
-                .getField(mSummary, "mSuggestionControllerMixin");
-        assertThat(mixin).isNull();
-    }
-
-    @Test
-    public void onAttach_suggestionEnabled_shouldStartSuggestionControllerMixin() {
-        when(mFeatureFactory.suggestionsFeatureProvider.isSuggestionEnabled(any(Context.class)))
-                .thenReturn(true);
-
-        mSummary.onAttach(mContext);
-        final SuggestionControllerMixinCompat mixin = ReflectionHelpers
-                .getField(mSummary, "mSuggestionControllerMixin");
-        assertThat(mixin).isNotNull();
-    }
-
-    @Test
-    public void updateCategory_shouldGetCategoryFromFeatureProvider() {
-        ReflectionHelpers.setField(mSummary, "mSuggestionControllerMixin",
-                mSuggestionControllerMixin);
-
-        when(mSuggestionControllerMixin.isSuggestionLoaded()).thenReturn(true);
-        doReturn(mock(FragmentActivity.class)).when(mSummary).getActivity();
-        mSummary.onAttach(mContext);
-        mSummary.updateCategory();
-
-        verify(mSummaryLoader).updateSummaryToCache(nullable(DashboardCategory.class));
-        verify(mDashboardFeatureProvider).getTilesForCategory(CategoryKey.CATEGORY_HOMEPAGE);
-        verify(mAdapter).setCategory(any());
-    }
-
-    @Test
-    public void updateCategory_shouldGetCategoryFromFeatureProvider_evenIfSuggestionDisabled() {
-        when(mFeatureFactory.suggestionsFeatureProvider.isSuggestionEnabled(any(Context.class)))
-                .thenReturn(false);
-
-        doReturn(mock(FragmentActivity.class)).when(mSummary).getActivity();
-        mSummary.onAttach(mContext);
-        mSummary.updateCategory();
-
-        verify(mSummaryLoader).updateSummaryToCache(nullable(DashboardCategory.class));
-        verify(mDashboardFeatureProvider).getTilesForCategory(CategoryKey.CATEGORY_HOMEPAGE);
-        verify(mAdapter).setCategory(any());
-    }
-
-    @Test
-    public void onConditionChanged_PositionAtTop_ScrollToTop() {
-        when(mLayoutManager.findFirstCompletelyVisibleItemPosition()).thenReturn(1);
-        mSummary.onConditionsChanged();
-        mSummary.onConditionsChanged();
-        verify(mDashboard).scrollToPosition(0);
-    }
-
-    @Test
-    public void onConditionChanged_PositionNotTop_RemainPosition() {
-        when(mLayoutManager.findFirstCompletelyVisibleItemPosition()).thenReturn(2);
-        mSummary.onConditionsChanged();
-        mSummary.onConditionsChanged();
-        verify(mDashboard, never()).scrollToPosition(0);
-    }
-
-    @Test
-    public void onConditionChanged_firstCall_shouldIgnore() {
-        mSummary.onConditionsChanged();
-        verify(mAdapter, never()).setConditions(any());
-    }
-
-    @Test
-    public void onConditionChanged_secondCall_shouldSetConditionsOnAdapter() {
-        mSummary.onConditionsChanged();
-        mSummary.onConditionsChanged();
-        verify(mAdapter).setConditions(any());
-    }
-
-    @Test
-    public void onCategoryChanged_noRebuildOnFirstCall() {
-        doReturn(mock(FragmentActivity.class)).when(mSummary).getActivity();
-        doNothing().when(mSummary).rebuildUI();
-        mSummary.onCategoriesChanged();
-        verify(mSummary, never()).rebuildUI();
-    }
-
-    @Test
-    public void onCategoryChanged_rebuildOnSecondCall() {
-        doReturn(mock(FragmentActivity.class)).when(mSummary).getActivity();
-        doNothing().when(mSummary).rebuildUI();
-        mSummary.onCategoriesChanged();
-        mSummary.onCategoriesChanged();
-        verify(mSummary).rebuildUI();
-    }
-}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java
deleted file mode 100644
index a482647..0000000
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * Copyright (C) 2017 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.dashboard.suggestions;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.Icon;
-import android.service.settings.suggestions.Suggestion;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.WindowManager;
-import android.widget.FrameLayout;
-import android.widget.LinearLayout;
-
-import com.android.internal.logging.nano.MetricsProto;
-import com.android.settings.R;
-import com.android.settings.SettingsActivity;
-import com.android.settings.dashboard.DashboardAdapter;
-import com.android.settings.testutils.FakeFeatureFactory;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settings.testutils.shadow.ShadowCardView;
-import com.android.settingslib.Utils;
-import com.android.settingslib.suggestions.SuggestionControllerMixinCompat;
-import com.android.settingslib.utils.IconCache;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-import org.robolectric.util.ReflectionHelpers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@RunWith(SettingsRobolectricTestRunner.class)
-@Config(shadows = ShadowCardView.class)
-public class SuggestionAdapterTest {
-
-    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
-    private SettingsActivity mActivity;
-    @Mock
-    private SuggestionControllerMixinCompat mSuggestionControllerMixin;
-    @Mock
-    private Resources mResources;
-    @Mock
-    private WindowManager mWindowManager;
-
-    private FakeFeatureFactory mFeatureFactory;
-    private Context mContext;
-    private SuggestionAdapter mSuggestionAdapter;
-    private DashboardAdapter.DashboardItemHolder mSuggestionHolder;
-    private List<Suggestion> mOneSuggestion;
-    private List<Suggestion> mTwoSuggestions;
-    private SuggestionAdapter.CardConfig mConfig;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        mContext = spy(RuntimeEnvironment.application);
-        when(mActivity.getSystemService(Context.WINDOW_SERVICE)).thenReturn(mWindowManager);
-        when(mActivity.getResources()).thenReturn(mResources);
-        when(mResources.getDimensionPixelOffset(R.dimen.suggestion_card_inner_margin))
-            .thenReturn(10);
-        when(mResources.getDimensionPixelOffset(R.dimen.suggestion_card_outer_margin))
-            .thenReturn(20);
-        mConfig = spy(SuggestionAdapter.CardConfig.get(mActivity));
-
-        mFeatureFactory = FakeFeatureFactory.setupForTest();
-
-        final Suggestion suggestion1 = new Suggestion.Builder("id1")
-                .setTitle("Test suggestion 1")
-                .build();
-        final Suggestion suggestion2 = new Suggestion.Builder("id2")
-                .setTitle("Test suggestion 2")
-                .build();
-        mOneSuggestion = new ArrayList<>();
-        mOneSuggestion.add(suggestion1);
-        mTwoSuggestions = new ArrayList<>();
-        mTwoSuggestions.add(suggestion1);
-        mTwoSuggestions.add(suggestion2);
-    }
-
-    @Test
-    public void getItemCount_shouldReturnListSize() {
-        mSuggestionAdapter = new SuggestionAdapter(mContext, mSuggestionControllerMixin,
-            null /* savedInstanceState */, null /* callback */, null /* lifecycle */);
-        mSuggestionAdapter.setSuggestions(mOneSuggestion);
-        assertThat(mSuggestionAdapter.getItemCount()).isEqualTo(1);
-
-        mSuggestionAdapter.setSuggestions(mTwoSuggestions);
-        assertThat(mSuggestionAdapter.getItemCount()).isEqualTo(2);
-    }
-
-    @Test
-    public void getItemViewType_shouldReturnSuggestionTile() {
-        mSuggestionAdapter = new SuggestionAdapter(mContext, mSuggestionControllerMixin,
-            null /* savedInstanceState */, null /* callback */, null /* lifecycle */);
-        mSuggestionAdapter.setSuggestions(mOneSuggestion);
-        assertThat(mSuggestionAdapter.getItemViewType(0))
-            .isEqualTo(R.layout.suggestion_tile);
-    }
-
-    @Test
-    public void getItemType_hasButton_shouldReturnSuggestionWithButton() {
-        final List<Suggestion> suggestions = new ArrayList<>();
-        suggestions.add(new Suggestion.Builder("id")
-                .setFlags(Suggestion.FLAG_HAS_BUTTON)
-                .setTitle("123")
-                .setSummary("456")
-                .build());
-        mSuggestionAdapter = new SuggestionAdapter(mContext, mSuggestionControllerMixin,
-            null /* savedInstanceState */, null /* callback */, null /* lifecycle */);
-        mSuggestionAdapter.setSuggestions(suggestions);
-
-        assertThat(mSuggestionAdapter.getItemViewType(0))
-            .isEqualTo(R.layout.suggestion_tile_with_button);
-    }
-
-    @Test
-    public void onBindViewHolder_shouldLog() {
-        final View view = spy(LayoutInflater.from(mContext).inflate(
-            R.layout.suggestion_tile, new LinearLayout(mContext), true));
-        mSuggestionHolder = new DashboardAdapter.DashboardItemHolder(view);
-        mSuggestionAdapter = new SuggestionAdapter(mContext, mSuggestionControllerMixin,
-            null /* savedInstanceState */, null /* callback */, null /* lifecycle */);
-        mSuggestionAdapter.setSuggestions(mOneSuggestion);
-        doReturn("sans").when(mContext).getString(anyInt());
-
-        // Bind twice
-        mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
-        mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
-
-        // Log once
-        verify(mFeatureFactory.metricsFeatureProvider).action(
-                mContext, MetricsProto.MetricsEvent.ACTION_SHOW_SETTINGS_SUGGESTION,
-                mOneSuggestion.get(0).getId());
-    }
-
-    @Test
-    public void onBindViewHolder_itemViewShouldHandleClick()
-            throws PendingIntent.CanceledException {
-        final List<Suggestion> suggestions = makeSuggestions("pkg1");
-        setupSuggestions(mActivity, suggestions);
-
-        mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
-        mSuggestionHolder.itemView.performClick();
-
-        verify(mSuggestionControllerMixin).launchSuggestion(suggestions.get(0));
-        verify(suggestions.get(0).getPendingIntent()).send();
-    }
-
-    @Test
-    public void onBindViewHolder_hasButton_buttonShouldHandleClick()
-        throws PendingIntent.CanceledException {
-        final List<Suggestion> suggestions = new ArrayList<>();
-        final PendingIntent pendingIntent = mock(PendingIntent.class);
-        suggestions.add(new Suggestion.Builder("id")
-            .setFlags(Suggestion.FLAG_HAS_BUTTON)
-            .setTitle("123")
-            .setSummary("456")
-            .setPendingIntent(pendingIntent)
-            .build());
-        mSuggestionAdapter = new SuggestionAdapter(mContext, mSuggestionControllerMixin,
-            null /* savedInstanceState */, null /* callback */, null /* lifecycle */);
-        mSuggestionAdapter.setSuggestions(suggestions);
-        mSuggestionHolder = mSuggestionAdapter.onCreateViewHolder(
-            new FrameLayout(RuntimeEnvironment.application),
-            mSuggestionAdapter.getItemViewType(0));
-        doReturn("sans").when(mContext).getString(anyInt());
-
-        mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
-        mSuggestionHolder.itemView.findViewById(android.R.id.primary).performClick();
-
-        verify(mSuggestionControllerMixin).launchSuggestion(suggestions.get(0));
-        verify(pendingIntent).send();
-    }
-
-    @Test
-    public void getSuggestions_shouldReturnSuggestionWhenMatch() {
-        final List<Suggestion> suggestions = makeSuggestions("pkg1");
-        setupSuggestions(mActivity, suggestions);
-
-        assertThat(mSuggestionAdapter.getSuggestion(0)).isNotNull();
-    }
-
-    @Test
-    public void onBindViewHolder_closeButtonShouldHandleClick()
-        throws PendingIntent.CanceledException {
-        final List<Suggestion> suggestions = makeSuggestions("pkg1");
-        final SuggestionAdapter.Callback callback = mock(SuggestionAdapter.Callback.class);
-        mSuggestionAdapter = new SuggestionAdapter(mActivity, mSuggestionControllerMixin,
-            null /* savedInstanceState */, callback, null /* lifecycle */);
-        mSuggestionAdapter.setSuggestions(suggestions);
-        mSuggestionHolder = mSuggestionAdapter.onCreateViewHolder(
-            new FrameLayout(RuntimeEnvironment.application),
-            mSuggestionAdapter.getItemViewType(0));
-
-        mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
-        mSuggestionHolder.itemView.findViewById(R.id.close_button).performClick();
-
-        final Suggestion suggestion = suggestions.get(0);
-        verify(mFeatureFactory.suggestionsFeatureProvider).dismissSuggestion(
-            mActivity, mSuggestionControllerMixin, suggestion);
-        verify(callback).onSuggestionClosed(suggestion);
-    }
-
-    @Test
-    public void onBindViewHolder_iconNotTintable_shouldNotTintIcon()
-            throws PendingIntent.CanceledException {
-        final Icon icon = mock(Icon.class);
-        final Suggestion suggestion = new Suggestion.Builder("pkg1")
-            .setPendingIntent(mock(PendingIntent.class))
-            .setIcon(icon)
-            .build();
-        final List<Suggestion> suggestions = new ArrayList<>();
-        suggestions.add(suggestion);
-        mSuggestionAdapter = new SuggestionAdapter(mActivity, mSuggestionControllerMixin,
-            null /* savedInstanceState */, null /* callback */, null /* lifecycle */);
-        mSuggestionAdapter.setSuggestions(suggestions);
-        mSuggestionHolder = mSuggestionAdapter.onCreateViewHolder(
-            new FrameLayout(RuntimeEnvironment.application),
-            mSuggestionAdapter.getItemViewType(0));
-        IconCache cache = mock(IconCache.class);
-        final Drawable drawable = mock(Drawable.class);
-        when(cache.getIcon(icon)).thenReturn(drawable);
-        ReflectionHelpers.setField(mSuggestionAdapter, "mCache", cache);
-
-        mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
-
-        verify(drawable, never()).setTint(anyInt());
-    }
-
-    @Test
-    public void onBindViewHolder_iconTintable_shouldTintIcon()
-            throws PendingIntent.CanceledException {
-        final Icon icon = mock(Icon.class);
-        final int FLAG_ICON_TINTABLE = 1 << 1;
-        final Suggestion suggestion = new Suggestion.Builder("pkg1")
-            .setPendingIntent(mock(PendingIntent.class))
-            .setIcon(icon)
-            .setFlags(FLAG_ICON_TINTABLE)
-            .build();
-        final List<Suggestion> suggestions = new ArrayList<>();
-        suggestions.add(suggestion);
-        mSuggestionAdapter = new SuggestionAdapter(mActivity, mSuggestionControllerMixin,
-            null /* savedInstanceState */, null /* callback */, null /* lifecycle */);
-        mSuggestionAdapter.setSuggestions(suggestions);
-        mSuggestionHolder = mSuggestionAdapter.onCreateViewHolder(
-            new FrameLayout(RuntimeEnvironment.application),
-            mSuggestionAdapter.getItemViewType(0));
-        IconCache cache = mock(IconCache.class);
-        final Drawable drawable = mock(Drawable.class);
-        when(cache.getIcon(icon)).thenReturn(drawable);
-        ReflectionHelpers.setField(mSuggestionAdapter, "mCache", cache);
-        TypedArray typedArray = mock(TypedArray.class);
-        final ColorStateList colorAccentState = Utils.getColorAccent(mContext);
-        when(mActivity.obtainStyledAttributes(any())).thenReturn(typedArray);
-        when(typedArray.getColorStateList(anyInt())).thenReturn(colorAccentState);
-
-        mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
-
-        verify(drawable).setTintList(colorAccentState);
-    }
-
-    @Test
-    public void onBindViewHolder_closeButtonShouldHaveContentDescription()
-        throws PendingIntent.CanceledException {
-        final List<Suggestion> suggestions = makeSuggestions("pkg1");
-        setupSuggestions(mActivity, suggestions);
-
-        mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
-
-        assertThat(
-            mSuggestionHolder.itemView.findViewById(R.id.close_button).getContentDescription())
-            .isNotNull();
-    }
-
-    @Test
-    public void setCardLayout_twoCards_shouldSetCardWidthToHalfScreenMinusPadding() {
-        final List<Suggestion> suggestions = makeSuggestions("pkg1");
-        setupSuggestions(mContext, suggestions);
-        doReturn(200).when(mConfig).getScreenWidth();
-
-        mConfig.setCardLayout(mSuggestionHolder, 0);
-
-        /*
-         * card width = (screen width - left margin - inner margin - right margin) / 2
-         *            = (200 - 20 - 10 - 20) / 2
-         *            = 75
-         */
-        assertThat(mSuggestionHolder.itemView.getLayoutParams().width).isEqualTo(75);
-    }
-
-    private void setupSuggestions(Context context, List<Suggestion> suggestions) {
-        mSuggestionAdapter = new SuggestionAdapter(context, mSuggestionControllerMixin,
-            null /* savedInstanceState */, null /* callback */, null /* lifecycle */);
-        mSuggestionAdapter.setSuggestions(suggestions);
-        mSuggestionHolder = mSuggestionAdapter.onCreateViewHolder(
-                new FrameLayout(RuntimeEnvironment.application),
-                mSuggestionAdapter.getItemViewType(0));
-    }
-
-    private List<Suggestion> makeSuggestions(String... pkgNames) {
-        final List<Suggestion> suggestions = new ArrayList<>();
-        for (String pkgName : pkgNames) {
-            final Suggestion suggestion = new Suggestion.Builder(pkgName)
-                    .setPendingIntent(mock(PendingIntent.class))
-                    .build();
-            suggestions.add(suggestion);
-        }
-        return suggestions;
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/homepage/conditional/ConditionAdapterTest.java b/tests/robotests/src/com/android/settings/homepage/conditional/ConditionAdapterTest.java
deleted file mode 100644
index 4d154da..0000000
--- a/tests/robotests/src/com/android/settings/homepage/conditional/ConditionAdapterTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2017 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.homepage.conditional;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyLong;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.LinearLayout;
-
-import com.android.settings.R;
-import com.android.settings.dashboard.DashboardAdapter;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RuntimeEnvironment;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@RunWith(SettingsRobolectricTestRunner.class)
-public class ConditionAdapterTest {
-
-    @Mock
-    private ConditionalCard mCondition1;
-    @Mock
-    private ConditionalCard mCondition2;
-    @Mock
-    private ConditionManager mConditionManager;
-
-    private Context mContext;
-    private ConditionAdapter mConditionAdapter;
-    private List<ConditionalCard> mOneCondition;
-    private List<ConditionalCard> mTwoConditions;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        mContext = RuntimeEnvironment.application;
-        final CharSequence action = "action";
-        when(mCondition1.getActionText()).thenReturn(action);
-        mOneCondition = new ArrayList<>();
-        mOneCondition.add(mCondition1);
-        mTwoConditions = new ArrayList<>();
-        mTwoConditions.add(mCondition1);
-        mTwoConditions.add(mCondition2);
-    }
-
-    @Test
-    public void getItemCount_notExpanded_shouldReturn0() {
-        mConditionAdapter = new ConditionAdapter(mContext, mConditionManager, mOneCondition, false);
-        assertThat(mConditionAdapter.getItemCount()).isEqualTo(0);
-    }
-
-    @Test
-    public void getItemCount_expanded_shouldReturnListSize() {
-        mConditionAdapter = new ConditionAdapter(mContext, mConditionManager, mOneCondition, true);
-        assertThat(mConditionAdapter.getItemCount()).isEqualTo(1);
-
-        mConditionAdapter = new ConditionAdapter(mContext, mConditionManager, mTwoConditions, true);
-        assertThat(mConditionAdapter.getItemCount()).isEqualTo(2);
-    }
-
-    @Test
-    public void getItemViewType_shouldReturnConditionTile() {
-        mConditionAdapter = new ConditionAdapter(mContext, mConditionManager, mTwoConditions, true);
-        assertThat(mConditionAdapter.getItemViewType(0)).isEqualTo(R.layout.condition_tile);
-    }
-
-    @Test
-    public void onBindViewHolder_shouldSetListener() {
-        final View view = LayoutInflater.from(mContext)
-                .inflate(R.layout.condition_tile, new LinearLayout(mContext), true);
-        final DashboardAdapter.DashboardItemHolder viewHolder =
-                new DashboardAdapter.DashboardItemHolder(view);
-        mConditionAdapter = new ConditionAdapter(mContext, mConditionManager, mOneCondition, true);
-
-        mConditionAdapter.onBindViewHolder(viewHolder, 0);
-        final View card = view.findViewById(R.id.content);
-        assertThat(card).isNotNull();
-        assertThat(card.hasOnClickListeners()).isTrue();
-    }
-
-    @Test
-    public void viewClick_shouldInvokeConditionPrimaryClick() {
-        final View view = LayoutInflater.from(mContext)
-                .inflate(R.layout.condition_tile, new LinearLayout(mContext), true);
-        final DashboardAdapter.DashboardItemHolder viewHolder =
-                new DashboardAdapter.DashboardItemHolder(view);
-        mConditionAdapter = new ConditionAdapter(mContext, mConditionManager, mOneCondition, true);
-
-        mConditionAdapter.onBindViewHolder(viewHolder, 0);
-        final View card = view.findViewById(R.id.content);
-        assertThat(card).isNotNull();
-        card.performClick();
-        verify(mConditionManager).onPrimaryClick(any(Context.class), anyLong());
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/network/NetworkDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/network/NetworkDashboardFragmentTest.java
index 469a537..e0370a4 100644
--- a/tests/robotests/src/com/android/settings/network/NetworkDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/network/NetworkDashboardFragmentTest.java
@@ -17,17 +17,10 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.Mockito.when;
-
 import android.content.Context;
 import android.provider.SearchIndexableResource;
 
-import com.android.settings.dashboard.SummaryLoader;
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settings.wifi.WifiMasterSwitchPreferenceController;
 import com.android.settingslib.drawer.CategoryKey;
 
 import org.junit.Before;
@@ -65,90 +58,4 @@
         assertThat(indexRes).hasSize(1);
         assertThat(indexRes.get(0).xmlResId).isEqualTo(mFragment.getPreferenceScreenResId());
     }
-
-    @Test
-    public void summaryProviderSetListening_hasMobileAndHotspot_shouldReturnMobileSummary() {
-        final WifiMasterSwitchPreferenceController wifiPreferenceController =
-                mock(WifiMasterSwitchPreferenceController.class);
-        final MobileNetworkPreferenceController mobileNetworkPreferenceController =
-                mock(MobileNetworkPreferenceController.class);
-        final TetherPreferenceController tetherPreferenceController =
-                mock(TetherPreferenceController.class);
-
-        final SummaryLoader summaryLoader = mock(SummaryLoader.class);
-        final SummaryLoader.SummaryProvider provider =
-                new NetworkDashboardFragment.SummaryProvider(mContext, summaryLoader,
-                        wifiPreferenceController, mobileNetworkPreferenceController,
-                        tetherPreferenceController, () -> true);
-
-        provider.setListening(false);
-
-        verifyZeroInteractions(summaryLoader);
-
-        when(wifiPreferenceController.isAvailable()).thenReturn(true);
-        when(mobileNetworkPreferenceController.isAvailable()).thenReturn(true);
-        when(tetherPreferenceController.isAvailable()).thenReturn(true);
-
-        provider.setListening(true);
-
-        verify(summaryLoader).setSummary(provider, "Wi\u2011Fi, mobile, data usage, and hotspot");
-    }
-
-    @Test
-    public void summaryProviderSetListening_noMobileOrHotspot_shouldReturnSimpleSummary() {
-        final WifiMasterSwitchPreferenceController wifiPreferenceController =
-                mock(WifiMasterSwitchPreferenceController.class);
-        final MobileNetworkPreferenceController mobileNetworkPreferenceController =
-                mock(MobileNetworkPreferenceController.class);
-        final TetherPreferenceController tetherPreferenceController =
-                mock(TetherPreferenceController.class);
-
-        final SummaryLoader summaryLoader = mock(SummaryLoader.class);
-        final SummaryLoader.SummaryProvider provider =
-                new NetworkDashboardFragment.SummaryProvider(mContext, summaryLoader,
-                        wifiPreferenceController, mobileNetworkPreferenceController,
-                        tetherPreferenceController, () -> true);
-
-        provider.setListening(false);
-
-        verifyZeroInteractions(summaryLoader);
-
-        when(wifiPreferenceController.isAvailable()).thenReturn(true);
-        when(mobileNetworkPreferenceController.isAvailable()).thenReturn(false);
-        when(tetherPreferenceController.isAvailable()).thenReturn(false);
-
-        provider.setListening(true);
-
-        verify(summaryLoader).setSummary(provider, "Wi\u2011Fi and data usage");
-    }
-
-    @Test
-    public void summaryProviderSetListening_noDataUsageActivity_shouldReturnNoDataUsageSummary() {
-        final WifiMasterSwitchPreferenceController wifiPreferenceController =
-                mock(WifiMasterSwitchPreferenceController.class);
-        final MobileNetworkPreferenceController mobileNetworkPreferenceController =
-                mock(MobileNetworkPreferenceController.class);
-        final TetherPreferenceController tetherPreferenceController =
-                mock(TetherPreferenceController.class);
-
-        final SummaryLoader summaryLoader = mock(SummaryLoader.class);
-        final SummaryLoader.SummaryProvider provider =
-                new NetworkDashboardFragment.SummaryProvider(mContext, summaryLoader,
-                        wifiPreferenceController, mobileNetworkPreferenceController,
-                        tetherPreferenceController, () -> false);
-
-        provider.setListening(false);
-
-        verifyZeroInteractions(summaryLoader);
-
-        when(wifiPreferenceController.isAvailable()).thenReturn(true);
-        when(mobileNetworkPreferenceController.isAvailable()).thenReturn(true);
-        when(tetherPreferenceController.isAvailable()).thenReturn(true);
-
-        provider.setListening(true);
-
-        verify(summaryLoader).setSummary(provider, "Wi\u2011Fi, mobile, and hotspot");
-    }
-
-
 }
diff --git a/tests/robotests/src/com/android/settings/network/telephony/cdma/CdmaApnPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/ApnPreferenceControllerTest.java
similarity index 83%
rename from tests/robotests/src/com/android/settings/network/telephony/cdma/CdmaApnPreferenceControllerTest.java
rename to tests/robotests/src/com/android/settings/network/telephony/ApnPreferenceControllerTest.java
index 2aceda7..0fda51f 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/cdma/CdmaApnPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/ApnPreferenceControllerTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.settings.network.telephony.cdma;
+package com.android.settings.network.telephony;
 
 import static com.android.settings.core.BasePreferenceController.AVAILABLE;
 import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
@@ -47,7 +47,7 @@
 import org.robolectric.RuntimeEnvironment;
 
 @RunWith(SettingsRobolectricTestRunner.class)
-public class CdmaApnPreferenceControllerTest {
+public class ApnPreferenceControllerTest {
     private static final int SUB_ID = 2;
 
     @Mock
@@ -59,7 +59,7 @@
     @Mock
     private CarrierConfigManager mCarrierConfigManager;
 
-    private CdmaApnPreferenceController mController;
+    private ApnPreferenceController mController;
     private RestrictedPreference mPreference;
     private Context mContext;
 
@@ -73,11 +73,12 @@
         doReturn(mTelephonyManager).when(mTelephonyManager).createForSubscriptionId(SUB_ID);
         doReturn(mInvalidTelephonyManager).when(mTelephonyManager).createForSubscriptionId(
                 SubscriptionManager.INVALID_SUBSCRIPTION_ID);
+        doReturn(mCarrierConfigManager).when(mContext).getSystemService(CarrierConfigManager.class);
 
         mPreference = new RestrictedPreference(mContext);
-        mController = new CdmaApnPreferenceController(mContext, "mobile_data");
+        mController = new ApnPreferenceController(mContext, "mobile_data");
         mController.init(SUB_ID);
-        mController.mPreference = mPreference;
+        mController.setPreference(mPreference);
         mController.mCarrierConfigManager = mCarrierConfigManager;
         mPreference.setKey(mController.getPreferenceKey());
     }
@@ -103,6 +104,16 @@
     }
 
     @Test
+    public void getAvailabilityStatus_apnSettingsSupportedWithGsm_returnAvailable() {
+        doReturn(PhoneConstants.PHONE_TYPE_GSM).when(mTelephonyManager).getPhoneType();
+        final PersistableBundle bundle = new PersistableBundle();
+        bundle.putBoolean(CarrierConfigManager.KEY_APN_EXPAND_BOOL, true);
+        doReturn(bundle).when(mCarrierConfigManager).getConfigForSubId(SUB_ID);
+
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
+    }
+
+    @Test
     public void handPreferenceTreeClick_fireIntent() {
         ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class);
 
diff --git a/tests/robotests/src/com/android/settings/network/telephony/CarrierPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/CarrierPreferenceControllerTest.java
index e119e89..8673de8 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/CarrierPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/CarrierPreferenceControllerTest.java
@@ -68,6 +68,7 @@
         doReturn(mTelephonyManager).when(mTelephonyManager).createForSubscriptionId(SUB_ID);
         doReturn(mInvalidTelephonyManager).when(mTelephonyManager).createForSubscriptionId(
                 SubscriptionManager.INVALID_SUBSCRIPTION_ID);
+        doReturn(mCarrierConfigManager).when(mContext).getSystemService(CarrierConfigManager.class);
 
         mPreference = new RestrictedPreference(mContext);
         mController = new CarrierPreferenceController(mContext, "mobile_data");
diff --git a/tests/robotests/src/com/android/settings/network/telephony/NetworkSelectSettingsTest.java b/tests/robotests/src/com/android/settings/network/telephony/NetworkSelectSettingsTest.java
new file mode 100644
index 0000000..3ebeba1
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/network/telephony/NetworkSelectSettingsTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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.network.telephony;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.telephony.CellInfo;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+
+import androidx.preference.PreferenceCategory;
+import androidx.preference.PreferenceManager;
+
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RuntimeEnvironment;
+
+import java.util.Arrays;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+public class NetworkSelectSettingsTest {
+    private static final int SUB_ID = 2;
+
+    @Mock
+    private TelephonyManager mTelephonyManager;
+    @Mock
+    private SubscriptionManager mSubscriptionManager;
+    @Mock
+    private CellInfo mCellInfo1;
+    @Mock
+    private CellInfo mCellInfo2;
+    @Mock
+    private PreferenceManager mPreferenceManager;
+    private Context mContext;
+
+    private PreferenceCategory mConnectedPreferenceCategory;
+    private PreferenceCategory mPreferenceCategory;
+
+    private NetworkSelectSettings mNetworkSelectSettings;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+
+        mContext = spy(RuntimeEnvironment.application);
+        when(mContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mTelephonyManager);
+        when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
+        when(mTelephonyManager.createForSubscriptionId(SUB_ID)).thenReturn(mTelephonyManager);
+
+        when(mCellInfo1.isRegistered()).thenReturn(true);
+        when(mCellInfo2.isRegistered()).thenReturn(false);
+
+        mConnectedPreferenceCategory = spy(new PreferenceCategory(mContext));
+        doReturn(mPreferenceManager).when(mConnectedPreferenceCategory).getPreferenceManager();
+        mPreferenceCategory = spy(new PreferenceCategory(mContext));
+        doReturn(mPreferenceManager).when(mPreferenceCategory).getPreferenceManager();
+
+        mNetworkSelectSettings = spy(new NetworkSelectSettings());
+        doReturn(mContext).when(mNetworkSelectSettings).getContext();
+        mNetworkSelectSettings.mTelephonyManager = mTelephonyManager;
+        mNetworkSelectSettings.mConnectedPreferenceCategory = mConnectedPreferenceCategory;
+        mNetworkSelectSettings.mPreferenceCategory = mPreferenceCategory;
+        mNetworkSelectSettings.mCellInfoList = Arrays.asList(mCellInfo1, mCellInfo2);
+    }
+
+    @Test
+    public void updateAllPreferenceCategory_containCorrectPreference() {
+        mNetworkSelectSettings.updateAllPreferenceCategory();
+
+        assertThat(mConnectedPreferenceCategory.getPreferenceCount()).isEqualTo(1);
+        final NetworkOperatorPreference connectedPreference =
+                (NetworkOperatorPreference) mConnectedPreferenceCategory.getPreference(0);
+        assertThat(connectedPreference.getCellInfo()).isEqualTo(mCellInfo1);
+        assertThat(mPreferenceCategory.getPreferenceCount()).isEqualTo(1);
+        final NetworkOperatorPreference preference =
+                (NetworkOperatorPreference) mPreferenceCategory.getPreference(0);
+        assertThat(preference.getCellInfo()).isEqualTo(mCellInfo2);
+    }
+
+}
diff --git a/tests/robotests/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceControllerTest.java
new file mode 100644
index 0000000..5f65241
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/network/telephony/gsm/AutoSelectPreferenceControllerTest.java
@@ -0,0 +1,114 @@
+/*
+ * 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.network.telephony.gsm;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.os.PersistableBundle;
+import android.telephony.CarrierConfigManager;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+
+import androidx.preference.Preference;
+
+import com.android.settings.R;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Answers;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+public class AutoSelectPreferenceControllerTest {
+    private static final int SUB_ID = 2;
+    private static final String OPERATOR_NAME = "T-mobile";
+
+    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+    private TelephonyManager mTelephonyManager;
+    @Mock
+    private SubscriptionManager mSubscriptionManager;
+    @Mock
+    private CarrierConfigManager mCarrierConfigManager;
+
+    private PersistableBundle mCarrierConfig;
+    private AutoSelectPreferenceController mController;
+    private Preference mPreference;
+    private Context mContext;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+
+        mContext = spy(RuntimeEnvironment.application);
+        when(mContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mTelephonyManager);
+        when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
+        when(mContext.getSystemService(CarrierConfigManager.class)).thenReturn(
+                mCarrierConfigManager);
+        when(mTelephonyManager.createForSubscriptionId(SUB_ID)).thenReturn(mTelephonyManager);
+
+        mCarrierConfig = new PersistableBundle();
+        mCarrierConfig.putBoolean(CarrierConfigManager.KEY_ONLY_AUTO_SELECT_IN_HOME_NETWORK_BOOL,
+                true);
+        when(mCarrierConfigManager.getConfigForSubId(SUB_ID)).thenReturn(mCarrierConfig);
+
+        mPreference = new Preference(mContext);
+        mController = new AutoSelectPreferenceController(mContext, "auto_select");
+        mController.init(SUB_ID);
+    }
+
+    @Test
+    public void setChecked_isChecked_updateValue() {
+        when(mTelephonyManager.getNetworkSelectionMode()).thenReturn(
+                TelephonyManager.NETWORK_SELECTION_MODE_AUTO);
+
+        assertThat(mController.setChecked(true)).isTrue();
+
+        verify(mTelephonyManager).setNetworkSelectionModeAutomatic();
+    }
+
+    @Test
+    public void updateState_isRoaming_enabled() {
+        when(mTelephonyManager.getServiceState().getRoaming()).thenReturn(true);
+
+        mController.updateState(mPreference);
+
+        assertThat(mPreference.isEnabled()).isTrue();
+    }
+
+    @Test
+    public void updateState_notRoamingWithAutoSelectOn_disabled() {
+        when(mTelephonyManager.getServiceState().getRoaming()).thenReturn(false);
+        doReturn(OPERATOR_NAME).when(mTelephonyManager).getSimOperatorName();
+
+        mController.updateState(mPreference);
+
+        assertThat(mPreference.isEnabled()).isFalse();
+        assertThat(mPreference.getSummary()).isEqualTo(
+                mContext.getString(R.string.manual_mode_disallowed_summary,
+                        mTelephonyManager.getSimOperatorName()));
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceControllerTest.java
new file mode 100644
index 0000000..d5fc6e0
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/network/telephony/gsm/OpenNetworkSelectPagePreferenceControllerTest.java
@@ -0,0 +1,110 @@
+/*
+ * 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.network.telephony.gsm;
+
+import static com.google.common.truth.Truth.assertThat;
+
+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.PersistableBundle;
+import android.telephony.CarrierConfigManager;
+import android.telephony.ServiceState;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+
+import androidx.preference.Preference;
+
+import com.android.settings.R;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+public class OpenNetworkSelectPagePreferenceControllerTest {
+    private static final int SUB_ID = 2;
+    private static final String OPERATOR_NAME = "T-mobile";
+
+    @Mock
+    private TelephonyManager mTelephonyManager;
+    @Mock
+    private SubscriptionManager mSubscriptionManager;
+    @Mock
+    private CarrierConfigManager mCarrierConfigManager;
+    @Mock
+    private ServiceState mServiceState;
+
+    private PersistableBundle mCarrierConfig;
+    private OpenNetworkSelectPagePreferenceController mController;
+    private Preference mPreference;
+    private Context mContext;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+
+        mContext = spy(RuntimeEnvironment.application);
+        when(mContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mTelephonyManager);
+        when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
+        when(mContext.getSystemService(CarrierConfigManager.class)).thenReturn(
+                mCarrierConfigManager);
+        when(mTelephonyManager.createForSubscriptionId(SUB_ID)).thenReturn(mTelephonyManager);
+        when(mTelephonyManager.getServiceState()).thenReturn(mServiceState);
+
+        mCarrierConfig = new PersistableBundle();
+        when(mCarrierConfigManager.getConfigForSubId(SUB_ID)).thenReturn(mCarrierConfig);
+
+        mPreference = new Preference(mContext);
+        mController = new OpenNetworkSelectPagePreferenceController(mContext,
+                "open_network_select");
+        mController.init(SUB_ID);
+    }
+
+    @Test
+    public void updateState_modeAuto_disabled() {
+        when(mTelephonyManager.getNetworkSelectionMode()).thenReturn(
+                TelephonyManager.NETWORK_SELECTION_MODE_AUTO);
+
+        mController.updateState(mPreference);
+
+        assertThat(mPreference.isEnabled()).isFalse();
+    }
+
+    @Test
+    public void getSummary_inService_returnOperatorName() {
+        when(mServiceState.getState()).thenReturn(ServiceState.STATE_IN_SERVICE);
+        doReturn(OPERATOR_NAME).when(mTelephonyManager).getNetworkOperatorName();
+
+        assertThat(mController.getSummary()).isEqualTo(OPERATOR_NAME);
+    }
+
+    @Test
+    public void getSummary_notInService_returnDisconnect() {
+        when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE);
+        doReturn(OPERATOR_NAME).when(mTelephonyManager).getNetworkOperatorName();
+
+        assertThat(mController.getSummary()).isEqualTo(
+                mContext.getString(R.string.network_disconnected));
+    }
+}
diff --git a/tests/unit/src/com/android/settings/dashboard/DashboardSummaryInstrumentationTest.java b/tests/unit/src/com/android/settings/dashboard/DashboardSummaryInstrumentationTest.java
deleted file mode 100644
index c21f0c0..0000000
--- a/tests/unit/src/com/android/settings/dashboard/DashboardSummaryInstrumentationTest.java
+++ /dev/null
@@ -1,81 +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.dashboard;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.app.Instrumentation;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.ActivityInfo;
-import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.uiautomator.By;
-import android.support.test.uiautomator.UiDevice;
-import android.support.test.uiautomator.UiObject2;
-import android.support.test.uiautomator.Until;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.List;
-
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentActivity;
-
-@RunWith(AndroidJUnit4.class)
-@SmallTest
-public class DashboardSummaryInstrumentationTest {
-
-    private static final long TIMEOUT = 2000l;
-
-    private Context mContext;
-    private Instrumentation mInstrumentation;
-
-    private UiDevice mDevice;
-
-    @Before
-    public void setUp() {
-        mInstrumentation = InstrumentationRegistry.getInstrumentation();
-        mDevice = UiDevice.getInstance(mInstrumentation);
-        mContext = InstrumentationRegistry.getTargetContext();
-    }
-
-    @Test
-    public void rotate_shouldSaveCategoriesChangedState() {
-        final Intent intent = new Intent(Settings.ACTION_SETTINGS)
-                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        final FragmentActivity activity =
-                (FragmentActivity) mInstrumentation.startActivitySync(intent);
-
-        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
-        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
-
-        final UiObject2 item = mDevice.wait(Until.findObject(By.res("android:id/title")
-                .text("Network & internet")), TIMEOUT);
-        assertThat(item).isNotNull();
-
-        final List<Fragment> fragments = activity.getSupportFragmentManager().getFragments();
-        final DashboardSummary fragment = (DashboardSummary) fragments.get(0);
-
-        assertThat(fragment.mIsOnCategoriesChangedCalled).isTrue();
-    }
-
-}