Merge "Add policy transparency dialog to 'Remove work profile'" into rvc-dev
diff --git a/res/layout/notification_history_log_row.xml b/res/layout/notification_history_log_row.xml
index 136af38..c77b005 100644
--- a/res/layout/notification_history_log_row.xml
+++ b/res/layout/notification_history_log_row.xml
@@ -28,19 +28,21 @@
         android:layout_height="wrap_content"
         android:orientation="vertical"
         android:layout_marginBottom="6dp">
-        <RelativeLayout
+        <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="@*android:dimen/status_bar_icon_size"
             android:gravity="center_vertical">
 
             <TextView
                 android:id="@+id/title"
-                android:layout_width="match_parent"
+                android:layout_weight="1"
+                android:layout_width="0dp"
                 android:layout_height="wrap_content"
                 android:layout_centerVertical="true"
                 android:ellipsize="end"
                 android:singleLine="true"
                 android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title"
+                android:layout_toStartOf="@id/alerted_icon"
                 android:textAlignment="viewStart"/>
 
             <ImageView
@@ -51,8 +53,9 @@
                 android:layout_marginStart="6dp"
                 android:paddingTop="1dp"
                 android:scaleType="fitCenter"
-                android:visibility="gone"
+                android:visibility="invisible"
                 android:layout_toEndOf="@id/title"
+                android:layout_toStartOf="@id/timestamp"
                 android:tint="?android:attr/textColorSecondary"
                 android:src="@drawable/ic_notifications_alert"/>
 
@@ -67,7 +70,7 @@
                 android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification"
                 android:textAlignment="viewEnd"
                 />
-        </RelativeLayout>
+        </LinearLayout>
 
         <TextView
             android:id="@+id/text"
diff --git a/res/layout/wifi_dialog.xml b/res/layout/wifi_dialog.xml
index 18ad3b5..45ecd61 100644
--- a/res/layout/wifi_dialog.xml
+++ b/res/layout/wifi_dialog.xml
@@ -559,27 +559,6 @@
 
             </LinearLayout>
 
-            <LinearLayout android:id="@+id/privacy_settings_fields"
-                          android:layout_width="match_parent"
-                          android:layout_height="wrap_content"
-                          style="@style/wifi_item"
-                          android:visibility="gone">
-
-                <TextView android:id="@+id/privacy_settings_title"
-                          android:layout_width="wrap_content"
-                          android:layout_height="wrap_content"
-                          style="@style/wifi_item_label"
-                          android:text="@string/wifi_privacy_settings" />
-
-                <Spinner android:id="@+id/privacy_settings"
-                         android:layout_width="match_parent"
-                         android:layout_height="wrap_content"
-                         style="@style/wifi_item_spinner"
-                         android:prompt="@string/wifi_privacy_settings"
-                         android:entries="@array/wifi_privacy_entries"/>
-
-            </LinearLayout>
-
             <LinearLayout android:id="@+id/staticip"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
@@ -680,6 +659,26 @@
                 </LinearLayout>
             </LinearLayout>
 
+            <LinearLayout android:id="@+id/privacy_settings_fields"
+                          android:layout_width="match_parent"
+                          android:layout_height="wrap_content"
+                          style="@style/wifi_item"
+                          android:visibility="gone">
+
+                <TextView android:id="@+id/privacy_settings_title"
+                          android:layout_width="wrap_content"
+                          android:layout_height="wrap_content"
+                          style="@style/wifi_item_label"
+                          android:text="@string/wifi_privacy_settings" />
+
+                <Spinner android:id="@+id/privacy_settings"
+                         android:layout_width="match_parent"
+                         android:layout_height="wrap_content"
+                         style="@style/wifi_item_spinner"
+                         android:prompt="@string/wifi_privacy_settings"
+                         android:entries="@array/wifi_privacy_entries"/>
+            </LinearLayout>
+
             <LinearLayout
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0c9fa05..da4583b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -11002,6 +11002,7 @@
     <string-array name="graphics_driver_all_apps_preference_values">
         <item>@string/graphics_driver_app_preference_default</item>
         <item>@string/graphics_driver_app_preference_game_driver</item>
+        <item>@string/graphics_driver_app_preference_prerelease_driver</item>
     </string-array>
     <!-- All the values of graphics driver for app preference [CHAR LIMIT=50] -->
     <string-array name="graphics_driver_app_preference_values">
@@ -11431,22 +11432,6 @@
     <!-- Mobile network details page. Label for an option that lets the user delete an eSIM from
          the device. [CHAR LIMIT=60] -->
     <string name="mobile_network_erase_sim">Erase SIM</string>
-    <!-- Title of a confirmation dialog for deleting an eSIM from the device.
-         [CHAR LIMIT=60] -->
-    <string name="mobile_network_erase_sim_dialog_title">Erase this downloaded SIM?</string>
-    <!-- Body text of of a confirmation dialog for deleting an eSIM from the device.
-         [CHAR LIMIT=NONE] -->
-    <string name="mobile_network_erase_sim_dialog_body">
-        Erasing this SIM removes <xliff:g id="carrier" example="Verizon">%1$s</xliff:g> service
-        from this device.\n\nService for <xliff:g id="carrier" example="Verizon">%2$s</xliff:g>
-        won\u2019t be canceled.
-    </string>
-    <!-- OK button on a confirmation dialog for deleting an eSIM from the device.
-         [CHAR LIMIT=30] -->
-    <string name="mobile_network_erase_sim_dialog_ok">Erase</string>
-    <!-- Body text of the progress dialog we show while deleting an eSIM from the device.
-         [CHAR LIMIT=NONE] -->
-    <string name="mobile_network_erase_sim_dialog_progress">Erasing SIM\u2026</string>
 
     <!-- Title of a dialog indicating that an error ocurred when deleting an eSIM from the device
          [CHAR LIMIT=60] -->
@@ -11636,6 +11621,8 @@
     <string name="media_output_panel_title">Switch output</string>
     <!-- Summary for represent which device is playing media [CHAR LIMIT=NONE] -->
     <string name="media_output_panel_summary_of_playing_device">Currently playing on <xliff:g id="device_name" example="Bose headphone">%1$s</xliff:g></string>
+    <!-- Summary for disconnected status [CHAR LIMIT=50] -->
+    <string name="media_output_disconnected_status"><xliff:g id="device_name" example="My device">%1$s</xliff:g> (disconnected)</string>
 
     <!-- Label for the title on wfc disclaimer fragment. [CHAR LIMIT=40] -->
     <string name="wfc_disclaimer_title_text">Important information</string>
diff --git a/res/xml/graphics_driver_settings.xml b/res/xml/graphics_driver_settings.xml
index c72c8fb..a1fa78c 100644
--- a/res/xml/graphics_driver_settings.xml
+++ b/res/xml/graphics_driver_settings.xml
@@ -24,8 +24,6 @@
         android:key="graphics_driver_all_apps_preference"
         android:title="@string/graphics_driver_all_apps_preference_title"
         android:dialogTitle="@string/graphics_driver_all_apps_preference_title"
-        android:entries="@array/graphics_driver_all_apps_preference_values"
-        android:entryValues="@array/graphics_driver_all_apps_preference_values"
         settings:controller="com.android.settings.development.graphicsdriver.GraphicsDriverEnableForAllAppsPreferenceController">
     </ListPreference>
 
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 4e8e8fe..5c94f59 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -915,7 +915,7 @@
      *    phone that has no encryption.
      */
     private final void setAirplaneModeIfNecessary() {
-        if (!getTelephonyManager().isGlobalModeEnabled()) {
+        if (!getTelephonyManager().isLteCdmaEvdoGsmWcdmaEnabled()) {
             Log.d(TAG, "Going into airplane mode.");
             Settings.Global.putInt(getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1);
             final Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
diff --git a/src/com/android/settings/applications/AppStateManageExternalStorageBridge.java b/src/com/android/settings/applications/AppStateManageExternalStorageBridge.java
index 5a69035..7933062 100644
--- a/src/com/android/settings/applications/AppStateManageExternalStorageBridge.java
+++ b/src/com/android/settings/applications/AppStateManageExternalStorageBridge.java
@@ -22,20 +22,25 @@
 
 import com.android.settingslib.applications.ApplicationsState;
 
+import java.util.List;
+
 /**
  * Retrieves information from {@link AppOpsManager} and {@link android.content.pm.PackageManager}
  * regarding {@link AppOpsManager#OP_MANAGE_EXTERNAL_STORAGE} and
  * {@link Manifest.permission#MANAGE_EXTERNAL_STORAGE}.
  */
 public class AppStateManageExternalStorageBridge extends AppStateAppOpsBridge {
-    private static final int APP_OPS_OP_CODE = AppOpsManager.OP_MANAGE_EXTERNAL_STORAGE;
+    private static final String APP_OP_STR = AppOpsManager.OPSTR_MANAGE_EXTERNAL_STORAGE;
     private static final String[] PERMISSIONS = {
             Manifest.permission.MANAGE_EXTERNAL_STORAGE
     };
 
+    private final AppOpsManager mAppOpsManager;
+
     public AppStateManageExternalStorageBridge(Context context, ApplicationsState appState,
             Callback callback) {
-        super(context, appState, callback, APP_OPS_OP_CODE, PERMISSIONS);
+        super(context, appState, callback, AppOpsManager.strOpToOp(APP_OP_STR), PERMISSIONS);
+        mAppOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
     }
 
     @Override
@@ -43,6 +48,25 @@
         app.extraInfo = getManageExternalStoragePermState(pkg, uid);
     }
 
+    @Override
+    protected void loadAllExtraInfo() {
+        super.loadAllExtraInfo();
+        List<ApplicationsState.AppEntry> apps = mAppSession.getAllApps();
+        for (ApplicationsState.AppEntry app : apps) {
+            if (app.extraInfo instanceof PermissionState) {
+                ((PermissionState) app.extraInfo).appOpMode =  mAppOpsManager.unsafeCheckOpNoThrow(
+                        APP_OP_STR, app.info.uid, app.info.packageName);
+            }
+        }
+    }
+
+    @Override
+    public PermissionState getPermissionInfo(String pkg, int uid) {
+        PermissionState ps = super.getPermissionInfo(pkg, uid);
+        ps.appOpMode = mAppOpsManager.unsafeCheckOpNoThrow(APP_OP_STR, uid, pkg);
+        return ps;
+    }
+
     /**
      * Returns the MANAGE_EXTERNAL_STORAGE {@link AppStateAppOpsBridge.PermissionState} object
      * associated with the given package and user.
diff --git a/src/com/android/settings/applications/appinfo/ManageExternalStorageDetails.java b/src/com/android/settings/applications/appinfo/ManageExternalStorageDetails.java
index 63ce440..6c840d5 100644
--- a/src/com/android/settings/applications/appinfo/ManageExternalStorageDetails.java
+++ b/src/com/android/settings/applications/appinfo/ManageExternalStorageDetails.java
@@ -23,7 +23,6 @@
 import android.view.View;
 import android.view.ViewGroup;
 
-import androidx.annotation.VisibleForTesting;
 import androidx.appcompat.app.AlertDialog;
 import androidx.preference.Preference;
 import androidx.preference.Preference.OnPreferenceChangeListener;
@@ -110,8 +109,8 @@
      */
     private void setManageExternalStorageState(boolean newState) {
         logSpecialPermissionChange(newState, mPackageName);
-        mAppOpsManager.setMode(AppOpsManager.OP_MANAGE_EXTERNAL_STORAGE,
-                mPackageInfo.applicationInfo.uid, mPackageName, newState
+        mAppOpsManager.setUidMode(AppOpsManager.OP_MANAGE_EXTERNAL_STORAGE,
+                mPackageInfo.applicationInfo.uid, newState
                         ? AppOpsManager.MODE_ALLOWED : AppOpsManager.MODE_ERRORED);
     }
 
diff --git a/src/com/android/settings/development/graphicsdriver/GraphicsDriverAppPreferenceController.java b/src/com/android/settings/development/graphicsdriver/GraphicsDriverAppPreferenceController.java
index 2013b45..b1a31fb 100644
--- a/src/com/android/settings/development/graphicsdriver/GraphicsDriverAppPreferenceController.java
+++ b/src/com/android/settings/development/graphicsdriver/GraphicsDriverAppPreferenceController.java
@@ -26,9 +26,7 @@
 import android.content.res.Resources;
 import android.os.Handler;
 import android.os.Looper;
-import android.os.SystemProperties;
 import android.provider.Settings;
-import android.text.TextUtils;
 
 import androidx.annotation.VisibleForTesting;
 import androidx.preference.ListPreference;
@@ -60,9 +58,6 @@
         GraphicsDriverContentObserver.OnGraphicsDriverContentChangedListener, LifecycleObserver,
         OnStart, OnStop {
 
-    private static final String PROPERTY_GFX_DRIVER_GAME = "ro.gfx.driver.0";
-    private static final String PROPERTY_GFX_DRIVER_PRERELEASE = "ro.gfx.driver.1";
-
     private final Context mContext;
     private final ContentResolver mContentResolver;
     private final String mPreferenceTitle;
@@ -98,7 +93,8 @@
         mPreferencePrereleaseDriver =
                 resources.getString(R.string.graphics_driver_app_preference_prerelease_driver);
         mPreferenceSystem = resources.getString(R.string.graphics_driver_app_preference_system);
-        mEntryList = constructEntryList();
+        mEntryList = GraphicsDriverEnableForAllAppsPreferenceController.constructEntryList(
+                mContext, true);
 
         // TODO: Move this task to background if there's potential ANR/Jank.
         // Update the UI when all the app infos are ready.
@@ -195,28 +191,6 @@
         updateState(mPreferenceGroup);
     }
 
-    /**
-     * Constructs and returns a list of graphics driver choices.
-     */
-    public CharSequence[] constructEntryList() {
-        final String prereleaseDriverPackageName =
-                SystemProperties.get(PROPERTY_GFX_DRIVER_PRERELEASE);
-        final String gameDriverPackageName = SystemProperties.get(PROPERTY_GFX_DRIVER_GAME);
-
-        List<CharSequence> entryList = new ArrayList<>();
-        entryList.add(mPreferenceDefault);
-        if (!TextUtils.isEmpty(prereleaseDriverPackageName)) {
-            entryList.add(mPreferencePrereleaseDriver);
-        }
-        if (!TextUtils.isEmpty(gameDriverPackageName)) {
-            entryList.add(mPreferenceGameDriver);
-        }
-        entryList.add(mPreferenceSystem);
-        CharSequence[] filteredEntryList = new CharSequence[entryList.size()];
-        filteredEntryList = entryList.toArray(filteredEntryList);
-        return filteredEntryList;
-    }
-
     // AppInfo class to achieve loading the application label only once
     class AppInfo {
         AppInfo(PackageManager packageManager, ApplicationInfo applicationInfo) {
diff --git a/src/com/android/settings/development/graphicsdriver/GraphicsDriverEnableForAllAppsPreferenceController.java b/src/com/android/settings/development/graphicsdriver/GraphicsDriverEnableForAllAppsPreferenceController.java
index 4baa993..29f1014 100644
--- a/src/com/android/settings/development/graphicsdriver/GraphicsDriverEnableForAllAppsPreferenceController.java
+++ b/src/com/android/settings/development/graphicsdriver/GraphicsDriverEnableForAllAppsPreferenceController.java
@@ -18,10 +18,15 @@
 
 import android.content.ContentResolver;
 import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
 import android.content.res.Resources;
+import android.os.Build;
 import android.os.Handler;
 import android.os.Looper;
+import android.os.SystemProperties;
 import android.provider.Settings;
+import android.text.TextUtils;
 
 import androidx.annotation.VisibleForTesting;
 import androidx.preference.ListPreference;
@@ -35,6 +40,11 @@
 import com.android.settingslib.core.lifecycle.events.OnStop;
 import com.android.settingslib.development.DevelopmentSettingsEnabler;
 
+import dalvik.system.VMRuntime;
+
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * Controller of global switch to enable Game Driver for all Apps.
  */
@@ -47,6 +57,8 @@
     public static final int GAME_DRIVER_ALL_APPS = 1;
     public static final int GAME_DRIVER_PRERELEASE_ALL_APPS = 2;
     public static final int GAME_DRIVER_OFF = 3;
+    public static final String PROPERTY_GFX_DRIVER_GAME = "ro.gfx.driver.0";
+    public static final String PROPERTY_GFX_DRIVER_PRERELEASE = "ro.gfx.driver.1";
 
     private final Context mContext;
     private final ContentResolver mContentResolver;
@@ -54,6 +66,8 @@
     private final String mPreferenceGameDriver;
     private final String mPreferencePrereleaseDriver;
     @VisibleForTesting
+    CharSequence[] mEntryList;
+    @VisibleForTesting
     GraphicsDriverContentObserver mGraphicsDriverContentObserver;
 
     private ListPreference mPreference;
@@ -69,6 +83,7 @@
                 resources.getString(R.string.graphics_driver_app_preference_game_driver);
         mPreferencePrereleaseDriver =
                 resources.getString(R.string.graphics_driver_app_preference_prerelease_driver);
+        mEntryList = constructEntryList(mContext, false);
         mGraphicsDriverContentObserver =
                 new GraphicsDriverContentObserver(new Handler(Looper.getMainLooper()), this);
     }
@@ -87,6 +102,8 @@
     public void displayPreference(PreferenceScreen screen) {
         super.displayPreference(screen);
         mPreference = screen.findPreference(getPreferenceKey());
+        mPreference.setEntries(mEntryList);
+        mPreference.setEntryValues(mEntryList);
         mPreference.setOnPreferenceChangeListener(this);
     }
 
@@ -147,4 +164,64 @@
     public void onGraphicsDriverContentChanged() {
         updateState(mPreference);
     }
+
+    /**
+     * Constructs and returns a list of graphics driver choices.
+     */
+    public static CharSequence[] constructEntryList(Context context, boolean withSystem) {
+        final Resources resources = context.getResources();
+        final String prereleaseDriverPackageName =
+                SystemProperties.get(PROPERTY_GFX_DRIVER_PRERELEASE);
+        final String gameDriverPackageName = SystemProperties.get(PROPERTY_GFX_DRIVER_GAME);
+
+        List<CharSequence> entryList = new ArrayList<>();
+        entryList.add(resources.getString(R.string.graphics_driver_app_preference_default));
+        final PackageManager pm = context.getPackageManager();
+        if (!TextUtils.isEmpty(prereleaseDriverPackageName)
+                && hasDriverPackage(pm, prereleaseDriverPackageName)) {
+            entryList.add(resources.getString(
+                    R.string.graphics_driver_app_preference_prerelease_driver));
+        }
+        if (!TextUtils.isEmpty(gameDriverPackageName)
+                && hasDriverPackage(pm, gameDriverPackageName)) {
+            entryList.add(resources.getString(R.string.graphics_driver_app_preference_game_driver));
+        }
+        if (withSystem) {
+            entryList.add(resources.getString(R.string.graphics_driver_app_preference_system));
+        }
+        CharSequence[] filteredEntryList = new CharSequence[entryList.size()];
+        filteredEntryList = entryList.toArray(filteredEntryList);
+        return filteredEntryList;
+    }
+
+    private static boolean hasDriverPackage(PackageManager pm, String driverPackageName) {
+        final ApplicationInfo driverAppInfo;
+        try {
+            driverAppInfo = pm.getApplicationInfo(driverPackageName,
+                    PackageManager.MATCH_SYSTEM_ONLY);
+        } catch (PackageManager.NameNotFoundException e) {
+            return false;
+        }
+        if (driverAppInfo.targetSdkVersion < Build.VERSION_CODES.O) {
+            return false;
+        }
+        final String abi = chooseAbi(driverAppInfo);
+        if (abi == null) {
+            return false;
+        }
+        return true;
+    }
+
+    private static String chooseAbi(ApplicationInfo ai) {
+        final String isa = VMRuntime.getCurrentInstructionSet();
+        if (ai.primaryCpuAbi != null
+                && isa.equals(VMRuntime.getInstructionSet(ai.primaryCpuAbi))) {
+            return ai.primaryCpuAbi;
+        }
+        if (ai.secondaryCpuAbi != null
+                && isa.equals(VMRuntime.getInstructionSet(ai.secondaryCpuAbi))) {
+            return ai.secondaryCpuAbi;
+        }
+        return null;
+    }
 }
diff --git a/src/com/android/settings/deviceinfo/imei/ImeiInfoDialogController.java b/src/com/android/settings/deviceinfo/imei/ImeiInfoDialogController.java
index 2048be0..a10b9f1 100644
--- a/src/com/android/settings/deviceinfo/imei/ImeiInfoDialogController.java
+++ b/src/com/android/settings/deviceinfo/imei/ImeiInfoDialogController.java
@@ -147,7 +147,7 @@
 
     @VisibleForTesting
     boolean isCdmaLteEnabled() {
-        return mTelephonyManager.isGlobalModeEnabled();
+        return mTelephonyManager.isLteCdmaEvdoGsmWcdmaEnabled();
     }
 
     boolean isSimPresent(int slotId) {
diff --git a/src/com/android/settings/display/darkmode/DarkModeSettingsFragment.java b/src/com/android/settings/display/darkmode/DarkModeSettingsFragment.java
index 97ee221..530a541 100644
--- a/src/com/android/settings/display/darkmode/DarkModeSettingsFragment.java
+++ b/src/com/android/settings/display/darkmode/DarkModeSettingsFragment.java
@@ -15,19 +15,19 @@
 package com.android.settings.display.darkmode;
 
 import android.app.Dialog;
-import android.app.TimePickerDialog;
-import android.app.UiModeManager;
+import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.os.Bundle;
-import android.app.settings.SettingsEnums;
+import android.os.PowerManager;
+
 import androidx.preference.Preference;
+
 import com.android.settings.R;
 import com.android.settings.dashboard.DashboardFragment;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settingslib.core.AbstractPreferenceController;
 import com.android.settingslib.search.SearchIndexable;
 
-import java.time.LocalTime;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -143,5 +143,11 @@
     }
 
     public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
-            new BaseSearchIndexProvider(R.xml.dark_mode_settings);
+            new BaseSearchIndexProvider(R.xml.dark_mode_settings) {
+                @Override
+                protected boolean isPageSearchEnabled(Context context) {
+                    return !context.getSystemService(PowerManager.class).isPowerSaveMode();
+                }
+            };
+
 }
diff --git a/src/com/android/settings/media/MediaOutputSlice.java b/src/com/android/settings/media/MediaOutputSlice.java
index 3c9999e..92fa843 100644
--- a/src/com/android/settings/media/MediaOutputSlice.java
+++ b/src/com/android/settings/media/MediaOutputSlice.java
@@ -17,6 +17,7 @@
 package com.android.settings.media;
 
 import static android.app.slice.Slice.EXTRA_RANGE_VALUE;
+import static android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
 
 import static com.android.settings.slices.CustomSliceRegistry.MEDIA_OUTPUT_SLICE_URI;
 
@@ -24,9 +25,12 @@
 import android.bluetooth.BluetoothAdapter;
 import android.content.Context;
 import android.content.Intent;
+import android.graphics.Color;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
+import android.text.SpannableString;
 import android.text.TextUtils;
+import android.text.style.ForegroundColorSpan;
 import android.util.Log;
 
 import androidx.annotation.VisibleForTesting;
@@ -162,7 +166,7 @@
     }
 
     private ListBuilder.RowBuilder getMediaDeviceRow(MediaDevice device) {
-        final String title = device.getName();
+        final String deviceName = device.getName();
         final PendingIntent broadcastAction =
                 getBroadcastIntent(mContext, device.getId(), device.hashCode());
         final IconCompat deviceIcon = getDeviceIconCompat(device);
@@ -170,9 +174,22 @@
         final ListBuilder.RowBuilder rowBuilder = new ListBuilder.RowBuilder()
                 .setTitleItem(deviceIcon, ListBuilder.ICON_IMAGE)
                 .setPrimaryAction(SliceAction.create(broadcastAction, deviceIcon,
-                        ListBuilder.ICON_IMAGE, title))
-                .setTitle(title)
-                .setSubtitle(device.isConnected() ? null : device.getSummary());
+                        ListBuilder.ICON_IMAGE, deviceName));
+        // Append status to tile only for the disconnected Bluetooth device.
+        if (device.getDeviceType() == MediaDevice.MediaDeviceType.TYPE_BLUETOOTH_DEVICE
+                && !device.isConnected()) {
+            final SpannableString spannableTitle = new SpannableString(
+                    mContext.getString(R.string.media_output_disconnected_status, deviceName));
+            spannableTitle.setSpan(new ForegroundColorSpan(Color.GRAY), deviceName.length(),
+                    spannableTitle.length(), SPAN_EXCLUSIVE_EXCLUSIVE);
+            rowBuilder.setTitle(spannableTitle);
+            rowBuilder.setPrimaryAction(SliceAction.create(broadcastAction, deviceIcon,
+                    ListBuilder.ICON_IMAGE, spannableTitle));
+        } else {
+            rowBuilder.setTitle(deviceName);
+            rowBuilder.setPrimaryAction(SliceAction.create(broadcastAction, deviceIcon,
+                    ListBuilder.ICON_IMAGE, deviceName));
+        }
 
         return rowBuilder;
     }
diff --git a/src/com/android/settings/network/telephony/DataServiceSetupPreferenceController.java b/src/com/android/settings/network/telephony/DataServiceSetupPreferenceController.java
index da2bff7..c200d5e 100644
--- a/src/com/android/settings/network/telephony/DataServiceSetupPreferenceController.java
+++ b/src/com/android/settings/network/telephony/DataServiceSetupPreferenceController.java
@@ -52,7 +52,7 @@
                 && carrierConfig != null
                 && !carrierConfig.getBoolean(
                 CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL)
-                && mTelephonyManager.isGlobalModeEnabled() && !TextUtils.isEmpty(mSetupUrl)
+                && mTelephonyManager.isLteCdmaEvdoGsmWcdmaEnabled() && !TextUtils.isEmpty(mSetupUrl)
                 ? AVAILABLE
                 : CONDITIONALLY_UNAVAILABLE;
     }
diff --git a/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java b/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java
index 5b5fc4e..d633b39 100644
--- a/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java
+++ b/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java
@@ -146,7 +146,7 @@
         mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
                 .createForSubscriptionId(mSubId);
 
-        mIsGlobalCdma = mTelephonyManager.isGlobalModeEnabled()
+        mIsGlobalCdma = mTelephonyManager.isLteCdmaEvdoGsmWcdmaEnabled()
                 && carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_CDMA_CHOICES_BOOL);
         mShow4GForLTE = carrierConfig != null
                 ? carrierConfig.getBoolean(
@@ -180,7 +180,7 @@
                     android.provider.Settings.Global.LTE_SERVICE_FORCED + mSubId,
                     0);
             final int settingsNetworkMode = getPreferredNetworkMode();
-            if (mTelephonyManager.isGlobalModeEnabled()) {
+            if (mTelephonyManager.isLteCdmaEvdoGsmWcdmaEnabled()) {
                 if (lteForced == 0) {
                     preference.setEntries(
                             R.array.enabled_networks_cdma_choices);
diff --git a/src/com/android/settings/network/telephony/NetworkScanHelper.java b/src/com/android/settings/network/telephony/NetworkScanHelper.java
index eb0d020..6d3cdbb 100644
--- a/src/com/android/settings/network/telephony/NetworkScanHelper.java
+++ b/src/com/android/settings/network/telephony/NetworkScanHelper.java
@@ -25,6 +25,7 @@
 import android.telephony.TelephonyScanManager;
 import android.util.Log;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Executor;
 
@@ -75,37 +76,6 @@
     private static final int MAX_SEARCH_TIME_SEC = 300;
     private static final int INCREMENTAL_RESULTS_PERIODICITY_SEC = 3;
 
-    private static final NetworkScanRequest NETWORK_SCAN_REQUEST =
-            new NetworkScanRequest(
-                    NetworkScanRequest.SCAN_TYPE_ONE_SHOT,
-                    new RadioAccessSpecifier[]{
-                            // GSM
-                            new RadioAccessSpecifier(
-                                    AccessNetworkType.GERAN,
-                                    null /* bands */,
-                                    null /* channels */),
-                            // LTE
-                            new RadioAccessSpecifier(
-                                    AccessNetworkType.EUTRAN,
-                                    null /* bands */,
-                                    null /* channels */),
-                            // WCDMA
-                            new RadioAccessSpecifier(
-                                    AccessNetworkType.UTRAN,
-                                    null /* bands */,
-                                    null /* channels */),
-                            // NR
-                            new RadioAccessSpecifier(
-                                    AccessNetworkType.NGRAN,
-                                    null /* bands */,
-                                    null /* channels */)
-                    },
-                    SEARCH_PERIODICITY_SEC,
-                    MAX_SEARCH_TIME_SEC,
-                    INCREMENTAL_RESULTS,
-                    INCREMENTAL_RESULTS_PERIODICITY_SEC,
-                    null /* List of PLMN ids (MCC-MNC) */);
-
     private final NetworkScanCallback mNetworkScanCallback;
     private final TelephonyManager mTelephonyManager;
     private final TelephonyScanManager.NetworkScanCallback mInternalNetworkScanCallback;
@@ -120,6 +90,47 @@
         mExecutor = executor;
     }
 
+    private NetworkScanRequest createNetworkScanForPreferredAccessNetworks() {
+        long networkTypeBitmap3gpp = mTelephonyManager.getPreferredNetworkTypeBitmask()
+                & TelephonyManager.NETWORK_STANDARDS_FAMILY_BITMASK_3GPP;
+
+        List<RadioAccessSpecifier> radioAccessSpecifiers = new ArrayList<>();
+        // If the allowed network types are unknown or if they are of the right class, scan for
+        // them; otherwise, skip them to save scan time and prevent users from being shown networks
+        // that they can't connect to.
+        if (networkTypeBitmap3gpp == 0
+                || (networkTypeBitmap3gpp & TelephonyManager.NETWORK_CLASS_BITMASK_2G) != 0) {
+            radioAccessSpecifiers.add(
+                    new RadioAccessSpecifier(AccessNetworkType.GERAN, null, null));
+        }
+        if (networkTypeBitmap3gpp == 0
+                || (networkTypeBitmap3gpp & TelephonyManager.NETWORK_CLASS_BITMASK_3G) != 0) {
+            radioAccessSpecifiers.add(
+                    new RadioAccessSpecifier(AccessNetworkType.UTRAN, null, null));
+        }
+        if (networkTypeBitmap3gpp == 0
+                || (networkTypeBitmap3gpp & TelephonyManager.NETWORK_CLASS_BITMASK_4G) != 0) {
+            radioAccessSpecifiers.add(
+                    new RadioAccessSpecifier(AccessNetworkType.EUTRAN, null, null));
+        }
+        if (networkTypeBitmap3gpp == 0
+                || (networkTypeBitmap3gpp & TelephonyManager.NETWORK_CLASS_BITMASK_5G) != 0) {
+            radioAccessSpecifiers.add(
+                    new RadioAccessSpecifier(AccessNetworkType.NGRAN, null, null));
+        }
+
+
+        return new NetworkScanRequest(
+                NetworkScanRequest.SCAN_TYPE_ONE_SHOT,
+                radioAccessSpecifiers.toArray(
+                        new RadioAccessSpecifier[radioAccessSpecifiers.size()]),
+                SEARCH_PERIODICITY_SEC,
+                MAX_SEARCH_TIME_SEC,
+                INCREMENTAL_RESULTS,
+                INCREMENTAL_RESULTS_PERIODICITY_SEC,
+                null /* List of PLMN ids (MCC-MNC) */);
+    }
+
     /**
      * Request a network scan.
      *
@@ -134,7 +145,7 @@
             return;
         }
         mNetworkScanRequester = mTelephonyManager.requestNetworkScan(
-                NETWORK_SCAN_REQUEST,
+                createNetworkScanForPreferredAccessNetworks(),
                 mExecutor,
                 mInternalNetworkScanCallback);
         if (mNetworkScanRequester == null) {
diff --git a/src/com/android/settings/network/telephony/PreferredNetworkModePreferenceController.java b/src/com/android/settings/network/telephony/PreferredNetworkModePreferenceController.java
index cdfbff8..2d38377 100644
--- a/src/com/android/settings/network/telephony/PreferredNetworkModePreferenceController.java
+++ b/src/com/android/settings/network/telephony/PreferredNetworkModePreferenceController.java
@@ -99,7 +99,7 @@
         mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
                 .createForSubscriptionId(mSubId);
 
-        mIsGlobalCdma = mTelephonyManager.isGlobalModeEnabled()
+        mIsGlobalCdma = mTelephonyManager.isLteCdmaEvdoGsmWcdmaEnabled()
                 && carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_CDMA_CHOICES_BOOL);
     }
 
@@ -126,7 +126,7 @@
             case TelephonyManagerConstants.NETWORK_MODE_GSM_UMTS:
                 return R.string.preferred_network_mode_gsm_wcdma_summary;
             case TelephonyManagerConstants.NETWORK_MODE_CDMA_EVDO:
-                return mTelephonyManager.isGlobalModeEnabled()
+                return mTelephonyManager.isLteCdmaEvdoGsmWcdmaEnabled()
                         ? R.string.preferred_network_mode_cdma_summary
                         : R.string.preferred_network_mode_cdma_evdo_summary;
             case TelephonyManagerConstants.NETWORK_MODE_CDMA_NO_EVDO:
diff --git a/src/com/android/settings/notification/history/NotificationHistoryActivity.java b/src/com/android/settings/notification/history/NotificationHistoryActivity.java
index fbbda21..8c00b5d 100644
--- a/src/com/android/settings/notification/history/NotificationHistoryActivity.java
+++ b/src/com/android/settings/notification/history/NotificationHistoryActivity.java
@@ -241,7 +241,16 @@
 
         @Override
         public void onListenerConnected() {
-            StatusBarNotification[] snoozed = getSnoozedNotifications();
+            StatusBarNotification[] snoozed = null;
+            StatusBarNotification[] dismissed = null;
+            try {
+                snoozed = getSnoozedNotifications();
+                dismissed = mNm.getHistoricalNotifications(
+                    NotificationHistoryActivity.this.getPackageName(), 6, false);
+            } catch (SecurityException | RemoteException e) {
+                Log.d(TAG, "OnPaused called while trying to retrieve notifications");
+            }
+
             mSnoozedRv = mSnoozeView.findViewById(R.id.notification_list);
             LinearLayoutManager lm = new LinearLayoutManager(NotificationHistoryActivity.this);
             mSnoozedRv.setLayoutManager(lm);
@@ -259,26 +268,23 @@
                         new ArrayList<>(Arrays.asList(snoozed)));
             }
 
-            try {
-                StatusBarNotification[] dismissed = mNm.getHistoricalNotifications(
-                        NotificationHistoryActivity.this.getPackageName(), 6, false);
-                mDismissedRv = mDismissView.findViewById(R.id.notification_list);
-                LinearLayoutManager dismissLm =
-                        new LinearLayoutManager(NotificationHistoryActivity.this);
-                mDismissedRv.setLayoutManager(dismissLm);
-                mDismissedRv.setAdapter(
-                        new NotificationSbnAdapter(NotificationHistoryActivity.this, mPm));
-                DividerItemDecoration dismissDivider = new DividerItemDecoration(
-                        mDismissedRv.getContext(), dismissLm.getOrientation());
-                mDismissedRv.addItemDecoration(dismissDivider);
-                mDismissedRv.setNestedScrollingEnabled(false);
+            mDismissedRv = mDismissView.findViewById(R.id.notification_list);
+            LinearLayoutManager dismissLm =
+                new LinearLayoutManager(NotificationHistoryActivity.this);
+            mDismissedRv.setLayoutManager(dismissLm);
+            mDismissedRv.setAdapter(
+                new NotificationSbnAdapter(NotificationHistoryActivity.this, mPm));
+            DividerItemDecoration dismissDivider = new DividerItemDecoration(
+                mDismissedRv.getContext(), dismissLm.getOrientation());
+            mDismissedRv.addItemDecoration(dismissDivider);
+            mDismissedRv.setNestedScrollingEnabled(false);
 
-                ((NotificationSbnAdapter) mDismissedRv.getAdapter()).onRebuildComplete(
-                        new ArrayList<>(Arrays.asList(dismissed)));
-                mDismissView.setVisibility(View.VISIBLE);
-            } catch (Exception e) {
-                Slog.e(TAG, "Cannot load recently dismissed", e);
+            if (dismissed == null || dismissed.length == 0) {
                 mDismissView.setVisibility(View.GONE);
+            } else {
+                mDismissView.setVisibility(View.VISIBLE);
+                ((NotificationSbnAdapter) mDismissedRv.getAdapter()).onRebuildComplete(
+                    new ArrayList<>(Arrays.asList(dismissed)));
             }
         }
 
diff --git a/src/com/android/settings/panel/VolumePanel.java b/src/com/android/settings/panel/VolumePanel.java
index 61dee15..dd9b53c 100644
--- a/src/com/android/settings/panel/VolumePanel.java
+++ b/src/com/android/settings/panel/VolumePanel.java
@@ -48,7 +48,7 @@
 
     @Override
     public CharSequence getTitle() {
-        return mContext.getText(R.string.volume_connectivity_panel_title);
+        return mContext.getText(R.string.sound_settings);
     }
 
     @Override
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index d9b9e3c..5264e10 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -82,6 +82,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
+import java.util.stream.Collectors;
 
 /**
  * The class for allowing UIs like {@link WifiDialog} and {@link WifiConfigUiBase} to
@@ -133,6 +134,14 @@
     public static final int WIFI_TTLS_PHASE2_MSCHAPV2  = 2;
     public static final int WIFI_TTLS_PHASE2_GTC       = 3;
 
+    private static final String UNDESIRED_CERTIFICATE_MACRANDSECRET = "MacRandSecret";
+    private static final String UNDESIRED_CERTIFICATE_MACRANDSAPSECRET = "MacRandSapSecret";
+    @VisibleForTesting
+    static final String[] UNDESIRED_CERTIFICATES = {
+        UNDESIRED_CERTIFICATE_MACRANDSECRET,
+        UNDESIRED_CERTIFICATE_MACRANDSAPSECRET
+    };
+
     /* Phase2 methods supported by PEAP are limited */
     private ArrayAdapter<CharSequence> mPhase2PeapAdapter;
     /* Phase2 methods supported by TTLS are limited */
@@ -1425,7 +1434,8 @@
         return KeyStore.getInstance();
     }
 
-    private void loadCertificates(
+    @VisibleForTesting
+    void loadCertificates(
             Spinner spinner,
             String prefix,
             String noCertificateString,
@@ -1441,12 +1451,25 @@
         if (showUsePreinstalledCertOption) {
             certs.add(mUseSystemCertsString);
         }
+
+        String[] certificateNames = null;
         try {
-            certs.addAll(
-                Arrays.asList(getKeyStore().list(prefix, android.os.Process.WIFI_UID)));
+            certificateNames = getKeyStore().list(prefix, android.os.Process.WIFI_UID);
         } catch (Exception e) {
             Log.e(TAG, "can't get the certificate list from KeyStore");
         }
+        if (certificateNames != null && certificateNames.length != 0) {
+            certs.addAll(Arrays.stream(certificateNames)
+                    .filter(certificateName -> {
+                        for (String undesired : UNDESIRED_CERTIFICATES) {
+                            if (certificateName.startsWith(undesired)) {
+                                return false;
+                            }
+                        }
+                        return true;
+                    }).collect(Collectors.toList()));
+        }
+
         if (mAccessPointSecurity != AccessPoint.SECURITY_EAP_SUITE_B) {
             certs.add(noCertificateString);
         }
diff --git a/src/com/android/settings/wifi/WifiConfigController2.java b/src/com/android/settings/wifi/WifiConfigController2.java
index 8352a76..830f061 100644
--- a/src/com/android/settings/wifi/WifiConfigController2.java
+++ b/src/com/android/settings/wifi/WifiConfigController2.java
@@ -82,6 +82,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
+import java.util.stream.Collectors;
 
 /**
  * The class for allowing UIs like {@link WifiDialog2} and {@link WifiConfigUiBase2} to
@@ -133,6 +134,14 @@
     public static final int WIFI_TTLS_PHASE2_MSCHAPV2  = 2;
     public static final int WIFI_TTLS_PHASE2_GTC       = 3;
 
+    private static final String UNDESIRED_CERTIFICATE_MACRANDSECRET = "MacRandSecret";
+    private static final String UNDESIRED_CERTIFICATE_MACRANDSAPSECRET = "MacRandSapSecret";
+    @VisibleForTesting
+    static final String[] UNDESIRED_CERTIFICATES = {
+        UNDESIRED_CERTIFICATE_MACRANDSECRET,
+        UNDESIRED_CERTIFICATE_MACRANDSAPSECRET
+    };
+
     /* Phase2 methods supported by PEAP are limited */
     private ArrayAdapter<CharSequence> mPhase2PeapAdapter;
     /* Phase2 methods supported by TTLS are limited */
@@ -1421,7 +1430,8 @@
         return KeyStore.getInstance();
     }
 
-    private void loadCertificates(
+    @VisibleForTesting
+    void loadCertificates(
             Spinner spinner,
             String prefix,
             String noCertificateString,
@@ -1437,11 +1447,25 @@
         if (showUsePreinstalledCertOption) {
             certs.add(mUseSystemCertsString);
         }
+
+        String[] certificateNames = null;
         try {
-            certs.addAll(Arrays.asList(getKeyStore().list(prefix, android.os.Process.WIFI_UID)));
+            certificateNames = getKeyStore().list(prefix, android.os.Process.WIFI_UID);
         } catch (Exception e) {
             Log.e(TAG, "can't get the certificate list from KeyStore");
         }
+        if (certificateNames != null && certificateNames.length != 0) {
+            certs.addAll(Arrays.stream(certificateNames)
+                    .filter(certificateName -> {
+                        for (String undesired : UNDESIRED_CERTIFICATES) {
+                            if (certificateName.startsWith(undesired)) {
+                                return false;
+                            }
+                        }
+                        return true;
+                    }).collect(Collectors.toList()));
+        }
+
         if (mWifiEntrySecurity != WifiEntry.SECURITY_EAP_SUITE_B) {
             certs.add(noCertificateString);
         }
diff --git a/src/com/android/settings/wifi/WifiSettings2.java b/src/com/android/settings/wifi/WifiSettings2.java
index 1b3a731..f88a4df 100644
--- a/src/com/android/settings/wifi/WifiSettings2.java
+++ b/src/com/android/settings/wifi/WifiSettings2.java
@@ -423,8 +423,8 @@
                 final WifiConfiguration wifiConfiguration = data.getParcelableExtra(
                         ConfigureWifiEntryFragment.NETWORK_CONFIG_KEY);
                 if (wifiConfiguration != null) {
-                    mWifiManager.save(wifiConfiguration,
-                            new WifiSaveThenConnectActionListener(wifiConfiguration));
+                    mWifiManager.connect(wifiConfiguration,
+                            new WifiConnectActionListener());
                 }
             }
             return;
@@ -970,29 +970,6 @@
                 fullScreenEdit));
     }
 
-    private class WifiSaveThenConnectActionListener implements WifiManager.ActionListener {
-        final WifiConfiguration mWifiConfiguration;
-
-        WifiSaveThenConnectActionListener(WifiConfiguration wifiConfiguration) {
-            mWifiConfiguration = wifiConfiguration;
-        }
-
-        @Override
-        public void onSuccess() {
-            mWifiManager.connect(mWifiConfiguration, new WifiConnectActionListener());
-        }
-
-        @Override
-        public void onFailure(int reason) {
-            final Activity activity = getActivity();
-            if (isFisishingOrDestroyed(activity)) {
-                return;
-            }
-
-            Toast.makeText(activity, R.string.wifi_failed_save_message, Toast.LENGTH_SHORT).show();
-        }
-    };
-
     private class WifiConnectActionListener implements WifiManager.ActionListener {
         @Override
         public void onSuccess() {
diff --git a/tests/robotests/src/com/android/settings/development/graphicsdriver/GraphicsDriverEnableForAllAppsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/graphicsdriver/GraphicsDriverEnableForAllAppsPreferenceControllerTest.java
index 366a18d..920e9d1 100644
--- a/tests/robotests/src/com/android/settings/development/graphicsdriver/GraphicsDriverEnableForAllAppsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/graphicsdriver/GraphicsDriverEnableForAllAppsPreferenceControllerTest.java
@@ -82,6 +82,8 @@
                 mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
 
         mController = new GraphicsDriverEnableForAllAppsPreferenceController(mContext, "testKey");
+        mController.mEntryList = mContext.getResources().getStringArray(
+                R.array.graphics_driver_all_apps_preference_values);
         when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
         mController.displayPreference(mScreen);
     }
diff --git a/tests/robotests/src/com/android/settings/media/MediaOutputIndicatorSliceTest.java b/tests/robotests/src/com/android/settings/media/MediaOutputIndicatorSliceTest.java
index fa926df..7097889 100644
--- a/tests/robotests/src/com/android/settings/media/MediaOutputIndicatorSliceTest.java
+++ b/tests/robotests/src/com/android/settings/media/MediaOutputIndicatorSliceTest.java
@@ -35,6 +35,7 @@
 import android.media.session.MediaController;
 import android.media.session.MediaSession;
 import android.net.Uri;
+import android.os.Process;
 import android.text.TextUtils;
 
 import androidx.slice.Slice;
@@ -109,7 +110,7 @@
         mAudioManager.setMode(AudioManager.MODE_NORMAL);
         sMediaOutputIndicatorWorker = spy(new MediaOutputIndicatorWorker(mContext,
                 MEDIA_OUTPUT_INDICATOR_SLICE_URI));
-        mToken = new MediaSession.Token(null);
+        mToken = new MediaSession.Token(Process.myUid(), null);
         // Set-up specs for SliceMetadata.
         SliceProvider.setSpecs(SliceLiveData.SUPPORTED_SPECS);
         // Setup Bluetooth environment
diff --git a/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java b/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java
index adbd14d..f71c090 100644
--- a/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java
+++ b/tests/robotests/src/com/android/settings/media/MediaOutputSliceTest.java
@@ -44,6 +44,7 @@
 import androidx.slice.core.SliceQuery;
 import androidx.slice.widget.SliceLiveData;
 
+import com.android.settings.R;
 import com.android.settings.testutils.shadow.ShadowBluetoothAdapter;
 import com.android.settingslib.media.LocalMediaManager;
 import com.android.settingslib.media.MediaDevice;
@@ -156,6 +157,26 @@
     }
 
     @Test
+    public void getSlice_disconnectedBluetooth_verifyTitle() {
+        mDevices.clear();
+        final MediaDevice device = mock(MediaDevice.class);
+        when(device.getName()).thenReturn(TEST_DEVICE_1_NAME);
+        when(device.getIcon()).thenReturn(mTestDrawable);
+        when(device.getMaxVolume()).thenReturn(100);
+        when(device.isConnected()).thenReturn(false);
+
+        mDevices.add(device);
+        mMediaDeviceUpdateWorker.onDeviceListUpdate(mDevices);
+
+        final Slice mediaSlice = mMediaOutputSlice.getSlice();
+        final SliceMetadata metadata = SliceMetadata.from(mContext, mediaSlice);
+
+        final SliceAction primaryAction = metadata.getPrimaryAction();
+        assertThat(primaryAction.getTitle().toString()).isEqualTo(TEST_DEVICE_1_NAME + " ("
+                + mContext.getText(R.string.media_output_disconnected_status) + ")");
+    }
+
+    @Test
     public void onNotifyChange_foundMediaDevice_connect() {
         mDevices.clear();
         final MediaDevice device = mock(MediaDevice.class);
diff --git a/tests/robotests/src/com/android/settings/network/telephony/DataServiceSetupPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/DataServiceSetupPreferenceControllerTest.java
index ddfae64..3eb3caf 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/DataServiceSetupPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/DataServiceSetupPreferenceControllerTest.java
@@ -90,7 +90,7 @@
 
     @Test
     public void getAvailabilityStatus_allConfigOn_returnAvailable() {
-        doReturn(true).when(mTelephonyManager).isGlobalModeEnabled();
+        doReturn(true).when(mTelephonyManager).isLteCdmaEvdoGsmWcdmaEnabled();
         mCarrierConfig.putBoolean(CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL,
                 false);
 
@@ -101,7 +101,7 @@
     public void getAvailabilityStatus_missUrl_returnUnavailable() {
         Settings.Global.putString(mContext.getContentResolver(),
                 Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL, "");
-        doReturn(true).when(mTelephonyManager).isGlobalModeEnabled();
+        doReturn(true).when(mTelephonyManager).isLteCdmaEvdoGsmWcdmaEnabled();
         mCarrierConfig.putBoolean(CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL,
                 false);
 
@@ -113,7 +113,7 @@
 
     @Test
     public void getAvailabilityStatus_notCdma_returnUnavailable() {
-        doReturn(false).when(mTelephonyManager).isGlobalModeEnabled();
+        doReturn(false).when(mTelephonyManager).isLteCdmaEvdoGsmWcdmaEnabled();
         mCarrierConfig.putBoolean(CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL,
                 false);
 
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiConfigController2Test.java b/tests/robotests/src/com/android/settings/wifi/WifiConfigController2Test.java
index e0dc97f..c9bc346 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiConfigController2Test.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiConfigController2Test.java
@@ -241,6 +241,20 @@
     }
 
     @Test
+    public void loadCertificates_undesiredCertificates_shouldNotLoadUndesiredCertificates() {
+        final Spinner spinner = new Spinner(mContext);
+        when(mKeyStore.list(anyString())).thenReturn(WifiConfigController.UNDESIRED_CERTIFICATES);
+
+        mController.loadCertificates(spinner,
+                "prefix",
+                "doNotProvideEapUserCertString",
+                false /* showMultipleCerts */,
+                false /* showUsePreinstalledCertOption */);
+
+        assertThat(spinner.getAdapter().getCount()).isEqualTo(1);   // doNotProvideEapUserCertString
+    }
+
+    @Test
     public void ssidGetFocus_addNewNetwork_shouldReturnTrue() {
         mController = new TestWifiConfigController2(mConfigUiBase, mView, null /* wifiEntry */,
                 WifiConfigUiBase2.MODE_CONNECT);
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java b/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
index 3a17b6c..9146998 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java
@@ -241,6 +241,20 @@
     }
 
     @Test
+    public void loadCertificates_undesiredCertificates_shouldNotLoadUndesiredCertificates() {
+        final Spinner spinner = new Spinner(mContext);
+        when(mKeyStore.list(anyString())).thenReturn(WifiConfigController.UNDESIRED_CERTIFICATES);
+
+        mController.loadCertificates(spinner,
+                "prefix",
+                "doNotProvideEapUserCertString",
+                false /* showMultipleCerts */,
+                false /* showUsePreinstalledCertOption */);
+
+        assertThat(spinner.getAdapter().getCount()).isEqualTo(1);   // doNotProvideEapUserCertString
+    }
+
+    @Test
     public void ssidGetFocus_addNewNetwork_shouldReturnTrue() {
         mController = new TestWifiConfigController(mConfigUiBase, mView, null /* accessPoint */,
                 WifiConfigUiBase.MODE_CONNECT);