66 Commits

Author SHA1 Message Date
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
Orion Hodson
cc8b8ca466 Adds ToBits helper method to convert instructon opcode enum to bits
Bug: 142948359
Test: atest dex-builder-test
Change-Id: Ic1c02e74dd787107c08bd34ca861eee89d6d1423
2019-11-04 16:58:26 +00:00
Orion Hodson
59d07201d9 Switch to slicer DEX opcode definitions
Removes dependency on art/libdexfile and uses equivalent definitions
from the dexter/slicer library.

Bug: 133140750
Bug: 142948359
Test: m
Test: atest dex-builder-test \
            view-compiler-tests \
            android.view.cts.PrecompiledLayoutTest
Change-Id: I49562ac4867254ecde287b828f76d23cb5132dd0
2019-11-01 11:38:56 +00:00
Treehugger Robot
f5617abe09 Merge "Refactor DexViewBuilder" 2019-09-25 16:57:37 +00:00
Steven Moreland
598bda8624 Host users of libutils trace use libcutils.
Reducing device/host differences. This is now required since libutils
Trace.h always calls the libcutils functions, instead of before where
it only called these functions on device.

Bug: 124524556
Test: build & boot
Change-Id: Ic096ed7caf8ca59292b3427a16c4e2545d12dfd9
2019-09-20 11:27:59 -07:00
Eric Holk
5c6a1a516b Refactor DexViewBuilder
The code was previously pretty messy and hard to follow. This reworks some
things to make it more manageable. Among the changes:

* Pull out fragments of code into their own method, so the high level steps are
  more apparent in methods like DexViewBuilder::Start.
* Pull frequently used types into global constants in dex_layout_compiler.cc.
* Rework register handling to track liveness so a strict stack discipline is no
  longer needed.

Change-Id: Idb4b41f88c96a1ac4efb2c7b9bed05c2de0da999
2019-09-18 17:04:50 -07:00
Eric Holk
06a213820d [view compiler] Add test coverage for layouts compiled from APK
The existing LayoutCompilerTest only covered compiled layouts generated from
text XML files. It did not cover layouts that were extracted from the APK. This
is an important area to cover.

This test works by calling `pm compile --compile-layouts` on the test APK, and
then directly loads the `compiled_view.dex` file. From there, it pulls out the
compiled layouts and executes their inflater. This makes sure the generated DEX
files validate and execute without error.

Bug: 111895153
Merged-In: Ifc6719c2f438474b5474def02422ef68eee800b2
Change-Id: I7024069bb4d77a81871366f259fb34ae54a55aac
2019-09-05 11:20:05 -07:00
Eric Holk
130c3cc2b1 Merge "[view compiler] Remove dex_builder_test.cc"
am: 63f6a62163

Change-Id: Ib73ed6f1fee41358eabe4b93fd99fe96339c205d
2019-08-05 10:06:15 -07:00
Eric Holk
e167823f12 [view compiler] Remove dex_builder_test.cc
This test is problematic because it links against libdexfile and we would like
to remove this dependency. All of the functionality covered by this test is also
tested more thoroughly by the on-device dex-builder-test, so there's no reason
to test it here as well.

Change-Id: Ie45d4a1c99668b68476168fc072a220fa5db3695
2019-08-02 09:32:02 -07:00
Eric Holk
f6b04a5e3b Merge "[view compiler] Cleanup: Delete duplicate LayoutValidationVisitor::VisitStartTag"
am: 94d801a515

Change-Id: I19439c000c8372db0ee3f68f904d9ebe84c74a06
2019-07-31 16:24:46 -07:00
Treehugger Robot
94d801a515 Merge "[view compiler] Cleanup: Delete duplicate LayoutValidationVisitor::VisitStartTag" 2019-07-31 22:03:46 +00:00
Eric Holk
615fd40982 Merge "[view compiler] Add DexBuilder support for getting and setting instance fields"
am: c0b1a32260

Change-Id: I9efc2af44faa17b40de1b3630ecfb54ca0b15f6d
2019-07-31 12:29:23 -07:00
Eric Holk
d2364572fe [view compiler] Cleanup: Delete duplicate LayoutValidationVisitor::VisitStartTag
Change-Id: I9f83b2a5d61e92dee9cded239626dcaa0ebb1993
2019-07-31 11:07:51 -07:00
Eric Holk
f3b9589e7b [view compiler] Add DexBuilder support for getting and setting instance fields
Bug: 111895153
Change-Id: I5fa2936501c79e30a66f3863b76229ec83433928
2019-07-30 14:47:06 -07:00
Eric Holk
1c2e3a181d Merge changes I12b38fa5,Ia11195b1
am: 8aa2b1dffd

Change-Id: I2ac308ac94fd49298641c1230e731c1406913281
2019-07-26 20:13:32 -07:00
Eric Holk
70445d0d89 [viewcompiler] Add support for static field put to DexBuilder
Bug: 111895153
Change-Id: I12b38fa520790debec545d7d1f6b3522a65ce03b
2019-07-26 09:46:18 -07:00
Eric Holk
3092f99ae6 [viewcompiler] Add static field get instructions to DexBuilder
This allows us to generate code that can read static fields in a class. Once we
include several other field operations, we will be able to generate more
specialized inflation code in the view compiler.

Bug: 111895153
Change-Id: Ia11195b1cea6d5a3ddbc60d972922586a062c853
2019-07-26 09:42:41 -07:00
Colin Cross
cd18790959 Merge "Fix ODR issue in viewcompiler" am: b9879d00c4 am: d1e12a6112
am: bf200e78a8

Change-Id: Ib8afbe33ef39a140e8d9855a13aa1296a6b5bd61
2019-03-21 01:44:16 -07:00
Colin Cross
d1e12a6112 Merge "Fix ODR issue in viewcompiler"
am: b9879d00c4

Change-Id: I2fda6bdf7ebc082a732d75d55694d47f5a755fdc
2019-03-21 01:23:40 -07:00
Colin Cross
d7632929ea Fix ODR issue in viewcompiler
libz is already linked as a static library through
libdexfile_static_defaults, don't also link it as a shared library.
Fixes:
=================================================================
==43189==ERROR: AddressSanitizer: odr-violation (0x55d1ed723a60):
[1] size=48 'inflate_copyright' external/zlib/src/inftrees.c:11:12
[2] size=48 'inflate_copyright' external/zlib/src/inftrees.c:11:12
These globals were registered at these points:
[1]:
 #0 0x55d1ed769a0e (/buildbot/src/android/master/out/soong/host/linux-x86/bin/viewcompiler+0xf3a0e)
 #1 0x55d1ed991b1b (/buildbot/src/android/master/out/soong/host/linux-x86/bin/viewcompiler+0x31bb1b)

[2]:
 #0 0x55d1ed769a0e (/buildbot/src/android/master/out/soong/host/linux-x86/bin/viewcompiler+0xf3a0e)
 #1 0x7f5dff20a09b (/buildbot/src/android/master/out/soong/host/linux-x86/bin/../lib64/libz-host.so+0x3e09b)

Test: m SANITIZE_HOST=address viewcompiler && viewcompiler
Change-Id: I4ebdf7ef4ec1641488fbc25275dbf6aa0cdbe2eb
2019-03-20 21:19:57 -07:00
Brett Chabot
502ec7ae4b Migrate remainder of frameworks/base to androidx.test
See go/jetpack-test-android-migration

Exempt-From-Owner-Approval: automated package name refactoring

Test: m  m -j BroadcastRadioTests KeystoreTests mediaframeworktest ActivityManagerPerfTests AppLaunch AppLaunchWear BackgroundDexOptServiceIntegrationTests AppCompatibilityTest DynamicCodeLoggerIntegrationTests FlickerLibTest InternalTests PackageWatchdogTest RcsTests RollbackTestAppAv1 RollbackTestAppAv2 RollbackTestAppACrashingV2 RollbackTestAppBv1 RollbackTestAppBv2 RollbackTestAppASplitV1 RollbackTestAppASplitV2 RollbackTest ServiceCrashTest UsageStatsPerfTests UsbTests WindowAnimationJank
Change-Id: I32fe3297656eec6060da6c7e24582bcd5315fb16
2019-03-02 00:35:17 +00:00
Xin Li
b455c3a7f3 DO NOT MERGE - Merge pi-dev@5234907 into stage-aosp-master
Bug: 120848293
Change-Id: I2f9a524f2ba552de3f62e343075cf0abf400bbae
2019-02-21 16:02:06 -08:00
Chih-hung Hsieh
f59468295e Merge "Add default code reviewers into OWNERS" am: e45eefe8ec
am: 3a59c9f70e

Change-Id: I65f8c7aa64ee34388341c6e8687adc3dbdcfa595
2019-02-06 22:42:47 -08:00
Chih-Hung Hsieh
34cd77a651 Add default code reviewers into OWNERS
Bug: 33166666
Test: gerrit uploader
Change-Id: Ief5d4bf9005bb3a712803101f98dd2b876662eb8
2019-02-06 22:19:19 -08:00
Chih-hung Hsieh
acd74cfac0 Merge "Work around clang-tidy bug in dex_builder.cc." am: c6036971e7
am: 24a986bfb1

Change-Id: Ic46821b9512dc4b73ce153202012984a714649c5
2019-02-06 14:34:50 -08:00
Chih-Hung Hsieh
2b61bddc1a Work around clang-tidy bug in dex_builder.cc.
Bug: 123880763
Test: build with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=*,-readability-*,
    -google-readability-*,-google-runtime-references,-cppcoreguidelines-*,
    -modernize-*,-llvm-*,-bugprone-narrowing-conversions,
    -misc-non-private-member-variables-in-classes,
    -misc-unused-parameters,-hicpp-*,-fuchsia-*

Change-Id: Ibf80f951ae2369a55570770febe8a1c4422181e1
2019-02-05 17:11:05 -08:00
Chih-Hung Hsieh
6cb189e322 Merge "Temporarily disable clang-tidy for dex_builder.cc." am: 171dfad60c
am: e6d84ae4c9

Change-Id: I13efd650ad82f46e7c060558809109b72de17047
2019-02-04 21:36:52 -08:00
Chih-Hung Hsieh
7ae7f169fb Temporarily disable clang-tidy for dex_builder.cc.
Bug: 123880763
Test: build with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=*,-readability-*,
-google-readability-*,-google-runtime-references,-cppcoreguidelines-*,
-modernize-*,-llvm-*,-bugprone-narrowing-conversions,
-misc-non-private-member-variables-in-classes,
-misc-unused-parameters,-hicpp-*,-fuchsia-*

Change-Id: I7be72b9db232a375bf7caf3b2dbeb9c6f7368a8e
2019-02-04 10:35:55 -08:00
Eric Holk
1660db4818 Merge "[viewcompiler] Support more than 16 registers in invoke instructions" am: f96ebc501e
am: 18fa74cbe4

Change-Id: I2bbe8793d7bf3b1e06ec5576ba250f10a0f9c304
2019-02-01 12:44:32 -08:00
Treehugger Robot
f96ebc501e Merge "[viewcompiler] Support more than 16 registers in invoke instructions" 2019-02-01 18:57:18 +00:00
Eric Holk
55398cf19d Merge "[viewcompiler] Add PrecompiledLayoutTest to TEST_MAPPING" am: 1cb64c6a85
am: d8ec417dd6

Change-Id: I12273695d8318900d325436ebb252b287517c367
2019-01-31 19:17:13 -08:00
Eric Holk
d1b4383660 [viewcompiler] Support more than 16 registers in invoke instructions
This was causing the viewcompiler to crash on deeper layout hierarchies.

We fix this by reserving several scratch registers. When an invoke instruction
uses registers that don't fit in a 4-bit field, we move all of these values into
the scratch registers and use an invoke/range instruction instead. The scratch
registers are all above the highest allocated register, so they are guaranteed
not to clobber meaningful values.

Supporting more registers for invoke also required supporting
register-to-register moves, which some how we'd gotten by without so far.

Finally, to make viewcompiler fail more loudly when things go wrong, many
DCHECKs have been changed to CHECKs.

Bug: 123517491
Test: atest
Change-Id: I9eb7c9bcf1fc7d713e664b331804bdcddafc95a4
2019-01-31 15:15:14 -08:00
Eric Holk
8c933e5a9d [viewcompiler] Add PrecompiledLayoutTest to TEST_MAPPING
PrecompiledLayoutTest makes sure that layouts generated by the viewcompiler are
equivalent to inflating from the resource XML file. We'll want to run these
tests when making changes to the viewcompiler.

Bug: 111895153
Test: atest
Change-Id: Iffa6f0f01c3f43d43feaabd1a5cd36be76650975
2019-01-31 21:22:06 +00:00
Orion Hodson
0c024ea711 Merge "startop: use static_lib dependency on libdexfile." am: ff1aa4e49a
am: db28e6e8b1

Change-Id: I64907bda16a8f248a27eb643b6a4621860c30928
2019-01-28 20:54:34 -08:00
Orion Hodson
ca1b80b52e startop: use static_lib dependency on libdexfile.
libdexfile.so is moving to APEX and the external API doesn't include
the features needed for startop.

Bug: 119632407
Test: Builds
Change-Id: I6d33e8737341a508637321921ca732af913827a3
2019-01-28 13:32:37 +00:00
Eric Holk
2c6aa62cee Merge "[viewcompiler] Enable input from file descriptor" am: 040579c6a3
am: 88f9ca38fb

Change-Id: I828cd906b95daac5f74d2cc0289c211ade0be1d9
2019-01-15 14:00:35 -08:00
Eric Holk
0e0e7dde92 [viewcompiler] Enable input from file descriptor
This is needed to be able to launch the viewcompiler from installd. We only
support FD-input mode when reading from APKs. For output to an FD, we rely on
stdout redirection.

Bug: 111895153
Change-Id: I3025d83c60494485bada5f2f4cd67e25354d1d53
2019-01-15 10:03:46 -08:00
Eric Holk
9f69619a97 Merge "Make viewcompiler available on device" am: eb678ba1d3
am: a3e9526ea8

Change-Id: I4ddbb337967a7e072d69d024fe7c92099e7dce4b
2019-01-14 14:25:25 -08:00
Eric Holk
bf30e31acc Make viewcompiler available on device
We'll need this binary on device to be able to compile views at application
install time. There will be a followup CL to the build system to make sure
viewcompiler is built and installed by default.

Bug: 111895153
Change-Id: I2c98864118dfeca79e36be760bd44b9afa03b4d4
2019-01-14 10:25:40 -08:00
Eric Holk
72ffe3b785 Merge "[view compiler] Compile all layouts in an APK" am: a95eac0c59
am: 0ca2e2c2dd

Change-Id: I9106f0893aef1569b7ba6b9944cc2d7b8081ee94
2019-01-08 10:28:53 -08:00
Eric Holk
b377e5177e [view compiler] Compile all layouts in an APK
Test: atest
Bug: 111895153
Change-Id: I5f4b9b4c1160acf1c04a4492f5e3a736fbaf2fdc
2019-01-07 14:40:44 -08:00
Eric Holk
c31debe037 Merge "[view compiler] Add XML to DEX compilation" am: d426ee84a0
am: 755467bb4f

Change-Id: I32e325db7d9176910e271b721c0adf1b98d1a688
2019-01-07 10:08:49 -08:00
Eric Holk
4273457c9e [view compiler] Add XML to DEX compilation
Test: atest
Bug: 111895153
Change-Id: I91c01ff4474e080c87b902ae963b5d655346f859
2019-01-05 01:36:05 +00:00
Eric Holk
b63e813feb Merge "[view-compiler] Better namespacing of util functions" am: ff77ea8d58
am: 36c3953339

Change-Id: I5aa433d38991ec73280b267076ca20b784a032f8
2019-01-02 11:46:15 -08:00
Eric Holk
ddc8990f09 [view-compiler] Better namespacing of util functions
This moves some helper functions into our own namespace to avoid conflicting
with other util.h files.

Bug: 111895153
Change-Id: I2b4c77732a97b34a8528d69867c15ed802686703
2019-01-02 18:02:31 +00:00
Eric Holk
531c40f8b8 Merge "[view compiler] Re-enable host-side tests" am: abe06f9138
am: ca50bb3980

Change-Id: I02bfcdd456344cb05c05c767d63a105324deb6dd
2019-01-02 08:17:45 -08:00
Eric Holk
162c812b65 [view compiler] Re-enable host-side tests
TEST_MAPPING supports both host and device tests now, so we should run both.

Test: atest
Bug: 111895153
Change-Id: I48f26093fc0ae3cdaa9e5295375945b5a519e1c2
2018-12-21 16:10:49 -08:00
Chih-Hung Hsieh
4b4210f342 Merge "Fix/suppress startop google-explicit-constructor warnings" am: 667dba5c14
am: b3bc82c7f5

Change-Id: I0efecc008ff21584fbec19fd68b2a94368821b4f
2018-12-20 22:14:59 -08:00
Chih-Hung Hsieh
81aff0fbab Fix/suppress startop google-explicit-constructor warnings
* Add explicit to conversion constructors/operators

Bug: 28341362
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor
Change-Id: I9e7b929cfa65c68f4cdb4710c1c5c6760d56e4d5
2018-12-20 13:53:28 -08:00
Eric Holk
77e8678219 Merge "[view-compiler] DexBuilder: Add check-cast instruction" am: bce4bd1745
am: 758823ae17

Change-Id: I12ce815eb4f83c6abc60ad7402c754e3c69cb0d9
2018-12-18 16:14:25 -08:00