Commit Graph

3354 Commits

Author SHA1 Message Date
Josh Gao 2683d0a2ca Merge changes I2d005e17,If2eec162,Icfd642e6
* changes:
  adb: daemon: Assign valid fd to usb_handle ep0 file descriptor
  adbd: respond to device-to-host control transfers.
  adbd: read, print, and ignore USB control transfers.
2019-06-04 19:22:08 +00:00
Josh Gao a891ffddd3 Merge "adbd: provide MS OS descriptors for WinUSB." 2019-06-04 19:22:00 +00:00
Mohammad Samiul Islam 361a99a3c4 Merge "Allow adb to handle single paramter with install-multi-package flag" am: d877a96656
am: c625e74d88

Change-Id: Ibbe33e4a9290b5e3b40898f7c75e58982ce47ae7
2019-06-03 16:04:00 -07:00
Treehugger Robot d877a96656 Merge "Allow adb to handle single paramter with install-multi-package flag" 2019-06-03 22:49:48 +00:00
chihhao.chen c097a5786d Merge "Fix non-aio USB read issue for fastbootd" into qt-dev
am: 9122289a97

Change-Id: I0274561a806f027452bf814a8e0cafbd5a7e0a85
2019-05-29 16:34:29 -07:00
TreeHugger Robot 9122289a97 Merge "Fix non-aio USB read issue for fastbootd" into qt-dev 2019-05-29 23:11:55 +00:00
chihhao.chen 8c544b6fd8 Fix non-aio USB read issue for fastbootd
non-aio USB read function was stuck in a loop waiting for more data
because data length parameter is always set 64 for fastbootd commands.
It should be a normal case to get less data than expected
since lengths of these commands are usually less than 64.
Add logic to check this and one more parameter to distinguish
fastbootd from general adbd case.

Bug: 133189029
Test: try various fastbootd commands
Change-Id: I6690324840d78f3f1e04235040301520329976db
Merged-In: I6690324840d78f3f1e04235040301520329976db
2019-05-29 23:10:50 +00:00
chihhao.chen 5f8b966d96 Fix non-aio USB read issue for fastbootd
non-aio USB read function was stuck in a loop waiting for more data
because data length parameter is always set 64 for fastbootd commands.
It should be a normal case to get less data than expected
since lengths of these commands are usually less than 64.
Add logic to check this and one more parameter to distinguish
fastbootd from general adbd case.

Bug: 133189029
Test: try various fastbootd commands
Change-Id: I6690324840d78f3f1e04235040301520329976db
2019-05-29 12:41:55 -07:00
Mohammad Samiul Islam b581ce93bb Allow adb to handle single paramter with install-multi-package flag
Bug: 130164367
Test: $adb install-multi-package dummy.apk
      It installs successfully.

Change-Id: I5775813d10b7a8d865518ce5480a401e8f41e876
2019-05-29 15:00:00 +01:00
Hemant Kumar 1cbe5edbc3 adb: daemon: Assign valid fd to usb_handle ep0 file descriptor
Bug: http://b/129283234
Test: treehugger
Change-Id: I2d005e17ccb45af95351c074cc53f6cfc53b5fdd
2019-05-28 17:53:24 -07:00
Josh Gao 43a0a9a5bf adbd: respond to device-to-host control transfers.
Failing to write to the endpoint results in subsequent reads on ep0 to
fail with EL2HLT, so do an empty write to fulfill the transfer.

Bug: http://b/131867920
Test: manually tested with modified auto client
Change-Id: If2eec162ca4b31a9974c7bd5802be51cee9e2708
Merged-In: If2eec162ca4b31a9974c7bd5802be51cee9e2708
(cherry-picked from internal commit af086e9a95)
2019-05-28 17:52:11 -07:00
Josh Gao fc2e2003dd adbd: read, print, and ignore USB control transfers.
It seems like we're blowing up when receiving a control transfer that's
intended for Android Auto, because we're not expecting to get the data
for the control transfer in a subsequent read.

Bug: http://b/131867920
Test: none
Change-Id: Icfd642e6dfc02d2ccbdd60c39f89e534298c944d
Merged-In: Icfd642e6dfc02d2ccbdd60c39f89e534298c944d
(cherry-picked from internal commit 12807c7012)
2019-05-28 17:51:05 -07:00
Josh Gao 527d6dd738 Merge "adbd: respond to device-to-host control transfers." into qt-dev
am: 8ef22b102c

Change-Id: Ia371254756e7d951064607226b4f9cfc67832c0b
2019-05-22 16:15:04 -07:00
Josh Gao db64696b7c adbd: provide MS OS descriptors for WinUSB.
Add Microsoft OS Descriptors so that on Windows, we get automatically
registered with the WinUSB driver instead of requiring a different INF
to be used with device with a different vendor ID.

Bug: http://b/68993980
Test: manually changed the vendor ID on a blueline and connected it to a Windows VM
Change-Id: Id78bae270df9805573a90a86019267b53a3c8252
2019-05-22 14:58:13 -07:00
Josh Gao af086e9a95 adbd: respond to device-to-host control transfers.
Failing to write to the endpoint results in subsequent reads on ep0 to
fail with EL2HLT, so do an empty write to fulfill the transfer.

Bug: http://b/131867920
Test: manually tested with modified auto client
Change-Id: If2eec162ca4b31a9974c7bd5802be51cee9e2708
2019-05-21 16:39:51 -07:00
Josh Gao 26a6faf0ae Merge "adbd: read, print, and ignore USB control transfers." into qt-dev
am: 6031286936

Change-Id: I3e1a2052406b3399f7e11176ac2aca1adcb20f52
2019-05-20 17:17:31 -07:00
TreeHugger Robot 7eeed22871 Merge "adbd: reduce queue depths." into qt-dev 2019-05-21 00:05:34 +00:00
TreeHugger Robot 5b882637e1 Merge "adbd: avoid starting multiple worker threads." into qt-dev 2019-05-21 00:04:15 +00:00
Josh Gao 12807c7012 adbd: read, print, and ignore USB control transfers.
It seems like we're blowing up when receiving a control transfer that's
intended for Android Auto, because we're not expecting to get the data
for the control transfer in a subsequent read.

Bug: http://b/131867920
Test: none
Change-Id: Icfd642e6dfc02d2ccbdd60c39f89e534298c944d
2019-05-17 18:34:23 -07:00
Evgenii Stepanov 9da358d6d3 Initialize all fields of struct iocb.
Kernel does not accept non-zero value of iocb->aio_reserved2.

Bug: 132803232
Test: initialize malloc() memory to non-zero pattern and see what breaks

Change-Id: I65a7e89e3a2c1ba79df1dc2d011d6c76c41afb81
(cherry picked from commit fe7eca7b8f)
2019-05-16 12:55:41 -07:00
Evgenii Stepanov 79b1dc0106 Merge "Initialize all fields of struct iocb." am: 6e06bcce9c
am: 37c81fd6f0

Change-Id: I3c8155e222b7e7f4277d5654f85e7006a777dd16
2019-05-16 00:03:37 -07:00
Evgenii Stepanov fe7eca7b8f Initialize all fields of struct iocb.
Kernel does not accept non-zero value of iocb->aio_reserved2.

Bug: 132803232
Test: initialize malloc() memory to non-zero pattern and see what breaks

Change-Id: I65a7e89e3a2c1ba79df1dc2d011d6c76c41afb81
2019-05-15 18:46:18 -07:00
TreeHugger Robot 82ebfca5cd Merge "adbd: don't abort on EOF on functionfs control fd." into qt-dev 2019-05-13 22:21:59 +00:00
Josh Gao 127da2ab6d Merge "adbd: don't abort on EOF on functionfs control fd." am: 41531df7b0
am: f848fac660

Change-Id: I9fda92cd15fa84318759a37606429621a0797d36
2019-05-13 11:58:57 -07:00
Josh Gao 1f7ae9d4e3 adbd: don't abort on EOF on functionfs control fd.
Also, improve the logging in the cases where we do abort.

Bug: http://b/131867920
Test: treehugger
Change-Id: If8ec9f4614ce146e6dbd21cc77587ea81658199b
(cherry picked from commit 2916e148d9)
2019-05-13 11:42:29 -07:00
Josh Gao 41531df7b0 Merge "adbd: don't abort on EOF on functionfs control fd." 2019-05-13 18:40:34 +00:00
Michael Groover 69277fb9c5 Merge "Notify the framework when an adb key is authorized" into qt-dev
am: b9c555e2cf

Change-Id: I664ba3acfb8295ccf7b773e07d2d007ff942bc40
2019-05-10 17:21:47 -07:00
Elliott Hughes 7b4bd88aa0 Merge "Clean up copy & paste from frameworks/base/cmds." am: d203a508ff
am: 9dedcc81ad

Change-Id: I2b851d9b6e8e60bd518fc209d263014c72c7c5b4
2019-05-10 17:12:42 -07:00
Treehugger Robot d203a508ff Merge "Clean up copy & paste from frameworks/base/cmds." 2019-05-10 22:00:23 +00:00
Josh Gao 2916e148d9 adbd: don't abort on EOF on functionfs control fd.
Also, improve the logging in the cases where we do abort.

Bug: http://b/131867920
Test: treehugger
Change-Id: If8ec9f4614ce146e6dbd21cc77587ea81658199b
2019-05-10 11:37:34 -07:00
Al Sutton 4983a007cf Merge "Add deprecation warning to adb backup/restore" am: 09070afd38
am: 2cf161bcc7

Change-Id: Icaa05ed20fb043c98bc440a1a36390b2396eb227
2019-05-10 03:42:06 -07:00
Al Sutton 09070afd38 Merge "Add deprecation warning to adb backup/restore" 2019-05-10 08:40:50 +00:00
Stephen Hines e5c452085b Merge "NFC: Fix potentially uninitialized 'port' variable." am: f0d59e24c3
am: 68b69c35b7

Change-Id: I3df8fa238dfaba119caad661914f59489d5c8207
2019-05-09 22:15:13 -07:00
Josh Gao 0bd7a96967 Merge "Revert "Revert "Add a way to turn off unique_fd's operator int.""" am: fe1d1e815f
am: 0df5a1cb66

Change-Id: I8cc21b88841d6a7b7b93efafbc89939540350214
2019-05-09 22:14:23 -07:00
Elliott Hughes e98971c06e Clean up copy & paste from frameworks/base/cmds.
Test: treehugger
Change-Id: I337e6f7e48d4debfce010ad4b6f9fcb860c13fb7
2019-05-09 22:05:13 -07:00
Treehugger Robot f0d59e24c3 Merge "NFC: Fix potentially uninitialized 'port' variable." 2019-05-10 01:34:56 +00:00
Michael Groover 7eeda6ba03 Notify the framework when an adb key is authorized
Bug: 124076524
Test: atest AdbDebuggingManagerTest
Change-Id: If73b81ca73ba4d64763cf49c1bbe42de81fa1cb6
2019-05-09 16:05:40 -07:00
Stephen Hines 391c40b9ec NFC: Fix potentially uninitialized 'port' variable.
Bug: http://b/131390872
Test: Builds with -Wconditional-uninitialized.
Change-Id: Ie699ec39307fb3b66ade8248cdbe3d6de42533a7
2019-05-09 12:55:41 -07:00
Al Sutton 31d335f39f Add deprecation warning to adb backup/restore
Test: Manual execution and verification of the message
Fixes: 131891013
Change-Id: Idc38fcdace2d79668a4daac0b99fb87d04fb4cb8
2019-05-09 16:14:05 +00:00
Josh Gao 27241a7a96 Revert "Revert "Add a way to turn off unique_fd's operator int.""
The original commit broke aosp-master-with-phones, because of
vendor libraries the depended on the int versions of libbase functions.

This patch reverts the revert, and also adds ABI-compatibility shims for
the replaced functions.

This reverts commit 2c58e1924a.

Bug: http://b/131312539
Test: treehugger
Test: forrest run of aosp-master-with-phones
Change-Id: I75cc84ec8d963e20862f7662e8e2f409471f41cc
2019-05-06 16:18:02 -07:00
Mark Salyzyn 5c812e7a13 Merge "adb: enable/disable verity expected overlayfs errors." am: be9c2c0310
am: 3809014902

Change-Id: Icb7f4cd3c20af1f80fa3ca2b05b906b38111b1e2
2019-05-06 08:38:56 -07:00
Treehugger Robot be9c2c0310 Merge "adb: enable/disable verity expected overlayfs errors." 2019-05-06 14:36:51 +00:00
Elliott Hughes f774bcc942 Merge "libbase: add ConsumePrefix/ConsumeSuffix." am: 7046bcb461
am: 9f6f62a485

Change-Id: Ie328e1a6da12ace87ebb2da65cbc649a1c972039
2019-05-03 17:48:43 -07:00
Josh Gao a31aa2e749 Merge "adbd: move posix_fadvise after open." am: 19322dddc6
am: c97b258c42

Change-Id: I10f91ee1cedd16c1f803c3bdff9253fe3bca6841
2019-05-03 17:25:51 -07:00
Elliott Hughes 7046bcb461 Merge "libbase: add ConsumePrefix/ConsumeSuffix." 2019-05-04 00:03:14 +00:00
Treehugger Robot 19322dddc6 Merge "adbd: move posix_fadvise after open." 2019-05-03 23:23:59 +00:00
Mark Salyzyn 5828b77a3d adb: enable/disable verity expected overlayfs errors.
Expect EBUSY for overlayfs teardown, and ENOENT for setup.

Test: adb-remount-test.sh
Bug: 131614849
Change-Id: I0fb351d6d5fe758021c9e9043f57863c7a194c12
2019-05-03 14:44:49 -07:00
Elliott Hughes b4dc7be6c5 libbase: add ConsumePrefix/ConsumeSuffix.
adb was already using ConsumePrefix, and now we have another would-be
user in cutils. (There appears to be one place in adb that should use
ConsumeSuffix, so I'm assuming we'll want that sooner or later.)

I've kept these inline because adb and google3's versions both were, and
I'm easily led.

Test: treehugger
Change-Id: I29d99032f6f6ccbfaefece59725db8afb02a4c87
2019-05-03 12:49:31 -07:00
Josh Gao d594359e7f Merge "adbd: avoid starting multiple worker threads." am: 5ddd49eeae
am: dcfc785d20

Change-Id: Id5fbaba786214b2d5b9dcab7f433ce12f850d35d
2019-05-02 14:33:26 -07:00
Josh Gao 94fb36bf77 adbd: avoid starting multiple worker threads.
A previous patch intended to make receiving multiple FUNCTIONFS_ENABLEs
non-fatal, but failed to do so because we would try to spawn another
worker thread and hit a different assertion.

Bug: http://b/130638368
Test: echo mem | adb shell "su 0 sh -c 'cat > /sys/power/state'"
Change-Id: I53456112244d8b4f7d26df6ec6961389fca70498
(cherry picked from commit 910ce0ff08)
2019-05-02 14:13:14 -07:00
Treehugger Robot 5ddd49eeae Merge "adbd: avoid starting multiple worker threads." 2019-05-02 21:09:04 +00:00
Josh Gao 1f37bbb38c Merge "adb: increase `adb [un]root` timeout." am: 6bc132846a
am: bead01860d

Change-Id: I9c5d7e914d27705f3f021a476ac9adf19ec7039a
2019-05-02 09:19:02 -07:00
Treehugger Robot 6bc132846a Merge "adb: increase `adb [un]root` timeout." 2019-05-02 15:53:20 +00:00
Josh Gao 15cc1d641e Merge "adbd: compile a static version." am: 7a7c71b2b6
am: d8ccd6b57c

Change-Id: I9a305af5eaf20cfb136cb74833a4a5c6f41e69e0
2019-05-01 22:09:05 -07:00
Josh Gao ef4a999343 adb: increase `adb [un]root` timeout.
3 seconds isn't generous enough, because if we're rapidly restarting
(e.g. `adb root; adb unroot`), init will wait 5 seconds to restart us.

Test: `adb root && adb unroot`
Change-Id: I353e8d1ee14f3b08416445ff627dea4a49afd9a4
2019-05-01 18:53:43 -07:00
Josh Gao bde8c848d8 adbd: compile a static version.
Test: mma
Change-Id: I785de074f9b5cc63d1804420b734c4b07081a716
2019-05-01 18:25:52 -07:00
Josh Gao 910ce0ff08 adbd: avoid starting multiple worker threads.
A previous patch intended to make receiving multiple FUNCTIONFS_ENABLEs
non-fatal, but failed to do so because we would try to spawn another
worker thread and hit a different assertion.

Bug: http://b/130638368
Test: echo mem | adb shell "su 0 sh -c 'cat > /sys/power/state'"
Change-Id: I53456112244d8b4f7d26df6ec6961389fca70498
2019-05-01 17:27:27 -07:00
Josh Gao b5d1d19269 adbd: move posix_fadvise after open.
Test: treehugger
Change-Id: I531e452eda46d7df3106fd59192e9936e64876b1
2019-05-01 13:40:01 -07:00
Josh Gao 60a5541e04 Merge "adb: restore generation of public key in `adb keygen`." am: fe6cc3e2d3
am: 6848befe69

Change-Id: I018c396127b0bb68358b74a72ecd33532440df5d
2019-04-29 16:04:00 -07:00
Treehugger Robot fe6cc3e2d3 Merge "adb: restore generation of public key in `adb keygen`." 2019-04-29 22:31:17 +00:00
xunchang 40bf0f0772 Support adb rescue wipe command
Support `adb rescue wipe` command on the host side. This command runs
under the rescue mode and wipes data (and cache/metadata).

Bug: 131037235
Test: run adb rescue wipe

Change-Id: Ib3a3f2d564cc19d0446540d616cc21489ba558c2
(cherry picked from commit c2265c5343)
2019-04-29 15:21:50 -07:00
Josh Gao 032989a2ba adb: restore generation of public key in `adb keygen`.
We don't need the public key to be generated at ~/.android/adbkey.pub,
but it's still useful to be able to generate the public key for use with
ADB_VENDOR_KEYS.

Bug: http://b/119634232
Test: manual
Change-Id: Iecd6ff1bba4af4ba142456034f3faf52bb9e017d
2019-04-29 12:36:32 -07:00
Tianjie Xu 0eff930825 Merge "Support adb rescue wipe command" am: 56311071fe
am: 979f05c621

Change-Id: I8bc2ffef336c57b47972b7f37ccfc70ab7a19158
2019-04-29 11:06:03 -07:00
Tao Bao fbeac4605c adb: Support rescue install and getprop.
Bug: 128415917
Test: Enter rescue mode on taimen. Send the following commands:
      `adb rescue getprop ro.build.fingerprint`
      `adb rescue getprop ro.build.date.utc`
      `adb rescue getprop ro.build.invalid`
      `adb rescue install /path/to/package.zip`
Test: Sideload on taimen w/ `adb sideload /path/to/package.zip`.
Change-Id: Ia246b30314fbcd2bd4cc71a8085a280e33041967
Merged-In: Ia246b30314fbcd2bd4cc71a8085a280e33041967
(cherry picked from commit 11cf30b5ed)
2019-04-26 12:27:39 -07:00
Tao Bao 25fe126fb0 adb: Recognize rescue mode.
This CL adds client support to recognize the rescue mode (which will be
served by recovery image). It also allows waiting for a device to enter
rescue mode. The support for the actual rescue commands will be added in
follow-up CLs.

Bug: 128415917
Test: `adb devices` recognizes devices under rescue mode.
Test: `adb wait-for-rescue` waits for device to be in rescue mode.
Change-Id: I367d7339fe68006aba09a1e3db6370d472296676
Merged-In: I367d7339fe68006aba09a1e3db6370d472296676
(cherry picked from commit 55d407ec4a)
2019-04-26 12:27:17 -07:00
xunchang c2265c5343 Support adb rescue wipe command
Support `adb rescue wipe` command on the host side. This command runs
under the rescue mode and wipes data (and cache/metadata).

Bug: 131037235
Test: run adb rescue wipe

Change-Id: Ib3a3f2d564cc19d0446540d616cc21489ba558c2
2019-04-26 10:37:13 -07:00
Ian Kasprzak 19187f1bfc Merge "Revert "Add a way to turn off unique_fd's operator int."" am: e30fe5fe89
am: e285dbeae3

Change-Id: I8a4911e8b6970c3b0defef66dc109358ff2d6748
2019-04-25 10:30:15 -07:00
Ian Kasprzak e30fe5fe89 Merge "Revert "Add a way to turn off unique_fd's operator int."" 2019-04-25 17:16:55 +00:00
Ian Kasprzak 2c58e1924a Revert "Add a way to turn off unique_fd's operator int."
This reverts commit 93d63c010a.

Reason for revert: b/131312539 - All aosp-master-with-phones phones failing boot / health check.

Change-Id: Id4239f93484b7d6b8d9bcd355a59cbd40d9766e2
2019-04-25 15:59:28 +00:00
Josh Gao ed0033b4c0 Merge "adbd: reduce queue depths." am: 0fcd9292c4
am: 1c6d4f3663

Change-Id: I95bc10b35cf00f02833978d762c21be4b8e9b5e2
2019-04-24 18:29:59 -07:00
Josh Gao d0feaf9f79 adbd: reduce queue depths.
Each operation we submit results in a contiguous allocation in the
kernel which can trigger OOM-killing. Tune the queue depths to reduce
the chances of this happening, with a minimal impact on performance.

Bug: http://b/126582877
Test: ./benchmark_device.py with blueline
Change-Id: I4b0f83d54a9a9a69f0ab48322d78fb137c94dd35
(cherry picked from commit 28293f16a8)
2019-04-24 18:12:17 -07:00
Josh Gao 0fcd9292c4 Merge "adbd: reduce queue depths." 2019-04-25 01:09:23 +00:00
Josh Gao 8c856f3e10 Merge "Add a way to turn off unique_fd's operator int." am: 971bae0bcf
am: 7653723999

Change-Id: I06811b1e5ff3d45e4b0490bf00d1608bdf1ce1c4
2019-04-24 16:07:09 -07:00
Josh Gao 76de9a471d Merge "adb: silence warning from libusb." am: ee5083b3c7
am: 4a749cc3f1

Change-Id: Ic2ab02abe3b2d1f001ee52c9ced9c0cb4db1e129
2019-04-24 16:06:21 -07:00
Josh Gao b83f920abf Merge "adb: fix double close in wait-for-*." am: e923e5ef62
am: a8a1f75147

Change-Id: Id73338791ef4cd3aa08c2bc0b00b8b1410dd8461
2019-04-24 16:05:33 -07:00
Josh Gao 971bae0bcf Merge "Add a way to turn off unique_fd's operator int." 2019-04-24 22:58:00 +00:00
Treehugger Robot ee5083b3c7 Merge "adb: silence warning from libusb." 2019-04-24 22:46:28 +00:00
Treehugger Robot e923e5ef62 Merge "adb: fix double close in wait-for-*." 2019-04-24 22:38:31 +00:00
Josh Gao 28293f16a8 adbd: reduce queue depths.
Each operation we submit results in a contiguous allocation in the
kernel which can trigger OOM-killing. Tune the queue depths to reduce
the chances of this happening, with a minimal impact on performance.

Bug: http://b/126582877
Test: ./benchmark_device.py with blueline
Change-Id: I4b0f83d54a9a9a69f0ab48322d78fb137c94dd35
2019-04-24 15:05:21 -07:00
Josh Gao 93d63c010a Add a way to turn off unique_fd's operator int.
unique_fd's implicit conversion to int has led to tons of problems (see
all of the overloads for close, fdopen, fdopendir, etc.). Add a switch
that can turn it off, and reduce the ridiculous amount of work to fix up
callers by introducing a borrowed_fd type that can be constructed from
either int or unique_fd.

Test: treehugger
Change-Id: If77cf5cbcaddacdaec5919a15b3520fb68f51a62
2019-04-24 12:59:42 -07:00
Tao Bao de8d0dfdc0 Merge "adb: Support rescue install and getprop." am: 6688eaf23f
am: 3ad39fa24b

Change-Id: Ic2fe41f624999762eb9c34e7d97727919ce821ab
2019-04-22 15:46:32 -07:00
Tao Bao 11cf30b5ed adb: Support rescue install and getprop.
Bug: 128415917
Test: Enter rescue mode on taimen. Send the following commands:
      `adb rescue getprop ro.build.fingerprint`
      `adb rescue getprop ro.build.date.utc`
      `adb rescue getprop ro.build.invalid`
      `adb rescue install /path/to/package.zip`
Test: Sideload on taimen w/ `adb sideload /path/to/package.zip`.
Change-Id: Ia246b30314fbcd2bd4cc71a8085a280e33041967
2019-04-19 12:51:57 -07:00
Josh Gao 499601b94f adb: fix double close in wait-for-*.
unique_fd's implicit conversion to int allows the following code to
compile without error, leading to a double close:

  std::function<void(unique_fd)> func = [](int x) { close(x); };
  func(unique_fd(42));

Test: treehugger
Change-Id: I948ecda3a12738b3af6444fe2902d2f7b80e1b4c
2019-04-18 16:58:30 -07:00
Tao Bao 2b82b147c8 Merge "adb: Recognize rescue mode." am: f072aaffe0
am: ff460d7fa8

Change-Id: Id617e014b74d0f090aaf0ce04c44f4de743595d0
2019-04-18 15:11:11 -07:00
Tao Bao f072aaffe0 Merge "adb: Recognize rescue mode." 2019-04-18 21:45:50 +00:00
Josh Gao 08ccc735a3 adbd: reduce the USB buffer sizes to 16k.
Some USB controllers only support 16k writes, so drop down to that.

Bug: http://b/130622010
Test: treehugger
Change-Id: I836d5b2d0d6fcae05f290af11a6a19c6e8d7c1ba
(cherry picked from commit 770a6a4d46)
2019-04-17 17:53:34 -07:00
Josh Gao 4710e53fe5 adb: silence warning from libusb.
Test: mma
Change-Id: I3f254f3432020937e0f22b04baf7df61336c500b
2019-04-17 16:57:43 -07:00
Josh Gao 039cc7d1f8 Merge "adbd: reduce the USB buffer sizes to 16k." am: f05fbe6957
am: 949a903ff5

Change-Id: I887c8b43ac51eef60b5d0ec2a489277ad8a0c092
2019-04-17 16:15:35 -07:00
Tao Bao 55d407ec4a adb: Recognize rescue mode.
This CL adds client support to recognize the rescue mode (which will be
served by recovery image). It also allows waiting for a device to enter
rescue mode. The support for the actual rescue commands will be added in
follow-up CLs.

Bug: 128415917
Test: `adb devices` recognizes devices under rescue mode.
Test: `adb wait-for-rescue` waits for device to be in rescue mode.
Change-Id: I367d7339fe68006aba09a1e3db6370d472296676
2019-04-17 13:47:02 -07:00
Josh Gao 770a6a4d46 adbd: reduce the USB buffer sizes to 16k.
Some USB controllers only support 16k writes, so drop down to that.

Bug: http://b/130622010
Test: treehugger
Change-Id: I836d5b2d0d6fcae05f290af11a6a19c6e8d7c1ba
2019-04-16 15:14:24 -07:00
Alex Buynytskyy 7e1d397d1a Binding err to inout for raw protocol for in-process execute.
As raw protocol does not allow for splitting err - it has to be redirected to inout.
Before this change it was not done for in-process and all err data was lost.

Bug: 130086616
Test: manual + atest adbd_test
Change-Id: I6cd11c940673d73e2993a6eb23c46d31bd8bf504
(cherry picked from commit 704c97d6c2)
2019-04-10 11:13:39 -07:00
Josh Gao a7f6cd0470 adb: defuse CHECK on IOVector::append of an empty block.
Bug: http://b/129706741
Test: treehugger
Change-Id: I35a35d20d179a155adb4fe83078739fcaf517136
(cherry picked from commit 3443b77415)
2019-04-10 11:13:35 -07:00
Alex Buynytskyy 88f48b125a Merge "Binding err to inout for raw protocol for in-process execute." am: 265af10e6e
am: 4daf72da7a

Change-Id: I38919f3b0c01590ba4a80beef7a1cf5e34e3a298
2019-04-09 12:28:14 -07:00
Alex Buynytskyy 704c97d6c2 Binding err to inout for raw protocol for in-process execute.
As raw protocol does not allow for splitting err - it has to be redirected to inout.
Before this change it was not done for in-process and all err data was lost.

Bug: 130086616
Test: manual + atest adbd_test
Change-Id: I6cd11c940673d73e2993a6eb23c46d31bd8bf504
2019-04-08 19:16:05 -07:00
Josh Gao 02dc0fcda0 Merge "adb: defuse CHECK on IOVector::append of an empty block." am: 5c58e092f3
am: c923599e0c

Change-Id: Iab58ded15e69a08176e586d2cdee46b3f742e56a
2019-04-04 14:22:15 -07:00
Treehugger Robot 5c58e092f3 Merge "adb: defuse CHECK on IOVector::append of an empty block." 2019-04-04 21:02:02 +00:00
Josh Gao 3443b77415 adb: defuse CHECK on IOVector::append of an empty block.
Bug: http://b/129706741
Test: treehugger
Change-Id: I35a35d20d179a155adb4fe83078739fcaf517136
2019-04-03 12:56:22 -07:00
Josh Gao fff6760db5 Merge "adb: fix mac build breakage." am: 52c6f1b6de am: 94a23604c7
am: 0a2e8e94ae

Change-Id: Ic2966482db39cdb15eacb192606bca44b0fd5f6f
2019-04-02 22:17:39 -07:00
Treehugger Robot 52c6f1b6de Merge "adb: fix mac build breakage." 2019-04-03 03:14:28 +00:00
Josh Gao 296ac3f024 adb: fix mac build breakage.
Bug: http://b/129786641
Test: none
Change-Id: Ibe051a0db2f912d1f7e55369e25a5bd38bf86fd5
2019-04-02 16:31:32 -07:00
Josh Gao 804ffede3e Merge "adbd: demote CHECKs to warning logs." am: 16f4a033c3 am: 887e8f4bfd
am: 8cecb02a2c

Change-Id: Id2ab6435ad2953cd4bb6348fc5166a07a598832f
2019-04-02 15:27:18 -07:00
Josh Gao 87afd52fb5 adbd: demote CHECKs to warning logs.
It seems like we don't actually always get these events in order, so
demote them to a log and restart the connection instead of aborting.

Bug: http://b/129464137
Test: mma
Change-Id: I7dffbf62f9dea665cf9f9f9e1bd18d444b6905ec
2019-04-02 10:56:07 -07:00
Josh Gao 73a9681319 Merge "adb: make `adb reconnect` perform a USB reset." am: 3b25a17a8a am: 0d9d5ef1bb
am: e5a5a5b18f

Change-Id: If54f9d0b4c8a003ab7cd5557a4d0b0a48fc3654d
2019-04-01 15:34:48 -07:00
Josh Gao 3b25a17a8a Merge "adb: make `adb reconnect` perform a USB reset." 2019-04-01 21:42:57 +00:00
Josh Gao 3705b346b9 adb: make `adb reconnect` perform a USB reset.
Bug: http://b/128941083
Test: manual
Change-Id: Iaf46d2c46cc82b590768004486d119244591c8e2
2019-03-28 15:47:44 -07:00
Josh Gao 2a1fb09335 Merge "adbd: wait for FUNCTIONFS_BIND for up to a second, then retry." am: bfcb981b32 am: 80268fd592
am: 51ca488977

Change-Id: Ia4a29eedde07ea29b0a7650179330386ecf19af1
2019-03-28 14:02:31 -07:00
Josh Gao 19dc296305 adbd: wait for FUNCTIONFS_BIND for up to a second, then retry.
Occasionally, after we open the functionfs endpoint and write our
descriptors to it, we end up in a state where we never receive any
events from ep0, presumably due to a race against some other part of
the system, since adding sleeps reduces the likelihood. Add an
(arbitrarily chosen) timeout for the initial FUNCTIONFS_BIND we read,
and retry on failure.

Bug: http://b/128679787
Test: unplug and replug a blueline 14,000 times with a usb switch board
Change-Id: I4b3d5d552179ee7f3fefcc15f9575f793926f784
2019-03-27 18:04:45 +00:00
Greg Kaiser e0a1be42cb Merge changes Ia84ed9ec,I1c0fde72 am: 10533c57ed am: b6bc0075f4
am: d095e07371

Change-Id: I85cb7c71f37565e220a16ea6f21548887ef8e20c
2019-03-26 18:17:41 -07:00
Josh Gao 3d26a86676 Merge changes I80af5f4b,I2fd0034e am: 2decb2fc3a am: c9a893c1eb
am: 448aed3c73

Change-Id: I783537a4b2ec10659c563b4461186d2230895e35
2019-03-26 18:08:11 -07:00
Treehugger Robot 10533c57ed Merge changes Ia84ed9ec,I1c0fde72
* changes:
  fastboot: Avoid extra std::string copies
  adb: Avoid extra std::string copies
2019-03-27 00:33:05 +00:00
Josh Gao 6933d54e09 adbd: listen to all functionfs events.
Monitor for FUNCTIONFS_UNBIND as well, so that in the case where we get
FUNCTIONFS_BIND, FUNCTIONFS_UNBIND, FUNCTIONFS_BIND, we don't trigger an
assertion failure from seeing two FUNCTIONFS_BINDs.

Bug: http://b/129134256
Test: manual
Change-Id: I80af5f4b833513e932262638b9f8d76bbcb35504
2019-03-26 13:38:41 -07:00
Josh Gao 63b52ec13b adbd: increment writes_submitted_ before submitting writes.
If we fail to submit writes for some reason (e.g. the USB cable was
unplugged), another thread that's waiting on the write mutex can enter
SubmitWrites and attempt to resubmit the writes that we already failed
to submit, leading to a failed assertion of !IoBlock::pending.

Increment writes_submitted_ before actually calling io_submit, so we
skip over these writes and fall through to exit.

Bug: http://b/129134256
Test: manually unplugged a blueline
Change-Id: I2fd0034e45db22c8f637c81039ce686b7aa6a03b
2019-03-26 13:06:38 -07:00
Greg Kaiser e2125fdeb1 adb: Avoid extra std::string copies
When a function argument takes a std::string, it's inefficient to
pass std::string::c_str(), since that creates an additional copy.
So we change these calling sites.

Test: TreeHugger
Change-Id: I1c0fde7275eb3ebd3baf05ec62581b0243655608
2019-03-26 12:00:19 -07:00
Josh Gao f31a12aa71 Merge "adbd: support ro.adb.nonblocking_ffs." am: affe351420 am: c94cec6d9d
am: 1e43373c62

Change-Id: Icdafb535240608d0e7ba927583c79199ef78747a
2019-03-19 13:10:35 -07:00
Josh Gao affe351420 Merge "adbd: support ro.adb.nonblocking_ffs." 2019-03-19 19:44:00 +00:00
Josh Gao c57206a541 Merge "adb: fix uninitialized variable." am: 588a87d68e am: 966b39b34c
am: 4ba1491a38

Change-Id: I5765725c70d659e73b5b852cad0095a9d0d52522
2019-03-18 20:49:51 -07:00
Treehugger Robot 588a87d68e Merge "adb: fix uninitialized variable." 2019-03-19 03:14:17 +00:00
Josh Gao 8038e35fdf adbd: support ro.adb.nonblocking_ffs.
Allow disabling ro.adb.nonblocking_ffs via an ro system property, which
gets overridden by the currently supported persist.adb.nonblocking_ffs.

Bug: http://b/128679787
Test: mma
Change-Id: I28891d2da129e9654bf63ab8a4c330c4d2f5b336
2019-03-18 17:59:24 -07:00
Josh Gao b019574476 adb: fix uninitialized variable.
Previously, we were initializing IoBlock::pending when submitting a read,
but leaving it uninitialized when doing a write, which would sometimes
result in an assertion firing when we received a previously allocated
block of memory that happened to have a nonzero value in pending.

Test: treehugger
Change-Id: I434c65f554ceed313fea9cfcc98788908f3ca8bc
2019-03-18 17:12:19 -07:00
Greg Kaiser 446f4655cb Merge "adb: Fix return value in error case" am: 2925a580e9 am: 73308830a6
am: 507be15cf8

Change-Id: I2e8d88291ee2f26fda59607eb64e8d6accf69968
2019-03-18 14:46:27 -07:00
Greg Kaiser 5fe40a66b2 adb: Fix return value in error case
When we introduced __adb_check_server_version() as a function
returning a 'bool', we missed missed converting once instance
of "return -1;" to "return false;".  Thus, we're returning 'true'
in this case as our non-zero value gets implicitly converted to
'true'.

We fix this case as well with this CL.

Test: TreeHugger
Change-Id: I90b01567d927f36d2d963561b676b3bfabfcee49
2019-03-18 07:00:00 -07:00
Josh Gao 8738462218 Merge "adb: avoid sign extension of shell return code." am: b5ac15a936 am: a6397564b6
am: 3811ab5afa

Change-Id: I334ee2c20a76a6a081b7b752d8e7ca558da3f1da
2019-03-15 21:22:52 -07:00
Josh Gao bcde100b00 Merge "adb: attempt to exec newer adb servers on Linux." am: eecd5cc532 am: e60f681f7c
am: b333e684d1

Change-Id: I23041966e50fd61dc0e034a609e2534d1f58c1ad
2019-03-15 16:06:29 -07:00
Josh Gao 1e1ae45a8c adb: avoid sign extension of shell return code.
Windows has int32_t return codes, which results in return codes 128-255
being sign extended into a negative number. Manually truncate the return
codes we get to preserve their values.

Test: test_device.py on windows
Change-Id: If41d6d469350301704f6ecff72ad17b412db3e04
2019-03-15 14:54:32 -07:00
Josh Gao eecd5cc532 Merge "adb: attempt to exec newer adb servers on Linux." 2019-03-15 21:54:10 +00:00
Jiyong Park c9a07bcbb4 Revert "Handle adb sync with Bionic under /bionic" am: fc97d2a116 am: 8b9fa0a44d
am: ebe1460df5

Change-Id: I24a5a49a8cd894b93664c65b76534db614d891e2
2019-03-15 02:43:37 -07:00
Jiyong Park 8b9fa0a44d Revert "Handle adb sync with Bionic under /bionic"
am: fc97d2a116

Change-Id: I8c8780f0009795d281b93efa691791427402ef45
2019-03-15 02:18:42 -07:00
Treehugger Robot 4cd0914048 Merge changes from topic "apex_earlymount_no_bionic_bindmount"
* changes:
  /bionic path is gone
  Revert "Handle adb sync with Bionic under /bionic"
  Don't bind-mount bionic files
2019-03-15 09:02:18 +00:00
Bowgo Tsai 76f9dc6f31 Merge changes from topic "adb_root_in_user" am: da1251d6a5 am: ac5d9460f2
am: c613c0d130

Change-Id: I46e9d64a103c7a983d908e7b6f131332aafe1b72
2019-03-14 22:05:05 -07:00
Josh Gao d10b7c4e02 adb: attempt to exec newer adb servers on Linux.
Test: manual
Change-Id: Iebdfa292f21b2871e6010ab6cc964134fec447e9
2019-03-14 15:41:41 -07:00
Bowgo Tsai 9b30c0a7e6 adbd: allowing adb root when the device is unlocked
As there is no security guarantee when the device is unlocked,
allowing adb root gives us more rooms to debug a USER build images.

Also, this makes it possible to run VTS on a USER build GSI, with
setting ro.debuggable=1 and unlocking the device.

This basically re-lands a reverted change:
https://android-review.googlesource.com/c/platform/system/core/+/437815

Which isn't needed after we moved /sbin/adbd to /system/bin/adbd in
USERDEBUG GSI. But it's still needed for USER build GSI.

Bug: 126493225
Test: unlock a USER build device, check 'adb root' can work
Change-Id: I93f12c8a3fe65c96c947e4602795eadfe591c521
2019-03-15 03:04:46 +08:00
Jiyong Park fc97d2a116 Revert "Handle adb sync with Bionic under /bionic"
This reverts commit 7c7189c469.

Bug: 125549215
Test: system/core/fs_mgr/tests/adb-remount-test.sh
Change-Id: I4ee40cda9c3b94b116dc822c7b9736cfe2c9c9f0
2019-03-14 07:35:54 +09:00
Josh Gao 8c73ee5afc Merge "adb: make root/unroot wait for the device to come back." am: 59d4c8a352 am: 983e1a5af2
am: 2ef1948cd0

Change-Id: I7b0b6974ad6e90b8143515d486299d75ca8d1a64
2019-03-11 21:17:46 -07:00
Josh Gao 2986dd4dfc Merge "adbd: properly handle FUNCTIONFS_BIND without ENABLE." am: 22ff8e1909 am: b90db0840a
am: 313d214ec0

Change-Id: I63965d5bf49bdf63383bdd6aaac703c06fab5179
2019-03-11 17:15:56 -07:00
Josh Gao 3c99b0f94f adb: make root/unroot wait for the device to come back.
Test: manually unplugged a device after adb root
Change-Id: I588283a666cc5e19d809d7ce81b5300398e8be2d
2019-03-11 15:59:09 -07:00
Josh Gao 007a4dc7a6 adbd: properly handle FUNCTIONFS_BIND without ENABLE.
If a device is unplugged, a BIND will happen without an ENABLE until the
device is plugged in, which would previously result in adbd crashing
every 5 seconds due to an attempt to join a thread that hadn't been
started.

Bug: http://b/128255355
Test: manually observed adbd via serial cable while unplugged
Change-Id: I90d6384e7e829df1ffaf73a95f2418a2ff97fb03
2019-03-11 13:06:17 -07:00
Josh Gao 9909c13ad9 Merge "Restrict scanning port range, not emulator count" am: e6413fcd94 am: b4954166ac
am: 4b868d648b

Change-Id: I79ce65ada9dd071b1eba7743d5e3d5212ce68fef
2019-03-08 12:27:57 -08:00
Josh Gao e6413fcd94 Merge "Restrict scanning port range, not emulator count" 2019-03-08 19:29:43 +00:00
Josh Gao b1aa106e44 Merge "Revert "Revert "adbd: switch the default USB implementation.""" am: f97193d96f am: d9e3421558
am: 3fafb971d9

Change-Id: Ie98d0d8b581fb53d0e7ecc64f55744fa851e3174
2019-03-07 21:14:18 -08:00
Treehugger Robot f97193d96f Merge "Revert "Revert "adbd: switch the default USB implementation.""" 2019-03-08 03:29:41 +00:00
Tim Baverstock 25173c808a Restrict scanning port range, not emulator count
Our servers can comfortably run more than 16 emulators, and this is
much easier than messing with hypervisors or docker port allocation.

Assumes you know how to avoid clashes with Google Wear's default port.

Test: manual - still registers emulators.

Change-Id: I47cfd28725a550de0bd77fd11fcd94cdd11d2cc2
2019-03-07 12:28:31 +00:00
Josh Gao 2d918cde58 Merge "adbd: cleanups in remount/verity." am: 98efc485de am: d659bb49be
am: b7dc01a570

Change-Id: Ia1f05becfdbba49606fb9bd47123e81c73d55e97
2019-03-06 18:46:04 -08:00
Josh Gao 3ed90b75da adbd: cleanups in remount/verity.
1. Don't clear O_CLOEXEC on an fd we're duping to stdin/out/err: dup2
   does that for us if oldfd != newfd, and we know the fd can't be
   stdin/out/err.
2. Use unique_fd.
3. Remove gotos by breaking the remount logic into its own function.

Test: mma
Change-Id: If9929e7f20de445322fd498e1379a2d4e572cb52
2019-03-06 13:03:30 -08:00
Mark Salyzyn 2085759c6d Merge "adb: use /system/bin/remount command" am: d458066bc7 am: bc0887add7
am: be17923ece

Change-Id: Iaf7574caa4b4ee23acc864d7eeaf3a095394c215
2019-03-04 14:51:39 -08:00
Mark Salyzyn 2f6c180749 adb: use /system/bin/remount command
Replace direct logic in support for 'adb remount' with an exec out to
/system/bin/remount to do the heavy lifting.  Remount success and
failure strings are reported by the adb remount service in response
to the various reported errors, freeing up the remount command itself
from the legacy of script expectations.

Test: adb-remount-test.sh
Bug: 122602260
Change-Id: I686fa465f463b881bbb38f709d780a95e463be80
2019-03-04 11:12:54 -08:00
Josh Gao 291f29613c Merge "adbd: fix a case where we can fail to join a thread." am: b530537d46 am: ace5a7c799
am: ee76606206

Change-Id: Ic09c38e919a1d1d12308504b4cbe2d388b94c42d
2019-03-01 02:30:19 -08:00
Josh Gao b67e5cd91d Merge changes I4d351f56,Ib9e91157 am: 7669ea5a44 am: 68f136b407
am: a7140a1222

Change-Id: I403b2d6c59dcc16a8853ffccdc40eba5984699f4
2019-03-01 02:29:03 -08:00
Josh Gao b530537d46 Merge "adbd: fix a case where we can fail to join a thread." 2019-03-01 10:16:46 +00:00
Josh Gao 5841a96afc adbd: tune USB read/write sizes and queue depths.
Reduce the operation sizes to sizes that are small enough that the
kernel will run the OOM killer to try to make them succeed. Compensate
for the smaller operation sizes by increasing the queue depth.

Bug: http://b/126582877
Test: benchmark_device.py
Change-Id: I4d351f56c8f83fea882614238cc3fec8ba1e9bf9
2019-02-28 15:53:48 -08:00
Josh Gao b416f2252e adb: add benchmarks for sink/source.
Test: ./benchmark_device.py
Change-Id: Ib9e911574be3afa94efcfd9bc5be0a5cf7b9e2c0
2019-02-28 15:53:48 -08:00
Josh Gao e778b3ad71 adbd: fix a case where we can fail to join a thread.
Bug: http://b/126703621
Change-Id: I3061d24bbdc154ebf1f9e3f5a903f01382fa518f
2019-02-28 13:53:24 -08:00
Josh Gao ae084ea9e4 Merge "adbd: limit the sizes of aio writes." am: 50cb647e7d am: c423d790b7
am: 57ba09aea9

Change-Id: Ib6c09a5dbddea768eed6fa4570067c4d8bb42045
2019-02-27 23:43:03 -08:00
Josh Gao 02e94a4f76 Revert "Revert "adbd: switch the default USB implementation.""
This reverts commit 0d780391a1.

Reason for revert: cause for original revert probably fixed by https://android-review.googlesource.com/c/platform/system/core/+/914673

Change-Id: I9a7eead54fca3a1a9dfd93f650f01c056d39339e
2019-02-28 07:26:20 +00:00
Josh Gao 50cb647e7d Merge "adbd: limit the sizes of aio writes." 2019-02-28 07:25:21 +00:00
Josh Gao 86b33be035 adbd: limit the sizes of aio writes.
The kernel does a kmalloc of the write size for each write during
io_submit, which can lead to failure if the kernel's heap is fragmented
such that it can't allocate a contiguous 1MB chunk. Partition writes
into 16 page chunks which are much more likely to succeed.

Bug: http://b/126582877
Test: test_device.py
Change-Id: Ib2d48561594e1d81f1a2f62e34eaa40265ac47c4
2019-02-27 15:45:59 -08:00
Dario Freni e2bec0d338 Merge "Support splitAPK in install-multi-package." am: 455f12446e am: a7f85cfeb4
am: 0057231d1b

Change-Id: I77ea80c87044c8b532b2eb84a36093366db8020f
2019-02-27 11:40:41 -08:00
Dario Freni 455f12446e Merge "Support splitAPK in install-multi-package." 2019-02-27 19:00:14 +00:00
Josh Gao 7975e1812d Merge "Revert "adbd: switch the default USB implementation."" am: c2970282cb am: b7d775866c
am: 093d5c34a5

Change-Id: I70c93faf116d9acdaf9852d286ecc64e87ecc05c
2019-02-26 14:39:12 -08:00
Josh Gao c2970282cb Merge "Revert "adbd: switch the default USB implementation."" 2019-02-26 22:15:40 +00:00
Josh Gao 0d780391a1 Revert "adbd: switch the default USB implementation."
This reverts commit 12f328489b.

Reason for revert: possibly causing b/126388431

Change-Id: Ida7c30a92f552f923f3bcb153d945d58ebbc4257
2019-02-26 22:10:33 +00:00
Josh Gao 0537179493 Merge changes I86c3ec0f,I57d1a30a,Ib50d289b,I791a4f82,I316a8799, ... am: 216d158daf am: ff7b56f917
am: d575bc93a5

Change-Id: I610dd6851e7725c45fd64875eef758175fb19b0b
2019-02-26 13:30:18 -08:00
Josh Gao 216d158daf Merge changes I86c3ec0f,I57d1a30a,Ib50d289b,I791a4f82,I316a8799, ...
* changes:
  adb: switch sockets.cpp to ConsumePrefix.
  adbd: switch abb to ConsumePrefix.
  adb: increment server version.
  adb: wait for device to disconnect upon `adb root`.
  adb: implement wait-for-disconnect.
  adb: tell the client what transport it received.
  adbd: switch daemon/services to ConsumePrefix.
  adb: switch host_service_to_socket to string_view.
  adb: switch handle_host_request to string_view.
  adb: switch adb_io.h to string_view.
  adb: add helper to consume a prefix on a string_view.
  adb: make ParseUint reject garbage at the end by default.
2019-02-26 20:55:19 +00:00
Josh Gao 88c3bd5c83 Merge "adbd: switch the default USB implementation." am: 5782600271 am: 269ef5d068
am: d4c49c4b44

Change-Id: I85adc4e8d270a6c71dbd0266ba330df6c37b2faf
2019-02-26 01:21:38 -08:00
Josh Gao 5782600271 Merge "adbd: switch the default USB implementation." 2019-02-26 06:47:46 +00:00
Alex Buynytskyy 04bcfcb380 Merge "Adding EXEC version of calling ABB." am: e257772bb2 am: b590a59bc4
am: 5c18315e47

Change-Id: I5bdfd0ceb489b28954bf49dbf08390460b70393d
2019-02-25 19:27:59 -08:00
Julien Desprez 4306ad0096 Merge "Temporarily @ignore test_reconnect" am: 9bfa166ad9 am: 84d796dac4
am: b1687ed7e3

Change-Id: Ieec56ca6069294770c1d0303d466a2d67fbf9e2c
2019-02-25 15:28:52 -08:00
Josh Gao 43f3805950 adb: switch sockets.cpp to ConsumePrefix.
Test: mma
Change-Id: I86c3ec0fd90fe45e59c0187f664d46020bad2c0f
2019-02-25 13:59:00 -08:00
Josh Gao ccc584523a adbd: switch abb to ConsumePrefix.
Test: mma
Change-Id: I57d1a30a526c97c5b5a2718740b76220da6eea39
2019-02-25 13:59:00 -08:00
Josh Gao aa4f31a124 adb: increment server version.
Increment the server version for adb_connect with transport id, and
wait-for-disconnect.

Bug: http://b/124244488
Test: none
Change-Id: Ib50d289b68fce4befbf1f5d9507d7e6f9cc1f4f5
2019-02-25 13:59:00 -08:00
Josh Gao 2020dd6f2e adb: wait for device to disconnect upon `adb root`.
Previously, there was a race where if adb root took longer than 3
seconds to take effect, we'd return early and allow subsequent commands
to be targeted at the still-not-dead transport, and spuriously fail.

Bug: http://b/124244488
Test: test_device.py
Change-Id: I791a4f82946eb28e4d37729ab0ed3b7fc05b42a2
2019-02-25 13:59:00 -08:00
Josh Gao 1e9e471c9c adb: implement wait-for-disconnect.
Bug: http://b/124244488
Test: manual
Change-Id: I316a87994924c51c785e46a4900380c58e726985
2019-02-25 13:59:00 -08:00
Josh Gao 79797ecbb1 adb: tell the client what transport it received.
Prerequisite for making `adb root` wait for the device that it told to
restart to disappear: the client needs to know which transport to wait
on.

Bug: http://b/124244488
Test: manual
Change-Id: I474559838ad7c0e961e9d2a98c902bca3b60d6c8
2019-02-25 13:49:25 -08:00
Josh Gao 2df76b7ee7 adbd: switch daemon/services to ConsumePrefix.
Test: mma
Change-Id: Ib4bb7d3352219a9883a5089e08225fb17145c2ee
2019-02-25 13:49:25 -08:00
Josh Gao 0ecc4020d6 adb: switch host_service_to_socket to string_view.
Test: manual
Change-Id: I09b83cc82edb10c1a51ecc5ebb8d9fe5294222c3
2019-02-25 13:49:25 -08:00
Josh Gao 769f853f96 adb: switch handle_host_request to string_view.
Test: test_adb.py
Test: test_device.py
Change-Id: Ideae5262a6dff2e27c50f666144d48f874837290
2019-02-25 13:49:25 -08:00
Josh Gao 342b661e81 adb: switch adb_io.h to string_view.
Test: mma
Change-Id: Ifa16502bac18429491426c45ece562657cff1689
2019-02-25 13:49:25 -08:00
Josh Gao ac8da2a7df adb: add helper to consume a prefix on a string_view.
It's error-prone to manually writing code of the following form:

  if (foo.starts_with("some_prefix:")) {
    foo.remove_prefix(strlen("some_prefix:"));
  }

Add a helper to do that for us.

Test: mma
Change-Id: I5df391deba8b6c036fcbf17a1f1c79af8d9abd2b
2019-02-25 13:49:25 -08:00
Josh Gao aeca208385 adb: make ParseUint reject garbage at the end by default.
Test: adb_test on host
Change-Id: Ie63d89bd08f0b296a3d54ff66aae85fe52d8cd0f
2019-02-25 13:49:25 -08:00
Dario Freni 6dc6157bc8 Support splitAPK in install-multi-package.
Fix: 125342787
Test: adb install-multi-package file1.apex
base.apk:split1.apk:split2.apk (and also the non-split version)

Change-Id: I3d5ee2504b6d1e4f7ae555586960b61a2e1e9680
2019-02-25 12:10:31 +00:00
Alex Buynytskyy 05626c18af Adding EXEC version of calling ABB.
This is corresponding to exec: command of adb and allows for simplifed calls
to binder without shell protocol.

Bug: 111621042
Test: manual

Change-Id: Id6935cd53e351388ecf6d2d15f3a204cb871536a
2019-02-23 06:15:03 +00:00
Julien Desprez 9bfa166ad9 Merge "Temporarily @ignore test_reconnect" 2019-02-21 18:16:21 +00:00
Josh Gao 7fff457b18 Merge "adb: update symlink timestamps." am: effcb96670 am: c8f34c7920
am: 11b95b8d93

Change-Id: Iea203261dd8d49023ae7b446ec9ebd0f75edec80
2019-02-20 18:52:09 -08:00
Josh Gao effcb96670 Merge "adb: update symlink timestamps." 2019-02-21 02:31:03 +00:00
Josh Gao 7b1cb66a83 adb: update symlink timestamps.
Bug: http://b/120162375
Test: adb sync; adb shell touch -h -d 2008-01-0101:01:01 /system/bin/ls; adb sync; adb sync
Change-Id: Iedf54528b164913739c66c71d20006e484a4f5e4
2019-02-20 13:17:56 -08:00
Julien Desprez fb4c13500f Temporarily @ignore test_reconnect
For the purpose of on-boarding all the other tests,
skip test_reconnect for now.

Test: atest -v adb_integration_test_adb
Bug: 123247844
Change-Id: I50269272adbfc3f946d71bae13677546566d541f
2019-02-20 09:42:49 -08:00
Josh Gao 3dd004fd00 Merge "adbd: log when exiting due to root/unroot/tcpip/usb." am: de3c3e8c76 am: 2eaddf6183
am: b78556b277

Change-Id: I6a6dd3807d24a450130efc8dfa63ce1c9b672e70
2019-02-20 04:22:32 -08:00
Josh Gao 24cfc7b5d5 Merge changes from topic "base_cmsg" am: 8954d0bc98 am: b1ca42ae28
am: 8f1cbd47fe

Change-Id: Iadf654700aac1a2892536c262f0fe6203c9beab1
2019-02-19 14:13:18 -08:00
Josh Gao a80b64f2a0 adbd: log when exiting due to root/unroot/tcpip/usb.
Test: treehugger
Change-Id: Ibfbe4d512c6e126f2e6d311867316f033a4c9ab7
2019-02-19 13:12:59 -08:00
Josh Gao 8954d0bc98 Merge changes from topic "base_cmsg"
* changes:
  adb: switch to base::{Send,Receive}FileDescriptors.
  debuggerd: switch to base::{Send,Receive}FileDescriptors.
  base: add helpers for sending/receiving file descriptors.
2019-02-19 20:53:01 +00:00
Josh Gao fb45030cad Merge "adbd: fallback to legacy USB implementation if needed." am: f80c326d2e am: dc50e92b71
am: 8b47738b0a

Change-Id: I3d8e50a4168232ae0367e7bcaf5ac670daa24e69
2019-02-16 20:30:03 -08:00
Josh Gao f80c326d2e Merge "adbd: fallback to legacy USB implementation if needed." 2019-02-17 04:14:22 +00:00
Josh Gao 586a681dbf Merge "base: add ScopedLockAssertion." am: 3777d9cc10 am: 379b6f403f
am: f01d33b9e8

Change-Id: If81cf0d25621d6f733b39823d6b6dbc774a37150
2019-02-15 18:47:40 -08:00
Josh Gao 12f328489b adbd: switch the default USB implementation.
Switch to the nonblocking FFS implementation that fixes several race
conditions on connect/disconnect.

Test: treehugger
Change-Id: I91fdb9b27152078cb38e610861a05f1fa95aa3a2
2019-02-15 11:43:49 -08:00
Josh Gao c0b831bb81 adbd: fallback to legacy USB implementation if needed.
Detect kernels that don't support AIO on functionfs endpoints and fall
back to the old legacy implementation.

Test: treehugger
Change-Id: Ice28dcd40c9730ac2dd5e468d065b41c0e076146
2019-02-15 11:43:49 -08:00
Josh Gao 8e0af5f1b5 adb: switch to base::{Send,Receive}FileDescriptors.
Test: test_device.py
Test: adb abb package list packages
Change-Id: I080dc8620d77b0e6144c895fd2a0cbf7b8063c53
2019-02-13 13:21:54 -08:00
Josh Gao 982f7bd345 base: add ScopedLockAssertion.
This is a useful helper for anyone that's using thread safety
annotations alongside std::condition_variable, extract it from adb and
move it to libbase.

Test: mma
Change-Id: Ic51e2f2a0e6a16628034b29d8ff32bf2155afccd
2019-02-12 16:32:35 -08:00
Josh Gao ec30852d8d Merge "adb: "support" O_CLOEXEC in adb_open on Windows." am: 9c4fda6cd2 am: c1f4e167b6
am: e90e12de63

Change-Id: Ie2952b103020716afebadfaa13ecd593ed671117
2019-02-07 23:11:42 -08:00
Treehugger Robot 9c4fda6cd2 Merge "adb: "support" O_CLOEXEC in adb_open on Windows." 2019-02-08 06:56:47 +00:00
Josh Gao cefb432500 Merge "adb: hopefully deflake test_adb.py." am: 151499e47e am: ad68f429ca
am: 001adec269

Change-Id: Ifb02659531eae0b7aaadb3b54bb8d02e33b2295c
2019-02-07 22:02:57 -08:00
Josh Gao aa95aa063f adb: hopefully deflake test_adb.py.
The reconnection test is spuriously failing on test infrastructure for
unclear reasons, which might be due to a race between the connection
attempt and the first command we send. Insert a sleep to hopefully
reduce the flakiness.

Bug: http://b/123247844
Test: ./test_adb.py (but it didn't fail for me in the first place)
Change-Id: Ic36924c16bae424accfec700af4623794fd1f123
2019-02-07 17:53:29 -08:00
Josh Gao 4b019a5f25 adb: "support" O_CLOEXEC in adb_open on Windows.
Previously, we were rejecting the flag and failing with EINVAL. File
handles aren't inherited by default, so just ignore the flag.

Bug: http://b/123753498
Test: adb install --streaming foo.apk
Change-Id: I17401fcdd58024956d47a5c4c0c57b06831d9817
2019-02-07 14:23:39 -08:00
Josh Gao e3a16ff9df Merge changes I1abd671f,I9ae61465 am: 0220ca7d09 am: 3839ff3bf9
am: e6c5224c7c

Change-Id: Ib2f76aeb430b487fd3a379fb3c9ccd91c7c5e31b
2019-02-01 14:10:10 -08:00
Josh Gao 74b7ec72f8 adb: don't close sockets before hitting EOF.
Reimplement commit ffc11d3cf3 using
fdevent. The previous attempt was reverted because we were blindly
continuing when revents & POLLIN == 0, which ignored POLLHUP/POLLERR,
leading to spinloops when the opposite end of the file descriptor was
shutdown when we had no data left to read.

This patch reimplements the functionality implemented by that commit
using fdevent, which gets us detection of spin loops for free.

Bug: http://b/74616284
Test: ./test_device.py
Change-Id: I1abd671fef4c29e99dad968aa66bb754ca382578
2019-01-31 23:36:41 -08:00
Josh Gao 1a90118bbb adb: implement fdevent_set_timeout.
Test: adb_test
Change-Id: I9ae61465617b6a2fe0a1c161ad88c4feae49ec80
2019-01-31 23:36:41 -08:00
Josh Gao 41b2e6f282 Merge changes If8747ba1,Id1943ebd am: 69ba5179f4 am: a2e6417840
am: b890b1acd2

Change-Id: I6f82b8a5e5d2a3bccb75ae0cb8f5ad94884ff9cf
2019-01-31 13:52:33 -08:00
Josh Gao 69ba5179f4 Merge changes If8747ba1,Id1943ebd
* changes:
  adb: improve network_connect error messages.
  adbd: fix TCP bind address.
2019-01-31 21:19:45 +00:00
Tom Cherry 5f174d3649 Merge "Add android::fs_mgr namespace for new Fstab code" am: 54ea49ba05 am: 0bc62d5680
am: 0dec9106c3

Change-Id: I7fd5d3927dde907a7dbf8ad47325c3a9c5819d0d
2019-01-31 12:23:54 -08:00
Tom Cherry 54ea49ba05 Merge "Add android::fs_mgr namespace for new Fstab code" 2019-01-31 19:35:54 +00:00
Josh Gao 4a7704cd76 Merge changes Ief3dbf8e,Ib06e6f65 am: ee0e63f71d am: 12ac0c75ac
am: f4a35a0ec6

Change-Id: I74478f32beb3cc5014f90740f3a8838f67b7cd6b
2019-01-31 01:29:29 -08:00
Josh Gao ee0e63f71d Merge changes Ief3dbf8e,Ib06e6f65
* changes:
  adb: add fdevent callback that passes the fdevent.
  base: don't overwrite errno in unique_fd::~unique_fd.
2019-01-31 09:09:12 +00:00
Jiyong Park 7b9a913497 Merge changes from topic "move_bionic_to_apex3" am: a15f385821 am: 90b7095cf5
am: 7ce93d2d0d

Change-Id: I670493883a18e604bb3cbc80979c76d0a725c0ef
2019-01-30 21:30:28 -08:00
Treehugger Robot a15f385821 Merge changes from topic "move_bionic_to_apex3"
* changes:
  Handle adb sync with Bionic under /bionic
  Proper mount namespace configuration for bionic
2019-01-31 04:46:49 +00:00
Tom Cherry a3530e6366 Add android::fs_mgr namespace for new Fstab code
Should have been done a while ago, but better late than never.

Test: treehugger
Change-Id: I0ea6e8d459cd3f3b3ce2d00a7a6a9786d52c52dd
2019-01-30 20:20:05 -08:00
Josh Gao c162c713ef adb: add fdevent callback that passes the fdevent.
This is useful for when we don't want to actually store the fdevent
into a separate struct to be able to destroy it, but instead want to
destroy it immediately from the callback.

Test: adb_test
Change-Id: Ief3dbf8ea6a6bd72dc7e73f9ab9b7429e48fc181
2019-01-30 15:18:56 -08:00
Josh Gao 64e597a62f adb: improve network_connect error messages.
Test: manual
Change-Id: If8747ba1951d3c87561fbd3fb4968821243b2ee2
2019-01-30 14:54:10 -08:00
Josh Gao eb0875db65 adbd: fix TCP bind address.
The switch to socket_spec_listen broke adbd over TCP, because
socket_spec_listen only listens on localhost.

Bug: http://b/123592649
Test: manual
Change-Id: Id1943ebd7f0059db05ad756fe96189c60ebde337
2019-01-30 14:49:20 -08:00
Dario Freni a7be4fd34f Merge "Fix: Propagate cmd args to multi-package sessions." am: 2dc8b4cec8 am: f5a2df770b
am: e03d955c62

Change-Id: I4409db1d4dd0eb6223c00532e0469303a7f6afe4
2019-01-30 14:08:35 -08:00
Dario Freni a2f3f9558f Fix: Propagate cmd args to multi-package sessions.
Test: adb install-multi-package --staged file1.apk file2.apk. Verified
that --staged is propagated.
Bug: 118865310
Change-Id: I59cd5c49b4a60ab7bf7481732cd3bd3205820d7a
2019-01-30 16:40:02 +00:00
Jiyong Park 7c7189c469 Handle adb sync with Bionic under /bionic
Background:
We now have two sets of Bionic: the bootstrap Bionic which is at
/system/{lib|bin}/bootstrap for early processes and the default Bionic
which is from the runtime APEX for all the others. In order to give the
same path for Bionic to both categories of processes, the init prepares
two mount namespaces and bind-mount appropriate Bionic files onto the
common mount points under /bionic. For example,
/system/bin/bootstrap/linker is bind-mounted to /bionic/bin/linker for
the early processes. Likewise, /apex/com.android.runtime/bin/linker is
bind-mounted to the same path for rest of the processes.

In addition, in order not to propagate mount events in one mount
namespace to the other namespace, /bionic itself is created as a mount
namespace (via self bind-mount) and its propagation type is set to
private.

Changes required:
This however requires some adjustments to adb sync and remount
mechanism.

For remounting, /bionic path should also be re-mounted for RW, because
it is a RO mount in the beginning. This remounting is done only for the
system-as-root devices where entire / can be re-mounted as RW.

For synching, the sync thread creates a temporary mount namespace where
there is no bind-mount. This ensures that a path that the thread handles
is pointing to the correct file that is expected from the client side.

In addition, push operation to /bionic path is done without unlinking.
This is required because the mount points under /bionic are gone in the
current mount namespace but are still active in other mount namespaces.
If unlinked, the existing mounts on the path are all silently removed.
In order to prevent the unwanted situation, the moint points are not
unlinked but truncated to 0. This however is not a significant problem
because the files that serve as mount points do not carry any
useful information (i.e. the content is meaningless).

Bug: 879416
Test: adb sync
adb push <random_file> /bionic/bin/linker64
adb push <random_file> /system/bin/bootstrap/bin/linker64
system/core/fs_mgr/tests/adb-remount-test.sh
Change-Id: Id87dc9ee7ec5c43d06b54969b55e2cb394329317
2019-01-30 19:18:22 +09:00
Josh Gao 71b815f797 Merge "adb: turn off fastdeploy." am: 82f0e7dad8 am: 90aadf880d
am: a3de92be6c

Change-Id: I260480c896f890f67818b85a5916a1a9057a33bf
2019-01-29 16:42:58 -08:00
Josh Gao 82f0e7dad8 Merge "adb: turn off fastdeploy." 2019-01-29 23:50:07 +00:00
Josh Gao 287e442dc4 adb: turn off fastdeploy.
The PDK doesn't have frameworks/base, so having a dependency from adb to
a library in there breaks the build. #ifdef out fastdeploy until we
figure out what we're going to do here, to unbreak the PDK build.

Bug: http://b/118782743
Test: treehugger
Change-Id: I638cf09e5013935e112c7a57dae0e7e94e1a4680
2019-01-29 11:21:15 -08:00
Tom Cherry ab66380469 Merge "Remove the rest of users of the old style fstab" am: 286684f835 am: 9eaed18adb
am: cd12736426

Change-Id: I86c21f222595ba43068c20edd95582c66b1d4d15
2019-01-29 00:50:04 -08:00
Greg Kaiser 7beedaf0a5 Merge "adb: Fix incorrect logging statement" am: 32aaba6dcf am: d13559092c
am: c5ba3e1014

Change-Id: If4e5a98de613f84d14b74b7307865ec42f217d3d
2019-01-28 22:18:26 -08:00
Treehugger Robot 286684f835 Merge "Remove the rest of users of the old style fstab" 2019-01-29 00:29:09 +00:00
Tom Cherry b688d917cd Remove the rest of users of the old style fstab
And deprecate one more old style function that is not used after this
change.

Test: boot, disable and enable verity
Change-Id: Id509f479850120352b4ea4dc3b6c40f6e8e2e53e
2019-01-28 12:34:33 -08:00
Greg Kaiser fdb9800fcc adb: Fix incorrect logging statement
We were logging "fd.get()" after we had already done a
"std::move(fd)".  That won't log the value we were hoping for.
We instead cache the file descriptor value in a local int prior
to the move(), and log that.

Test: TreeHugger
Change-Id: I715874ac63329280ffb55881fb2590fb31dc2457
2019-01-28 06:17:44 -08:00
Cody Schuffelen 6dbf6a491c Merge "Add native vsock support to ADB." am: d290bb7ed8 am: 8435ddc499
am: 00a8d2693f

Change-Id: I5fc12d468a710dcca271ba1f03b6a939675b1cb2
2019-01-25 21:45:32 -08:00
Treehugger Robot d290bb7ed8 Merge "Add native vsock support to ADB." 2019-01-26 05:25:28 +00:00
Cody Schuffelen a05b64d432 Add native vsock support to ADB.
vsock is a socket address family for communicating into and out of
virtual machines. Addresses have a port and CID. The CID is unique to
each virtual machine on the computer. The VM host always has CID 2.
http://man7.org/linux/man-pages/man7/vsock.7.html

Inside the android guest, the adb daemon hosts a vsock server with
VMADDR_CID_ANY, automatically using the guest CID. The adb server
can now connect to addresses of the form vsock:cid:port, where the CID
must be specified and the port defaults to 5555.

This is a significant speed improvement for ADB connections in
Cuttlefish, with 150-200 MB/s for `adb push` and 100-150 MB/s for
`adb pull`. It also allows removing some proxying steps from Cuttlefish,
simplifying the full connection path, and removes a dependency on the
unstable ivshmem protocol.

Commands tested against a Cuttlefish VM with CID 3:
adb connect vsock:3:5555
adb -s vsock:3:5555 shell
adb disconnect vsock:3:5555

Supporting "adb disconnect" and "adb -s" required modifying some of the
parts that parse addresses / serials.

push/pull trials with native adb vsock support in cuttlefish:

100m: 1 file pushed. 297.6 MB/s (104857600 bytes in 0.336s)
100m: 1 file pushed. 270.3 MB/s (104857600 bytes in 0.370s)
100m: 1 file pushed. 271.7 MB/s (104857600 bytes in 0.368s)
100m: 1 file pushed. 250.5 MB/s (104857600 bytes in 0.399s)
100m: 1 file pushed. 277.1 MB/s (104857600 bytes in 0.361s)
100m: 1 file pushed. 263.5 MB/s (104857600 bytes in 0.379s)
100m: 1 file pushed. 242.6 MB/s (104857600 bytes in 0.412s)
100m: 1 file pushed. 271.8 MB/s (104857600 bytes in 0.368s)
100m: 1 file pushed. 267.1 MB/s (104857600 bytes in 0.374s)

/data/local/tmp/100m: 1 file pulled. 212.8 MB/s (104857600 bytes in 0.470s)
/data/local/tmp/100m: 1 file pulled. 236.7 MB/s (104857600 bytes in 0.423s)
/data/local/tmp/100m: 1 file pulled. 201.2 MB/s (104857600 bytes in 0.497s)
/data/local/tmp/100m: 1 file pulled. 255.6 MB/s (104857600 bytes in 0.391s)
/data/local/tmp/100m: 1 file pulled. 199.6 MB/s (104857600 bytes in 0.501s)
/data/local/tmp/100m: 1 file pulled. 214.6 MB/s (104857600 bytes in 0.466s)
/data/local/tmp/100m: 1 file pulled. 254.2 MB/s (104857600 bytes in 0.393s)
/data/local/tmp/100m: 1 file pulled. 212.5 MB/s (104857600 bytes in 0.471s)
/data/local/tmp/100m: 1 file pulled. 218.9 MB/s (104857600 bytes in 0.457s)
/data/local/tmp/100m: 1 file pulled. 223.6 MB/s (104857600 bytes in 0.447s)

Bug: 121166534
Change-Id: I50f21fb5c9acafb8daa789df4e28c9e1bbbbf2ef
Test: adb connect/shell/disconnect
2019-01-25 17:55:06 -08:00
Josh Gao 6bbd3ff7ff Merge "adb: convert more stuff to unique_fd." am: 79f60a9bab am: 7dcb91cbc8
am: 60df9ecb5e

Change-Id: I5fdd7ad01021fe0670bfb58b83bc6f42e97768f2
2019-01-25 14:12:10 -08:00
Josh Gao db956ccb48 Merge "adbd: compile for host." am: b42946a6d3 am: 134576deba
am: 4162be2090

Change-Id: I29e1f100ba8990ca4d003343c73fc97f59a8b61f
2019-01-24 14:33:36 -08:00
Josh Gao 74ccdf984b adb: convert more stuff to unique_fd.
Test: adb_test
Test: adbd_test
Test: test_device.py
Change-Id: Ie75f0b811d2c75d508e6ecffb40579308f5789d0
2019-01-23 17:11:13 -08:00
Henry Daitx 6a7b8f736f Merge "Fix fastdeploy failure in Windows" am: 09158b1d5a am: 9ac57ceae7
am: 9875bcd839

Change-Id: Ic49cf28ad437b6269d2c35920f48970b8db38c1b
2019-01-23 13:37:29 -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
Henry Daitx 09158b1d5a Merge "Fix fastdeploy failure in Windows" 2019-01-23 20:52:01 +00:00
Michael Groover 5f9db7dcf9 Merge "Notify framework on adb disconnect" 2019-01-23 16:47:48 +00:00
Henry Daitx f788f67c23 Fix fastdeploy failure in Windows
adb --fastdeploy creates a TemporaryFile to which the stdout for a shell
command is redirected. This happens while the file is still open (the
TemporaryFile object holds the file handle). In Linux this works, but
Windows blocks the operation with an error of "The process cannot access
the file because it is being used by another process".

This change closes the file before the shell tries to write to it.

Test: mm -j 72
Test: adb install --fastdeploy --force-agent --local-agent /mnt/raid/boat-attack-apk/boat-attack-swappy.apk

Bug: 122592986
Change-Id: Iaaaf62cda43e4714d7f979e6a690549b383a7b82
2019-01-23 11:00:45 +00:00
Josh Gao 54d1e31c63 Merge "adb: win32: improve console output on Windows 10" 2019-01-23 03:59:27 +00:00
Josh Gao 89a6fdc4b3 Merge "adb: win32: LinePrinter Unicode support" 2019-01-23 03:47:21 +00:00
Michael Groover 3857dead17 Notify framework on adb disconnect
Bug: 111656592
Test: atest AdbDebuggingManagerTest
Change-Id: I84f0b076799b0628663fde1a14609bc71c5a9ed3
2019-01-22 13:12:32 -08:00
Alex Buynytskyy 01a65eebbf Adding new feature to adb "abb".
It will allow clients to detect if abb is supported.

Test: manual
BUG: 111621042

Change-Id: Ifddabe49214882a6c6ad898c7e2a0f5cc92458d8
2019-01-18 21:45:02 +00:00
Cody Schuffelen 539c4d427b Merge "Combine tcp_connect and socket_spec_connect." 2019-01-18 02:28:50 +00:00
Cody Schuffelen af0e220fb1 Combine tcp_connect and socket_spec_connect.
This will make it easier to add new types of transports by combining the
logic the adb server and adb daemon use to connect to things.

Bug:121166534
Test: adb connect against a cuttlefish instance over the shm proxy.
Change-Id: Ic7fc848c60a85eef968c3735838c87cb7fdaf38b
2019-01-17 15:58:41 -08:00
Treehugger Robot b42719bcd3 Merge "Disable dexpreopt for deployagent" 2019-01-17 21:13:35 +00:00
Henry Daitx 05af6aef82 Disable dexpreopt for deployagent
platform-tools/deployagent.jar is built incorrectly for userdebug sdk
builds (which the build machines in android-build use). In eng builds
dexpreopt is disable by default, so the file is built correctly.

This change disables dexpreopt for deployagent in all builds, for
consistency.

Bug: 122831369

Test: lunch sdk-eng
Test: make sdk
Change-Id: I370f0536d906690b153f114ba3dd589a14d222d4
2019-01-17 16:24:52 +00:00
Dario Freni bc54c3670f Multi-package support for APEX.
This CL introduces two changes to adb install-multi-package:
- If there is at least one apex package in the list of packages, use the
  --staged parameter for both the parent and the child sessions
- When the package being sent is an apex, use the --apex parameter

Bug: 118865310
Test: Printed out the resulting commands and verified that both
non-staged and staged workflow are accepted by PackageManager. Tried
scheduling install sessions for a mix of APK/APEX, only APKs, only APEX.
Change-Id: I8d1a6a7c5408fb95c10d79e38ddaf115a46f5d8b
2019-01-16 21:59:34 +00:00
Treehugger Robot 6410fd2434 Merge "adb: switch install to unique_fd." 2019-01-16 05:45:26 +00:00
Treehugger Robot e5f61a9bcd Merge "Admit that there's more `adb install` help available." 2019-01-12 06:21:31 +00:00
Josh Gao 61f872f2a8 adb: switch install to unique_fd.
Test: mma
Change-Id: I9474c003e0eb4a8cb183090a2e525d78932d3bea
2019-01-11 13:57:36 -08:00