From d2a3075106f700f229750c228de989b789b7dacd Mon Sep 17 00:00:00 2001 From: Neil Fuller <nfuller@google.com> Date: Mon, 1 Jun 2015 17:12:38 +0100 Subject: Configure ICU4C without relying on build-time flags The presence of the build-time flags appears to cause ICU4C to open the .dat file again as a fallback if it fails to find a config value. This is even though the .dat file is explicitly mapped using udata_setCommonData(). Bug: 19960867 Bug: 19961406 (cherry-picked from commit 79fdcc64ea2d9234f258dac57f04b1017a573311) Change-Id: I03f0f2d661dd2de2b0db085519159f7deb60816d --- luni/src/main/native/libcore_icu_ICU.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'luni/src') diff --git a/luni/src/main/native/libcore_icu_ICU.cpp b/luni/src/main/native/libcore_icu_ICU.cpp index 0e744b7..d092978 100644 --- a/luni/src/main/native/libcore_icu_ICU.cpp +++ b/luni/src/main/native/libcore_icu_ICU.cpp @@ -890,9 +890,14 @@ void register_libcore_icu_ICU(JNIEnv* env) { } // Use the ICU data files that shipped with the device for everything else. + const char* systemPathPrefix = getenv("ANDROID_ROOT"); + if (systemPathPrefix == NULL) { + ALOGE("ANDROID_ROOT environment variable not set"); \ + abort(); + } std::string systemPath; - systemPath = u_getDataDirectory(); - systemPath += "/"; + systemPath = systemPathPrefix; + systemPath += "/usr/icu/"; systemPath += U_ICUDATA_NAME; systemPath += ".dat"; -- cgit v1.1