Commit graph

3523 commits

Author SHA1 Message Date
Treehugger Robot
8987016b1e Merge changes I24e70952,I652560ad
* changes:
  adb: use transport-id to make coverage script faster.
  adb: add `adb transport-id` command.
2020-05-12 02:22:27 +00:00
Treehugger Robot
1d77251d76 Merge "Remove unneeded optimize_for lite" 2020-05-11 23:49:29 +00:00
Joshua Duong
2814928567 Merge "[adb client] Fix mdns discovery service registry." 2020-05-06 21:39:59 +00:00
Josh Gao
a11d27f920 adb: use transport-id to make coverage script faster.
Test: ./coverage/gen_coverage.sh
Change-Id: I24e70952946ad91d51acf9bda386826e4e73a0d2
2020-05-05 14:44:01 -07:00
Josh Gao
3441f232ab adb: add adb transport-id command.
Make it possible to safely script waiting for a device to go away after
root/unroot.

Test: manual
Change-Id: I652560ad1d88a5c6a1e8ea5787c3cf165c82aa63
2020-05-05 14:43:53 -07:00
Joshua Duong
077ac11106 [adb client] Fix mdns discovery service registry.
We were getting stale service ip addresses because we weren't
destroying the sdref correctly.

Also, we were leaking the ResolvedServices when removing it from the
ServiceRegistry. Converted them to smart pointers to fix that.

Bug: 153343580

Test: test_adb.py
Change-Id: Ib7c1dbf54937d4ac6d9885cb5f7289bef616d12e
2020-05-05 00:21:12 -07:00
Luca Stefani
9a3d868d3e Remove unneeded optimize_for lite
* It's already specified in the java_library definition

Test: m deployagent_lib, no warnings
Change-Id: I58fa9af71b8f817da55cfc040fbcbd80fd6425cf
2020-05-01 16:11:22 +02:00
Jooyung Han
60985953bd Merge "Add min_sdk_version:R to updatable apexes" 2020-04-25 04:41:43 +00:00
Joshua Duong
3eea62432d Merge "[adb] Disable _adb._tcp. service auto-connect by default." 2020-04-24 05:38:22 +00:00
Treehugger Robot
abc40c7c5d Merge "Using ABB for install-multi." 2020-04-24 01:15:49 +00:00
Joshua Duong
2eedc2303b [adb] Disable _adb._tcp. service auto-connect by default.
Added ADB_MDNS_AUTO_CONNECT envionment variable to control which
services to allow auto-connect. By default, only _adb-tls-connect
services can auto-connect, since these services only auto-connect once
paired. _adb services will try to auto-connect to every service found.

Bug: 152636135

Test: ADB_TRACE=1 adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=adb adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=adb,adb-tls-connect adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=adb-tls-connect adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=0 adb server nodaemon | grep whitelist
Test: ADB_TRACE=1 ADB_MDNS_AUTO_CONNECT=1 adb server nodaemon | grep whitelist

Change-Id: Ie562ea24fea3d6d96e67b376a0523b09e2778eb7
2020-04-23 16:55:52 -07:00
Alex Buynytskyy
a59e9b4e70 Using ABB for install-multi.
ABB uses single shared CMD for all operations which improves
reliability.

Bug: b/153486595
Test: atest adb_test adbd_test fastdeploy_test
Change-Id: I1e3da63882c980811ed2e9f5556732b24a041ce5
2020-04-23 16:30:49 -07:00
Josh Gao
0e778dc794 adb: allow filtering by file in coverage/show.sh.
Test: ./coverage.sh transport.cpp
Change-Id: I5fd3b25d9b3edd7a9131dae902e1868ced0384cc
2020-04-22 23:15:06 -07:00
Josh Gao
d5d5ba1644 adbd: don't use libc++_static.
We have dependencies that use libc++_shared, which results in ODR
violation manifesting as host adbd crashing on launch in libc++ locale
initialization.

Test: adbd on host
Change-Id: I6c039b325308fb8c36dfe5c1d090ff4ebe9e3433
2020-04-22 23:15:06 -07:00
Josh Gao
8a9277a243 adb: split transport_local.cpp into client/daemon.
Improve coverage some more.

Test: ./coverage/gen_coverage.sh && ./coverage/report.sh
Change-Id: I014d7ad25b2793d5d836ce5e526d657d46687ea4
2020-04-22 23:15:02 -07:00
Joshua Duong
13c639e0bb [adb client] Add "mdns services" command.
This command list all discovered mdns services, so we
can connect via service name later on.

Bug: 152521166

Test: 'adb mdns services'
Test: test_adb.py
Change-Id: I23d42a7933e67a65bd0c9924afd6abe5915c0a11
2020-04-22 08:43:15 -07:00
Joshua Duong
504d393176 [adb client] Add "adb mdns check" command.
This command will check if the mdns daemon is available on the host
machine.

Bug: 152510294

Test: pkill -9 mdnsd; adb mdns check; mdnsd; adb mdns check;
Test: test_adb.py
Change-Id: If644678a339763817a8a7adcbdc545626d161aba
2020-04-22 08:43:15 -07:00
Josh Gao
073c8d2394 adbd: improve coverage by compiling less code.
Test: ./coverage/gen_coverage.sh && ./coverage/report.sh
Change-Id: I26f823e2587435b7ec2c6ca05955adef5cfc23a0
2020-04-21 17:57:29 -07:00
Josh Gao
f099105f07 adb: refactor and relocate coverage script.
Test: ./coverage/gen_coverage.sh
Change-Id: Iaff2b1577e32ba4ec8647a418a2ff4a1e9a0835d
2020-04-21 17:57:19 -07:00
Josh Gao
79d4f148d6 adbd: test TCP in coverage.
Test: ./coverage.sh
Change-Id: I82a0d54fcc1e19585a27c2d049be40289bf15f60
2020-04-21 17:57:17 -07:00
Josh Gao
e3c62cc549 adb: allow wait-for-disconnect to match offline for TCP devices.
This fixes a bug in adb root/unroot where we always fail because we're
waiting for a TCP device to disappear.

Test: test_device.py over TCP
Change-Id: I7e4b6fdaa1070cee1f9b471de46ae00bf89b3089
2020-04-21 17:57:15 -07:00
Josh Gao
03bee48659 adbd: add unit tests to coverage report.
Test: ./coverage.sh
Change-Id: I268367b857efc2125c6714a1d0b0e874fa8d143d
2020-04-21 17:57:13 -07:00
Josh Gao
67095b28de Merge "adb: add helper binary to do a usb reset on a device." 2020-04-21 23:01:48 +00:00
Josh Gao
c0d8686053 adbd: add a script to generate coverage information.
Test: ./coverage.sh
Change-Id: I1a3608063e4c4e3af5ec01680f0255d8c69e7127
2020-04-20 17:37:50 -07:00
Josh Gao
98419f738b adbd: add a log message on start.
Make it easier to identify adbd's PIDs for coverage purposes by adding
an explicit log message to grep for.

Test: manual
Change-Id: I47e13417c0d9adb7d427414fd70c218f988909f5
2020-04-20 16:45:55 -07:00
Greg Kaiser
89fe376d13 [adb data server] Initialize variable
servingComplete_ was left uninitialized and only set to 'true'
in the code.  We initialize it to the 'false' state to avoid
uninitialized references in SkipToRequest().

Bug: 150865433
Test: TreeHugger
Change-Id: Ia8a4d7135c432eb657543c5498fc9dbe8f4718b6
Merged-In: Ia8a4d7135c432eb657543c5498fc9dbe8f4718b6
2020-04-20 11:06:13 -07:00
Josh Gao
ff08a51a72 Merge "adbconnection: silence logspam." 2020-04-18 02:47:11 +00:00
Treehugger Robot
22cc277bfe Merge "adb: change mdns tls service names (RFC 6763)." 2020-04-18 01:37:41 +00:00
Joshua Duong
81f2db4d6a adb: change mdns tls service names (RFC 6763).
Even though mdnsresponder seems to allow us to use _adb_secure_connect
and _adb_secure_pairing as service names, these names violate the syntax
outlined in RFC6763, and may not be compatible with other dns-sd
implementations.

Also address some comments from a previous CL.

Bug: 154268895

Test: atest adbd_test
Change-Id: Ia872e976fc4276587b500a827a41d46d9dc755dd
2020-04-17 16:38:34 -07:00
Josh Gao
d81a805a4c adbconnection: silence logspam.
Userdebug devices enable JDWP for every process, so if adbd is turned
off manually, we get an error message for every single process on the
system.

Bug: http://b/154319466
Test: manual
Change-Id: Ia702974d371e35497573c31e22cfb2b572334590
2020-04-17 16:35:01 -07:00
Josh Gao
4a1da79208 adbconnection: delete unnecessary darwin workaround.
This shouldn't be compiling for the mac.

Test: none
Change-Id: I9aea1861365c0da041c665e14e3e86cb802ad697
2020-04-17 14:46:41 -07:00
Josh Gao
fb4616b200 adb: fix feature sets on devices that don't have them.
Previously, we weren't distinguishing between nonexistent devices and
devices that don't support features, resulting in lots of stuff being
broken for pre-N devices.

Bug: http://b/154272158
Test: adb shell on a JB emulator
Change-Id: I0058b2a60678e1ad0503f5abac30157be976c9c4
2020-04-16 19:39:05 -07:00
Treehugger Robot
8fbb0d8de0 Merge "macOS build fix: no SOCK_CLOEXEC on darwin." 2020-04-15 23:38:53 +00:00
Treehugger Robot
63f2be8f56 Merge "macOS build fix: no off64_t on darwin." 2020-04-15 22:24:03 +00:00
Elliott Hughes
cbe30fb952 macOS build fix: no SOCK_CLOEXEC on darwin.
We can't use the sysdeps.h copy of this code, so for now add yet
another copy & paste. We should come up with something better in
libbase, but let's get the macOS build fixed first.

Test: builds on mac
Change-Id: Ifb059990d7091f3d91b54e684f4ee14afe69c28b
2020-04-15 21:28:01 +00:00
Joshua Duong
5e32d2f8de Remove host_supported from libadb_pairing_server.
To fix mac build error. Shouldn't be building this for the host.

Bug: N/A

Test: mma in system/core/adb on mac.
Change-Id: I8b86d265ef9b91eeaf7a4e5d6623a5399403ecaf
2020-04-15 06:53:38 +00:00
Elliott Hughes
729f58e0b7 macOS build fix: don't build libadbconnection.
Test: builds on mac
Change-Id: I91e3bf6b06f31edf542f8f8d6529787b0bf3a6ed
2020-04-14 16:33:16 -07:00
Elliott Hughes
7d9a7a3b6e macOS build fix: no off64_t on darwin.
Darwin has always had a 64-bit off_t, and never added an off64_t.

Test: builds on mac
Change-Id: I4b244dda94c67da76c9e0f47b333c2734f5a94af
2020-04-14 15:34:01 -07:00
Alex Buynytskyy
82c1c9711d [incfs] Stream the hash tree for incremental installation
Instead of sending the whole tree upfront use the same
streaming interface for it as for the data blocks

This improves installation speed by almost 200ms,
650-800ms -> 500-600ms

Bug: 153696423
Test: manual, adb install in various configurations

Change-Id: Ia83de2af54ca0b1969397514ea5d761719af9055
Merged-In: Ia83de2af54ca0b1969397514ea5d761719af9055
2020-04-13 13:00:01 -07:00
Yurii Zubrytskyi
6fc26dff7c [adb] Don't copy features set on each get()
The features are already cached in a static and don't change.
Let's return the cached set instead of copying it every time.

Bug: 150183149
Test: manual
Change-Id: Ifdca852cc3b32e09e50ea4771f7878987c46cce8
2020-04-09 22:26:48 -07:00
Jooyung Han
31242c07fa Add min_sdk_version:R to updatable apexes
APEXes introduced in R need to set min_sdk_version to ensure that they
are built against correct version of stubs (libc/liblog/...).

Bug: 152655956
Test: m
Merged-In: Id3f94a2ac09bd7bf7f9a4a0c2f62b624f29509d0
Change-Id: Id3f94a2ac09bd7bf7f9a4a0c2f62b624f29509d0
(cherry picked from commit ab9dfa4321)
2020-04-09 16:08:43 +09:00
Josh Gao
89cce05891 Merge changes from topic "adbd_lz4"
* changes:
  adb: add dry-run option to push/sync.
  adb: implement LZ4 compression.
  adb: fix use of wrong union variant.
  adb: fix front_size, front_data.
  adb: add interfaces for Encoder/Decoder.
2020-04-07 21:30:30 +00:00
Josh Gao
edd7771583 Merge "adb: add option to disable kill-server." 2020-04-07 20:36:47 +00:00
Elliott Hughes
a0c191867f Merge "Add missing static for macOS inline." 2020-04-07 19:43:29 +00:00
Josh Gao
20f079ec66 Merge "Revert "Reland "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor""" 2020-04-07 11:08:00 +00:00
Josh Gao
9026a44bb3 Revert "Reland "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor""
This reverts commit bfe3dac36d.

This seems to be correlated with an increase in the rate of devices
going offline. Revert it to see if failure rates improve.

Bug: http://b/150863651
Test: treehugger
Change-Id: Ia6163fd9e31d2bf812628e028249662594ac2024
2020-04-06 16:49:01 -07:00
Josh Gao
ba6d1da8ea adb: add option to disable kill-server.
In the post-apocalypse, it's increasingly common for people to use ssh
port forwarding to use an adb client with a remote adb server. This
results in `adb kill-server` being catastrophic, because the client has
no way of restarting the server on the other end. Android Studio in
particular has an unforunate habit of trying to manage adb's life cycle
such that starting or exiting Studio will result in a kill-server.

Add the ADB_REJECT_KILL_SERVER environment variable which ignores
kill-server, to make this scenario a bit better.

Bug: http://b/152251952
Test: ADB_REJECT_KILL_SERVER=1 adb start-server; adb kill-server
Change-Id: I5533a6dcbdb9220526a6fcf9ca31d9fcef1cec17
2020-04-06 14:33:14 -07:00
Elliott Hughes
681338dfb6 Add missing static for macOS inline.
Also switch to #pragma once and s/__inline__/inline/g for consistency.

There are a handful of inlines that are missing static, which seems like
a bug, but I've left those for now.

Bug: http://b/153328340
Test: treehugger
Change-Id: I2353215c0a8a6154ce8b39ecde022b282f5c0cb9
2020-04-06 09:17:08 -07:00
Josh Gao
0aafa0f714 adb: add implementation of mempcpy for deficient platforms.
Test: none
Change-Id: Ic2f4e1c85c9f02e804d849c6cb60b22e15e981d6
2020-04-03 10:13:53 -07:00
Josh Gao
5949fccc42 adb: add dry-run option to push/sync.
Make it easier to benchmark file sync performance by ignoring the file
system.

Bug: https://issuetracker.google.com/150827486
Test: test_device.py
Change-Id: Icfa4b28eb5206f1914c0c163833d070a3748c3ea
2020-04-02 17:11:08 -07:00