Commit Graph

6856 Commits

Author SHA1 Message Date
Artur Satayev
54c2d606b3 Add support for greylist-max-r signatures.
Bug: 156307884
Test: m
Change-Id: I66f8e48817d16bad5b306b91323bf0cdf42dbabe
2020-05-20 17:50:24 +01:00
Ryan Mitchell
9ed5638125 Do not rename R.java package
When the --rename-resources-package flag is used, only rename the
package name within the resources.arsc. Generate the R.java under
the package name defined by the manifest unless --custom-package is
used.

(This is a cherry pick.)

Bug: 147434671
Test: manual
Merged-In: Id9d10e16f32533da1b67ab72ac846791526e7a76
Change-Id: Id9d10e16f32533da1b67ab72ac846791526e7a76
2020-05-13 09:04:14 -07:00
Ryan Mitchell
940ae50498 Add --rename-resources-package to aapt2
There is currently no way to change the package name encoded in the
resources table. This change adds a flag that controls rewriting the
package name encoded into the resources table. This flag does not
rewrite the package name in the manifest xml.

(This is a cherry pick.)

Bug: 147434671
Test: manual
Merged-In: I435ba07e29df0522c3a44cc5f2c460004a02d71c
Change-Id: I435ba07e29df0522c3a44cc5f2c460004a02d71c
2020-05-07 17:03:12 -07:00
Treehugger Robot
54ac3c6932 Merge "Fix clang-analyzer-core.uninitialized.Branch warnings" 2020-04-28 01:36:36 +00:00
Roshan Pius
29c974a624 aapt2: Add command to rename overlay "targetPackage" attribute
Bug: 154960712
Test: atest ManifestFixerTest
Change-Id: I556fc11e271337de40c70d4ed56a0381a2f79712
Merged-In: I556fc11e271337de40c70d4ed56a0381a2f79712
2020-04-28 00:30:04 +00:00
Chih-Hung Hsieh
7887035743 Fix clang-analyzer-core.uninitialized.Branch warnings
Bug: 154760495
Test: make with WITH_TIDY=1 and DEFAULT_GLOBAL_TIDY_CHECKS=clang-analyzer-core.uninitialized.Branch
Change-Id: I569749166177c25e63b32fb468dccd13797acc05
2020-04-23 14:52:58 -07:00
Orion Hodson
63f06b738d Add explicit dependencies on jni_headers
Preparation for removing implicit include paths for jni.h from soong.

Also remove unnecessary jni.h includes from PathParser.{h,cpp}.

Bug: 152482542
Test: lunch aosp_x86_64 && m checkbuild
Change-Id: Ib18afa3d2c93ed3ce69204286d5177991100fd7e
Exempt-From-Owner-Approval: build refactoring
2020-04-16 08:26:14 +00:00
Dan Willemsen
0985ac8982 Master is now S
Bug: 150754986
Test: treehugger
Change-Id: I44d1b5a0fea74e2bb9e332dcb8486fd30fbd2f07
Merged-In: I44d1b5a0fea74e2bb9e332dcb8486fd30fbd2f07
2020-04-10 05:18:32 +00:00
Chih-Hung Hsieh
3fb38f7fe2 Fix bugprone-copy-constructor-init warnings
* normally a copy constructor should call base copy constructor

Bug: 151109313
Test: WITH_TIDY=1 make
Change-Id: I9677889973178c26cd787a457333877619956b51
2020-03-10 12:58:29 -07:00
Chih-hung Hsieh
100a6f64e5 Merge "Suppress bugprone-use-after-move warnings" 2020-03-09 02:48:04 +00:00
Haibo Huang
715857dbda Uses python3 for fontTools
Change-Id: I33bb8881823278c990faeb1a0e119f855c9948b9
2020-03-07 02:02:19 +00:00
Chih-Hung Hsieh
7a616f65d6 Suppress bugprone-use-after-move warnings
Bug: 150783499
Test: WITH_TIDY=1 make
Change-Id: Ifdd5d89d2207caba765e8f74e8a86f6b6b4ff609
2020-03-06 10:04:30 -08:00
Jeremy Woods
4bdc698d9f Generate "keep" rules for android:name and class attributes
We should keep classes that are in the android:name or class xml
attributes.

Test: m -j aapt2_tests
Bug: 142601969
Change-Id: Ia67365bd702bae75d38b9572d68e9930e856e0f8
2020-03-05 13:06:26 -08:00
Steven Moreland
4351d26575 Use String8 ostream from String8.h
Bug: N/A
Test: N/A
Change-Id: If2762ec4a9bb84cca41b1752fe005605eb9b2013
2020-02-26 09:14:29 -08:00
Artur Satayev
4ef7a1a594 Use argparse in merge_csv.py.
- Allow passing list of explicit fieldnames, instead of sorting header names.
- Allow passing a single zip file with all CSV files to merge.

Bug: 145132366
Test: diff -w out/soong/hiddenapi/hiddenapi-greylist.csv
Change-Id: I7c6db369069452293c15eec290c635fb3879275d
2020-02-19 16:33:10 +00:00
Chih-Hung Hsieh
f2ef6579f2 Fix clang-tidy performance-faster-string-find warnings
Bug: 30411878
Test: build with WITH_TIDY=1
Change-Id: I7fd815aa401fbcaff97b772f3ba5d6f1d2034011
2020-02-11 14:27:11 -08:00
Treehugger Robot
3e6f701980 Merge "Use py3 features in merge_csv.py." 2020-01-30 15:18:58 +00:00
Muhammad Qureshi
bb699b68c0 Generate compile-time Q-compatible StatsLog
Bug: 148388745
Test: m NetworkStack
Test: m NetworkStackNext
Change-Id: Ic37bb67ce625d0a583c424d4775e9f0fa132c418
2020-01-29 14:27:04 -08:00
Artur Satayev
9430c17a6c Use py3 features in merge_csv.py.
- Use csv.QUOTE_MINIMAL strategy to only quote fields with special characters.
- Open file as 'r', not 'rb'.
- Use 'unix' dialect for '\n' as line terminator, instead of \r\n.

Bug: 145132366
Test: diff -w out/soong/hiddenapi/hiddenapi-greylist.csv
Change-Id: I888f3219beee5b83e53f05589a90a05f93399fe3
2020-01-29 19:54:58 +00:00
Muhammad Qureshi
b11e00d655 Add flag to stats-log-api-gen for WorkSource.
As part of getting rid of StatsLogInternal and moving every atom to be
logged from a module, this CL addresses 2 issues:
1. Add WorkSource logging to modules.
2. Gate WorkSource logging via a CLI flag to prevent WorkSource methods
from being included in modules that are Mainline modules and can't have
@hide calls.

Bug: 147541828
Test: m
Test: atest android.cts.statsd.atom.UidAtomTests

Change-Id: Icce2f6ed7298be5e5ceebfb05d87e6fa7cd6bdbb
Merged-In: Icce2f6ed7298be5e5ceebfb05d87e6fa7cd6bdbb
2020-01-23 11:39:38 -08:00
Muhammad Qureshi
17c204de33 Make writeKeyValuePairs accept Nullable args
API Review requested to remove unneeded allocations so pass null for
arguments that are empty when writing KeyValuePairs

Bug: 146383532
Test: m
Change-Id: Ic1788f65e8c7f837d6800d59c186519a82882bf7
Merged-In: Ic1788f65e8c7f837d6800d59c186519a82882bf7
(cherry picked from commit 996afa633c)
2020-01-23 11:32:07 -08:00
Muhammad Qureshi
0c8cdf54db Use preview_sdk_int for version code checks
Don't use Build.VERSION.CODENAME to check for R.
Use Build.VERSION.SDK_INT > Q || (Build.VERSION.SDK_INT == Q &&
        Build.VERSION.PREVIEW_SDK_INT > 0)

Bug: 146235828
Test: m DocumentsUIGoogle

Change-Id: I59e327d4e92d41a93b6bea145b8497fd4f85108c
Merged-In: I59e327d4e92d41a93b6bea145b8497fd4f85108c
(cherry picked from commit b6f32d9fe2)
2020-01-23 11:29:21 -08:00
Treehugger Robot
7b56a5075d Merge "Add option to avoid clobbering visibility of <declare-styleable>" 2020-01-17 18:21:24 +00:00
Treehugger Robot
445a5e3836 Merge "Remove dependency on libutils in native autogen" 2020-01-11 01:04:47 +00:00
Treehugger Robot
2ff0a7bd58 Merge changes I978ac321,I5675a80c,I56ef3cc4,I1cdaf002
* changes:
  Add --supportQ flag to java StatsLog codegen
  Support new socket schema in native codegen
  Move statsd metadata from statslog to atoms_info
  Fix StatsEvent memory usage for pulled events
2020-01-11 00:42:14 +00:00
Treehugger Robot
baa778df4d Merge changes I2159bf13,I93146faa
* changes:
  Fix error handling in StatsEvent
  Handle nulls in Java autogeneration
2020-01-10 22:46:51 +00:00
Treehugger Robot
94e980f83b Merge "Use StatsEvent in Java autogenerated code" 2020-01-10 22:42:45 +00:00
Tom Cherry
5576f58f1b Merge "Add liblog as a dependency where libbase is used" 2020-01-10 16:59:43 +00:00
Tobias Thierer
4effc4b64a Make extract_package() work for toplevel classes.
Before this CL, classes in the unnamed package, such as

L$r8$backportedMethods$utility$Objects$2$checkIndex

(which looks like it is generated by R8 for Objects.checkIndex() calls)
were breaking the build because extract_package was incorrectly assuming
that there would always be a '/' in the identifier string.

Test: Build that previously broke is now working.

Change-Id: Ice78d6b31c4f38a3c9d529bc6156d625d19bcacf
2020-01-10 14:28:21 +00:00
Tom Cherry
1089bdfb43 Add liblog as a dependency where libbase is used
Bug: 119867234
Test: build
Change-Id: Iad0de2cef63aa52bb573e1571efbac1d689e7603
2020-01-09 11:11:28 -08:00
Muhammad Qureshi
6a6bd7ee22 Remove dependency on libutils in native autogen
Right now, Q schema generated code has a dependency on libutils.
Turning on R schema for clients will remove libutils as a required
dependency. Once libutils is removed from clients, turning the flag off
again will be complicated as all clients will need to re-include
libutils. To fix this problem, remove dependency on libutils in Q
schema.

Right now, we only use SystemClock.h from libutils in Q schema autogen.
Use timespec from C standard library instead.

Bug: 146808265
Test: m
Test: flashes successfully
Test: adb logcat "*:S statsd:*"
Test: bit statsd_test:*
Change-Id: I00efeab1be351a95083f3b6e2dbc9067849bee20
Merged-In: I00efeab1be351a95083f3b6e2dbc9067849bee20
2020-01-08 17:08:05 -08:00
Muhammad Qureshi
7182159154 Add --supportQ flag to java StatsLog codegen
Add support to generate Q schema code generation only for modules that
ship to Q.

Bug: 145606209
Test: m
Test: flashes successfully
Test: adb logcat "*:S statsd:*"
Change-Id: I978ac321415f1e8d76e4ec73445894965845aaea
Merged-In: I978ac321415f1e8d76e4ec73445894965845aaea
2020-01-08 17:07:18 -08:00
Muhammad Qureshi
6f65881d62 Support new socket schema in native codegen
New code generation implementation is flag guarded by
STATS_SCHEMA_LEGACY

Support for Q schema can be added by passing --supportQ flag in
stats_log_api_gen. (Only needed for statslog_resolv.cpp)

Q schema is supported through StatsEventCompat.

Generated R schema statslog.h:
https://paste.googleplex.com/4986214782337024

Generated R schema statslog.cpp:
https://paste.googleplex.com/4856851575341056

Generated R schema statslog_resolv.h:
https://paste.googleplex.com/6062978921136128

Generated R schema statslog_resolv.cpp:
https://paste.googleplex.com/4752329251225600

Generated Q schema statslog.h:
https://paste.googleplex.com/4766729873915904

Generated Q schema statslog.cpp:
https://paste.googleplex.com/5018563779756032

Generated Q schema statslog_resolv.h:
https://paste.googleplex.com/5338897498243072

Generated Q schema statslog_resolv.cpp:
https://paste.googleplex.com/5191011011657728

Test: m -j
Test: flashes successfully
Test: adb logcat inspection
Change-Id: I5675a80c03ca3fbd5cd4a02c04a4b9cb89ec32ab
Merged-In: I5675a80c03ca3fbd5cd4a02c04a4b9cb89ec32ab
2020-01-08 17:06:18 -08:00
Muhammad Qureshi
c29064e14c Move statsd metadata from statslog to atoms_info
Clients don't need to know about statsd metadata. Extract out metadata
from statslog.h/cpp into atoms_info.h/cpp which is only used by statsd.

Generated atoms_info.h: https://paste.googleplex.com/6303016724463616
Generated atoms_info.cpp: https://paste.googleplex.com/5717940978581504

Test: m -j
Test: old metadata in statslog matches the metadata in
atoms_info
Test: Flashes successfully
Test: adb logcat "*:S statsd:*"

Change-Id: I56ef3cc4ea1fbd2cd0130d4e9576b242efb9f627
Merged-In: I56ef3cc4ea1fbd2cd0130d4e9576b242efb9f627
2020-01-08 17:05:15 -08:00
Muhammad Qureshi
2a4c0782b5 Fix StatsEvent memory usage for pulled events
Add usePooledBuffer flag to the Builder which determines whether to reuse
the Buffer's byte array in StatsEvent or use a copy.
The build() function also calls release() on the Buffer
if a copy of the Buffer's byte array is passed to StatsEvent.

Also, for pushed events, release the StatsEvent object and consequently,
the Buffer in StatsLog.write(StatsEvent)

Fixes: 145026572
Fixes: 144126444
Test: bit FrameworksCoreTests:android.util.StatsEventTest
Change-Id: I1cdaf0027b69281cb7cb6f3c8ca923d03829b4dd
Merged-In: I1cdaf0027b69281cb7cb6f3c8ca923d03829b4dd
2020-01-08 17:04:27 -08:00
Muhammad Qureshi
01268dec13 Handle nulls in Java autogeneration
Bug: 143979391
Test: m -j
Change-Id: I93146faa1976cac195c2250832d12ee4a09ae969
Merged-In: I93146faa1976cac195c2250832d12ee4a09ae969
2020-01-08 17:02:22 -08:00
Muhammad Qureshi
ef19b08b05 Use StatsEvent in Java autogenerated code
The change is guarded by STATS_SCHEMA_LEGACY flag in the autogenerator
Android.bp.

The flag can only be removed once rest of statsd switches over to the
new socket schema.

The new autogeneration uses StatsEvent for both Mainline module
clients and the default platform client. For Mainline modules, the
autogenerated code uses a runtime dessert version check to use new
socket schema on R+ platforms and the legacy schema on the older
platforms.

The legacy schema is encapsulated in a separate autogenerated inner
class called QLogger.

generated DocumentsStatsLog.java: https://paste.googleplex.com/4665805503463424
generated StatsLogInternal.java: https://paste.googleplex.com/5955095055302656
generated android_util_StatsLogInternal.cpp:
    https://paste.googleplex.com/6737331711115264

Bug: 142811546
Test: m -j && m -j DocumentsUIGoogle
Test: Flashes successfully and events are logged to statsd
Change-Id: I4c804eaf4d5ae78001146c89ebe46dfb0a453853
Merged-In: I4c804eaf4d5ae78001146c89ebe46dfb0a453853
2020-01-08 17:01:43 -08:00
Donald Chai
f80d0ae89b Add option to avoid clobbering visibility of <declare-styleable>
"aapt2 compile" marks styleables as public instead of preserving
information from <public/> or --visibility options.  This behavior can
now be disabled via --preserve-visibility-of-styleables.

Bug: 146649511
Change-Id: Ifb8ab396573d1393df737a59625e79e9cf2494a7
Tested: aapt2_tests
2020-01-07 21:17:59 -08:00
vichang
6658c31b4e Merge "Regenerate LocaleDataTables.cpp" 2019-12-17 11:28:19 +00:00
Victor Chang
e84c6b50c2 Regenerate LocaleDataTables.cpp
LocaleDataTables.cpp is outdated due to ICU update over the years

Test: ./tools/localedata/extract_icu_data.py $ANDROID_BUILD_TOP
Test: m droid
Change-Id: I21918cc0f50c7347e514dc7b015607e19cffb377
2019-12-16 15:31:09 +00:00
Artur Satayev
38deb176b0 Move UnsupportedAppUsageProcessor to tools/platform-compat
Test: diff unsupportedusage_index.csv
Bug: 145132366
Change-Id: I2e03788ba20f5801d6aa429e5daac927966c5bff
Merged-In: I2e03788ba20f5801d6aa429e5daac927966c5bff
2019-12-04 17:54:11 +00:00
Mathew Inwood
2867ddf511 Handle overrideSourcePosition in unsupportedappusageprocessor.
The property is currently set by the AIDL compiler to indicate the original
position of the annotation in the AIDL file. Use this position in
preference to the annotation position within Java code if it's present.

Also rework the tests to use the google compile-testing library rather than
my crufty javac library. This makes testing failure conditions much nicer.

Bug: 145120552
Test: atest unsupportedappusage-processor-test
Test: m framework-annotation-proc
Change-Id: Icaac9b40672dce028095b578c19950b688506c0d
2019-12-02 11:42:07 +00:00
Anton Hansson
79995a5673 Merge "Revert "Work around b/70221552"" 2019-11-19 12:38:28 +00:00
Mathew Inwood
d1219acf84 Merge "Fix SignatureBuilder." 2019-11-19 12:11:39 +00:00
Anton Hansson
d82b2f7e4a Revert "Work around b/70221552"
This reverts commit 159799d7c9.

Reason for revert: b/70221552 is fixed

Change-Id: Iaae0df6736a3141847376b9ab0115f1c7a31fdb1
2019-11-18 13:40:45 +00:00
Artur Satayev
44036a7689 Blacklist @TestApis by default.
If the signature has @UnsupportedAppUsage or @SystemApi annotation as well, those take precedence and the API would either be whitelisted or greylisted accordingly. All other, "pure" @TestApi signatures would be blacklisted and only allowed access in instrumented processes.

Test: manual
Bug: 133832325
Change-Id: I4684929caed8be7c42c91fed33ddd2a3b67ae19b
2019-11-15 16:54:14 +00:00
Mathew Inwood
4e2a44234e Fix SignatureBuilder.
It seems the compiler has started adding a top level MODULE which broke
assumptions made in here.

Also add some tests to verify this and other basic functionality, so that
future such breaks may be caught sooner.

Test: m framework-annotation-proc-index
Test: atest unsupportedappusage-processor-test
Bug: 144495446
Change-Id: I43efb25c1600af15809d48aa84498a6800f713b1
2019-11-15 15:13:03 +00:00
Brian Duff
2f7e4d1a82 Speed up WriteKeepSet when generate_conditional_proguard_rules is off.
The results of CollectLocations() are only used if the --proguard-conditional-keep-rules option is set, but the function is always called when the --proguard option is set.

Since this function can be slow on particularly large resource sets, avoid calling it unless --proguard-conditional-keep-rules is set.

Change-Id: If259d41cdab16abad8ca62f30d8beb5ebf33575a
Bug: 144236322
Test: aapt2_tests
2019-11-11 09:47:18 -08:00
Donald Chai
6e914e8baf Merge "Fix computation of 'entry_length' in AAPT2 container format" 2019-11-08 06:13:54 +00:00
Donald Chai
6f613875a1 Fix computation of 'entry_length' in AAPT2 container format
When the protobuf header (or data payload) size are a multiple of 4,
"entry_length" (called "aligned size" in the code) would have counted bytes that
are never actually written.

Bug: 139418052
Change-Id: Ia688a82a67f3807f7feb0be03670bf2827b1d6a1
(cherry picked from commit b99e50922b)
2019-11-08 05:15:38 +00:00