Commit 8aabaeef authored by Alexander Martinz's avatar Alexander Martinz Committed by Michael Bestas

Localization: do not use private ICU APIs

Instead of using private ICU APIs for checking, if the ICU's version
has been updated, use the android sdk version.

It is safe to assume, that ICU version does not change randomly and if
then only on major Android version upgrades.

Change-Id: Ia348a5597aa472d44b766b869a31a3935723f210
Signed-off-by: default avatarAlexander Martinz <amartinz@shiftphones.com>
parent 246354f8
......@@ -18,6 +18,7 @@ package org.lineageos.eleven.locale;
import android.content.Context;
import android.support.annotation.VisibleForTesting;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
......@@ -25,8 +26,6 @@ import org.lineageos.eleven.provider.PropertiesStore;
import java.util.Locale;
import libcore.icu.ICU;
public class LocaleSetManager {
private static final String TAG = LocaleSetManager.class.getSimpleName();
......@@ -57,9 +56,9 @@ public class LocaleSetManager {
// if our icu version has changed, return true
final String storedICUversion = PropertiesStore.getInstance(mContext)
.getProperty(PropertiesStore.DbProperties.ICU_VERSION);
if (!ICU.getIcuVersion().equals(storedICUversion)) {
if (!String.valueOf(Build.VERSION.SDK_INT).equals(storedICUversion)) {
Log.d(TAG, "ICU version has changed from: " + storedICUversion + " to "
+ ICU.getIcuVersion());
+ String.valueOf(Build.VERSION.SDK_INT));
return true;
}
......
......@@ -19,6 +19,7 @@ import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
......@@ -38,8 +39,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import libcore.icu.ICU;
/**
* Because sqlite localized collator isn't sufficient, we need to store more specialized logic
* into our own db similar to contacts db. This is most noticeable in languages like Chinese,
......@@ -178,8 +177,10 @@ public class LocalizedStore {
// Update the ICU version used to generate the locale derived data
// so we can tell when we need to rebuild with new ICU versions.
// But assume that ICU versions are only able to change on Android version upgrades and
// use SDK INT as identifier.
PropertiesStore.getInstance(mContext).storeProperty(
PropertiesStore.DbProperties.ICU_VERSION, ICU.getIcuVersion());
PropertiesStore.DbProperties.ICU_VERSION, String.valueOf(Build.VERSION.SDK_INT));
PropertiesStore.getInstance(mContext).storeProperty(PropertiesStore.DbProperties.LOCALE,
locales.toString());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment