Trailing data after the main RES_TABLE_TYPE should be logged but not
cause an error.
Bug: 36945869
Test: (aapt2 dump apk/attached/in/bug.apk)
Change-Id: I784406a680b79630798fdb4b7ca81f9d1f2b96d1
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
In order to support a staged rollout of support for AAPT2,
libraries being built the old way (merged into a single resource
directory) still need to make use of the generated R.txt AAPT
emitted. Do the same as AAPT.
Test: manual
Change-Id: Iaac1e824ddbd67e4efbab7692cddc1e4aa052f5a
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
Pseudolocalization didn't properly handle spans in
strings like "<small><small>Hello</small></small>".
The spans would be identical and when doing range checks
only one of them would be updated.
Switched to a more robust way of extracting the relevant
chunks of a styled string. This uses a stack, which is more
in line with the real representation in XML.
Bug: 34088357
Test: make aapt2_tests
Change-Id: Ia4e4501713e688c96a89e26e4e2b1384f4cd3889
Presumably, the apps build fine for the developers, so just
feed the existing names through without validation. Validation
still exists when building an app from source.
Bug: 36051854
Change-Id: Idc64ee91b08dce67d3c28f3c5284a7afa1312df1
Test: run aapt2 optimize on the apks from b/36051854 and build aapt2_tests
ID types should not be encoded as a map. AAPT and AAPT2 emit
IDs as boolean types.
Some apps exist that for some reason have their ID types encoded
as empty maps. This is the case only for the auto generated IDs
from enum values in <attr> tags.
Allow IDs as maps and ignore their content when processing an APK
for optimizing.
Also fixes an issue with expected size of the ResTable_package struct.
Bug: 35861796
Test: tested against the APK in b/35861796
Change-Id: I29a19cd9777bb10bed6766cd42e35e50e098797b
This also enables an AAPT behavior that CTS tests have
come to depend on.
Small files that compress negatively (get larger) are stored
uncompressed. Some CTS tests assume this and try to open these
files by mmapping them, which is only possible if they are
uncompressed.
Bug: 35461578
Test: make aapt2_tests
Change-Id: Id622a6150fe72477ad65d67d1bad897a8ee2ffb9
An overlay was incorrectly leaking its own resources into the
framework resource package, which caused warnings for every app
that tried to access framework resources (all of them).
This change skips including any resources that are not overlaying
anything (not present in IDMAP).
Bug: 36256974
Test: make libandroidfw_tests
Change-Id: I8c710af6849bb848938825aacca02799ee96c003
- Prefix the config split name generated from a feature split with the
name of the feature split.
- Add the 'configForSplit' attribute to the <manifest> tag of a config
split and give it the same name as the feature split it was generated
from.
- Look for the featureSplit attribute in <manifest> and automatically
convert it to 'split' and inject 'android:isFeatureSplit="true"'.
Feature splits should be written like so:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.foo.example"
featureSplit="feature_b">
<uses-split android:name="feature_a" />
...
</manifest>
Bug: 34703094
Test: manual
Change-Id: I01b5c4a9aa03a2d25ef1e87bc7874b57c9deede9
Looks like the build system doesn't support assets/ for
resources, so we will re-introduce them in aapt2, even though
we're just copying them around and they would be better
suited for inclusion in the APK when classes.dex gets inserted.
Bug: 35461578
Test: CTS test android.content.res.cts.AssetManager#testAssetOperations should pass
Change-Id: I18361d7367d476806bcf7154ee76df3f0e83b565
ResTable_type's size changes due to it containing
ResTable_config. Make sure we check for the minimum size
required to read it.
Bug: 35861796
Test: Manual (don't have an integration test harness setup yet)
Change-Id: Ifb0cd1d732625f59835c8ed0449adb78129636de
Benchmarks on bullhead-userdebug show that there is a negligent
performance impact when using sparse entries on a 30% loaded
sparse type of 1000 resources.
Benchmark Time CPU Iterations
-----------------------------------------------------------------------------------
BM_SparseEntryGetResourceSparseLarge 255 ns 254 ns 2751408
BM_SparseEntryGetResourceNotSparseLarge 254 ns 254 ns 2756534
Bug: 27381711
Test: make libandroidfw_tests aapt2_tests
Change-Id: I051ea22f2f6b2bc3696e446adc9e2a34be18009f
The XLIFF 'g' tag specifies content that should NOT be translated.
AAPT2's pseudolocalization process should respect it.
Bug:34064599
Test: make libandroidfw_tests
Change-Id: Ice437d7f0ff246730ee04896fd035e2d846148fb
This is useful when we want to write an APK and keep the same
compression parameters as the original APK.
Test: Unit tests pass.
Change-Id: I3afcae1c8727e429b08c9ac7359cf0789ff4abfc
- Add <feature-group> to ManifestFixer.
- Support <meta-data> in <instrumentation>
- Add support for <bag> and type="configVarying". Some CTS tests use this
old notation, we need to support it (even though configVarying isn't
anything supported by the framework convention).
Change-Id: I6946fa633ce513ea8437c1496db883cf27dcf6de
Test: make aapt2_tests
The strip command takes an APK as argument and a --target-densities flag which
contains the list of screen densities for which to optimize the APK. All
the resources that would be unused for a device having the given
densities are stripped from the APK leaving only the ones actually being
used.
Test: Manual.
Change-Id: I68368b00876a18ccdbbfc0a8dd265bd361117933