Commit graph

3523 commits

Author SHA1 Message Date
Greg Kaiser
edfec96679 adb: Avoid a couple std::string constructions
With some internal API changing from "const char*" to
"const std::string&", we can change a couple calling sites to
directly pass a std::string reference, instead of getting the
c_str() version of the string.  This avoids us creating a
temporary std::string for the call.

Test: TreeHugger
Change-Id: I2fe0760ce8bf7d352010a341005356c0a801d351
2020-03-11 07:07:55 -07:00
Jiyong Park
95b6f45b0e don't include liblog to APEXes
liblog is a platform library that provides stable C API. There is no
need to include the library, especialy by statically linking to it, in
any APEX. It not only wastes the storage/ram, but also is incorrect
because the socket interface to logd which is implemented in liblog is
not guaranteed to be stable.

Fixing this issue by converting static_libs: ["liblog"] into
shared_libs: ["liblog"], in which case the dependency to the library
is satisfied via the stub variant of the library.

As a result, we could restrict the availablity of the library to
the platform and the runtime APEX.

Exempt-From-Owner-Approval: already approved when this was in internal
master (ag/10572699)

Bug: http://b/151051671
Bug: http://b/150827719
Test: m
Change-Id: I5aab863cb12b8767b6979255c247000a59355b0e
2020-03-11 09:20:08 +00:00
Elliott Hughes
a52b458dd4 adb: support wait-for- with multiple states.
Test: manual, adb wait-for-device-recovery
Change-Id: I92034c477d28f847e24ec72bbb87b252fba875e1
2020-03-10 17:01:34 -07:00
Tianjie Xu
0ac447ab95 Merge "adbd: make libadbd_services cc_library again." 2020-03-10 18:43:30 +00:00
Josh Gao
2263bcb4d0 Merge "adb: defer acknowledgement of pushed files until the end." 2020-03-10 01:55:51 +00:00
Chih-hung Hsieh
262b58cd07 Merge "Fix bugprone-string-integer-assignment warnings" 2020-03-10 00:07:58 +00:00
Josh Gao
7f8a37c8c7 adbd: make libadbd_services cc_library again.
For currently unknown reasons, sideloading is broken with
libadbd_services as a cc_library_static.

Partial revert of commit a9b62d5452.

Bug: http://b/151056300
Test: xunchang@ tested manually
Change-Id: Iaffad9c476ba0adcffc5db512ba4a7ee0fb5cb22
2020-03-09 15:20:55 -07:00
Chih-Hung Hsieh
5d13645bfe Fix bugprone-string-integer-assignment warnings
* mdns.cpp:153:20: warning: an integer is interpreted as a character code
  when assigning it to a string; if this is intended, cast the integer to
  the appropriate character type; if you want a string representation, use
  the appropriate conversion facility [bugprone-string-integer-assignment]

Test: WITH_TIDY=1 make
Change-Id: Id9a790ac31722c6ee8886703939977b913ce95fe
2020-03-09 15:05:54 -07:00
Treehugger Robot
c6e64b3e1d Merge ""track-app" service showing debuggable/profileable apps" 2020-03-09 21:21:38 +00:00
Elliott Hughes
401c78780f adb: improve logging of key loading slightly.
In particular, always include the file name in the log.

Bug: http://b/144462309
Test: adb kill-server && adb devices -l && cat /tmp/adb.*.log
Change-Id: I66b5e063b00381f9dfa9ace222cad3e415e4f43b
2020-03-07 12:52:36 -08:00
Shukang Zhou
f4ffae1055 "track-app" service showing debuggable/profileable apps
Add a "track-app" service in adbd. For every debuggable or
profileable-from-shell process, ART sends related info to
adbd and adbd surfaces the info through the "track-app"
service.

The output format of "track-app" is a line summarizing
the number of reported processes, followed by a protobuf
message in human readable form. For example,

Process count: 2
process {
  pid: 3307
  profileable: true
  architecture: "arm64"
}
process {
  pid: 3341
  debuggable: true
  profileable: true
  architecture: "arm64"
}

Bug: 149050485
Test: manually unplugged/replugged, "adb track-app",
      "adb track-jdwp"
Change-Id: Id1f1a920e1afc148c7e4d2add790baab796178e1
2020-03-06 13:56:27 -08:00
Josh Gao
64ff82ba68 adb: defer acknowledgement of pushed files until the end.
Previously, we were waiting for the other end to respond after every
file sent, which results in massive slowdown when there's any amount of
latency on the transport.

This improves performance on a cuttlefish instance with ~7ms RTT from:

    system/: 2037 files pushed, 0 skipped. 2.8 MB/s (762803979 bytes in 262.964s)

to:

    system/: 2037 files pushed, 0 skipped. 11.9 MB/s (762803979 bytes in 61.278s)

Bug: https://issuetracker.google.com/150827486
Test: ./test_device.py
Change-Id: I3a0c893faa5d455cc6ccbc86915a17e1b5abbfbe
2020-03-05 19:48:11 -08:00
Treehugger Robot
824f0095b0 Merge changes Ic2af40b8,I9c8cfebe
* changes:
  Reland "adb: turn CHECKs into an error + transport restart."
  Reland "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor"
2020-03-03 06:29:55 +00:00
Joshua Duong
49d4dd23ca Merge "Disable AdbPairingConnectionTest#MultipleClientsOnePass." 2020-03-03 00:36:22 +00:00
Josh Gao
7b3048446d Reland "adb: turn CHECKs into an error + transport restart."
This reverts commit 2547f740ea.

Bug: http://b/134695864
Bug: http://b/133872605
Test: manually unplugged/replugged
Change-Id: Ic2af40b81354138a7842eb93aacc303885ac952e
2020-03-02 13:55:04 -08:00
Josh Gao
bfe3dac36d Reland "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor"
This reverts commit ba4684c2b2.

Bug: http://b/129283234
Test: manually unplugged/replugged
Change-Id: I9c8cfebe09b2855cab986068273a835a13247b77
2020-03-02 13:45:52 -08:00
Joshua Duong
2e1ee8ee51 Disable AdbPairingConnectionTest#MultipleClientsOnePass.
Will re-enable once flaky failure is fixed.

Bug: 150529485
Bug: 150388912

Test: atest adb_pairing_connection_test doesn't run above test.
Change-Id: I63ac3fc2fd2d289b977dd3b9f6eccfb65866769c
2020-03-02 12:56:59 -08:00
Jiyong Park
ab8a7e35ec Merge "Mark updatable APEXes" 2020-03-01 00:39:18 +00:00
Joshua Duong
ad9d034e7d Merge "Remove pairing_auth, pairing_connection from recovery." 2020-02-29 00:47:44 +00:00
Josh Gao
14c65f6fb6 Merge changes Ib97acc6d,Id5bbfd6d,I4dfc3f52
* changes:
  adbd: add runtime-configurable logging.
  adbd: add usb thread spawn logging.
  base: add CachedProperty.
2020-02-28 23:17:49 +00:00
Josh Gao
52d0b67f19 adbd: add runtime-configurable logging.
Add some requested logging options that can be turned on at runtime
without having to restart adbd.

Bug: http://b/141959374
Test: manual
Change-Id: Ib97acc6d199e0b91238a6758e18b7cb75f8688d9
2020-02-28 12:58:42 -08:00
Joshua Duong
0f53d1794a Remove pairing_auth, pairing_connection from recovery.
Also remove statically linking libc++, because these libraries are not
exported native shared libraries.

We are slightly over the 12MB limit for ramdisk recovery size, so let's
remove the adb pairing libraries, since they won't be used in recovery
mode.

These are only used in normal boot mode, and currently, only by adb
client. The pairing server is used by system server.

Bug: 150317254

Test: Check size of ramdisk-recovery.img in walleye, walleye-hwasam
build to be under 12MB. Also verify installed-files-recovery.txt no
longer contains libadb_pairing*.
Also put phone into recovery mode, check system/lib64 for no
libadb_pairing*.

Change-Id: Ida7c4fdc9dda2b09091b853feac8df8f125e4274
Merged-In: Ida7c4fdc9dda2b09091b853feac8df8f125e4274
(cherry picked from commit afc2cf0dec)
Exempt-From-Owner-Approval: cherry-pick
2020-02-28 20:45:43 +00:00
Josh Gao
e8829c6bfc adb: don't hardcode ports in test_adb.
If we get unlucky and something else (or ourselves, in another thread)
beats us to listening on our hardcoded ports, we can deadlock.

Bug: http://b//149829737
Test: ./test_adb.py
Change-Id: I8f14004a6b2e77366abad6e88786ea8941629020
2020-02-27 14:30:35 -08:00
Josh Gao
e3d34e1f8b adbd: add usb thread spawn logging.
Bug: http://b/141959374
Test: adbd shell killall adbd; adb wait-for-device logcat | grep UsbFfs
Change-Id: Id5bbfd6d2198005bf10b94c691499059e130afe7
2020-02-27 13:56:48 -08:00
Jiyong Park
49c3dc51c7 Mark updatable APEXes
Mark updatable APEXes as updatable: true so that they are opted-out from
optimizations that make sense only for non-updatable modules; such as
symlinking to the libs in the system partition.

Bug: 149805758
Test: m and check that there is no symlink from the APEX to the system
partition.

Exempt-From-Owner-Approval: cherry-pick from internal

Merged-In: Ic3edc7e285e9eafbdaa20b18ccbc0b2231370779
(cherry picked from commit 7c2ae1f02c)
Change-Id: Ic3edc7e285e9eafbdaa20b18ccbc0b2231370779
2020-02-27 10:52:47 +09:00
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
Junyong Sun
1ffccf5c8b adb: windows: fix adb execute root cmd with no tips
fwrite can cross windows platform to show log on terminal,
so we use it instead of WriteFdExactly.

Change-Id: I252c15a0bc72e1dbd98b7b5ec8000ecdcde16416
Signed-off-by: Junyong Sun <sunjy516@gmail.com>
2020-01-17 09:39:21 +08:00
Tom Cherry
f633b62b63 Merge "Require liblog for libbase in all configurations" 2020-01-15 23:20:07 +00:00
Kevin Brodsky
0b633d8800 Remove leftover support for target-as-host
Support for target-as-host was removed by 4626b71057 ("Fix win_sdk
build."), so ADB_HOST_ON_TARGET is never defined.

Test: build
Change-Id: I5ab27e68208677266e2e4272bc2bae7d6a097c5d
2020-01-13 14:48:49 +00:00
Treehugger Robot
a6379cd2df Merge "Add /system/lib to the permitted paths for ns of APEXes" 2020-01-13 08:19:23 +00: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
Treehugger Robot
f5a329f1a4 Merge "adb: fix adb connect help typo." 2020-01-09 04:34:27 +00:00
Treehugger Robot
97186600b5 Merge "adb: avoid consuming input in adb remount." 2020-01-08 23:52:40 +00:00
Josh Gao
9e75634082 adb: avoid consuming input in adb remount.
Bug: https://issuetracker.google.com/146163747
Test: dd if=/dev/zero bs=1024 count=1 | (adb remount; wc)
Change-Id: I700090cd0bbae2d76569008f3c1a116336951c0a
2020-01-08 12:43:34 -08:00
Elliott Hughes
65474fd78c adb: fix adb connect help typo.
Bug: http://b/130380645
Test: adb connect
Change-Id: I04205ff0120bcfd865dc5fa95846694d0ff6de80
2020-01-08 10:02:43 -08:00
Jiyong Park
016059dd46 Add /system/lib to the permitted paths for ns of APEXes
With b/144533348, there will be symlinks from libs in APEXes to the libs
in the system partition. This is to reduce the size of APEXes when the
APEX is bundled with the platform.

Adding the /system/lib to the permitted paths so that the realpaths of
the symlinks are allowed for the namespaces.

Note that this however does not open all libs in the system partition to
the APEX namespaces, because searching of the libs are NOT done in
/system/lib, but in /apex/<module>/lib directory.

Bug: 144533348
Test: m
Change-Id: I4bb1d6cb5dbf647ae669f49aa5ccb178f5488b5e
2020-01-07 19:53:38 +09:00
Kiyoung Kim
0513f0e266 Update ld.config.txt for adbd apex
ld.config.txt for ADBD APEX works properly, but it can be reduced into
simpler way. This change updates ADBD APEX linker configuration which
reduces complexity and limit library usage from system partition.

Test: m -j && confirmed adbd works from cuttlefish
Change-Id: Ifcf1323082148aec4b6417c0ba7df0d9fe8ffeb0
2020-01-03 13:37:29 +09:00
Josh Gao
27fa358d41 Merge "adb: use poll instead of select in shell_service." 2019-12-19 20:22:13 +00:00
Treehugger Robot
1cdcc5f7e8 Merge "adb: fix use after free of atransport." 2019-12-18 22:39:48 +00:00
Josh Gao
63da8e6272 adb: use poll instead of select in shell_service.
Bug: http://b/141955761
Test: test_device.py
Test: adbd_test
Change-Id: I8976304a1011e81e85f8d90d95d36ecd82834f5f
2019-12-18 14:02:57 -08:00
Elliott Hughes
264a37d12f Merge "Fix SEGV in libziparchive with malformed zip file." 2019-12-18 16:14:54 +00:00
Treehugger Robot
90e9217aca Merge "Enable "localfilesystem" UNIX domain socket for ADB." 2019-12-18 05:34:30 +00:00
Elliott Hughes
fba2a1a1ec Fix SEGV in libziparchive with malformed zip file.
d77c99ebc3 changed MappedFile to return a
bogus zero-length mapping on failure rather than nullptr. None of the
calling code was changed, though, and it seems like doing so would be a
bad idea. Revert that part of the change.

Add missing tests, and tidy up some of the logging. Also remove
single-use or obfuscatory constants from the tests.

The new "empty.zip" was created by using zip(1) to create a zip file
with one entry, then using `zip -d` to remove it.

The new "zero-size-cd.zip" was created by using zip(1) to create a zip
file containing a single empty file, and then hex editing the two byte
"size of the central directory" field in the "end of central directory
record" structure at the end of the file. (This is equivalent to, but
much smaller than, the example zip file provided by the bug reporter.)

Bug: http://b/145925341
Test: treehugger
Change-Id: Iff64673bce7dae886ccbc9dd6c2bbe18de19f9d2
2019-12-17 08:39:09 -08:00
Elliott Hughes
dfe6c84709 adb: improve help for -t/-tt.
Test: adb help
Change-Id: Ic75bf184dfc51e57b422666d85e3b7a5139b3853
2019-12-13 16:43:10 -08:00
Josh Gao
607fd5424a adb: fix use after free of atransport.
libadbd_auth might report authentication success for a transport that's
already been destroyed. Fix this by storing a weak pointer to the
atransport that gets cleared upon destruction instead of a raw pointer.

Bug: http://b/144704376
Test: ./test_adb.py
Test: ./test_device.py
Change-Id: Idffe027381e6b2e37f06aa0166e97cafc98eaf3b
2019-12-13 13:28:21 -08:00
Jack Pham
b310da608b adbd: Update DeviceInterfaceGUID for WinUSB
The MS OS extended property descriptor is used to convey additional
information to Windows hosts, in this case the DeviceInterfaceGUID
which allows the inbox WinUSB driver to get automatically installed.

However, the ADB windows client looks for USB devices by enumerating
devices with a specific GUID {F72FE0D4-CBCB-407D-8814-9ED673D0DD6B},
and as a result fails to find the device since it was installed with
a different DeviceInterfaceGUID. Update the OS descriptor to pass
back the same GUID the client already uses.

Change-Id: If664cdd9be821c502e8c2048ff79e79e311936f5
2019-12-12 00:13:56 -08:00
Josh Gao
f4ddee0f32 Merge changes I6ff85723,Ia7d743d5
* changes:
  adb: add ls_v2.
  adb: rename syncmsg::*::time to mtime.
2019-12-12 01:39:20 +00:00
Treehugger Robot
d692530a71 Merge "adb: remove atransport ref counting." 2019-12-12 00:47:28 +00:00
Josh Gao
9a8366b3d9 adb: remove atransport ref counting.
The reference count is always 0 or 1.

Test: ./test_adb.py
Change-Id: I669f98f4996f4e41ac037f1add9c47819d4003d4
2019-12-11 13:40:41 -08:00
Daniel Colascione
3ec7be7a84 Revert "Revert "Support socket activation of adb server""
Test: actually build both device and client adb this time

This reverts commit c77904e3c5.

Change-Id: I8c2b8f24884ff36ff2460dab2500bad777100dfd
2019-12-11 08:20:20 +00:00
Jason Jeremy Iman
8bde191202 Enable "localfilesystem" UNIX domain socket for ADB.
This patch introduce "service.adb.listen_addrs", a new
string type property, while keeping the old properties.
The new property added in this patch is used to listen
on UNIX domain socket "localfilesystem".

"service.adb.listen_addrs" can be used to listen on
multiple addresses, such as tcp:5555 and tcp:5556.
It is separated by ',' (comma) character.

In the process of introducing the new socket type, the
method tcp_connect is removed and combined into
socket_spec_connect.

Without specifying using the new property, adb will
try to listen on both tcp and vsock (following the
previous implementation).

Some examples of the new property value are:
  - "tcp:5555"
  - "vsock:5555"
  - "localfilesystem:/tmp/test"
  - "tcp:5555,vsock:5555"

Bug: 133378083
Test: On master-arc-dev:
        adb root;
        setprop service.adb.listen_addrs localfilesystem:
	    <path_to_socket>;
        adb connect localfilesystem:<path_to_socket>;
        adb -s localfilesystem:<path_to_socket> shell;
	    inside Chrome OS.
Test: On aosp_bluefin:
        setprop service.adb.listen_addr tcp:5555;
        adb connect <IP>:5555; adb shell;
Test: On aosp_bluefin:
        setprop service.adb.tcp.port 5555;
        adb connect <IP>:5555; adb shell;
Test: On aosp_bluefin:
        setprop service.adb.listen_addrs tcp:5555,tcp:6666;
        adb connect <IP>:5555; adb shell;
        adb connect <IP>:6666; adb shell;
Test: On aosp_bluefin:
        ./adb_test;
Test: On cuttlefish:
        launch_cvd;
        adb -s 127.0.0.1:6520 shell;
Test: Ran host tests:
        ./adb_test;
        ./adb_integration_test_adb;
        ./adb_integration_test_device;

Change-Id: I8289bf0ab3305cf23ce5695ffba46845d58ef6bb
2019-12-04 10:05:05 +09: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
80a734f146 Merge "Allow the adb server to bind on ::1" 2019-11-21 21:51:07 +00:00
Tianjie Xu
b6d7ea15b7 Handle the reboot in the recovery user mode
We have switched to "/system/bin/reboot" to perform the reboot. But
accessing the shell for user build under recovery is not allowed by
sepolicy. So adding a special routine to handle this reboot case.

Bug: 141247819
Test: run `adb reboot` in user mode recovery
Change-Id: Ia37438e52c67fd2bd54e923a0fea5817a1455a08
2019-11-13 14:23:09 -08:00
Elliott Hughes
ef6d913027 Merge "fastdeploy: fix tests." 2019-11-08 21:11:45 +00:00
Elliott Hughes
74f0fc6b18 fastdeploy: fix tests.
Actually log results of adb commands, so we can see why this fails.

Fix the asan-detected use of a value from a reused part of the stack.

Test: atest FastDeployTest on Linux (with an asan adb)
Change-Id: I4d2bbae62a301e16065d604a2c9918077489cafb
2019-11-08 15:39:50 +00:00
Callum Ryan
8539cb3f75 Allow the adb server to bind on ::1
Currently the adb server can only bind on 127.0.0.1 or * if -a is
provided. This diff adds the ability for adb to bind on ::1 as
well for use cases where you might want to force adb to be IPv6
only.

To bind the adb server on ::1
```
$ ./adb -L tcp:[::1]:1234 server
$ lsof -nPi :1234
COMMAND ... NODE NAME
adb     ...  TCP [::1]:1234 (LISTEN)
```
The original behaviour is also retained, so this would only affect
users explicitly specifying ::1 in the socket spec
```
$ export ANDROID_ADB_SERVER_PORT=1234
$ ./adb server
$ lsof -nPi :1234
COMMAND ... NODE NAME
adb     ...  TCP 127.0.0.1:1234 (LISTEN)
```

Note: I've only implemented this behaviour for posix base systems,
due to my limited understanding of networking on windows. If
needed I can do some research to implement it there as well, but
there is currently no IPv6 support at all on the windows side.

Test: New unit test and the commands in the summary

Change-Id: I23e4531e8dfda4de9348124ad7491d728aecdbf7
2019-11-07 08:32:01 -08:00
Daniel Colascione
2aabeed1fd Merge "Properly finish daemon init when initial USB scan complete" 2019-11-05 23:44:25 +00:00
Josh Gao
e24a4b37b4 Merge changes from topic "adbd_apex"
* changes:
  Move adbd to an apex.
  adbd: use libadbd_auth for authentication.
2019-11-05 23:36:39 +00:00
Tianjie Xu
a933b43c02 Grant adb auth under recovery for unlocked & userdebug devices
During automatic tests, we sometimes want to reboot the device out of
the rescue party remotely. And per http://go/recovery-adb-access, we
need to grant the adb authorization to enable the adb access. The auth
are only granted for userdebug devices and those with an unlocked
bootloader. Since the user can always flash a custom recovery image if
the bootloader is unlocked.

This cl ignores the ro.adb.secure property under recovery. The other
option is to default this property to 0 when building the boot/recovery
image.

Bug: 141247819
Test: unlock bootloader, run adb under recovery in user build
Change-Id: I424cfed5bf51a1e31d8687256ae4c6eaaa5e6249
2019-11-04 16:12:00 -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
Daniel Colascione
3aef5c82f7 Properly finish daemon init when initial USB scan complete
Call adb_notify_device_scan_complete when we finish enumerating USB
devices. The original intent of the code appears to have been to have
adb_wait_for_device_initialization return as soon as we've finished
looking around at the system USB environment on daemon startup, but at
some point, we forgot to actually notify the init thread that we
finished scanning all the USB devices, forcing the wait on init_cv to
time out after three seconds on every daemon initialization.

After this change, the daemon starts in a few milliseconds on my Linux
machine

Test: killall adb && sleep 1 && time adb server && adb shell ls
Change-Id: I0bc1da7a597d2077dd2b591560d03798b05905b7
2019-11-04 11:43:20 -08:00
Josh Gao
18bbb2d821 Merge changes from topics "adbd_reboot", "adbd_verity"
* changes:
  adb: replace reboot service with exec of /system/bin/reboot.
  Move enable-verity/disable-verity out of adb to a helper binary.
  Use adbd_system_binaries to track adbd's dependencies.
2019-10-24 20:29:25 +00: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
c9e09e69b9 deployagent: set sdk version.
Not specifying a platform version in a java binary will result in code
generation tools being built to create framework.jar, which currently
fails when building with BUILD_HOST_static=1.

Specify an SDK version to avoid this.

Bug: http://b/142536936
Test: m -j adb BUILD_HOST_static=1
Change-Id: Ifb9556c7c6cc43417c3f56137edee21f145f8b17
2019-10-17 16:20:26 -07:00
Josh Gao
baea773324 Merge changes from topic "apex_remount"
* changes:
  adbd: replace remount_service with an exec of /system/bin/remount.
  Move remount to PRODUCT_PACKAGES_DEBUG.
2019-10-17 19:14:26 +00: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
Treehugger Robot
2fd9d735ea Merge "adbd: allow port configuration on host." 2019-10-16 23:22:44 +00: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
Elliott Hughes
7fb1407125 adb: log more detail on failure to read keys.
Before we just got "Failed to read key". After:

  adb E 10-07 08:20:14 258249 258249 auth.cpp:176] Failed to read key \
    from '/usr/local/google/home/enh/.android/adbkey'
  94390117965240:error:0900006e:PEM routines:OPENSSL_internal:NO_START_LINE:\
    external/boringssl/src/crypto/pem/pem_lib.c:622:Expecting: ANY PRIVATE KEY

Also fix the misleading "Failed to generate" message from adb_auth_init.

Bug: http://b/141715453
Test: manually corrupted key; see above
Change-Id: I6732ee6b683c8548d596d7c22eeddab8ce9a3cea
2019-10-07 08:25:42 -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
Josh Gao
ea3f43ccf2 adb: disable failing test.
Bug: http://b/141943968
Bug: http://b/141923622
Test: python -m unittest test_device.FileOperationsTest
Change-Id: Ie384c71c3d6875db74982a398fb66f035ce9f408
2019-10-01 14:15:31 -07:00
Colin Cross
2a62d42704 Merge "Use libcrypto_static instead of libcrypto" 2019-09-26 14:32:33 +00:00
Josh Gao
3a22e8cf73 Merge "adb: fragment host linux USB writes when needed." 2019-09-25 21:20:54 +00:00
Treehugger Robot
070c030289 Merge "adb: fix infinite loop when attempting to push to //foo." 2019-09-25 19:59:51 +00:00
Josh Gao
06e7cb5af0 adbd: allow port configuration on host.
Test: manual
Change-Id: I68cbd9bdb253a68463cc65e63a764ad4fa410c1c
2019-09-26 03:23:05 +08:00
Josh Gao
76b64ba826 adb: fix infinite loop when attempting to push to //foo.
dirname (on glibc, at least) preserves multiple leading slashes, and we
were looping until path != "/", which would lead to an infinite loop
when attempting to push to a path like //data/local/tmp.

Bug: http://b/141311284
Test: python -m unittest test_device.FileOperationsTest.test_push_multiple_slash_root
Change-Id: I182b3e89ef52579c716fdb525e9215f1fe822477
2019-09-26 01:56:58 +08:00
Dan Shi
03ba5b9dfb Merge "Add require_root to adbd_test and libpackagelistparser_test" 2019-09-24 18:30:44 +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
Mark Salyzyn
6f908cefe7 adb: fix adb remount -R
A regression from commit 8c2198c809
("adb: use shell for remount to forward return codes.") where the
optional argv[1] got missed for the remount command.  This change
hands off _all_ the arguments if to a shell and activates some of
the extra features in the remount command.

$ adb remount --help
remount [-h] [-R] [-T fstab_file] [partition]...
	-h --help	this help
	-R --reboot	disable verity & reboot to facilitate remount
	-T --fstab	custom fstab file location
	partition	specific partition(s) (empty does all)

Remount specified partition(s) read-write, by name or mount point.
-R notwithstanding, verity must be disabled on partition(s).
$

SideEffects: adb remount [-h] [-R] [-T fstab_file] [partition]...
Test: adb-remount-test.sh
Bug: 138577868
Bug: 139283818
Bug: 139226412
Change-Id: I8223d4000ab20857e9b634e4d4a326eed530d7be
2019-09-18 09:40:50 -07:00
Josh Gao
1025b228ba adb: fragment host linux USB writes when needed.
We've seen USB writes failing due to inability to allocate contiguous
chunks of memory in the kernel on devices, but it looks like the same
problem can occur on the host, as well. It's a mild performance
regression (90->80 MB/s on a blueline) to split the writes always, so
attempt the full write first, and fall back to splitting it up if that
fails with ENOMEM. Once we switch over the the asynchronous transport
API, we'll be able to submit multiple writes cheaply, like on devices,
so we won't need to retry at that point.

Bug: http://b/140985544
Test: test_device.py
Change-Id: I1517c348375b829dfff6796c4e9d394802b02d5b
2019-09-17 14:48:16 +08:00
Alex Buynytskyy
7ea92d8232 Using the correct feature name for abb_exec.
Test: atest adb_test
Test: atest fastdeploy_test

Change-Id: Ib917ed8293d0f51339cade032c768a4058ba578e
2019-09-16 10:36:52 -07:00
Treehugger Robot
fd010252c2 Merge "adb: fix old host transport selection." 2019-09-12 19:58:20 +00:00
Josh Gao
727b07b260 adb: fix old host transport selection.
We regressed handling of the old host transport selection syntax, which
broke users that reimplement adb themselves (e.g. Studio via ddmlib).

Bug: https://issuetracker.google.com/140369526
Test: adb raw "host-serial:822X0028S:forward:tcp:42929;localabstract:/com.example.ndktest-0/platform-1568299082100.sock"
Test: ./test_device.py
Change-Id: Iaaec8fde952316fe9bf2a6f6c6c4a3bc9f74bf72
2019-09-13 00:26:37 +08:00
Colin Cross
537e4af235 Merge changes from topic "protobuf-3.9.1"
* changes:
  Use installed paths of vndk libraries for ld.config.txt
  Adapt to google::protobuf::int64 type change
2019-09-11 18:00:15 +00:00
Josh Gao
3b8cd67dff Add stub code to read MS OS 2.0 descriptors.
Linux doesn't seem to actually support emitting them, so we can't check
that they're actually there, but commit the code to read them so that
if and when Linux gets support, it's easier to check.

This also adds some error checking for ill-formed binary object store
entries.

Test: check_ms_os_desc
Change-Id: I4baf6a16f0f96acbec468b843db65d4ab3a589fe
2019-09-06 14:45:11 -07:00
Josh Gao
27512c9e49 adb: add host tool to check for WinUSB descriptor.
Bug: http://b/68993980
Test: manual
Change-Id: I97395c9738a671dd136c6cf66f88fdb769ec7227
2019-09-05 15:56:54 -07:00
Colin Cross
cfcc0b0337 Adapt to google::protobuf::int64 type change
Protobuf 3.9.1 redefines google::protobuf::int64 from long long to
int64_t, which is sometimes long and sometimes long long.  Use PRId64
to print it.

Bug: 117607748
Test: m checkbuild
Change-Id: I6699cfdb0f0424aa3e1c98b59d941beb9f133055
Merged-In: I6699cfdb0f0424aa3e1c98b59d941beb9f133055
2019-09-05 14:46:16 -07:00
Josh Gao
1f32a20c5c Merge changes Iacf0093a,I40be3504
am: c2f53906e8

Change-Id: I21f8c74909b218a2d35d149305d9858722911cd1
2019-08-20 13:40:55 -07:00
Josh Gao
c2f53906e8 Merge changes Iacf0093a,I40be3504
* changes:
  adb: fdevent: add fdevent_context_epoll.
  adb: extract soon-to-be-common code.
2019-08-20 20:00:34 +00:00
Josh Gao
ada40cd6b8 Merge "adb: fix mac build"
am: ef356fa5bd

Change-Id: Ia7324a9137ce296f2090c82993b1c4726bb25553
2019-08-19 16:54:43 -07:00
Adrian Roos
68c14d10b8 adb: fix mac build
Ensure that off64_t is defined when building adb for mac

Fixes: 139646013
Test: make # On mac
Change-Id: I32b68738d71c8a63a35c22434092933dcabac1ce
(cherry picked from commit 2167b9082d)
2019-08-19 10:51:00 -07:00
Dan Albert
8c2b3a8cde Revert "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor"
This reverts commit b2d79c5e48.

Bug: http://b/135753060
Test: treehugger
Change-Id: I2b1b2b7dfb7bab783e4ed40e295329525ceaa0dd
(cherry-picked from internal commit ba4684c2b2)
2019-08-15 17:27:49 -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
Josh Gao
e22cb9f306 adb: extract soon-to-be-common code.
As a side effect, delete FDE_ACTIVE, which was always set on every
fdevent, and FDE_PENDING, which was an internal implementation detail.

This patch removes spin detection, which will be reimplemented
separately later.

Test: adb_test on host
Test: adbd_test on blueline
Change-Id: I40be3504ce03c4fae5e071fa018542a051b7511d
2019-08-14 13:56:08 -07:00
Yurii Zubrytskyi
71d621dd36 Merge "[adb] Use STL for ParseUInt() implementation"
am: 61bffa5fc0

Change-Id: Iafbacab5e2ddf180683d501cd702ad39017104f9
2019-08-14 01:41:47 -07:00
Treehugger Robot
61bffa5fc0 Merge "[adb] Use STL for ParseUInt() implementation" 2019-08-14 06:32:44 +00:00