Commit graph

92 commits

Author SHA1 Message Date
Josh Gao
955601beb4 Merge "Add libadbd_auth to adbd's required list." 2020-02-04 10:16:41 +00:00
Josh Gao
9952258416 Add libadbd_auth to adbd's required list.
It seems like we might not be tracking dependencies properly on
devices with flattened APEXes? Add libadbd_auth to adbd's required
list to work around this for now.

Bug: http://b/148812347
Test: `ls $ANDROID_PRODUCT_OUT/system/lib/libadbd_auth.so` before and after when building a go device
Change-Id: If60abeb00797e37bf6a5a037249a21877e0b3d26
2020-02-04 07:17:19 +00:00
Josh Gao
d0854b3397 Merge "Add adbd_test to mts." 2020-02-03 23:30:12 +00:00
Josh Gao
d5bad7c021 Merge "adbd: actually dynamically link against libadbd_auth." 2020-02-03 20:15:20 +00:00
Dan Willemsen
a536b4280e The darwin linker does not support version scripts
Fixes: 148774297
Test: m nothing   on a mac
Change-Id: I4000b2076fe2dde3776b112b506ee3266a529fc6
2020-02-03 10:02:41 -08:00
Josh Gao
24b01d2de8 libadbconnection_client: apply version script to library.
Previously, we were using the version script for only the stubs in the
library, which led to symbols from libc++_static leaking out.

Bug: http://b/148504737
Test: booted a user build
Change-Id: Ie22856f7d16cc837eb961f70195d49898bf7fb49
2020-01-31 16:51:54 -08:00
Josh Gao
7f72945eff adbd: actually dynamically link against libadbd_auth.
libadbd_auth was accidentally linked as a static library, which defeats
the entire purpose.

Test: treehugger
Test: readelf -d $ANDROID_PRODUCT_OUT/apex/com.android.adbd/bin/adbd
Change-Id: Id5b66745946a8b92e368ee5f3965275ff03e056d
2020-01-30 16:18:43 -08:00
Josh Gao
7e015871db Add adbd_test to mts.
Bug: http://b/137798163
Test: mts-tradefed run mts-adbd
Change-Id: I875f224bbcd7b1f81365fffdd8de8d2df4e87c84
2020-01-30 23:53:20 +00:00
Josh Gao
bb7fc92ee1 Move jdwp connection abstraction from ART apex to adbd apex.
Test: ./art/tools/run-jdwp-tests.sh
Change-Id: I3114b8403f3548700a45df5d7bb72ebe727adec1
2020-01-24 12:31:59 -08:00
Josh Gao
7da5d8a977 Build test_com.android.adbd.apex.
Build a test apex with an INT_MAX version code for the purposes of
update/rollback testing.

Test: atest adbd_e2e_tests # in internal master
Change-Id: I0e616db03dcbc940af2741dfca5b4c5f50a5a654
2020-01-23 11:55:03 -08:00
Tom Cherry
992163021d Require liblog for libbase in all configurations
liblog will soon be required for all of libbase's logging.  This
change proactively requires liblog in all configurations instead of
just Android.

Bug: 119867234
Test: build
Change-Id: I696162fbebc78d4ef23c6032412101ac51d397a4
2020-01-09 10:43:26 -08:00
Yurii Zubrytskyi
5dda7f6cea [adb] Optimize adbd's usb reading
Try to not allocate as many blocks on the heap, and reuse
memory instead of copying it

Get rid of unique_ptr and shared_ptr where possible, move
the Block objects themselves

Overall this reduces the time spent in memcpy() from 30% to
15% of the whole 'adb push' command, and gets rid of about 5%
of the time spent in the malloc/free calls

Test: builds
Change-Id: I8995115274b6f08a4df13c58183c928ef384a767
2019-11-28 18:24:01 -08:00
Josh Gao
594f70ffb8 Move adbd to an apex.
Test: adb shell "su 0 readlink /proc/\`pidof adbd\`/exe"
Change-Id: I84dfe4d1b28b619f98c03a2c8eeef2c783d30af2
2019-11-04 15:52:16 -08:00
Josh Gao
275232667d adbd: use libadbd_auth for authentication.
Bug: http://b/137798163
Test: for i in `seq 1 100000`; do echo $i; adb wait-for-device shell "su 0 stop; su 0 start; sleep 10"; adb disconnect; done
Change-Id: Ie481e79a48c4aabf18ef797317ba18f207808c63
2019-11-04 15:46:20 -08:00
Josh Gao
2c356bb91e adb: replace reboot service with exec of /system/bin/reboot.
Test: adb reboot
Test: adb reboot fastboot
Change-Id: Ia4146dde7ef3ae00a782dbe68aff166d63eabdb9
2019-10-23 14:33:36 -07:00
Josh Gao
f61f41494e Move enable-verity/disable-verity out of adb to a helper binary.
Test: adb enable-verity
Test: adb disable-verity
Test: adb shell enable-verity
Test: adb shell disable-verity
Test: fs_mgr/tests/adb-remount-test.sh
Change-Id: I0f21a6678b332cc9166d912aa38952d50d924566
2019-10-23 14:33:36 -07:00
Josh Gao
7b7ee191dc Use adbd_system_binaries to track adbd's dependencies.
required doesn't propagate from apexes, so we need a separate phony
target to track adbd's dependenecies.

Test: m
Change-Id: I4c97047dbd1c2f9b394d864aed229798f09fc9b1
2019-10-23 14:33:36 -07:00
Josh Gao
8d1d87e460 adbd: replace remount_service with an exec of /system/bin/remount.
Test: fs_mgr/tests/adb-remount-test.sh
Test: treehugger
Change-Id: Idd581c3927fd8a8bbdf70e90e8f928b7e98e032a
2019-10-16 16:29:10 -07:00
Josh Gao
6ce44041b5 Move remount to PRODUCT_PACKAGES_DEBUG.
required seems to conflict with apex with the following error:

    build/make/core/main.mk:1338: warning: build/make/target/product/aosp_x86_64.mk produces files inside build/make/target/product/mainline_system.mks artifact path requirement.

Test: treehugger
Change-Id: If1fbb9c4a4be340750ee6daea7aa4621177d8d56
2019-10-10 13:12:21 -07:00
Alex Buynytskyy
665f3ff5a7 FastDeploy refactor: 2+GB APK support, optimizations, tests.
- removed 2GB apk size cap,
- removed zip archive parsing on device (1.1M->236K agent size reduction),
- optimized matching entries search,
- added more robust matching entries search based on hash of CDr entry,
- reduced patch size by reusing Local File Header of matched entries,
- removed extra manifest parsing and extra agent calls,
- added device-side tests for agent,
- fix for Windows patch creation.

Test: atest adb_test fastdeploy_test FastDeployTests

Total time for 0-size patch reduction for 1.7G apk: 1m1.778s->0m36.234s.

Change-Id: I66d2cef1adf5b2be3325e355a7e72e9c99992369
2019-10-02 13:25:03 -07:00
Colin Cross
2a62d42704 Merge "Use libcrypto_static instead of libcrypto" 2019-09-26 14:32:33 +00:00
Dan Shi
d1360f4412 Add require_root to adbd_test and libpackagelistparser_test
Bug: 141272654
Test: atest
Change-Id: I14e0d3283cba79a2a4e36e1a1274d6921be5b629
2019-09-24 09:13:32 -07:00
Colin Cross
f117f34aed Use libcrypto_static instead of libcrypto
Replace libcrypto with libcrypto_static, which can be protected through
visibility to ensure only modules that don't affect FIPS certification
can use it.

Bug: 141248879
Test: m checkbuild
Change-Id: I5f0b9acfb57f68570f6f58f2395f2bb1bc015365
2019-09-18 11:04:35 -07:00
Josh Gao
b43ad44f4c adb: fdevent: add fdevent_context_epoll.
Implement an epoll-backed fdevent_context, that reduces overhead when
we're polling many file descriptors. FdeventTest.smoke goes from ~5.2s
to ~3.3s when run on the host (after this patch's modification to change
it from chaining 10 file descriptors together to 512).

Test: adb_test on host
Test: adbd_test on blueline
Test: test_adb.py
Test: test_device.py
Change-Id: Iacf0093aa7bebea31e447c2cb012af72d8c3297e
2019-08-14 13:56:08 -07:00
Joshua Gilpatrick
af3ce0876c Fastdeploy converted to c++ and bin2c on the jar.
Test: Added test for DeployPatchGenerator and PatchUtils cpp files.
Bug: 138130943
Change-Id: I6a128eff4cda00dd05c1bccec71e2678a8b13324
2019-07-29 12:00:09 -07:00
Josh Gao
1f1a0009fc Merge changes I35f8843e,Icd2a94f8,I6c20f3b3
* changes:
  adb: win32: don't shutdown socket when closing.
  adb: win32: silence wine test failure.
  adb: win32: fix adb_test.
2019-07-17 18:04:29 +00:00
Josh Gao
efd8ae2d54 adb: win32: fix adb_test.
At some point between Q and master, adb_test.exe stopped working because
it wasn't being linked with -municode?

Test: wine adb_test.exe
Change-Id: I6c20f3b3241cee2052d31d1ca85b8a9738828f6e
2019-07-16 15:21:59 -07:00
Steven Moreland
e0d94b6493 libadbd_services: remove unused deps
Bug: 137311188
Test: library still builds
Change-Id: I52e110ddfda073c833e86194eaf7a9502b9181a6
2019-07-11 16:13:10 -07:00
Josh Gao
95068bbd9a adb: move fdevent implementation out to a separate file.
Test: mma
Change-Id: I8af945b9ae0accac75fa93c538e44cbab357bb5d
2019-07-08 16:03:27 -07:00
Josh Gao
57e09b16ca adb: move fdevent to its own folder.
Preparatory refactoring for platform-specific implementations.

Test: mma
Change-Id: I0f600122ac89241788c5f3300f362fd9ef02ddcd
2019-07-08 14:37:27 -07:00
Josh Gao
5f2c5bbd04 adbd: move jdwp listening logic into ART.
Test: manually use jdwp
Change-Id: Ia09a5c643cba9ec5f343c9767d43d72b077bc247
2019-06-25 12:37:20 -07:00
Josh Gao
27241a7a96 Revert "Revert "Add a way to turn off unique_fd's operator int.""
The original commit broke aosp-master-with-phones, because of
vendor libraries the depended on the int versions of libbase functions.

This patch reverts the revert, and also adds ABI-compatibility shims for
the replaced functions.

This reverts commit 2c58e1924a.

Bug: http://b/131312539
Test: treehugger
Test: forrest run of aosp-master-with-phones
Change-Id: I75cc84ec8d963e20862f7662e8e2f409471f41cc
2019-05-06 16:18:02 -07:00
Josh Gao
bde8c848d8 adbd: compile a static version.
Test: mma
Change-Id: I785de074f9b5cc63d1804420b734c4b07081a716
2019-05-01 18:25:52 -07:00
Ian Kasprzak
e30fe5fe89 Merge "Revert "Add a way to turn off unique_fd's operator int."" 2019-04-25 17:16:55 +00:00
Ian Kasprzak
2c58e1924a Revert "Add a way to turn off unique_fd's operator int."
This reverts commit 93d63c010a.

Reason for revert: b/131312539 - All aosp-master-with-phones phones failing boot / health check.

Change-Id: Id4239f93484b7d6b8d9bcd355a59cbd40d9766e2
2019-04-25 15:59:28 +00:00
Josh Gao
971bae0bcf Merge "Add a way to turn off unique_fd's operator int." 2019-04-24 22:58:00 +00:00
Josh Gao
93d63c010a Add a way to turn off unique_fd's operator int.
unique_fd's implicit conversion to int has led to tons of problems (see
all of the overloads for close, fdopen, fdopendir, etc.). Add a switch
that can turn it off, and reduce the ridiculous amount of work to fix up
callers by introducing a borrowed_fd type that can be constructed from
either int or unique_fd.

Test: treehugger
Change-Id: If77cf5cbcaddacdaec5919a15b3520fb68f51a62
2019-04-24 12:59:42 -07:00
Josh Gao
4710e53fe5 adb: silence warning from libusb.
Test: mma
Change-Id: I3f254f3432020937e0f22b04baf7df61336c500b
2019-04-17 16:57:43 -07:00
Bowgo Tsai
9b30c0a7e6 adbd: allowing adb root when the device is unlocked
As there is no security guarantee when the device is unlocked,
allowing adb root gives us more rooms to debug a USER build images.

Also, this makes it possible to run VTS on a USER build GSI, with
setting ro.debuggable=1 and unlocking the device.

This basically re-lands a reverted change:
https://android-review.googlesource.com/c/platform/system/core/+/437815

Which isn't needed after we moved /sbin/adbd to /system/bin/adbd in
USERDEBUG GSI. But it's still needed for USER build GSI.

Bug: 126493225
Test: unlock a USER build device, check 'adb root' can work
Change-Id: I93f12c8a3fe65c96c947e4602795eadfe591c521
2019-03-15 03:04:46 +08:00
Mark Salyzyn
2f6c180749 adb: use /system/bin/remount command
Replace direct logic in support for 'adb remount' with an exec out to
/system/bin/remount to do the heavy lifting.  Remount success and
failure strings are reported by the adb remount service in response
to the various reported errors, freeing up the remount command itself
from the legacy of script expectations.

Test: adb-remount-test.sh
Bug: 122602260
Change-Id: I686fa465f463b881bbb38f709d780a95e463be80
2019-03-04 11:12:54 -08:00
Josh Gao
287e442dc4 adb: turn off fastdeploy.
The PDK doesn't have frameworks/base, so having a dependency from adb to
a library in there breaks the build. #ifdef out fastdeploy until we
figure out what we're going to do here, to unbreak the PDK build.

Bug: http://b/118782743
Test: treehugger
Change-Id: I638cf09e5013935e112c7a57dae0e7e94e1a4680
2019-01-29 11:21:15 -08:00
Josh Gao
776c2ec08c adbd: compile for host.
Preparatory step for testing adb on GCE on non-linux hosts: instead of
pointing them at a device (emulated or otherwise), point them at adbd
running on a linux host instead.

Test: adbd & adb connect localhost:5555; adb -e wait-for-device shell
Change-Id: Ib22d51a4fc9e6e68f71bf1b3b9b2e1b0bd844760
2019-01-23 12:59:41 -08:00
Alex Buynytskyy
640407d632 Adding Android Binder Bridge (abb) utility launched from adbd.
Once launched, abb will listen for incoming Binder cli requests.
Executing in-process provides 6x latency improvement (125ms vs 25ms on
PixelXL) for commands like 'package path'

Intended usage by Android Studio for fast deployment and patching of APKs.

Test: manual
BUG: 111621042

Change-Id: Ica84eb2ec9628efa441ecd627b119f3361feaf9f
2019-01-07 15:45:11 +00:00
Josh Gao
6eb788298b adbd: add source/sink services.
Add some services that skip the service fd to see how much of a benefit
it'll be to eliminate it.

Test: adb raw source:$((300 * 1024 * 1024)) | pv > /dev/null
Test: dd if=/dev/zero bs=1M count=100 | pv | adb raw sink:$((100 * 1024 * 1024))
Change-Id: I042f25f85b16ae9869cb1f1e306d8671b024ed97
2018-12-12 12:54:28 -08:00
Josh Gao
ce5ce87a66 adb: remove incorrect use of RTTI.
We were dynamic_casting to UsbConnection to check for USB connections,
but the actual type was a BlockingConnectionAdapter wrapping a
UsbConnection, with the result that unplugging an inaccessible (due to
permissions) device on Linux wouldn't make the device go away.

Test: manual
Change-Id: Icb4acea5fd3c3baa9691698686213e122e898e4a
2018-12-12 12:54:03 -08:00
Elliott Hughes
3c59cb8420 C++17 is the default now.
Test: builds
Change-Id: I6814455e9ad2cdcf99ad66de38a3ad0bfb440d80
2018-12-03 09:02:18 -08:00
Dan Willemsen
3f439a7a88 Switch from dist-for-goals to dist in Android.bp
Removes a few more Android.mk files.

Test: check for adb, mkbootfs, and fastboot in the build artifacts
Change-Id: Ie4e50a363a734d0b9207f0d0098c54719f038e76
2018-11-19 23:06:12 -08:00
Josh Gao
1289e1ec65 Revert "adb: make benchmarks build on the host."
This reverts commit 80dd70d285.

Breaks the darwin build.

Change-Id: If95266c6fc027cf2a706f3c83dce7e50b762b8aa
2018-11-13 11:28:29 -08:00
Josh Gao
80dd70d285 adb: make benchmarks build on the host.
Test: adb_benchmark
Change-Id: I9afedd7bdcf645652e514d98bb88036753718168
2018-11-12 20:54:30 -08:00
Josh Gao
c51726cbec adbd: implement a nonblocking USB Connection.
Implement a Connection that implements a nonblocking interface to
functionfs, to replace the existing implementation that uses two
threads that loop and call read and write respectively. The existing
implementation is vulnerable to a race condition that can occur when a
connection is terminated, where one thread can notice failure and
complete reinitialization of the USB endpoints before the other thread
noticed anything went wrong, resulting in either the first packet
coming from the other end disappearing in to the void, or the other end
getting a packet of garbage.

As a side benefit, this improves performance on walleye from:

    push 100MiB: 10 runs: median 49.48 MiB/s, mean 50.00 MiB/s, stddev: 2.77 MiB/s
    pull 100MiB: 10 runs: median 75.82 MiB/s, mean 76.18 MiB/s, stddev: 6.60 MiB/s

to:

    push 100MiB: 10 runs: median 73.90 MiB/s, mean 73.51 MiB/s, stddev: 5.26 MiB/s
    pull 100MiB: 10 runs: median 105.90 MiB/s, mean 107.19 MiB/s, stddev: 6.10 MiB/s

Test: python test_device.py
Change-Id: I9b77c1057965edfef739ed9736e5d76613adf60a
2018-10-19 17:53:18 -07:00