diff options
Diffstat (limited to 'icu4j/main')
-rw-r--r-- | icu4j/main/core/src/main/java/com/ibm/icu/platform/AndroidDataFiles.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/platform/AndroidDataFiles.java b/icu4j/main/core/src/main/java/com/ibm/icu/platform/AndroidDataFiles.java index 385222dc1..be0bf136b 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/platform/AndroidDataFiles.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/platform/AndroidDataFiles.java @@ -36,15 +36,25 @@ public class AndroidDataFiles { public static final String ANDROID_I18N_ROOT_ENV = "ANDROID_I18N_ROOT"; public static final String ANDROID_TZDATA_ROOT_ENV = "ANDROID_TZDATA_ROOT"; + /** + * This is identical to + * {@link com.android.i18n.timezone.TzDataSetVersion#CURRENT_FORMAT_MAJOR_VERSION}, but because + * dependency is in the opposite direction we can't refer to that field from this class. + * TzDataSetVersionTest ensures that their values are the same. + */ // VisibleForTesting - public static String getTimeZoneModuleIcuFile(String fileName) { - return getTimeZoneModuleFile("icu/" + fileName); - } + // LINT.IfChange + public static final int CURRENT_MAJOR_VERSION = 8; + // LINT.ThenChange(external/icu/android_icu4j/libcore_bridge/src/java/com/android/i18n/timezone/TzDataSetVersion.java) private static String getTimeZoneModuleFile(String fileName) { return System.getenv(ANDROID_TZDATA_ROOT_ENV) + "/etc/" + fileName; } + private static String getTimeZoneModuleIcuFile(String fileName) { + return getTimeZoneModuleFile("tz/versioned/" + CURRENT_MAJOR_VERSION + "/icu/" + fileName); + } + // VisibleForTesting public static String getI18nModuleIcuFile(String fileName) { return getI18nModuleFile("icu/" + fileName); @@ -55,13 +65,13 @@ public class AndroidDataFiles { } public static String generateIcuDataPath() { - List<String> paths = new ArrayList<>(3); + List<String> paths = new ArrayList<>(2); // Note: This logic below should match the logic in IcuRegistration.cpp in external/icu/ // to ensure consistent behavior between ICU4C and ICU4J. // ICU should look for a mounted time zone module file in /apex. This is used for - // (optional) time zone data that can be updated with an APEX file. + // time zone data that can be updated with an APEX file. String timeZoneModuleIcuDataPath = getTimeZoneModuleIcuFile(""); paths.add(timeZoneModuleIcuDataPath); |