summaryrefslogtreecommitdiffstats
path: root/tools/aapt/Command.cpp
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2014-01-21 15:32:36 +0000
committerNarayan Kamath <narayan@google.com>2014-02-14 14:08:57 +0000
commit788fa41482b9d398591b7db8b0b01839029611ad (patch)
treeab94d4040351d79cca717a8b7e21fc6be5d0fcb5 /tools/aapt/Command.cpp
parent48620f1d1b03e1cb4e0dce4999e0a4c2daf3a1b2 (diff)
downloadframeworks_base-788fa41482b9d398591b7db8b0b01839029611ad.zip
frameworks_base-788fa41482b9d398591b7db8b0b01839029611ad.tar.gz
frameworks_base-788fa41482b9d398591b7db8b0b01839029611ad.tar.bz2
Extended locales in AAPT / AssetManager.
Support 3 letter language codes, script codes & variants. The bulk of the changes are related to the implementation of command line filtering of locales etc. The previous code assumed that the value of each "axis" (locale, density, size etc.) could be represented by a 4 byte type. This is no longer the case. This change introduces a new class, AaptLocaleValue which holds a (normalized) locale parsed from a directory name or a filter string. This class takes responsibility for parsing locales as well as writing them to ResTable_config structures, which is their representation in the resource table. This includes minor changes at the java / JNI level for AssetManager. We now call locale.toLanguageTag() to give the native layer a well formed BCP-47 tag. I've removed some duplicated parsing code in AssetManager.cpp and replaced them with functions on ResTable_config. The native getLocales function has been changed to return well formed BCP-47 locales as well, so that the corresponding java function can use Locale.forLanguageTag to construct a Locale object out of it. Finally, this change introduces default and copy constructors for ResTable_config to prevent having to memset() the associated memory to 0 on every stack allocation. (cherry-picked from commit 91447d88f2bdf9c2bf8d1a53570efef6172fba74) Change-Id: I1b43086860661012f949fb8e5deb7df44519b854
Diffstat (limited to 'tools/aapt/Command.cpp')
-rw-r--r--tools/aapt/Command.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index 8a6faed..c7cce96 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -517,6 +517,7 @@ int doDump(Bundle* bundle)
// the API version because key resources like icons will have an implicit
// version if they are using newer config types like density.
ResTable_config config;
+ memset(&config, 0, sizeof(ResTable_config));
config.language[0] = 'e';
config.language[1] = 'n';
config.country[0] = 'U';