Commit Graph

5670 Commits

Author SHA1 Message Date
Adam Lesinski
5fae742a1e Merge "AAPT2: Ensure strings are sorted by configuration" into oc-mr1-dev
am: 8da74b1bfd

Change-Id: Ifd3555db424136fe8a8057504df414f41fb020a1
2017-10-19 21:43:31 +00:00
TreeHugger Robot
8da74b1bfd Merge "AAPT2: Ensure strings are sorted by configuration" into oc-mr1-dev 2017-10-19 21:31:10 +00:00
Adam Lesinski
8a0b238b13 AAPT2: Ensure strings are sorted by configuration
Keep strings sorted by configuration so that strings likely
to be selected (all match the same locale, for instance) are
close together.

Bug: 67958501
Test: make aapt2_tests
Change-Id: Id17d93bf2e03ce408a6f619d3ea6dc313e393b76
2017-10-18 15:12:42 -07:00
Dan Willemsen
bfc9e71e0d Merge "Use soong_ui directly, instead of make" am: e994b4b584 am: 0531e5c647
am: 98fc198f1f

Change-Id: Id17adee4b02cc499261f88c3faed15d889f5b6c3
2017-10-18 06:24:45 +00:00
Dan Willemsen
0531e5c647 Merge "Use soong_ui directly, instead of make"
am: e994b4b584

Change-Id: I406a02af2d5fd1accf5c53609af00f416669e18f
2017-10-18 06:10:06 +00:00
Adam Lesinski
f60d30b682 Merge "AAPT2: Flatten AndroidManifest.xml stringpool in UTF16" into oc-mr1-dev
am: 3bdfe1a251

Change-Id: I3295e61dcf29a7cb242b4ee0017f2fd94a0cfd65
2017-10-18 00:57:26 +00:00
Dan Willemsen
a40118d7b6 Use soong_ui directly, instead of make
This will use ckati instead of make for dumping variables, for
consistent makefile parsing. It may also sandbox executions, etc.

Also skip the legacy make wrapper to build, and use soong_ui instead.
The command line arguments are equivalent, but -j is no longer
necessary, we'll default to a sane value.

Test: bit -b framework
Change-Id: Idc2c9d1abe84b6b783b8702925de5493d47a4509
2017-10-17 17:53:36 -07:00
Adam Lesinski
9c40250cdf AAPT2: Flatten AndroidManifest.xml stringpool in UTF16
A few OEM devices have introduced a memory corruption bug
that is only triggered when an application's AndroidManifest.xml
uses UTF8 string pools. Workaround this by only encoding
AndroidManifest.xml with UTF16 strings.

Bug: 64434571
Test: manual
Change-Id: I2ee50d1b2b5942d971ef2a544c878de63f67c652
2017-10-17 15:16:41 -07:00
Chih-hung Hsieh
decc397b26 Merge "Use -Werror in frameworks/base" am: 16fbd3a1d8 am: 0bfb717a37
am: 9f004b1752

Change-Id: I6517ee1689b0247caf830a6c3528bfa9bcf91f75
2017-10-16 19:50:38 +00:00
Chih-hung Hsieh
0bfb717a37 Merge "Use -Werror in frameworks/base"
am: 16fbd3a1d8

Change-Id: Iab69cf4f99cf4bedd12eb7764c773a893bfe5343
2017-10-16 19:24:53 +00:00
Tobias Thierer
b5a80794bb Merge "Update locked_region_code_injection tool to ASM 6.0-BETA." am: 26817938f6 am: e69366ff27
am: 8e60defe4b

Change-Id: Ic425066feb4288c37154d8b0c487aeda93a6ac59
2017-10-15 03:18:47 +00:00
Tobias Thierer
e69366ff27 Merge "Update locked_region_code_injection tool to ASM 6.0-BETA."
am: 26817938f6

Change-Id: I193d04b7a4ebf0f39f60ac275a7eeb93499ded9d
2017-10-15 02:38:05 +00:00
Chih-Hung Hsieh
c7edf078f9 Use -Werror in frameworks/base
* Fix unused variable and return value warnings.

Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I890e65a20848d00559ba5a4f9691be1347b456af
2017-10-13 16:25:16 -07:00
Tobias Thierer
26817938f6 Merge "Update locked_region_code_injection tool to ASM 6.0-BETA." 2017-10-13 17:40:50 +00:00
Tobias Thierer
95aa2ea9d8 Update locked_region_code_injection tool to ASM 6.0-BETA.
ASM 6 is required to read version 53 (OpenJDK 9) class files.

Test: make EXPERIMENTAL_USE_OPENJDK9=true services.core
      (in the presence of other unsubmitted CLs that fix
      other issues)
Test: Copied all required dependencies into a subdirectory lib/,
      then ran the steps from TestMain.java, both for OpenJDK 8
      and OpenJDK 9 toolchains.
Bug: 67676752

Change-Id: If324d8ea28450d9a8426a2279190b2f4d9213ed5
2017-10-12 21:14:31 +01:00
Chih-hung Hsieh
e640a8284d Merge "Revert work around clang-tidy segmentation fault."
am: a47e513464

Change-Id: Ie04d0d16a05c35a865776571f95078e63bc1bf47
2017-10-04 06:38:31 +00:00
Chih-Hung Hsieh
ca8dbebe1e Revert work around clang-tidy segmentation fault.
Bug: 34740546
Test: build with WITH_TIDY=1 and
WITH_TIDY_CHECKS="*,-readability-*,-google-readability-*,-google-runtime-references"

Change-Id: If99c75cab6a2bec0c6b38aa17189668b4943478d
2017-10-03 20:23:10 -07:00
Adam Lesinski
8e43e0d0ad Merge "AAPT2: Fix R.java styleable + indices ordering" into oc-mr1-dev
am: b986ebce75

Change-Id: I16382162fecf323074c13b376a23fccab1da092b
2017-10-03 22:02:20 +00:00
Adam Lesinski
8284349fc9 Merge "AAPT2: Preserve line numbers when deserializing from binary XML" into oc-mr1-dev
am: 9b581c7bc1

Change-Id: I55d8c73df0ce751472e58a9ae505c94edc90c68e
2017-10-03 21:51:09 +00:00
TreeHugger Robot
b986ebce75 Merge "AAPT2: Fix R.java styleable + indices ordering" into oc-mr1-dev 2017-10-03 21:24:48 +00:00
Yunlian Jiang
61879522fe Merge "Replace strcpy with memcpy." am: bb115bac41 am: 16951dcb54
am: 23f6dca5fd

Change-Id: I446973c3b96f253e3c3fc2dfda7647cd3e625916
2017-10-03 04:38:07 +00:00
Yunlian Jiang
16951dcb54 Merge "Replace strcpy with memcpy."
am: bb115bac41

Change-Id: I28c118a609d999fe1ef6bd126557e63076f452c6
2017-10-03 04:20:17 +00:00
Treehugger Robot
bb115bac41 Merge "Replace strcpy with memcpy." 2017-10-03 04:09:48 +00:00
Adam Lesinski
0da683bd8d AAPT2: Preserve line numbers when deserializing from binary XML
Bug: 65827146
Test: make aapt2_tests
Change-Id: Idbfea640eb8727fe209ebc6eb072296845d9f282
2017-10-02 17:00:07 -07:00
Adam Lesinski
1ee1a106c5 AAPT2: Fix R.java styleable + indices ordering
Make sure that Styleables are directly followed by their indices.
If not, Robolectric breaks. This is not strictly incorrect to have
an arbitrary ordering in R.java, but its easier to just support
Robolectric in this case.

Bug: 65837293
Merged-In: Ia59ba58427ade386d075ca9fc9eb5b53e35beca0
Test: make aapt2_tests

(cherry picked from commit af85c4deb667843a227d62275fe6992005f4c38d)

Change-Id: Ia59ba58427ade386d075ca9fc9eb5b53e35beca0
2017-10-02 15:42:24 -07:00
Yunlian Jiang
d32ae10f4c Replace strcpy with memcpy.
This fixes the warning
Call to function 'strcpy' is insecure as it does not provide bounding of
the memory buffer. As a side effect, it sliences the warning
frameworks/base/tools/aapt/Images.cpp:1270:50: warning: Potential leak
of memory pointed to by field 'data' [clang-analyzer-unix.Malloc]
frameworks/base/tools/aapt2/compile/Png.cpp:562:42: warning: Potential
leak of memory pointed to by field 'data' [clang-analyzer-unix.Malloc].

Bug: None
Test: The warning is gone.

Change-Id: I25f68ff85bea7069c21549c7deb7920d1877069e
2017-09-26 16:02:11 -07:00
Adam Lesinski
e33de76a16 Merge changes Id8bdb14e,I573a6735,Ia804777f,Ia68122cb,Ia1997800, ... into oc-mr1-dev
am: e02983681a

Change-Id: I42369e6fb7bd121e45b5a002cd5f00e05221ead3
2017-09-15 16:57:21 +00:00
Adam Lesinski
689ce3f658 AAPT2: Bump to version 2.19
Test: manual
Bug: 65645766
Change-Id: Id8bdb14e498bd79ff642f9ad56ef05ec7a5825af
Merged-In: Id8bdb14e498bd79ff642f9ad56ef05ec7a5825af
2017-09-15 08:49:24 +00:00
Adam Lesinski
a91d5c39ed AAPT2: Fix issue with resource deduping
Resource deduping relies on the definitions of
ConfigDescription.ConflictsWith, ConfigDescription.IsCompatibleWith,
and ConfigDescription.Dominates.

ConflictsWith is supposed to ignore range-based qualifiers, like
version, density, smallest width, screen size, etc.

This was not the case for screen size, and was assumed that the
choice of screen size is mutually exclusive.

This CL fixes the assumption and includes screen size (small, normal, large, xlarge)
as a qualifier that does not conflict.

Bug: 64397629
Bug: 65645766
Test: make aapt2_tests
Change-Id: I573a6735fedd7721a10ba32902bc5d27ef99b88e
Merged-In: I573a6735fedd7721a10ba32902bc5d27ef99b88e
2017-09-14 11:31:48 -07:00
Adam Lesinski
40e869e2a5 AAPT: Dump badging should pickup strings from the right package
A bug in the dump badging command caused strings to be looked up in the
first loaded package only.

Bug: 64948230
Bug: 65645766
Test: none
Change-Id: Ia804777fe3f963004a5c053129ef6e0c94b7f6a3
Merged-In: Ia804777fe3f963004a5c053129ef6e0c94b7f6a3
2017-09-14 11:31:40 -07:00
Adam Lesinski
f1a7e04851 AAPT2: Change the daemon mode to be line based
Accept a set of arguments separated by newlines.
This avoids path separator conflicts with the argument
format for passing splits.

Test: manual
Bug: 65645766
Change-Id: Ia68122cb77b7dde2292a0fd953e79f02996ac01c
Merged-In: Ia68122cb77b7dde2292a0fd953e79f02996ac01c
2017-09-14 11:31:30 -07:00
Izabela Orlowska
96ed7c3b17 AAPT2: better error handling for daemon mode
Test: manual
Bug: 65645766
Change-Id: Ia1997800ad94f386dbbb4195011395ecee1ba91f
Merged-In: Ia1997800ad94f386dbbb4195011395ecee1ba91f
2017-09-14 11:31:22 -07:00
Adam Lesinski
6e241e7e54 AAPT2: Fix regression in Manifest.java permissions
Permissions defined with the same leaf name emit the same
string symbol, which causes collisions. AAPT would override
the symbol with the last one seen.

Do the same thing as AAPT, but emit a warning.

Bug: 64472942
Bug: 65645766
Test: make aapt2_tests
Change-Id: I17b9dc7e8d8bd80db98869394c93695cb453bebd
Merged-In: I17b9dc7e8d8bd80db98869394c93695cb453bebd
2017-09-14 11:31:13 -07:00
Adam Lesinski
b791721cd1 AAPT2: Define intermediate compiled XML proto
This proto format is meant to encapsulate more information
that is specific to Android and allows for easier validation
and manipulation across tools.

Test: make aapt2_tests
Bug: 65645766
Change-Id: I13bc34a460671fc0a36246be0d287a3d37d244d6
Merged-In: I13bc34a460671fc0a36246be0d287a3d37d244d6
2017-09-14 11:31:04 -07:00
Adam Lesinski
44ec315e06 AAPT2: Add a daemon mode
Gradle and other build tools that need to frequently interact with aapt2
can use the daemon mode to issue regular CLI commands without paying
the process start cost for each invocation.

Test: manual
Bug: 65645766
Change-Id: I543858ed46496278bad643f0dae688c924ec6c3f
Merged-In: I543858ed46496278bad643f0dae688c924ec6c3f
2017-09-14 11:30:56 -07:00
Adam Lesinski
68b5e8a439 AAPT2: Fix mkdirs implementation
Once switched to using std::string, the mkdirs implementation was
trying to create an empty string when an absolute file path on
linux or macOS was used.

Bug: 62336414
Bug: 65645766
Test: manual
Change-Id: I52f3050b410a923ca48f353b0983667c16d00ee8
Merged-In: I52f3050b410a923ca48f353b0983667c16d00ee8
2017-09-14 11:30:48 -07:00
Adam Lesinski
5c33fb5408 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
Bug: 65645766
Change-Id: Ib97ff1c4252b7907e2cc1f13a448dc4ca3b809a4
Merged-In: Ib97ff1c4252b7907e2cc1f13a448dc4ca3b809a4
2017-09-14 11:30:38 -07:00
Adam Lesinski
5b54ca2d72 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
Bug: 65645766
Test: manual
Change-Id: I597da51e33729ed1b98bf246e7e773337fd3fee8
Merged-In: I597da51e33729ed1b98bf246e7e773337fd3fee8
2017-09-14 11:30:29 -07:00
Adam Lesinski
cb1e6f95ae AAPT2: Fix typo in Config parsing
The 'any' syntax of a configuration is rarely used so this has not been
an issue in the field.

Test: none
Bug: 65645766
Change-Id: Icb9cb2d5ad061e3ea1c43dc1cd7ca2f222965cdc
Merged-In: Icb9cb2d5ad061e3ea1c43dc1cd7ca2f222965cdc
2017-09-14 11:30:18 -07:00
Adam Lesinski
e116ebe0bc AAPT2: Change proto format to reduce usage of StringPool
The StringPool class is a binary blob and makes it difficult to
modify the proto files from external tools (like bundle-tool).

Size increase of full build is negligible.

Test: make aapt2_tests
Bug: 65645766
Change-Id: I984755170c315730ab751b51133f8fb2f614f6af
Merged-In: I984755170c315730ab751b51133f8fb2f614f6af
2017-09-14 11:29:47 -07:00
Adam Lesinski
ee0e486d36 AAPT2: Add navigation type
Test: build succeeds
Bug: 65645766
Change-Id: I7d49366c7cc4a93c29bad4cb9f13eec23ad05bd2
Merged-In: I7d49366c7cc4a93c29bad4cb9f13eec23ad05bd2
2017-09-14 11:29:34 -07:00
Adam Lesinski
18fc9f65d0 AAPT2: Document Format.proto
Test: none
Bug: 65645766
Change-Id: I6b05bcdece5a310201d3ab0790a4ea1d23698e96
Merged-In: I6b05bcdece5a310201d3ab0790a4ea1d23698e96
2017-09-14 11:29:24 -07:00
Adam Lesinski
fa6058118e AAPT2: Fix processing of quotes in XML
When processing attributes in XML, quotes can't be used to mark a
section as whitespace preserving, so the assumption should be that the
entire string is whitespace preserving, which makes quote characters
literals.

Bug: 62840718
Bug: 62840406
Test: make aapt2_tests
Change-Id: I4afff02148b5b8e78833abf1f323c2f5325d6155
2017-09-11 13:05:38 -07:00
Dan Willemsen
2e9ec5f0de Merge changes I93cf24d4,I32e438ef am: 30798ad13a am: c28d591b36
am: 59225490b8

Change-Id: I6cf57e951900b3df816070feee0d3bf92a6a5a7d
2017-09-10 02:05:05 +00:00
Dan Willemsen
c28d591b36 Merge changes I93cf24d4,I32e438ef
am: 30798ad13a

Change-Id: I0b178c8523d0c5829d731f6ed05cfa3fe89ad9b4
2017-09-10 01:44:06 +00:00
Treehugger Robot
30798ad13a Merge changes I93cf24d4,I32e438ef
* changes:
  Convert host tools to Android.bp
  Rename aapt_defaults to aapt2_defaults
2017-09-10 01:29:21 +00:00
Dan Willemsen
24041fe213 Merge "Convert incident_report and incident-section-gen to Android.bp"
am: d928842ab6

Change-Id: I0e0ff3d75ce5f9dc302052c1da057db8d5d35cd7
2017-09-09 22:11:38 +00:00
Dan Willemsen
eb211c23d5 Merge changes Ia3bcece1,Icd26dc1e am: ec462238f6 am: c201a6bb7d
am: 9539d236e7

Change-Id: I2a5c73a54004c1aa378d25776de0d2080544137d
2017-09-09 19:54:02 +00:00
Dan Willemsen
0b4a0272c7 Rename aapt_defaults to aapt2_defaults am: 7544b9cbb9
am: 6737dc9448

Change-Id: I78debad7c68e37bd935b881ad791a771c8ee86c7
2017-09-09 19:33:53 +00:00
Dan Willemsen
c201a6bb7d Merge changes Ia3bcece1,Icd26dc1e
am: ec462238f6

Change-Id: Ied36c517ed7fa80dc85b07b1532821dc93628d40
2017-09-09 19:28:33 +00:00