Commit Graph

6424 Commits

Author SHA1 Message Date
Paul Duffin
da1293aba9 Merge changes from topic "libcore-remaining-hiddenapi" am: 74c171b4da am: a51da7d3be
am: da53a737ca

Change-Id: I7e5ca251a6c15ea6f040897a8e5cf4c653f4ddd1
2018-11-29 08:34:17 -08:00
Paul Duffin
00537c15e8 Prevent hiddenapi entries being added for libcore related projects
The libcore related projects (see below) have been (mostly) switched
over to use UnsupportedAppUsage annotations, This change will prevent
entries for those projects being added to a config/hiddenapi-* file.

* libcore
* external/bouncycastle
* external/conscrypt
* external/icu
* external/okhttp
* external/libphonenumber - still has a couple of entries in
      config/hiddenapi-light-greylist.txt due to limitations in
      UnsupportedAppUsage/class2greylist.

Tested by attempting to upload the file with entries for libcore
projects and without those entries and checking that the behavior
is expected.

Test: see above
Bug: 117818301
Change-Id: I67a30b307e12e842b28cfb2160fab0029868fa06
2018-11-29 09:41:56 +00:00
Jeff Sharkey
86445841ac Guide towards Context.createPackageContextAsUser().
It's a better alternative that should be used instead of adding
new "ForUser" or "AsUser" methods.

Bug: 115654727
Test: manual
Change-Id: I8742c2ef42d743ef69f8f7a91378f498fdc81e43
2018-11-27 17:36:07 -07:00
Anton Hansson
2f5dd12af0 Add linter for strings attribute names
Only one bad example for now, which is a misspelling that's not
entirely uncommon and can lead to real problems (see linked bug).

Example output:
Line 58: 'my_new': Misspelled <string> attribute.
        Actual: translateable
        Example: translatable

Bug: 119884572
Test: with a misspelled attribute
Change-Id: If61412fe318a34191920781c4834584363080e11
2018-11-23 15:25:52 +00:00
Ryan Mitchell
19954a261c Merge "Do not serialize empty text in manifest proto" 2018-11-19 22:13:35 +00:00
Mark Salyzyn
adc63f02b3 Merge changes I664fb325,I5e289469 am: 701001688f am: 833a491fab
am: beea2153ab

Change-Id: Ifd30d79d06e4e80103ff2f09b0ae960ceb8bc7f9
2018-11-19 13:46:31 -08:00
TreeHugger Robot
d1633c3bdb Merge "Incidentd: Fix switch break warnings" 2018-11-19 20:14:12 +00:00
Ryan Mitchell
467b689a4c Do not serialize empty text in manifest proto
When linking an APK in the proto format, the manifest is currently
serializes text nodes that only contain whitespace:

child: {
  text: "\n        "
  source: {
    line_number  : 0x0000000f
    column_number: 0x0000002f
  }
}

These whitespace bloat the proto size unnecessarily. Do not write these
text nodes for proto apks.

Bug: 118800653
Test: make aapt2_tests
Change-Id: Icfaaf88976f81450bbf51610a316b336deeae60c
2018-11-16 15:58:06 -08:00
Ryan Mitchell
a7d9f269d6 Merge "Fix loaded apk string pool order" 2018-11-16 17:27:23 +00:00
Ryan Mitchell
4e9a922ede Fix loaded apk string pool order
Loading in an APk changed the ordering of strings in the string pool.
When loading an apk, assign the strings to the same index as they
are in the ResStringPool.

Bug: 118831219
Test: "aapt2 dump strings left.apk" prints in the correct order,
"aapt2 convert left.apk --output-format binary -o left_binary.apk" has
entries in the correct order, and aapt2_tests

Change-Id: I00014c02195f39c1152a110e90083d9b14e9216e
2018-11-15 11:37:01 -08:00
Mark Salyzyn
d100107806 switch to using android-base/file.h instead of android-base/test_utils.h
Test: compile
Bug: 119313545
Change-Id: I664fb32522d01909c603d7b903475c4e9aea9223
2018-11-14 15:54:32 -08:00
Bookatz
da9b8d0ad1 Incidentd: Fix switch break warnings
A few switches didn't have explicit breaks in them, which was causing
warnings. They were all benign, as the logic did not necessitate a
break. But this is will stop the warnings and perhaps prevent future
bugs.

Change-Id: Idb293a4896f4df8d3f11d748e0e716efc26bbd6a
Fixes: 119047812
Test: N/A
2018-11-14 13:35:30 -08:00
TreeHugger Robot
252c7c43c9 Merge "Pass the last error code when statslog.write fails" 2018-11-12 19:27:58 +00:00
Yao Chen
39b679925a Pass the last error code when statslog.write fails
The error code will give us some clue on what caused the loss (e.g., EBUSY, or ENOENT)

Test: manual
Bug: 80538532

Change-Id: I446c6e2255bdae063dfb8803ad0b702ead87c645
2018-11-09 09:56:36 -08:00
Mårten Kongstad
4b55bd77fb AAPT2: propagate SPEC_OVERLAYABLE to splits
A resource marked SPEC_OVERLAYABLE in the base package was not marked as
such in the corresponding split packages. Add missing copy statement.

Test: manual (aapt2 dump test content in libandroidfw)
Change-Id: I800e92111a9da7c6f5e83f8a546d260c8d93b308
(cherry picked from commit ee41b3a36dcd87f79f3c2a21383a97743530099d)
2018-11-07 08:23:06 -08:00
TreeHugger Robot
e0c2f7e17d Merge "RRO: Added partition policies for overlays" 2018-11-06 16:49:55 +00:00
Ryan Mitchell
e4e989ccba RRO: Added partition policies for overlays
<overlayable> tags can now have policy elements that indicate which
partition the overlay apk must reside on in order to be allowed to
overlay a resource. This change only adds parsing of <policy> and
encoding of policy in the proto ResourceTable. A later change will add
the encoding of policy and overlayable in the binary APK.

<overlayable>
  <policy type="system|vendor|product|product_services|public" >
    <item type="string" name="oof" />
  </policy>
</overlayable>

Bug: 110869880
Test: make aapt2_tests
Change-Id: I8d4ed7b0e01f981149c6e3190af1681073b79b03
2018-11-06 00:10:26 +00:00
Chih-hung Hsieh
51025d638d Merge "Allow implicit-fallthrough warnings locally." am: 36afe11a64 am: 9c5738238d
am: 469705cca4

Change-Id: I4bc5f389495ed535762438632e65ccd6c66f3739
2018-10-25 17:58:17 -07:00
Marco Nelissen
6baf5e4e1c Merge "Don't try to compress opus resources" 2018-10-25 19:39:11 +00:00
Marco Nelissen
18f16d6241 Don't try to compress opus resources
Test: build

Change-Id: Ibf398b3afca02d4111d88b126c8d107ac44068a6
2018-10-25 08:31:19 -07:00
Yao Chen
bbdd67d19f Allow atoms to log fields in bytes format.
There are an increasing number of requests to log data in complex format to statsd, while the data
is not expected to be parsed or aggregated by statsd and only to be uploaded as events.

Instead of making an exception for each of these cases in a hard coded way, this CL add a feature to
annotate these field in atoms.proto and the stats-log-api-gen tool will produce byte array
interfaces for them.

Note that log_msg does not have byte array type, and only has string type, when statsd receives the
log, these fields are in string type. Only when the atom is written to proto, we will check if this
field should be bytes field and write it to protobuf in message format.

Change-Id: If53dd95c5826710c76d7fe982bf951a435dfc738
Fix: 118386797
Test: unit test & manual test
2018-10-24 13:12:13 -07:00
Chih-Hung Hsieh
e8abd06776 Allow implicit-fallthrough warnings locally.
It will be a global error by default.

Test: make checkbuild
Bug: 112564944
Change-Id: I26616fd50ccf3639fa7c01d850a14d079273ede7
Exempt-From-Owner-Approval: do not block on new warnings
2018-10-22 09:56:12 -07:00
Mathew Inwood
061b522b91 Merge "Merge hidden API metadata into a single CSV file." am: 5037a7eb93 am: 3ffa1cad11
am: 92b1736e66

Change-Id: I55b39b42411e93adf2716bf59ef15eb5981f526a
2018-10-18 08:23:01 -07:00
Ryan Mitchell
67f94b4002 Merge "Fix incorrect proto apk loading" 2018-10-17 23:53:04 +00:00
Mathew Inwood
3ffa1cad11 Merge "Merge hidden API metadata into a single CSV file."
am: 5037a7eb93

Change-Id: I0efce89576b0ca7ae90d49de3455466a866521de
2018-10-17 10:35:39 -07:00
Ryan Mitchell
ec74f2fbd5 Fix incorrect proto apk loading
If a proto apk is missing resources.pb, AAPT2 would fail to detrmine the
apk format because of an incorrect check. This fixes that check and
removes the checking fuction from the LoadedApk header.

Bug: 117820549
Test: removed resources.pb from proto apks and confirmed that loading in
apks still works

Change-Id: If3628a821e7b59c7dfcbefb502b6080be083cec1
2018-10-17 09:30:01 -07:00
Mathew Inwood
5037a7eb93 Merge "Merge hidden API metadata into a single CSV file." 2018-10-17 09:20:04 +00:00
Dan Willemsen
9ad6ab595d Merge "Stop using DIST_DIR directly, use dist-for-goals instead" am: a8f2601d28 am: 9b767e275e
am: fa5b204029

Change-Id: Ic052f5d1de317c2f271f5a2df83c733c79978679
2018-10-16 18:01:26 -07:00
Dan Willemsen
9b767e275e Merge "Stop using DIST_DIR directly, use dist-for-goals instead"
am: a8f2601d28

Change-Id: Iabb2ddb086dda71887c3d50152db50f813c9556a
2018-10-16 17:43:35 -07:00
Treehugger Robot
a8f2601d28 Merge "Stop using DIST_DIR directly, use dist-for-goals instead" 2018-10-17 00:18:07 +00:00
Paul Duffin
043424db98 Merge "Fix issue with sort_api.sh" am: f943c52105 am: 66e9d98618
am: 1a73c07ab4

Change-Id: I214977be62710e359839acd25fda1b22d7f043f8
2018-10-16 10:41:54 -07:00
Paul Duffin
66e9d98618 Merge "Fix issue with sort_api.sh"
am: f943c52105

Change-Id: I196e57f5d5f96e5f5e1885e893be21ae81b75207
2018-10-16 10:10:45 -07:00
Paul Duffin
c78bea41c6 Fix issue with sort_api.sh
Should use -ne not -neq.

Test: run script manually
Bug: 115609023
Change-Id: I337ed43be1f9250e6c2b2c88d97c68a5c9e8941c
2018-10-16 14:30:01 +01:00
Mathew Inwood
0085baa159 Merge "Add new "max-sdk-p blacklist"." am: adbc7dfc28 am: f0a45a4114
am: 94db534287

Change-Id: Ie0e9cfd4d0f0eff82736741a768f607872589244
2018-10-16 06:10:51 -07:00
Mathew Inwood
f0a45a4114 Merge "Add new "max-sdk-p blacklist"."
am: adbc7dfc28

Change-Id: Ice435ecdef532f3d25b705cc734773deba84322f
2018-10-16 05:38:00 -07:00
Mathew Inwood
ea14c0c36f Merge hidden API metadata into a single CSV file.
Add a python script to merge the CSV files, dealing with the fact that the
source columns may differ due to the annotation properties present in the
source.

Add this new file and the existing greylist.txt files as dependencies of
the 'dist' target, so that they appear as artifacts on the build server.
This allows them to be processed later by reading them from the build
server.

Test: m out/target/common/obj/PACKAGING/hiddenapi-greylist.csv
Bug: 117314178
Change-Id: Ib9e5da90e4c32333a3f4f02ee7f159f77086ae5e
2018-10-16 12:12:27 +01:00
Mathew Inwood
50dea42729 Add new "max-sdk-p blacklist".
This will contain greylist entries accessible by apps with a
targetSdkVersion of less than Q. Currently empty, will be populated in
follow up CLs.

For now, these APIs are just merged into the light greylist at build time,
pending support in the runtime for implementing the correct runtime
behavior.

Also fix a bug in sort_api.sh so it deals with empty API lists
correctly.

Bug: 115609023
Test: m
Change-Id: I213874062f393f96d120648a934ae5ad7aba93af
2018-10-15 16:38:12 +01:00
Yangster-mac
b6b77c6fb4 Make state atom field annotation name consistent between google3 and android.
Test: statsd test
Fix: b/117681672

Change-Id: I3b0145516c594cc23565df67acc1cfa9f79d306e
2018-10-13 10:40:09 -07:00
Ryan Mitchell
d4bf08501a Merge "Preserve compression of xml files in convert" 2018-10-12 16:42:34 +00:00
Ryan Mitchell
05aebf46b4 Preserve compression of xml files in convert
Respect the compression the original compression of xml files when using
aapt2 convert. Uncompressed files should remain uncompressed, and
compressed files should remain compressed.

Bug: 117289326
Test: manual
Change-Id: I81b431b4a4abd81f5694ea7dc3b3c6ec8c13ca32
2018-10-11 17:14:29 -07:00
Ryan Mitchell
6ffa32f13d AAPT2: Add the rest of supported manifest elements
am: 00d5548355

Change-Id: I9c8002d2891d762e579d0d987bb52856fb20df17
2018-10-10 16:06:48 -07:00
Ryan Mitchell
840beebdb4 AAPT2: Add supported manifest elements
am: 48d009ad32

Change-Id: Ib620e6c3a5ee6b4a33f4d64a9afa44302de67d7a
2018-10-10 16:00:02 -07:00
Treehugger Robot
e75f2f504e Merge changes from topic "aapt2-manifest-elements"
* changes:
  Remove workarounds for b/79755007
  AAPT2: Add the rest of supported manifest elements
  AAPT2: Add supported manifest elements
2018-10-10 22:29:57 +00:00
Mårten Kongstad
b7c0800fa0 Merge "libandroidfw: move ConfigDescription from aapt2 to libandroidfw"
am: b14c887974

Change-Id: I14be80a2d2c3620919a78da5a42ed56ec1d1737f
2018-10-09 16:04:34 -07:00
Mårten Kongstad
7672daf8e5 Merge changes from topic "idmap2-prerequisites"
am: 62a5d4249f

Change-Id: I8db3f5ba0de6510c3327273c56e9fcc75c836694
2018-10-09 16:00:31 -07:00
Treehugger Robot
b14c887974 Merge "libandroidfw: move ConfigDescription from aapt2 to libandroidfw" 2018-10-09 21:43:38 +00:00
Treehugger Robot
62a5d4249f Merge changes from topic "idmap2-prerequisites"
* changes:
  AssetManager2: optionally keep non-matching configs
  AAPT2: optionally keep resources without default value
  libandroidfw: add resource ID iterator
2018-10-09 21:43:38 +00:00
Dan Willemsen
5cc1700171 Stop using DIST_DIR directly, use dist-for-goals instead
As a preparation in refactoring how we handle dist, I'm making
everything use dist-for-goals. In this case, instead of fully relying on
a phony rule, write the gtest xml into an intermediate folder, and use
dist-for-goals to copy that into the dist dir.

Bug: 117463001
Test: DIST_DIR=dist m aapt2_run_host_unit_tests dist
Test: DIST_DIR=dist m aapt2_run_host_unit_tests dist   (reruns test)
Change-Id: I166c2b3088703875c6028c3479aec7cf09f3f635
2018-10-09 14:28:35 -07:00
Aurimas Liutikas
13e6a1dc3e Add style parents dump command.
This command prints out the parent graph of a given style

Test: out/host/linux-x86/bin/aapt2 dump styleparents \
    --style Widget.MaterialComponents.TextInputLayout.FilledBox \
    out/target/product/generic_x86/system/priv-app/SystemUIGoogle/SystemUIGoogle.apk
Change-Id: Ib2ace7e90bee6f1c4b6a184edc591b1a3993db75
2018-10-09 13:55:31 -07:00
TreeHugger Robot
1e7b9347d7 Merge "Created resuable DumpApkCommand and added "badger"" 2018-10-09 19:15:47 +00:00