14

I am running Android 4.4.3 on my device and of course it has outdated time zones and I am trying to update the tzdata in /system/usr/share/zoneinfo. However replacing the file straight away does not update the time zone.

Since ICU keeps its own copy of the time zone data we have to replace that as well (according to Google AOSP team) . The updated data files are Update for ICU and Update for bionic

However, I when I build and replace the the icu4c libraries (libicui18n.so and libicuuc.so) and replace icudt51l.dat with icudt53l.dat, the system cannot initialize ICU.

I have tried unpacking the icudt53l.dat and pushing its *.res files inside old icudt51l.dat but that failed as well because ICUPKG tool checks the checksum of the res file before packing them.

I followed XDA link to update tzdata but that approach failed because they create zoneinfo.dat, zoneinfo.idx, zoneinfo.version files using tzdata. But the system looks for tzdata itself in /system/usr/share/zoneinfo

I am not a time zone or ICU expert, could you please point me if am looking in the wrong direction and help.

Mattia Maestrini
  • 32,270
  • 15
  • 87
  • 94
Robin Chander
  • 7,225
  • 3
  • 28
  • 42
  • Are you asking about updating the os, icu, or both? – Matt Johnson-Pint Oct 30 '15 at 16:42
  • I want to update the icu only, but if any other components of the OS are dependent on the ICU version, I don't mind updating the OS. – Robin Chander Oct 30 '15 at 17:08
  • Does [Updating the Time Zone Data](http://userguide.icu-project.org/datetime/timezone#TOC-Updating-the-Time-Zone-Data) from the ICU user guide answer your question? – Matt Johnson-Pint Oct 30 '15 at 17:29
  • I tried packaging the **metaZones.res, timezoneTypes.res, windowZones.res and zoneinfo64.res** nto the current icudt51l.dat I have on my device. Also changed the corresponding tzdata but still no effect. – Robin Chander Oct 30 '15 at 17:43
  • 1
    try this http://stackoverflow.com/questions/29583662/how-to-handle-jodatimes-and-androids-timezone-database-differences – Mohammad Hossein Gerami Nov 03 '15 at 03:19
  • FWIW - I'd like to see a definitive answer as well. I'd answer, but I'm not familiar enough with the specific implementation details within Android. – Matt Johnson-Pint Nov 03 '15 at 17:56

1 Answers1

4

It's not necessary to update ICU or Bionic, you can simply change the tzdata file with the updated one. Also you don't need to manually generate the file tzdata from the IANA time zone data. You can take the already builded tzdata from the bionic repo. You can find the update file to the last version of Time Zone Data v. 2015g here.

Once you download the file copy it on your device (e.g. /sdcard/Download/tzdata), then open a shell:

shell@maguro:/ $ su
shell@maguro:/ $ setprop persist.sys.timezone Europe/Istanbul
shell@maguro:/ $ date -s 20151106.130000
Fri Nov  6 13:00:00 EET 2015
root@maguro:/ # mount -o rw,remount /system
root@maguro:/ # cd /system/usr/share/zoneinfo/
root@maguro:/system/usr/share/zoneinfo # cp tzdata tzdata.bak
root@maguro:/system/usr/share/zoneinfo # cp /sdcard/Download/tzdata tzdata
root@maguro:/system/usr/share/zoneinfo # chmod 644 tzdata
root@maguro:/system/usr/share/zoneinfo # date
Fri Nov  6 14:00:47 EEST 2015

If after this it still doesn't work:

root@maguro:/ # cd /data/misc/zoneinfo/
root@maguro:/data/misc/zoneinfo # cp tzdata tzdata.bak
root@maguro:/data/misc/zoneinfo # cp /sdcard/Download/tzdata tzdata
root@maguro:/data/misc/zoneinfo # chmod 644 tzdata

As you can see with the updated tzdata the time zone of Europe/Istanbul on 6th November changes from EET to EEST because in v. 2015g the Turkey's DST fall-back moving from the 25th October to 8th November.

Mattia Maestrini
  • 32,270
  • 15
  • 87
  • 94
  • +1 I already replaced the tzdata a dozen times but never did the date command from adb. I noticed date moved back 1 hour for Moscow which is correct. However, Settings app still showed GMT+4 rather than GMT+3. I deleted dalvik-cache and now it shows GMT+3, never thought about this earlier. Do you know which system calls depend on the ICU though? – Robin Chander Nov 09 '15 at 15:31
  • 1
    Unfortunately I didn't find a list of system calls that depend on the ICU. I tried to make a quick search in the JAVA part of android repo and the only reference to ICU's timezone seems `TimeZoneNames` in [ZoneGetter.java](https://goo.gl/gkgOjv). In other places instead it uses directly the `tzdata` file, for example in [ZoneInfoDB.java](https://goo.gl/KL5qlF) – Mattia Maestrini Nov 09 '15 at 17:13