Find tzdata in the runtime module before /system
Look for the tzdata file in the runtime module before looking
in /system. It is still an open question how the removal of
tzdata will be handled, if at all. Until it is worked out it
will be duplicated.
Bug: 119293618
Bug: 119390260
Test: build / boot
Change-Id: I7e14ef41d0ec226caa595c56be61df5ecf50c382
diff --git a/libc/tzcode/bionic.cpp b/libc/tzcode/bionic.cpp
index ee835b2..cb9c359 100644
--- a/libc/tzcode/bionic.cpp
+++ b/libc/tzcode/bionic.cpp
@@ -200,15 +200,29 @@
int fd;
#if defined(__ANDROID__)
- // On Android, try the three hard-coded locations.
+ // On Android devices, try the four hard-coded locations in order.
+ //
+ // 1: The O-MR1 time zone updates via APK update mechanism. This is
+ // tried first because it allows us to test that the time zone updates
+ // via APK mechanism still works even on devices with the time zone
+ // module.
fd = __bionic_open_tzdata_path("/data/misc/zoneinfo/current/tzdata",
olson_id, entry_length);
if (fd >= 0) return fd;
+ // 2: The time zone data module which may contain newer data on
+ // devices that support module updates.
fd = __bionic_open_tzdata_path("/apex/com.android.tzdata/etc/tz/tzdata",
olson_id, entry_length);
if (fd >= 0) return fd;
+ // 3: The runtime module, which should exist even on devices that
+ // do not support APEX file updates.
+ fd = __bionic_open_tzdata_path("/apex/com.android.runtime/etc/tz/tzdata",
+ olson_id, entry_length);
+ if (fd >= 0) return fd;
+
+ // 4: The ultimate fallback: the non-updatable copy in /system.
fd = __bionic_open_tzdata_path("/system/usr/share/zoneinfo/tzdata",
olson_id, entry_length);
if (fd >= 0) return fd;