Remove bionic refs to runtime module tz files
The tzdata file is being removed from the runtime mainline module in an upcoming commit. This commit removes the bionic references to it. This commit also contains general comment tidy-ups. Bug: 132168458 Test: build only Change-Id: I83cd9ff756b36e1d1222b7830f97c8bde2885ce4
This commit is contained in:
parent
1069236349
commit
41636ca1ac
|
@ -199,37 +199,36 @@ static int __bionic_open_tzdata_path(const char* path,
|
||||||
int __bionic_open_tzdata(const char* olson_id, int32_t* entry_length) {
|
int __bionic_open_tzdata(const char* olson_id, int32_t* entry_length) {
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
// Try the three locations for the tzdata file in a strict order:
|
||||||
// On Android devices, try the four hard-coded locations in order.
|
|
||||||
//
|
|
||||||
// 1: The O-MR1 time zone updates via APK update mechanism. This is
|
// 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
|
// 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
|
// via APK mechanism still works even on devices with the time zone
|
||||||
// module.
|
// module.
|
||||||
|
// 2: The time zone data module which contains the main copy. This is the
|
||||||
|
// common case.
|
||||||
|
// 3: The ultimate fallback: the non-updatable copy in /system.
|
||||||
|
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
// On Android devices, bionic has to work even if exec takes place without
|
||||||
|
// environment variables set. So, all paths are hardcoded here.
|
||||||
|
|
||||||
fd = __bionic_open_tzdata_path("/data/misc/zoneinfo/current/tzdata",
|
fd = __bionic_open_tzdata_path("/data/misc/zoneinfo/current/tzdata",
|
||||||
olson_id, entry_length);
|
olson_id, entry_length);
|
||||||
if (fd >= 0) return fd;
|
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",
|
fd = __bionic_open_tzdata_path("/apex/com.android.tzdata/etc/tz/tzdata",
|
||||||
olson_id, entry_length);
|
olson_id, entry_length);
|
||||||
if (fd >= 0) return fd;
|
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",
|
fd = __bionic_open_tzdata_path("/system/usr/share/zoneinfo/tzdata",
|
||||||
olson_id, entry_length);
|
olson_id, entry_length);
|
||||||
if (fd >= 0) return fd;
|
if (fd >= 0) return fd;
|
||||||
#else
|
#else
|
||||||
// On the host, we don't expect those locations to exist, and we're not
|
// On the host, we don't expect the hard-coded locations above to exist, and
|
||||||
// worried about security so we trust $ANDROID_DATA, $ANDROID_RUNTIME_ROOT,
|
// we're not worried about security so we trust $ANDROID_DATA,
|
||||||
// $ANDROID_TZDATA_ROOT, and $ANDROID_ROOT to point us in the right direction.
|
// $ANDROID_TZDATA_ROOT, and $ANDROID_ROOT to point us in the right direction
|
||||||
|
// instead.
|
||||||
|
|
||||||
char* path = make_path("ANDROID_DATA", "/misc/zoneinfo/current/tzdata");
|
char* path = make_path("ANDROID_DATA", "/misc/zoneinfo/current/tzdata");
|
||||||
fd = __bionic_open_tzdata_path(path, olson_id, entry_length);
|
fd = __bionic_open_tzdata_path(path, olson_id, entry_length);
|
||||||
free(path);
|
free(path);
|
||||||
|
@ -240,11 +239,6 @@ int __bionic_open_tzdata(const char* olson_id, int32_t* entry_length) {
|
||||||
free(path);
|
free(path);
|
||||||
if (fd >= 0) return fd;
|
if (fd >= 0) return fd;
|
||||||
|
|
||||||
path = make_path("ANDROID_RUNTIME_ROOT", "/etc/tz/tzdata");
|
|
||||||
fd = __bionic_open_tzdata_path(path, olson_id, entry_length);
|
|
||||||
free(path);
|
|
||||||
if (fd >= 0) return fd;
|
|
||||||
|
|
||||||
path = make_path("ANDROID_ROOT", "/usr/share/zoneinfo/tzdata");
|
path = make_path("ANDROID_ROOT", "/usr/share/zoneinfo/tzdata");
|
||||||
fd = __bionic_open_tzdata_path(path, olson_id, entry_length);
|
fd = __bionic_open_tzdata_path(path, olson_id, entry_length);
|
||||||
free(path);
|
free(path);
|
||||||
|
|
Loading…
Reference in New Issue