Commit graph

13 commits

Author SHA1 Message Date
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
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
Josh Gao
0f29cbc750 adb: switch unix_open to string_view.
Test: test_adb.py
Test: test_device.py
Test: $ANDROID_HOST_OUT/nativetest64/adb_test/adb_test
Test: adb shell /data/nativetest64/adbd_test/adbd_test
Change-Id: Ieecc9b1b7f2111f4da45d4bbd1b7703535fe7d4d
2018-12-21 01:43:31 -08:00
Josh Gao
68b5d0c3e3 adb: flush stderr after logging on Windows.
Test: set ADB_TRACE=1 & adb.exe server nodaemon
Change-Id: Ibb109618be7eaae49461a306e34ff79451ec330e
2018-11-12 14:08:40 -08:00
Josh Gao
95c4497bd4 adb: don't spew to logcat when tracing is enabled.
When persist.adb.trace_mask is used to enable verbose logging, avoid
exponential logging when a user runs `adb logcat`. As a side-effect,
set the minimum logging level to include everything when ADB_TRACE is
used on the client (which is something we want anyway).

Bug: http://b/72971016
Test: `adb shell 'setprop persist.adb.trace_mask; killall adbd'; adb logcat`
Change-Id: Id4bca1f3933a920345499dbeaeb103c8a2e220cd
2018-02-06 15:55:06 -08:00
Yabin Cui
b5e11415d9 adb: fix two device offline problems.
When device goes offline, user usually has to manually replug the
usb device. This patch tries to solve two offline situations, all
because when adb on host is killed, the adbd on device is not notified.

1. When adb server is killed while pushing a large file to device,
the device is still reading the unfinished large message. So the
device thinks of the CNXN message as part of the previous unfinished
message, so it doesn't reply and the device is in offline state.

The solution is to add a write_msg_lock in atransport struct. And it
kicks the transport only after sending a whole message. By kicking
all transports before exit, we ensure that we don't write part of
a message to any device. So next time we start adb server, the device
should be waiting for a new message.

2. When adb server is killed while pulling a large file from device,
the device is still trying to send the unfinished large message. So
adb on host usually reads data with EOVERFLOW error. This is because
adb on host is reading less than one packet sent from device.

The solution is to use buffered read on host. The max packet size
of bulk transactions in USB 3.0 is 1024 bytes. By preparing an at least
1024 bytes buffer when reading, EOVERFLOW no longer occurs. And teach
adb host to ignore wrong messages.

To be safe, this patch doesn't change any logic on device.

Bug: http://b/32952319
Test: run python -m unittest -q test_device.DeviceOfflineTest
Test: on linux/mac/windows with bullhead, ryu.
Change-Id: Ib149d30028a62a6f03857b8a95ab5a1d6e9b9c4e
2017-04-20 10:14:59 -07:00
Daniel Friederich
b644134858 adb: fix adb trace tag
The ADB trace enum value collided with the 0 values used to mean all, hence it
was not possible to just trace the ADB tagged messages without also tracing everything else.

Change-Id: I15ff9c50c4ac01806c4841cf8213ce859faf130b
Test: Manually by setting ADB_TRACE and running adb, e.g. "ADB_TRACE=adb adb shell ls"
2016-12-14 12:41:43 -06:00
Elliott Hughes
90390302d5 Make "adb logcat" pass $ANDROID_LOG_TAGS through again.
But not for Windows, because even dealing with environment variables is
too hard there (and no Windows user has complained yet).

Bug: http://b/30184452
Test: manual
Change-Id: I2d60049ed0049a9532414a7cdecbd0687e06aba7
2016-10-26 15:12:14 -07:00
Elliott Hughes
ffdec18017 Switch adb to <android-base/properties.h>.
Bug: http://b/23102347
Test: manual
Change-Id: Iffa66258c01f84f41b9af99ab5e768a0a2669106
2016-09-26 13:14:14 -07:00
Elliott Hughes
4f71319df0 Track rename of base/ to android-base/.
Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
2015-12-04 22:00:26 -08:00
Spencer Low
363af568b8 adb/base: minor compiler portability improvements
I've been using these changes to compile with Visual Studio.

- GetFileBasename(): __FILE__ uses \ with Visual Studio.

- adb_trace.cpp: Apparently VS needs an ampersand before the function name.

- "expr1 ? : expr2" is a GCC extension.

- <algorithm> contains std::min().

- seekdir can't always be #define'd because some headers have members
  named seekdir.

- adb_utils.cpp: Not really a compiler issue, just a random fix:
  0x7F/DEL is not printable.

Change-Id: I0dfb634f1ba4ccbc0d1b9f71b00e838fbebb3b41
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-11-09 10:22:13 -08:00
David Pursell
c5b8ad88ce adb: create unix_isatty() function.
Our Windows code has several different ways it checks whether an FD is
a console or not, some of which aren't exactly correct as they may
treat character devices (e.g. NUL) as consoles.

This CL disallows using the builtin isatty() function and provides
unix_isatty() instead which correctly checks these corner cases.

Change-Id: I6d551c745dae691c7eb3446b585265d62c1e62fa
2015-11-02 16:44:34 -08:00
Yabin Cui
aed3c61c44 Adb: use VLOG() to replace D() for verbose logging.
As there are too many D(), we can keep both VLOG() and D() now, and get
rid of D() gradually.

Change-Id: I2f1cb70bcab3e82c99fed939341d03f6b2216076
2015-09-23 12:53:38 -07:00