History log of /frameworks/base/tools/aapt2/xml/XmlDom.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e1094a2e232277a719025aa5c97c492502c34f5b 23-Feb-2018 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix issue with String flattening in XmlFlattener

Compiled Strings (previously not encountered) in an XML resource
were using a different StringPool than the one being referred to
in the XmlFlattener, and so the indices were all wrong.

Bug: 72700446
Test: make aapt2_tests
Change-Id: I663924f8fad50fd4c69cfa196318dc63fb641a25
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
bbf429795d0558797e7ac8d1024fa5c16552e96c 14-Feb-2018 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix issue with deserializing binary XML

We assumed that a raw text value set for an attribute meant there
were no compiled values set either.

This would only really happen for attributes that did not belong to any
namespace (no prefix:), since we always kept their raw string values
in case some code relied on it.

Bug: 72700446
Test: make aapt2_tests
Change-Id: Icba40a1d4b181bfe7cad73131c4dbe5ba7f8b085
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
c6284379a5dde6bc5927409eff292db2f0add578 04-Dec-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Embed version of framework an app was compiled against.

This change injects the 'android:compileSdkVersion' and
'android:compileSdkVersionCodename' into an app's AndroidManifest.xml,
whose values are dervied from the version name and version code of the
framework AndroidManifest.xml that is being linked against.

Bug: 63388434
Test: make aapt2_tests
Change-Id: I7b607192ecb337307c4bcb5770e7f716c6d4c9d2
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
8780eb6e4918ae24fb1ae74d631042c32e41dc3d 01-Nov-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Add convert command

This command allows a developer to convert their proto APK
(generated from the link phase using --proto-format) into
a binary APK suitable for use on device.

aapt2 convert -o output.apk input.apk

Test: manual + make aapt2_tests
Change-Id: I10a7c33bb4b57006d01fe00a8bf92f78e04e7e50
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
004511660671511ae88e0e837a6f92db28eadaef 03-Oct-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Define and Implement AAPT Container Format

AAPT Container Format (.apc) is a simple container that
enumerates the various intermediate files that AAPT2 generates
during the compile phase.

The format is defined in formats.md.

For now, continue using the .flat extension for the container file,
and keep making use of the .flata zip for storing multiple files.
This will allow easier integration with existing build systems and allow
the evolution of the APC format to better handle arbitrarily large
files.

Test: make aapt2_tests
Change-Id: Id7216e5b76316bdd683f0fa4eaf2d2da273ba815
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
d3ffa844f5a07756009f019e13806e253d1bb119 28-Sep-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Cleanup Visitors for XML and Values

Test: make aapt2_tests
Change-Id: Ib61f64c155a380115610edeaf2d65e60258a2426
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
4b8ca8be4d6b0e867f5a421197fa4b5d006fd311 08-Sep-2017 Shane Farmer <safarmer@google.com> AAPT2: Handle inflating compiled attributes.

* Added the resource ID pulled from the XML parser into the compiled
attribattribue. This allows binary attributes such as the version code
and min SDK values to be available whern flattening the XmlResource back
into an APK file.

* Only add a compiled value if the attribute value was not a string.
This allows string values like the package name and version name to be
flattened back into an APK file.

Before making this change, aapt would segfault when dumping the manifest
and dumping badging would be missing values. After making this change,
the manifest and badging are dumping correctly.

Test: ran unit tests
Test: manually ran optimize against an APK
Change-Id: I885bb06557b032b9f702e8065d637d359c2b519b
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
1ef0fa9d7242b1926543bc49e35905d1be02a781 16-Aug-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Fixup namespace implementation

A few pieces were missing in the namespace mangling implementation.
Namespace aware libraries now work, along with R class generation.

Bug: 64706588
Test: make AaptTestNamespace_App
Change-Id: I12f78d6aa909e782c0faf7ceaa36058f2e6c864a
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
6b372991296c9f2bd6f8f8847dcd23d50970d06d 09-Aug-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Change XmlDom to exclude Namespace as a node

In preparation for exporting an XML proto format for UAM to consume,
this change brings the XML DOM API more in line with other APIs that
do not make the Namespace a separate node.

Treating Namespace declarations as just properties of an Element
node makes the implementation of algorithms much simpler, as
the constraints that Namespace nodes have only one child
are now built in and traversing to find Element nodes
is much simpler.

Also made a bunch of quality of life improvements, like formatting and
comment style.

Test: make aapt2_tests
Change-Id: Ib97ff1c4252b7907e2cc1f13a448dc4ca3b809a4
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
efeb7af13be4446ce4a511a2ca707691e9a67c1e 02-Aug-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix windows unicode path issues

Mingw64 was being difficult, so instead of defining a wmain entrypoint,
the command line parameters are parsed manually using built-in Windows
methods that support Unicode. The results are converted to UTF8 and
handled just like the rest of the linux/mac version of the code.

This also removes dependencies on std::istream in favour of a
FileInputStream which calls the appropriate unicode version of
open to read a file.

No speed regressions found on Linux or MacOS.

Bug: 62336414
Bug: 63830502
Test: manual
Change-Id: I597da51e33729ed1b98bf246e7e773337fd3fee8
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
c744ae8aca97edfb2422598ea620e8219449fa9b 18-May-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Implement attribute compat versioning

This change defines some hardcoded rules to degrade
attributes in newer SDKs to specific older attributes.

An attribute with a degrade rule will generate a new XML for the API
in which the attribute resulting from the degradation was introduced.

Since API 22 (Lollipop MR1), attributes are correctly ignored and do
not need to be versioned. In XML files defined for APIs 22+, the
original and degraded attributes coexist in the same XML file.

One such example is paddingHorizontal, introduced in API 26.
paddingHorizontal degrades to paddingLeft and paddingRight, which
were both introduced in API 1.

Bug: 35763493
Test: make aapt2_tests
Change-Id: I4aa8755a9ee2c0cc5afdc55c3d30093fd3a47f3d
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
48448e8a310e72eb2846ad0f86672ce4f0b47e47 27-Apr-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix string escaping

We were processing escaped strings too early, before
parsing of values into types. Now the escaped strings get
processed when they are being flattened.

Bug: 37715376
Test: make aapt2_tests
Change-Id: Ic59aa2e3a20c40756c219752ff74b2a4f8a602ba
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
ea134e08d70d156bdd17714d5f9ab9c44c91d4fa 13-Apr-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix order-of-destruction crash

Make sure that users of StringPool are destroyed before
the StringPool itself.

Test: valgrind aapt2 optimize -o opt.apk out/target/common/obj/APPS/framework-res_intermediates/package-export.apk
Change-Id: I140c2d32f8449028976795d5d6865d83e1409b53
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
d0f492db038c6210c1138865d816bfb134376538 04-Apr-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Share split functionality between link and optimize

Generating splits should be possible to do from the optimize command.
This means that a lot of infrastructure around split APKs can be
shared by both the optimize and link phase.

Bug: 35925830
Change-Id: Ia88b9e4bff300a56353b2f7a4a2547c8eb43a299
Test: manual
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
ac6edc501b61e14e3b70ccbbd4d8ed112d92b96c 03-Mar-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix escaping sequence processing in XML parsing

Bug: 35483813
Test: make aapt2_tests
Change-Id: I68baba17ab3639c220b734a2a68d86aad0dedf8c
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
d5083f6f6b9bc76bbe64052bcec639eee752a321 17-Jan-2017 Adam Lesinski <adamlesinski@google.com> Move StringPiece to libandroidfw

libandroidfw needs to make use of StringPiece, so
move it to libandroidfw and update all code referencing
StringPiece in aapt2.

Test: make libandroidfw_tests libaapt2_tests
Change-Id: I68d7f0fc7c651b048d9d1f5e7971f10ef5349fa1
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
e343eb145c42d00c4fd3fdde93cd0be55cb5b855 28-Oct-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Insert <uses-sdk> element before <application>

PackageParser on the device uses the targetSdkVersion of the
app while it parses <application>. That means that if the
<uses-sdk> tag comes after <application>, the targetSdkVersion
is assumed to be 0.

Test: make libaapt2_tests
Change-Id: I60f2179a7ff44e7419217afb53f3d24f8c030f6e
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
ce5e56e243d262a9b65459c3bd0bb9eaadd40628 22-Oct-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Rename to match new style

Use Google3 naming style to match new
projects' and open source google projects' style.

Preferred to do this in a massive CL so as to avoid
style inconsistencies that plague legacy code bases.
This is a relatively NEW code base, may as well keep
it up to date.

Test: name/style refactor - existing tests pass
Change-Id: Ie80ecb78d46ec53efdfca2336bb57d96cbb7fb87
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
5eeaaddffd23d8d85aeb321e3ceea626e42cf9de 25-Aug-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Add Inline Complex XML support

See: https://developer.android.com/guide/topics/resources/complex-xml-resources.html

Change-Id: I8274c85e25cabf90423141c228697e873167d136
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
d0f116b619feede0cfdb647157ce5ab4d50a1c46 09-Jul-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Remove usage of u16string

For legacy reasons, we kept around the use of UTF-16 internally
in AAPT2. We don't need this and this CL removes all instances of
std::u16string and StringPiece16. The only places still needed
are when interacting with the ResTable APIs that only operate in
UTF16.

Change-Id: I492475b84bb9014fa13bf992cff447ee7a5fe588
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
803c7c807969bea1f1c50f348832f5b60ad05d8e 07-Apr-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Enable windows build and make sure it builds

Mingw32 4.8 is kind of picky with macros and some complicated template
stuff. Luckily there was another way to represent the
SFINAE code that works on all platforms. Yay!

Change-Id: Idc2e38f47bfdc57b394550bfa0f53cc0b825df25
/frameworks/base/tools/aapt2/xml/XmlDom.cpp
467f171315f9c2037fcd3eb5edcfabc40671bf7b 17-Nov-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Fail compiling when private symbols are referenced

Also moved some XML specific stuff into its own directory,
and refactored ReferenceLinker a bit.

Change-Id: I912247a82023c1bbf72dc191fbdaf62858cbec0c
/frameworks/base/tools/aapt2/xml/XmlDom.cpp