summaryrefslogtreecommitdiff
path: root/tools/aapt/Resource.cpp
AgeCommit message (Collapse)Author
2014-11-03Add error checking to aapt for split generationAdam Lesinski
Change-Id: Ica627db6a671f6a6c35f98bfd9c03598ffe103ce
2014-11-03Fix issues that will be present in C++11Adam Lesinski
- char16_t is a distinct type, so stay consistent with it throughout the code base. - char16_t is defined as minimum size of 16 bits. Since we mmap and cast data structures onto raw memory, we need a precise definition (uint16_t), so we cast between that (and static_assert that they are the same size). Change-Id: I869c32637543bbcfb39d2643e7d9df10d33acd3c
2014-10-20am 9295a135: am e40974d9: Merge "Fix an overflow found by ASAN."Dan Albert
* commit '9295a1354eb8220be9a0a40985253c6cdfac35c3': Fix an overflow found by ASAN.
2014-10-20Fix an overflow found by ASAN.Dan Albert
Sometimes len is 0. Change-Id: I031000188edc57663a5519b00cbbb751600d32f4
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-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-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-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-11am 972628dc: am 5128e88e: Merge "Don\'t use reflection when generating the ↵Marcin Kosiba
onResourcesLoaded callback." into lmp-dev * commit '972628dc8c63b02b75f9e976b3ab67e3913da1a8': Don't use reflection when generating the onResourcesLoaded callback.
2014-09-11Don't use reflection when generating the onResourcesLoaded callback.Marcin Kosiba
BUG: 17466240 Change-Id: I74608f3d8b3617281639a9d387face97e15fb616
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-27Stamp platform version code into app ApksAdam Lesinski
The versionCode of theframework resources that an app is built against gets stamped inside an app's AndroidManifest.xml in the <manifest> tag as "platformBuildVersionCode" and "platformBuildVersionName" attributes. Bug:17207635 Change-Id: Id573c3dffcbca38eec9c0eb3e89f4a547e3361d3
2014-08-25Have R classes generate their own reference rewrite logicAdam Lesinski
Change-Id: I0e5b8311fc3479d966a49f9acf0d4c32a6a024d3
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-21Use the correct versionCode for Split APKsAdam Lesinski
Insert the correct versionCode into the generated Split AndroidManifest.xml. Change-Id: I0aec797b5a4ff8bd70f9394b18aee5ad292b37c8
2014-08-15Add FeatureGroup to PackageInfoAdam Lesinski
FeatureGroups replace top-level FeatureInfo objects. FeatureGroups inherit top-level FeatureInfos but override them if the feature names are the same. Bug:16822121 Change-Id: I80b2cb778a0fbcb4521efce986fba641e0914290
2014-08-14Ensure that split names are validAdam Lesinski
Generate valid split names for resource splits. Validate split names for features. Change-Id: I3040438af0156778c2bd66ddeffdf62fe9dcc9fc
2014-08-09Merge "AAPT support for feature splits" into lmp-devAdam Lesinski
2014-08-07Have styleable indices be non-final for library projectsAdam Lesinski
Invoking aapt after merging resources from a library project may yield a different ordering to styleable arrays, so have the indices be non-final too. Bug:16842410 Change-Id: I0432bea03dc4312d5908a770fc70a11f0a1596ae
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-15Mark resource-only splits as hasCode=false.Jeff Sharkey
PackageManagerService now skips dexopt for split APKs that don't declare they have code. Also surface more detailed error messages in logs. Bug: 14975160 Change-Id: Ie6078dba724815020cee59b7fc52317e88ca097a
2014-07-09Add versionCode to split manifest; compile.Jeff Sharkey
To verify consistency at install time, all APK manifests must declare the same package name and version code. Also start compiling the manifest, since versionCode is an attribute. Bug: 14975160 Change-Id: I2a1a769bd3dfde05b19563af5ca9b6c15a9c95ff
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-06-06Add support for @SystemApi annotation to aapt.Jeff Brown
When aapt sees @SystemApi in the XML comment associated with a resource, it will now remove this tag from the comment (since is it not meaningful as a Javadoc tag) and instead add an @android.annotation.SystemApi annotation to the declared type or member. This enables easy downstream processing of this annotation from generated code. Change-Id: If984908477648c0c90be52fdc955fbb891d99b28
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-04-25Child nodes of <preference-headers> now output proguard keep options.Adam Lesinski
Bug:13797600 Change-Id: I55c71a2fcf7f9b4bdad684d5c235981c3a8bc1e9
2014-02-25Add --replace-version flag to aapt.Jeff Davidson
Motivation: we'd like to programmatically specify the version name/code (i.e. to include the build number from the build server). However, this means that we cannot specify version info in the AndroidManifest.xml file, as this takes precedence. Not doing so makes IDE use more difficult, as the IDE gets version code 0 and won't install over an existing non-IDE version unless you first force a downgrade to an IDE build from the command line. This flag allows us to specify a very high version code in the AndroidManifest.xml file, making IDE builds take precedence, while still allowing us to override this info when performing command-line (official) builds. Change-Id: I5d01048698af5c26bdf19066c6cd4eca1115112a
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-31Change ResourceType cookies to int32_t.Narayan Kamath
Also change the order of parameters in ResTable constructors to avoid ambiguity. (cherry picked from commit 00b314436f4fdfada4bbf1e79ec12e9fa38aeaf1) Change-Id: I874c5d03c134dc3c331fba423b5280366296287c
2014-01-28Change ResourceType cookies to int32_t.Narayan Kamath
Also change the order of parameters in ResTable constructors to avoid ambiguity. Change-Id: If7bfa1f640dddca39b9f26a3ce84081fa7b6e6e3
2014-01-27Re-apply several tools fixes lost by the directory rearrangement.Elliott Hughes
Leaks on error in tools/aapt/Images.cpp. https://code.google.com/p/android/issues/detail?id=61552 Two missing fclose calls in tools/aapt/Resource.cpp. https://code.google.com/p/android/issues/detail?id=61553 Missing fclose in tools/aidl/aidl.cpp. https://code.google.com/p/android/issues/detail?id=61554 Change-Id: I56ce144958296961b77354815efc1a245564594b
2014-01-27Remove scenes from Resource.cppChet Haase
Part of the Transition API changes, except that the tools/ directory got moved between klp and master, so re-making the same changes here. Issue #10460684 KLP API Review: android.view.transition and android.animation Change-Id: Icedca1dc689285b4b213f9376656b26f18c7f23e
2014-01-27Revert "Move frameworks/base/tools/ to frameworks/tools/"Adam Lesinski
This reverts commit 9f6a119c8aa276432ece4fe2118bd8a3c9b1067e.
2013-11-22Merge commit 'b873a17ce7be0a9771c24999adca6964431728f6' into HEADThe Android Open Source Project
Change-Id: I938755073e70602cc8f51ce9bd420fdcf870cecd
2013-10-29Fix a variety of small publicly-reported bugs.Elliott Hughes
Possible NULL dereference in cmds/bootanimation/BootAnimation.cpp. https://code.google.com/p/android/issues/detail?id=61556 Missing fclose in core/jni/android_os_Debug.cpp. https://code.google.com/p/android/issues/detail?id=61546 Bad loop guards in core/jni/android_util_Process.cpp. https://code.google.com/p/android/issues/detail?id=61557 Assignment to wrong variable in libs/androidfw/AssetManager.cpp. https://code.google.com/p/android/issues/detail?id=61560 Missing delete[]s in libs/androidfw/ObbFile.cpp. https://code.google.com/p/android/issues/detail?id=61549 Leaks on error in tools/aapt/Images.cpp. https://code.google.com/p/android/issues/detail?id=61552 Two missing fclose calls in tools/aapt/Resource.cpp. https://code.google.com/p/android/issues/detail?id=61553 Missing fclose in tools/aidl/aidl.cpp. https://code.google.com/p/android/issues/detail?id=61554 Change-Id: I5820f3824e72d07a9acb776cf0af3e7443f5694a
2013-09-04Transition API changes from API council recommendationsChet Haase
Issue #10460684 KLP API Review: android.view.transition and android.animation Issue #10570740 Transitions: inflate transition targets from xml Change-Id: I7a3f6d3aece2fcafc5efd555d033f79e86635c98
2013-08-28Move frameworks/base/tools/ to frameworks/tools/Mike Lockwood
Change-Id: I3ffafdab27cc4aca256c3a5806b630795b75d5c8
2013-05-07libutils clean-upMathias Agopian
Change-Id: I11ee943da23a66828455a9770fc3c5ceb4bbcaa9
2013-04-26am eb6403e9: resolved conflicts for merge of bfdd2566 to jb-mr2-dev-plus-aospJeff Brown
* commit 'eb6403e95d601b62be7b4610599e72fd329f2666': Generate SDK docs for v7 support library packages.
2013-04-26Generate SDK docs for v7 support library packages.Jeff Brown
This change required fixing some bugs in how AAPT handles qualified symbols such as "android:layout_height" when generating JavaDoc links. The links were being generated using the package name of the generated R file rather than the package name of the referenced symbol. These broken links caused the JavaDoc build to fail. Bug: 8175766 Change-Id: I52fbef27825a25abca960cb44b59c2132267e9d6
2013-04-18First draft of Scenes & Transitions featureChet Haase
This checkin has preliminary API (in flux, definitely changes still to be made) and implementation for a new "Scenes & Transitions" feature. The current implementation allows you to define different Scenes (via layout resource IDs or callbacks) and Transitions to be used when changing to those scenes. By default, scene changes will use AutoTransition, which generally does the right thing. There are no overview docs or tutorials yet. The best way to learn how things work is to see the code for the various tests in frameworks/base/tests/TransitionTests. Expect the API to change. Expect the implementation to change (mostly to add more functionality). Expect bugs, but tell me if things do not work as expected. Change-Id: Ib025a9f565678b225afa4759325cf6d496cc7215
2013-04-13Revert "Make --non-constant-id generates non final IDs for styleable."Xavier Ducrohet
This reverts commit 8730f46ae5ba9021a0e01c068ffc6b552b6c4510.
2013-04-12Make --non-constant-id generates non final IDs for styleable.Xavier Ducrohet
This was already done for all other types of resources, but not for styleable (or the constants for the styleable array indices). This fixes this. This only affects the SDK as this is used by the SDK toolchain only. Change-Id: Idfc2f7915be2b0e88590f38fd660610ffc7e160c
2012-09-26am fb34490f: Merge "Fix writing text version of styleable IDs."Xavier Ducrohet
* commit 'fb34490f4dca7aac623fb9a80fe9a2371107a786': Fix writing text version of styleable IDs.
2012-09-26Fix writing text version of styleable IDs.Xavier Ducrohet
Change-Id: I3f2614689a597de3fd46628c020cf649a808c82f
2012-09-17am 31820a35: Merge "Add --output-text-symbols option to aapt."Xavier Ducrohet
* commit '31820a35b2cf864a8dcb71d43e6fd21d54f49a2d': Add --output-text-symbols option to aapt.