Chromium Code Reviews| Index: base/android/java/src/org/chromium/base/ResourceExtractor.java |
| diff --git a/base/android/java/src/org/chromium/base/ResourceExtractor.java b/base/android/java/src/org/chromium/base/ResourceExtractor.java |
| index 807fbb3c693725384f25e810bea4c2d11c275d2b..3dc0ce8690f14c536258b43310b5706c2502410e 100644 |
| --- a/base/android/java/src/org/chromium/base/ResourceExtractor.java |
| +++ b/base/android/java/src/org/chromium/base/ResourceExtractor.java |
| @@ -8,7 +8,9 @@ import android.content.SharedPreferences; |
| import android.content.pm.PackageInfo; |
| import android.content.pm.PackageManager; |
| import android.os.AsyncTask; |
| +import android.os.Build; |
| import android.os.Handler; |
| +import android.os.LocaleList; |
| import android.os.Looper; |
| import java.io.File; |
| @@ -173,14 +175,31 @@ public class ResourceExtractor { |
| } |
| private static String[] detectFilesToExtract() { |
| - Locale defaultLocale = Locale.getDefault(); |
| - String language = LocaleUtils.getUpdatedLanguageForChromium(defaultLocale.getLanguage()); |
| + ArrayList<String> languages = new ArrayList<>(); |
| + Locale defaultLocale; |
|
ksk1
2016/11/08 09:38:02
Please declare defaultLocale and localeLanguage in
Yirui Huang
2016/11/08 10:39:31
File reverted to the previous version.
|
| + String localeLanguage; |
| + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { |
|
ksk1
2016/11/08 09:38:02
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
Yirui Huang
2016/11/08 10:39:31
File reverted to the previous version.
|
| + defaultLocale = Locale.getDefault(); |
| + localeLanguage = LocaleUtils.getUpdatedLanguageForChromium(defaultLocale.getLanguage()); |
| + languages.add(localeLanguage); |
| + } else { |
| + LocaleList localeList = LocaleList.getDefault(); |
|
Seigo Nonaka
2016/11/08 09:31:11
I think we should use LocaleList.getAdjustedDefaul
Yirui Huang
2016/11/08 10:39:31
File reverted to the previous version.
|
| + for (int i = 0; i < localeList.size(); i++) { |
|
ksk1
2016/11/08 09:38:02
for (Locale defaultLocale : localeList) {
}
Yirui Huang
2016/11/08 10:39:31
File reverted to the previous version.
|
| + defaultLocale = localeList.get(i); |
| + localeLanguage = |
| + LocaleUtils.getUpdatedLanguageForChromium(defaultLocale.getLanguage()); |
| + languages.add(localeLanguage); |
| + } |
| + } |
| + |
| // Currenty (Oct 2016), this array can be as big as 4 entries, so using a capacity |
|
ksk1
2016/11/08 09:38:02
Is this comment still correct?
Yirui Huang
2016/11/08 10:39:31
File reverted to the previous version.
|
| // that allows a bit of growth, but is still in the right ballpark.. |
| ArrayList<String> activeLocalePakFiles = new ArrayList<String>(6); |
| for (String locale : BuildConfig.COMPRESSED_LOCALES) { |
| - if (locale.startsWith(language)) { |
| - activeLocalePakFiles.add(locale + ".pak"); |
| + for (String language : languages) { |
| + if (locale.startsWith(language)) { |
| + activeLocalePakFiles.add(locale + ".pak"); |
| + } |
| } |
| } |
| return activeLocalePakFiles.toArray(new String[activeLocalePakFiles.size()]); |