Commit graph

2424 commits

Author SHA1 Message Date
Dan Albert
6c95c3edcd Merge "Indicate that a packet was truncated." am: 046160959c am: e76c8020ba
am: c83ec67ec3

Change-Id: I61c12bc6fbcd205c2421831a64ffb783249a2222
2017-06-27 23:06:56 +00:00
Treehugger Robot
046160959c Merge "Indicate that a packet was truncated." 2017-06-27 22:50:48 +00:00
Dan Albert
9893f93950 Indicate that a packet was truncated.
Test: make checkbuild, check adb log
Bug: None
Change-Id: I0006ed284697f01966fdd79ca0b05dbc6d2eecf0
2017-06-27 13:26:14 -07:00
Josh Gao
cb39742d3a Merge "Revert "adb: turn on libusb by default."" am: b22067677e am: de931dab2d
am: 947a301852

Change-Id: Ideabacf8cd79adaf6fb828874ac636ed88707240
2017-06-26 22:17:29 +00:00
Treehugger Robot
b22067677e Merge "Revert "adb: turn on libusb by default."" 2017-06-26 21:33:34 +00:00
Josh Gao
969110ca4a Revert "adb: turn on libusb by default."
This reverts commit f2f0b31850.

libusb seems to be causing flakiness on some machines. Disable it for
now.

Bug: http://b/62962248
Test: python test_device.py (with DeviceOfflineTest commented out)
Change-Id: Ia9de78ab772c22574cf5ca7facb78f22af6d7a71
2017-06-26 13:17:58 -07:00
Elliott Hughes
b76034e755 Merge "Give a clear error message if we can't start the server." am: b6d3f28287 am: 1496863091
am: 07db226264

Change-Id: Ic2244ee02ca83ccdffcfbefac49797c2e4f7d459
2017-06-21 01:06:53 +00:00
Treehugger Robot
b6d3f28287 Merge "Give a clear error message if we can't start the server." 2017-06-21 00:48:30 +00:00
Elliott Hughes
6eadee8607 Give a clear error message if we can't start the server.
Bug: http://b/35218713
Test: adb kill-server ; export HOME=/ ; adb devices
Change-Id: I53cc30213be0eab84e42b09c7b501362d6e44b05
2017-06-20 14:21:41 -07:00
Josh Gao
24e8e0d0d8 Merge "adb: increase the shell command length limit." am: 9d2e688b9a am: 749d2a0ab5
am: 3df484eeab

Change-Id: I90d845f1c2b6aa767a7c5540b25619724f3b2331
2017-06-17 22:10:31 +00:00
Treehugger Robot
9d2e688b9a Merge "adb: increase the shell command length limit." 2017-06-17 21:57:12 +00:00
Josh Gao
a019f78141 adb: increase the shell command length limit.
Relax the shell command length limits when talking to an adbd with the
shell protocol.

shell is pretty much the only service that takes an arbitrarily long
string, so this is somewhat safe.

Bug: http://b/37716055
Test: `adb shell $(python -c 'print "echo " + "f" * (32*1024)') | wc` on L and master
Change-Id: I0737fd2244530ef8080f300cd3a3549a1ab93465
2017-06-16 18:01:11 -07:00
Josh Gao
7ff1e56f59 Merge "adb: fix deadlock between transport_unref and usb_close." am: 6f61a6d9c4 am: 2a8ce10cd8
am: 64523c01bd

Change-Id: I94128840430281a54c74cdfb2b35744b4730942f
2017-06-12 23:16:10 +00:00
Treehugger Robot
6f61a6d9c4 Merge "adb: fix deadlock between transport_unref and usb_close." 2017-06-12 23:03:55 +00:00
Nicolas Norvez
c616a8ad84 Merge "adbd: optionally use qemud pipe without ro.kernel.qemu" am: b3c363f32c am: 516ee2445d
am: 6ff249f483

Change-Id: I7a5886b9a9c325036007ad9251b0952fdbd7a206
2017-06-12 21:53:42 +00:00
Nicolas Norvez
717f15353f adbd: optionally use qemud pipe without ro.kernel.qemu
adbd currently decides to use the QEMUD pipe if ro.kernel.qemu=1, as set
for ranchu. The Android container in Chrome OS doesn't have that
property set and it can't be set to 1 because it's used as equivalent to
"runs inside an emulator" throughout Android and changes the way
graphics are handled, whether Bluetooth is supported, etc., behaviour
that we do not want to trigger in Chrome OS.

adbd now also checks service.adb.transport to decide whether to use the
QEMUD (goldfish) pipe.
adbd still first checks for ro.kernel.qemu to preserve existing
behaviour and will still fallback to TCP if it can't use Goldfish.

Bug: 38497992
Test: tested by jmgao@ -thanks!- on aosp_angler, adb still works.

Change-Id: I8370704145ae7301ac7aeef81c5cbd94cfcb7fd7
2017-06-12 12:22:32 -07:00
Josh Gao
7e197ef833 adb: fix deadlock between transport_unref and usb_close.
Fix a deadlock that happened when a reader/writer thread released a
transport while the hotplug thread attempted  to handle a device
disconnection. Decrementing a transport refcount to zero would hold the
global transport mutex and attempt to take the usb handles mutex, while
the hotplug thread would hold the usb handles mutex and try to call
unregister_usb_transport, which would attempt to take the global
transport mutex.

Resolve this by making transport_unref not take the global transport
mutex.

Bug: http://b/62423753
Test: python test_device.py
Change-Id: Ib48b80a2091a254527f3a7d945b6a11fae61f937
2017-06-07 18:54:09 -07:00
Josh Gao
806ca1a1b0 Merge changes Id51dcb18,I2517dcb9 am: 4db472b779 am: aa3c3fc3be
am: 4b32a1f8b8

Change-Id: I9b9a5f594dd9a20bbf6dc2fead193433deb51942
2017-06-07 20:12:53 +00:00
Josh Gao
5b8b10e078 adb: libusb: switch from polling for accessibility to a sleep.
For unclear reasons, it seems that for some people, devices are
becoming accessible, inaccessible, and then inaccessible again.
Switch to a sleep for now.

Bug: http://b/62200735
Test: manual
Change-Id: Id51dcb188c3534a57c35cbfd30a181c99115a23c
2017-06-07 11:08:00 -07:00
Josh Gao
7dd382ded9 adb: improve race between device_connected and device_disconnected.
If a device is unplugged while it's being processed, we can be inside
register_usb_transport still when we call unregister_usb_transport,
leading to bad things happening. Move the call of
register_usb_transport into the scope guarded by usb_handles_mutex.

Bug: http://b/62200735
Test: manual
Change-Id: I2517dcb9d30d9a08cebbb5f715ae3fd30c510109
2017-06-07 11:06:53 -07:00
Josh Gao
8e2661eedc Merge changes I6c6bf61b,I3fb0b3a8 am: 3160a25010 am: 9d7880fe96 am: 14f749c2c4
am: 2d30a74181

Change-Id: I57a3916c312b8cc23c616232e84ad6c5507b5a39
2017-06-06 03:05:34 +00:00
Josh Gao
60b8c26520 adb: libusb: don't try to delete a usb_handle twice.
Previously, we would attempt to delete a usb_handle in both
device_disconnected and usb_close. If the one in device_disconnected
happened to happen first, usb_close would abort when it failed to find
the handle it was supposed to own.

Bug: http://b/62020217
Test: unplugging device on darwin
Change-Id: I6c6bf61bf89a4d9a23458c00b457080d3d6cc744
2017-06-05 15:11:53 -07:00
Josh Gao
664a618c06 adb: don't hold queue lock while performing callbacks.
Fix yet another source of deadlocks.

Bug: http://b/62020217
Test: unplugged device on darwin
Change-Id: I3fb0b3a84c56aed7d0da8ddba36e2d01fdb682ee
2017-06-05 14:54:45 -07:00
Josh Gao
f2bd9a1b6f Merge "adb: reunregress waiting for device on start-server." am: 72076d1aa7 am: 08a70ac6e5 am: 986ba5bbbb
am: 86aeea69f2

Change-Id: Icfb77a5a596ebd9207793d9c7929bebb992de40d
2017-06-02 00:58:23 +00:00
TreeHugger Robot
b4ad076ede Merge "Send color space information with screenshots" 2017-06-01 19:27:08 +00:00
Romain Guy
3a4e80ab8a Send color space information with screenshots
Version 2 of the framebuffer protocol in adb can now be used to read
the color space information of the screenshot: unknown (native),
sRGB or Display P3.

Bug: 29940137
Test: Manual
Change-Id: I037da58e1c4f6e9e874d72348140c067640c6931
2017-05-31 19:13:47 -07:00
Josh Gao
0b13c89f7a adb: reunregress waiting for device on start-server.
Move the invocation of adb_notify_device_scan_complete to
the end of device_connected, where we decrement connecting_devices.
Also, create a dedicated thread for handling hotplug events, instead of
reusing the main thread for this, since the main thread blocks until
device scan is complete.

Test: `adb kill-server; adb devices`
Change-Id: Ia73b1a57538174282a48ef73ab0a3e58152d6f83
2017-05-31 12:13:59 -07:00
Josh Gao
2f8dc5c785 Merge "adb: fix deadlock." am: 68599f5759 am: d5a2cdb72c am: a08c949c7a
am: 86d63c89b0

Change-Id: I7c45e6fcf3327d97ff15adbaa47df7ad08d4d0b2
2017-05-31 02:26:15 +00:00
Treehugger Robot
68599f5759 Merge "adb: fix deadlock." 2017-05-31 02:03:42 +00:00
Josh Gao
d1a3e8f1ab adb: fix deadlock.
libusb hotplug callbacks are called with the libusb lock taken, and we
call into libusb with our local mutex, so we need to enforce an ordering
between the two. Instead of calling device_connected or
device_disconnected directly, enqueue them onto the main thread.

Bug: http://b/62200735
Test: manually hotplugged a device
Change-Id: Ic5d55db83b47f4bb60f124ce94ddfe06f5f1a0c6
2017-05-30 17:09:42 -07:00
GuangHui Liu
51dff9791e Merge "Create build target to pull adb test scripts." am: 9c0a541f08 am: 0daaf93424 am: 621e253c43
am: 3b9865faa9

Change-Id: Ic5fb3113f33aa7bc0bfac3366862ce0236768e20
2017-05-25 17:11:19 +00:00
GuangHui Liu
9c0a541f08 Merge "Create build target to pull adb test scripts." 2017-05-25 16:48:19 +00:00
Felipe Leme
8baa2168af Merge "Always print the initial bugreport progress message." am: 5b17d7131b am: 8b54eb7681 am: 916a84e38b
am: bcb2f87c5c

Change-Id: Ic9988557ad259439ad72b43c154d8d092f540088
2017-05-24 02:26:53 +00:00
Dan Albert
a1a4371517 Merge "Add host feature for push --sync support." am: 886e6cac05 am: e2d7a50b69 am: 311f93faca
am: e0e9e4661b

Change-Id: I9909f7e52fc60b2446d84d1fc5da82a3925f921e
2017-05-23 23:58:17 +00:00
Felipe Leme
e5d665b46f Always print the initial bugreport progress message.
Otherwise, it might take seconds to display the initial percentage,
and the user might thing something is wrong and CTRL-C the process.

Fixes: 62003852
Test: added BugreportTest.OkProgressZeroPercentIsNotIgnored
Test: m -j32 adb_test && ./out/host/linux-x86/nativetest64/adb_test/adb_test --gtest_filter=BugreportTest.*

Change-Id: I8e7dbb28666c825c1408d5d204f813064fc3048f
2017-05-23 16:58:16 -07:00
Dan Albert
5176df8d4a Add host feature for push --sync support.
Test: adb host-features | grep push_sync
Bug: None
Change-Id: Ia7a7e9c3c2e6632a9c954fbad8f64602a21d9757
2017-05-23 14:30:00 -07:00
GuangHui Liu
41bda344a9 Create build target to pull adb test scripts.
Test: m adb_integration_test_adb adb_integration_test_device

Change-Id: I8c97af44ecf65eeae8a8dd678c43ad1d9f6c8a51
2017-05-23 10:42:59 -07:00
Josh Gao
8b4f5d97ce Merge changes I8d0c60e5,Ib8ad0ad6 am: a6bb369cb0 am: c7d9eb8636 am: a1c2561863
am: fb37f521b0

Change-Id: Ib67fcd1ff88df4e379ce92693eaa339d2dad0fbb
2017-05-23 03:00:18 +00:00
Treehugger Robot
a6bb369cb0 Merge changes I8d0c60e5,Ib8ad0ad6
* changes:
  adb: boolify check_header and check_data.
  adb: redirect stdout/stderr before initializing usb.
2017-05-23 02:51:32 +00:00
Dan Albert
dfc0ba92a8 Merge "Add --sync support to push." am: 62db5fcee0 am: d50b10544b am: 141f9c46d5
am: 8572f515fd

Change-Id: I29fe1ae0cf6be95b7bd44aaaed87a06065229c16
2017-05-19 20:42:22 +00:00
Dan Albert
06b0d6b01b Add --sync support to push.
Passing --sync only copies files that are older on the device.

Test: nose2
Bug: None
Change-Id: I2ff6c3d1fe29262c8ee50db316aa92fc38dd7147
2017-05-19 11:09:58 -07:00
Dan Albert
05e2c509dd Merge "Fix test following -p removal." am: 5e49fbc547 am: 3039d9d4fa am: 222a69bc92
am: b34b448bcd

Change-Id: I79a75b5167f7b8e03a176ed05f42c89000e43a61
2017-05-19 17:32:28 +00:00
Dan Albert
def4aae26d Fix test following -p removal.
Just use the environment variable.

Test: nose2
Bug: None
Change-Id: I020c737f8aa7416b46794ce387a12f7959a9ca2a
2017-05-19 00:30:51 -07:00
Josh Gao
36dadca9f0 adb: boolify check_header and check_data.
Test: grep
Change-Id: I8d0c60e500bba855a1afc0877253262246c07fef
2017-05-18 13:40:13 -07:00
Josh Gao
16c5a133ab adb: redirect stdout/stderr before initializing usb.
Avoid printing USB logging to the console.

Test: None
Change-Id: Ib8ad0ad6c559689d0f8feec2e66b42380edd26fb
2017-05-18 13:38:50 -07:00
David Zeuthen
7718e06ac0 Merge "adb: Allow disabling verity on eng builds when using AVB." am: 7ce0f00c08 am: 1ceea342d5 am: 984757365f
am: 7fb7389b66

Change-Id: I738acce3d5548bcfc444b4c04a0e20ba95fd9962
2017-05-17 21:26:36 +00:00
David Zeuthen
abddbc2cdf adb: Allow disabling verity on eng builds when using AVB.
Unlike VB1.0, if a device is using AVB then dm-verity is used on any
build (userdebug, eng, etc.). Therefore, we should allow disabling
verity on any build (except USER), not just userdebug. This bug was
pointed out in https://android-review.googlesource.com/#/c/371372/

Bug: 34124301
Test: Manually tested on -eng build on device using AVB.
Change-Id: I314550c13d7458d5d1ef68eb06f98849e11fbe15
2017-05-17 14:28:47 -04:00
Josh Gao
7be316ec0d Merge changes I8e8e0963,I3c714f63,Id157412e,Ib7c26fbd am: 55ddb99527 am: 66ca192ac3 am: f4578f1ad4
am: 21348e1205

Change-Id: Ie54a5dfdba5f6e4681473709af4aa370abb46d48
2017-05-15 21:40:45 +00:00
Josh Gao
425aefdcf0 adb: libusb: recognize devices with multiple interfaces.
A bug was introduced by commit 8bf37d7a wherein we accidentally only
look at the first interface of a device when checking whether a USB
device was an ADB device or not.

Bug: http://b/38201318
Test: none
Change-Id: I8e8e0963c77cd2cb03538d926ab735f4b57e52b7
2017-05-12 17:08:50 -07:00
Josh Gao
3f60a968e3 adb: libusb: wait for devices to become accessible.
Android's host linux libusb uses netlink instead of udev for device
hotplug notification, which means we can get hotplug notifications
before udev has updated ownership/perms on the device.

When detecting a new device, poll the device file for a while until we
can access it, before trying to open it.

Bug: http://b/38170349
Test: manually incrased timeout and chmodded a device betwen 0 and 664
Change-Id: I3c714f630940df02b407442592301e2bbb3d9653
2017-05-12 17:08:50 -07:00