blob: 63157cdd34ccbdef55819127f09086d089eb90a5 [file] [log] [blame]
Neil Fuller3830d702017-08-18 17:03:59 +01001This directory contains code, tools and data related to time zone rules data
2and updates.
Neil Fuller86e72c52017-06-12 15:36:06 +01003
Neil Fuller3830d702017-08-18 17:03:59 +01004Directory structure
5===================
6
7distro
8 - Code related to "distros", the collection of files that can be used to
9 update time zone rules on Android devices. See distro/README for details.
10
11input_data
12 - Contains files that provide inputs to the time zone rules update process.
13 Some files come from external sources and some are mastered in Android.
14 See also download-iana-data.py.
15
16output_data
17 - Contains some derived files from the time zone rules update process and
18 used in the Android system image and distros. Some files are also held by
19 ICU - see also update-tzdata.py
20
21testing
22 - Contains tools and scripts related to testing time zone update code. See
23 testing/data/README for details.
24
25tzdatacheck
26 - Source code for a binary executed during boot and used to ensure that a
27 device doesn't boot with incompatible/outdated time zone data installed
28 /data (as could happen if the device has just received an OTA upgrade).
29 It is also responsible for committing staged install/uninstalls.
30
31zone_compactor
32 - Used to create Android's native tzdata file format from the files
33 produced by the zic tool. See also update-tzdata.py.
34
35
36Data file update tools
37======================
Neil Fuller86e72c52017-06-12 15:36:06 +010038
Neil Fuller56166d32017-06-12 12:57:10 +010039download-iana-data.py
40 - A helper script run before update-tzdata.py.
41 It downloads the latest tzdata update from IANA and puts it in
42 the system/timezone/input_data/iana directory for use by the
43 update-tzdata.py script.
44
Neil Fuller56166d32017-06-12 12:57:10 +010045update-tzdata.py
Neil Fuller35467e12017-06-12 16:55:44 +010046 - Regenerates the external/icu and system/timezone/output_data timezone
47 data files.
Neil Fuller56166d32017-06-12 12:57:10 +010048
Neil Fuller3830d702017-08-18 17:03:59 +010049See update instructions below for how these tools are used.
50
51IANA rules data changes
52=======================
53
54When IANA release new time zone rules, the update process is:
55
561) Run download-iana-data.py to update the system/timezone/input_data/iana
57 file.
582) Make manual modifications to system/timezone/input_data/android files as
59 needed.
603) There are sometimes code and metadata changes associated with tzdata updates
61 that should be applied to Android's copy of ICU.
62 e.g. see http://bugs.icu-project.org/trac/search?q=2015d
634) Run update-tzdata.py to regenerate the system/timezone/output_data,
64 system/timezone/testing/data and external/icu runtime files.
655) Regenerate test data files by running:
66 cd testing/data
67 ./create-test-data.sh
686) Build/flash a device image with the changes and run CTS:
69 cts-tradefed
70 run cts -m CtsLibcoreTestCases
71 run cts -m CtsIcuTestCases
72 (And any others that you think may have been affected)
737) Upload, review, submit the changes from external/icu and system/timezone.
74
75REMINDER: Any prebuilt apks of OEM-specific time zone data apps .apk files
76(i.e. ones that that contain distro files) will also need to be regenerated
77with a new version code / string and any OEM-specific tests should be run.
78
79
80Distro Versioning
81=================
82
83The Android time zone "distro" is a zip archive containing the files needed
84to update a device's time zone rules by overlaying files into locations in /
85data. See distro/ for details.
86
87The distro format (i.e. the files contained within the zip file) can change
88between major releases as Android evolves or makes updates to components that
89use the time zone data.
90
91Distros have a major and minor format version number:
92
93- Major format version numbers are mutually incompatible. e.g. v2 is not
94 compatible with a v1 or a v3 device.
95- Minor format version numbers are backwards compatible. e.g. a v2.2 distro
96 will work on a v2.1 device but not a v2.3 device.
97- The minor version is reset to 1 when the major version is incremented.
98
99The most obvious/common change that can occur between Android releases is an
100ICU upgrade, which currently requires a major format version increment: Android
101uses the ICU4C's native format for both ICU4C and ICU4J time zone code which is
102tied to the ICU major version. The main .dat file used by ICU is held in
103external/icu and will naturally be updated when ICU is updated. Less obviously,
104the distro code and files must be updated as well.
105
106Other examples of changes that affect format versioning:
107
108Major version increment:
109- A non-backwards compatible change to the tzdata or tzlookup.xml files used
110 by bionic / libcore.
111- Removal of an existing file from the distro.
112
113Minor version increment:
114- Backwards compatible changes:
115 - A new file in the distro.
116 - Additional required data in an existing file (e.g. a backwards compatible
117 change to tzdata / tzlookup.xml).
118
119
120Changing the distro format version
121----------------------------------
122
1231) Modify distro/core/src/main/com/android/timezone/distro/DistroVersion.java:
124 - CURRENT_FORMAT_MAJOR_VERSION, CURRENT_FORMAT_MINOR_VERSION
1252) Modify: tzdatacheck/tzdatacheck.cpp
126 - SUPPORTED_DISTRO_MAJOR_VERSION, SUPPORTED_DISTRO_MINOR_VERSION
1273) Run update-tzdata.py to regenerate the system/timezone/output_data,
128 system/timezone/testing/data and external/icu runtime files.
1294) Regenerate test data files by running:
130 cd testing/data
131 ./create-test-data.sh
1325) Build/flash a device image with the changes and run CTS:
133 cts-tradefed
134 run cts -m CtsHostTzDataTests
135 run cts -m CtsLibcoreTestCases
1366) Run non-CTS test cases:
137 make -j30 FrameworksServicesTests
138 adb install -r -g \
139 "${ANDROID_PRODUCT_OUT}/data/app/FrameworksServicesTests/FrameworksServicesTests.apk"
140 adb shell am instrument -e package com.android.server.timezone -w \
141 com.android.frameworks.servicestests \
142 "com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner"
1437) Upload, review, submit the changes from system/timezone.
144
145REMINDER: Any prebuilt apks of OEM-specific time zone data apps .apk files
146(i.e. ones that that contain distro files) will also need to be regenerated
147with a new version code / string and any OEM-specific tests should be run.
Neil Fuller86e72c52017-06-12 15:36:06 +0100148