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:
Almaz Mingaleev
2021-03-25 15:22:30 +00:00
parent d3db03b520
commit dd2a685756
7 changed files with 64 additions and 27 deletions

View File

@@ -43,7 +43,7 @@ public class TimeZoneDataTest {
FilteredCountryTimeZones countryTimeZones =
mTimeZoneData.lookupCountryTimeZones(regionId);
assertThat(countryTimeZones).isNotNull();
assertThat(countryTimeZones.getTimeZoneIds().size()).isGreaterThan(0);
assertThat(countryTimeZones.getPreferredTimeZoneIds().size()).isGreaterThan(0);
}
}
@@ -54,11 +54,8 @@ public class TimeZoneDataTest {
1) because we specifically exclude it with the picker attribute, and
2) because it's the same as Moscow after Oct 2014.
*/
assertThat(mTimeZoneData.lookupCountryCodesForZoneId("Europe/Simferopol").isEmpty())
.isTrue();
assertThat(mTimeZoneData.lookupCountryCodesForZoneId("Europe/London").isEmpty())
.isFalse();
assertThat(mTimeZoneData.lookupCountryCodesForZoneId("America/Los_Angeles").isEmpty())
.isFalse();
assertThat(mTimeZoneData.lookupCountryCodesForZoneId("Europe/Simferopol")).isEmpty();
assertThat(mTimeZoneData.lookupCountryCodesForZoneId("Europe/London")).isNotEmpty();
assertThat(mTimeZoneData.lookupCountryCodesForZoneId("America/Los_Angeles")).isNotEmpty();
}
}