Commit graph

3398 commits

Author SHA1 Message Date
Joshua Duong
79a452a923 Properly remove adb DNS services.
Bug: b/150136878
Bug: b/111434128

Test: make
Change-Id: Ibfb92a7c197a25fd1913107d277fbc5f78108c05
2020-02-24 10:09:35 -08:00
Treehugger Robot
b9c95f8e6a Merge "Remove various bits of dead code and unused workarounds." 2020-02-23 04:16:25 +00:00
Elliott Hughes
f77f6f003c Remove various bits of dead code and unused workarounds.
Test: treehugger
Change-Id: I68fcd5da304d04ff4da3c3f3712fb79ce6b5791e
Merged-In: I68fcd5da304d04ff4da3c3f3712fb79ce6b5791e
2020-02-22 16:53:24 +00:00
Treehugger Robot
0ea130eab1 Merge "incremental_server: fix a use of uninitalized memory" 2020-02-22 09:18:55 +00:00
Josh Gao
6d949e89a4 adbd: fix build breakage.
This broke because two CLs touching the Android.bp file both
independently passed presubmit, but failed when combined.

Clean up a misindentation while we're at it.

Bug: http://b/150032367
Test: mma in system/core/adb
Change-Id: I091ef9dec806c767ffb21a5fd73b2bb37ab29ff9
2020-02-22 00:43:55 +00:00
Josh Gao
744ba42d2d Merge "adbd: remove static dependency on libcutils." 2020-02-22 00:03:21 +00:00
George Burgess IV
19b500bd50 incremental_server: fix a use of uninitalized memory
Without this, the caller is likely to assume that their buffer is
fully usable, which clang's analyzer doesn't believe is the case.

Another option is to set `*size` to nonzero.

Caught by the static analyzer:
system/core/adb/client/incremental_server.cpp:111:31: warning: 1st
function call argument is an uninitialized value
[clang-analyzer-core.CallAndMessage]

Bug: None
Test: TreeHugger
Change-Id: Ib844aa4ab3ebb297ca8f6f4289bbe3212275275b
2020-02-21 14:36:31 -08:00
Joshua Duong
5cf7868b7e [adbwifi] Add A_STLS command.
This command will be sent by adbd to notify the client that the
connection will be over TLS.

When client connects, it will send the CNXN packet, as usual. If the
server connection has TLS enabled, it will send the A_STLS packet
(regardless of whether auth is required). At this point, the client's
only valid response is to send a A_STLS packet. Once both sides have
exchanged the A_STLS packet, both will start the TLS handshake.

If auth is required, then the client will receive a CertificateRequest
with a list of known public keys (SHA256 hash) that it can use in its
certificate. Otherwise, the list will be empty and the client can assume
that either any key will work, or none will work.

If the handshake was successful, the server will send the CNXN packet
and the usual adb protocol is resumed over TLS. If the handshake failed,
both sides will disconnect, as there's no point to retry because the
server's known keys have already been communicated.

Bug: 111434128

Test: WIP; will add to adb_test.py/adb_device.py.

Enable wireless debugging in the Settings, then 'adb connect
<ip>:<port>'. Connection should succeed if key is in keystore. Used
wireshark to check for packet encryption.

Change-Id: I3d60647491c6c6b92297e4f628707a6457fa9420
2020-02-21 21:07:13 +00:00
Joshua Duong
d85f5c0130 [adbwifi] Add adbwifi_libs, TLS connection, and MDNS implementation.
Bug: 111434128, 119493510, 119494503

Test: Enable wireless debugging in Settings UI, click "pair with pairing code"
to generate pairing code.
On client, 'adb pair <ip_address>', enter pairing code at prompt and hit
enter. Pairing should complete.
'adb logcat'.
Change-Id: I86527bd3fc52e30a8e08ec5843dc3e100abf91fa
Exempt-From-Owner-Approval: approved already
2020-02-21 21:06:40 +00:00
Joshua Duong
16d5bc6ed5 [adbd-apex] Export adbd libraries used by system_server.
Bug: b/111434128
Bug: b/149181583

Test: cat proc/`pidof system_server`/maps | grep libadb
Test: cat proc/`pidof adbd`/maps | grep libadb
Change-Id: Idd36ca31cba7e4dc2d8836d229b23665e69b42fb
Exempt-From-Owner-Approval: approved already
2020-02-21 21:06:28 +00:00
Joshua Duong
c7a1fb8fd9 [adbwifi] Add pairing_connection library.
Bug: 111434128
Bug: 119494503

Test: atest adb_pairing_connection_test
Change-Id: I54d68c65067809832266d6c3043b63222c98a9cd
Exempt-From-Owner-Approval: approved already
2020-02-21 21:06:12 +00:00
Joshua Duong
340a5e86d2 [adbwifi] Add pairing_auth library.
Bug: 111434128
Bug: 119494503

Test: atest adb_pairing_auth_test
Change-Id: Ieada7b8d9d8817292175623af55eac235b938c65
Exempt-From-Owner-Approval: approved already
2020-02-21 21:04:39 +00:00
Joshua Duong
51378f41a1 adbd_auth function signature changes.
Bug: 111434128

Test: make
Change-Id: If801346e436dc7d7a7dfbbc296f7b2393d1e91af
Exempt-From-Owner-Approval: approved already
2020-02-21 20:12:23 +00:00
Yurii Zubrytskyi
b182a3582c Merge "Initialize |sentBlocksCount|" 2020-02-21 05:29:45 +00:00
Kiyoung Kim
5694a9559b Merge "Remove ld.config.txt from adbd APEX" 2020-02-21 04:10:13 +00:00
Yurii Zubrytskyi
12051a0937 Initialize |sentBlocksCount|
It happened to always be 0 during all tests.

Test: manual
Change-Id: I2f5089096a8ecda2ec52756199412c7d43f6903c
2020-02-20 16:03:10 -08:00
Yurii Zubrytskyi
b65950642d Fix the MacOS build of incremental*
Test: local build, no feature code changes

Change-Id: Ic0072b06f6bfd6b12f26c4056bd3192cd3fdd778
2020-02-20 15:39:36 -08:00
Kiyoung Kim
f611e41e14 Remove ld.config.txt from adbd APEX
Dynamic linker will use generated linker configuration in general. As
ld.config.txt file in the APEX module will not be used, we can remove
this to avoid confusion.

Bug: 149887007
Test: m -j passed
Test: Boot succeeded from cuttlefish and walleye
Change-Id: Ic98aca819b5a4d0e0af4fe0ea25145a483aa7d53
2020-02-20 16:06:53 +09:00
Josh Gao
a9b62d5452 adbd: remove static dependency on libcutils.
We were previously statically linking libcutils into adbd for several
different reasons, which were addressed as follows:

  socket functions: extracted to a statically linked libcutils_network
  fs_config: wrapped with a shared library on /system
  ATRACE: deleted the single use in adbd

Test: treehugger
Change-Id: I821fa174cfcbfa8e29a4be10de4016b817adbaf8
2020-02-19 17:44:38 -08:00
Yurii Zubrytskyi
516c441fd8 [adb] Add a version field to v4 signature format
Test: manual
Change-Id: I8a1034d7131905463749d5b131dd9a3c8703fe96
2020-02-19 14:46:16 -08:00
Alex Buynytskyy
96ff54bf34 Incremental installations in adb, client/host side.
Test: adb install --incremental <apk>

Change-Id: I74e3eaf9718a16272bc533bc8298dfcf81120caa
2020-02-19 08:01:06 -08:00
Joshua Duong
663b3c9d88 Some minor fixes to libadb_tls_connection.
Bug: 111434128

Test: atest adb_tls_connection_test
Exempt-From-Owner-Approval: approved
Change-Id: I4c23cc6ba5b14b65122e61297554dedabf43d0b4
2020-02-18 22:14:48 +00:00
Lingfeng Yang
39e54b8c5b add a version TXT record to adb secure mdns services
In the context of secure connect, allows adbd and host adb to reject
each other based on incompatible versions without even having to
actually connect (since it is a DNS TXT).

Bug: 111434128, 119490749

Test: N/A
Exempt-From-Owner-Approval: already approved
Change-Id: I54312d8b67370c397ba81ecdbca1b27e3ee58572
2020-02-18 05:13:06 +00:00
Lingfeng Yang
615036f494 adbd: only register dnsservices via explicit API
For privacy/security reasons, let's not broadcast the adb secure
services on startup automatically, and instead leave that up to
the rest of the adbd code somehow.

Instead, this CL adds an API in daemon/mdns.h that lets the user
control when registration happens, potentially only doing so if
the developer option is enabled or something.

Bug: 111434128, 119490749

Test: N/A
Exempt-From-Owner-Approval: already approved
Change-Id: Idc994a59ef9e5d48f08796c21989883497e19ef8
2020-02-18 05:12:52 +00:00
Lingfeng Yang
cef4ade8e1 adb client interface for secure services
This CL exposes a callback-based interface to perform some action for
each resolved pairing/connect service as a function of their hostname,
ip address, and port.

The ADB client can then use this information to either set up secure
connections directly, or to tell the adb host server to do so, or
something.

Bug: 111434128, 119490749

Test: N/A
Exempt-From-Owner-Approval: already approved
Change-Id: I2dd04c322df5b0597859f44703cfd2f3f29fd737
2020-02-18 05:12:36 +00:00
Lingfeng Yang
4b62bcde04 get the ip address info for all DNS services
This CL adds functionality to the class ResolvedService where the ip
address associated with a resolved DNS service is recorded.

It also avoids connecting to the device unless it is the Things-related
DNS service.

Next step is to add some kind of interface in other parts of adb code
to retrieve these IP addresses.

Bug: 111434128, 119490749

Test: N/A
Exempt-From-Owner-Approval: already approved
Change-Id: I46895a7a5bf5660f524c7323a9454f1e2c7d385c
2020-02-18 05:12:25 +00:00
Lingfeng Yang
c712f2db76 make the client browse for appropriate mdns services
This CL makes it so the client looks for the adb secure pairing
and adb secure connect services. Nothing else should happen,
but this should be useful to see if the right packet traffic for
discoverability is happening.

Bug: 111434128, 119490749

Test: N/A
Exempt-From-Owner-Approval: already approved
Change-Id: I266bdb8526cf39bbfa131344dca2b1bb14c14a7b
2020-02-18 05:10:52 +00:00
Lingfeng Yang
be49d8a2a9 Add mDNS services for pairing and connect
- ADB Secure Pairing
- ADB Secure Connect

Nothing else is implemented.

Bug: 111434128, 119490749

Test: N/A
Exempt-From-Owner-Approval: already approved
Change-Id: I2e7873b62a3c7631451e47f6a301f8c4a5ffa2e2
2020-02-18 05:07:32 +00:00
Joshua Duong
4293e322f2 [adbwifi] Add tls_connection library.
Bug: 111434128, 119494503, 119493510

Test: atest adb_tls_connection_test
Exempt-From-Owner-Approval: yolo?
Change-Id: Ie9b629e4cb955702cec890bbb89a6a762e4b71b3
2020-02-14 17:41:36 +00:00
Joshua Duong
ef28ca4cdc Move adb RSA utilities into its own library.
Since both the client and daemon will now be generating keys.

BUG: b/111434128

Test: atest adb_crypto_test
Change-Id: I6fac562ae5629ab30b6639fbd88d822dae6e96bd
2020-02-11 20:49:20 -08:00
Joshua Duong
9e96e71067 [adbwifi] Add adb protos.
BUG: b/111434128

Test: make
Change-Id: I7eef85c773e219e1873c9fbc30d14c17c110c3bf
2020-02-11 20:49:15 -08:00
Josh Gao
68f2e9cf1b Merge changes Ia8f83a53,Ia1f6a659
* changes:
  adbd: add a perfunctory abb test.
  adb: switch tests to python3.
2020-02-10 19:11:26 +00:00
Josh Gao
e4d66fc678 adbd: add a perfunctory abb test.
Bug: http://b/148838069
Test: python3 -m unittest test_device.AbbTest
Change-Id: Ia8f83a535d4a513f4bdce5cfa4bfe69cd2dbb634
2020-02-07 15:59:49 -08:00
Josh Gao
93dee964d4 adb: switch tests to python3.
Test: treehugger
Change-Id: Ia1f6a659e23f5d9e63c9b106c60d56b5b954b19c
2020-02-07 15:59:49 -08:00
Jiyong Park
17730e7cf6 use apex_test for test apexes
... so that the build system can distinguish testing APEXes and installable APEXes, and apply
different rules to them.

Bug: 146308764
Test: m
Change-Id: I5fdab94da352e8014225b2454aacc2a5b5fc6a52
2020-02-05 18:44:10 +09:00
Josh Gao
c71a1e7ab0 Merge "adb: report error in copy_to_file." 2020-02-04 23:49:37 +00:00
Josh Gao
3828ebcdd8 adb: report error in copy_to_file.
Previously, if we failed to read a file after successfully opening it,
(e.g. because it's a directory), we would return prematurely without
notifying our caller, which would then wait forever for a response that
isn't coming.

Switch all of the adb install callsites over to checking the result,
but leave the other callsites ignoring the result, because they're
either deprecated, or don't care.

Bug: http://b/145621968
Test: mkdir foo.apk; adb install foo.apk
Change-Id: Ia82f8280b144f7881e067a10cd17f9a89019cf3f
2020-02-04 13:47:57 -08:00
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
Elliott Hughes
b2066fda6d Merge "adb: make the push summary fit in 80 columns." 2020-01-30 16:01:01 +00:00
Elliott Hughes
00ff8d7021 adb: make the push summary fit in 80 columns.
Elide $ANDROID_PRODUCT_OUT for a large saving:

  /data/: 2 files pushed. 734 files skipped. 6.5 MB/s (830776 bytes in 0.122s)
  /product/: 0 files pushed. 357 files skipped.
  /system/: 7 files pushed. 2638 files s...d. 16.3 MB/s (3785511 bytes in 0.221s)
  /system_ext/: 1 file pushed. 90 files ...d. 13.2 MB/s (1152016 bytes in 0.084s)
  /vendor/: 0 files pushed. 200 files skipped.

And drop the repeated "files" when talking about how many were skipped
for a small saving:

  /data/: 2 files pushed, 734 skipped. 6.4 MB/s (830776 bytes in 0.124s)
  /product/: 0 files pushed, 357 skipped.
  /system/: 7 files pushed, 2638 skipped. 13.8 MB/s (3785511 bytes in 0.262s)
  /system_ext/: 1 file pushed, 90 skipped. 12.2 MB/s (1152016 bytes in 0.090s)
  /vendor/: 0 files pushed, 200 skipped.

Bug: http://b/131717844
Test: adb sync
Change-Id: I9d24df49498211bc2b8dcebcc6d8bd557da214c1
2020-01-27 10:05:36 -08: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
427006042c Merge "Build test_com.android.adbd.apex." 2020-01-23 23:58:43 +00: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