Commit Graph

6997 Commits

Author SHA1 Message Date
Ryan Mitchell
cd78febeac Recognize dynamic res ids as valid
Shared libraries are assigned package id 0. Resource ids that start
with 0x00 are not invalid. This change changes is_valid to accept
dynamic resource ids and adds an is_valid_static method for when
an id must have a non-zero package id.

This also fixes an issue that made layouts in shared libraries that
use internal attributes exclude compiled resource ids from the binay
xml output.

Bug: 146491000
Test: Build a shared library with a layout that uses app attributes
      as well as android attribute and verify that all attributes
      have assigned resource ids using `aapt2 dump xmltree`

Change-Id: Ibc0407c610ffc98d7aaf233c37c065912ab0d516
2019-12-19 18:22:45 +00:00
TreeHugger Robot
a261d615dd Merge "Fix deserialization of @id aliases" 2019-12-18 22:58:06 +00:00
Muhammad Qureshi
0868413c19 Merge "Move statsd metadata from statslog to atoms_info" 2019-12-18 01:44:15 +00:00
Muhammad Qureshi
c8e226610c 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
2019-12-17 12:59:01 -08:00
Automerger Merge Worker
cfb045a481 Merge "Regenerate LocaleDataTables.cpp" am: 6658c31b4e am: ccc64a5aef am: ffbeb382a2
Change-Id: Ic6beb9b8a0374663babf41431e5f59ad7c18f7d0
2019-12-17 14:45:33 +00: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
Donald Chai
4abc82859d Fix deserialization of @id aliases
I didn't realize that this was actually a thing, but:

  <resources>
    <item name="id1" type="id"></item>
    <item name="id2" type="id">@id/id1</item>
  </resources>

leads to a resource table which 'aapt dump resources' will render as:

    resource 0x7f030000 com.pkg:id/id1: t=0x03 d=0x00000001 (s=0x0008 r=0x00)
    resource 0x7f030001 com.pkg:id/id2: t=0x01 d=0x7f030000 (s=0x0008 r=0x00)

while 'aapt2 dump resources' printed:

  type id id=03 entryCount=2
    resource 0x7f030000 id/id1
      () (id)
    resource 0x7f030001 id/id2
      () (id)

After this change, it prints:

  type id id=03 entryCount=2
    resource 0x7f030000 id/id1
      () (id)
    resource 0x7f030001 id/id2
      () @id/id1

Bug: 69445910
Change-Id: I0001ff09345434577ac4c1d32f96a781f4190d8d
Tested: manual, see above
2019-12-14 07:29:01 +00:00
TreeHugger Robot
d5cbd092ab Merge "Generate "keep" rules for actionProviderClass and actionViewClass" 2019-12-12 04:36:35 +00:00
TreeHugger Robot
5e68b5c709 Merge "Fix StatsEvent memory usage for pulled events" 2019-12-10 23:18:07 +00:00
Muhammad Qureshi
9e829804e1 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
2019-12-10 13:27:38 -08:00
TreeHugger Robot
995fbdb659 Merge "Fix aapt2 JavaClassGenerator Maybe#value() call before check" 2019-12-09 19:47:59 +00:00
Muhammad Qureshi
67df8893dd Handle nulls in Java autogeneration
Bug: 143979391
Test: m -j
Change-Id: I93146faa1976cac195c2250832d12ee4a09ae969
2019-12-08 20:40:46 -08:00
Ryan Mitchell
4e19c48a6e Fix aapt2 JavaClassGenerator Maybe#value() call before check
Previous refactor accidentally assumed all attributes would have
resolvable symbols when generating the R class. Restore previous
behavior of calling SkipSymbol before retrieving the attribute
comment.

Bug: 145685954
Test: m TeleService
Change-Id: Ie8e1092556bc0b6a764462ffa0b99a876bcbd70e
2019-12-06 13:05:44 -08:00
satayev
0c637f535c Merge "Move UnsupportedAppUsageProcessor to tools/platform-compat" am: d7dd4ad00c am: cf662a4aac
am: 82993fd505

Change-Id: Ib704126399887b529e091b247dbd936348aeec53
2019-12-05 06:46:57 -08:00
satayev
8899e8f174 Merge "Handle overrideSourcePosition in unsupportedappusageprocessor." am: 168c609085 am: be7b380039
am: 271ca11abe

Change-Id: I05d1a54032c456b9e07674199e334a4d483298f2
2019-12-04 14:44:45 -08: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
Jean-Luc Coelho
181cbfde80 Add "no-proguard-location-reference" flag to aapt2
This fixes relocatability issues with the code shrinkers.

Bug: 144529940
Test: None
Change-Id: I65e08e850193e67dcdf4c533d9e66332714f0c8c
2019-12-02 21:11:08 +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
Izabela Orlowska
5b89b2d320 Use case-sensitive regular expressions in --no-compress-regex
On some windows versions (plus wine) std::regex has issues with the
icase flag (making regex case insensitive). Put the responsibility of
the case sensitivity on the caller.

Fixes: 127793905
Test: wine aapt2_tests.exe -> Util_test
Change-Id: I6775514d3ef43c2c47465bf39ceaf2c195909724
2019-11-27 18:37:09 +00:00
Donald Chai
d520db5355 Factor out repeated shift instructions to reduce code size
R8 has some O(n^3) analysis somewhere, so this should speed up analysis
of "onResourcesLoaded" by 1.5^3=3.3x.

Bug: 145052564
Change-Id: Ib6ab111511d6bd3afae0c29cd00f743e7128768a
Tested: aapt2_tests
2019-11-26 23:22:34 +00:00
TreeHugger Robot
8312525fc4 Merge "Disable test broken on windows" 2019-11-26 19:19:43 +00:00
Ryan Mitchell
e5981c075a Disable test broken on windows
RegularExperssions is broken on Windows, disable this test while a
fix is being worked on.

Bug: 127793905
Test: wine aapt2.exe
Change-Id: Ic78a7f12b004d2e8dbf5d79c5b52f00ca0ceb9e9
2019-11-26 18:28:01 +00:00
Muhammad Qureshi
9effe48706 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
2019-11-25 12:50:49 -08:00
TreeHugger Robot
5d1c9a388a Merge "Exposing WorkSource hidden APIs as system APIs" 2019-11-21 21:15:48 +00:00
TreeHugger Robot
6394799c47 Merge "Add @NonNull annotation to Builder.addXXX args" 2019-11-21 20:01:12 +00:00
Suprabh Shukla
f7cffa7aaf Exposing WorkSource hidden APIs as system APIs
Users of these APIs are planning to move to apex.

Test: atest FrameworksCoreTests:android.os.WorkSourceTest
atest CtsOsTestCases:android.os.cts.WorkSourceTest

Bug: 143551137
Change-Id: I2e97a8b469254ea92e3ee21571ee8ae3cbb9abbe
2019-11-20 14:26:47 -08:00
Anton Hansson
55b08655e9 Merge "Revert "Work around b/70221552"" am: 79995a5673 am: b2f181d3c3
am: 6f81d38eb0

Change-Id: I1674380d0b79b446e27ddffff32f708c12d3acc0
2019-11-19 19:43:20 -08:00
Mathew Inwood
ca4589bf8e Merge "Fix SignatureBuilder." am: d1219acf84 am: a8aa26d1ed
am: cb84d0811c

Change-Id: I2c9be5a7db203e1fef778fd44bac9b5da189f248
2019-11-19 19:40:22 -08: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
Eugene Susla
f745042916 Add @NonNull annotation to Builder.addXXX args
API guidelines is for each non-primitive arg to have a nullablility annotation.
Since it's very rate for collections to permit null values, just assume
collections only accept @NunNull emenents for now.

Fixes: 144725154
Test: . frameworks/base/tests/Codegen/runTest.sh
Change-Id: I333327490bd8eb9bb031f062c80283bd405173af
2019-11-18 16:39:55 -08: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
satayev
fe407f7afd Merge "Blacklist @TestApis by default." am: 0753b42c3f am: d19b7b9dfa
am: 7593f165af

Change-Id: I8208be1dd88c4bc9958184196e360e71931b7fbe
2019-11-15 11:21:36 -08: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
TreeHugger Robot
d34013b779 Merge "Include ResourcesInternal.proto in aapt2-protos.zip" 2019-11-14 18:20:11 +00:00
Brian Duff
a950d5b4a6 Merge "Speed up WriteKeepSet when generate_conditional_proguard_rules is off." am: a9ee3aaa5f am: 1f44c03058
am: 65e3a342c4

Change-Id: Ifc50ebb69bb6e89fb74c147328eca3c90df7acbf
2019-11-12 16:21:35 -08: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
Donald Chai
34ebc8f435 [aapt2] Fix infinite loop in proguard::CollectLocations
std::set only works correctly when the < comparator is a strict weak
ordering, while UsageLocation::operator< was actually implementing !=.

Bug: 134190468
Change-Id: Icb9407e9c8451f9fcb4eb9b2cea310e3bcaf159e
Tested: aapt2_tests, and b/134190468#comment1
(cherry picked from commit 44fa342eb9)
2019-11-08 05:13:53 +00:00
Treehugger Robot
a5e26c955b Merge "[aapt2] Pseudolocalize <plurals> values." 2019-11-07 22:59:41 +00:00
Donald Chai
98c6138c70 [aapt2] Pseudolocalize <plurals> values.
(.won slaer roF)

Bug: 134190774
Test: aapt2_tests
Change-Id: If307af4adfb1d556c41d7cb08590d1c25287f992
(cherry picked from commit 4c3da0f8a4)
2019-11-07 10:32:09 -08:00
Izabela Orlowska
f53b67cecf Include ResourcesInternal.proto in aapt2-protos.zip
Bug: 144080617
Test: N/A
Change-Id: I71e9cacb9ba7e82024278f888ee6b6a18b43ca64
2019-11-07 11:59:18 +00:00
Adrian Roos
be6c7b4671 Merge "Merge "API Lint: remove obsolete python linter" am: d5ef2d61d1 am: 5d587aeb3f" into qt-qpr1-dev-plus-aosp
am: bf8a7f3b51

Change-Id: I4fac51ae512a7f29c1e499b15e2517922331d25c
2019-11-06 14:34:27 -08:00
Eugene Susla
c5c636a5ea Fix codegen ArrayMap fields
Fixes: 143112074
Test: . frameworks/base/tests/Codegen/runTest.sh
Change-Id: Iec0fa89a91955f8b4e4b5b8d4dd9d7f0b30c608f
2019-11-05 18:14:24 -08:00
Eugene Susla
89cc836c2e Merge "[codegen] Fix generation for files without end markers" 2019-11-04 18:04:57 +00:00
Eugene Susla
7daee0bba4 [codegen] Fix generation for files without end markers
This fixes a bug where cedegen fails for files that were generated before
end of generated code section markers were introduced.

Test: . master/frameworks/base/tests/Codegen/runTest.sh
Change-Id: Ia68e8124fcbdeeb2052067ba8731e68e42007529
2019-11-01 17:56:08 -07:00
Wenjie Zhou
0c1dd67d50 Merge "Add last logcat data to incident report" 2019-11-01 23:05:05 +00:00