summaryrefslogtreecommitdiff
path: root/tools/aapt/XMLNode.cpp
AgeCommit message (Collapse)Author
2018-08-20AAPT: Render resource ID values with 0x%08x in "dump xmltree" output asDonald Chai
is done elsewhere. Test: N/A Change-Id: I7ff686425fec447ae43b364e592b81bfcbc1df30
2018-05-11For Win32, don't cast ssize_t while printingPirama Arumuga Nainar
Bug: http://b/69933068 This is a partial revert of https://android-review.googlesource.com/c/platform/frameworks/base/+/109433 so we can use Clang for windows cross compilation. Clang does not allow a cast to 'signed size_t' and both Clang and current MinGW accept a ssize_t to the '%zd' format specifier. Test: m native-host, m native-host-cross with both MinGW and Clang Change-Id: I5366622b91be1433f6c533c55a9ae429b57c7a27
2016-08-11Fix clang-tidy warnings in aapt and aapt2.Chih-Hung Hsieh
* Add explicit keyword to conversion constructors. * Add NOLINT(implicit) comments for implicit conversion constructors. Bug: 28341362 * Use const reference type for read-only parameters. Bug: 30407689 * Use const reference type to avoid unnecessary copy. Bug: 30413862 Test: build with WITH_TIDY=1 Change-Id: Id6d21961f313a1ad92b15a37fdaa5be9e8ab48e1
2015-11-30Implement AAPT Bundle formatAdam Lesinski
AAPT will scan XML files looking for the <aapt:attr> XML tag. <!-- @layout/bundle.xml --> <ImageView xmlns:aapt="http://schemas.android.com/aapt"> <aapt:attr name="android:src"> <vector android:pathData="..." ...> </vector> </aapt:attr> </ImageView> The SINGLE child element of the <aapt:attr> tag is extracted into its own top level resource. It is given a generated name. The parent element of <aapt:attr> is then given the resource attribute that was assigned to the `name' attribute. The value is set to a reference to the generated resource. <!-- @layout/bundle.xml --> <ImageView android:src="@drawable/bundle_1.xml"> </ImageView> <!-- @layout/bundle_1.xml --> <vector android:pathData="..." ...> </vector> Bug:22627686 Change-Id: I8575fc4f739011402662fbf6b3db96df0012f598
2015-11-30Revert "Implement AAPT Bundle format"Adam Lesinski
This reverts commit 9d0f7d44d5cc5322415f52f7ce03cc37a478b350. Caused a build breakage when parsing some attributes. Change-Id: I89ca958b2f2e820d353648df8aadd90bbe8d8339
2015-11-24Implement AAPT Bundle formatAdam Lesinski
AAPT will scan XML files looking for the <aapt:attr> XML tag. <!-- @layout/bundle.xml --> <ImageView xmlns:aapt="http://schemas.android.com/aapt"> <aapt:attr name="android:src"> <vector android:pathData="..." ...> </vector> </aapt:attr> </ImageView> The SINGLE child element of the <aapt:attr> tag is extracted into its own top level resource. It is given a generated name. The parent element of <aapt:attr> is then given the resource attribute that was assigned to the `name' attribute. The value is set to a reference to the generated resource. <!-- @layout/bundle.xml --> <ImageView android:src="@drawable/bundle_1.xml"> </ImageView> <!-- @layout/bundle_1.xml --> <vector android:pathData="..." ...> </vector> Bug:22627686 Change-Id: I31bc96aae30d38bfd0b16508d0f585de5fd88a07
2015-08-17am 12cf0f9c: am eba23aaa: Merge "Replace HAVE_MS_C_RUNTIME with _WIN32 in ↵Elliott Hughes
frameworks/base/tools." * commit '12cf0f9c4cf8e6aed738da7349f556bd716ec09e': Replace HAVE_MS_C_RUNTIME with _WIN32 in frameworks/base/tools.
2015-08-17Replace HAVE_MS_C_RUNTIME with _WIN32 in frameworks/base/tools.Elliott Hughes
Change-Id: Ideef62acbf53a442167c9b8038021affffef9e8a
2015-06-09am 3277710c: am a121d34c: Merge "ICU format support for pseudolocalizes."Narayan Kamath
* commit '3277710c10e7b2dcd06bdc7f649346cd302fb3ac': ICU format support for pseudolocalizes.
2015-06-09ICU format support for pseudolocalizes.Igor Viarheichyk
Custom parser can handle nested ICU messages even if they are split into multiple fragments. Code reworked to encapsulate all pseudolocalization logic in Pseudolocalizer and PseudoMethods classes. To minimize a changelist size, some static functions remained. Fake BiDi pseudolocalization method is reimplemented to handle word boundaries correctly. Unit tests added. Change-Id: I9fb4baf4e3123df5dd6d182cca02bb7b0489ca71
2015-04-03am 66d94512: am dbb5f5d6: am efcbaec1: Merge "Only Windows doesn\'t have %zd."Elliott Hughes
* commit '66d9451273c4a3775b6b63a0e4b7027bd2eae65d': Only Windows doesn't have %zd.
2015-04-03Only Windows doesn't have %zd.Elliott Hughes
Change-Id: I0e4b0fdc61641c5ecb724fd096bd2315dcf8ed4a
2015-03-12Handle malformed manifests in printXMLBlockVishwath Mohan
Specially crafted manifest files can cause a segfault in printXMLBlock() using improper tag nesting (without evaluating to ResXMLTree::BAD_DOCUMENT). This fix checks and breaks when this condition is detected. Bug: 15549617 Change-Id: I27997fda86d228e993217a0c09993bff404cf317
2014-10-02am 152d9aae: am 31629651: Merge "Frameworks/base: Fix more aapt issues"Andreas Gampe
* commit '152d9aae631381ea28f5701168d372a1486a7502': Frameworks/base: Fix more aapt issues
2014-10-02am 152d9aae: am 31629651: Merge "Frameworks/base: Fix more aapt issues"Andreas Gampe
* commit '152d9aae631381ea28f5701168d372a1486a7502': Frameworks/base: Fix more aapt issues
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 more aapt issuesAndreas Gampe
Change-Id: I6da7dc674e9f9e3b0886a3cfd1e3194d6b5ac948
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-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-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-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>
2013-04-26Allow compiling aapt for the deviceBjorn Bringert
Changes: - The static device version of libandroidfw now includes the extra functions needed by aapt. I could only find a few host tools that use the static library, so this is hopefully not a problem. - The pseudolocalization code is moved into aapt. It was previously in libhost, but only used by aapt. Change-Id: Ib393ebb7dcebee8abbb628cbe5255ea1679674ac
2012-08-08Merge "Normalize output from aapt d xmltree"Jean-Baptiste Queru
2012-07-08Normalize output from aapt d xmltreeShachar Shemesh
When using aapt dump xmltree to dump an XML which has a content element with newlines, the output contains a newline. This makes it very difficult, sometimes impossible, to understand what is part of the content, and what is the meta-data. We now pass XML content through the same normalizer used for other tags. Change-Id: I327321520fac563eb32aecaf796f2473866697fc
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
2012-02-23Move the automatic namespace outside of the res namespace. do not merge.Xavier Ducrohet
(cherry picked from commit d9fe8018ffbf94f18a840005e688ad1d712f0225) Change-Id: I48ca78d5fccc75392b3f1cf9525890e5145293c4
2012-02-23Fix for issue 9656 - custom xml attributes in Android Libraries. do not merge.inazaruk
Added support for predefined namespace http://schemas.android.com/apk/res/auto that aapt tool recognizes and treats as namespace with package name taken from current application's AndroidManifest.xml, //manifest/package attribute. Signed-off-by: inazaruk <ievgenii.nazaruk@gmail.com> (cherry picked from commit e348909c1966c3d192841cc131a32be6ed90da18) Change-Id: I4bff836c42a309bac36e5d1ce1899131b3c4c194
2012-02-23Move the automatic namespace outside of the res namespace.Xavier Ducrohet
Change-Id: I107ee94af0a13f008ef4a8844a9038b84f97a247
2012-02-23am 63e43ba5: Merge "Fix for issue 9656 - custom xml attributes in Android ↵Jean-Baptiste Queru
Libraries" * commit '63e43ba56a95708c229eec539a544967f1bbb7d7': Fix for issue 9656 - custom xml attributes in Android Libraries
2012-02-23Merge "Fix for issue 9656 - custom xml attributes in Android Libraries"Jean-Baptiste Queru
2012-02-06Make aapt ignore tools-related data.Xavier Ducrohet
This patchset introduces a new standard namespace http://schemas.android.com/tools which will be used for tools specific XML attributes. Any attributes using this namespace will not be compiled into the binary XML file. The namespace node is also not written at all, and its string is not collected to ensure that there is no impact on the devices. (cherry picked from commit a5d5e9d906583ebeb590ca200ca9840302a5cd1a) Change-Id: I62937b8bc34c07ac544930aa8eadd7797e0179d5
2011-05-28Fix for issue 9656 - custom xml attributes in Android Librariesinazaruk
Added support for predefined namespace http://schemas.android.com/apk/res/auto that aapt tool recognizes and treats as namespace with package name taken from current application's AndroidManifest.xml, //manifest/package attribute. Signed-off-by: inazaruk <ievgenii.nazaruk@gmail.com> Change-Id: I4b24a7265511e416cc7e02b5bb8a08ef32b598eb
2011-04-11Normalize output of XMLtree contentShachar Shemesh
Make the output from aapt dump xmltree normalized, so that it is unambigously displayed regardless of the content of the strings. Previous patch left out handling of XML element content. Change-Id: Ib8016996c769f3dde7a87f7ecbdf850333f2426a
2011-01-04Normalize output from aapt dShachar Shemesh
Make the output from aapt dump --values resources and aapt dump xmltree normalized, so that it is unambigously displayed regardless of the content of the strings. Change-Id: Ia3bff36c4ee1e9a44f474534e154830948beabdf
2010-08-13Change aapt's warning message to suggest formatted="false", not "true".Eric Fischer
True is the default and specifying it won't suppress the warning. Change-Id: I8ecc919b4059bf3321e781649cb46dd2d3807592
2010-06-03Add error checking for translatable stringsKenny Root
Translatable strings that have multiple substitutions should use positional String.format() substitutions. This change makes it an error not to use that format on translatable strings that have more than one substitution in its text. Change-Id: I3a19707f3804aa24e8568dc1653a11576cac5916
2010-02-01Add the --rename-manifest-package option to aapt.Jeff Hamilton
It allows you to force override the manifest package listed in the AndroidManifest.xml when creating an APK file. Change-Id: I7eac7943c4e56610b65728ae54773a273634fd9d
2009-12-07Optional use of UTF-8 strings in resource bundlesKenny Root
Allows the use of UTF-8 for packing resources instead of the default of UTF-16 for Java. When strings are extracted from the ResStringPool, they are converted to UTF-16 and the result is cached for subsequent calls. When using aapt to package, add in the "-8" switch to pack the resources using UTF-8. This will result in the value, key, and type strings as well as the compiled XML string values taking significantly less space in the final application package in most scenarios. Change-Id: I129483f8b3d3b1c5869dced05cb525e494a6c83a
2009-09-01Make it an error to use a bare apostrophe in aapt, and adjust warnings/errors.Eric Fischer
In practice, no one ever writes an apostrophe in an aapt string with the intent of using it to quote whitespace -- they always mean to include a literal apostrophe in the string and then are surprised when they find the apostrophe missing. Make this an error so that it is discovered right away instead of waiting until late in QA or after the strings have already been sent for translation. (And fix a recently-introduced string that has exactly this problem.) Silence the warning about an empty span in a string, since this seems to annoy people instead of finding any real problems. Make the error about having a translated string with no base string into a warning, since this is a big pain when making changes to an application that has already had some translations done, and the dead translations should be removed by a later translation import anyway.
2009-07-13Format aapt warnings the same way as other compiler warningsMarco Nelissen
('warning: ' instead of 'WARNING: ' or 'WARNING ')
2009-05-15Implement compatibility support for WRITE_SDCARD permission.Dianne Hackborn
Now old applications will automatically be granted it. Also renamed it from SDCARD_WRITE to WRITE_SDCARD to be consistent with our other permissions, and re-arranged how we do targetSdkVersion to actually be usuable for this kind of stuff. Note that right now this results in basically all apps being given the WRITE_SDCARD permission, because their targetSdkVersion is not set. I will be dealing with that in a future change.
2009-04-20AI 147028: Fix up aapt so it runs cleanly under the valgrind leak checker.Marco Nelissen
Automated import of CL 147028
2009-03-03auto import from //depot/cupcake/@135843The Android Open Source Project
2009-03-03auto import from //depot/cupcake/@135843The Android Open Source Project
2009-02-10auto import from //branches/cupcake/...@130745The Android Open Source Project
2008-12-17Code drop from //branches/cupcake/...@124589The Android Open Source Project
2008-10-21Initial ContributionThe Android Open Source Project