Commit Graph

5971 Commits

Author SHA1 Message Date
TreeHugger Robot
e5b3296316 Merge "Allow <adopt-permissions> tag in manifest" 2018-01-19 17:10:29 +00:00
David Chaloupka
cfd1b4b263 Merge "Handle multiple packages of same name in 'aapt2 convert'" 2018-01-19 10:57:53 +00:00
TreeHugger Robot
e528516731 Merge "Ignore missing font in fontchain_linter.py" 2018-01-19 03:37:25 +00:00
Seigo Nonaka
1403ff2b0b Ignore missing font in fontchain_linter.py
It is totally valid if the font is missing even if the font is listed in
fonts.xml. Android Watch has less fonts and OEM vendor may reduce the
font files.

Bug: 72159040
Test: m fontchain_lint
Change-Id: I22bdf7bfeb6d80a2a338ebf7536c8eaf193b03c5
2018-01-18 17:24:31 -08:00
TreeHugger Robot
8f2fffd809 Merge "AAPT2: Store BinaryPrimatives in protos as oneofs" 2018-01-19 01:00:00 +00:00
David Chaloupka
e3c1a4a9d2 Handle multiple packages of same name in 'aapt2 convert'
aapt2 currently looks-up packages only by package name and then verifies
whether the package ID has the expected value. For pre-L we need to be able
to handle resource tables having packages of same package name but
different IDs.

Note that this CL fixes only proto->binary conversion but many other aapt2
commands are still affected. This is because many transformations still
consider package name as sufficient identifier of a package.

Bug: 72143207
Test: Manual
Change-Id: Id8a920d6cd15bec747d3124270f5bcb7f48924cf
2018-01-18 19:20:01 +00:00
David Chaloupka
415689bb1c Merge "Adjust file reference type in 'aapt2 convert'" 2018-01-18 10:06:01 +00:00
Michael Wachenschwanz
d06f1f38a9 AAPT2: Store BinaryPrimatives in protos as oneofs
Fixes: 69587794
Test: aapt2_tests

Change-Id: Idf5526f6b1b720b6e476bcdf8c2155e13a6ecc0f
2018-01-17 16:58:43 -08:00
TreeHugger Robot
bd56951c5b Merge "aapt2: Fix issue with Manifest duplicate handling" 2018-01-17 20:20:29 +00:00
David Chaloupka
b66db4ec4c Adjust file reference type in 'aapt2 convert'
When converting between binary and proto APKs in either direction, the
'aapt2 convert' command did not adjust FileReference type for entries
inside the resource table. This fix makes in-place changes of the resource
table passed to ConvertApk, which is safe since the resource table is
thrown away after the conversion.

Bug: 71854843
Test: Manual
Change-Id: Ide6e141269392db15b399db3566f18175f5133d5
2018-01-17 11:07:44 +00:00
Adam Lesinski
a4fb17bbbb aapt2: Fix issue with Manifest duplicate handling
Fixed a memory-corruption issue that led to multiple duplicate
permission entries being generated for Manifest.java.

Bug: 71641288
Test: make aapt2_tests
Change-Id: I8cd37929c4883aaba2beebbf874c7ee3234d51d8
2018-01-16 17:06:33 -08:00
Yangster-mac
ba5b9e44bb Stats log interface for single node attribution chain.
Usually the input parameters for attribution chain is list of int64/string.
The new c++interface takes one int64 and one string as input and write
as a single node into logd.

This will help avoid allocating temp objects in battery stats java code.

Test: all statsd unit test passed.
Change-Id: Ia0f7f26b71a570bd3628c42726a5afb0a500d073
2018-01-15 16:41:29 -08:00
TreeHugger Robot
db947de10f Merge "Add another pass of commont lint rules." 2018-01-12 20:57:05 +00:00
Jeff Sharkey
336dd0bf63 Add another pass of commont lint rules.
-- Parcelables should be inflated through CREATOR
-- Methods with no arguments should throw ISE
-- Examine constructors for Executors
-- Listeners should always be last for lambdas
-- Verify naming of UserHandle methods
-- Verify naming of Params objects
-- Verify naming of Context service constants
-- Verify tense of enabled methods

Better exception tracking.

Test: manual inspection
Bug: 37784434, 37749454, 37705832
Bug: 37705176, 37536230, 37533040, 71866617
Change-Id: If2f19784c46a4d99f54577a7365babfd357ca3f7
2018-01-12 12:12:29 -07:00
Izabela Orlowska
3c3f9b5d07 AAPT2: always compile 9patch files
Test: existing tests
Bug: 70578281
Change-Id: I7ffcbdd664108348182e71d01b1680e2399ec37c
2018-01-12 14:26:31 +00:00
TreeHugger Robot
4f9ba20690 Merge "AAPT2: Allow compatible duplicate Attributes" 2018-01-12 02:37:13 +00:00
Adam Lesinski
73bff1e851 AAPT2: Allow compatible duplicate Attributes
If a resource XML file defines two compatible Attributes, they should
be merged without throwing an error. Ex:

<declare-styleable>
  <attr name="conflict" format="string" />
</declare-styleable>

<declare-styleable>
  <attr name="conflict" format="string|reference" />
</declare-styleable>

In this case, string|reference and string are the same, so these should
merge correctly.

Bug: 65699599
Test: make aapt2_tests
Test: make AaptBasicTest
Change-Id: I7b0f956d2332f7f0b458acd59ca0a606b2cfdf95
2018-01-11 13:54:11 -08:00
Yi Kong
0556f3382b Add virtual dtor for virtual classes
Delete called on non-final virtual classes but non-virtual destructor.

Fixes -Wdelete-non-virtual-dtor warning.

Test: m checkbuild
Change-Id: Ia84c118db1a53f1ac846354a6023726e394a87ed
2018-01-10 19:59:58 -08:00
Yangster-mac
20ac944ea0 Handle null string in jni and c++ stats-log-api interfaces.
Test: statsd unit test passed.
Change-Id: I4a475d6fcc0b4a0293450bc0ccdd718b362c498b
2018-01-08 14:54:48 -08:00
Yi Kong
95820bc4df Merge "Add virtual dtor for virtual classes" am: 27f61a94d6 am: 2d7813a4a7
am: 2807036b09

Change-Id: I3723483c2aac5580a7db3256a39eca278a3ee9fb
2018-01-08 21:22:21 +00:00
Yi Kong
2807036b09 Merge "Add virtual dtor for virtual classes" am: 27f61a94d6
am: 2d7813a4a7

Change-Id: I8787ff83ec93f5a8ae2e08e1af573d13750d9aa5
2018-01-08 21:07:09 +00:00
Yi Jin
3c034c987e Implement a new type of section which reads from logd and dumps proto.
And implement a file section which reads from event-log-tags for
decoding binary logs.

Bug: 70936599
Test: atest incidentd_test && atest incident_helper_test and flush on
device and test log sections and event_log_tag_map
Change-Id: Ib3d35e317f355de69f01ded012482486e9a43da6
2018-01-06 20:33:14 -08:00
Treehugger Robot
27f61a94d6 Merge "Add virtual dtor for virtual classes" 2018-01-05 23:27:33 +00:00
Alan Viverette
cf5326fae1 Allow <adopt-permissions> tag in manifest
Change-Id: Ib595ab84da3a68e6a72f203ee51e3c86c7a3a3d1
Fixes: 71640901
Test: migrate GoogleServicesFramework to AAPT2, build
2018-01-05 16:04:33 -05:00
Yi Jin
e058f1a952 Merge "Dump Proto to a csv" 2018-01-04 21:09:39 +00:00
Yi Jin
0f2599fbf0 Dump Proto to a csv
Bug: 69427323
Test: N/A
Change-Id: I1b89898afc30d5a0df6355ee1f6477df8d271f98
2018-01-04 11:03:31 -08:00
Colin Cross
e9727164cb Merge changes I9de0ffe9,Idc804896 am: 153fb1c6e0 am: 99161bc1c7
am: 52d4011195

Change-Id: Ia3b7f49d4dbd38660570c7c84991a69f86bf24e4
2018-01-04 01:17:42 +00:00
Colin Cross
52d4011195 Merge changes I9de0ffe9,Idc804896 am: 153fb1c6e0
am: 99161bc1c7

Change-Id: Id831c5ab771fa59ac9906d473ffeb7720fbbdf54
2018-01-04 01:10:47 +00:00
Yi Kong
6dbd3d7a59 Add virtual dtor for virtual classes
delete called on non-final virtual classes but non-virtual destructor.

Fixes -Wdelete-non-virtual-dtor warning.

Test: m checkbuild
Change-Id: I142a2f70286a28722e462df4c160cb7aa3753c2a
2018-01-03 11:41:12 -08:00
Yangster-mac
2087716f2b 1/ Support nested message and repeated fields in statsd.
2/ Filter gauge fields by FieldMatcher.
3/ Wire up wakelock attribution chain.
4/ e2e test: wakelock duration metric with aggregated predicate dimensions.
5/ e2e test: count metric with multiple metric condition links for 2 predicates and 1 non-sliced predicate.

Test: statsd unit test passed.

Change-Id: I89db31cb068184a54e0a892fad710966d3127bc9
2018-01-01 10:01:36 -08:00
Adam Lesinski
fca5e427e2 AAPT2: <uses-library /> and <library /> don't need to be Java packages
- Also fixes issue where a failure checking the Java package of an attribute
would yield no error message.

Bug: 70722199
Test: make aapt2_tests
Change-Id: I417d5ffe18c8d4ba2f1638f9fb9ba29278ec8e94
2017-12-28 08:17:51 -08:00
Adam Lesinski
e6aa6d1421 AAPT2: Keep file enumeration consistent across platforms
Filesystem directory enumeration is platform dependent, so
sort the files lexicographically according to source path before
consuming them in the compile command.

Bug: 70680618
Test: manual
Change-Id: I6706dea2eb40cbaff8a586994dd1013976e4ced4
2017-12-28 08:17:43 -08:00
TreeHugger Robot
d14c826c82 Merge changes I0face862,If2d091e5,I4e18e63f
* changes:
  AAPT2: Sort artifacts based on the Play Store rules.
  AAPT2: Allow empty group definitions
  AAPT2: Get list of multi-APK artifacts without APK file
2017-12-20 18:05:53 +00:00
TreeHugger Robot
54839e0d30 Merge "AAPT2: Add flag to compile command for outputting symbols" 2017-12-20 15:27:19 +00:00
Izabela Orlowska
ad9e1324ff AAPT2: treat manifest validation errors as warnings when asked
Bug: 65670329
Test: updated
Change-Id: Ic554cc20134fce66aa9ddf8d16ddffe0131c50e9
2017-12-20 13:25:59 +00:00
Izabela Orlowska
c81d9f36ec AAPT2: Add flag to compile command for outputting symbols
Only XML files can define resources inside of them, so the fragment
R.txt will only be created for XML files. The fragment R.txt will
contain files defined inside the XML files and the file itself.
For example for res/layout/my_layout.xml that defines "@+id/myView" the
fragment R.txt will contain "default int id myView" and "default int
layout my_layout".
Resources defined with the "public" keyword will have the word "public"
in the partial R.txt, resources defined with the "java-symbol" keyword
will have the word "private, and all other resources will have the word
"default".
If a string is declared in values/strings.xml as:
'<string name="foo">text</string>'
then the partial R.txt will contain "default int string foo". If the
same string is also marked as public in the values/public.xml as:
'<public type="string" name="foo" id="0x7f000001"/>
then the partial R.txt for that file will cointain:
"public int string foo".
Also, the resource IDs will be skipped as this is only for compilation,
proper IDs will be generated at linking phase.

Test: manual
Change-Id: I37d07d5ee4a9f2e5a60a54e48579eba86ae7dd60
2017-12-20 12:04:23 +00:00
Adam Lesinski
5c693f2b82 Merge "AAPT2: Propagate SPEC_OVERLAYABLE flag to final APK" 2017-12-19 22:42:53 +00:00
Shane Farmer
78c43d7bee AAPT2: Sort artifacts based on the Play Store rules.
Sort output artifacts so that the updated versionCode manifest entry
will allow correct handling of updates from Play Store. The most
important dimension is Android SDK version. It is important that a split
based on min SDK version will allow a user to get a new APK if they
upgrade the OS on their device to support a new split.

ABI splits need to also be taken into consideration as it is possible
for a device to run in ARM emulation mode and installing an ARM APK over
a x86 APK could cause performance regressions.

The XML file format was updated to give each of the configuration groups
have their own section of the XML file. This allows the sort order to be
determined by a groups ordering. Artifacts can now be added to the
configuration file in an arbitrary order. Since this will be the common
case for developers, it will help reduce errors from inserting a new
artifact in the wrong spot.

The implementation follows the rules outlined at:
https://developer.android.com/google/play/publishing/multiple-apks.html

Test: Unit tests
Test: Manual process XML configuration

Change-Id: I0face862c6d6b9d3cd2d99088afe5b9491be0120
2017-12-19 13:52:30 -08:00
Shane Farmer
39e474f4b4 AAPT2: Allow empty group definitions
With ABI, screen density, and locale, it is possible to use a shorthand
notation when the group only has a single entry. The shorthand is to
leave the group empty and use a valid configuration for the group name.

Test: manually ran optimize command
Test: unit tests

Change-Id: If2d091e587474847c6c9e9be1a29196b261cc82d
2017-12-19 13:52:30 -08:00
Shane Farmer
2c12241fa8 AAPT2: Get list of multi-APK artifacts without APK file
Allow the optimize command to produce a list of output artifact names
without needing to read the input APK from disk. This not only saves
disk reads for a file that will not be used, it also allows the list
of outputs to be generated without having an APK file yet.

Test: unit tests
Test: split an APK
Test: print list of outputs without an APK
Change-Id: I4e18e63f298a07f26ab0de2b2f0acb769bb535ba
2017-12-19 13:52:30 -08:00
TreeHugger Robot
107f7cc4c4 Merge "Remove stream.proto and cpp-streaming-proto generates field name to id mapping by default" 2017-12-19 19:07:53 +00:00
Yi Jin
f68e747e05 Remove stream.proto and cpp-streaming-proto generates field name to id
mapping by default

Test: atest incident_helper_test
Change-Id: Iab04973ea78b942e44503fcd6ae60808caf3b9e0
2017-12-18 17:37:50 -08:00
Adam Lesinski
71be70507d AAPT2: Propagate SPEC_OVERLAYABLE flag to final APK
Resources can be marked as overlayable, which means they can
be overlaid by runtime resource overlays.

This change propagates this state to the final resource table that
is installed on device.

Future work:
- Have the idmap tool respect the overlayable state and ignore
  entries that overlay anything else.

Bug: 64980941
Test: make aapt2_tests
Change-Id: Id45b1e141a281be2ee32a4ac3096fcf1114d523b
2017-12-18 14:16:02 -08:00
Colin Cross
149008d892 Initial sdkparcelables
Adds a tool that can convert an SDK stubs jar into a framework.aidl
file by parsing the jar with ASM to find classes that implement
android.os.Parcelable directly or indirectly.

Bug: 70046217
Test: java -cp out/host/linux-x86/framework/sdk_parcelables_test.jar org.junit.runner.JUnitCore com.android.sdk_parcelables.ParcelableDetectorTest
Change-Id: Idc804896b8860352633a85168748af1b08777205
2017-12-16 20:43:50 -08:00
TreeHugger Robot
58a6cf6afe Merge "Stats log api for attribution chain." 2017-12-16 04:15:11 +00:00
Yangster-mac
7604aeaf99 Stats log api for attribution chain.
Test: all unit test passed.
Change-Id: I628d409e517f4f95c8da1d0c7fd4d514c1d9196d
2017-12-15 16:53:29 -08:00
TreeHugger Robot
6831a2646f Merge "Adds API for apps to push events to statsd." 2017-12-16 00:03:53 +00:00
David Chen
0a368b2c39 Adds API for apps to push events to statsd.
This API allows app to construct custom metrics based on labels
chosen by the app developers. Also added some buttons to manually
test this functionality in the dogfood app.

Test: Verified that Android can be built and tested with custom app.
Bug: 69522276
Change-Id: Ifb7abea4c1d62fb435a9cb6f32df12bc2234d82f
2017-12-14 16:19:29 -08:00
Adam Lesinski
e3b532ce0e Merge "AAPT2: Enable mangled symbol lookup in AssetManagerSymbolTable" 2017-12-14 22:27:02 +00:00
Yi Jin
9bc6eaca2c Merge "Create a new stream option which generates field name to id mapping recursively for all its submessages." 2017-12-14 03:02:03 +00:00