aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorTianjie Xu2017-01-06 13:44:40 -0600
committerTianjie Xu2017-01-06 18:32:40 -0600
commita78b2d22568d47492ba937fde87e6c6996a995a4 (patch)
treee109709f07515eaea41bc72b46b6eacabf66389b /tools
parent095675a3eb81fc32b73085a2e0dc0d963ce71a9e (diff)
downloadplatform-bootable-recovery-a78b2d22568d47492ba937fde87e6c6996a995a4.tar.gz
platform-bootable-recovery-a78b2d22568d47492ba937fde87e6c6996a995a4.tar.xz
platform-bootable-recovery-a78b2d22568d47492ba937fde87e6c6996a995a4.zip
Update background text images in recovery
Locale texts are missing in the recovery log due to an extra empty locale chunk in the png file. Fix the bug in the app and regenerate all the background texts and compress the file with pngcrush + zopflipng. Bug: 34054052 Test: Locale texts logged successfully on angler Change-Id: I89f823a53c1eb69756183e8e11113216d093304f
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 ac94bde1..30d45f6a 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;
38import java.io.IOException; 38import java.io.IOException;
39import java.util.ArrayList; 39import java.util.ArrayList;
40import java.util.Arrays; 40import java.util.Arrays;
41import java.util.Comparator;
41import java.util.HashMap; 42import java.util.HashMap;
42import java.util.Locale; 43import java.util.Locale;
43 44
@@ -148,11 +149,28 @@ public class Main extends Activity {
148 mText = (TextView) findViewById(R.id.text); 149 mText = (TextView) findViewById(R.id.text);
149 150
150 String[] localeNames = getAssets().getLocales(); 151 String[] localeNames = getAssets().getLocales();
151 Arrays.sort(localeNames); 152 Arrays.sort(localeNames, new Comparator<String>() {
153 // Override the string comparator so that en is sorted behind en_US.
154 // As a result, en_US will be matched first in recovery.
155 @Override
156 public int compare(String s1, String s2) {
157 if (s1.equals(s2)) {
158 return 0;
159 } else if (s1.startsWith(s2)) {
160 return -1;
161 } else if (s2.startsWith(s1)) {
162 return 1;
163 }
164 return s1.compareTo(s2);
165 }
166 });
167
152 ArrayList<Locale> locales = new ArrayList<Locale>(); 168 ArrayList<Locale> locales = new ArrayList<Locale>();
153 for (String localeName : localeNames) { 169 for (String localeName : localeNames) {
154 Log.i(TAG, "locale = " + localeName); 170 Log.i(TAG, "locale = " + localeName);
155 locales.add(Locale.forLanguageTag(localeName)); 171 if (!localeName.isEmpty()) {
172 locales.add(Locale.forLanguageTag(localeName));
173 }
156 } 174 }
157 175
158 final Runnable seq = buildSequence(locales.toArray(new Locale[0])); 176 final Runnable seq = buildSequence(locales.toArray(new Locale[0]));