1*e7c364b6SAndroid Build Coastguard Worker# Steps to regenerate background text images under res-*dpi/images/ 2*e7c364b6SAndroid Build Coastguard Worker 3*e7c364b6SAndroid Build Coastguard Worker1. Build the recovery_l10n app: 4*e7c364b6SAndroid Build Coastguard Worker 5*e7c364b6SAndroid Build Coastguard Worker cd bootable/recovery && mma -j32 6*e7c364b6SAndroid Build Coastguard Worker 7*e7c364b6SAndroid Build Coastguard Worker2. Install the app on the device (or emulator) with the intended dpi. 8*e7c364b6SAndroid Build Coastguard Worker 9*e7c364b6SAndroid Build Coastguard Worker * For example, we can use Nexus 5 to generate the text images under 10*e7c364b6SAndroid Build Coastguard Worker res-xxhdpi. 11*e7c364b6SAndroid Build Coastguard Worker * We can set up the maximum width of the final png image in res/layout/main.xml 12*e7c364b6SAndroid Build Coastguard Worker Currently, the image width is 1200px for xxxhdpi, 900px for xxhdpi and 13*e7c364b6SAndroid Build Coastguard Worker 480px for xhdpi/hdpi/mdpi. 14*e7c364b6SAndroid Build Coastguard Worker * When using the emulator, make sure the NDK version matches the current 15*e7c364b6SAndroid Build Coastguard Worker repository. Otherwise, the app may not work properly. 16*e7c364b6SAndroid Build Coastguard Worker 17*e7c364b6SAndroid Build Coastguard Worker adb install $PATH_TO_APP 18*e7c364b6SAndroid Build Coastguard Worker 19*e7c364b6SAndroid Build Coastguard Worker3. Run the app, select the string to translate and press the 'go' button. 20*e7c364b6SAndroid Build Coastguard Worker 21*e7c364b6SAndroid Build Coastguard Worker4. After the app goes through the strings for all locales, pull the output png 22*e7c364b6SAndroid Build Coastguard Worker file from the device. 23*e7c364b6SAndroid Build Coastguard Worker 24*e7c364b6SAndroid Build Coastguard Worker adb root && adb pull /data/data/com.android.recovery_l10n/files/text-out.png 25*e7c364b6SAndroid Build Coastguard Worker 26*e7c364b6SAndroid Build Coastguard Worker5. Compress the output file put it under the corresponding directory. 27*e7c364b6SAndroid Build Coastguard Worker 28*e7c364b6SAndroid Build Coastguard Worker * "pngcrush -c 0 ..." converts "text-out.png" into a 1-channel image, 29*e7c364b6SAndroid Build Coastguard Worker which is accepted by Recovery. This also compresses the image file by 30*e7c364b6SAndroid Build Coastguard Worker ~60%. 31*e7c364b6SAndroid Build Coastguard Worker * zopflipng could further compress the png files by ~10%, more details 32*e7c364b6SAndroid Build Coastguard Worker in https://github.com/google/zopfli/blob/master/README.zopflipng 33*e7c364b6SAndroid Build Coastguard Worker * If you're using other png compression tools, make sure the final text 34*e7c364b6SAndroid Build Coastguard Worker image works by running graphic tests under the recovery mode. 35*e7c364b6SAndroid Build Coastguard Worker 36*e7c364b6SAndroid Build Coastguard Worker pngcrush -c 0 text-out.png $OUTPUT_PNG 37