Merge "Import translations. DO NOT MERGE"
diff --git a/res/drawable/ic_chevron_right_24dp.xml b/res/drawable/ic_chevron_right_24dp.xml
index ba62187..17e2b92 100644
--- a/res/drawable/ic_chevron_right_24dp.xml
+++ b/res/drawable/ic_chevron_right_24dp.xml
@@ -23,6 +23,5 @@
     android:viewportWidth="24.0"
     android:tint="?android:attr/colorControlNormal">
     <path android:fillColor="#FF000000"
-          android:pathData="M9.29,15.63l3.88-3.88L9.29,7.87c-0.39-0.39-0.39-1.02,0-1.41l0,0c0.39-0.39,1.02-0.39,1.41,0l4.59,4.59
-c0.39,0.39,0.39,1.02,0,1.41l-4.59,4.59c-0.39,0.39-1.02,0.39-1.41,0l0,0C8.91,16.66,8.9,16.02,9.29,15.63z" />
+          android:pathData="M9.71,18.71l-1.42,-1.42l5.3,-5.29l-5.3,-5.29l1.42,-1.42l6.7,6.71z"/>
 </vector>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 255a3cf..4e41572 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -414,7 +414,7 @@
     <!-- Title for connected device group [CHAR LIMIT=none]-->
     <string name="connected_device_saved_title">Saved devices</string>
     <!-- Title for preference to add a device [CHAR LIMIT=none]-->
-    <string name="connected_device_add_device_title">Add device</string>
+    <string name="connected_device_add_device_title">Pair new device</string>
     <!-- Summary for preference to add a device [CHAR LIMIT=none]-->
     <string name="connected_device_add_device_summary">Bluetooth will turn on to pair</string>
     <!-- Title for other connection preferences [CHAR LIMIT=none]-->
@@ -4058,12 +4058,6 @@
     <string name="join_two_items"><xliff:g id="first_item">%1$s</xliff:g> and <xliff:g id="second_item">%2$s</xliff:g></string>
     <!-- [CHAR_LIMIT=NONE] Format to put together two unrelated items in a list when "and" is not an appropriate conjunction for these 2 items -->
     <string name="join_two_unrelated_items"><xliff:g id="first_item">%1$s</xliff:g>, <xliff:g id="second_item">%2$s</xliff:g></string>
-    <!-- [CHAR_LIMIT=NONE] Format to put the last item at the end of a series of 3 or more items in a list -->
-    <string name="join_many_items_last"><xliff:g id="all_but_last_item">%1$s</xliff:g>, and <xliff:g id="last_item">%2$s</xliff:g></string>
-    <!-- [CHAR_LIMIT=NONE] Format to put the first item at the start of a series of 3 or more items in a list -->
-    <string name="join_many_items_first"><xliff:g id="first_item">%1$s</xliff:g>, <xliff:g id="all_but_first_and_last_item">%2$s</xliff:g></string>
-    <!-- [CHAR_LIMIT=NONE] Format to put the middle items together in a series of 4 or more items in a list -->
-    <string name="join_many_items_middle"><xliff:g id="added_item">%1$s</xliff:g>, <xliff:g id="rest_of_items">%2$s</xliff:g></string>
     <!-- Manage applications, individual application info screen, text that appears under the "Permissions" heading after the app has tried to send to a premium SMS. [CHAR LIMIT=50] -->
     <string name="security_settings_billing_desc">This app may charge you money:</string>
     <!-- Manage applications, text for permission to send to premium SMS short codes. [CHAR LIMIT=40] -->
@@ -4997,9 +4991,13 @@
     <string name="battery_abnormal_apps_summary"><xliff:g id="number">%1$d</xliff:g> apps misbehaving</string>
 
     <!-- Title for the battery summary tip [CHAR LIMIT=NONE] -->
-    <string name="battery_tip_summary_title">Battery is in good shape</string>
+    <string name="battery_tip_summary_title">Apps are running normally</string>
     <!-- Summary for the battery summary tip [CHAR LIMIT=NONE] -->
-    <string name="battery_tip_summary_summary">Apps are running normally</string>
+    <string name="battery_tip_summary_summary" product="default">Phone has typical background battery usage</string>
+    <!-- Summary for the battery summary tip [CHAR LIMIT=NONE] -->
+    <string name="battery_tip_summary_summary" product="tablet">Tablet has typical background battery usage</string>
+    <!-- Summary for the battery summary tip [CHAR LIMIT=NONE] -->
+    <string name="battery_tip_summary_summary" product="device">Device has typical background battery usage</string>
     <!-- Title for the low battery tip [CHAR LIMIT=NONE] -->
     <string name="battery_tip_low_battery_title">Low battery capacity</string>
     <!-- Summary for the low battery tip [CHAR LIMIT=NONE] -->
@@ -5078,9 +5076,11 @@
     <string name="battery_tip_unrestrict_app_dialog_cancel">Cancel</string>
 
     <!-- Message for battery tip dialog to show the battery summary -->
-    <string name="battery_tip_dialog_summary_message">Based on your usage, your battery usually lasts about <xliff:g id="time_duration">%1$s</xliff:g> when fully charged.\n\nIf you need to extend your battery life, turn on Battery Saver.</string>
+    <string name="battery_tip_dialog_summary_message" product="default">Your apps are using a normal amount of battery. If apps use too much battery, your phone will suggest actions you can take.\n\nYou can always turn on Battery Saver if you\u2019re running low on battery.</string>
     <!-- Message for battery tip dialog to show the battery summary -->
-    <string name="battery_tip_dialog_summary_message_no_estimation">If you need to extend your battery life, turn on Battery Saver</string>
+    <string name="battery_tip_dialog_summary_message" product="tablet">Your apps are using a normal amount of battery. If apps use too much battery, your tablet will suggest actions you can take.\n\nYou can always turn on Battery Saver if you\u2019re running low on battery.</string>
+    <!-- Message for battery tip dialog to show the battery summary -->
+    <string name="battery_tip_dialog_summary_message" product="device">Your apps are using a normal amount of battery. If apps use too much battery, your device will suggest actions you can take.\n\nYou can always turn on Battery Saver if you\u2019re running low on battery.</string>
 
     <!-- Title for the smart battery manager preference [CHAR LIMIT=NONE] -->
     <string name="smart_battery_manager_title">Battery Manager</string>
@@ -8842,7 +8842,7 @@
     <!-- Summary of Android version info (when there is a pending upgrade available) [CHAR LIMIT=NONE] -->
     <string name="android_version_pending_update_summary">Update available</string>
 
-    <!-- Title for dialog displayed when user selects on a setting locked by an admin [CHAR LIMIT=30] -->
+    <!-- Title for dialog displayed when user selects on a setting locked by an admin [CHAR LIMIT=30 BACKUP_MESSAGE_ID:4867639270211833535] -->
     <string name="disabled_by_policy_title">Action not allowed</string>
     <!-- Title for dialog displayed to tell user that changing volume was disallowed by an admin [CHAR LIMIT=50] -->
     <string name="disabled_by_policy_title_adjust_volume">Can’t change volume</string>
diff --git a/res/xml/wifi_tether_settings.xml b/res/xml/wifi_tether_settings.xml
index f9d9596..bf11698 100644
--- a/res/xml/wifi_tether_settings.xml
+++ b/res/xml/wifi_tether_settings.xml
@@ -28,6 +28,7 @@
 
     <com.android.settings.widget.ValidatedEditTextPreference
         android:key="wifi_tether_network_password"
+        android:persistent="false"
         android:title="@string/wifi_hotspot_password_title" />
 
     <SwitchPreference
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 7e77047..496baa6 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -695,10 +695,9 @@
 
         final boolean showDev = DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(this)
                 && !Utils.isMonkeyRunning();
-        final boolean isAdminOrDemo = um.isAdminUser() || um.isDemoUser();
         somethingChanged = setTileEnabled(changedList, new ComponentName(packageName,
                         Settings.DevelopmentSettingsDashboardActivity.class.getName()),
-                showDev, isAdminOrDemo)
+                showDev, isAdmin)
                 || somethingChanged;
 
         // Enable/disable backup settings depending on whether the user is admin.
@@ -735,9 +734,7 @@
                         final ComponentName component = category.getTile(i).intent.getComponent();
                         final String name = component.getClassName();
                         final boolean isEnabledForRestricted = ArrayUtils.contains(
-                                SettingsGateway.SETTINGS_FOR_RESTRICTED, name) || (isAdminOrDemo
-                                && Settings.DevelopmentSettingsDashboardActivity.class.getName()
-                                .equals(name));
+                                SettingsGateway.SETTINGS_FOR_RESTRICTED, name);
                         if (packageName.equals(component.getPackageName())
                                 && !isEnabledForRestricted) {
                             somethingChanged =
diff --git a/src/com/android/settings/accounts/AccountDashboardFragment.java b/src/com/android/settings/accounts/AccountDashboardFragment.java
index 094390c..281b1ba 100644
--- a/src/com/android/settings/accounts/AccountDashboardFragment.java
+++ b/src/com/android/settings/accounts/AccountDashboardFragment.java
@@ -19,6 +19,7 @@
 
 import android.app.Activity;
 import android.content.Context;
+import android.icu.text.ListFormatter;
 import android.os.UserHandle;
 import android.provider.SearchIndexableResource;
 import android.text.BidiFormatter;
@@ -96,12 +97,11 @@
                 final AuthenticatorHelper authHelper = new AuthenticatorHelper(mContext,
                         UserHandle.of(UserHandle.myUserId()), null /* OnAccountsUpdateListener */);
                 final String[] types = authHelper.getEnabledAccountTypes();
-
                 final BidiFormatter bidiFormatter = BidiFormatter.getInstance();
+                final List<CharSequence> summaries = new ArrayList<>();
 
-                CharSequence summary = null;
                 if (types == null || types.length == 0) {
-                    summary = mContext.getString(R.string.account_dashboard_default_summary);
+                    summaries.add(mContext.getString(R.string.account_dashboard_default_summary));
                 } else {
                     // Show up to 3 account types, ignore any null value
                     int accountToAdd = Math.min(3, types.length);
@@ -111,16 +111,12 @@
                         if (TextUtils.isEmpty(label)) {
                             continue;
                         }
-                        if (summary == null) {
-                            summary = bidiFormatter.unicodeWrap(label);
-                        } else {
-                            summary = mContext.getString(R.string.join_many_items_middle, summary,
-                                    bidiFormatter.unicodeWrap(label));
-                        }
+
+                        summaries.add(bidiFormatter.unicodeWrap(label));
                         accountToAdd--;
                     }
                 }
-                mSummaryLoader.setSummary(this, summary);
+                mSummaryLoader.setSummary(this, ListFormatter.getInstance().format(summaries));
             }
         }
     }
diff --git a/src/com/android/settings/applications/AppPermissionsPreferenceController.java b/src/com/android/settings/applications/AppPermissionsPreferenceController.java
index 206ef33..38a56af 100644
--- a/src/com/android/settings/applications/AppPermissionsPreferenceController.java
+++ b/src/com/android/settings/applications/AppPermissionsPreferenceController.java
@@ -19,13 +19,14 @@
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.pm.PermissionGroupInfo;
 import android.content.pm.PermissionInfo;
-import android.text.TextUtils;
+import android.icu.text.ListFormatter;
 import android.util.ArraySet;
 import android.util.Log;
 
 import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 
@@ -33,7 +34,7 @@
 
     private static final String TAG = "AppPermissionPrefCtrl";
     private static final String KEY_APP_PERMISSION_GROUPS = "manage_perms";
-    private static final String[] PERMISSION_GROUPS = new String[] {
+    private static final String[] PERMISSION_GROUPS = new String[]{
             "android.permission-group.LOCATION",
             "android.permission-group.MICROPHONE",
             "android.permission-group.CAMERA",
@@ -64,18 +65,20 @@
     public CharSequence getSummary() {
         final Set<String> permissions = getAllPermissionsInGroups();
         Set<String> grantedPermissionGroups = getGrantedPermissionGroups(permissions);
-        CharSequence summary = null;
         int count = 0;
+        final List<String> summaries = new ArrayList<>();
+
         for (String group : PERMISSION_GROUPS) {
             if (!grantedPermissionGroups.contains(group)) {
                 continue;
             }
-            summary = concatSummaryText(summary, group);
+            summaries.add(getPermissionGroupLabel(group).toString().toLowerCase());
             if (++count >= NUM_PERMISSION_TO_USE) {
                 break;
             }
         }
-        return count > 0 ? mContext.getString(R.string.app_permissions_summary, summary) : null;
+        return count > 0 ? mContext.getString(R.string.app_permissions_summary,
+                ListFormatter.getInstance().format(summaries)) : null;
     }
 
     private Set<String> getGrantedPermissionGroups(Set<String> permissions) {
@@ -96,14 +99,6 @@
         return grantedPermissionGroups;
     }
 
-    private CharSequence concatSummaryText(CharSequence currentSummary, String permission) {
-        final String label = getPermissionGroupLabel(permission).toString().toLowerCase();
-        if (TextUtils.isEmpty(currentSummary)) {
-            return label;
-        }
-        return mContext.getString(R.string.join_many_items_middle, currentSummary, label);
-    }
-
     private CharSequence getPermissionGroupLabel(String group) {
         try {
             final PermissionGroupInfo groupInfo = mPackageManager.getPermissionGroupInfo(group, 0);
diff --git a/src/com/android/settings/applications/DefaultAppSettings.java b/src/com/android/settings/applications/DefaultAppSettings.java
index 8def015..3af5bc2 100644
--- a/src/com/android/settings/applications/DefaultAppSettings.java
+++ b/src/com/android/settings/applications/DefaultAppSettings.java
@@ -17,6 +17,7 @@
 
 import android.app.Activity;
 import android.content.Context;
+import android.icu.text.ListFormatter;
 import android.provider.SearchIndexableResource;
 import android.text.TextUtils;
 
@@ -138,25 +139,22 @@
             if (!listening) {
                 return;
             }
-            CharSequence summary = concatSummaryText(
-                    mDefaultBrowserPreferenceController.getDefaultAppLabel(),
-                    mDefaultPhonePreferenceController.getDefaultAppLabel());
-            summary = concatSummaryText(summary,
-                    mDefaultSmsPreferenceController.getDefaultAppLabel());
+            final List<CharSequence> summaries = new ArrayList<>();
+            if(!TextUtils.isEmpty(mDefaultBrowserPreferenceController.getDefaultAppLabel())) {
+                summaries.add(mDefaultBrowserPreferenceController.getDefaultAppLabel());
+            }
+            if(!TextUtils.isEmpty(mDefaultPhonePreferenceController.getDefaultAppLabel())) {
+                summaries.add(mDefaultPhonePreferenceController.getDefaultAppLabel());
+            }
+            if(!TextUtils.isEmpty(mDefaultSmsPreferenceController.getDefaultAppLabel())) {
+                summaries.add(mDefaultSmsPreferenceController.getDefaultAppLabel());
+            }
+
+            CharSequence summary = ListFormatter.getInstance().format(summaries);
             if (!TextUtils.isEmpty(summary)) {
                 mSummaryLoader.setSummary(this, summary);
             }
         }
-
-        private CharSequence concatSummaryText(CharSequence summary1, CharSequence summary2) {
-            if (TextUtils.isEmpty(summary1)) {
-                return summary2;
-            }
-            if (TextUtils.isEmpty(summary2)) {
-                return summary1;
-            }
-            return mContext.getString(R.string.join_many_items_middle, summary1, summary2);
-        }
     }
 
     public static final SummaryLoader.SummaryProviderFactory SUMMARY_PROVIDER_FACTORY =
diff --git a/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupController.java b/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupController.java
index 9c15282..1e5224a 100644
--- a/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupController.java
+++ b/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupController.java
@@ -15,6 +15,8 @@
  */
 package com.android.settings.connecteddevice;
 
+import static com.android.settingslib.Utils.isAudioModeOngoingCall;
+
 import android.content.Context;
 import android.content.pm.PackageManager;
 import androidx.annotation.VisibleForTesting;
@@ -23,8 +25,13 @@
 import androidx.preference.PreferenceScreen;
 import com.android.settings.bluetooth.AvailableMediaBluetoothDeviceUpdater;
 import com.android.settings.bluetooth.BluetoothDeviceUpdater;
+import com.android.settings.bluetooth.Utils;
 import com.android.settings.core.BasePreferenceController;
 import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.R;
+import com.android.settingslib.bluetooth.BluetoothCallback;
+import com.android.settingslib.bluetooth.CachedBluetoothDevice;
+import com.android.settingslib.bluetooth.LocalBluetoothManager;
 import com.android.settingslib.core.lifecycle.LifecycleObserver;
 import com.android.settingslib.core.lifecycle.events.OnStart;
 import com.android.settingslib.core.lifecycle.events.OnStop;
@@ -35,26 +42,30 @@
  * to add/remove {@link Preference}
  */
 public class AvailableMediaDeviceGroupController extends BasePreferenceController
-        implements LifecycleObserver, OnStart, OnStop, DevicePreferenceCallback {
+        implements LifecycleObserver, OnStart, OnStop, DevicePreferenceCallback, BluetoothCallback {
 
     private static final String KEY = "available_device_list";
 
     @VisibleForTesting
     PreferenceGroup mPreferenceGroup;
     private BluetoothDeviceUpdater mBluetoothDeviceUpdater;
+    private final LocalBluetoothManager mLocalBluetoothManager;
 
     public AvailableMediaDeviceGroupController(Context context) {
         super(context, KEY);
+        mLocalBluetoothManager = Utils.getLocalBtManager(mContext);
     }
 
     @Override
     public void onStart() {
         mBluetoothDeviceUpdater.registerCallback();
+        mLocalBluetoothManager.getEventManager().registerCallback(this);
     }
 
     @Override
     public void onStop() {
         mBluetoothDeviceUpdater.unregisterCallback();
+        mLocalBluetoothManager.getEventManager().unregisterCallback(this);
     }
 
     @Override
@@ -63,6 +74,7 @@
         if (isAvailable()) {
             mPreferenceGroup = (PreferenceGroup) screen.findPreference(KEY);
             mPreferenceGroup.setVisible(false);
+            updateTitle();
             mBluetoothDeviceUpdater.setPrefContext(screen.getContext());
             mBluetoothDeviceUpdater.forceUpdate();
         }
@@ -105,4 +117,56 @@
     public void setBluetoothDeviceUpdater(BluetoothDeviceUpdater bluetoothDeviceUpdater) {
         mBluetoothDeviceUpdater  = bluetoothDeviceUpdater;
     }
+
+    @Override
+    public void onBluetoothStateChanged(int bluetoothState) {
+        // do nothing
+    }
+
+    @Override
+    public void onScanningStateChanged(boolean started) {
+        // do nothing
+    }
+
+    @Override
+    public void onDeviceAdded(CachedBluetoothDevice cachedDevice) {
+        // do nothing
+    }
+
+    @Override
+    public void onDeviceDeleted(CachedBluetoothDevice cachedDevice) {
+        // do nothing
+    }
+
+    @Override
+    public void onDeviceBondStateChanged(CachedBluetoothDevice cachedDevice, int bondState) {
+        // do nothing
+    }
+
+    @Override
+    public void onConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) {
+        // do nothing
+    }
+
+    @Override
+    public void onActiveDeviceChanged(CachedBluetoothDevice activeDevice, int bluetoothProfile) {
+        // do nothing
+    }
+
+    @Override
+    public void onAudioModeChanged() {
+        updateTitle();
+    }
+
+    private void updateTitle() {
+        if (isAudioModeOngoingCall(mContext)) {
+            // in phone call
+            mPreferenceGroup.
+                    setTitle(mContext.getString(R.string.connected_device_available_call_title));
+        } else {
+            // without phone call
+            mPreferenceGroup.
+                    setTitle(mContext.getString(R.string.connected_device_available_media_title));
+        }
+    }
 }
diff --git a/src/com/android/settings/fuelgauge/batterytip/BatteryTipDialogFragment.java b/src/com/android/settings/fuelgauge/batterytip/BatteryTipDialogFragment.java
index 182ba9c..ef903a8 100644
--- a/src/com/android/settings/fuelgauge/batterytip/BatteryTipDialogFragment.java
+++ b/src/com/android/settings/fuelgauge/batterytip/BatteryTipDialogFragment.java
@@ -79,16 +79,8 @@
 
         switch (mBatteryTip.getType()) {
             case BatteryTip.TipType.SUMMARY:
-                final long averageTimeMs = ((SummaryTip) mBatteryTip).getAverageTimeMs();
-                final String message = context.getString(
-                        averageTimeMs == Estimate.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN
-                                ? R.string.battery_tip_dialog_summary_message_no_estimation
-                                : R.string.battery_tip_dialog_summary_message,
-                        StringUtil.formatElapsedTime(context, averageTimeMs,
-                                false /* withSeconds */));
-
                 return new AlertDialog.Builder(context)
-                        .setMessage(message)
+                        .setMessage(R.string.battery_tip_dialog_summary_message)
                         .setPositiveButton(android.R.string.ok, null)
                         .create();
             case BatteryTip.TipType.HIGH_DEVICE_USAGE:
diff --git a/src/com/android/settings/inputmethod/PhysicalKeyboardPreferenceController.java b/src/com/android/settings/inputmethod/PhysicalKeyboardPreferenceController.java
index 9532fbc..367ea80 100644
--- a/src/com/android/settings/inputmethod/PhysicalKeyboardPreferenceController.java
+++ b/src/com/android/settings/inputmethod/PhysicalKeyboardPreferenceController.java
@@ -18,6 +18,9 @@
 
 import android.content.Context;
 import android.hardware.input.InputManager;
+import android.icu.text.ListFormatter;
+
+import androidx.preference.Preference;
 
 import com.android.settings.R;
 import com.android.settings.core.PreferenceControllerMixin;
@@ -28,9 +31,9 @@
 import com.android.settingslib.core.lifecycle.events.OnPause;
 import com.android.settingslib.core.lifecycle.events.OnResume;
 
+import java.util.ArrayList;
 import java.util.List;
 
-import androidx.preference.Preference;
 
 public class PhysicalKeyboardPreferenceController extends AbstractPreferenceController
         implements PreferenceControllerMixin, LifecycleObserver, OnResume, OnPause,
@@ -100,15 +103,10 @@
             mPreference.setSummary(R.string.keyboard_disconnected);
             return;
         }
-        String summary = null;
+        final List<String> summaries = new ArrayList<>();
         for (HardKeyboardDeviceInfo info : keyboards) {
-            if (summary == null) {
-                summary = info.mDeviceName;
-            } else {
-                summary = mContext.getString(R.string.join_many_items_middle, summary,
-                        info.mDeviceName);
-            }
+            summaries.add(info.mDeviceName);
         }
-        mPreference.setSummary(summary);
+        mPreference.setSummary(ListFormatter.getInstance().format(summaries));
     }
 }
diff --git a/src/com/android/settings/inputmethod/VirtualKeyboardPreferenceController.java b/src/com/android/settings/inputmethod/VirtualKeyboardPreferenceController.java
index 4a04646..61e6a42 100644
--- a/src/com/android/settings/inputmethod/VirtualKeyboardPreferenceController.java
+++ b/src/com/android/settings/inputmethod/VirtualKeyboardPreferenceController.java
@@ -19,11 +19,13 @@
 import android.app.admin.DevicePolicyManager;
 import android.content.Context;
 import android.content.pm.PackageManager;
-import androidx.preference.Preference;
+import android.icu.text.ListFormatter;
 import android.text.BidiFormatter;
 import android.view.inputmethod.InputMethodInfo;
 import android.view.inputmethod.InputMethodManager;
 
+import androidx.preference.Preference;
+
 import com.android.settings.R;
 import com.android.settings.core.PreferenceControllerMixin;
 import com.android.settingslib.core.AbstractPreferenceController;
@@ -81,15 +83,10 @@
 
         final BidiFormatter bidiFormatter = BidiFormatter.getInstance();
 
-        String summary = null;
+        final List<String> summaries = new ArrayList<>();
         for (String label : labels) {
-            if (summary == null) {
-                summary = bidiFormatter.unicodeWrap(label);
-            } else {
-                summary = mContext.getString(R.string.join_many_items_middle, summary,
-                        bidiFormatter.unicodeWrap(label));
-            }
+            summaries.add(bidiFormatter.unicodeWrap(label));
         }
-        preference.setSummary(summary);
+        preference.setSummary(ListFormatter.getInstance().format(summaries));
     }
 }
diff --git a/src/com/android/settings/notification/ZenModeSettings.java b/src/com/android/settings/notification/ZenModeSettings.java
index 706bc63..ddbfcb6 100644
--- a/src/com/android/settings/notification/ZenModeSettings.java
+++ b/src/com/android/settings/notification/ZenModeSettings.java
@@ -21,9 +21,11 @@
 import android.app.NotificationManager;
 import android.app.NotificationManager.Policy;
 import android.content.Context;
+import android.icu.text.ListFormatter;
 import android.provider.SearchIndexableResource;
 import android.provider.Settings;
 import android.service.notification.ZenModeConfig;
+
 import androidx.annotation.VisibleForTesting;
 import androidx.preference.CheckBoxPreference;
 
@@ -44,6 +46,7 @@
 @SearchIndexable
 public class ZenModeSettings extends ZenModeSettingsBase {
     private static final String KEY_SOUND = "zen_effect_sound";
+
     @Override
     public void onResume() {
         super.onResume();
@@ -118,18 +121,21 @@
             } else if (numCategories == 2) {
                 return mContext.getString(R.string.join_two_items, enabledCategories.get(0),
                         enabledCategories.get(1).toLowerCase());
-            } else if (numCategories == 3){
-                String secondaryText = mContext.getString(R.string.join_two_unrelated_items,
-                        enabledCategories.get(0), enabledCategories.get(1).toLowerCase());
-                return mContext.getString(R.string.join_many_items_last, secondaryText,
-                        enabledCategories.get(2).toLowerCase());
+            } else if (numCategories == 3) {
+                final List<String> summaries = new ArrayList<>();
+                summaries.add(enabledCategories.get(0));
+                summaries.add(enabledCategories.get(1).toLowerCase());
+                summaries.add(enabledCategories.get(2).toLowerCase());
+
+                return ListFormatter.getInstance().format(summaries);
             } else {
-                String secondaryText = mContext.getString(R.string.join_many_items_middle,
-                        enabledCategories.get(0), enabledCategories.get(1).toLowerCase());
-                secondaryText = mContext.getString(R.string.join_many_items_middle, secondaryText,
-                        enabledCategories.get(2).toLowerCase());
-                return mContext.getString(R.string.join_many_items_last, secondaryText,
-                        mContext.getString(R.string.zen_mode_other_options));
+                final List<String> summaries = new ArrayList<>();
+                summaries.add(enabledCategories.get(0));
+                summaries.add(enabledCategories.get(1).toLowerCase());
+                summaries.add(enabledCategories.get(2).toLowerCase());
+                summaries.add(mContext.getString(R.string.zen_mode_other_options));
+
+                return ListFormatter.getInstance().format(summaries);
             }
         }
 
@@ -175,15 +181,15 @@
         String getAutomaticRulesSummary() {
             final int count = getEnabledAutomaticRulesCount();
             return count == 0 ? mContext.getString(R.string.zen_mode_settings_summary_off)
-                : mContext.getResources().getQuantityString(
-                    R.plurals.zen_mode_settings_summary_on, count, count);
+                    : mContext.getResources().getQuantityString(
+                            R.plurals.zen_mode_settings_summary_on, count, count);
         }
 
         @VisibleForTesting
         int getEnabledAutomaticRulesCount() {
             int count = 0;
             final Map<String, AutomaticZenRule> ruleMap =
-                NotificationManager.from(mContext).getAutomaticZenRules();
+                    NotificationManager.from(mContext).getAutomaticZenRules();
             if (ruleMap != null) {
                 for (Entry<String, AutomaticZenRule> ruleEntry : ruleMap.entrySet()) {
                     final AutomaticZenRule rule = ruleEntry.getValue();
diff --git a/src/com/android/settings/slices/SliceBuilderUtils.java b/src/com/android/settings/slices/SliceBuilderUtils.java
index 3ac0069..c6f6db4 100644
--- a/src/com/android/settings/slices/SliceBuilderUtils.java
+++ b/src/com/android/settings/slices/SliceBuilderUtils.java
@@ -30,13 +30,16 @@
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.net.Uri;
+import android.provider.Settings;
 import android.provider.SettingsSlicesContract;
 import android.text.TextUtils;
+import android.util.Log;
 import android.util.Pair;
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.settings.R;
+import com.android.settings.SettingsActivity;
 import com.android.settings.SubSettings;
 import com.android.settings.core.BasePreferenceController;
 import com.android.settings.core.SliderPreferenceController;
@@ -75,6 +78,7 @@
      * {@param sliceData} is an inline controller.
      */
     public static Slice buildSlice(Context context, SliceData sliceData) {
+        Log.d(TAG, "Creating slice for: " + sliceData.getPreferenceController());
         final BasePreferenceController controller = getPreferenceController(context, sliceData);
         final Pair<Integer, Object> sliceNamePair =
                 Pair.create(MetricsEvent.FIELD_SETTINGS_PREFERENCE_CHANGE_NAME, sliceData.getKey());
@@ -177,8 +181,7 @@
      * @return {@link PendingIntent} to the Settings home page.
      */
     public static PendingIntent getSettingsIntent(Context context) {
-        final PackageManager manager = context.getPackageManager();
-        final Intent intent = manager.getLaunchIntentForPackage(context.getPackageName());
+        final Intent intent = new Intent(Settings.ACTION_SETTINGS);
         return PendingIntent.getActivity(context, 0 /* requestCode */, intent, 0 /* flags */);
     }
 
diff --git a/src/com/android/settings/sound/AudioSwitchPreferenceController.java b/src/com/android/settings/sound/AudioSwitchPreferenceController.java
index cae7b0c..24d23ab 100644
--- a/src/com/android/settings/sound/AudioSwitchPreferenceController.java
+++ b/src/com/android/settings/sound/AudioSwitchPreferenceController.java
@@ -198,13 +198,6 @@
         return mAudioManager.getDevicesForStream(streamType) == device;
     }
 
-    protected boolean isOngoingCallStatus() {
-        final int audioMode = mAudioManager.getMode();
-        return audioMode == AudioManager.MODE_RINGTONE
-                || audioMode == AudioManager.MODE_IN_CALL
-                || audioMode == AudioManager.MODE_IN_COMMUNICATION;
-    }
-
     int getDefaultDeviceIndex() {
         // Default device is after all connected devices.
         return ArrayUtils.size(mConnectedDevices);
diff --git a/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceController.java b/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceController.java
index 7e91865..732f0ef 100644
--- a/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceController.java
+++ b/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceController.java
@@ -19,6 +19,8 @@
 import static android.media.AudioManager.STREAM_VOICE_CALL;
 import static android.media.AudioSystem.DEVICE_OUT_USB_HEADSET;
 
+import com.android.settingslib.Utils;
+
 import android.bluetooth.BluetoothDevice;
 import android.content.Context;
 import androidx.preference.Preference;
@@ -45,7 +47,7 @@
             return;
         }
 
-        if (!isOngoingCallStatus()) {
+        if (!Utils.isAudioModeOngoingCall(mContext)) {
             // Without phone call, disable the switch entry.
             mPreference.setVisible(false);
             preference.setSummary(mContext.getText(R.string.media_output_default_summary));
@@ -90,7 +92,7 @@
 
     @Override
     public void setActiveBluetoothDevice(BluetoothDevice device) {
-        if (isOngoingCallStatus()) {
+        if (Utils.isAudioModeOngoingCall(mContext)) {
             mProfileManager.getHeadsetProfile().setActiveDevice(device);
         }
     }
diff --git a/src/com/android/settings/sound/MediaOutputPreferenceController.java b/src/com/android/settings/sound/MediaOutputPreferenceController.java
index 5ac0848..89ee412 100644
--- a/src/com/android/settings/sound/MediaOutputPreferenceController.java
+++ b/src/com/android/settings/sound/MediaOutputPreferenceController.java
@@ -20,6 +20,8 @@
 import static android.media.AudioSystem.DEVICE_OUT_REMOTE_SUBMIX;
 import static android.media.AudioSystem.DEVICE_OUT_USB_HEADSET;
 
+import com.android.settingslib.Utils;
+
 import android.bluetooth.BluetoothDevice;
 import android.content.Context;
 import android.media.AudioManager;
@@ -57,7 +59,7 @@
             return;
         }
 
-        if (isOngoingCallStatus()) {
+        if (Utils.isAudioModeOngoingCall(mContext)) {
             // Ongoing call status, switch entry for media will be disabled.
             mPreference.setVisible(false);
             preference.setSummary(
diff --git a/src/com/android/settings/widget/DonutView.java b/src/com/android/settings/widget/DonutView.java
index 76e687e..261c85d 100644
--- a/src/com/android/settings/widget/DonutView.java
+++ b/src/com/android/settings/widget/DonutView.java
@@ -25,7 +25,6 @@
 import android.graphics.PorterDuffColorFilter;
 import android.graphics.Typeface;
 import android.icu.text.DecimalFormatSymbols;
-import androidx.annotation.ColorRes;
 import android.text.Layout;
 import android.text.Spannable;
 import android.text.SpannableString;
@@ -37,6 +36,8 @@
 import android.util.AttributeSet;
 import android.view.View;
 
+import androidx.annotation.ColorRes;
+
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.settings.R;
 import com.android.settings.Utils;
@@ -207,7 +208,7 @@
                                     R.dimen.storage_donut_view_shrunken_label_text_size));
         }
         setContentDescription(getContext().getString(
-                R.string.join_many_items_middle, mPercentString, mFullString));
+                R.string.join_two_unrelated_items, mPercentString, mFullString));
         invalidate();
     }
 
diff --git a/tests/robotests/src/com/android/settings/accounts/AccountDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/accounts/AccountDashboardFragmentTest.java
index ade7dc9..8c74edb 100644
--- a/tests/robotests/src/com/android/settings/accounts/AccountDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accounts/AccountDashboardFragmentTest.java
@@ -15,9 +15,13 @@
  */
 package com.android.settings.accounts;
 
-import static com.android.settings.accounts.AccountDashboardFragmentTest.ShadowAuthenticationHelper.LABELS;
-import static com.android.settings.accounts.AccountDashboardFragmentTest.ShadowAuthenticationHelper.TYPES;
+import static com.android.settings.accounts.AccountDashboardFragmentTest
+        .ShadowAuthenticationHelper.LABELS;
+import static com.android.settings.accounts.AccountDashboardFragmentTest
+        .ShadowAuthenticationHelper.TYPES;
+
 import static com.google.common.truth.Truth.assertThat;
+
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 
@@ -49,116 +53,119 @@
 @RunWith(RobolectricTestRunner.class)
 public class AccountDashboardFragmentTest {
 
-  private AccountDashboardFragment mFragment;
+    private AccountDashboardFragment mFragment;
 
-  @Before
-  public void setUp() {
-    mFragment = new AccountDashboardFragment();
-  }
-
-  @After
-  public void tearDown() {
-    ShadowAuthenticationHelper.reset();
-  }
-
-  @Test
-  public void testCategory_isAccount() {
-    assertThat(mFragment.getCategoryKey()).isEqualTo(CategoryKey.CATEGORY_ACCOUNT);
-  }
-
-  @Test
-  @Config(shadows = {
-      ShadowAuthenticationHelper.class
-  })
-  public void updateSummary_hasAccount_shouldDisplayUpTo3AccountTypes() {
-    final SummaryLoader loader = mock(SummaryLoader.class);
-    final Activity activity = Robolectric.buildActivity(Activity.class).setup().get();
-
-    final SummaryLoader.SummaryProvider provider =
-        AccountDashboardFragment.SUMMARY_PROVIDER_FACTORY.createSummaryProvider(activity, loader);
-    provider.setListening(true);
-
-    verify(loader).setSummary(provider, LABELS[0] + ", " + LABELS[1] + ", " + LABELS[2]);
-  }
-
-  @Test
-  @Config(shadows = ShadowAuthenticationHelper.class)
-  public void updateSummary_noAccount_shouldDisplayDefaultSummary() {
-    ShadowAuthenticationHelper.setEnabledAccount(null);
-    final SummaryLoader loader = mock(SummaryLoader.class);
-    final Activity activity = Robolectric.buildActivity(Activity.class).setup().get();
-
-    final SummaryLoader.SummaryProvider provider =
-        AccountDashboardFragment.SUMMARY_PROVIDER_FACTORY.createSummaryProvider(activity, loader);
-    provider.setListening(true);
-
-    verify(loader).setSummary(provider,
-        activity.getString(R.string.account_dashboard_default_summary));
-  }
-
-  @Test
-  @Config(shadows = ShadowAuthenticationHelper.class)
-  public void updateSummary_noAccountTypeLabel_shouldNotDisplayNullEntry() {
-    final SummaryLoader loader = mock(SummaryLoader.class);
-    final Activity activity = Robolectric.buildActivity(Activity.class).setup().get();
-    final String[] enabledAccounts = {TYPES[0], "unlabeled_account_type", TYPES[1]};
-    ShadowAuthenticationHelper.setEnabledAccount(enabledAccounts);
-
-    final SummaryLoader.SummaryProvider provider =
-        AccountDashboardFragment.SUMMARY_PROVIDER_FACTORY.createSummaryProvider(activity, loader);
-    provider.setListening(true);
-
-    // should only show the 2 accounts with labels
-    verify(loader).setSummary(provider, LABELS[0] + ", " + LABELS[1]);
-  }
-
-  @Test
-  public void testSearchIndexProvider_shouldIndexResource() {
-    final List<SearchIndexableResource> indexRes =
-        AccountDashboardFragment.SEARCH_INDEX_DATA_PROVIDER
-            .getXmlResourcesToIndex(RuntimeEnvironment.application, true /* enabled */);
-
-    assertThat(indexRes).isNotNull();
-    assertThat(indexRes.get(0).xmlResId).isEqualTo(mFragment.getPreferenceScreenResId());
-  }
-
-  @Implements(AuthenticatorHelper.class)
-  public static class ShadowAuthenticationHelper {
-
-    static final String[] TYPES = {"type1", "type2", "type3", "type4"};
-    static final String[] LABELS = {"LABEL1", "LABEL2", "LABEL3", "LABEL4"};
-    private static String[] sEnabledAccount = TYPES;
-
-    public void __constructor__(Context context, UserHandle userHandle,
-        AuthenticatorHelper.OnAccountsUpdateListener listener) {
+    @Before
+    public void setUp() {
+        mFragment = new AccountDashboardFragment();
     }
 
-    private static void setEnabledAccount(String[] enabledAccount) {
-      sEnabledAccount = enabledAccount;
+    @After
+    public void tearDown() {
+        ShadowAuthenticationHelper.reset();
     }
 
-    @Resetter
-    public static void reset() {
-      sEnabledAccount = TYPES;
+    @Test
+    public void testCategory_isAccount() {
+        assertThat(mFragment.getCategoryKey()).isEqualTo(CategoryKey.CATEGORY_ACCOUNT);
     }
 
-    @Implementation
-    public String[] getEnabledAccountTypes() {
-      return sEnabledAccount;
+    @Test
+    @Config(shadows = {
+            ShadowAuthenticationHelper.class
+    })
+    public void updateSummary_hasAccount_shouldDisplayUpTo3AccountTypes() {
+        final SummaryLoader loader = mock(SummaryLoader.class);
+        final Activity activity = Robolectric.buildActivity(Activity.class).setup().get();
+
+        final SummaryLoader.SummaryProvider provider =
+                AccountDashboardFragment.SUMMARY_PROVIDER_FACTORY.createSummaryProvider(activity,
+                        loader);
+        provider.setListening(true);
+
+        verify(loader).setSummary(provider, LABELS[0] + ", " + LABELS[1] + ", and " + LABELS[2]);
     }
 
-    @Implementation
-    public CharSequence getLabelForType(Context context, final String accountType) {
-      if (TextUtils.equals(accountType, TYPES[0])) {
-        return LABELS[0];
-      } else if (TextUtils.equals(accountType, TYPES[1])) {
-        return LABELS[1];
-      } else if (TextUtils.equals(accountType, TYPES[2])) {
-        return LABELS[2];
-      } else if (TextUtils.equals(accountType, TYPES[3])) {
-        return LABELS[3];
-      }
-      return null;
+    @Test
+    @Config(shadows = ShadowAuthenticationHelper.class)
+    public void updateSummary_noAccount_shouldDisplayDefaultSummary() {
+        ShadowAuthenticationHelper.setEnabledAccount(null);
+        final SummaryLoader loader = mock(SummaryLoader.class);
+        final Activity activity = Robolectric.buildActivity(Activity.class).setup().get();
+
+        final SummaryLoader.SummaryProvider provider =
+                AccountDashboardFragment.SUMMARY_PROVIDER_FACTORY.createSummaryProvider(activity,
+                        loader);
+        provider.setListening(true);
+
+        verify(loader).setSummary(provider,
+                activity.getString(R.string.account_dashboard_default_summary));
     }
-  }
+
+    @Test
+    @Config(shadows = ShadowAuthenticationHelper.class)
+    public void updateSummary_noAccountTypeLabel_shouldNotDisplayNullEntry() {
+        final SummaryLoader loader = mock(SummaryLoader.class);
+        final Activity activity = Robolectric.buildActivity(Activity.class).setup().get();
+        final String[] enabledAccounts = {TYPES[0], "unlabeled_account_type", TYPES[1]};
+        ShadowAuthenticationHelper.setEnabledAccount(enabledAccounts);
+
+        final SummaryLoader.SummaryProvider provider =
+                AccountDashboardFragment.SUMMARY_PROVIDER_FACTORY.createSummaryProvider(activity,
+                        loader);
+        provider.setListening(true);
+
+        // should only show the 2 accounts with labels
+        verify(loader).setSummary(provider, LABELS[0] + " and " + LABELS[1]);
+    }
+
+    @Test
+    public void testSearchIndexProvider_shouldIndexResource() {
+        final List<SearchIndexableResource> indexRes =
+                AccountDashboardFragment.SEARCH_INDEX_DATA_PROVIDER
+                        .getXmlResourcesToIndex(RuntimeEnvironment.application, true /* enabled */);
+
+        assertThat(indexRes).isNotNull();
+        assertThat(indexRes.get(0).xmlResId).isEqualTo(mFragment.getPreferenceScreenResId());
+    }
+
+    @Implements(AuthenticatorHelper.class)
+    public static class ShadowAuthenticationHelper {
+
+        static final String[] TYPES = {"type1", "type2", "type3", "type4"};
+        static final String[] LABELS = {"LABEL1", "LABEL2", "LABEL3", "LABEL4"};
+        private static String[] sEnabledAccount = TYPES;
+
+        public void __constructor__(Context context, UserHandle userHandle,
+                AuthenticatorHelper.OnAccountsUpdateListener listener) {
+        }
+
+        private static void setEnabledAccount(String[] enabledAccount) {
+            sEnabledAccount = enabledAccount;
+        }
+
+        @Resetter
+        public static void reset() {
+            sEnabledAccount = TYPES;
+        }
+
+        @Implementation
+        public String[] getEnabledAccountTypes() {
+            return sEnabledAccount;
+        }
+
+        @Implementation
+        public CharSequence getLabelForType(Context context, final String accountType) {
+            if (TextUtils.equals(accountType, TYPES[0])) {
+                return LABELS[0];
+            } else if (TextUtils.equals(accountType, TYPES[1])) {
+                return LABELS[1];
+            } else if (TextUtils.equals(accountType, TYPES[2])) {
+                return LABELS[2];
+            } else if (TextUtils.equals(accountType, TYPES[3])) {
+                return LABELS[3];
+            }
+            return null;
+        }
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/applications/AppPermissionsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/AppPermissionsPreferenceControllerTest.java
index 581b300..cb3d3ad 100644
--- a/tests/robotests/src/com/android/settings/applications/AppPermissionsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppPermissionsPreferenceControllerTest.java
@@ -17,6 +17,7 @@
 package com.android.settings.applications;
 
 import static com.google.common.truth.Truth.assertThat;
+
 import static org.mockito.Matchers.anyInt;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Matchers.eq;
@@ -31,6 +32,7 @@
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.pm.PermissionGroupInfo;
 import android.content.pm.PermissionInfo;
+
 import androidx.preference.Preference;
 
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
@@ -95,21 +97,21 @@
 
         // create permission groups
         when(mPackageManager.getPermissionGroupInfo(eq(PERM_LOCATION), anyInt()))
-            .thenReturn(mGroupLocation);
+                .thenReturn(mGroupLocation);
         when(mGroupLocation.loadLabel(mPackageManager)).thenReturn(LABEL_LOCATION);
         when(mPackageManager.getPermissionGroupInfo(eq(PERM_MICROPHONE), anyInt()))
-            .thenReturn(mGroupMic);
+                .thenReturn(mGroupMic);
         when(mGroupMic.loadLabel(mPackageManager)).thenReturn(LABEL_MICROPHONE);
         when(mPackageManager.getPermissionGroupInfo(eq(PERM_CAMERA), anyInt()))
-            .thenReturn(mGroupCamera);
+                .thenReturn(mGroupCamera);
         when(mGroupCamera.loadLabel(mPackageManager)).thenReturn(LABEL_CAMERA);
         when(mPackageManager.getPermissionGroupInfo(eq(PERM_SMS), anyInt())).thenReturn(mGroupSms);
         when(mGroupSms.loadLabel(mPackageManager)).thenReturn(LABEL_SMS);
         when(mPackageManager.getPermissionGroupInfo(eq(PERM_CONTACTS), anyInt()))
-            .thenReturn(mGroupContacts);
+                .thenReturn(mGroupContacts);
         when(mGroupContacts.loadLabel(mPackageManager)).thenReturn(LABEL_CONTACTS);
         when(mPackageManager.getPermissionGroupInfo(eq(PERM_PHONE), anyInt()))
-            .thenReturn(mGroupPhone);
+                .thenReturn(mGroupPhone);
         when(mGroupPhone.loadLabel(mPackageManager)).thenReturn(LABEL_PHONE);
 
         // create permissions
@@ -139,7 +141,7 @@
         permissions.add(mPermContacts);
         permissions.add(mPermPhone);
         when(mPackageManager.queryPermissionsByGroup(anyString(), anyInt()))
-            .thenReturn(permissions);
+                .thenReturn(permissions);
 
         mController = spy(new AppPermissionsPreferenceController(mContext));
     }
@@ -155,7 +157,7 @@
         final PackageInfo info = new PackageInfo();
         installedPackages.add(info);
         when(mPackageManager.getInstalledPackages(PackageManager.GET_PERMISSIONS))
-            .thenReturn(installedPackages);
+                .thenReturn(installedPackages);
 
         mController.updateState(mPreference);
 
@@ -168,7 +170,7 @@
         final PackageInfo info = new PackageInfo();
         installedPackages.add(info);
         when(mPackageManager.getInstalledPackages(PackageManager.GET_PERMISSIONS))
-            .thenReturn(installedPackages);
+                .thenReturn(installedPackages);
         PermissionInfo[] permissions = new PermissionInfo[4];
         info.permissions = permissions;
 
@@ -177,33 +179,38 @@
         permissions[2] = mPermCamera;
         permissions[3] = mPermSms;
         mController.updateState(mPreference);
-        verify(mPreference).setSummary("Apps using location, microphone, camera");
+
+        verify(mPreference).setSummary("Apps using location, microphone, and camera");
 
         permissions[0] = mPermPhone;
         permissions[1] = mPermMic;
         permissions[2] = mPermCamera;
         permissions[3] = mPermSms;
         mController.updateState(mPreference);
-        verify(mPreference).setSummary("Apps using microphone, camera, sms");
+
+        verify(mPreference).setSummary("Apps using microphone, camera, and sms");
 
         permissions[0] = mPermPhone;
         permissions[1] = mPermMic;
         permissions[2] = mPermContacts;
         permissions[3] = mPermSms;
         mController.updateState(mPreference);
-        verify(mPreference).setSummary("Apps using microphone, sms, contacts");
+
+        verify(mPreference).setSummary("Apps using microphone, sms, and contacts");
 
         permissions = new PermissionInfo[2];
         info.permissions = permissions;
         permissions[0] = mPermLocation;
         permissions[1] = mPermCamera;
         mController.updateState(mPreference);
-        verify(mPreference).setSummary("Apps using location, camera");
+
+        verify(mPreference).setSummary("Apps using location and camera");
 
         permissions = new PermissionInfo[1];
         info.permissions = permissions;
         permissions[0] = mPermCamera;
         mController.updateState(mPreference);
+
         verify(mPreference).setSummary("Apps using camera");
     }
 }
diff --git a/tests/robotests/src/com/android/settings/applications/DefaultAppSettingsTest.java b/tests/robotests/src/com/android/settings/applications/DefaultAppSettingsTest.java
index d17fc87..fef8eef 100644
--- a/tests/robotests/src/com/android/settings/applications/DefaultAppSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/DefaultAppSettingsTest.java
@@ -91,44 +91,51 @@
         when(defaultBrowser.getDefaultAppLabel()).thenReturn("Browser1");
         when(defaultPhone.getDefaultAppLabel()).thenReturn("Phone1");
         summaryProvider.setListening(true);
-        verify(summaryLoader).setSummary(summaryProvider, "Browser1, Phone1, Sms1");
+
+        verify(summaryLoader).setSummary(summaryProvider, "Browser1, Phone1, and Sms1");
 
         // 2 available
         when(defaultSms.getDefaultAppLabel()).thenReturn(null);
         when(defaultBrowser.getDefaultAppLabel()).thenReturn("Browser1");
         when(defaultPhone.getDefaultAppLabel()).thenReturn("Phone1");
         summaryProvider.setListening(true);
-        verify(summaryLoader).setSummary(summaryProvider, "Browser1, Phone1");
+
+        verify(summaryLoader).setSummary(summaryProvider, "Browser1 and Phone1");
 
         when(defaultSms.getDefaultAppLabel()).thenReturn("Sms1");
         when(defaultBrowser.getDefaultAppLabel()).thenReturn(null);
         when(defaultPhone.getDefaultAppLabel()).thenReturn("Phone1");
         summaryProvider.setListening(true);
-        verify(summaryLoader).setSummary(summaryProvider, "Phone1, Sms1");
+
+        verify(summaryLoader).setSummary(summaryProvider, "Phone1 and Sms1");
 
         when(defaultSms.getDefaultAppLabel()).thenReturn("Sms1");
         when(defaultBrowser.getDefaultAppLabel()).thenReturn("Browser1");
         when(defaultPhone.getDefaultAppLabel()).thenReturn(null);
         summaryProvider.setListening(true);
-        verify(summaryLoader).setSummary(summaryProvider, "Phone1, Sms1");
+
+        verify(summaryLoader).setSummary(summaryProvider, "Browser1 and Sms1");
 
         // 1 available
         when(defaultSms.getDefaultAppLabel()).thenReturn(null);
         when(defaultBrowser.getDefaultAppLabel()).thenReturn("Browser1");
         when(defaultPhone.getDefaultAppLabel()).thenReturn(null);
         summaryProvider.setListening(true);
+
         verify(summaryLoader).setSummary(summaryProvider, "Browser1");
 
         when(defaultSms.getDefaultAppLabel()).thenReturn("Sms1");
         when(defaultBrowser.getDefaultAppLabel()).thenReturn(null);
         when(defaultPhone.getDefaultAppLabel()).thenReturn(null);
         summaryProvider.setListening(true);
+
         verify(summaryLoader).setSummary(summaryProvider, "Sms1");
 
         when(defaultSms.getDefaultAppLabel()).thenReturn(null);
         when(defaultBrowser.getDefaultAppLabel()).thenReturn(null);
         when(defaultPhone.getDefaultAppLabel()).thenReturn("Phone1");
         summaryProvider.setListening(true);
+
         verify(summaryLoader).setSummary(summaryProvider, "Phone1");
 
         // None available
@@ -136,6 +143,7 @@
         when(defaultBrowser.getDefaultAppLabel()).thenReturn(null);
         when(defaultPhone.getDefaultAppLabel()).thenReturn(null);
         summaryProvider.setListening(true);
+
         verify(summaryLoader, never()).setSummary(summaryProvider, eq(anyString()));
 
     }
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupControllerTest.java
index fbcf585..c36d03b 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupControllerTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupControllerTest.java
@@ -19,6 +19,7 @@
 import static com.android.settings.core.BasePreferenceController.DISABLED_UNSUPPORTED;
 
 import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.spy;
@@ -27,14 +28,21 @@
 
 import android.content.Context;
 import android.content.pm.PackageManager;
+import android.media.AudioManager;
 import androidx.preference.Preference;
 import androidx.preference.PreferenceGroup;
 import androidx.preference.PreferenceManager;
 import androidx.preference.PreferenceScreen;
 
+import com.android.settings.R;
 import com.android.settings.bluetooth.AvailableMediaBluetoothDeviceUpdater;
 import com.android.settings.dashboard.DashboardFragment;
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settings.testutils.shadow.ShadowAudioManager;
+import com.android.settings.testutils.shadow.ShadowBluetoothUtils;
+import com.android.settingslib.bluetooth.BluetoothCallback;
+import com.android.settingslib.bluetooth.BluetoothEventManager;
+import com.android.settingslib.bluetooth.LocalBluetoothManager;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -43,8 +51,13 @@
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
 
 @RunWith(SettingsRobolectricTestRunner.class)
+@Config(shadows = {
+        ShadowAudioManager.class,
+        ShadowBluetoothUtils.class}
+)
 public class AvailableMediaDeviceGroupControllerTest {
 
     private static final String PREFERENCE_KEY_1 = "pref_key_1";
@@ -59,11 +72,17 @@
     private PreferenceManager mPreferenceManager;
     @Mock
     private PackageManager mPackageManager;
+    @Mock
+    private BluetoothEventManager mEventManager;
+    @Mock
+    private LocalBluetoothManager mLocalManager;
 
     private PreferenceGroup mPreferenceGroup;
     private Context mContext;
     private Preference mPreference;
     private AvailableMediaDeviceGroupController mAvailableMediaDeviceGroupController;
+    private LocalBluetoothManager mLocalBluetoothManager;
+    private ShadowAudioManager mShadowAudioManager;
 
     @Before
     public void setUp() {
@@ -78,6 +97,11 @@
         doReturn(mPackageManager).when(mContext).getPackageManager();
         doReturn(true).when(mPackageManager).hasSystemFeature(PackageManager.FEATURE_BLUETOOTH);
 
+        ShadowBluetoothUtils.sLocalBluetoothManager = mLocalManager;
+        mLocalBluetoothManager = ShadowBluetoothUtils.getLocalBtManager(mContext);
+        mShadowAudioManager = ShadowAudioManager.getShadow();
+        doReturn(mEventManager).when(mLocalBluetoothManager).getEventManager();
+
         mAvailableMediaDeviceGroupController = new AvailableMediaDeviceGroupController(mContext);
         mAvailableMediaDeviceGroupController.
                 setBluetoothDeviceUpdater(mAvailableMediaBluetoothDeviceUpdater);
@@ -127,6 +151,8 @@
         // register the callback in onStart()
         mAvailableMediaDeviceGroupController.onStart();
         verify(mAvailableMediaBluetoothDeviceUpdater).registerCallback();
+        verify(mLocalBluetoothManager.getEventManager()).registerCallback(
+                any(BluetoothCallback.class));
     }
 
     @Test
@@ -134,6 +160,8 @@
         // unregister the callback in onStop()
         mAvailableMediaDeviceGroupController.onStop();
         verify(mAvailableMediaBluetoothDeviceUpdater).unregisterCallback();
+        verify(mLocalBluetoothManager.getEventManager()).unregisterCallback(
+                any(BluetoothCallback.class));
     }
 
     @Test
@@ -151,4 +179,22 @@
         assertThat(mAvailableMediaDeviceGroupController.getAvailabilityStatus()).isEqualTo(
                 AVAILABLE);
     }
+
+    @Test
+    public void setTitle_inCallState_showCallStateTitle() {
+        mShadowAudioManager.setMode(AudioManager.MODE_IN_CALL);
+        mAvailableMediaDeviceGroupController.onAudioModeChanged();
+
+        assertThat(mPreferenceGroup.getTitle()).isEqualTo(
+                mContext.getText(R.string.connected_device_available_call_title));
+    }
+
+    @Test
+    public void setTitle_notInCallState_showMediaStateTitle() {
+        mShadowAudioManager.setMode(AudioManager.MODE_NORMAL);
+        mAvailableMediaDeviceGroupController.onAudioModeChanged();
+
+        assertThat(mPreferenceGroup.getTitle()).isEqualTo(
+                mContext.getText(R.string.connected_device_available_media_title));
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipDialogFragmentTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipDialogFragmentTest.java
index 1de1e48..7a41921 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipDialogFragmentTest.java
@@ -199,7 +199,7 @@
     }
 
     @Test
-    public void testOnCreateDialog_summaryTipWithEstimation_fireDialogWithEstimation() {
+    public void testOnCreateDialog_summaryTip_fireDialog() {
         doReturn(AVERAGE_TIME_MS).when(mSummaryTip).getAverageTimeMs();
         mDialogFragment = BatteryTipDialogFragment.newInstance(mSummaryTip, METRICS_KEY);
 
@@ -209,20 +209,8 @@
         ShadowAlertDialog shadowDialog = shadowOf(dialog);
 
         assertThat(shadowDialog.getMessage()).isEqualTo(
-                "Based on your usage, your battery usually lasts about 1 hr when fully charged"
-                        + ".\n\nIf you need to extend your battery life, turn on Battery Saver.");
-    }
-
-    @Test
-    public void testOnCreateDialog_summaryTipWithoutEstimation_fireDialogWithoutEstimation() {
-        mDialogFragment = BatteryTipDialogFragment.newInstance(mSummaryTip, METRICS_KEY);
-
-        FragmentTestUtil.startFragment(mDialogFragment);
-
-        final AlertDialog dialog = (AlertDialog) ShadowDialog.getLatestDialog();
-        ShadowAlertDialog shadowDialog = shadowOf(dialog);
-
-        assertThat(shadowDialog.getMessage()).isEqualTo(
-                "If you need to extend your battery life, turn on Battery Saver");
+                "Your apps are using a normal amount of battery. If apps use too much battery, "
+                        + "your phone will suggest actions you can take.\n\nYou can always turn"
+                        + " on Battery Saver if you’re running low on battery.");
     }
 }
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipPreferenceControllerTest.java
index 60699cf..ff52a08 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipPreferenceControllerTest.java
@@ -37,6 +37,7 @@
 import android.text.format.DateUtils;
 
 import com.android.internal.logging.nano.MetricsProto;
+import com.android.settings.R;
 import com.android.settings.SettingsActivity;
 import com.android.settings.core.InstrumentedPreferenceFragment;
 import com.android.settings.fuelgauge.batterytip.tips.BatteryTip;
@@ -181,7 +182,9 @@
         assertThat(preferenceGroup.getPreferenceCount()).isEqualTo(1);
 
         final Preference preference = preferenceGroup.getPreference(0);
-        assertThat(preference.getTitle()).isEqualTo("Battery is in good shape");
-        assertThat(preference.getSummary()).isEqualTo("Apps are running normally");
+        assertThat(preference.getTitle()).isEqualTo(
+                mContext.getString(R.string.battery_tip_summary_title));
+        assertThat(preference.getSummary()).isEqualTo(
+                mContext.getString(R.string.battery_tip_summary_summary));
     }
 }
diff --git a/tests/robotests/src/com/android/settings/inputmethod/VirtualKeyboardPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/inputmethod/VirtualKeyboardPreferenceControllerTest.java
index c1a963c..43e89ff 100644
--- a/tests/robotests/src/com/android/settings/inputmethod/VirtualKeyboardPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/inputmethod/VirtualKeyboardPreferenceControllerTest.java
@@ -17,8 +17,7 @@
 package com.android.settings.inputmethod;
 
 import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
+
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
@@ -28,11 +27,12 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.pm.PackageManager;
-import androidx.core.text.BidiFormatter;
-import androidx.preference.Preference;
 import android.view.inputmethod.InputMethodInfo;
 import android.view.inputmethod.InputMethodManager;
 
+import androidx.core.text.BidiFormatter;
+import androidx.preference.Preference;
+
 import com.android.settings.R;
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
 
@@ -125,18 +125,9 @@
         when(imis.get(0).loadLabel(mPm)).thenReturn(label1);
         when(imis.get(1).getPackageName()).thenReturn(componentName.getPackageName());
         when(imis.get(1).loadLabel(mPm)).thenReturn(label2);
-        when(mContext.getString(eq(R.string.join_many_items_middle), anyString(), anyString()))
-                .thenAnswer(invocation -> {
-                    final Object[] args = invocation.getArguments();
-                    final String str1 = (String) args[1];
-                    final String str2 = (String) args[2];
-                    return RuntimeEnvironment.application.getString(R.string.join_many_items_middle,
-                            str1, str2);
-                });
 
         mController.updateState(mPreference);
 
-        verify(mPreference).setSummary(
-                formatter.unicodeWrap(label1) + ", " + formatter.unicodeWrap(label2));
+        verify(mPreference).setSummary(formatter.unicodeWrap(label1) + " and " + formatter.unicodeWrap(label2));
     }
 }
diff --git a/tests/robotests/src/com/android/settings/slices/SliceBuilderUtilsTest.java b/tests/robotests/src/com/android/settings/slices/SliceBuilderUtilsTest.java
index 20bb5a0..a74e2ba 100644
--- a/tests/robotests/src/com/android/settings/slices/SliceBuilderUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/slices/SliceBuilderUtilsTest.java
@@ -24,6 +24,7 @@
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 
+import android.app.PendingIntent;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
@@ -405,6 +406,16 @@
         assertThat(intentData).isEqualTo(expectedUri);
     }
 
+    @Test
+    public void getSettingsIntent_createsIntentToSettings() {
+        final Intent intent = new Intent(Settings.ACTION_SETTINGS);
+        final PendingIntent expectedIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
+
+        final PendingIntent settingsIntent = SliceBuilderUtils.getSettingsIntent(mContext);
+
+        assertThat(expectedIntent).isEqualTo(settingsIntent);
+    }
+
     private SliceData getDummyData() {
         return getDummyData(TOGGLE_CONTROLLER, SUMMARY, SliceData.SliceType.SWITCH);
     }