README.android 5.6 KB

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