Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update android time zone data

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.

like image 838
Robin Chander Avatar asked Oct 30 '15 15:10

Robin Chander


1 Answers

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.

like image 53
Mattia Maestrini Avatar answered Sep 20 '22 16:09

Mattia Maestrini