Commit graph

3024 commits

Author SHA1 Message Date
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
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
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