From 4bf9551c30d8266a6ead5c66001cd6b1fe0597e3 Mon Sep 17 00:00:00 2001 From: Weng Su Date: Wed, 19 May 2021 01:26:51 +0800 Subject: [PATCH] Improve discoverability of the intent & actions progress - Display "Select the network you want to use for data" on sub-title when Wi-Fi networks is not empty - Screenshot: https://screenshot.googleplex.com/6nuwYoSh7UjF93Q Bug: 186432232 Test: manual test atest -c InternetConnectivityPanelTest Change-Id: I9ab0ce0ca052b3444e50a914b59f38e4e7778ddf --- res/values/strings.xml | 2 ++ .../settings/panel/InternetConnectivityPanel.java | 5 +++++ .../settings/panel/InternetConnectivityPanelTest.java | 9 +++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index a34f909260c..cdcb8e9fa78 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -13125,6 +13125,8 @@ To switch networks, disconnect ethernet Wi\u2011Fi is turned on + + Select the network you want to use for data W+ connections diff --git a/src/com/android/settings/panel/InternetConnectivityPanel.java b/src/com/android/settings/panel/InternetConnectivityPanel.java index 163afa10a19..50371ae8fb7 100644 --- a/src/com/android/settings/panel/InternetConnectivityPanel.java +++ b/src/com/android/settings/panel/InternetConnectivityPanel.java @@ -65,6 +65,8 @@ public class InternetConnectivityPanel implements PanelContent, LifecycleObserve private static final String TAG = "InternetConnectivityPanel"; private static final int SUBTITLE_TEXT_NONE = -1; private static final int SUBTITLE_TEXT_WIFI_IS_TURNED_ON = R.string.wifi_is_turned_on_subtitle; + private static final int SUBTITLE_TEXT_SELECT_NETWORK_TO_CONNECT_INTERNET = + R.string.select_network_to_connect_internet; private static final int SUBTITLE_TEXT_SEARCHING_FOR_NETWORKS = R.string.wifi_empty_list_wifi_on; private static final int SUBTITLE_TEXT_NON_CARRIER_NETWORK_UNAVAILABLE = @@ -322,6 +324,9 @@ public class InternetConnectivityPanel implements PanelContent, LifecycleObserve final List wifiList = mWifiManager.getScanResults(); if (wifiList != null && wifiList.size() != 0) { + // When the Wi-Fi scan result is not empty + // Sub-Title: Select the network you want to use for data + mSubtitle = SUBTITLE_TEXT_SELECT_NETWORK_TO_CONNECT_INTERNET; return; } diff --git a/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java b/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java index 5ee2cc96daa..651eb048905 100644 --- a/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java +++ b/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java @@ -63,6 +63,10 @@ public class InternetConnectivityPanelTest { ApplicationProvider.getApplicationContext(), "airplane_mode"); public static final String SUBTITLE_WIFI_IS_TURNED_ON = ResourcesUtils.getResourcesString( ApplicationProvider.getApplicationContext(), "wifi_is_turned_on_subtitle"); + public static final String SUBTITLE_TEXT_SELECT_NETWORK_TO_CONNECT_INTERNET = + ResourcesUtils.getResourcesString( + ApplicationProvider.getApplicationContext(), + "select_network_to_connect_internet"); public static final String BUTTON_SETTINGS = ResourcesUtils.getResourcesString( ApplicationProvider.getApplicationContext(), "settings_button"); public static final String SUBTITLE_NON_CARRIER_NETWORK_UNAVAILABLE = @@ -175,7 +179,7 @@ public class InternetConnectivityPanelTest { } @Test - public void getSubTitle_apmOffWifiOnTwoWifiItemsNoCarrierData_shouldBeNull() { + public void getSubTitle_apmOffWifiOnTwoWifiItemsNoCarrierData_selectNetworkToConnectInternet() { List wifiList = new ArrayList(); wifiList.add(new ScanResult()); wifiList.add(new ScanResult()); @@ -183,7 +187,8 @@ public class InternetConnectivityPanelTest { mPanel.updatePanelTitle(); - assertThat(mPanel.getSubTitle()).isNull(); + assertThat(mPanel.getSubTitle()) + .isEqualTo(SUBTITLE_TEXT_SELECT_NETWORK_TO_CONNECT_INTERNET); } @Test