summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2017-01-14 00:09:07 +0100
committerandroid-build-merger <android-build-merger@google.com>2017-01-14 00:09:07 +0100
commite05674f93e54a14f982e64adc90b7b75f48f4a73 (patch)
tree3d9523b89e4fca5c538011e954309709409e9893 /tools
parentMerge changes from topic 'host_suffix_cleanup' am: 8031c2d2bb (diff)
parentMerge "Update background text images in recovery" (diff)
downloadandroid_bootable_recovery-e05674f93e54a14f982e64adc90b7b75f48f4a73.tar
android_bootable_recovery-e05674f93e54a14f982e64adc90b7b75f48f4a73.tar.gz
android_bootable_recovery-e05674f93e54a14f982e64adc90b7b75f48f4a73.tar.bz2
android_bootable_recovery-e05674f93e54a14f982e64adc90b7b75f48f4a73.tar.lz
android_bootable_recovery-e05674f93e54a14f982e64adc90b7b75f48f4a73.tar.xz
android_bootable_recovery-e05674f93e54a14f982e64adc90b7b75f48f4a73.tar.zst
android_bootable_recovery-e05674f93e54a14f982e64adc90b7b75f48f4a73.zip
Diffstat (limited to 'tools')
-rw-r--r--tools/recovery_l10n/src/com/android/recovery_l10n/Main.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/tools/recovery_l10n/src/com/android/recovery_l10n/Main.java b/tools/recovery_l10n/src/com/android/recovery_l10n/Main.java
index ac94bde1c..30d45f6ae 100644
--- a/tools/recovery_l10n/src/com/android/recovery_l10n/Main.java
+++ b/tools/recovery_l10n/src/com/android/recovery_l10n/Main.java
@@ -38,6 +38,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.Locale;
@@ -148,11 +149,28 @@ public class Main extends Activity {
mText = (TextView) findViewById(R.id.text);
String[] localeNames = getAssets().getLocales();
- Arrays.sort(localeNames);
+ Arrays.sort(localeNames, new Comparator<String>() {
+ // Override the string comparator so that en is sorted behind en_US.
+ // As a result, en_US will be matched first in recovery.
+ @Override
+ public int compare(String s1, String s2) {
+ if (s1.equals(s2)) {
+ return 0;
+ } else if (s1.startsWith(s2)) {
+ return -1;
+ } else if (s2.startsWith(s1)) {
+ return 1;
+ }
+ return s1.compareTo(s2);
+ }
+ });
+
ArrayList<Locale> locales = new ArrayList<Locale>();
for (String localeName : localeNames) {
Log.i(TAG, "locale = " + localeName);
- locales.add(Locale.forLanguageTag(localeName));
+ if (!localeName.isEmpty()) {
+ locales.add(Locale.forLanguageTag(localeName));
+ }
}
final Runnable seq = buildSequence(locales.toArray(new Locale[0]));