251 Commits

Author SHA1 Message Date
TreeHugger Robot
df2870df9a Merge "AAPT2: Fix parsing ResTable_type" 2017-03-06 20:01:17 +00:00
TreeHugger Robot
ae3c244944 Merge "AAPT2: Fix Plural::Equals() method" 2017-03-04 00:50:51 +00:00
Adam Lesinski
136fd0764f AAPT2: Fix parsing ResTable_type
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
2017-03-03 14:01:09 -08:00
Adam Lesinski
ac6edc501b AAPT2: Fix escaping sequence processing in XML parsing
Bug: 35483813
Test: make aapt2_tests
Change-Id: I68baba17ab3639c220b734a2a68d86aad0dedf8c
2017-03-02 19:32:32 -08:00
Adam Lesinski
8f7c550e20 AAPT2: Fix Plural::Equals() method
Test: make aapt2_tests
Bug: 35902437
Change-Id: I8797f89af58876f891f0b0c5cce85fd7781c4e24
2017-03-02 17:45:51 -08:00
Adam Lesinski
b5dc4bd49a AAPT2: Few tweaks to get shared-libraries working
Test: manual (building shared support library demo)
Change-Id: I4730645aa92ba1893baf67ffe35fbd4aac0f8e46
2017-02-22 19:54:43 -08:00
Adam Lesinski
d48944a745 AAPT2: Rename strip phase to optimize
- Allow resource deduping, version collapsing, and sparse resource
  encoding.

Test: manual
Change-Id: Ia4aa892ab5b06ba1d5ea4a6efb51b00bc3a980c4
2017-02-22 11:41:55 -08:00
Adam Lesinski
ceb9b2f80f AAPT2: Shared library support
Test: make aapt2_tests
Change-Id: I98dddf1367e6c0ac425bb20be46e6ff05f4f2f45
2017-02-22 11:16:13 -08:00
Adam Lesinski
c8f71aa67e Add ResTable_sparseTypeEntry support
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
2017-02-15 12:40:02 -08:00
Pierre Lecesne
5b12734fb0 Merge "Allow for multiple preferred densities in the strip command." 2017-02-12 18:44:01 +00:00
Pierre Lecesne
672384b41e Allow for multiple preferred densities in the strip command.
Test: Unit tests pass.

Change-Id: I1f27ac8c36ff3489e4c8e4fce7f3d9cb31df6906
2017-02-12 15:57:41 +00:00
TreeHugger Robot
024d22fdb7 Merge "AAPT2: Fix pseudolocalization to respect <xliff:g>" 2017-02-09 16:17:18 +00:00
Adam Lesinski
7542162cb1 AAPT2: Fix pseudolocalization to respect <xliff:g>
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
2017-02-08 06:23:45 -08:00
Adam Lesinski
929d6517df AssetManager2: Add GetResourceId
Add ability to lookup a resource by name.

Test: make libandroidfw_tests
Change-Id: I262ba5ce4c9892458226fbdb44cf21f9877fb92d
2017-02-08 06:04:52 -08:00
Pierre Lecesne
0355dccc85 Merge "Only compress files that were already compressed in the original APK." 2017-02-04 03:54:43 +00:00
Adam Lesinski
558a63056e Merge "AAPT2: Support CtsContentTestCases build" 2017-02-04 03:44:25 +00:00
Pierre Lecesne
fa131d5312 Only compress files that were already compressed in the original APK.
Also fix a log message.

Test: Manually. Unit tests pass.

Change-Id: Iea236bbcfbe1a0a0894ce1bfce09c19208c5a0bc
2017-02-03 19:49:37 +00:00
Pierre Lecesne
2968cbf4aa Strip the resources from the APK using the TableSplitter.
Test: Unit tests pass.

Change-Id: I1dd71581113fb9a6feeefa9c794cc282529c3754
2017-02-03 18:57:09 +00:00
Pierre Lecesne
fc866baa33 Merge "Iterate over the zip entries in order." 2017-02-03 18:51:42 +00:00
Pierre Lecesne
265066c51d Merge "Expose whether a file was compressed before being loaded in memory." 2017-02-03 18:50:16 +00:00
Pierre Lecesne
970732dc45 Expose whether a file was compressed before being loaded in memory.
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
2017-02-02 23:39:24 +00:00
Pierre Lecesne
880d65b4fd Iterate over the zip entries in order.
Test: Unit tests pass.

Change-Id: I0501fad51a87c6cc91f2fc22358cd356616e1a2e
2017-02-02 22:52:44 +00:00
Pierre Lecesne
2599aa4dfd Add a method LoadedApk::WriteToArchive.
Test: Manually.

Change-Id: I61717204e58ca2bbfba9a52c7aecf27882a853f8
2017-02-02 21:35:21 +00:00
Adam Lesinski
86d67df8d5 AAPT2: Support CtsContentTestCases build
- 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
2017-02-01 15:28:23 -08:00
Pierre Lecesne
8a7b4cb992 Backbone of the new aapt2 strip command.
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
2017-02-01 18:49:19 +00:00
Pierre Lecesne
ff759e6a6e Moving the LoadedApk class to its own file.
Test: Unit tests pass.

Change-Id: Id706f9ad1f3406bb73a60a33139a04745d5d72c0
2017-02-01 00:31:55 +00:00
TreeHugger Robot
e84ad491c8 Merge "Add color mode to activity/window" 2017-01-25 01:20:28 +00:00
Romain Guy
4832745b84 Add color mode to activity/window
The color mode lets an application request a wide color gamut for
a specific window. This will also be used in the future to request
HDR. The color mode is currently either default (sRGB) or an undefined
wide gamut color space chosen by the platform. These attributes could
later be used to choose a specific color space if we deem this important
or useful.

This change also renames the various "colorimetry" attributes and
constants to "color mode" for consistency. These symbols were
added in O and can be safely renamed.

Test: CtsColorModeTestCases
Bug: 32984164
Change-Id: I4d4691dd12dbe3f3aa6a5cf893cff39aa16c739e
2017-01-24 15:55:09 -08:00
Yuichi Araki
4d35cca96c AAPT: Add --no-version-transitions flag
Add a new flag to disable versioning of Transition related XMLs.
Transition support library will use this to handle these XMLs on older
API levels.

Test: make libaapt_tests AaptTestAppOne
Bug: 34427868
Change-Id: I66e81cca049e71ef6704177b2ca21c9cdeaff78f
2017-01-24 14:59:51 +09:00
Romain Guy
c9ba559021 Add wide color gamut and HDR resource qualifiers
Bug: 32984164
Test: Config_test, AaptConfig_test and aapt2_tests
Change-Id: Ie9c82bfe2d36b1d6180ee223250ab5bb2ce90dd4
2017-01-19 18:44:00 -08:00
Adam Lesinski
d5083f6f6b 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
2017-01-17 18:55:51 -08:00
Fabien Sanglard
d8cb7dcc41 Merge "AAPT2: Convert Android.mk to Android.bp" 2017-01-17 16:34:06 +00:00
Fabien Sanglard
191602091b AAPT2: Convert Android.mk to Android.bp
Change-Id: I6c563993b57e3f04165ca57743f9a2878aba556c
2017-01-13 18:56:55 -05:00
Zak Cohen
1a6acdbb86 Introduce new UI_MODE_TYPE_VR_HEADSET and qualifier.
Bug: 30989383
Test: Unit test for aapt2
Change-Id: I66dc65af6327b94fed74538bee08cada0b8be4fa
2017-01-11 11:44:47 -08:00
Adam Lesinski
38665547bb AAPT2: Treat non-AAPT attributes as Attributes with no format specified.
Attributes in XML like "class" should be treated as attributes with no
format specified. That means that something like 'version="1"' will
be interpreted as an Integer value instead of as a string.

This is more in line with the old AAPT behaviour.
Bug: 30763349
Test: make libaapt2_tests

Change-Id: I02fe41617e3c62c354714056198ef480d62afee7
2016-12-28 12:40:35 -05:00
Adam Lesinski
5119e51730 AAPT2: Allow <meta-data> in <manifest>
Bug:32171613
Test: libaapt2_tests
Change-Id: I30fdd9475ff7dff6ceb0ff46a4a00991b72db68b
2016-12-05 21:09:52 -08:00
Tamas Berghammer
67387af732 Merge "Update package names to work with the proto3 compiler" 2016-11-09 13:38:58 +00:00
Adam Lesinski
f96789d37c Merge "Add font type to AAPT2" 2016-11-08 23:03:58 +00:00
Tamas Berghammer
383db5ebcc Update package names to work with the proto3 compiler
Bug: b/28974522
Change-Id: I5f3adf4946ee4ba1e09e4f40afe83c151405972a
2016-11-08 14:06:09 +00:00
Paulo Casanova
a256408b24 Renamed Aapt2.java to Aapt2Jni.java.
See http://ag/1590668 for a discussion.

Test: Done in tools
Change-Id: I3bfced0da98ab24531c1c1a79970841b32bfa1fa
2016-11-04 11:28:44 +00:00
Paulo Casanova
573cccfea7 Merge "Updated JNI interface." 2016-11-03 18:39:04 +00:00
Paulo Casanova
b555b59f2e Updated JNI interface.
Added new "ping" method used to detect if the shared
library has already been loaded.

Fixed a few bugs in the implementation (and now it works
from the Java side).

See http://ag/1590668 for the implementation on devtools.

Test: Done on the tools side
Change-Id: Ifa41073dc3b6ac69cdb9f77e655bf261c3b4c3d1
2016-11-03 10:14:42 +00:00
Paulo Casanova
3497b26507 Added Windows support for aapt/JNI.
This includes copying and slightly modifying
libnativehelper's ScopedUtfChars' implementation.

Test: Done in studio-master-dev
Change-Id: I2aacc67b444668478aaa5bb0db991a201c571d1f
2016-11-03 09:39:43 +00:00
Adam Lesinski
c0c366394c Add font type to AAPT2
Test: make libaapt2_tests AaptTestAppOne
Change-Id: I8fbf01675a218cc3c0b59598b6b1ec173851e946
2016-10-27 18:09:00 -07:00
Adam Lesinski
e343eb145c 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
2016-10-27 16:31:58 -07:00
Adam Lesinski
ce5e56e243 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
2016-10-26 19:30:23 -07:00
Paulo Casanova
418063c63f Merge "Added JNI interface for aapt2." 2016-10-22 08:19:19 +00:00
TreeHugger Robot
b366402a68 Merge "AAPT2: Ensure string pool ordering is compact" 2016-10-22 00:37:20 +00:00
Adam Lesinski
b54ef10f55 AAPT2: Ensure string pool ordering is compact
Keep styledstrings at the beginning of the StringPool
to reduce the padding in the StyledString array.

Bug:32336940
Test: manual
Change-Id: Iec820c21a54daac40ecc3b2f87517a0f1efc9d3d
2016-10-21 13:51:59 -07:00
TreeHugger Robot
577e66cc43 Merge "AAPT2: Fail compile on bad output file/dir" 2016-10-21 03:04:12 +00:00