Create a string for private DNS "On"

The last private DNS settings screen landed in P after string
freeze, which led us to reuse R.string.switch_on_text for the
"on" text when private DNS is active. That string comes from
notifications. Private DNS should have its own string for this
instead.

Bug: 79122154
Test: 1. Build pass
      2. make -j44 RunSettingsRoboTests \
      ROBOTEST_FILTER=PrivateDnsPreferenceControllerTest

Change-Id: Ie013a858c8bc41e00a1b940d02efa2b605991685
This commit is contained in:
lucaslin
2019-07-23 19:40:09 +08:00
parent 0c7e805902
commit be8701bca5
3 changed files with 4 additions and 6 deletions

View File

@@ -2362,6 +2362,8 @@
<string name="emergency_address_summary">Used as your location when you make an emergency call over Wi\u2011Fi</string> <string name="emergency_address_summary">Used as your location when you make an emergency call over Wi\u2011Fi</string>
<!-- Message of private dns that provides a help link. [CHAR LIMIT=NONE] --> <!-- Message of private dns that provides a help link. [CHAR LIMIT=NONE] -->
<string name="private_dns_help_message"><annotation id="url">Learn more</annotation> about Private DNS features</string> <string name="private_dns_help_message"><annotation id="url">Learn more</annotation> about Private DNS features</string>
<!-- Message to display when private dns is on. [CHAR LIMIT=10] -->
<string name="private_dns_mode_on">On</string>
<!-- Message to display when setting wifi calling are not editable [CHAR LIMIT=NONE] --> <!-- Message to display when setting wifi calling are not editable [CHAR LIMIT=NONE] -->
<string name="wifi_calling_pref_managed_by_carrier">Setting managed by carrier</string> <string name="wifi_calling_pref_managed_by_carrier">Setting managed by carrier</string>

View File

@@ -119,11 +119,7 @@ public class PrivateDnsPreferenceController extends BasePreferenceController
case PRIVATE_DNS_MODE_OFF: case PRIVATE_DNS_MODE_OFF:
return res.getString(R.string.private_dns_mode_off); return res.getString(R.string.private_dns_mode_off);
case PRIVATE_DNS_MODE_OPPORTUNISTIC: case PRIVATE_DNS_MODE_OPPORTUNISTIC:
// TODO (b/79122154) : create a string specifically for this, instead of return dnsesResolved ? res.getString(R.string.private_dns_mode_on)
// hijacking a string from notifications. This is necessary at this time
// because string freeze is in the past and this string has the right
// content at this moment.
return dnsesResolved ? res.getString(R.string.switch_on_text)
: res.getString(R.string.private_dns_mode_opportunistic); : res.getString(R.string.private_dns_mode_opportunistic);
case PRIVATE_DNS_MODE_PROVIDER_HOSTNAME: case PRIVATE_DNS_MODE_PROVIDER_HOSTNAME:
return dnsesResolved return dnsesResolved

View File

@@ -186,7 +186,7 @@ public class PrivateDnsPreferenceControllerTest {
when(lp.getValidatedPrivateDnsServers()).thenReturn(NON_EMPTY_ADDRESS_LIST); when(lp.getValidatedPrivateDnsServers()).thenReturn(NON_EMPTY_ADDRESS_LIST);
updateLinkProperties(lp); updateLinkProperties(lp);
mController.updateState(mPreference); mController.updateState(mPreference);
verify(mPreference).setSummary(getResourceString(R.string.switch_on_text)); verify(mPreference).setSummary(getResourceString(R.string.private_dns_mode_on));
reset(mPreference); reset(mPreference);
lp = mock(LinkProperties.class); lp = mock(LinkProperties.class);