Add summary for hostspot when airplane is on.

Change-Id: I5470dab7050b73ed474abd5b948e873699819751
Fixes: 72716285
Test: RunSettingsRoboTests
This commit is contained in:
jackqdyulei
2018-02-13 14:21:12 -08:00
parent 4f6d667ac4
commit 2c45737dfb
3 changed files with 4 additions and 2 deletions

View File

@@ -2142,6 +2142,8 @@
<string name="wifi_hotspot_configure_ap_text_summary">AndroidAP WPA2 PSK hotspot</string> <string name="wifi_hotspot_configure_ap_text_summary">AndroidAP WPA2 PSK hotspot</string>
<!-- Default access point SSID used for tethering --> <!-- Default access point SSID used for tethering -->
<string name="wifi_tether_configure_ssid_default">AndroidHotspot</string> <string name="wifi_tether_configure_ssid_default">AndroidHotspot</string>
<!-- Summary text when hotspot is disabled because airplane mode is on [CHAR LIMIT=80]-->
<string name="wifi_tether_disabled_by_airplane">Unavailable because airplane mode is turned on</string>
<!-- Do not translate. Used for diagnostic screens, precise translation is not necessary <!-- Do not translate. Used for diagnostic screens, precise translation is not necessary
Wi-Fi Testing on the diagnostic screen--> Wi-Fi Testing on the diagnostic screen-->

View File

@@ -202,7 +202,7 @@ public class WifiTetherPreferenceController extends AbstractPreferenceController
boolean isAirplaneMode = Settings.Global.getInt(mContext.getContentResolver(), boolean isAirplaneMode = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.AIRPLANE_MODE_ON, 0) != 0; Settings.Global.AIRPLANE_MODE_ON, 0) != 0;
if (isAirplaneMode) { if (isAirplaneMode) {
mPreference.setSummary(R.string.summary_placeholder); mPreference.setSummary(R.string.wifi_tether_disabled_by_airplane);
} }
} }
// //

View File

@@ -185,7 +185,7 @@ public class WifiTetherPreferenceControllerTest {
receiver.onReceive(RuntimeEnvironment.application, broadcast); receiver.onReceive(RuntimeEnvironment.application, broadcast);
assertThat(mPreference.getSummary().toString()).isEqualTo( assertThat(mPreference.getSummary().toString()).isEqualTo(
RuntimeEnvironment.application.getString(R.string.summary_placeholder)); "Unavailable because airplane mode is turned on");
} }
@Test @Test