Commit graph

3086 commits

Author SHA1 Message Date
Josh Gao
2ad4c3696f adb: win32: silence wine test failure.
Wine implements sockets with their own internal socketpair, which
results in the poll disconnect test failing.

Bug: http://b/117568356
Test: wine adb_test.exe
Change-Id: Icd2a94f8297fefd5c02e6517568fe288b168032c
2019-07-16 15:22:51 -07:00
Josh Gao
efd8ae2d54 adb: win32: fix adb_test.
At some point between Q and master, adb_test.exe stopped working because
it wasn't being linked with -municode?

Test: wine adb_test.exe
Change-Id: I6c20f3b3241cee2052d31d1ca85b8a9738828f6e
2019-07-16 15:21:59 -07:00
Josh Gao
88d23135d2 Merge changes from topic "fdevent_refactor"
* changes:
  adb: fdevent: extract Add/Del/SetTimeout.
  adb: fdevent: extract Create/Destroy from fdevent_context_poll.
  adb: fdevent: move TerminateLoop to fdevent_context.
  adb: fdevent: move CheckMainThread logic to fdevent_context.
  adb: fdevent: delete FDE_CREATED.
  adb: fdevent: move run queue to fdevent_context.
  adb: implement fdevent_reset by constructing a new context.
  adb: move fdevent implementation out to a separate file.
  adb: de-globalize fdevent context.
  adb: move fdevent to its own folder.
  adb: add superfluous include.
2019-07-09 20:02:29 +00:00
Justin Yun
5d0ac62995 Rename product_services to system_ext
Update adb, fastboot and mount point

Bug: 134359158
Test: build and check if system_ext.img can be flashed
Change-Id: I6219f72242c5fe42a508008c0b1fd218d74da5b6
2019-07-09 08:56:53 +00:00
Josh Gao
35b29360a2 adb: fdevent: extract Add/Del/SetTimeout.
Test: adb_test
Change-Id: Ibed301f8de73289837153fdfed370a681c24ac55
2019-07-08 18:32:24 -07:00
Josh Gao
33944a2742 adb: fdevent: extract Create/Destroy from fdevent_context_poll.
Test: adb_test
Change-Id: Ida308e8e281cbb2954277196a51945f124ce5823
2019-07-08 18:32:24 -07:00
Josh Gao
ebaa348d32 adb: fdevent: move TerminateLoop to fdevent_context.
Test: adb_test
Change-Id: Ib1f20aefdb36603e2ceac4197c02551f557056ee
2019-07-08 18:32:24 -07:00
Josh Gao
2c95bf73a5 adb: fdevent: move CheckMainThread logic to fdevent_context.
Test: adb_test
Change-Id: I10b93293af22d54ec739dc0f95c95df3ab082fb6
2019-07-08 18:32:24 -07:00
Josh Gao
e546f6816e adb: fdevent: delete FDE_CREATED.
All fdevents must be created by fdevent_create/fdevent_context::Create
now, so this flag is meaningless.

Test: none
Change-Id: I8489afad07bdb267ddfdb0dbb25d40d3a62f55f6
2019-07-08 18:05:55 -07:00
Josh Gao
95eef6b097 adb: fdevent: move run queue to fdevent_context.
Make the run queue logic reusable between implementations of fdevent by
moving it to the abstract base class.

Test: adb_test
Change-Id: If2f72e3ddc8007304bca63aa75446fa117267b25
2019-07-08 18:05:47 -07:00
Josh Gao
7adca93fe9 adb: implement fdevent_reset by constructing a new context.
Test: adb_test
Change-Id: Ie67afafe2b73fb2a8fc08568560adac6f456eb9a
2019-07-08 17:32:14 -07:00
Josh Gao
95068bbd9a adb: move fdevent implementation out to a separate file.
Test: mma
Change-Id: I8af945b9ae0accac75fa93c538e44cbab357bb5d
2019-07-08 16:03:27 -07:00
Josh Gao
c2cf121174 adb: de-globalize fdevent context.
Test: adb_test
Test: adbd_test
Change-Id: If711257d831b9090b38412821466c1d358d53d2d
2019-07-08 14:37:27 -07:00
Josh Gao
57e09b16ca adb: move fdevent to its own folder.
Preparatory refactoring for platform-specific implementations.

Test: mma
Change-Id: I0f600122ac89241788c5f3300f362fd9ef02ddcd
2019-07-08 14:37:27 -07:00
Josh Gao
2d03ad42ed adb: add superfluous include.
Resolve a merge conflict between internal and aosp by making aosp look
like internal.

Test: none
Change-Id: I7bea6ab61ad45ff20a3d07abf3f73903a7c05585
Merged-In: If73b81ca73ba4d64763cf49c1bbe42de81fa1cb6
2019-07-08 14:37:27 -07:00
Alex Buynytskyy
cc2f124070 Refactorings to match adb_abb to adb_shell code.
Test: Build, flash and boot, use `adb abb` to verify

Change-Id: I30eb6e8a4fd43b1548a9398376c72e2cb31223a4
2019-07-08 18:30:26 +00:00
Josh Gao
d194013097 Merge "adbd: move jdwp listening logic into ART." 2019-06-28 19:01:38 +00:00
Josh Gao
5f2c5bbd04 adbd: move jdwp listening logic into ART.
Test: manually use jdwp
Change-Id: Ia09a5c643cba9ec5f343c9767d43d72b077bc247
2019-06-25 12:37:20 -07:00
Elliott Hughes
12794c039a Merge "Revert "Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND.""" 2019-06-25 05:56:53 +00:00
Elliott Hughes
fab9f30f6f Revert "Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND.""
This reverts commit b00e66f754.

Reason for revert: http://b/135753060

Change-Id: I30f472427f52076b64902420f9538b4a880a2cbe
2019-06-25 05:42:55 +00:00
Josh Gao
2a6ec6c332 Merge "Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."" 2019-06-21 02:36:56 +00:00
Treehugger Robot
ad0f27fe72 Merge "adb: turn CHECKs into an error + transport restart." 2019-06-19 00:11:49 +00:00
Josh Gao
b00e66f754 Reland "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."
Read until we receive FUNCTIONFS_BIND after every USB descriptor setup,
instead of only after initial creation of the control fd, so we properly
handle a rebind caused by a change of the USB configuration.

This reverts commit 55b31933f41b1c550b788fa2054010c51f56111b.

Bug: http://b/133132986
Bug: http://b/135155652
Test: manually enabled/disabled MTP with nonblocking_ffs enabled and disabled
Change-Id: Ibb3f46b8f84854ede47a669a85e07e16a5dd6008
2019-06-18 15:00:15 -07:00
Josh Gao
9dba0f5824 Revert "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND."
We're only reading FUNCTIONFS_BIND on creation upon the first creation
of the control fd, which results in an abort when rebind happens (e.g.
when MTP is enabled) and we unexpectedly read FUNCTIONFS_BIND in the
second instantiation of the connection.

This reverts commit 2b668d3906.

Bug: http://b/135155652
Test: manually enabled MTP
2019-06-14 16:21:21 -07:00
Josh Gao
fc0f80ae49 adb: turn CHECKs into an error + transport restart.
These CHECKs are expected to happen if the client does the wrong thing,
so we probably shouldn't be aborting in adbd.

Bug: http://b/133872605
Bug: http://b/134695864
Test: treehugger
Change-Id: I875b87a06ba9d399db26f8af1ad47ccf34e9445a
2019-06-13 13:16:57 -07:00
Treehugger Robot
cb2352a75d Merge "adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND." 2019-06-12 14:34:14 +00:00
Josh Gao
2b668d3906 adbd: don't close ep0 until we receive FUNCTIONFS_UNBIND.
Rework the functionfs logic to avoid rebinding the USB interface
repeatedly.

Bug: http://b/133132986
Test: treehugger
Change-Id: I7f75874efd197764d40b66800a117ff4726d793b
2019-06-11 20:33:16 -07:00
Josh Gao
e72c44b24a adb: avoid freeing argv entries on Windows.
We assign string literals directly to argv[0], which leads to fun
explosions when we attempt to free  when the runtime can detect that
a bad free happened, which seems to happen reliably with lld.

Bug: http://b/110800681
Test: `adb shell true` on windows
Change-Id: Ica81e472c31686d80b58c41ff6d2b825baef06fb
2019-06-10 12:54:14 -07:00
Tao Bao
8eea2cae86 Merge "adb: Allow adb rescue getprop." 2019-06-05 20:43:55 +00:00
Tao Bao
599eee1f37 adb: Allow adb rescue getprop.
Which will dump all the allowed properties, similar to `adb shell
getprop`.

Bug: 134027350
Test: Run the command under rescue mode.
Change-Id: Id668224098006d71ee192c8c2bea5d791d2423c1
2019-06-04 14:59:58 -07:00
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
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
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
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
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
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
Josh Gao
41531df7b0 Merge "adbd: don't abort on EOF on functionfs control fd." 2019-05-13 18:40:34 +00: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
09070afd38 Merge "Add deprecation warning to adb backup/restore" 2019-05-10 08:40:50 +00: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
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
Treehugger Robot
be9c2c0310 Merge "adb: enable/disable verity expected overlayfs errors." 2019-05-06 14:36:51 +00:00