Giter Site home page Giter Site logo

android_system_timezone's Introduction

This directory contains code, tools and data related to time zone rules data
and updates.

Directory structure
===================

distro
  - Code related to "distros", the collection of files that can be used to
    update time zone rules on Android devices. See distro/README for details.

input_data
  - Contains files that provide inputs to the time zone rules update process.
    Some files come from external sources and some are mastered in Android.
    See also download-iana-data.py.

output_data
  - Contains some derived files from the time zone rules update process and
    used in the Android system image and distros. Some files are also held by
    ICU - see also update-tzdata.py

testing
  - Contains tools and scripts related to testing time zone update code. See
    testing/data/README for details.

tzdatacheck
  - Source code for a binary executed during boot and used to ensure that a
    device doesn't boot with incompatible/outdated time zone data installed
    /data (as could happen if the device has just received an OTA upgrade).
    It is also responsible for committing staged install/uninstalls.

zone_compactor
  - Used to create Android's native tzdata file format from the files
    produced by the zic tool. See also update-tzdata.py.


Data file update tools
======================

download-iana-data.py
  - A helper script run before update-tzdata.py.
    It downloads the latest tzdata update from IANA and puts it in
    the system/timezone/input_data/iana directory for use by the
    update-tzdata.py script.

update-tzdata.py
  - Regenerates the external/icu and system/timezone/output_data timezone
    data files.

See update instructions below for how these tools are used.

IANA rules data changes
=======================

When IANA release new time zone rules, the update process is:

1) Run download-iana-data.py to update the system/timezone/input_data/iana
  file.
2) Make manual modifications to system/timezone/input_data/android files as
  needed.
3) There are sometimes code and metadata changes associated with tzdata updates
  that should be applied to Android's copy of ICU.
  e.g. see http://bugs.icu-project.org/trac/search?q=2015d
4) Run update-tzdata.py to regenerate the system/timezone/output_data,
  system/timezone/testing/data, external/icu runtime files and testing equivalents.
5) Build/flash a device image with the changes and run CTS:
    cts-tradefed
    run cts -m CtsLibcoreTestCases
    run cts -m CtsIcuTestCases
   (And any others that you think may have been affected)
6) Upload, review, submit the changes from external/icu and system/timezone.

REMINDER: Any prebuilt apks of OEM-specific time zone data apps .apk files
(i.e. ones that that contain distro files) will also need to be regenerated
with a new version code / string and any OEM-specific tests should be run.


Distro Versioning
=================

The Android time zone "distro" is a zip archive containing the files needed
to update a device's time zone rules by overlaying files into locations in /
data. See distro/ for details.

The distro format (i.e. the files contained within the zip file) can change
between major releases as Android evolves or makes updates to components that
use the time zone data.

Distros have a major and minor format version number:

- Major format version numbers are mutually incompatible. e.g. v2 is not
  compatible with a v1 or a v3 device.
- Minor format version numbers are backwards compatible. e.g. a v2.2 distro
  will work on a v2.1 device but not a v2.3 device.
- The minor version is reset to 1 when the major version is incremented.

The most obvious/common change that can occur between Android releases is an
ICU upgrade, which currently requires a major format version increment: Android
uses the ICU4C's native format for both ICU4C and ICU4J time zone code which is
tied to the ICU major version. The main .dat file used by ICU is held in
external/icu and will naturally be updated when ICU is updated. Less obviously,
the distro code and files must be updated as well.

Other examples of changes that affect format versioning:

Major version increment:
- A non-backwards compatible change to the tzdata or tzlookup.xml files used
  by bionic / libcore.
- Removal of an existing file from the distro.

Minor version increment:
- Backwards compatible changes:
  - A new file in the distro.
  - Additional required data in an existing file (e.g. a backwards compatible
    change to tzdata / tzlookup.xml).


Changing the distro format version
----------------------------------

1) Modify distro/core/src/main/com/android/timezone/distro/DistroVersion.java:
  - CURRENT_FORMAT_MAJOR_VERSION, CURRENT_FORMAT_MINOR_VERSION
2) Modify: tzdatacheck/tzdatacheck.cpp
  - SUPPORTED_DISTRO_MAJOR_VERSION, SUPPORTED_DISTRO_MINOR_VERSION
3) Run update-tzdata.py to regenerate the system/timezone/output_data,
  system/timezone/testing/data, external/icu runtime files and testing equivalents.
4) Build/flash a device image with the changes and run CTS:
    cts-tradefed
    run cts -m CtsHostTzDataTests
    run cts -m CtsLibcoreTestCases
5) Run non-CTS test cases:
    make -j30 FrameworksServicesTests
    adb install -r -g \
        "${ANDROID_PRODUCT_OUT}/data/app/FrameworksServicesTests/FrameworksServicesTests.apk"
    adb shell am instrument -e package com.android.server.timezone -w \
        com.android.frameworks.servicestests \
        "com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner"
6) Upload, review, submit the changes from system/timezone.

REMINDER: Any prebuilt apks of OEM-specific time zone data apps .apk files
(i.e. ones that that contain distro files) will also need to be regenerated
with a new version code / string and any OEM-specific tests should be run.

android_system_timezone's People

Contributors

15characterlimi avatar colincross avatar delphij avatar gvictor avatar haggertk avatar luca020400 avatar nfuller avatar roubert avatar yqwed avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.