Commit graph

3551 commits

Author SHA1 Message Date
Yurii Zubrytskyi
063b81599c Merge "[adb] generic "cast_handle_to_int" function" am: a1f41fc6f1 am: 5ce68b0941
Change-Id: Ib7974bf235f0edd40670750a3a6c5c2d67cc00eb
2020-03-27 07:47:11 +00:00
Yurii Zubrytskyi
a1f41fc6f1 Merge "[adb] generic "cast_handle_to_int" function" 2020-03-27 07:03:22 +00:00
Treehugger Robot
7d105291da Merge "adb: fix bugreport status line." am: f225aa3f24 am: cf4f2c9439
Change-Id: I2585a1ff18dff168c67456232d18ee90f0bd0df4
2020-03-27 06:42:53 +00:00
Yurii Zubrytskyi
e3e64b8f54 [adb] generic "cast_handle_to_int" function
Now one can use it without platform #ifdefs

Bug: 150183149
Test: compiles
Change-Id: I6280dcdd2faaff33014f11237d9d04231ac16b82
2020-03-26 22:25:46 -07:00
Josh Gao
82f715b7b5 adb: fix bugreport status line.
The status line char* was getting converted to bool and used as the
compression argument, and the actual status line was defaulting to
nullptr. This didn't actually really change anything, since we only use
the name during transfer, and not for the final message at the end, so
the output is slightly uglier for 50 milliseconds.

This also had the side effect of turning on compression for the
already-compressed bugreport zip, which costs a bit of throughput with
brotli.

Bug: https://issuetracker.google.com/150827486
Test: adb bugreport foo.zip
Change-Id: I74bed9c09442c655a956eb1e8318c0123632ef4c
2020-03-26 21:10:31 -07:00
Josh Gao
9b567bbd6d Merge "adb: implement compression for file sync." am: 4dc73c0b58 am: 1588155e47
Change-Id: I0ff4ddf1286a01ed2faeca7fdabe5d419d7228a8
2020-03-26 21:05:30 +00:00
Josh Gao
4dc73c0b58 Merge "adb: implement compression for file sync." 2020-03-26 20:34:17 +00:00
Josh Gao
939fc19aee adb: implement compression for file sync.
This improves performance when syncing by up to 2x (remote cuttlefish
goes from 11.9 MB/s to 21.3 MB/s, blueline over USB 2.0 from 36 MB/s
to 70 MB/s).

This results in a slight drop in push speeds over USB 3.0 (125 -> 115
MB/s on blueline), presumably because we're compressing and extracting
on only a single thread, but the gains over lower bandwidth transports
make this worth it to submit this now and parallelize later.

Bug: https://issuetracker.google.com/150827486
Test: ADB_COMPRESSION={0, 1} test_device.py (with new/old adbd)
Change-Id: Ic2a0c974f1b6efecda115f87d336e3caac810035
2020-03-26 13:31:32 -07:00
Joshua Duong
dd4ca8a9a1 Merge changes from topic "adbwifi-bugfixes" am: 1e413c8a9d am: b1ce151b34
Change-Id: I1c9b7462db4f2a8082279acabb6e27263006e030
2020-03-26 02:51:51 +00:00
Joshua Duong
1e413c8a9d Merge changes from topic "adbwifi-bugfixes"
* changes:
  Pass the os handle to the tls connection.
  Fix pairing aes_128_gcm key initialization.
2020-03-26 02:16:14 +00:00
Joshua Duong
1b273ed0e3 Pass the os handle to the tls connection.
This fixes the tls connection failure on Windows.

Bug: 150719467

Test: 'adb pair', 'adb connect' on Windows host machine.
Test: atest adb_tls_connection_test
Change-Id: I54b8945543ad8b430510fa51dd7bea64a119454f
2020-03-26 02:16:01 +00:00
Joshua Duong
87c00f8c80 Fix pairing aes_128_gcm key initialization.
Bug: 150719467

Test: atest adb_pairing_auth_test
Test: check 'adb pair' command on all three platforms work
Change-Id: Idfc64fe7bed2d09f4da9d2f7df70f9d6ae4e8fa3
Exempt-From-Owner-Approval: approved in go/ag/10808153
2020-03-26 02:14:48 +00:00
Treehugger Robot
cf8d5f6fef Merge "Revert "Revert "Set apex_available property""" am: 5e4b94d44d am: eccd4aad99
Change-Id: I1ebd28d9edc9da75d1d09075faabe67e721cb209
2020-03-26 01:17:57 +00:00
Treehugger Robot
5e4b94d44d Merge "Revert "Revert "Set apex_available property""" 2020-03-26 00:42:36 +00:00
Jiyong Park
697134d1d4 Revert "Revert "Set apex_available property""
This reverts commit 56a712f6c9.

Reason for revert: forward fix is at aosp/1265379

Exempt-From-Owner-Approval: relanding of an already approved CL

Change-Id: I0d93417939d570ce21f105ee4b3bae6414194dbe
2020-03-26 00:23:56 +00:00
Yurii Zubrytskyi
47a58ecd34 [adb] file sync performance on Windows
Print not more often than once a 100ms - it is smooth enough
and speeds up transfer even more on Windows, where a single
line output may take up to 5ms.
An added benefit is getting rid of some extra heap allocation
and string formatting when in the end the identical message
filtering would've dropped the line anyway. This is also
significantly more expensive on Windows.

Bug: 151900478
Test: manual, push/pull a file and a directory

Change-Id: I9038729e8a01d5f93fd301beaeb8a086f5039b77
Merged-In: I9038729e8a01d5f93fd301beaeb8a086f5039b77
2020-03-24 10:28:24 -07:00
Alex Buynytskyy
8539004821 Adding block kind to protocol for future streaming of a tree.
Bug: b/152050621
Test: adb install --incremental megacity.apk
Change-Id: I0c977080475088bf046a521a85f78595aac994f0
Merged-In: I0c977080475088bf046a521a85f78595aac994f0
2020-03-24 10:28:19 -07:00
Yurii Zubrytskyi
b0fa864cc5 [adb] Print fewer progress messages for push/pull
Windows console IO is terribly slow. Reducing the number of
printed progress messages speeds up the transfer rate
from 80 to 130 MB/s on Windows laptop

Bug: 151900478
Test: adb push/pull
Change-Id: I223284c8a662bd8f2b8ba280cdcc8c930d3e5205
Merged-In: I223284c8a662bd8f2b8ba280cdcc8c930d3e5205
2020-03-24 10:28:14 -07:00
Yurii Zubrytskyi
4eb910e82e [adb] Optimize fdevent machinery
- Use one fewer heap allocation per fdevent object
- Lazy-init the fdevent context

Bug: 151239696
Test: various adb commands on Win/Linux

Change-Id: Ic7de207b30495e618f187e097c0276ad42c34005
Merged-In: Ic7de207b30495e618f187e097c0276ad42c34005
2020-03-24 10:28:08 -07:00
Yurii Zubrytskyi
2488c21d8b [adb] Fix incremental installation on Windows
Use only the syscalls that work with the wrapped ADB fds, or
extract the native handles for the case when need to call one
not wrapped.

Bug: 151239696
Test: adb install --incremental <apk> on Windows
Change-Id: Ia6de620171ab696b8136dcb60a2b63af6f86419f
Merged-In: Ia6de620171ab696b8136dcb60a2b63af6f86419f
2020-03-24 10:28:03 -07:00
Songchun Fan
c3eb3014f6 [adb incremental] send priority blocks first
Before this change, "Success" is returned after all data is streamed,
around 7.5 seconds for Megacity.

After this change, "Success" is returned in about 1.5 seconds, before
streaming finishes.

BUG: 151676293
Test: manual
Change-Id: Ifda7de48da8e82623c99ae0194f70cb162fd72fa
Merged-In: Ifda7de48da8e82623c99ae0194f70cb162fd72fa
2020-03-24 10:27:56 -07:00
Songchun Fan
23bd5529c1 [adb data server] wait for installation results before terminates
Currently the server often quits before installation finishes. As a
result, there is no difference in the commandline output between a
successful installation and a failed one.

Let adb client wait till installation fails or succeeds by parsing the
output from the inc-server process.

Test: $ adb install --incremental ~/Downloads/base.apk
Test: Performing Incremental Install
Test: Serving...
Test: All files should be loaded. Notifying the device.
Test: Failure [INSTALL_PARSE_FAILED_NOT_APK: Failed to parse /data/app/vmdl749343150.tmp/base.apk: Failed to load asset path /data/app/vmdl749343150.tmp/base.apk]
Test: Install command complete (ms: 91 total, 0 apk prep, 91 install)

BUG: b/150865433
Change-Id: Ie33505f9cc08fc6d60ad4a5d709526e7aa9a0ad1
Merged-In: Ie33505f9cc08fc6d60ad4a5d709526e7aa9a0ad1
2020-03-24 10:27:47 -07:00
Alex Buynytskyy
eebf9f7670 Implement the new v4 signing scheme in adb
To be submitted along with changes in apksigner tool and the framework.
Merged to AOSP after that.

Test: adb install --incremental <apk>

Bug: b/151241461
Change-Id: I26e187f8e389e31e2759037057b96fc6c9cb1e94
Merged-In: I26e187f8e389e31e2759037057b96fc6c9cb1e94
2020-03-24 10:27:39 -07:00
Yurii Zubrytskyi
cf77acf723 Merge "[adb] file sync performance on Windows" into rvc-dev am: 34fdb226f5
Change-Id: Ib8a77d9db54ec0565798ea1fe80044d6e7bd04bc
2020-03-24 06:02:51 +00:00
Yurii Zubrytskyi
34fdb226f5 Merge "[adb] file sync performance on Windows" into rvc-dev 2020-03-24 05:47:13 +00:00
Josh Gao
a8776b4913 adb: fix sync.
adbd's file sync service doesn't handle a full socket gracefully,
immediately terminating the service as soon as it fails to write a
response. This would generally be fine if the socket's buffer were as
large as it claims (212992 by default with a 64-bit kernel), but this
buffer size is a giant lie, as each write has 576 bytes of overhead
that's used up in the send buffer. When setting the send buffer size,
the kernel helpfully doubles the value to attempt to account for the
overhead, but when writing 8 byte responses, only 2% of the buffer
actually gets used for responses, so we run out of buffer after 364
files instead of the 26624 that would be expected.

Fix this by processing the responses as they become available, and
calculate a maximum limit to how many sends we dispatch before we stop
and wait for responses to come in.

Bug: http://b/150827486
Test: manually modified adbd to respond with giant error messages, and
      modified adb to not read responses until we choose to block
Change-Id: Ieb8c935662864211e2fd16c337ffed0992990086
(cherry picked from commit 672cdfeeff)
2020-03-23 17:36:15 -07:00
Josh Gao
65396f4734 adb: extract syncmsg structs.
Make it so that we can get the sizeof a member of syncmsg without having
an instance of syncmsg or doing something awful along the lines of
sizeof(reinterpret_cast<syncmsg*>(nullptr)->status).

Bug: http://b/150827486
Test: m adb adbd
Change-Id: I4830e7f90033c7706ff52cdd8d13e9cf40c73628
(cherry picked from commit eddae92928)
2020-03-23 17:36:06 -07:00
Anna Trostanetski
1c1d2bb7e0 Merge "Revert "Set apex_available property"" am: 447a1ead21 am: d731f3ed3b
Change-Id: I2352a891e0d1c762280b4b981f695189417b89e8
2020-03-23 15:00:32 +00:00
Anna Trostanetski
447a1ead21 Merge "Revert "Set apex_available property"" 2020-03-23 14:14:32 +00:00
Anna Trostanetski
56a712f6c9 Revert "Set apex_available property"
This reverts commit d25bb60e05.

Reason for revert: Breaks build_test b/152190149
Bug: 152190149

Change-Id: I6b7cb4aa4fc07fae648bcf4d9e8f60ea1c62fd9e
2020-03-23 12:02:53 +00:00
Jiyong Park
3ee525ee32 Merge "Set apex_available property" am: fb0b0d24f2 am: d0d864deef
Change-Id: I34d549ca369020acf0939cdbf1cd64fb59a8f5ad
2020-03-23 11:21:44 +00:00
Jiyong Park
fb0b0d24f2 Merge "Set apex_available property" 2020-03-23 10:51:28 +00:00
Jiyong Park
d25bb60e05 Set apex_available property
The marked library(ies) were available to the adbd APEX via the
hand-written whitelist in build/soong/apex/apex.go. Trying to remove the
whitelist by adding apex_available property to the Android.bp of the
libraries.

Exempt-From-Owner-Approval: already +2'ed by the owner (enh)

Bug: 150999716
Bug: 151398197
Test: m
Change-Id: I8b572e3c4e76bd10c0443a6c08b72e9519243ab5
2020-03-23 10:50:12 +00:00
Treehugger Robot
4b437076dc Merge "adb: fix sync." am: 4abafe2230 am: 6e9effd885
Change-Id: I8a405cf3f731c347bc8cb9f660624108785ec979
2020-03-23 06:36:48 +00:00
Treehugger Robot
141aa49eea Merge "adb: extract syncmsg structs." am: c549b122f4 am: a651084255
Change-Id: I492b747e5d49d8b537a834bc731edb36579b79d9
2020-03-23 06:36:29 +00:00
Treehugger Robot
4abafe2230 Merge "adb: fix sync." 2020-03-23 06:06:25 +00:00
Treehugger Robot
c549b122f4 Merge "adb: extract syncmsg structs." 2020-03-23 06:01:26 +00:00
Josh Gao
672cdfeeff adb: fix sync.
adbd's file sync service doesn't handle a full socket gracefully,
immediately terminating the service as soon as it fails to write a
response. This would generally be fine if the socket's buffer were as
large as it claims (212992 by default with a 64-bit kernel), but this
buffer size is a giant lie, as each write has 576 bytes of overhead
that's used up in the send buffer. When setting the send buffer size,
the kernel helpfully doubles the value to attempt to account for the
overhead, but when writing 8 byte responses, only 2% of the buffer
actually gets used for responses, so we run out of buffer after 364
files instead of the 26624 that would be expected.

Fix this by processing the responses as they become available, and
calculate a maximum limit to how many sends we dispatch before we stop
and wait for responses to come in.

Test: manually modified adbd to respond with giant error messages, and
      modified adb to not read responses until we choose to block
Change-Id: Ieb8c935662864211e2fd16c337ffed0992990086
2020-03-21 20:06:39 -07:00
Yurii Zubrytskyi
05227d99e0 [adb] file sync performance on Windows
Print not more often than once a 100ms - it is smooth enough
and speeds up transfer even more on Windows, where a single
line output may take up to 5ms.
An added benefit is getting rid of some extra heap allocation
and string formatting when in the end the identical message
filtering would've dropped the line anyway. This is also
significantly more expensive on Windows.

Bug: 151900478
Test: manual, push/pull a file and a directory

Change-Id: I9038729e8a01d5f93fd301beaeb8a086f5039b77
2020-03-20 22:48:10 -07:00
Yurii Zubrytskyi
b959a788b2 Merge "Adding block kind to protocol for future streaming of a tree." into rvc-dev am: c0a5aff0df
Change-Id: Ie9f752720280473a4634c184448cbc6b3a57812b
2020-03-20 22:27:09 +00:00
Yurii Zubrytskyi
c0a5aff0df Merge "Adding block kind to protocol for future streaming of a tree." into rvc-dev 2020-03-20 22:20:57 +00:00
Alex Buynytskyy
e7817e42d1 Adding block kind to protocol for future streaming of a tree.
Bug: b/152050621
Test: adb install --incremental megacity.apk
Change-Id: I0c977080475088bf046a521a85f78595aac994f0
2020-03-20 11:18:33 -07:00
Josh Gao
6e9bbfcc0e Merge "adbd: add apex_available and visibility for internal libs." am: 448519736b am: b802fd9b1c
Change-Id: I4f3ba750255be96a1f0a0b3a18d16b2266ccf9fa
2020-03-20 10:29:17 +00:00
TreeHugger Robot
97046b951c Merge "[adb] Print fewer progress messages for push/pull" into rvc-dev am: 934135d576
Change-Id: I3a05ae90ff85a979a1d4efc661e8c8a2f2aa13e7
2020-03-20 10:13:15 +00:00
TreeHugger Robot
934135d576 Merge "[adb] Print fewer progress messages for push/pull" into rvc-dev 2020-03-20 09:59:55 +00:00
TreeHugger Robot
50821ab80b Merge "[adb] Optimize fdevent machinery" into rvc-dev am: fd3b80c99c
Change-Id: I80e4f2baaacb88ec78a6fc0a557fe7d748536e0d
2020-03-20 06:47:42 +00:00
TreeHugger Robot
fd3b80c99c Merge "[adb] Optimize fdevent machinery" into rvc-dev 2020-03-20 06:33:47 +00:00
Josh Gao
eddae92928 adb: extract syncmsg structs.
Make it so that we can get the sizeof a member of syncmsg without having
an instance of syncmsg or doing something awful along the lines of
sizeof(reinterpret_cast<syncmsg*>(nullptr)->status).

Test: m adb adbd
Change-Id: I4830e7f90033c7706ff52cdd8d13e9cf40c73628
2020-03-19 17:24:15 -07:00
TreeHugger Robot
8d4383e728 Merge "[adb] Fix incremental installation on Windows" into rvc-dev am: ea1103cb1d
Change-Id: Id4fc8cd1430efd567f86acc22664c3f452e6fc6f
2020-03-19 22:19:48 +00:00
TreeHugger Robot
ea1103cb1d Merge "[adb] Fix incremental installation on Windows" into rvc-dev 2020-03-19 22:05:53 +00:00