Update time_zones_by_country.xml / delete unused files
preferred_time_zones.xml is not referenced in any code and has been deleted here. TimeUtilsTest.java is broken / out of date and semi-duplicates code in android.util.cts.TimeUtilsTest. It has been deleted here. time_zones_by_country.xml file has not been updated since (at least) 2009. Ideally this information would be updated as needed when the timezone rule data is updated on device. This change just brings the data up to date without addressing that issue. Given the apparent, non-obvious, ordering requirements it may not be possible to use zone1970.tab data directly. --------------- Impact assessment: At the time of writing time_zones_by_country.xml is used from: Non-public methods: android.util.TimeUtils.getTimeZones(String) Public methods: android.util.TimeUtils.getTimeZone(int, boolean, long, String) android.util.TimeUtils.getTimeZonesWithUniqueOffsets(String) Therefore there is some app / user benefit from updating it. Within the framework, this affects: telephony.ServiceStateTracker - in some circumstances when receiving offset information from cell networks when better information is not available. There is some clockwork code affected that uses the calls for similar purposes. --------------- Notes on file formats / mapping the IANA source data: The updated data was sourced from the IANA tzdata 2016g file called zone1970.tab. The time_zones_by_country.xml file was manually edited in a text editor using criteria detailed below. The zone1970.tab file maps country codes (column 1) to a zone ID (column 3). A country can be mapped to multiple zones. The zone.tab file that was likely used in the past is similar in content and format. See the zone.tab file header for details of the differences. The time_zones_by_country.xml can have multiple entries for each country, starting with a comment. Comments exist for each (Country, Offset) pair. The name is free-text, the offset is a non-DST offset for a zone as of 14th Oct 2016 using the 2016g data. <!-- {Country name}, {offset from UTC} --> Countries are listed in ASCII ascending order of the country code. Within each country offsets are mostly ordered east to west. An exception appears to be Australia. The data may have a secondary order of "best match" (e.g. maybe by population). This might be important for getTimeZone(int, boolean, long, String)) since it returns the first match for a given offset, dst, country. The timezone offset, transition information itself (offset, dst) is pulled from the timezone rules data on the device, not this file. The data is encoded for each (Country, Offset) pair by a sequence of: <timezone code="xx">{Olson ID}</timezone> xx is the country code from column 1 in the zone1970.tab file, the element content is the zone ID from column 3. --------------- Notes on the changes made to time_zones_by_country.xml: There are various changes in this commit associated with switching from zone.tab to zone1970.tab as a data source: zone.tab uses different Olson IDs due to the different criteria used by these files. The offset in each case will be the same so will have no practical effect on offsets / zone detection, though will affect the exemplar location for the zone found. The remaining changes reflect actual zone / offset changes that have occurred. When adding new zones or rearranging existing ones they have been positioned so as not to modify the first zone for each country or the first zone per offset because of the uncertainty about the secondary ordering. This is to avoid the risk of now picking a different zone for a country or {country + dst + offset}. This has resulted in a couple of places where the ordering is non-intuitive. The zone names and the offset information contained in the comments was checked semi-manually using other 2016g data, i.e. the base offset of each zone was checked against output from a script that created a TimeZone object from each Olson ID in the file and output the raw (non-DST) offset. --------------- Change specifics: Changes made due to zone1970.tab vs zone.tab: ANTIGUA AND BARBUDA ANGUILLA ANGOLA ALAND ISLANDS ARUBA BOSNIA AND HERZEGOVINA BURKINA FASO BAHRAIN BENIN BOTSWANA CONGO CENTRAL AFRICAN REPUBLIC CONGO CAMEROON DJIBOUTI DOMINICA ERITREA ETHIOPIA GABON GRENADA GUERNSEY GAMBIA GUINEA GUADELOUPE EQUATORIAL GUINEA CROATIA ISLE OF MAN JERSEY CAMBODIA COMOROS SAINT KITTS AND NEVIS KUWAIT CAYMAN ISLANDS LAO PEOPLE'S DEMOCRATIC REPUBLIC SAINT LUCIA LIECHTENSTEIN LESOTHO MONTENEGRO MADAGASCAR MACEDONIA MALI NORTHERN MARIANA ISLANDS MAURITANIA MONTSERRAT MALAWI NIGER OMAN RWANDA SAINT HELENA SLOVENIA SVALBARD AND JAN MAYEN SLOVAKIA SIERRA LEONE SAN MARINO SENEGAL SOMALIA SAO TOME AND PRINCIPE SWAZILAND TOGO TANZANIA UGANDA UNITED STATES MINOR OUTLYING ISLANDS HOLY SEE SAINT VINCENT AND THE GRENADINES VIRGIN ISLANDS YEMEN MAYOTTE ZAMBIA ZIMBABWE --------- Changes due to new data: ANTARCTICA ARGENTINA AUSTRALIA BRAZIL CANADA CHINA MICRONESIA INDIA MYANMAR MEXICO PAPUA NEW GUINEA PALESTINE RUSSIAN FEDERATION UNITED STATES UKRAINE --------- Removal of NETHERLANDS ANTILLES (country code "an"): "an" no longer present in the IANA data. The country code is no longer in use. https://en.wikipedia.org/wiki/ISO_3166-2:AN New country entries for: Saint Barthélemy Caribbean Netherlands Curaçao Collectivity of Saint Martin Sint Maarten --------- Changes due to new data *and* with differences between zone1970.tab and zone.tab: GERMANY South Sudan (entirely new) VIET NAM FRENCH SOUTHERN TERRITORIES --------- Changes to comments or arrangement of existing entries due to non-DST offset changes since the last update: Antarctica/Mawson Europe/Minsk America/Resolute Atlantic/Stanley Asia/Pyongyang America/Cancun America/Grand_Turk Pacific/Fakaofo Europe/Istanbul America/Caracas Pacific/Apia Bug: 25338903 Test: Build / CtsUtilTestCases Change-Id: I87e3db795f55ddd92e7402459c5e97aa70b9301e
Loading
Please register or sign in to comment