Merge "Provide "Disconnected" in summary for detail page" into qt-dev
This commit is contained in:
@@ -77,6 +77,8 @@
|
||||
|
||||
<!-- Summary for the remembered network. -->
|
||||
<string name="wifi_remembered">Saved</string>
|
||||
<!-- Summary for the disconnected network. [CHAR LIMIT=40] -->
|
||||
<string name="wifi_disconnected">Disconnected</string>
|
||||
<!-- Status for networks disabled for unknown reason -->
|
||||
<string name="wifi_disabled_generic">Disabled</string>
|
||||
<!-- Status for networked disabled from a DNS or DHCP failure -->
|
||||
|
||||
@@ -968,6 +968,13 @@ public class AccessPoint implements Comparable<AccessPoint> {
|
||||
}
|
||||
|
||||
public String getSettingsSummary() {
|
||||
return getSettingsSummary(false /*convertSavedAsDisconnected*/);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the summary for the AccessPoint.
|
||||
*/
|
||||
public String getSettingsSummary(boolean convertSavedAsDisconnected) {
|
||||
// Update to new summary
|
||||
StringBuilder summary = new StringBuilder();
|
||||
|
||||
@@ -1033,8 +1040,13 @@ public class AccessPoint implements Comparable<AccessPoint> {
|
||||
R.string.wifi_ap_unable_to_handle_new_sta));
|
||||
break;
|
||||
default:
|
||||
// "Saved"
|
||||
summary.append(mContext.getString(R.string.wifi_remembered));
|
||||
if (convertSavedAsDisconnected) {
|
||||
// Disconnected
|
||||
summary.append(mContext.getString(R.string.wifi_disconnected));
|
||||
} else {
|
||||
// "Saved"
|
||||
summary.append(mContext.getString(R.string.wifi_remembered));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -515,6 +515,30 @@ public class AccessPointTest {
|
||||
R.string.connected_via_carrier), carrierName));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSummaryString_showsDisconnected() {
|
||||
AccessPoint ap = createAccessPointWithScanResultCache();
|
||||
ap.update(new WifiConfiguration());
|
||||
|
||||
assertThat(ap.getSettingsSummary(true /*convertSavedAsDisconnected*/))
|
||||
.isEqualTo(mContext.getString(R.string.wifi_disconnected));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSummaryString_concatenatedMeteredAndDisconnected() {
|
||||
AccessPoint ap = createAccessPointWithScanResultCache();
|
||||
WifiConfiguration config = new WifiConfiguration();
|
||||
config.meteredHint = true;
|
||||
ap.update(config);
|
||||
|
||||
String expectedString =
|
||||
mContext.getResources().getString(R.string.preference_summary_default_combination,
|
||||
mContext.getString(R.string.wifi_metered_label),
|
||||
mContext.getString(R.string.wifi_disconnected));
|
||||
assertThat(ap.getSettingsSummary(true /*convertSavedAsDisconnected*/))
|
||||
.isEqualTo(expectedString);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSummaryString_showsConnectedViaSuggestionOrSpecifierApp() throws Exception {
|
||||
final int rssi = -55;
|
||||
|
||||
Reference in New Issue
Block a user