diff --git a/res/values/strings.xml b/res/values/strings.xml
index fca80b4..74f4621 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -490,8 +490,6 @@
     <string name="activity_picker_label">Choose activity</string>
     <!-- Do not translate. -->
     <string name="debug_intent_sender_label">Debug intent sender</string>
-    <!-- The title of the activity to see random device info. -->
-    <string name="device_info_label">Device info</string>
     <!-- The title of the activity to adjust display settings -->
     <string name="display_label">Screen</string>
     <!-- The title of the activity to adjust SD card settings [CHAR LIMIT=25] -->
@@ -1765,7 +1763,8 @@
     <string name="tx_link_speed"><xliff:g id="Transmit link speed" example="150 Mbps">%1$d</xliff:g> Mbps</string>
     <!-- Receive Link speed on Wifi Status screen [CHAR LIMIT=32] -->
     <string name="rx_link_speed"><xliff:g id="Receive link speed" example="54 Mbps">%1$d</xliff:g> Mbps</string>
-
+    <!-- Link speed on Wifi Status screen [CHAR LIMIT=32] -->
+    <string name="link_speed"><xliff:g id="Link speed" example="54 Mbps">%1$d</xliff:g> Mbps</string>
     <!-- This string asks the user whether or not to allow an app to enable WiFi. [CHAR LIMIT=NONE] -->
     <string name="wifi_ask_enable"><xliff:g id="requester" example="FancyApp">%s</xliff:g> wants to turn on Wi-Fi</string>
     <!-- This string asks the user whether or not to allow an app to disable WiFi. [CHAR LIMIT=NONE] -->
@@ -1956,8 +1955,6 @@
     <string name="wifi_show_advanced">Advanced options</string>
     <!-- Message for talkback to say when focus on Advanced Options[CHAR LIMIT=NONE] -->
     <string name="wifi_advanced_toggle_description">Drop down list Advanced Options</string>
-    <!-- Extended message for talkback to say when Advanced Options is expanded. (e.g., Double-tap to collapse) [CHAR LIMIT=NONE] -->
-    <string name="wifi_advanced_toggle_description_expanded">collapse</string>
     <!-- Extended message for talkback to say when Advanced Options is collapsed. (e.g., Double-tap to expand) [CHAR LIMIT=NONE] -->
     <string name="wifi_advanced_toggle_description_collapsed">expand</string>
     <!-- Label for the SSID of the network -->
@@ -1978,6 +1975,8 @@
     <string name="tx_wifi_speed">Transmit link speed</string>
     <!-- Label for the receive link speed of the connection. [CHAR LIMIT=32] -->
     <string name="rx_wifi_speed">Receive link speed</string>
+    <!-- Label for the link speed of the connection. [CHAR LIMIT=32] -->
+    <string name="wifi_speed">Link speed</string>
     <!-- Label for the frequency band of the connection -->
     <string name="wifi_frequency">Frequency</string>
     <!-- Label for the IP address of the connection -->
@@ -7319,6 +7318,8 @@
     <string name="keywords_wifi">wifi, wi-fi, network connection, internet, wireless, data, wi fi</string>
     <!-- Search keyword for "Open Network Notification" settings. [CHAR_LIMIT=NONE]-->
     <string name="keywords_wifi_notify_open_networks">Wi\u2011Fi notification, wifi notification</string>
+    <!-- Search keyword for "Wi-fi data usage" settings. [CHAR_LIMIT=NONE]-->
+    <string name="keywords_wifi_data_usage">data usage</string>
     <!-- Search keyword for "Vibrate on touch" settings. [CHAR_LIMIT=NONE]-->
     <string name="keywords_vibrate_on_touch">Stop vibration, tap, keyboard</string>
     <!-- Search keyword for "Time format" settings. [CHAR_LIMIT=NONE]-->
@@ -11215,9 +11216,6 @@
     <!-- Available networks screen, summary when button disallowed due to permanent automatic mode [CHAR LIMIT=NONE] -->
     <string name="manual_mode_disallowed_summary">Unavailable when connected to <xliff:g id="carrier" example="verizon">%1$s</xliff:g></string>
 
-    <!-- Used for EmergencyInfoSlice slice helper class [CHAR LIMIT=NONE]-->
-    <string name="emergency_info_contextual_card_summary">Medical info, emergency contacts</string>
-
     <!-- See more items in contextual homepage [CHAR LIMIT=30]-->
     <string name="see_more">See more</string>
     <!-- See less items in contextual homepage [CHAR LIMIT=30]-->
diff --git a/res/xml/security_settings_face.xml b/res/xml/security_settings_face.xml
index cd05512..cc45a96 100644
--- a/res/xml/security_settings_face.xml
+++ b/res/xml/security_settings_face.xml
@@ -71,17 +71,19 @@
         android:title="@string/security_settings_face_preference_title">
         <com.android.settingslib.widget.LayoutPreference
             android:key="security_settings_face_delete_faces_container"
+            android:title="@string/security_settings_face_settings_remove_face_data"
             android:selectable="false"
             android:layout="@layout/face_remove_button"
             settings:allowDividerBelow="true"/>
 
         <com.android.settingslib.widget.LayoutPreference
             android:key="security_settings_face_enroll_faces_container"
+            android:title="@string/security_settings_face_settings_enroll"
             android:selectable="false"
-            android:layout="@layout/face_enroll_button "
+            android:layout="@layout/face_enroll_button"
             settings:allowDividerBelow="true"/>
     </PreferenceCategory>
 
     <com.android.settingslib.widget.FooterPreference
         settings:allowDividerAbove="true"/>
-</PreferenceScreen>
\ No newline at end of file
+</PreferenceScreen>
diff --git a/res/xml/wifi_settings.xml b/res/xml/wifi_settings.xml
index d7c299e..5fac85a 100644
--- a/res/xml/wifi_settings.xml
+++ b/res/xml/wifi_settings.xml
@@ -17,19 +17,21 @@
 <PreferenceScreen
         xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:settings="http://schemas.android.com/apk/res-auto"
-        android:title="@string/wifi_settings"
-        settings:keywords="@string/keywords_wifi">
+        android:title="@string/wifi_settings">
 
     <com.android.settings.wifi.LinkablePreference
-        android:key="wifi_status_message"/>
+        android:key="wifi_status_message"
+        settings:searchable="false"/>
 
     <PreferenceCategory
         android:key="connected_access_point"
-        android:layout="@layout/preference_category_no_label"/>
+        android:layout="@layout/preference_category_no_label"
+        settings:searchable="false"/>
 
     <PreferenceCategory
         android:key="access_points"
-        android:layout="@layout/preference_category_no_label"/>
+        android:layout="@layout/preference_category_no_label"
+        settings:searchable="false"/>
 
     <Preference
         android:key="configure_settings"
@@ -44,5 +46,6 @@
 
     <com.android.settings.datausage.DataUsagePreference
         android:key="wifi_data_usage"
-        android:title="@string/wifi_data_usage"/>
+        android:title="@string/wifi_data_usage"
+        settings:keywords="@string/keywords_wifi_data_usage"/>
 </PreferenceScreen>
diff --git a/src/com/android/settings/AirplaneModeEnabler.java b/src/com/android/settings/AirplaneModeEnabler.java
index 64ad17d..f1d36f2 100644
--- a/src/com/android/settings/AirplaneModeEnabler.java
+++ b/src/com/android/settings/AirplaneModeEnabler.java
@@ -22,9 +22,7 @@
 import android.os.UserHandle;
 import android.provider.Settings;
 import android.telephony.PhoneStateListener;
-import android.telephony.ServiceState;
 import android.telephony.SubscriptionInfo;
-import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 import android.util.Log;
 
@@ -34,7 +32,6 @@
 import com.android.settingslib.WirelessUtils;
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 
-import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -61,12 +58,11 @@
 
     private TelephonyManager mTelephonyManager;
     private ProxySubscriptionManager mProxySubscriptionMgr;
-    private List<ServiceStateListener> mServiceStateListeners;
+    private PhoneStateListener mPhoneStateListener;
 
     private GlobalSettingsChangeListener mAirplaneModeObserver;
 
-    public AirplaneModeEnabler(Context context,
-            OnAirplaneModeChangedListener listener) {
+    public AirplaneModeEnabler(Context context, OnAirplaneModeChangedListener listener) {
         super(context, Settings.Global.AIRPLANE_MODE_ON);
 
         mContext = context;
@@ -75,6 +71,16 @@
 
         mTelephonyManager = context.getSystemService(TelephonyManager.class);
         mProxySubscriptionMgr = ProxySubscriptionManager.getInstance(context);
+
+        mPhoneStateListener = new PhoneStateListener() {
+            @Override
+            public void onRadioPowerStateChanged(int state) {
+                if (DEBUG) {
+                    Log.d(LOG_TAG, "RadioPower: " + state);
+                }
+                onAirplaneModeChanged();
+            }
+        };
     }
 
     /**
@@ -88,35 +94,13 @@
     }
 
     public void resume() {
-        final List<SubscriptionInfo> subInfoList =
-                mProxySubscriptionMgr.getActiveSubscriptionsInfo();
-
-        mServiceStateListeners = new ArrayList<ServiceStateListener>();
-
-        // add default listener
-        mServiceStateListeners.add(new ServiceStateListener(mTelephonyManager,
-                SubscriptionManager.INVALID_SUBSCRIPTION_ID, this));
-
-        if (subInfoList != null) {
-            for (SubscriptionInfo subInfo : subInfoList) {
-                mServiceStateListeners.add(new ServiceStateListener(mTelephonyManager,
-                        subInfo.getSubscriptionId(), this));
-            }
-        }
-
-        for (ServiceStateListener ssListener : mServiceStateListeners) {
-            ssListener.start();
-        }
+        mTelephonyManager.listen(mPhoneStateListener,
+                PhoneStateListener.LISTEN_RADIO_POWER_STATE_CHANGED);
     }
 
     public void pause() {
-        if (mServiceStateListeners == null) {
-            return;
-        }
-        for (ServiceStateListener ssListener : mServiceStateListeners) {
-            ssListener.stop();
-        }
-        mServiceStateListeners = null;
+        mTelephonyManager.listen(mPhoneStateListener,
+                PhoneStateListener.LISTEN_NONE);
     }
 
     private void setAirplaneModeOn(boolean enabling) {
@@ -200,51 +184,4 @@
     public boolean isAirplaneModeOn() {
         return WirelessUtils.isAirplaneModeOn(mContext);
     }
-
-    private static class ServiceStateListener extends PhoneStateListener {
-        private ServiceStateListener(TelephonyManager telephonyManager, int subscriptionId,
-                AirplaneModeEnabler enabler) {
-            super();
-            mSubId = subscriptionId;
-            mTelephonyManager = getSubIdSpecificTelephonyManager(telephonyManager);
-            mEnabler = enabler;
-        }
-
-        private int mSubId;
-        private TelephonyManager mTelephonyManager;
-        private AirplaneModeEnabler mEnabler;
-
-        int getSubscriptionId() {
-            return mSubId;
-        }
-
-        void start() {
-            if (mTelephonyManager != null) {
-                mTelephonyManager.listen(this, PhoneStateListener.LISTEN_SERVICE_STATE);
-            }
-        }
-
-        void stop() {
-            if (mTelephonyManager != null) {
-                mTelephonyManager.listen(this, PhoneStateListener.LISTEN_NONE);
-            }
-        }
-
-        @Override
-        public void onServiceStateChanged(ServiceState serviceState) {
-            if (DEBUG) {
-                Log.d(LOG_TAG, "ServiceState in sub" + mSubId + ": " + serviceState);
-            }
-            mEnabler.onAirplaneModeChanged();
-        }
-
-        private TelephonyManager getSubIdSpecificTelephonyManager(
-                TelephonyManager telephonyManager) {
-            if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
-                return telephonyManager;
-            }
-            return telephonyManager.createForSubscriptionId(mSubId);
-        }
-    }
-
 }
diff --git a/src/com/android/settings/biometrics/face/FaceSettings.java b/src/com/android/settings/biometrics/face/FaceSettings.java
index ca51f18..5795e65 100644
--- a/src/com/android/settings/biometrics/face/FaceSettings.java
+++ b/src/com/android/settings/biometrics/face/FaceSettings.java
@@ -56,6 +56,11 @@
     private static final String TAG = "FaceSettings";
     private static final String KEY_TOKEN = "hw_auth_token";
 
+    private static final String PREF_KEY_DELETE_FACE_DATA =
+            "security_settings_face_delete_faces_container";
+    private static final String PREF_KEY_ENROLL_FACE_UNLOCK =
+            "security_settings_face_enroll_faces_container";
+
     private UserManager mUserManager;
     private FaceManager mFaceManager;
     private int mUserId;
@@ -309,6 +314,15 @@
                 protected boolean isPageSearchEnabled(Context context) {
                     return isAvailable(context);
                 }
-            };
 
+                @Override
+                public List<String> getNonIndexableKeys(Context context) {
+                    final List<String> keys = super.getNonIndexableKeys(context);
+                    final FaceManager faceManager = context.getSystemService(FaceManager.class);
+                    final boolean hasEnrolled = faceManager.hasEnrolledTemplates(
+                            UserHandle.myUserId());
+                    keys.add(hasEnrolled ? PREF_KEY_ENROLL_FACE_UNLOCK : PREF_KEY_DELETE_FACE_DATA);
+                    return keys;
+                }
+            };
 }
diff --git a/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java b/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
index 292b203..bee93fb 100644
--- a/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
+++ b/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
@@ -73,6 +73,8 @@
     @VisibleForTesting
     Handler mHandler = new Handler(Looper.getMainLooper());
     @VisibleForTesting
+    boolean mIsRegisterCallback = false;
+    @VisibleForTesting
     final BluetoothAdapter.OnMetadataChangedListener mMetadataListener =
             new BluetoothAdapter.OnMetadataChangedListener() {
                 @Override
@@ -96,6 +98,7 @@
         final boolean untetheredHeadset = mCachedDevice != null
                 && BluetoothUtils.getBooleanMetaData(
                 mCachedDevice.getDevice(), BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET);
+        Log.d(TAG, "getAvailabilityStatus() is untethered : " + untetheredHeadset);
         return advancedEnabled && untetheredHeadset ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
     }
 
@@ -113,6 +116,7 @@
         if (!isAvailable()) {
             return;
         }
+        mIsRegisterCallback = true;
         mCachedDevice.registerCallback(this);
         mBluetoothAdapter.addOnMetadataChangedListener(mCachedDevice.getDevice(),
                 mContext.getMainExecutor(), mMetadataListener);
@@ -120,19 +124,17 @@
 
     @Override
     public void onStop() {
-        if (!isAvailable()) {
+        if (!mIsRegisterCallback) {
             return;
         }
         mCachedDevice.unregisterCallback(this);
         mBluetoothAdapter.removeOnMetadataChangedListener(mCachedDevice.getDevice(),
                 mMetadataListener);
+        mIsRegisterCallback = false;
     }
 
     @Override
     public void onDestroy() {
-        if (!isAvailable()) {
-            return;
-        }
         // Destroy icon bitmap associated with this header
         for (Bitmap bitmap : mIconCache.values()) {
             if (bitmap != null) {
diff --git a/src/com/android/settings/datetime/timezone/TimeZoneSettings.java b/src/com/android/settings/datetime/timezone/TimeZoneSettings.java
index 8226a6c..60cd636 100644
--- a/src/com/android/settings/datetime/timezone/TimeZoneSettings.java
+++ b/src/com/android/settings/datetime/timezone/TimeZoneSettings.java
@@ -25,6 +25,7 @@
 import android.content.SharedPreferences;
 import android.icu.util.TimeZone;
 import android.os.Bundle;
+import android.provider.Settings;
 import android.util.Log;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -123,9 +124,9 @@
         super.onCreate(icicle);
         // Hide all interactive preferences
         setPreferenceCategoryVisible((PreferenceCategory) findPreference(
-            PREF_KEY_REGION_CATEGORY), false);
+                PREF_KEY_REGION_CATEGORY), false);
         setPreferenceCategoryVisible((PreferenceCategory) findPreference(
-            PREF_KEY_FIXED_OFFSET_CATEGORY), false);
+                PREF_KEY_FIXED_OFFSET_CATEGORY), false);
 
         // Start loading TimeZoneData
         getLoaderManager().initLoader(0, null, new TimeZoneDataLoader.LoaderCreator(
@@ -237,7 +238,7 @@
         String tzId = data.getStringExtra(RegionZonePicker.EXTRA_RESULT_TIME_ZONE_ID);
         // Ignore the result if user didn't change the region or time zone.
         if (Objects.equals(regionId, use(RegionPreferenceController.class).getRegionId())
-            && Objects.equals(tzId, mSelectedTimeZoneId)) {
+                && Objects.equals(tzId, mSelectedTimeZoneId)) {
             return;
         }
 
@@ -327,9 +328,9 @@
     private void setSelectByRegion(boolean selectByRegion) {
         mSelectByRegion = selectByRegion;
         setPreferenceCategoryVisible((PreferenceCategory) findPreference(
-            PREF_KEY_REGION_CATEGORY), selectByRegion);
+                PREF_KEY_REGION_CATEGORY), selectByRegion);
         setPreferenceCategoryVisible((PreferenceCategory) findPreference(
-            PREF_KEY_FIXED_OFFSET_CATEGORY), !selectByRegion);
+                PREF_KEY_FIXED_OFFSET_CATEGORY), !selectByRegion);
         final String localeRegionId = getLocaleRegionId();
         final Set<String> allCountryIsoCodes = mTimeZoneData.getRegionIds();
 
@@ -353,6 +354,7 @@
      * Find the a region associated with the specified time zone, based on the time zone data.
      * If there are multiple regions associated with the given time zone, the priority will be given
      * to the region the user last picked and the country in user's locale.
+     *
      * @return null if no region associated with the time zone
      */
     private String findRegionIdForTzId(String tzId) {
@@ -378,7 +380,7 @@
     }
 
     private void setPreferenceCategoryVisible(PreferenceCategory category,
-        boolean isVisible) {
+            boolean isVisible) {
         // Hiding category doesn't hide all the children preference. Set visibility of its children.
         // Do not care grandchildren as time_zone_pref.xml has only 2 levels.
         category.setVisible(isVisible);
@@ -392,5 +394,13 @@
     }
 
     public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
-            new BaseSearchIndexProvider(R.xml.time_zone_prefs);
+            new BaseSearchIndexProvider(R.xml.time_zone_prefs) {
+                @Override
+                protected boolean isPageSearchEnabled(Context context) {
+                    // We can't enter this page if the auto time zone is enabled.
+                    final int autoTimeZone = Settings.Global.getInt(context.getContentResolver(),
+                            Settings.Global.AUTO_TIME_ZONE, 1);
+                    return autoTimeZone == 1 ? false : true;
+                }
+            };
 }
diff --git a/src/com/android/settings/deviceinfo/BrandedAccountPreferenceController.java b/src/com/android/settings/deviceinfo/BrandedAccountPreferenceController.java
index bdd76fc..3543832 100644
--- a/src/com/android/settings/deviceinfo/BrandedAccountPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/BrandedAccountPreferenceController.java
@@ -32,13 +32,13 @@
 import com.android.settings.overlay.FeatureFactory;
 
 public class BrandedAccountPreferenceController extends BasePreferenceController {
-    private final Account[] mAccounts;
+    private final AccountFeatureProvider mAccountFeatureProvider;
+    private Account[] mAccounts;
 
     public BrandedAccountPreferenceController(Context context, String key) {
         super(context, key);
-        final AccountFeatureProvider accountFeatureProvider = FeatureFactory.getFactory(
-                mContext).getAccountFeatureProvider();
-        mAccounts = accountFeatureProvider.getAccounts(mContext);
+        mAccountFeatureProvider = FeatureFactory.getFactory(mContext).getAccountFeatureProvider();
+        mAccounts = mAccountFeatureProvider.getAccounts(mContext);
     }
 
     @Override
@@ -56,8 +56,6 @@
     @Override
     public void displayPreference(PreferenceScreen screen) {
         super.displayPreference(screen);
-        final AccountFeatureProvider accountFeatureProvider = FeatureFactory.getFactory(
-                mContext).getAccountFeatureProvider();
         final Preference accountPreference = screen.findPreference(getPreferenceKey());
         if (accountPreference != null && (mAccounts == null || mAccounts.length == 0)) {
             screen.removePreference(accountPreference);
@@ -72,7 +70,7 @@
             args.putParcelable(AccountDetailDashboardFragment.KEY_USER_HANDLE,
                     android.os.Process.myUserHandle());
             args.putString(AccountDetailDashboardFragment.KEY_ACCOUNT_TYPE,
-                    accountFeatureProvider.getAccountType());
+                    mAccountFeatureProvider.getAccountType());
 
             new SubSettingLauncher(mContext)
                     .setDestination(AccountDetailDashboardFragment.class.getName())
@@ -83,4 +81,13 @@
             return true;
         });
     }
+
+    @Override
+    public void updateState(Preference preference) {
+        super.updateState(preference);
+        mAccounts = mAccountFeatureProvider.getAccounts(mContext);
+        if (mAccounts == null || mAccounts.length == 0) {
+            preference.setVisible(false);
+        }
+    }
 }
diff --git a/src/com/android/settings/deviceinfo/MigrateEstimateTask.java b/src/com/android/settings/deviceinfo/MigrateEstimateTask.java
index c41ebe0..a5790b3 100644
--- a/src/com/android/settings/deviceinfo/MigrateEstimateTask.java
+++ b/src/com/android/settings/deviceinfo/MigrateEstimateTask.java
@@ -29,7 +29,7 @@
 import android.os.UserManager;
 import android.os.storage.StorageManager;
 import android.os.storage.VolumeInfo;
-import android.telecom.Log;
+import android.util.Log;
 import android.text.format.DateUtils;
 import android.text.format.Formatter;
 
diff --git a/src/com/android/settings/homepage/contextualcards/deviceinfo/DataUsageSlice.java b/src/com/android/settings/homepage/contextualcards/deviceinfo/DataUsageSlice.java
deleted file mode 100644
index 419b770..0000000
--- a/src/com/android/settings/homepage/contextualcards/deviceinfo/DataUsageSlice.java
+++ /dev/null
@@ -1,135 +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.contextualcards.deviceinfo;
-
-import android.app.PendingIntent;
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import android.text.Spannable;
-import android.text.SpannableString;
-import android.text.TextUtils;
-import android.text.format.Formatter;
-import android.text.style.TextAppearanceSpan;
-
-import androidx.core.graphics.drawable.IconCompat;
-import androidx.slice.Slice;
-import androidx.slice.builders.ListBuilder;
-import androidx.slice.builders.SliceAction;
-
-import com.android.internal.annotations.VisibleForTesting;
-import com.android.settings.R;
-import com.android.settings.SubSettings;
-import com.android.settings.Utils;
-import com.android.settings.datausage.DataUsageSummary;
-import com.android.settings.datausage.DataUsageUtils;
-import com.android.settings.slices.CustomSliceRegistry;
-import com.android.settings.slices.CustomSliceable;
-import com.android.settings.slices.SliceBuilderUtils;
-import com.android.settingslib.net.DataUsageController;
-
-import java.util.concurrent.TimeUnit;
-
-public class DataUsageSlice implements CustomSliceable {
-    private static final String TAG = "DataUsageSlice";
-    private static final long MILLIS_IN_A_DAY = TimeUnit.DAYS.toMillis(1);
-
-
-    private final Context mContext;
-
-    public DataUsageSlice(Context context) {
-        mContext = context;
-    }
-
-    @Override
-    public Uri getUri() {
-        return CustomSliceRegistry.DATA_USAGE_SLICE_URI;
-    }
-
-    @Override
-    public Slice getSlice() {
-        final IconCompat icon = IconCompat.createWithResource(mContext,
-                R.drawable.ic_settings_data_usage);
-        final String title = mContext.getString(R.string.data_usage_summary_title);
-        final SliceAction primaryAction = SliceAction.createDeeplink(getPrimaryAction(), icon,
-                ListBuilder.ICON_IMAGE, title);
-        final DataUsageController dataUsageController = new DataUsageController(mContext);
-        final DataUsageController.DataUsageInfo info = dataUsageController.getDataUsageInfo();
-        final ListBuilder listBuilder =
-                new ListBuilder(mContext, CustomSliceRegistry.DATA_USAGE_SLICE_URI,
-                        ListBuilder.INFINITY)
-                        .setAccentColor(Utils.getColorAccentDefaultColor(mContext))
-                        .setHeader(new ListBuilder.HeaderBuilder().setTitle(title));
-        if (DataUsageUtils.hasSim(mContext)) {
-            listBuilder.addRow(new ListBuilder.RowBuilder()
-                    .setTitle(getDataUsageText(info))
-                    .setSubtitle(getCycleTime(info))
-                    .setPrimaryAction(primaryAction));
-        } else {
-            listBuilder.addRow(new ListBuilder.RowBuilder()
-                    .setTitle(mContext.getText(R.string.no_sim_card))
-                    .setPrimaryAction(primaryAction));
-        }
-        return listBuilder.build();
-    }
-
-    @Override
-    public Intent getIntent() {
-        final String screenTitle = mContext.getText(R.string.data_usage_wifi_title).toString();
-        return SliceBuilderUtils.buildSearchResultPageIntent(mContext,
-                DataUsageSummary.class.getName(), "" /* key */, screenTitle,
-                SettingsEnums.SLICE)
-                .setClassName(mContext.getPackageName(), SubSettings.class.getName())
-                .setData(CustomSliceRegistry.DATA_USAGE_SLICE_URI);
-    }
-
-    private PendingIntent getPrimaryAction() {
-        final Intent intent = getIntent();
-        return PendingIntent.getActivity(mContext, 0  /* requestCode */, intent, 0  /* flags */);
-    }
-
-    @VisibleForTesting
-    CharSequence getDataUsageText(DataUsageController.DataUsageInfo info) {
-        final Formatter.BytesResult usedResult = Formatter.formatBytes(mContext.getResources(),
-                info.usageLevel, Formatter.FLAG_CALCULATE_ROUNDED | Formatter.FLAG_IEC_UNITS);
-        final SpannableString usageNumberText = new SpannableString(usedResult.value);
-        usageNumberText.setSpan(
-                new TextAppearanceSpan(mContext, android.R.style.TextAppearance_Large), 0,
-                usageNumberText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
-        return TextUtils.expandTemplate(mContext.getText(R.string.data_used_formatted),
-                usageNumberText, usedResult.units);
-    }
-
-    @VisibleForTesting
-    CharSequence getCycleTime(DataUsageController.DataUsageInfo info) {
-        final long millisLeft = info.cycleEnd - System.currentTimeMillis();
-        if (millisLeft <= 0) {
-            return mContext.getString(R.string.billing_cycle_none_left);
-        } else {
-            final int daysLeft = (int) (millisLeft / MILLIS_IN_A_DAY);
-            return daysLeft < 1 ? mContext.getString(R.string.billing_cycle_less_than_one_day_left)
-                    : mContext.getResources().getQuantityString(R.plurals.billing_cycle_days_left,
-                            daysLeft, daysLeft);
-        }
-    }
-
-    @Override
-    public void onNotifyChange(Intent intent) {
-
-    }
-}
diff --git a/src/com/android/settings/homepage/contextualcards/deviceinfo/DeviceInfoSlice.java b/src/com/android/settings/homepage/contextualcards/deviceinfo/DeviceInfoSlice.java
deleted file mode 100644
index 4a028b0..0000000
--- a/src/com/android/settings/homepage/contextualcards/deviceinfo/DeviceInfoSlice.java
+++ /dev/null
@@ -1,125 +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.contextualcards.deviceinfo;
-
-import android.app.PendingIntent;
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import android.telephony.SubscriptionInfo;
-import android.telephony.SubscriptionManager;
-import android.text.TextUtils;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.core.graphics.drawable.IconCompat;
-import androidx.slice.Slice;
-import androidx.slice.builders.ListBuilder;
-import androidx.slice.builders.SliceAction;
-
-import com.android.settings.R;
-import com.android.settings.SubSettings;
-import com.android.settings.Utils;
-import com.android.settings.deviceinfo.HardwareInfoPreferenceController;
-import com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment;
-import com.android.settings.slices.CustomSliceRegistry;
-import com.android.settings.slices.CustomSliceable;
-import com.android.settings.slices.SliceBuilderUtils;
-import com.android.settingslib.DeviceInfoUtils;
-
-import java.util.List;
-
-public class DeviceInfoSlice implements CustomSliceable {
-    private static final String TAG = "DeviceInfoSlice";
-
-    private final Context mContext;
-    private final SubscriptionManager mSubscriptionManager;
-
-    public DeviceInfoSlice(Context context) {
-        mContext = context;
-        mSubscriptionManager = mContext.getSystemService(SubscriptionManager.class);
-    }
-
-    @Override
-    public Slice getSlice() {
-        final IconCompat icon = IconCompat.createWithResource(mContext,
-                R.drawable.ic_info_outline_24dp);
-        final String title = mContext.getString(R.string.device_info_label);
-        final SliceAction primaryAction = SliceAction.createDeeplink(getPrimaryAction(), icon,
-                ListBuilder.ICON_IMAGE, title);
-        return new ListBuilder(mContext, CustomSliceRegistry.DEVICE_INFO_SLICE_URI,
-                ListBuilder.INFINITY)
-                .setAccentColor((Utils.getColorAccentDefaultColor(mContext)))
-                .setHeader(new ListBuilder.HeaderBuilder().setTitle(title))
-                .addRow(new ListBuilder.RowBuilder()
-                        .setTitle(getPhoneNumber())
-                        .setSubtitle(getDeviceModel())
-                        .setPrimaryAction(primaryAction))
-                .build();
-    }
-
-    @Override
-    public Uri getUri() {
-        return CustomSliceRegistry.DEVICE_INFO_SLICE_URI;
-    }
-
-    @Override
-    public Intent getIntent() {
-        final String screenTitle = mContext.getText(R.string.device_info_label).toString();
-        return SliceBuilderUtils.buildSearchResultPageIntent(mContext,
-                MyDeviceInfoFragment.class.getName(), "" /* key */, screenTitle,
-                SettingsEnums.SLICE)
-                .setClassName(mContext.getPackageName(), SubSettings.class.getName())
-                .setData(CustomSliceRegistry.DEVICE_INFO_SLICE_URI);
-    }
-
-    private PendingIntent getPrimaryAction() {
-        final Intent intent = getIntent();
-        return PendingIntent.getActivity(mContext, 0  /* requestCode */, intent, 0  /* flags */);
-    }
-
-    @VisibleForTesting
-    CharSequence getPhoneNumber() {
-        final SubscriptionInfo subscriptionInfo = getFirstSubscriptionInfo();
-        if (subscriptionInfo == null) {
-            return mContext.getString(R.string.device_info_default);
-        }
-        final String phoneNumber = DeviceInfoUtils.getBidiFormattedPhoneNumber(mContext,
-                subscriptionInfo);
-        return TextUtils.isEmpty(phoneNumber) ? mContext.getString(R.string.device_info_default)
-                : phoneNumber;
-    }
-
-    private CharSequence getDeviceModel() {
-        return HardwareInfoPreferenceController.getDeviceModel();
-    }
-
-    @VisibleForTesting
-    SubscriptionInfo getFirstSubscriptionInfo() {
-        final List<SubscriptionInfo> subscriptionInfoList =
-                mSubscriptionManager.getActiveSubscriptionInfoList();
-        if (subscriptionInfoList == null || subscriptionInfoList.isEmpty()) {
-            return null;
-        }
-        return subscriptionInfoList.get(0);
-    }
-
-    @Override
-    public void onNotifyChange(Intent intent) {
-
-    }
-}
diff --git a/src/com/android/settings/homepage/contextualcards/deviceinfo/EmergencyInfoSlice.java b/src/com/android/settings/homepage/contextualcards/deviceinfo/EmergencyInfoSlice.java
deleted file mode 100644
index 10e87ff..0000000
--- a/src/com/android/settings/homepage/contextualcards/deviceinfo/EmergencyInfoSlice.java
+++ /dev/null
@@ -1,85 +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.contextualcards.deviceinfo;
-
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-
-import androidx.core.graphics.drawable.IconCompat;
-import androidx.slice.Slice;
-import androidx.slice.builders.ListBuilder;
-import androidx.slice.builders.SliceAction;
-
-import com.android.settings.R;
-import com.android.settings.accounts.EmergencyInfoPreferenceController;
-import com.android.settings.slices.CustomSliceRegistry;
-import com.android.settings.slices.CustomSliceable;
-
-// This is a slice helper class for EmergencyInfo
-public class EmergencyInfoSlice implements CustomSliceable {
-
-    private final Context mContext;
-
-    public EmergencyInfoSlice(Context context) {
-        mContext = context;
-    }
-
-    @Override
-    public Slice getSlice() {
-        final ListBuilder listBuilder = new ListBuilder(mContext,
-                CustomSliceRegistry.EMERGENCY_INFO_SLICE_URI,
-                ListBuilder.INFINITY);
-        listBuilder.addRow(
-                new ListBuilder.RowBuilder()
-                        .setTitle(mContext.getText(R.string.emergency_info_title))
-                        .setSubtitle(
-                                mContext.getText(R.string.emergency_info_contextual_card_summary))
-                        .setPrimaryAction(createPrimaryAction()));
-        return listBuilder.build();
-    }
-
-    @Override
-    public Uri getUri() {
-        return CustomSliceRegistry.EMERGENCY_INFO_SLICE_URI;
-    }
-
-    @Override
-    public Intent getIntent() {
-        return new Intent(EmergencyInfoPreferenceController.getIntentAction(mContext));
-    }
-
-    @Override
-    public void onNotifyChange(Intent intent) {
-    }
-
-    private SliceAction createPrimaryAction() {
-        final PendingIntent pendingIntent =
-                PendingIntent.getActivity(
-                        mContext,
-                        0 /* requestCode */,
-                        getIntent(),
-                        PendingIntent.FLAG_UPDATE_CURRENT);
-
-        return SliceAction.createDeeplink(
-                pendingIntent,
-                IconCompat.createWithResource(mContext, R.drawable.empty_icon),
-                ListBuilder.ICON_IMAGE,
-                mContext.getText(R.string.emergency_info_title));
-    }
-}
diff --git a/src/com/android/settings/network/ProxySubscriptionManager.java b/src/com/android/settings/network/ProxySubscriptionManager.java
index b10c727..0306b55 100644
--- a/src/com/android/settings/network/ProxySubscriptionManager.java
+++ b/src/com/android/settings/network/ProxySubscriptionManager.java
@@ -77,7 +77,7 @@
         mActiveSubscriptionsListeners =
                 new ArrayList<OnActiveSubscriptionChangedListener>();
 
-        mSubsciptionsMonitor = new ActiveSubsciptionsListener(looper, context) {
+        mSubscriptionMonitor = new ActiveSubsciptionsListener(looper, context) {
             public void onChanged() {
                 notifyAllListeners();
             }
@@ -85,16 +85,16 @@
         mAirplaneModeMonitor = new GlobalSettingsChangeListener(looper,
                 context, Settings.Global.AIRPLANE_MODE_ON) {
             public void onChanged(String field) {
-                mSubsciptionsMonitor.clearCache();
+                mSubscriptionMonitor.clearCache();
                 notifyAllListeners();
             }
         };
 
-        mSubsciptionsMonitor.start();
+        mSubscriptionMonitor.start();
     }
 
     private Lifecycle mLifecycle;
-    private ActiveSubsciptionsListener mSubsciptionsMonitor;
+    private ActiveSubsciptionsListener mSubscriptionMonitor;
     private GlobalSettingsChangeListener mAirplaneModeMonitor;
 
     private List<OnActiveSubscriptionChangedListener> mActiveSubscriptionsListeners;
@@ -130,17 +130,17 @@
 
     @OnLifecycleEvent(ON_START)
     void onStart() {
-        mSubsciptionsMonitor.start();
+        mSubscriptionMonitor.start();
     }
 
     @OnLifecycleEvent(ON_STOP)
     void onStop() {
-        mSubsciptionsMonitor.stop();
+        mSubscriptionMonitor.stop();
     }
 
     @OnLifecycleEvent(ON_DESTROY)
     void onDestroy() {
-        mSubsciptionsMonitor.close();
+        mSubscriptionMonitor.close();
         mAirplaneModeMonitor.close();
 
         if (mLifecycle != null) {
@@ -157,7 +157,7 @@
      * @return a SubscriptionManager
      */
     public SubscriptionManager get() {
-        return mSubsciptionsMonitor.getSubscriptionManager();
+        return mSubscriptionMonitor.getSubscriptionManager();
     }
 
     /**
@@ -166,7 +166,7 @@
      * @return max. number of active subscription info(s)
      */
     public int getActiveSubscriptionInfoCountMax() {
-        return mSubsciptionsMonitor.getActiveSubscriptionInfoCountMax();
+        return mSubscriptionMonitor.getActiveSubscriptionInfoCountMax();
     }
 
     /**
@@ -175,7 +175,7 @@
      * @return A list of active subscription info
      */
     public List<SubscriptionInfo> getActiveSubscriptionsInfo() {
-        return mSubsciptionsMonitor.getActiveSubscriptionsInfo();
+        return mSubscriptionMonitor.getActiveSubscriptionsInfo();
     }
 
     /**
@@ -185,7 +185,7 @@
      * @return A subscription info which is active list
      */
     public SubscriptionInfo getActiveSubscriptionInfo(int subId) {
-        return mSubsciptionsMonitor.getActiveSubscriptionInfo(subId);
+        return mSubscriptionMonitor.getActiveSubscriptionInfo(subId);
     }
 
     /**
@@ -194,7 +194,7 @@
      * @return A list of accessible subscription info
      */
     public List<SubscriptionInfo> getAccessibleSubscriptionsInfo() {
-        return mSubsciptionsMonitor.getAccessibleSubscriptionsInfo();
+        return mSubscriptionMonitor.getAccessibleSubscriptionsInfo();
     }
 
     /**
@@ -204,14 +204,14 @@
      * @return A subscription info which is accessible list
      */
     public SubscriptionInfo getAccessibleSubscriptionInfo(int subId) {
-        return mSubsciptionsMonitor.getAccessibleSubscriptionInfo(subId);
+        return mSubscriptionMonitor.getAccessibleSubscriptionInfo(subId);
     }
 
     /**
      * Clear data cached within proxy
      */
     public void clearCache() {
-        mSubsciptionsMonitor.clearCache();
+        mSubscriptionMonitor.clearCache();
     }
 
     /**
diff --git a/src/com/android/settings/slices/CustomSliceRegistry.java b/src/com/android/settings/slices/CustomSliceRegistry.java
index 66cc600..700fe2e 100644
--- a/src/com/android/settings/slices/CustomSliceRegistry.java
+++ b/src/com/android/settings/slices/CustomSliceRegistry.java
@@ -29,9 +29,6 @@
 import com.android.settings.display.AdaptiveSleepPreferenceController;
 import com.android.settings.flashlight.FlashlightSlice;
 import com.android.settings.fuelgauge.batterytip.BatteryTipPreferenceController;
-import com.android.settings.homepage.contextualcards.deviceinfo.DataUsageSlice;
-import com.android.settings.homepage.contextualcards.deviceinfo.DeviceInfoSlice;
-import com.android.settings.homepage.contextualcards.deviceinfo.EmergencyInfoSlice;
 import com.android.settings.homepage.contextualcards.deviceinfo.StorageSlice;
 import com.android.settings.homepage.contextualcards.slices.BatteryFixSlice;
 import com.android.settings.homepage.contextualcards.slices.BluetoothDevicesSlice;
@@ -117,34 +114,6 @@
             .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION)
             .appendPath("contextual_wifi")
             .build();
-
-    /**
-     * Backing Uri for the Data usage Slice.
-     */
-    public static final Uri DATA_USAGE_SLICE_URI = new Uri.Builder()
-            .scheme(ContentResolver.SCHEME_CONTENT)
-            .authority(SettingsSliceProvider.SLICE_AUTHORITY)
-            .appendPath(SettingsSlicesContract.PATH_SETTING_ACTION)
-            .appendPath("data_usage_card")
-            .build();
-    /**
-     * Backing Uri for the Device info Slice.
-     */
-    public static final Uri DEVICE_INFO_SLICE_URI = new Uri.Builder()
-            .scheme(ContentResolver.SCHEME_CONTENT)
-            .authority(SettingsSliceProvider.SLICE_AUTHORITY)
-            .appendPath(SettingsSlicesContract.PATH_SETTING_INTENT)
-            .appendPath("device_info_card")
-            .build();
-    /**
-     * Backing Uri for the Emergency Info Slice.
-     */
-    public static final Uri EMERGENCY_INFO_SLICE_URI = new Uri.Builder()
-            .scheme(ContentResolver.SCHEME_CONTENT)
-            .authority(SettingsSliceProvider.SLICE_AUTHORITY)
-            .appendPath(SettingsSlicesContract.PATH_SETTING_INTENT)
-            .appendPath("emergency_info_card")
-            .build();
     /**
      * Slice Uri for Enhanced 4G slice
      */
@@ -355,9 +324,6 @@
         sUriToSlice.put(CONTEXTUAL_NOTIFICATION_CHANNEL_SLICE_URI,
                 ContextualNotificationChannelSlice.class);
         sUriToSlice.put(CONTEXTUAL_WIFI_SLICE_URI, ContextualWifiSlice.class);
-        sUriToSlice.put(DATA_USAGE_SLICE_URI, DataUsageSlice.class);
-        sUriToSlice.put(DEVICE_INFO_SLICE_URI, DeviceInfoSlice.class);
-        sUriToSlice.put(EMERGENCY_INFO_SLICE_URI, EmergencyInfoSlice.class);
         sUriToSlice.put(FACE_ENROLL_SLICE_URI, FaceSetupSlice.class);
         sUriToSlice.put(FLASHLIGHT_SLICE_URI, FlashlightSlice.class);
         sUriToSlice.put(LOCATION_SLICE_URI, LocationSlice.class);
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 05fcf5e..e228a14 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -347,9 +347,13 @@
                 showProxyFields();
                 final CheckBox advancedTogglebox =
                         (CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox);
-                advancedTogglebox.setOnCheckedChangeListener(this);
-                advancedTogglebox.setChecked(showAdvancedFields);
-                setAdvancedOptionAccessibilityString(showAdvancedFields);
+                if (!showAdvancedFields) {
+                    // Need to show Advanced Option button.
+                    mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE);
+                    advancedTogglebox.setOnCheckedChangeListener(this);
+                    advancedTogglebox.setChecked(showAdvancedFields);
+                    setAdvancedOptionAccessibilityString();
+                }
                 mView.findViewById(R.id.wifi_advanced_fields)
                         .setVisibility(showAdvancedFields ? View.VISIBLE : View.GONE);
             }
@@ -1553,17 +1557,10 @@
                 ((EditText) mPasswordView).setSelection(pos);
             }
         } else if (view.getId() == R.id.wifi_advanced_togglebox) {
-            final int toggleVisibility;
-            final int stringID;
-            if (isChecked) {
-                toggleVisibility = View.VISIBLE;
-                // Hide the SoftKeyboard temporary to let user can see most of the expanded items.
-                hideSoftKeyboard(mView.getWindowToken());
-            } else {
-                toggleVisibility = View.GONE;
-            }
-            mView.findViewById(R.id.wifi_advanced_fields).setVisibility(toggleVisibility);
-            setAdvancedOptionAccessibilityString(isChecked);
+            // Hide the SoftKeyboard temporary to let user can see most of the expanded items.
+            hideSoftKeyboard(mView.getWindowToken());
+            view.setVisibility(View.GONE);
+            mView.findViewById(R.id.wifi_advanced_fields).setVisibility(View.VISIBLE);
         }
     }
 
@@ -1673,7 +1670,7 @@
         ((CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox))
                 .setOnCheckedChangeListener(this);
         // Set correct accessibility strings.
-        setAdvancedOptionAccessibilityString(false /* showAdvancedFields */);
+        setAdvancedOptionAccessibilityString();
     }
 
     /**
@@ -1765,7 +1762,7 @@
         inputMethodManager.hideSoftInputFromWindow(windowToken, 0 /* flags */);
     }
 
-    private void setAdvancedOptionAccessibilityString(boolean showAdvancedFields) {
+    private void setAdvancedOptionAccessibilityString() {
         final CheckBox advancedToggleBox = mView.findViewById(R.id.wifi_advanced_togglebox);
         advancedToggleBox.setAccessibilityDelegate(new AccessibilityDelegate() {
             @Override
@@ -1776,12 +1773,10 @@
                 info.setCheckable(false /* checkable */);
                 // To let TalkBack don't pronounce CheckBox.
                 info.setClassName(null /* className */);
-                final CharSequence accessibilityDoubleTapExtend = mContext.getString(
-                        showAdvancedFields ? R.string.wifi_advanced_toggle_description_expanded
-                                : R.string.wifi_advanced_toggle_description_collapsed);
                 // Customize TalkBack's pronunciation which been appended to "Double-tap to".
                 final AccessibilityAction customClick = new AccessibilityAction(
-                        AccessibilityNodeInfo.ACTION_CLICK, accessibilityDoubleTapExtend);
+                        AccessibilityNodeInfo.ACTION_CLICK,
+                        mContext.getString(R.string.wifi_advanced_toggle_description_collapsed));
                 info.addAction(customClick);
             }
         });
diff --git a/src/com/android/settings/wifi/WifiConfigController2.java b/src/com/android/settings/wifi/WifiConfigController2.java
index 0e9c4d0..c6b4702 100644
--- a/src/com/android/settings/wifi/WifiConfigController2.java
+++ b/src/com/android/settings/wifi/WifiConfigController2.java
@@ -348,9 +348,13 @@
                 showProxyFields();
                 final CheckBox advancedTogglebox =
                         (CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox);
-                advancedTogglebox.setOnCheckedChangeListener(this);
-                advancedTogglebox.setChecked(showAdvancedFields);
-                setAdvancedOptionAccessibilityString(showAdvancedFields);
+                if (!showAdvancedFields) {
+                    // Need to show Advanced Option button.
+                    mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE);
+                    advancedTogglebox.setOnCheckedChangeListener(this);
+                    advancedTogglebox.setChecked(showAdvancedFields);
+                    setAdvancedOptionAccessibilityString();
+                }
                 mView.findViewById(R.id.wifi_advanced_fields)
                         .setVisibility(showAdvancedFields ? View.VISIBLE : View.GONE);
             }
@@ -362,7 +366,7 @@
             } else {
                 final String signalLevel = getSignalString();
 
-                if (mWifiEntry.getConnectedState() != WifiEntry.CONNECTED_STATE_CONNECTED
+                if (mWifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_DISCONNECTED
                             && signalLevel != null) {
                     mConfigUi.setSubmitButton(res.getString(R.string.wifi_connect));
                 } else {
@@ -384,16 +388,10 @@
                     }
 
                     final ConnectedInfo info = mWifiEntry.getConnectedInfo();
-                    // TODO(b/143326832): Replace it with ConnectedInfo#linkSpeedMbps.
-                   //if (info != null && info.getTxLinkSpeedMbps() != WifiInfo.LINK_SPEED_UNKNOWN) {
-                    //    addRow(group, R.string.tx_wifi_speed, String.format(
-                   //            res.getString(R.string.tx_link_speed), info.getTxLinkSpeedMbps()));
-                    //}
-
-                   //if (info != null && info.getRxLinkSpeedMbps() != WifiInfo.LINK_SPEED_UNKNOWN) {
-                    //    addRow(group, R.string.rx_wifi_speed, String.format(
-                   //            res.getString(R.string.rx_link_speed), info.getRxLinkSpeedMbps()));
-                    //}
+                    if (info != null && info.linkSpeedMbps >= 0) {
+                        addRow(group, R.string.wifi_speed, String.format(
+                                res.getString(R.string.link_speed), info.linkSpeedMbps));
+                    }
 
                     if (info != null && info.frequencyMhz != WifiEntry.FREQUENCY_UNKNOWN) {
                         final int frequency = info.frequencyMhz;
@@ -1554,17 +1552,10 @@
                 ((EditText) mPasswordView).setSelection(pos);
             }
         } else if (view.getId() == R.id.wifi_advanced_togglebox) {
-            final int toggleVisibility;
-            final int stringID;
-            if (isChecked) {
-                toggleVisibility = View.VISIBLE;
-                // Hide the SoftKeyboard temporary to let user can see most of the expanded items.
-                hideSoftKeyboard(mView.getWindowToken());
-            } else {
-                toggleVisibility = View.GONE;
-            }
-            mView.findViewById(R.id.wifi_advanced_fields).setVisibility(toggleVisibility);
-            setAdvancedOptionAccessibilityString(isChecked);
+            // Hide the SoftKeyboard temporary to let user can see most of the expanded items.
+            hideSoftKeyboard(mView.getWindowToken());
+            view.setVisibility(View.GONE);
+            mView.findViewById(R.id.wifi_advanced_fields).setVisibility(View.VISIBLE);
         }
     }
 
@@ -1674,7 +1665,7 @@
         ((CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox))
                 .setOnCheckedChangeListener(this);
         // Set correct accessibility strings.
-        setAdvancedOptionAccessibilityString(false /* showAdvancedFields */);
+        setAdvancedOptionAccessibilityString();
     }
 
     /**
@@ -1766,7 +1757,7 @@
         inputMethodManager.hideSoftInputFromWindow(windowToken, 0 /* flags */);
     }
 
-    private void setAdvancedOptionAccessibilityString(boolean showAdvancedFields) {
+    private void setAdvancedOptionAccessibilityString() {
         final CheckBox advancedToggleBox = mView.findViewById(R.id.wifi_advanced_togglebox);
         advancedToggleBox.setAccessibilityDelegate(new AccessibilityDelegate() {
             @Override
@@ -1777,12 +1768,10 @@
                 info.setCheckable(false /* checkable */);
                 // To let TalkBack don't pronounce CheckBox.
                 info.setClassName(null /* className */);
-                final CharSequence accessibilityDoubleTapExtend = mContext.getString(
-                        showAdvancedFields ? R.string.wifi_advanced_toggle_description_expanded
-                                : R.string.wifi_advanced_toggle_description_collapsed);
                 // Customize TalkBack's pronunciation which been appended to "Double-tap to".
                 final AccessibilityAction customClick = new AccessibilityAction(
-                        AccessibilityNodeInfo.ACTION_CLICK, accessibilityDoubleTapExtend);
+                        AccessibilityNodeInfo.ACTION_CLICK,
+                        mContext.getString(R.string.wifi_advanced_toggle_description_collapsed));
                 info.addAction(customClick);
             }
         });
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index eb02833..4310476 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -493,7 +493,7 @@
             // could only be disconnected and be put in blacklists so it won't be used again.
             if (mSelectedAccessPoint.isSaved() || mSelectedAccessPoint.isEphemeral()) {
                 final int stringId = mSelectedAccessPoint.isEphemeral() ?
-                    R.string.wifi_disconnect_button_text : R.string.forget;
+                        R.string.wifi_disconnect_button_text : R.string.forget;
                 menu.add(Menu.NONE, MENU_ID_FORGET, 0 /* order */, stringId);
             }
 
@@ -1210,28 +1210,6 @@
         ((AccessPointPreference) accessPoint.getTag()).onLevelChanged();
     }
 
-    public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
-            new BaseSearchIndexProvider() {
-                @Override
-                public List<SearchIndexableRaw> getRawDataToIndex(Context context,
-                        boolean enabled) {
-                    final List<SearchIndexableRaw> result = new ArrayList<>();
-                    final Resources res = context.getResources();
-
-                    // Add fragment title if we are showing this fragment
-                    if (res.getBoolean(R.bool.config_show_wifi_settings)) {
-                        SearchIndexableRaw data = new SearchIndexableRaw(context);
-                        data.title = res.getString(R.string.wifi_settings);
-                        data.screenTitle = res.getString(R.string.wifi_settings);
-                        data.keywords = res.getString(R.string.keywords_wifi);
-                        data.key = DATA_KEY_REFERENCE;
-                        result.add(data);
-                    }
-
-                    return result;
-                }
-            };
-
     private void handleConfigNetworkSubmitEvent(Intent data) {
         final WifiConfiguration wifiConfiguration = data.getParcelableExtra(
                 ConfigureAccessPointFragment.NETWORK_CONFIG_KEY);
@@ -1257,4 +1235,42 @@
                 .setResultListener(this, CONFIG_NETWORK_REQUEST)
                 .launch();
     }
+
+    public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+            new BaseSearchIndexProvider(R.xml.wifi_settings) {
+                @Override
+                public List<SearchIndexableRaw> getRawDataToIndex(Context context,
+                        boolean enabled) {
+                    final List<SearchIndexableRaw> result = new ArrayList<>();
+                    final Resources res = context.getResources();
+
+                    // Add fragment title if we are showing this fragment
+                    if (res.getBoolean(R.bool.config_show_wifi_settings)) {
+                        SearchIndexableRaw data = new SearchIndexableRaw(context);
+                        data.title = res.getString(R.string.wifi_settings);
+                        data.screenTitle = res.getString(R.string.wifi_settings);
+                        data.keywords = res.getString(R.string.keywords_wifi);
+                        data.key = DATA_KEY_REFERENCE;
+                        result.add(data);
+                    }
+                    return result;
+                }
+
+                @Override
+                public List<String> getNonIndexableKeys(Context context) {
+                    final List<String> keys = super.getNonIndexableKeys(context);
+
+                    final WifiManager wifiManager = context.getSystemService(WifiManager.class);
+                    final List<AccessPoint> accessPoints = WifiSavedConfigUtils.getAllConfigs(
+                            context, wifiManager);
+                    if (accessPoints == null || accessPoints.size() <= 0) {
+                        keys.add(PREF_KEY_SAVED_NETWORKS);
+                    }
+
+                    if (!DataUsageUtils.hasWifiRadio(context)) {
+                        keys.add(PREF_KEY_DATA_USAGE);
+                    }
+                    return keys;
+                }
+            };
 }
diff --git a/src/com/android/settings/wifi/WifiSettings2.java b/src/com/android/settings/wifi/WifiSettings2.java
index ac5e31c..bd79b3f 100644
--- a/src/com/android/settings/wifi/WifiSettings2.java
+++ b/src/com/android/settings/wifi/WifiSettings2.java
@@ -142,6 +142,19 @@
     private String mDialogWifiEntryKey;
     private WifiEntry mDialogWifiEntry;
 
+    // This boolean extra specifies whether to enable the Next button when connected. Used by
+    // account creation outside of setup wizard.
+    private static final String EXTRA_ENABLE_NEXT_ON_CONNECT = "wifi_enable_next_on_connect";
+
+    // Enable the Next button when a Wi-Fi network is connected.
+    private boolean mEnableNextOnConnection;
+
+    // This string extra specifies a network to open the connect dialog on, so the user can enter
+    // network credentials.  This is used by quick settings for secured networks, among other
+    // things.
+    private static final String EXTRA_START_CONNECT_SSID = "wifi_start_connect_ssid";
+    private String mOpenSsid;
+
     private static boolean isVerboseLoggingEnabled() {
         return WifiPickerTracker.isVerboseLoggingEnabled();
     }
@@ -329,6 +342,15 @@
                 }
             }
         }
+
+        // If we're supposed to enable/disable the Next button based on our current connection
+        // state, start it off in the right state.
+        final Intent intent = getActivity().getIntent();
+        mEnableNextOnConnection = intent.getBooleanExtra(EXTRA_ENABLE_NEXT_ON_CONNECT, false);
+
+        if (intent.hasExtra(EXTRA_START_CONNECT_SSID)) {
+            mOpenSsid = intent.getStringExtra(EXTRA_START_CONNECT_SSID);
+        }
     }
 
     @Override
@@ -384,6 +406,23 @@
         if (mWifiEnabler != null) {
             mWifiEnabler.resume(activity);
         }
+
+        changeNextButtonState(mWifiPickerTracker.getConnectedWifiEntry() != null);
+
+        // Edit the Wi-Fi network of specified SSID.
+        if (mOpenSsid != null) {
+            Optional<WifiEntry> matchedWifiEntry = mWifiPickerTracker.getWifiEntries().stream()
+                    .filter(wifiEntry -> TextUtils.equals(mOpenSsid, wifiEntry.getSsid()))
+                    .filter(wifiEntry -> wifiEntry.getSecurity() != WifiEntry.SECURITY_NONE
+                            && wifiEntry.getSecurity() != WifiEntry.SECURITY_OWE)
+                    .filter(wifiEntry -> !wifiEntry.isSaved()
+                            || isDisabledByWrongPassword(wifiEntry))
+                    .findFirst();
+            if (matchedWifiEntry.isPresent()) {
+                mOpenSsid = null;
+                launchConfigNewNetworkFragment(matchedWifiEntry.get());
+            }
+        }
     }
 
     @Override
@@ -626,6 +665,7 @@
     @Override
     public void onWifiEntriesChanged() {
         updateWifiEntryPreferencesDelayed();
+        changeNextButtonState(mWifiPickerTracker.getConnectedWifiEntry() != null);
     }
 
     @Override
@@ -882,6 +922,19 @@
         return R.string.help_url_wifi;
     }
 
+    /**
+     * Renames/replaces "Next" button when appropriate. "Next" button usually exists in
+     * Wi-Fi setup screens, not in usual wifi settings screen.
+     *
+     * @param enabled true when the device is connected to a wifi network.
+     */
+    @VisibleForTesting
+    void changeNextButtonState(boolean enabled) {
+        if (mEnableNextOnConnection && hasNextButton()) {
+            getNextButton().setEnabled(enabled);
+        }
+    }
+
     @Override
     public void onForget(WifiDialog2 dialog) {
         forget(mDialogWifiEntry);
@@ -1014,16 +1067,7 @@
                 if (mEditIfNoConfig) {
                     // Edit an unsaved secure Wi-Fi network.
                     if (mFullScreenEdit) {
-                        final Bundle bundle = new Bundle();
-                        bundle.putString(WifiNetworkDetailsFragment2.KEY_CHOSEN_WIFIENTRY_KEY,
-                                mConnectWifiEntry.getKey());
-                        new SubSettingLauncher(getContext())
-                                .setTitleText(mConnectWifiEntry.getTitle())
-                                .setDestination(ConfigureWifiEntryFragment.class.getName())
-                                .setArguments(bundle)
-                                .setSourceMetricsCategory(getMetricsCategory())
-                                .setResultListener(WifiSettings2.this, CONFIG_NETWORK_REQUEST)
-                                .launch();
+                        launchConfigNewNetworkFragment(mConnectWifiEntry);
                     } else {
                         showDialog(mConnectWifiEntry, WifiConfigUiBase2.MODE_MODIFY);
                     }
@@ -1053,4 +1097,32 @@
     private boolean isFisishingOrDestroyed(Activity activity) {
         return activity == null || activity.isFinishing() || activity.isDestroyed();
     }
+
+    private void launchConfigNewNetworkFragment(WifiEntry wifiEntry) {
+        final Bundle bundle = new Bundle();
+        bundle.putString(WifiNetworkDetailsFragment2.KEY_CHOSEN_WIFIENTRY_KEY,
+                wifiEntry.getKey());
+        new SubSettingLauncher(getContext())
+                .setTitleText(wifiEntry.getTitle())
+                .setDestination(ConfigureWifiEntryFragment.class.getName())
+                .setArguments(bundle)
+                .setSourceMetricsCategory(getMetricsCategory())
+                .setResultListener(WifiSettings2.this, CONFIG_NETWORK_REQUEST)
+                .launch();
+    }
+
+    /** Helper method to return whether an WifiEntry is disabled due to a wrong password */
+    private static boolean isDisabledByWrongPassword(WifiEntry wifiEntry) {
+        WifiConfiguration config = wifiEntry.getWifiConfiguration();
+        if (config == null) {
+            return false;
+        }
+        WifiConfiguration.NetworkSelectionStatus networkStatus =
+                config.getNetworkSelectionStatus();
+        if (networkStatus == null || networkStatus.isNetworkEnabled()) {
+            return false;
+        }
+        int reason = networkStatus.getNetworkSelectionDisableReason();
+        return WifiConfiguration.NetworkSelectionStatus.DISABLED_BY_WRONG_PASSWORD == reason;
+    }
 }
diff --git a/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java b/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java
index f99b1d6..5f74d56 100644
--- a/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java
+++ b/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java
@@ -589,16 +589,24 @@
     private void refreshButtons() {
         boolean canForgetNetwork = mWifiEntry.canForget();
         boolean canSignIntoNetwork = canSignIntoNetwork();
-        boolean canConnectNetwork = mWifiEntry.canConnect();
+        boolean showConnectButton = mWifiEntry.canConnect()
+                || mWifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTING;
         boolean canShareNetwork = canShareNetwork();
 
         mButtonsPref.setButton1Visible(canForgetNetwork);
         mButtonsPref.setButton2Visible(canSignIntoNetwork);
-        mButtonsPref.setButton3Visible(canConnectNetwork);
+        mButtonsPref.setButton3Visible(showConnectButton);
+        if (showConnectButton) {
+            if (mWifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTING) {
+                mButtonsPref.setButton3Text(R.string.wifi_connecting).setButton3Enabled(false);
+            } else {
+                mButtonsPref.setButton3Text(R.string.wifi_connect).setButton3Enabled(true);
+            }
+        }
         mButtonsPref.setButton4Visible(canShareNetwork);
         mButtonsPref.setVisible(canForgetNetwork
                 || canSignIntoNetwork
-                || canConnectNetwork
+                || showConnectButton
                 || canShareNetwork);
     }
 
@@ -806,8 +814,6 @@
 
     @VisibleForTesting
     void connectNetwork() {
-        // TODO(b/143326832): What to do with WifiManager#isWifiEnabled() false case?
-        mButtonsPref.setButton3Text(R.string.wifi_connecting).setButton3Enabled(false);
         mWifiEntry.connect();
     }
 
@@ -847,8 +853,6 @@
             Toast.makeText(mContext,
                     mContext.getString(R.string.wifi_connected_to_message, mWifiEntry.getTitle()),
                     Toast.LENGTH_SHORT).show();
-            updateNetworkInfo();
-            refreshPage();
         } else if (mWifiEntry.getLevel() == WifiEntry.WIFI_LEVEL_UNREACHABLE) {
             Toast.makeText(mContext,
                     R.string.wifi_not_in_range_message,
diff --git a/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceController.java b/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceController.java
index 0741695..b9b0d64 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceController.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceController.java
@@ -105,8 +105,8 @@
         // 2: no 5 GHZ support means we can't have BAND_5GHZ - default to 2GHZ
         // 3: With Dual mode support we can't have BAND_5GHZ only - include 2GHZ
         if (!isDualMode
-                && ((band & (SoftApConfiguration.BAND_5GHZ
-                | SoftApConfiguration.BAND_2GHZ)) != 0)) {
+                && ((band & SoftApConfiguration.BAND_5GHZ) != 0)
+                && ((band & SoftApConfiguration.BAND_2GHZ) != 0)) {
             return SoftApConfiguration.BAND_5GHZ;
         } else if (!is5GhzBandSupported() && SoftApConfiguration.BAND_5GHZ == band) {
             return SoftApConfiguration.BAND_2GHZ;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
index 03e9b6f..80ab42c 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
@@ -210,11 +210,8 @@
     }
 
     @Test
-    public void onStop_isAvailable_unregisterCallback() {
-        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SETTINGS_UI,
-                SettingsUIDeviceConfig.BT_ADVANCED_HEADER_ENABLED, "true", true);
-        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
-                .thenReturn("true".getBytes());
+    public void onStop_isRegisterCallback_unregisterCallback() {
+        mController.mIsRegisterCallback = true;
 
         mController.onStop();
 
@@ -234,9 +231,8 @@
     }
 
     @Test
-    public void onStop_notAvailable_unregisterCallback() {
-        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
-                .thenReturn("false".getBytes());
+    public void onStop_notRegisterCallback_unregisterCallback() {
+        mController.mIsRegisterCallback = false;
 
         mController.onStop();
 
@@ -245,11 +241,7 @@
     }
 
     @Test
-    public void onDestroy_isAvailable_recycleBitmap() {
-        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SETTINGS_UI,
-                SettingsUIDeviceConfig.BT_ADVANCED_HEADER_ENABLED, "true", true);
-        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
-                .thenReturn("true".getBytes());
+    public void onDestroy_recycleBitmap() {
         mController.mIconCache.put(ICON_URI, mBitmap);
 
         mController.onDestroy();
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/EligibleCardCheckerTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/EligibleCardCheckerTest.java
index 7b70dad..3777920 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/EligibleCardCheckerTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/EligibleCardCheckerTest.java
@@ -31,7 +31,6 @@
 import androidx.slice.SliceProvider;
 import androidx.slice.widget.SliceLiveData;
 
-import com.android.settings.homepage.contextualcards.deviceinfo.EmergencyInfoSlice;
 import com.android.settings.slices.CustomSliceRegistry;
 import com.android.settings.wifi.slice.ContextualWifiSlice;
 
@@ -66,14 +65,6 @@
     }
 
     @Test
-    public void isSliceToggleable_cardWithoutToggle_returnFalse() {
-        final EmergencyInfoSlice emergencyInfoSlice = new EmergencyInfoSlice(mContext);
-        final Slice slice = emergencyInfoSlice.getSlice();
-
-        assertThat(mEligibleCardChecker.isSliceToggleable(slice)).isFalse();
-    }
-
-    @Test
     public void isCardEligibleToDisplay_toggleSlice_hasInlineActionShouldBeTrue() {
         final ContextualWifiSlice wifiSlice = new ContextualWifiSlice(mContext);
         final Slice slice = wifiSlice.getSlice();
@@ -85,17 +76,6 @@
     }
 
     @Test
-    public void isCardEligibleToDisplay_notToggleSlice_hasInlineActionShouldBeFalse() {
-        final EmergencyInfoSlice emergencyInfoSlice = new EmergencyInfoSlice(mContext);
-        final Slice slice = emergencyInfoSlice.getSlice();
-        doReturn(slice).when(mEligibleCardChecker).bindSlice(any(Uri.class));
-
-        mEligibleCardChecker.isCardEligibleToDisplay(getContextualCard(TEST_SLICE_URI));
-
-        assertThat(mEligibleCardChecker.mCard.hasInlineAction()).isFalse();
-    }
-
-    @Test
     public void isCardEligibleToDisplay_customCard_returnTrue() {
         final ContextualCard customCard = new ContextualCard.Builder()
                 .setName("custom_card")
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/deviceinfo/DataUsageSliceTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/deviceinfo/DataUsageSliceTest.java
deleted file mode 100644
index 13f26e4..0000000
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/deviceinfo/DataUsageSliceTest.java
+++ /dev/null
@@ -1,112 +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.contextualcards.deviceinfo;
-
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import android.app.usage.NetworkStatsManager;
-import android.content.Context;
-import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
-import androidx.core.graphics.drawable.IconCompat;
-import androidx.slice.Slice;
-import androidx.slice.SliceItem;
-import androidx.slice.SliceMetadata;
-import androidx.slice.SliceProvider;
-import androidx.slice.core.SliceAction;
-import androidx.slice.widget.SliceLiveData;
-import com.android.settings.R;
-import com.android.settings.testutils.SliceTester;
-import com.android.settings.testutils.shadow.ShadowDataUsageUtils;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.Shadows;
-import org.robolectric.annotation.Config;
-import org.robolectric.shadows.ShadowTelephonyManager;
-
-@RunWith(RobolectricTestRunner.class)
-@Config(shadows = ShadowDataUsageUtils.class)
-public class DataUsageSliceTest {
-    private static final String DATA_USAGE_TITLE = "Data usage";
-    private static final String DATA_USAGE_SUMMARY = "test_summary";
-
-    @Mock
-    private NetworkStatsManager mNetworkStatsManager;
-
-    private Context mContext;
-    private DataUsageSlice mDataUsageSlice;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-
-        mContext = spy(RuntimeEnvironment.application);
-        // Set-up specs for SliceMetadata.
-        SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
-        when(mContext.getSystemService(NetworkStatsManager.class)).thenReturn(mNetworkStatsManager);
-
-        mDataUsageSlice = spy(new DataUsageSlice(mContext));
-
-        final TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
-        final ShadowTelephonyManager shadowTelephonyManager = Shadows.shadowOf(telephonyManager);
-        shadowTelephonyManager.setTelephonyManagerForSubscriptionId(
-                SubscriptionManager.INVALID_SUBSCRIPTION_ID, telephonyManager);
-    }
-
-    @Test
-    public void getSlice_hasSim_shouldBeCorrectSliceContent() {
-        ShadowDataUsageUtils.HAS_SIM = true;
-        doReturn(DATA_USAGE_TITLE).when(mDataUsageSlice).getDataUsageText(any());
-        doReturn(DATA_USAGE_SUMMARY).when(mDataUsageSlice).getCycleTime(any());
-
-        final Slice slice = mDataUsageSlice.getSlice();
-
-        final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
-        assertThat(metadata.getTitle()).isEqualTo(
-                mContext.getString(R.string.data_usage_summary_title));
-
-        final SliceAction primaryAction = metadata.getPrimaryAction();
-        final IconCompat expectedIcon = IconCompat.createWithResource(mContext,
-                R.drawable.ic_settings_data_usage);
-        assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedIcon.toString());
-    }
-
-    @Test
-    public void getSlice_hasNoSim_shouldShowNoSimCard() {
-        ShadowDataUsageUtils.HAS_SIM = false;
-
-        final Slice slice = mDataUsageSlice.getSlice();
-
-        final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
-        assertThat(metadata.getTitle()).isEqualTo(
-                mContext.getString(R.string.data_usage_summary_title));
-
-        final List<SliceItem> sliceItems = slice.getItems();
-        SliceTester.assertAnySliceItemContainsTitle(sliceItems,
-                mContext.getString(R.string.no_sim_card));
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/deviceinfo/DeviceInfoSliceTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/deviceinfo/DeviceInfoSliceTest.java
deleted file mode 100644
index ddc7218..0000000
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/deviceinfo/DeviceInfoSliceTest.java
+++ /dev/null
@@ -1,99 +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.contextualcards.deviceinfo;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-
-import android.content.Context;
-import android.telephony.SubscriptionInfo;
-
-import androidx.core.graphics.drawable.IconCompat;
-import androidx.slice.Slice;
-import androidx.slice.SliceItem;
-import androidx.slice.SliceMetadata;
-import androidx.slice.SliceProvider;
-import androidx.slice.core.SliceAction;
-import androidx.slice.widget.SliceLiveData;
-
-import com.android.settings.R;
-import com.android.settings.testutils.SliceTester;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-import java.util.List;
-
-@RunWith(RobolectricTestRunner.class)
-public class DeviceInfoSliceTest {
-
-    @Mock
-    private SubscriptionInfo mSubscriptionInfo;
-
-    private Context mContext;
-    private DeviceInfoSlice mDeviceInfoSlice;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        mContext = RuntimeEnvironment.application;
-
-        // Set-up specs for SliceMetadata.
-        SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
-
-        mDeviceInfoSlice = spy(new DeviceInfoSlice(mContext));
-    }
-
-    @Test
-    public void getSlice_hasSubscriptionInfo_shouldBeCorrectSliceContent() {
-        final String phoneNumber = "1111111111";
-        doReturn(mSubscriptionInfo).when(mDeviceInfoSlice).getFirstSubscriptionInfo();
-        doReturn(phoneNumber).when(mDeviceInfoSlice).getPhoneNumber();
-
-        final Slice slice = mDeviceInfoSlice.getSlice();
-
-        final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
-        assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.device_info_label));
-
-        final SliceAction primaryAction = metadata.getPrimaryAction();
-        final IconCompat expectedIcon = IconCompat.createWithResource(mContext,
-                R.drawable.ic_info_outline_24dp);
-        assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedIcon.toString());
-
-        final List<SliceItem> sliceItems = slice.getItems();
-        SliceTester.assertAnySliceItemContainsTitle(sliceItems, phoneNumber);
-    }
-
-    @Test
-    public void getSlice_hasNoSubscriptionInfo_shouldShowUnknown() {
-        final Slice slice = mDeviceInfoSlice.getSlice();
-
-        final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
-        assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.device_info_label));
-
-        final List<SliceItem> sliceItems = slice.getItems();
-        SliceTester.assertAnySliceItemContainsTitle(sliceItems,
-                mContext.getString(R.string.device_info_default));
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/panel/PanelSlicesAdapterTest.java b/tests/robotests/src/com/android/settings/panel/PanelSlicesAdapterTest.java
index 9f4fffc..37036c4 100644
--- a/tests/robotests/src/com/android/settings/panel/PanelSlicesAdapterTest.java
+++ b/tests/robotests/src/com/android/settings/panel/PanelSlicesAdapterTest.java
@@ -36,7 +36,6 @@
 import androidx.slice.Slice;
 
 import com.android.settings.R;
-import com.android.settings.slices.CustomSliceRegistry;
 import com.android.settings.testutils.FakeFeatureFactory;
 
 import org.junit.Before;
@@ -54,8 +53,6 @@
 @RunWith(RobolectricTestRunner.class)
 public class PanelSlicesAdapterTest {
 
-    private static final Uri DATA_URI = CustomSliceRegistry.DATA_USAGE_SLICE_URI;
-
     private Context mContext;
     private PanelFragment mPanelFragment;
     private PanelFeatureProvider mPanelFeatureProvider;
@@ -97,18 +94,6 @@
     }
 
     @Test
-    public void onCreateViewHolder_returnsSliceRowViewHolder() {
-        addTestLiveData(DATA_URI);
-        final PanelSlicesAdapter adapter =
-                new PanelSlicesAdapter(mPanelFragment, mData, 0 /* metrics category */);
-        final ViewGroup view = new FrameLayout(mContext);
-        final PanelSlicesAdapter.SliceRowViewHolder viewHolder =
-                adapter.onCreateViewHolder(view, 0);
-
-        assertThat(viewHolder.sliceView).isNotNull();
-    }
-
-    @Test
     public void sizeOfAdapter_shouldNotExceedMaxNum() {
         for (int i = 0; i < MAX_NUM_OF_SLICES + 2; i++) {
             addTestLiveData(Uri.parse("uri" + i));
@@ -127,22 +112,6 @@
     }
 
     @Test
-    public void nonMediaOutputIndicatorSlice_shouldAllowDividerAboveAndBelow() {
-        addTestLiveData(DATA_URI);
-        final PanelSlicesAdapter adapter =
-                new PanelSlicesAdapter(mPanelFragment, mData, 0 /* metrics category */);
-        final int position = 0;
-        final ViewGroup view = new FrameLayout(mContext);
-        final PanelSlicesAdapter.SliceRowViewHolder viewHolder =
-                adapter.onCreateViewHolder(view, 0 /* view type*/);
-
-        adapter.onBindViewHolder(viewHolder, position);
-
-        assertThat(viewHolder.isDividerAllowedAbove()).isTrue();
-        assertThat(viewHolder.isDividerAllowedBelow()).isTrue();
-    }
-
-    @Test
     public void mediaOutputIndicatorSlice_shouldNotAllowDividerAbove() {
         addTestLiveData(MEDIA_OUTPUT_INDICATOR_SLICE_URI);
 
@@ -157,4 +126,4 @@
 
         assertThat(viewHolder.isDividerAllowedAbove()).isFalse();
     }
-}
\ No newline at end of file
+}
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java b/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
index e1202ae..bf50742 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
@@ -549,4 +549,13 @@
         assertThat(advButton.getContentDescription()).isEqualTo(
                 mContext.getString(R.string.wifi_advanced_toggle_description));
     }
+
+    @Test
+    public void getVisibility_whenAdvancedOptionClicked_shouldBeGone() {
+        final CheckBox advButton = mView.findViewById(R.id.wifi_advanced_togglebox);
+
+        advButton.performClick();
+
+        assertThat(advButton.getVisibility()).isEqualTo(View.GONE);
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiSettings2Test.java b/tests/robotests/src/com/android/settings/wifi/WifiSettings2Test.java
index aeec19a..eb4f326 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiSettings2Test.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiSettings2Test.java
@@ -18,6 +18,7 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.doNothing;
@@ -278,4 +279,11 @@
         verify(menu).add(anyInt(), eq(WifiSettings2.MENU_ID_FORGET), anyInt(), anyInt());
         verify(menu).add(anyInt(), eq(WifiSettings2.MENU_ID_DISCONNECT), anyInt(), anyInt());
     }
+
+    @Test
+    public void onWifiEntriesChanged_shouldChangeNextButtonState() {
+        mWifiSettings2.onWifiEntriesChanged();
+
+        verify(mWifiSettings2).changeNextButtonState(anyBoolean());
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceControllerTest.java
index 820a78b..36279cb 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceControllerTest.java
@@ -35,7 +35,6 @@
 import com.android.settings.R;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -49,6 +48,13 @@
     private static final String ALL_BANDS = "5.0 GHz Band preferred";
     private static final String TWO_GHZ_STRING = "2.4 GHz Band";
     private static final String FIVE_GHZ_STRING = "5.0 GHz Band";
+    private static final String VAL_2GHZ_STR  = "1";
+    private static final String VAL_5GHZ_STR = "2";
+    private static final String VAL_2_5_GHZ_STR = "3";
+    private static final int VAL_2GHZ_INT = 1;
+    private static final int VAL_5GHZ_INT = 2;
+    private static final int VAL_2_5_GHZ_INT = 3;
+
     private Context mContext;
     @Mock
     private ConnectivityManager mConnectivityManager;
@@ -81,14 +87,16 @@
     }
 
     @Test
-    @Ignore
     public void display_5GhzSupported_shouldDisplayFullList() {
         when(mWifiManager.getCountryCode()).thenReturn("US");
         when(mWifiManager.is5GHzBandSupported()).thenReturn(true);
         when(mWifiManager.isDualModeSupported()).thenReturn(true);
 
+        // Create a new instance to pick the proper value of isDualModeSupported()
+        mController = new WifiTetherApBandPreferenceController(mContext, mListener);
+
         mController.displayPreference(mScreen);
-        mController.onPreferenceChange(mPreference, "-1");
+        mController.onPreferenceChange(mPreference, VAL_2_5_GHZ_STR);
 
         assertThat(mPreference.getSummary()).isEqualTo(ALL_BANDS);
     }
@@ -118,77 +126,77 @@
     }
 
     @Test
-    @Ignore
     public void changePreference_noDualModeWith5G_shouldUpdateValue() {
         when(mWifiManager.getCountryCode()).thenReturn("US");
         when(mWifiManager.is5GHzBandSupported()).thenReturn(true);
 
         mController.displayPreference(mScreen);
 
-        // -1 is SoftApConfiguration.BAND_ANY, for 'Auto' option. This should be prevented from
-        // being set since it is invalid for this configuration
-        mController.onPreferenceChange(mPreference, "-1");
-        assertThat(mController.getBandIndex()).isEqualTo(1);
+        // 'Auto' option should be prevented from being set since
+        // it is invalid for this configuration
+        mController.onPreferenceChange(mPreference, VAL_2_5_GHZ_STR);
+        assertThat(mController.getBandIndex()).isEqualTo(VAL_5GHZ_INT);
         assertThat(mPreference.getSummary()).isEqualTo(FIVE_GHZ_STRING);
         verify(mListener, times(1)).onTetherConfigUpdated(mController);
 
         // set to 5 Ghz
-        mController.onPreferenceChange(mPreference, "1");
-        assertThat(mController.getBandIndex()).isEqualTo(1);
+        mController.onPreferenceChange(mPreference, VAL_5GHZ_STR);
+        assertThat(mController.getBandIndex()).isEqualTo(VAL_5GHZ_INT);
         assertThat(mPreference.getSummary()).isEqualTo(FIVE_GHZ_STRING);
         verify(mListener, times(2)).onTetherConfigUpdated(mController);
 
         // set to 2 Ghz
-        mController.onPreferenceChange(mPreference, "0");
-        assertThat(mController.getBandIndex()).isEqualTo(0);
+        mController.onPreferenceChange(mPreference, VAL_2GHZ_STR);
+        assertThat(mController.getBandIndex()).isEqualTo(VAL_2GHZ_INT);
         assertThat(mPreference.getSummary()).isEqualTo(TWO_GHZ_STRING);
         verify(mListener, times(3)).onTetherConfigUpdated(mController);
     }
 
     @Test
-    @Ignore
     public void changePreference_dualModeWith5G_shouldUpdateValue() {
         when(mWifiManager.getCountryCode()).thenReturn("US");
         when(mWifiManager.is5GHzBandSupported()).thenReturn(true);
         when(mWifiManager.isDualModeSupported()).thenReturn(true);
 
+        // Create a new instance to pick the proper value of isDualModeSupported()
+        mController = new WifiTetherApBandPreferenceController(mContext, mListener);
+
         mController.displayPreference(mScreen);
 
-        // -1 is SoftApConfiguration.BAND_ANY, for 'Auto' option.
-        mController.onPreferenceChange(mPreference, "-1");
-        assertThat(mController.getBandIndex()).isEqualTo(-1);
+        // 'Auto' option
+        mController.onPreferenceChange(mPreference, VAL_2_5_GHZ_STR);
+        assertThat(mController.getBandIndex()).isEqualTo(VAL_2_5_GHZ_INT);
         assertThat(mPreference.getSummary()).isEqualTo(ALL_BANDS);
         verify(mListener, times(1)).onTetherConfigUpdated(mController);
 
         // should revert to the default for 5 Ghz only since this is not supported with this config
-        mController.onPreferenceChange(mPreference, "1");
-        assertThat(mController.getBandIndex()).isEqualTo(-1);
+        mController.onPreferenceChange(mPreference, VAL_5GHZ_STR);
+        assertThat(mController.getBandIndex()).isEqualTo(VAL_2_5_GHZ_INT);
         assertThat(mPreference.getSummary()).isEqualTo(ALL_BANDS);
         verify(mListener, times(2)).onTetherConfigUpdated(mController);
 
         // set to 2 Ghz
-        mController.onPreferenceChange(mPreference, "0");
-        assertThat(mController.getBandIndex()).isEqualTo(0);
+        mController.onPreferenceChange(mPreference, VAL_2GHZ_STR);
+        assertThat(mController.getBandIndex()).isEqualTo(VAL_2GHZ_INT);
         assertThat(mPreference.getSummary()).isEqualTo(TWO_GHZ_STRING);
         verify(mListener, times(3)).onTetherConfigUpdated(mController);
     }
 
     @Test
-    @Ignore
     public void updateDisplay_shouldUpdateValue() {
         when(mWifiManager.getCountryCode()).thenReturn("US");
         when(mWifiManager.is5GHzBandSupported()).thenReturn(true);
 
-        // Set controller band index to 1 and verify is set.
+        // Set controller band index to 5GHz and verify is set.
         mController.displayPreference(mScreen);
-        mController.onPreferenceChange(mPreference, "1");
-        assertThat(mController.getBandIndex()).isEqualTo(1);
+        mController.onPreferenceChange(mPreference, VAL_5GHZ_STR);
+        assertThat(mController.getBandIndex()).isEqualTo(VAL_5GHZ_INT);
 
         // Disable 5Ghz band
         when(mWifiManager.is5GHzBandSupported()).thenReturn(false);
 
         // Call updateDisplay and verify it's changed.
         mController.updateDisplay();
-        assertThat(mController.getBandIndex()).isEqualTo(0);
+        assertThat(mController.getBandIndex()).isEqualTo(VAL_2GHZ_INT);
     }
 }
