Some language variants have the duplicated translations. Therefore,
we can compare the translated string for each locale to the default
text string for that language. And the duplicated ones will be skipped
to save some space.
Bug: 74397117
Test: generate and check the image
Change-Id: If51fa8fe700350c06f084f0e74d3698b82d6f177
In specific, the apostrophe appears as "\'"; and a new line appears as
"\n\n". We need to handle these two cases accordingly.
Bug: 74397117
Test: generate and check the image
Change-Id: I67b1ebce7494e4a685a0c7334da58dc6df2ccb29
The icu library takes care of the line boundary, so that we don't need
to worry about if the given language is logogram.
Bug: 74397117
Test: Generate and check the image
Change-Id: I1447f51b178c0fca83c5497d2f5b8e4009ca7f64
A smaller list of locales helps to reduce the size of the generated
images; and mitigate the additional space requirement on the tight boot
image for some devices. The caller of the program will be responsible
for providing the locale list.
Also add a verbose option and switch to logger.
Bug: 74397117
Test: generate and check the image
Change-Id: I7b7cee681ccdc6e13fdd0575cf02f8add2ad9a2d
The word "Android" is not translated. As a result, some locales fail to
render this word and some punctuations, leading to holes in the middle
of the text. In these cases, we will need to fall back to the default font
and re-measure the text width.
For now, we haven't handled the mix of latin and logogram languages; and
we can blacklist the problematic ones first.
Bug: 74397117
Test: generate and inspect the image
Change-Id: I07d22c0dae2e31eb74f2954e354cd39a42c22f14
We can adjust the image width with respect to the maximum width of the
wrapped text. This will remove some black margins and reduce the final
size of the images, especially for those with short strings, e.g.
"recovery_error".
Also, add an option to centrally align the text; and fix a boundary
check in the recovery resource test.
Bug: 74397117
Test: Generate and check the image
Change-Id: Ib6cf61a9c99c4aeede16751dc0adfa23ce3f5424
Format the file with google-java-format --aosp. This makes the presubmit
hook happy.
Bug: 74397117
Test: mma
Change-Id: Ie342ed11449414b63f2d1ae781023e940b136bcb
[platform/bootable/recovery] tools/image_generator/ImageGenerator.java:36: Wrong order for java.util.StringTokenizer import. Use Ctrl+Shift+O (Eclipse) or Ctrl+Alt+O (Intellij) to sort imports. https://source.android.com/setup/code-style#order-import-statementsERRORS:
[platform/bootable/recovery] tools/image_generator/ImageGenerator.java:43: Wrong order for org.apache.commons.cli.CommandLine import. Use Ctrl+Shift+O (Eclipse) or Ctrl+Alt+O (Intellij) to sort imports. https://source.android.com/setup/code-style#order-import-statementsERRORS:
[platform/bootable/recovery] tools/image_generator/ImageGenerator.java:50: Extra separation in import group before 'org.w3c.dom.Document'
Test: `mmma -j bootable/recovery`
Test: `repo upload` no longer gives warnings.
Change-Id: If24c6b7ca33b9223b3e326a48885c24c35b5fa68
Encode the width, height and locale of the localized image as pixels so
that recovery can locate the correct range of the image from a
concatenated png file.
Also address a few todoes including wrapping the CJK text, making a
catch-all type for all languages.
Test: view the generated image under locale test
Change-Id: Icd3997eb4e992e76ef72526787d64c406f606970
As we localize the wipe data menu under the recovery mode, some
additional strings need the new translation. The strings include
1. The menu header that prompts a data wipe
2. Try again description
3. Factory reset description
4. The menu header to confirm a data wipe
5. Cancel description
We will resue the "Factory reset description" in the confirmation menu;
and the image_generator tool will be moved to this directory in later
cls.
Bug: 74397117
Test: mma
Change-Id: I706b8677dba506b62e890f6b200e3eb3b11ce483
We used to dump the public key files into some text format; and parse
them under recovery. But now we have switched to read the certificates
directly from the zip files; and there's no caller of this dumpkey host
tool any more.
Bug: 116655889
Test: mma
Change-Id: I115592e2a894b3375495c81cb249d1bed1a5d973
The commandline parser adds some flexibility to the argument parsing. It
also makes the help message more descriptive.
Bug: 74397117
Test: generate a image, checks the help message
Change-Id: Ib238658a9a6fa8806f1b0dde419c8fb970e7cb37
This program uses java.awt.Graphics2D to generate the background text
files used under recovery mode. And thus we don't need to do the manual
work by running emulators with different dpi.
The program takes the following parameters:
1. imageWidth: The number of pixels per line; and the text strings will be
wrapped accordingly.
2. textName: The description of the text string, e.g. "recovery_erasing",
"recovery_installing_security"
3. fontDirectory: The directory that contains all the support .ttf | .ttc
files, e.g. $OUT/system/fonts/
4. resourceDirectory: The resource directory that contains all the translated
strings in xml format, e.g. bootable/recovery/tools/recovery_l10n/res/
5. outputFilename: Path to the generated image.
Bug: 74397117
Test: checks the generated png files
Change-Id: Ia5506a0a4f5da1ebfd7090345eb246f44b265075
This change sets LOCAL_SDK_VERSION for all packages where
this is possible without breaking the build, and
LOCAL_PRIVATE_PLATFORM_APIS := true otherwise.
Setting one of these two will be made required soon, and this
is a change in preparation for that. Not setting LOCAL_SDK_VERSION
makes the app implicitly depend on the bootclasspath, which is
often not required. This change effectively makes depending on
private apis opt-in rather than opt-out.
Test: make relevant packages
Bug: 73535841
Change-Id: I82fee834c5d92e699e9571933faded11c6d4596e
Restore the max width to 900px for xxhdpi and 1200px for xxxhdpi
Bug: 34541299
Test: Checked width and images passed recovery_manual_test
Change-Id: If0fd51f93cfb3f965d4e9e69be5626eba89eb857