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
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
Removes a few more Android.mk files.
Test: check for adb, mkbootfs, and fastboot in the build artifacts
Change-Id: Ie4e50a363a734d0b9207f0d0098c54719f038e76
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
Extract common functionality that will be useful for implementing a
nonblocking Connection for functionfs.
Test: mma
Change-Id: Iae4f3d55b2f56568d4a5138db9a2af5622eb83ad
Run some more tests for adb.
Test: tradefed.sh run template/local_min --template:map test=atest --include-filter adb_integration_test_device --log-level VERBOSE --log-level-display verbose
Bug: 112104122
Change-Id: I44b5a2aed8d86ab2dca62081d5b3b05f6e01cabd
Removed call to external aapt2 process
Replaced several layers of error handling with calls to fatal()
Changed output messages for failures to be more useful for diagnostics
Bug: 116753196
Test: mm
Test: adb install -r --fastdeploy --force-agent --local-agent ~/example_apks/example.apk
Test: adb install -r --fastdeploy --no-streaming --force-agent --local-agent ~/example_apks/example.apk
Change-Id: I6006d8aa584e789a086a31e79a41d1416e54402a
The standard (RFC 1122 - 4.2.2.13) says that if we call close on a
socket while we have pending data, a TCP RST should be sent to the
other end to notify it that we didn't read all of its data. However,
this can result in data that we've succesfully written out to be dropped
on the other end. To avoid this, instead of immediately closing a
socket, call shutdown on it instead, and then read from the file
descriptor until we hit EOF or an error before closing.
Bug: http://b/74616284
Test: ./test_adb.py
Test: ./test_device.py
Change-Id: I36f72bd14965821dc23de82774b0806b2db24f13
deploypatchgenerator is now a dependency of adb
deployagent is now a java_binary target and uses the built in 'wrapper' parameter to bundle deployagent.sh
fastdeploy.cpp code in adb modified to reference deployagent rather than deployagent.sh (required to work with built in wrapper functionality).
removed near-redundant fastdeploy_init and TFastDeployConfig singleton as per:
https://android-review.googlesource.com/c/platform/system/core/+/740521/12/adb/client/fastdeploy.cpp#36
relocated kFastDeployMinApi to more appropriate location
Test: rm -rf $ANDROID_ROOT/out
Test: make sdk -j40
Test: find out/ -iname deploypatchgenerator
Test: observe that deploypatchgenerator.jar has been built as a dependency of the sdk target
Test: mm
Test: adb install -r -f --force-agent --local-agent ~/example_apks/example.apk
Test: adb install -r -f --no-streaming --force-agent --local-agent ~/example_apks/example.apk
Change-Id: I4e52d32f87774b44845bf6b5be0bae331a0b2324
Also fix adb's version number to match.
See build/soong/README.md for more information.
Test: cd system/core/fastboot; mma
Test: fastboot --version
Test: adb --version
Test: out/host/linux-x86/nativetest/fastboot_test/fastboot_test
Test: out/host/linux-x86/nativetest64/fastboot_test/fastboot_test
Change-Id: I65ea39af9183c602e84f3bc0e4a0d066a30fc464
It was only needed when we statically linked libfec into libadbd in
past.
Test: `mmma -j system/core/adb`
Test: `m -j installclean && m -j bootimage` with aosp_taimen-userdebug.
Check the installed files in recovery image.
Change-Id: I8627d5f98568ab1d71e6a47cb1b2540a33bffdab
Currently, test_adb.py doesn't work on Windows, because we're selecting
on a pipe, which doesn't work on Windows. Python 3.5 adds socketpair
support to Windows, so switch over to Python 3 to make it so we can use
that.
Test: python3 test_adb.py
Change-Id: I0fbd1bca0b28324658831d5ef8ee08aefe2b0596
In order to run them continuously, add them to general-test
zip.
Test: make general-tests
Bug: 112104122
Change-Id: I7a1143ac638626069ed78ddd450063e9489e22e8
This CL builds the former `libadbd` as a shared library, and moves
`adbd` to using shared libraries.
We can't switch `libadbd` from static to shared library directly, due to
the circular dependency between `libadbd` and `adbd`. In particular,
daemon_service_to_fd() can't be compiled into `libadbd`, as it needs to
be overridden by recovery/minadbd.
This CL creates a static library `libadbd_core` as the common base,
which contains everything from the former `libadbd`. Both of the two
shared library targets `libadbd` and `libadbd_services` depend on
`libadbd_core`.
The `adbd` on device (under both of normal boot and recovery) now
depends on `libadbd.so` and `libadbd_services.so`. recovery/minadbd will
depend on `libadbd.so` and `libminadbd_services.so` in future (after
fully converting recovery to Soong).
Bug: 78793464
Test: `m dist`
Test: Run adbd_test on marlin.
Test: Build and flash marlin on device. Check basic adbd functionalities
(`adb shell` and `adb sync`) under normal boot and recovery.
Test: `adb sideload` on marlin.
Change-Id: Iacbd4db524ef94abd175cd1d27688f4faf3db024
Let minadbd override daemon services by pulling out the daemon services
into a separate translation unit, that isn't compiled into libadbd.
Bug: http://b/111831478
Test: mma
Change-Id: Iecfebea371e03864108eca9a4d2e9cfd5db34749
Fastbootd will reuses adb's functionfs transport
implementation.
Move it to daemon/include as well so it can be accessed
with "adbd/usb.h". Otherwise usb.h will conflict with
other imports.
Test: adb builds and works
Bug: 78793464
Change-Id: If3ba190d5c74b5f3633411f0484195e5a2a34d44
Bug: http://b/69933068
- Add -Wexit-time-destructor globally after fixing one warning
- Enable -Wthread-safety only for non-windows targets. The version of
libstdc++ we use for Windows doesn't have the correct thread-safety
annotations.
Test: Run Clang-built adb_test.exe under wine
Change-Id: I76a43060342e7d1dc370ce3e117f3563c82b7751
Implement a nonblocking version of FdConnection. The initial
implementation will be somewhat slower than the blocking one for large
packet sizes, due to an extra copy when coalescing an IOVector into an
apacket, but is still substantially faster for small packets.
Test: adb_benchmark
Change-Id: I4900c9ddf685d3bd557b8cb43958452ecb23db53
adbd has been built as a static executable since the same binary was
copied to the recovery partition where shared library is not supported.
However, since we now support shared library in the recovery partition,
adbd is built as a dynamic executable.
In addition, the dependency from adbd to libdebuggerd_handler is removed
as debuggerd is handled by the dynamic linker.
A few more modules in /system/core are marked as recovery_available:
true as they are transitive dependencies of the dynamic linker.
This change also includes ld.config.recovery.txt which is the linker
config file for the recovery mode. It is installed to /etc/ld.config.txt
and contains linker namespace config for the dynamic binaries under
/sbin.
Bug: 63673171
Test: `adb reboot recovery; adb devices` shows the device ID
Test: Select 'mount /system' in the recovery mode, then `adb shell`.
$ lsof -p `pidof adbd` shows that libm.so, libc.so, etc. are loaded from
the /lib directory.
Change-Id: I363d5a787863f1677ee40afb5d5841321ddaae77
adbd (and its dependencies) are marked as recovery_available:true so
that recovery version of the binary is built separately from the one for
system partition. This allows us to stop copying the system version to
the recovery partition and also opens up the way to enable shared
libraries in the recovery partition. Then we can also build adbd as a
dynamic executable.
Bug: 79146551
Test: m -j adbd.recovery
Change-Id: Ib95614c7435f9d0afc02a0c7d5ae1a94e439e32a
An IOVector is a collection of immutable reference counted blocks which
can have its head detached at an arbitrary index. This is extremely
useful for implementing packet-framed protocols like adb on top of a
stream protocol like TCP: a stream reader can read blocks, append them
to the end of the IOVector, and then pull packets off of the front.
This also lends itself naturally towards scatter/gather I/O, which will
enable us to read data from disk and send it across the wire with a
theoretical minimum number of copies in USB, and one extra copy over
TCP.
Since this is basically a generalization of std::deque<Range>, delete
Range and replace its uses with IOVector.
Test: adb_test
Test: wine adb_test.exe
Change-Id: I06561ad0bb25a3a51b378b61d257b5b04b41d9c4
The tags property is (and has always been) unused by Soong. The property has
been defined as a list of strings, and the `androidmk` converted any
LOCAL_MODULE_TAGS entries over to it, but we've never done anything with it.
In preparation for removing the definition from Soong, I'm removing it from all
Android.bp files in the tree.
Since this has never done anything, this is a no-op, but if you really did want
the Android.mk behavior, the proper way to define a module to be installed in
userdebug / eng builds is to use PRODUCT_PACKAGES_DEBUG or PRODUCT_PACKAGES_ENG
in the appropriate product makefile.
Change-Id: Id519b2c0ec352e45c470a1734dfc633bbe39937e
Exempt-From-Owner-Approval: global no-op build change
Test: remove `tags` from Soong, see errors go away.
This reverts commit 2ef56a1174.
host_supported is broken in cc_benchmark on Mac, but we probably don't
actually too much about the host benchmarks, so just delete the line.
Bug: http://b/77585931
Test: treehugger
Change-Id: I8898b4037a3faf8e8dee2a99498a6f84e642b92b
The switch over to soong unintentionally turned off building the
Windows tests (and there's a bug preventing them from being turned on).
Preemptively fix the build breakages that'll happen when we turn them
back on.
Test: mma with Android.bp 's/cc_test_host/cc_binary_host' hacks
Change-Id: I6582cfc61b96052537d50d8ba90533dbb66e3e1d
adbd is copied into the recovery image without the accompanying
linker/libraries, so it must be a static executable.
Bug: http://b/74237641
Test: `file $ANDROID_PRODUCT_OUT/system/bin/adbd`
Change-Id: Ie8d0710f6002458519d3eea3d696e9016faafee8
Rearrange some files while we're doing this.
Bug: http://b/71721338
Test: manually ran adb on windows
Change-Id: Ie47bda82279e4b9521505ad0353bf9ef649fc7d7