Allow alternative time zone ID to be set device's zone.
If America/Godthab is set as device time zone, display it as if America/Nuuk is chosen. If time zone is known, but is not an alternative and not shown in time zone picker, region will de derived from user's locale. Bug: 155738410 Test: atest com.android.settings.datetime.timezone.model Test: set persist.sys.timezone via adb and checked Date & Time screen Change-Id: I168fb4319e144dbe9e2496d06a681d4c09b411c0
This commit is contained in:
@@ -92,4 +92,23 @@ public class TimeZoneDataTest {
|
||||
.containsExactly("US", "GB");
|
||||
assertThat(timeZoneData.lookupCountryCodesForZoneId("Unknown/Secret_City2")).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lookupCountryCodesForNonCanonicalZoneId_returnsCurrentZone() {
|
||||
TimeZoneData timeZoneData = new TimeZoneData(mCountryZonesFinder);
|
||||
|
||||
CountryTimeZones greenland = mock(CountryTimeZones.class);
|
||||
when(greenland.getCountryIso()).thenReturn("gl");
|
||||
when(greenland.getTimeZoneMappings()).thenReturn(Arrays.asList(
|
||||
TimeZoneMapping.createForTests(
|
||||
"America/Nuuk",
|
||||
true /* showInPicker */,
|
||||
null /* notUsedAfter */,
|
||||
Arrays.asList("America/Godthab"))));
|
||||
when(mCountryZonesFinder.lookupCountryTimeZonesForZoneId("America/Godthab"))
|
||||
.thenReturn(Arrays.asList(greenland));
|
||||
|
||||
assertThat(timeZoneData.lookupCountryCodesForZoneId("America/Godthab"))
|
||||
.containsExactly("GL");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user