Merge "Update homepage summaries" into sc-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1db7ff0..690c98e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3167,7 +3167,7 @@
     <!-- Styles & Wallpapers settings title [CHAR LIMIT=30] -->
     <string name="style_and_wallpaper_settings_title">Wallpaper &amp; style</string>
     <!-- Summary for the top level Styles & wallpapers Settings [CHAR LIMIT=NONE]-->
-    <string name="wallpaper_dashboard_summary">Colors, app grid</string>
+    <string name="wallpaper_dashboard_summary">Colors, themed icons, app grid</string>
     <!-- Wallpaper settings summary when default wallpaper is used [CHAR LIMIT=NONE] -->
     <string name="wallpaper_settings_summary_default">Default</string>
     <!-- Wallpaper settings summary when wallpaper has been updated [CHAR LIMIT=NONE] -->
@@ -5177,7 +5177,7 @@
     <!-- Settings title for accessibility settings screen -->
     <string name="accessibility_settings_title">Accessibility settings</string>
     <!-- Summary for Accessibility settings, explaining a few important settings under it [CHAR LIMIT=NONE]-->
-    <string name="accessibility_settings_summary">Screen readers, display, interaction controls</string>
+    <string name="accessibility_settings_summary">Screen readers, interaction controls</string>
     <!-- Settings title for a brief version of Vision-Related Accessibility Settings. Displayed in Setup Wizard only. [CHAR LIMIT=35] -->
     <string name="vision_settings_title">Vision Settings</string>
     <!-- Settings description for a brief version of Vision-Related Accessibility Settings. Tells the user that they can adjust these settings now to help them through the remainder of the Setup Wizard and that they can later be changed in Settings. Displayed in Setup Wizard only. [CHAR LIMIT=none] -->
@@ -7678,7 +7678,7 @@
     <string name="help_label">Help &amp; feedback</string>
 
     <!-- Summary text for support setting tile [CHAR LIMIT=None] -->
-    <string name="support_summary">Help articles, phone &amp; chat, getting started</string>
+    <string name="support_summary">Help articles, phone &amp; chat</string>
 
     <!-- Help URI, Default [DO NOT TRANSLATE] -->
     <string name="help_uri_default" translatable="false"></string>
@@ -8074,15 +8074,15 @@
 
     <!-- Title for setting tile leading to network and Internet settings [CHAR LIMIT=40]-->
     <string name="network_dashboard_title">Network &amp; internet</string>
-    <!-- Summary for Network and Internet settings, explaining it contains mobile network setting [CHAR LIMIT=NONE]-->
-    <string name="network_dashboard_summary_mobile">mobile</string>
-    <!-- Summary for Network and Internet settings, explaining it contains network data usage setting [CHAR LIMIT=NONE]-->
-    <string name="network_dashboard_summary_data_usage">data usage</string>
-    <!-- Summary for Network and Internet settings, explaining it contains hotspot (tethering) setting [CHAR LIMIT=NONE]-->
-    <string name="network_dashboard_summary_hotspot">hotspot</string>
+    <!-- Summary for Network and Internet settings, explaining it contains mobile, wifi setting and data usage settings [CHAR LIMIT=NONE]-->
+    <string name="network_dashboard_summary_mobile">Mobile, Wi\u2011Fi, hotspot</string>
+    <!-- Summary for Network and Internet settings, explaining it contains wifi and data usage setting [CHAR LIMIT=NONE]-->
+    <string name="network_dashboard_summary_no_mobile">Wi\u2011Fi, hotspot</string>
 
     <!-- Title for setting tile leading to Connected devices settings [CHAR LIMIT=40]-->
     <string name="connected_devices_dashboard_title">Connected devices</string>
+    <!-- Summary for Connected devices settings, explaining default settings under it [CHAR LIMIT=NONE]-->
+    <string name="connected_devices_dashboard_default_summary">Bluetooth, pairing</string>
     <!-- Summary for Connected devices settings, explaning a few important settings under it [CHAR LIMIT=NONE]-->
     <string name="connected_devices_dashboard_summary">Bluetooth, driving mode, NFC</string>
     <!-- Summary for Connected devices settings, explaning a few important settings under it [CHAR LIMIT=NONE]-->
@@ -10900,7 +10900,7 @@
     <!-- Summary of display with screen sleep timeout [CHAR LIMIT=NONE] -->
     <string name="display_summary">Sleep after <xliff:g id="timeout_description" example="10 minutes">%1$s</xliff:g> of inactivity</string>
     <!-- Summary for Display settings, explaining a few important settings under it [CHAR LIMIT=NONE]-->
-    <string name="display_dashboard_summary">Screen timeout, font size</string>
+    <string name="display_dashboard_summary">Dark theme, font size, brightness</string>
 
     <!-- Example summary of display used in Setup Wizard preview screen [CHAR LIMIT=NONE] -->
     <string name="display_summary_example">Sleep after 10 minutes of inactivity</string>
diff --git a/res/xml/top_level_settings.xml b/res/xml/top_level_settings.xml
index 6d73ad6..1b949e9 100644
--- a/res/xml/top_level_settings.xml
+++ b/res/xml/top_level_settings.xml
@@ -35,7 +35,7 @@
         android:key="top_level_connected_devices"
         android:order="-140"
         android:title="@string/connected_devices_dashboard_title"
-        android:summary="@string/summary_placeholder"
+        android:summary="@string/connected_devices_dashboard_default_summary"
         settings:controller="com.android.settings.connecteddevice.TopLevelConnectedDevicesPreferenceController"/>
 
     <Preference
diff --git a/src/com/android/settings/connecteddevice/TopLevelConnectedDevicesPreferenceController.java b/src/com/android/settings/connecteddevice/TopLevelConnectedDevicesPreferenceController.java
index fd36bca..9db333d 100644
--- a/src/com/android/settings/connecteddevice/TopLevelConnectedDevicesPreferenceController.java
+++ b/src/com/android/settings/connecteddevice/TopLevelConnectedDevicesPreferenceController.java
@@ -33,10 +33,4 @@
         return mContext.getResources().getBoolean(R.bool.config_show_top_level_connected_devices)
                 ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
     }
-
-    @Override
-    public CharSequence getSummary() {
-        return mContext.getText(
-                AdvancedConnectedDeviceController.getConnectedDevicesSummaryResourceId(mContext));
-    }
 }
diff --git a/src/com/android/settings/network/TopLevelNetworkEntryPreferenceController.java b/src/com/android/settings/network/TopLevelNetworkEntryPreferenceController.java
index f0eb96d..868c79e 100644
--- a/src/com/android/settings/network/TopLevelNetworkEntryPreferenceController.java
+++ b/src/com/android/settings/network/TopLevelNetworkEntryPreferenceController.java
@@ -18,29 +18,18 @@
 
 import android.content.Context;
 import android.text.BidiFormatter;
-import android.text.TextUtils;
 
 import com.android.settings.R;
 import com.android.settings.Utils;
 import com.android.settings.core.BasePreferenceController;
-import com.android.settings.wifi.WifiPrimarySwitchPreferenceController;
-
-import java.util.ArrayList;
-import java.util.List;
 
 public class TopLevelNetworkEntryPreferenceController extends BasePreferenceController {
 
-    private final WifiPrimarySwitchPreferenceController mWifiPreferenceController;
     private final MobileNetworkPreferenceController mMobileNetworkPreferenceController;
-    private final TetherPreferenceController mTetherPreferenceController;
 
     public TopLevelNetworkEntryPreferenceController(Context context, String preferenceKey) {
         super(context, preferenceKey);
         mMobileNetworkPreferenceController = new MobileNetworkPreferenceController(mContext);
-        mTetherPreferenceController = new TetherPreferenceController(
-                mContext, null /* lifecycle */);
-        mWifiPreferenceController = new WifiPrimarySwitchPreferenceController(
-                mContext, null /* metrics */);
     }
 
     @Override
@@ -50,44 +39,12 @@
 
     @Override
     public CharSequence getSummary() {
-        final String wifiSummary = BidiFormatter.getInstance()
-                .unicodeWrap(mContext.getString(R.string.wifi_settings_title));
-        final String mobileSummary = mContext.getString(
-                R.string.network_dashboard_summary_mobile);
-        final String dataUsageSummary = mContext.getString(
-                R.string.network_dashboard_summary_data_usage);
-        final String hotspotSummary = mContext.getString(
-                R.string.network_dashboard_summary_hotspot);
-
-        final List<String> summaries = new ArrayList<>();
-        if (mWifiPreferenceController.isAvailable()
-                && !TextUtils.isEmpty(wifiSummary)) {
-            summaries.add(wifiSummary);
+        if (mMobileNetworkPreferenceController.isAvailable()) {
+            return BidiFormatter.getInstance()
+                    .unicodeWrap(mContext.getString(R.string.network_dashboard_summary_mobile));
+        } else {
+            return BidiFormatter.getInstance()
+                    .unicodeWrap(mContext.getString(R.string.network_dashboard_summary_no_mobile));
         }
-        if (mMobileNetworkPreferenceController.isAvailable() && !TextUtils.isEmpty(mobileSummary)) {
-            summaries.add(mobileSummary);
-        }
-        if (!TextUtils.isEmpty(dataUsageSummary)) {
-            summaries.add(dataUsageSummary);
-        }
-        if (mTetherPreferenceController.isAvailable()
-                && !TextUtils.isEmpty(hotspotSummary)) {
-            summaries.add(hotspotSummary);
-        }
-        return concatSummaries(summaries);
-    }
-
-    private CharSequence concatSummaries(List<String> summaries) {
-        if (summaries.isEmpty()) {
-            return mContext.getText(R.string.summary_placeholder);
-        }
-
-        String summary = summaries.get(0);
-        final int summary_size = summaries.size();
-        for (int i = 1; i < summary_size; i++) {
-            summary = mContext.getString(R.string.join_two_unrelated_items, summary,
-                    summaries.get(i));
-        }
-        return summary;
     }
 }
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/TopLevelConnectedDevicesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/TopLevelConnectedDevicesPreferenceControllerTest.java
index 14fe4bd..66f314d 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/TopLevelConnectedDevicesPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/TopLevelConnectedDevicesPreferenceControllerTest.java
@@ -23,16 +23,12 @@
 
 import android.content.Context;
 
-import com.android.settings.R;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
-import org.robolectric.annotation.Implementation;
-import org.robolectric.annotation.Implements;
 
 @RunWith(RobolectricTestRunner.class)
 public class TopLevelConnectedDevicesPreferenceControllerTest {
@@ -56,20 +52,4 @@
     public void getAvailabilityStatus_unsupportedWhenSet() {
         assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
     }
-
-    @Test
-    @Config(shadows = ShadowAdvancedConnectedDeviceController.class)
-    public void getSummary_shouldCallAdvancedConnectedDeviceController() {
-        assertThat(mController.getSummary())
-                .isEqualTo(mContext.getText(R.string.settings_label_launcher));
-    }
-
-    @Implements(AdvancedConnectedDeviceController.class)
-    private static class ShadowAdvancedConnectedDeviceController {
-
-        @Implementation
-        protected static int getConnectedDevicesSummaryResourceId(Context context) {
-            return R.string.settings_label_launcher;
-        }
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/network/TopLevelNetworkEntryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/TopLevelNetworkEntryPreferenceControllerTest.java
index 81092eb..a2bac85 100644
--- a/tests/robotests/src/com/android/settings/network/TopLevelNetworkEntryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/TopLevelNetworkEntryPreferenceControllerTest.java
@@ -24,10 +24,11 @@
 
 import android.content.Context;
 import android.os.UserManager;
+import android.text.BidiFormatter;
 
+import com.android.settings.R;
 import com.android.settings.testutils.shadow.ShadowRestrictedLockUtilsInternal;
 import com.android.settings.testutils.shadow.ShadowUtils;
-import com.android.settings.wifi.WifiPrimarySwitchPreferenceController;
 
 import org.junit.After;
 import org.junit.Before;
@@ -47,11 +48,7 @@
 public class TopLevelNetworkEntryPreferenceControllerTest {
 
     @Mock
-    private WifiPrimarySwitchPreferenceController mWifiPreferenceController;
-    @Mock
-    private MobileNetworkPreferenceController mMobileNetworkPreferenceController;
-    @Mock
-    private TetherPreferenceController mTetherPreferenceController;
+    private MobileNetworkPreferenceController mMobileNetworkPreferenceController;;
 
     private Context mContext;
     private TopLevelNetworkEntryPreferenceController mController;
@@ -66,12 +63,8 @@
 
         mController = new TopLevelNetworkEntryPreferenceController(mContext, "test_key");
 
-        ReflectionHelpers.setField(mController, "mWifiPreferenceController",
-                mWifiPreferenceController);
         ReflectionHelpers.setField(mController, "mMobileNetworkPreferenceController",
                 mMobileNetworkPreferenceController);
-        ReflectionHelpers.setField(mController, "mTetherPreferenceController",
-                mTetherPreferenceController);
     }
 
     @After
@@ -86,21 +79,18 @@
     }
 
     @Test
-    public void getSummary_hasMobileAndHotspot_shouldReturnMobileSummary() {
-        when(mWifiPreferenceController.isAvailable()).thenReturn(true);
+    public void getSummary_hasMobile_shouldReturnMobileSummary() {
         when(mMobileNetworkPreferenceController.isAvailable()).thenReturn(true);
-        when(mTetherPreferenceController.isAvailable()).thenReturn(true);
 
-        assertThat(mController.getSummary())
-                .isEqualTo("Wi\u2011Fi, mobile, data usage, hotspot");
+        assertThat(mController.getSummary()).isEqualTo(BidiFormatter.getInstance().unicodeWrap(
+                mContext.getString(R.string.network_dashboard_summary_mobile)));
     }
 
     @Test
-    public void getSummary_noMobileOrHotspot_shouldReturnSimpleSummary() {
-        when(mWifiPreferenceController.isAvailable()).thenReturn(true);
+    public void getSummary_noMobile_shouldReturnNoMobileSummary() {
         when(mMobileNetworkPreferenceController.isAvailable()).thenReturn(false);
-        when(mTetherPreferenceController.isAvailable()).thenReturn(false);
 
-        assertThat(mController.getSummary()).isEqualTo("Wi\u2011Fi, data usage");
+        assertThat(mController.getSummary()).isEqualTo(BidiFormatter.getInstance().unicodeWrap(
+                mContext.getString(R.string.network_dashboard_summary_no_mobile)));
     }
 }