summaryrefslogtreecommitdiff
path: root/tools/aapt/ResourceTable.cpp
AgeCommit message (Collapse)Author
2014-10-04am 85035d90: am b2b166a5: am 397001b2: am a80aba70: Merge "AAPT: Gate v21 ↵Adam Lesinski
resource synthesizing logging behind -v flag" into lmp-dev * commit '85035d90257beedd54641385674ce2dfb29ae241': AAPT: Gate v21 resource synthesizing logging behind -v flag
2014-10-03am a80aba70: Merge "AAPT: Gate v21 resource synthesizing logging behind -v ↵Adam Lesinski
flag" into lmp-dev * commit 'a80aba70728c2843df94474dbd7829dadb77855f': AAPT: Gate v21 resource synthesizing logging behind -v flag
2014-10-03AAPT: Gate v21 resource synthesizing logging behind -v flagAdam Lesinski
This is verbose information and should be hidden behind the -v flag. Bug:17822471 Change-Id: I36e2c6beb54669a31cde73416427477a80ded8a6
2014-10-01resolved conflicts for merge of 1dcc75b2 to lmp-dev-plus-aospAndreas Gampe
Change-Id: I8e1c6ee2025b6acd90803545fb95ab1b98560d92
2014-10-01resolved conflicts for merge of 1dcc75b2 to lmp-mr1-dev-plus-aospAndreas Gampe
Change-Id: I8f7cbd971beae3ab134195e612d705860665142f
2014-10-01Frameworks/base: Fix AAPT warningsAndreas Gampe
Turn on -Wall -Werror. Fix warnings. Change-Id: I287fb3c1e851c654479bcf9ea8c73bd354a6b2a1
2014-09-26am a196e203: am 98e858b1: am 581dfee1: am 0a6c5ea4: Merge "AAPT: Fix issue ↵Adam Lesinski
with synthesized resource not actually showing up" into lmp-dev * commit 'a196e203076cb810a21a702b41f6a1d82d029318': AAPT: Fix issue with synthesized resource not actually showing up
2014-09-26am 0a6c5ea4: Merge "AAPT: Fix issue with synthesized resource not actually ↵Adam Lesinski
showing up" into lmp-dev * commit '0a6c5ea412bc1e49aa1e98a6a3fe268081883d4a': AAPT: Fix issue with synthesized resource not actually showing up
2014-09-24AAPT: Fix issue with synthesized resource not actually showing upAdam Lesinski
AAPT keeps around a few pieces of state that are disjoint, so simply adding to a collection won't add the resource to the final flattened output. Instead, we create the resource from the top and then copy over the values into the newly created resource. Bug:17647890 Change-Id: I214263e84c18f9370c6e6a5aa53aa2d833fc842d
2014-09-22am d4e5b601: am 37e3df38: am 1aa4db07: am 81745c51: Merge "AAPT: ↵Adam Lesinski
Continuation of public/private attribute fix" into lmp-dev * commit 'd4e5b601c7da5c662d8cf9c46177810fdeeed23f': AAPT: Continuation of public/private attribute fix
2014-09-22am 36b5795f: am 81745c51: Merge "AAPT: Continuation of public/private ↵Adam Lesinski
attribute fix" into lmp-dev * commit '36b5795fc9e9a2eed320a0d626bce44a8c231f6b': AAPT: Continuation of public/private attribute fix
2014-09-22AAPT: Continuation of public/private attribute fixAdam Lesinski
XML files like layouts are now scanned and checked for v21 attributes. If those kinds of attributes are found, then we remove them in the original version and synthesize a new xml file under the v21 configuration. Bug:17520380 Change-Id: Icf984cb96134180a2e35349c1dbf2cef9a8f0bda
2014-09-19am 9ee3ba23: am e7e9ad6d: am 863b1a90: am 19f9d54f: Merge "Fix backwards ↵Adam Lesinski
compat problem with AAPT public attrs" into lmp-dev * commit '9ee3ba23395bd1a13bbfd3fe523ee611a5ca001b': Fix backwards compat problem with AAPT public attrs
2014-09-19am 8bdb265f: am 19f9d54f: Merge "Fix backwards compat problem with AAPT ↵Adam Lesinski
public attrs" into lmp-dev * commit '8bdb265f0a73bc6f2114ca70f141c214a23696c7': Fix backwards compat problem with AAPT public attrs
2014-09-18Fix backwards compat problem with AAPT public attrsAdam Lesinski
AAPT has traditionally assigned resource IDs to public attributes, and then followed those public definitions with private attributes. --- PUBLIC --- | 0x01010234 | attr/color | 0x01010235 | attr/background --- PRIVATE --- | 0x01010236 | attr/secret | 0x01010237 | attr/shhh Each release, when attributes are added, they take the place of the private attributes and the private attributes are shifted down again. --- PUBLIC --- | 0x01010234 | attr/color | 0x01010235 | attr/background | 0x01010236 | attr/shinyNewAttr | 0x01010237 | attr/highlyValuedFeature --- PRIVATE --- | 0x01010238 | attr/secret | 0x01010239 | attr/shhh Platform code may look for private attributes set in a theme. If an app compiled against a newer version of the platform uses a new public attribute that happens to have the same ID as the private attribute the older platform is expecting, then the behavior is undefined. We get around this by detecting any newly defined attributes (in L), copy the resource into a -v21 qualified resource, and delete the attribute from the original resource. This ensures that older platforms don't see the new attribute, but when running on L+ platforms, the attribute will be respected. We still need to address this problem in the platform moving forward, as this will only help us in the transition from pre L to L. Bug:17520380 Change-Id: Ia2a985798b50006c21c7c3431d30d9598f27cd91
2014-09-10am 716c7279: am 799dc748: Merge "AAPT: Don\'t crash on illegal symbol name" ↵Adam Lesinski
into lmp-dev * commit '716c7279854318eeabad39b7bb187aa69ad41c97': AAPT: Don't crash on illegal symbol name
2014-09-09AAPT: Don't crash on illegal symbol nameAdam Lesinski
We never checked the return value when adding a nested symbol, which would be NULL if the symbol name was invalid. External bug: https://code.google.com/p/android/issues/detail?id=75876 Change-Id: I5211f4d4b87897d52f2b6e5907113d31930bb92d
2014-09-08resolved conflicts for merge of 6c585756 to lmp-dev-plus-aospDan Albert
Change-Id: I5a25f2bac44ac5efcd7462af91005e09680a1d96
2014-09-08Use char16_t for char things.Dan Albert
When compiling in C++ mode, the compiler will complain about conversions from uint16_t to char16_t. Be consistent in using char16_t for strings. Change-Id: I052b6176ced635162920b31560052d9a64f92764
2014-08-21AAPT: mipmaps should not end up in SplitsAdam Lesinski
Mipmaps are never filtered, and so they will always end up in the base APK. Make sure they get omitted from any split. Change-Id: Id24b082bc9bd2d3f031a58bd0de4d30b4f0de7e0
2014-08-20AAPT: Fix regression generating dynamic ref table for shared librariesAdam Lesinski
AAPT stopped generating dynamic reference tables for shared libraries. Change-Id: Ib0025811bdca1a4756eb21080dd6b6bb3fc1ca3d
2014-08-19Allow enum generated IDs to reuse existing IDsAdam Lesinski
Change-Id: Ida5dbbce1c4ecb0a4e57511555cec6448737be25
2014-08-04AAPT support for feature splitsAdam Lesinski
This change allows the developer to add a base package for which to build a feature split. The generated resource types will begin after the base APK's defined types so as not to collide or override resources. Multiple features can be generated by first choosing an arbitrary order for the features. Then for each feature, the base APK and any preceding features are specified with the --feature-of flags. So with a base APK 'A' and features, 'B', and 'C', 'B' would be built with aapt package [...] --feature-of A [...] and 'C' would be built with aapt package [...] --feature-of A --feature-of B [...] Change-Id: I1be66e3f8df9a737b21c71f8a93685376c7e6780
2014-07-30Fix large memory corruption in AAPTAdam Lesinski
When assigning a new string pool to a package, don't release the reference to the old memory immediately, as the cleanup code that is called after references the old memory. Bug: 16155257 Change-Id: I3eaeb81191b71a282a0ef82856023f09707f1b17
2014-06-18Support multiple resource tables with same packageAdam Lesinski
In order to support APK split features, the resource table needs to support loading multiple resource tables with the same package but potentially new set of type IDs. This adds some complexity as the type ID space changes from dense and ordered to potentially sparse. A ByteBucketArray is used to store the type IDs in a memory efficient way that allows for fast retrieval. In addition, the IDMAP format has changed. We no longer need random access to the type data, since we store the types differently. However, random access to entries of a given type is still required. Change-Id: If6f5be680b405b368941d9c1f2b5d2ddca964160
2014-05-12Merge "Add support for building split APKs"Adam Lesinski
2014-05-11Add support for building split APKsAdam Lesinski
Build multiple APKs, each containing a disjoint subset of configurations. These can then be loaded into the device AssetManager and should operate as if they were never split. Use the idea of building multiple sets of files, where each set represents an APK. An ApkBuilder can place files in a set based on its configuration, but you can actually add directly to a set, in the case of the resources.arsc and generated AndroidManifest.xml for splits. Change-Id: Ic65d3f0ac1bbd290185695b9971d425c85ab1de3
2014-05-06am 86768034: am b593ad60: am f1f28d1d: Merge "Skip resource files for ↵Elliott Hughes
locales en-XA and ar-XB during packaging if pseudolocalization was done automatically. This prevents attemts to add same resource twice." * commit '867680342e12af59a26756f30cf817a131724943': Skip resource files for locales en-XA and ar-XB during packaging if pseudolocalization was done automatically. This prevents attemts to add same resource twice.
2014-05-05Skip resource files for locales en-XA and ar-XBIgor Viarheichyk
during packaging if pseudolocalization was done automatically. This prevents attemts to add same resource twice. Change-Id: I51e17f961ac44047bf466ce4aa0d4d17f4ded0d6
2014-04-30am fd955f14: am 6a6979ad: am 86315c45: Merge "Fixes issue causing ↵Elliott Hughes
pseudolocalization of strings in non-translatable resource files." * commit 'fd955f14d6c87dffd1a20c36ad8001705495f831': Fixes issue causing pseudolocalization of strings in non-translatable resource files.
2014-04-30Fixes issue causing pseudolocalization of stringsIgor Viarheichyk
in non-translatable resource files. Change-Id: Ic8e5effc86226d5be00561ac71bab7695ef90376
2014-04-18resolved conflicts for merge of 56ca8219 to masterElliott Hughes
Change-Id: I62f5804a5c4404eedce09188cda2e3b1bb990b36
2014-04-09Pseudolocalizer improvements.Anton Krumin
Fixes accented pseudolocalization and adds RTL pseudolocale. This change contains following modifications in the pseudolocalization logic: 1) zz_ZZ pseudolocale was removed; 2) en_XA pseudolocale was added for pseudo-accented; 3) ar_XB pseudolocale was added for pseudo-rtl; 4) Pseudo RTL localization functionality was implemented; 5) Text expansion functionality was implemented; 6) Text bracketing was implemented; 7) Couple of issues of previous implementation were fixed. Change-Id: I9f7f27bed717e39e82717d15c398decffc8bec3c Signed-off-by: Anton Krumin <antkrumin@google.com>
2014-03-25Shared library resource supportAdam Lesinski
Shared libraries can now export resources for applications to use. Exporting resources works the same way the framework exports resources, by defining the public symbols in res/values/public.xml. Building a shared library requires aapt to be invoked with the --shared-lib option. Shared libraries will be assigned a package ID of 0x00 at build-time. At runtime, all loaded shared libraries will be assigned a new package ID. Currently, shared libraries should not import other shared libraries, as those dependencies will not be loaded at runtime. At runtime, reflection is used to update the package ID of resource symbols in the shared library's R class file. The package name of the R class file is assumed to be the same as the shared library's package name declared in its manifest. This will be customizable in a future commit. See /tests/SharedLibrary/ for examples of a shared library and its client. Bug:12724178 Change-Id: I60c0cb8ab87849f8f8a1a13431562fe8603020a7
2014-03-24Reduce warning verbosity in aaptAdam Lesinski
- Attributed source of problems to the correct file. - Only verify string localizations against valid locales. Bug:13140015 Change-Id: I9dabc5efa0510649caee8af0c8ebb803d6f48269
2014-03-20Reduce warning verbosity in aaptAdam Lesinski
- Attributed source of problems to the correct file. - Only verify string localizations against valid locales. Bug:13140015 Change-Id: I9dabc5efa0510649caee8af0c8ebb803d6f48269
2014-02-14Extended locales in AAPT / AssetManager.Narayan Kamath
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
2014-02-10Extended locales in AAPT / AssetManager.Narayan Kamath
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. Change-Id: I899a56a9a182ee6be52b9389d1ae59266f5482e9
2014-01-27Don't pseudolocalize untranslatable strings.Narayan Kamath
bug: https://code.google.com/p/android/issues/detail?id=63004 (cherry picked from commit 7e1b8ff3e15b35b92978e572ccbfbc47cedce242) Change-Id: I99ba1a915ae8fc61f70ce570b782108171d0fcaa
2014-01-27Add new aapt flag --error-on-missing-config-entryYing Wang
It forces aapt to return an error if aapt fails to find an resource entry for a configuration. Bug: 11259444 Change-Id: Ie5674a29dff5d4455e7d7c94f6b25560fb1305b7
2014-01-27AAPT emits error for res with no 'default' productAdam Lesinski
Rather than ignoring resources that do not match the specified product, we keep track of the ignored ones and make sure that some variant of the resource that matches the product was processed. bug:10860838 Change-Id: I7a35f37fda2c9561634f75323bd4cb2b9047e29b
2014-01-27Revert "Move frameworks/base/tools/ to frameworks/tools/"Adam Lesinski
This reverts commit 9f6a119c8aa276432ece4fe2118bd8a3c9b1067e.
2013-12-10Don't pseudolocalize untranslatable strings.Narayan Kamath
bug: https://code.google.com/p/android/issues/detail?id=63004 Change-Id: I8e47a53d887144dc867111e42313d0e113b83ea1
2013-10-04AAPT emits error for res with no 'default' productAdam Lesinski
Rather than ignoring resources that do not match the specified product, we keep track of the ignored ones and make sure that some variant of the resource that matches the product was processed. bug:10860838 Change-Id: I804cd04a053269a35b7e1c1cc743b77493337bf9
2013-08-28Move frameworks/base/tools/ to frameworks/tools/Mike Lockwood
Change-Id: I3ffafdab27cc4aca256c3a5806b630795b75d5c8
2012-11-27Cache resource ID lookups in aaptChristopher Tate
This speeds up certain workloads considerably, particularly those involved in buildling apps via the SDK. Windows-based use should particularly benefit from the change. Change-Id: I29f4b3a77400b201ee219729cc28a5e359c0c5e8
2012-08-23Add support for "-rtl" in resourcesFabrice Di Meglio
- fix bug #7035019 Need to have "-rtl" support for Resource Change-Id: Ic82145c2ac672729d8a6c695a5f343276a1a0a2c
2012-05-01resolved conflicts for merge of 13c04786 to jb-dev-plus-aospJean-Baptiste Queru
Change-Id: Ib7aa5a768f4606beb2a4387811cfed7c00cbc111
2012-05-01resolved conflicts for merge of bc2fb7b9 to jb-dev-plus-aospJean-Baptiste Queru
Change-Id: I5386585e473201268c6ed8b05e0a16569d434ea2
2012-03-16Remove dead code in StringPool.Jeff Brown
The sorted string pool option was no longer used. Neither were strings with associated identifiers. Change-Id: Ic5f6368637fbeedfda873d63f4ad0f3ea9d0d603