Commit Graph

3827 Commits

Author SHA1 Message Date
Treehugger Robot 513bae7660 Merge "macOS build fix: don't build libadbconnection." am: 8b4ed5f6b6 am: 072e1d3ad4
Change-Id: I224a97c89bbc0f6e8db2ef7cd9eb709b3ee362ef
2020-04-15 17:26:08 +00:00
Alex Buynytskyy 203006b72a [incfs] Stream the hash tree for incremental installation
Instead of sending the whole tree upfront use the same
streaming interface for it as for the data blocks

This improves installation speed by almost 200ms,
650-800ms -> 500-600ms

Bug: 153696423
Test: manual, adb install in various configurations

Change-Id: Ia83de2af54ca0b1969397514ea5d761719af9055
(cherry picked from commit e2e850f325)
Merged-In: Ia83de2af54ca0b1969397514ea5d761719af9055
2020-04-15 17:07:07 +00:00
Joshua Duong 5e32d2f8de Remove host_supported from libadb_pairing_server.
To fix mac build error. Shouldn't be building this for the host.

Bug: N/A

Test: mma in system/core/adb on mac.
Change-Id: I8b86d265ef9b91eeaf7a4e5d6623a5399403ecaf
2020-04-15 06:53:38 +00:00
Elliott Hughes 729f58e0b7 macOS build fix: don't build libadbconnection.
Test: builds on mac
Change-Id: I91e3bf6b06f31edf542f8f8d6529787b0bf3a6ed
2020-04-14 16:33:16 -07:00
Elliott Hughes 7d9a7a3b6e macOS build fix: no off64_t on darwin.
Darwin has always had a 64-bit off_t, and never added an off64_t.

Test: builds on mac
Change-Id: I4b244dda94c67da76c9e0f47b333c2734f5a94af
2020-04-14 15:34:01 -07:00
Elliott Hughes e2bd0f0f6d Add missing `static` for macOS inline.
Also switch to #pragma once and s/__inline__/inline/g for consistency.

There are a handful of inlines that are missing static, which seems like
a bug, but I've left those for now.

Bug: http://b/153328340
Test: treehugger
Change-Id: I2353215c0a8a6154ce8b39ecde022b282f5c0cb9
Merged-In: I2353215c0a8a6154ce8b39ecde022b282f5c0cb9
(cherry picked from commit 681338dfb6)
2020-04-13 17:17:31 -07:00
Alex Buynytskyy 82c1c9711d [incfs] Stream the hash tree for incremental installation
Instead of sending the whole tree upfront use the same
streaming interface for it as for the data blocks

This improves installation speed by almost 200ms,
650-800ms -> 500-600ms

Bug: 153696423
Test: manual, adb install in various configurations

Change-Id: Ia83de2af54ca0b1969397514ea5d761719af9055
Merged-In: Ia83de2af54ca0b1969397514ea5d761719af9055
2020-04-13 13:00:01 -07:00
Alex Buynytskyy e2e850f325 [incfs] Stream the hash tree for incremental installation
Instead of sending the whole tree upfront use the same
streaming interface for it as for the data blocks

This improves installation speed by almost 200ms,
650-800ms -> 500-600ms

Bug: 153696423
Test: manual, adb install in various configurations

Change-Id: Ia83de2af54ca0b1969397514ea5d761719af9055
2020-04-10 14:45:51 -07:00
Josh Gao 196c93242f Merge "[adb] Don't copy features set on each get()" am: 8489bfb4d7 am: 257c5ef607
Change-Id: If36be78966aacacb001ef0666d86bbbb0fcbfed1
2020-04-10 19:23:30 +00:00
Yurii Zubrytskyi 6fc26dff7c [adb] Don't copy features set on each get()
The features are already cached in a static and don't change.
Let's return the cached set instead of copying it every time.

Bug: 150183149
Test: manual
Change-Id: Ifdca852cc3b32e09e50ea4771f7878987c46cce8
2020-04-09 22:26:48 -07:00
Jooyung Han 31242c07fa Add min_sdk_version:R to updatable apexes
APEXes introduced in R need to set min_sdk_version to ensure that they
are built against correct version of stubs (libc/liblog/...).

Bug: 152655956
Test: m
Merged-In: Id3f94a2ac09bd7bf7f9a4a0c2f62b624f29509d0
Change-Id: Id3f94a2ac09bd7bf7f9a4a0c2f62b624f29509d0
(cherry picked from commit ab9dfa4321)
2020-04-09 16:08:43 +09:00
Josh Gao b3ae997474 Merge changes from topic "adbd_lz4" am: 89cce05891 am: a047e4dbf4
Change-Id: If5e8c2607efa41a9e827abd9a2fe3d5533238e8e
2020-04-07 22:10:27 +00:00
Josh Gao 441808a139 adb: implement LZ4 compression. am: ec44d35fde am: e8d1281a48
Change-Id: I77c83a4725c4523db2015f7ab891621ab8828a77
2020-04-07 22:10:25 +00:00
Josh Gao 1b68baa26c adb: fix use of wrong union variant. am: 2165717875 am: 906ae0d9b0
Change-Id: I5433d281c9e4414e670b60b1547e3280d566a0b3
2020-04-07 22:10:24 +00:00
Josh Gao 5c4fbedebd adb: fix front_size, front_data. am: 4da40a9a5b am: 3a69cc704b
Change-Id: If3422b868a2a8ae9000188603426e336e7193176
2020-04-07 22:10:22 +00:00
Josh Gao b58e9916fb adb: add interfaces for Encoder/Decoder. am: 49ba558aa8 am: 0864b99961
Change-Id: I64298a19fb7a36fca0f987164b58aea3f526b93c
2020-04-07 22:10:18 +00:00
Josh Gao e8d1281a48 adb: implement LZ4 compression. am: ec44d35fde
Change-Id: Ie0ab6283ea843884a56bf0f0453036ae9f2e788c
2020-04-07 21:40:15 +00:00
Josh Gao 906ae0d9b0 adb: fix use of wrong union variant. am: 2165717875
Change-Id: I113892ca335419cb0eea8557e554497ed219aad3
2020-04-07 21:40:13 +00:00
Josh Gao 3a69cc704b adb: fix front_size, front_data. am: 4da40a9a5b
Change-Id: Ia54083330d8e8bde1f86821d9900644d73329bed
2020-04-07 21:40:12 +00:00
Josh Gao 0864b99961 adb: add interfaces for Encoder/Decoder. am: 49ba558aa8
Change-Id: If61913830dc03c54867a7bab3baadad780935aaa
2020-04-07 21:40:10 +00:00
Josh Gao 89cce05891 Merge changes from topic "adbd_lz4"
* changes:
  adb: add dry-run option to push/sync.
  adb: implement LZ4 compression.
  adb: fix use of wrong union variant.
  adb: fix front_size, front_data.
  adb: add interfaces for Encoder/Decoder.
2020-04-07 21:30:30 +00:00
Josh Gao 06369affd4 Merge "adb: add option to disable kill-server." am: edd7771583 am: a893592e56
Change-Id: I322447e7c6a02607144635d8632ca7641c1ea353
2020-04-07 21:22:08 +00:00
Josh Gao edd7771583 Merge "adb: add option to disable kill-server." 2020-04-07 20:36:47 +00:00
Elliott Hughes 8bb8c06357 Merge "Add missing `static` for macOS inline." am: a0c191867f am: 838f9e14f4
Change-Id: Ia2e1fefb98067b7220ac266a577d5544c11d7cb1
2020-04-07 20:04:54 +00:00
Elliott Hughes a0c191867f Merge "Add missing `static` for macOS inline." 2020-04-07 19:43:29 +00:00
Josh Gao 6cc08dbf6a Merge "Revert "Reland "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor""" into rvc-dev am: 60375b7cc6
Change-Id: I60c273c8ffd3404f4cd165932887ec9b81d9c2c8
2020-04-07 11:19:32 +00:00
Josh Gao 20f079ec66 Merge "Revert "Reland "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor""" 2020-04-07 11:08:00 +00:00
Josh Gao 9026a44bb3 Revert "Reland "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor""
This reverts commit bfe3dac36d.

This seems to be correlated with an increase in the rate of devices
going offline. Revert it to see if failure rates improve.

Bug: http://b/150863651
Test: treehugger
Change-Id: Ia6163fd9e31d2bf812628e028249662594ac2024
2020-04-06 16:49:01 -07:00
Josh Gao b3b43be658 Revert "Reland "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor""
This reverts commit d9684d5943.

This seems to be correlated with an increase in the rate of devices
going offline. Revert it to see if failure rates improve.

Bug: http://b/150863651
Test: treehugger
Change-Id: Ia6163fd9e31d2bf812628e028249662594ac2024
2020-04-06 16:48:35 -07:00
Josh Gao ba6d1da8ea adb: add option to disable kill-server.
In the post-apocalypse, it's increasingly common for people to use ssh
port forwarding to use an adb client with a remote adb server. This
results in `adb kill-server` being catastrophic, because the client has
no way of restarting the server on the other end. Android Studio in
particular has an unforunate habit of trying to manage adb's life cycle
such that starting or exiting Studio will result in a kill-server.

Add the ADB_REJECT_KILL_SERVER environment variable which ignores
kill-server, to make this scenario a bit better.

Bug: http://b/152251952
Test: ADB_REJECT_KILL_SERVER=1 adb start-server; adb kill-server
Change-Id: I5533a6dcbdb9220526a6fcf9ca31d9fcef1cec17
2020-04-06 14:33:14 -07:00
Elliott Hughes 681338dfb6 Add missing `static` for macOS inline.
Also switch to #pragma once and s/__inline__/inline/g for consistency.

There are a handful of inlines that are missing static, which seems like
a bug, but I've left those for now.

Bug: http://b/153328340
Test: treehugger
Change-Id: I2353215c0a8a6154ce8b39ecde022b282f5c0cb9
2020-04-06 09:17:08 -07:00
Jooyung Han 92bd33a286 Merge "Add min_sdk_version:R to updatable apexes" into rvc-dev am: a05e2b1a92
Change-Id: Ie396cf616dec766279bdcba26456be94fcc33bfa
2020-04-05 00:32:30 +00:00
Jooyung Han a05e2b1a92 Merge "Add min_sdk_version:R to updatable apexes" into rvc-dev 2020-04-05 00:14:36 +00:00
Josh Gao d527ae40dc Merge "adb: add implementation of mempcpy for deficient platforms." into rvc-dev 2020-04-04 06:45:09 +00:00
Josh Gao 0bd7d43f8b Merge "adb: add implementation of mempcpy for deficient platforms." am: d956dd78d0 am: 1264028fc7
Change-Id: Ia66bca6d22a6f573b48b319c1e00cf23f404f818
2020-04-03 19:50:28 +00:00
Josh Gao fbf30e4155 adb: add implementation of mempcpy for deficient platforms.
Bug: http://b/150827486
Test: none
Change-Id: Ic2f4e1c85c9f02e804d849c6cb60b22e15e981d6
(cherry picked from commit 0aafa0f714)
2020-04-03 12:18:29 -07:00
Josh Gao 0aafa0f714 adb: add implementation of mempcpy for deficient platforms.
Test: none
Change-Id: Ic2f4e1c85c9f02e804d849c6cb60b22e15e981d6
2020-04-03 10:13:53 -07:00
Josh Gao 5949fccc42 adb: add dry-run option to push/sync.
Make it easier to benchmark file sync performance by ignoring the file
system.

Bug: https://issuetracker.google.com/150827486
Test: test_device.py
Change-Id: Icfa4b28eb5206f1914c0c163833d070a3748c3ea
2020-04-02 17:11:08 -07:00
Josh Gao ec44d35fde adb: implement LZ4 compression.
Add support for LZ4 compression, which compresses and decompresses far
more quickly than brotli, at the cost of worse compression ratio.

`adb sync -d system` speeds (in MB/s) on aosp_blueline-eng:

           none    brotli    lz4
USB 3.0     120       110    190
USB 2.0      38        75     63

Bug: https://issuetracker.google.com/150827486
Test: python3 -m unittest test_device.FileOperationsTest{Uncompressed,Brotli,LZ4}
Change-Id: Ibef6ac15a76b4e5dcd02d7fb9433cbb1c02b8382
2020-04-02 17:11:07 -07:00
Josh Gao 2165717875 adb: fix use of wrong union variant.
Also, prepare to add more compression flags.

Bug: https://issuetracker.google.com/150827486
Test: none
Change-Id: I5044e5d5944aff5c18241fd7439baa48e2e09980
2020-04-02 17:11:07 -07:00
Josh Gao 4da40a9a5b adb: fix front_size, front_data.
Bug: https://issuetracker.google.com/150827486
Test: adb_test
Change-Id: I3d2c73a20a703d793efb56e592cf33149815f89b
2020-04-02 17:11:07 -07:00
Josh Gao 49ba558aa8 adb: add interfaces for Encoder/Decoder.
More groundwork to support more compression algorithms.

Bug: https://issuetracker.google.com/150827486
Test: python3 -m unittest test_device.FileOperationsTest{Uncompressed,Brotli}
Change-Id: I638493083b83e3f6c6854b631471e9d6b50bd79f
2020-04-02 17:11:07 -07:00
Josh Gao d6998c98d8 Merge changes I90e10c74,I038d1df4,I4299bd96 am: 73d44bb6c2 am: 72138abaa7
Change-Id: Ifa3354b755dab76cff00f3e7ceb0a80e5dd6657d
2020-04-01 23:19:26 +00:00
Josh Gao e485bdf06e adbd: delete unused variable.
Bug: https://issuetracker.google.com/150827486
Test: m adb com.android.adbd.apex
Change-Id: I90e10c74d695659c702dea4173cb33ac5ca1a102
2020-04-01 13:09:31 -07:00
Josh Gao 6e697f2f8c adb: move things around to prepare to add LZ4.
Bug: https://issuetracker.google.com/150827486
Test: m adb com.android.adbd.apex
Change-Id: I038d1df4f179ddb23102016d781c9bd90da5a546
2020-04-01 13:09:29 -07:00
Josh Gao 31d42aa73c adb: fix misindentation in Android.bp
Bug: https://issuetracker.google.com/150827486
Test: none
Change-Id: I4299bd962963a58ef5f075405b99b1d1e4c1febc
2020-04-01 13:09:16 -07:00
Jooyung Han ab9dfa4321 Add min_sdk_version:R to updatable apexes
APEXes introduced in R need to set min_sdk_version to ensure that they
are built against correct version(30 or R) of stubs (libc/liblog/...).

Bug: 152655956
Test: /vendor/google/build/build_mainline_modules.sh
Change-Id: Id3f94a2ac09bd7bf7f9a4a0c2f62b624f29509d0
2020-04-02 03:02:16 +09:00
Josh Gao 36fb67568c Statically link libadbd into minadbd.
Bug: http://b/150317254
Test: booted aosp_walleye-eng into recovery
Change-Id: Ie479ae2fbaf1006228a531dab26c7d535ed403db
Merged-In: Ie479ae2fbaf1006228a531dab26c7d535ed403db
(cherry picked from commit 3735614b28)
2020-03-31 19:16:08 -07:00
Josh Gao 2b5fa5505f adb: temporarily kill adb_benchmark.
Temporarily delete adb_benchmark, since it seems difficult to make this
sensibly work with a single target that's used for both libadb and
libadbd benchmarking.

Bug: http://b/150317254
Test: treehugger
Change-Id: Ibf81fdff4f2b7304b586ce9a7955b4bc2c11484e
Merged-In: Ibf81fdff4f2b7304b586ce9a7955b4bc2c11484e
(cherry picked from commit c6cb89ea80)
2020-03-31 16:05:41 -07:00
Josh Gao 2783122071 Move adbd's legacy USB implementation to fastboot.
This code path is effectively dead in adbd, and fastboot's dependency on
libadbd makes it hard to refactor adbd's dependencies.

Bug: http://b/150317254
Test: built and flashed aosp_walleye-eng
Change-Id: I5118136d32fdcbbd011559ed0a4a71e1dc7bf064
Merged-In: I5118136d32fdcbbd011559ed0a4a71e1dc7bf064
(cherry picked from commit 0871824de6)
2020-03-31 16:05:36 -07:00
Yurii Zubrytskyi 26dc4cc04d Merge "adb: fix apex installation." am: f8dc296dfd am: 39f4a75392
Change-Id: I89c773a5d5169c01e9ca58f1f8f6575d4e0882a8
2020-03-31 17:34:46 +00:00
Josh Gao cbdc9934c2 adb: fix apex installation.
Incremental doesn't support apex installation, but we were exiting
instead of returning -1 to fall back to regular installation.

Bug: http://b/151900478
Test: manual
Change-Id: Id27009250090a65fbb45bb65fc39c1799bf1f861
Merged-In: Id27009250090a65fbb45bb65fc39c1799bf1f861
2020-03-31 10:09:21 -07:00
Yurii Zubrytskyi bc445fbab8 [adb] Use incremental installation by default
This CL turns on the incremental installation for all
"adb install ..." commands where no explicit mode has been set.
To disable this, set the ADB_INSTALL_DEFAULT_INCREMENTAL
environment variable to 0/n/no/false. Unset to enable back

+ improve the install command argument parsing a bit: allow
  --wait for all installation modes, --incr is enough for
  an incremental install (and --no-incr to disable it)

Bug: 150183149
Test: adb install with different apks and command line switches
Change-Id: I1a237f34b70d920146746ab16104e28ef555a5fd
Merged-In: I1a237f34b70d920146746ab16104e28ef555a5fd
2020-03-31 10:04:15 -07:00
Yurii Zubrytskyi f8dc296dfd Merge "adb: fix apex installation." 2020-03-31 16:56:07 +00:00
Josh Gao c8a8e2a35e Merge "Statically link libadbd into minadbd." am: db22f23dd3 am: b903481992
Change-Id: I44d9fa2effda1f09c80bc3855ba7e3fd4c1bb6cc
2020-03-31 08:53:38 +00:00
Josh Gao 764bffe411 Merge "adb: temporarily kill adb_benchmark." am: d6211a2dde am: a056a8f239
Change-Id: I2204d9e9deae233cf827b4b71ee950360bc433bc
2020-03-31 04:09:06 +00:00
Josh Gao 3c1803cab5 adb: fix apex installation.
Incremental doesn't support apex installation, but we were exiting
instead of returning -1 to fall back to regular installation.

Bug: http://b/151900478
Test: manual
Change-Id: Id27009250090a65fbb45bb65fc39c1799bf1f861
2020-03-31 02:08:14 +00:00
Josh Gao 3735614b28 Statically link libadbd into minadbd.
Bug: http://b/150317254
Test: booted aosp_walleye-eng into recovery
Change-Id: Ie479ae2fbaf1006228a531dab26c7d535ed403db
2020-03-30 18:51:15 -07:00
Josh Gao ed91f30517 Merge "Move adbd's legacy USB implementation to fastboot." am: fd193bd291 am: 0a9431d0f3
Change-Id: I0cd942c1e13bf432fc91ed366266ee3227bde361
2020-03-31 00:50:44 +00:00
Josh Gao c6cb89ea80 adb: temporarily kill adb_benchmark.
Temporarily delete adb_benchmark, since it seems difficult to make this
sensibly work with a single target that's used for both libadb and
libadbd benchmarking.

Bug: http://b/150317254
Test: treehugger
Change-Id: Ibf81fdff4f2b7304b586ce9a7955b4bc2c11484e
2020-03-30 16:43:06 -07:00
Josh Gao 0871824de6 Move adbd's legacy USB implementation to fastboot.
This code path is effectively dead in adbd, and fastboot's dependency on
libadbd makes it hard to refactor adbd's dependencies.

Bug: http://b/150317254
Test: built and flashed aosp_walleye-eng
Change-Id: I5118136d32fdcbbd011559ed0a4a71e1dc7bf064
2020-03-30 16:43:06 -07:00
Songchun Fan f25ffde2dd Merge "[adb] use zip iteration with functor" am: 26a8ed983c am: d9ec4fc3f3
Change-Id: Id89e24dc5e57cf58c9dd069c31001297b428d279
2020-03-28 03:37:10 +00:00
Songchun Fan 26a8ed983c Merge "[adb] use zip iteration with functor" 2020-03-28 03:03:07 +00:00
Treehugger Robot 26e592437b Merge "Revert "Revert "Delay initial accept() until server initialized""" am: 551130fc2b am: 6ebfda18e9
Change-Id: I7017ca9abd2c981606a81c6046ef41333ac352a8
2020-03-28 01:52:07 +00:00
Songchun Fan 0f11895157 [adb] use zip iteration with functor
Test: manual
BUG: 151676293
Change-Id: I738811bb5ff3ecc86ae49aa64df29427fb4ec69a
2020-03-27 18:38:50 -07:00
Treehugger Robot 551130fc2b Merge "Revert "Revert "Delay initial accept() until server initialized""" 2020-03-28 01:27:38 +00:00
Treehugger Robot 3e6d867653 Merge "[adb] Use incremental installation by default" am: 02875acf84 am: ba6f4f78a1
Change-Id: Icf35e1e18145b2c29b3fbd736fb398dd3c96ff74
2020-03-28 01:13:49 +00:00
Daniel Colascione c2612cd775 Revert "Revert "Delay initial accept() until server initialized""
This reverts commit b71b5af783.

Test: actually build device and host adb this time
Change-Id: I9f9375aa83c9d023a1e26d2f95676b734e12f926
2020-03-27 20:51:19 +00:00
Yurii Zubrytskyi 4532ea881a [adb] Use incremental installation by default
This CL turns on the incremental installation for all
"adb install ..." commands where no explicit mode has been set.
To disable this, set the ADB_INSTALL_DEFAULT_INCREMENTAL
environment variable to 0/n/no/false. Unset to enable back

+ improve the install command argument parsing a bit: allow
  --wait for all installation modes, --incr is enough for
  an incremental install (and --no-incr to disable it)

Bug: 150183149
Test: adb install with different apks and command line switches
Change-Id: I1a237f34b70d920146746ab16104e28ef555a5fd
2020-03-27 12:30:29 -07:00
Treehugger Robot e7c25a62ac Merge "adb: Avoid extra string construction" am: 6b42d6d859 am: b8a9b8f367
Change-Id: I02366963f140a705d88b5625c907f70791d89c74
2020-03-27 15:33:27 +00:00
Greg Kaiser 030f1effdf adb: Avoid extra string construction
Test: TreeHugger
Change-Id: Ie03062a17b98866f1bc419a7e509461cf4e6bb80
2020-03-27 06:10:11 -07:00
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 50ab0a6900 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
Merged-In: Ic2a0c974f1b6efecda115f87d336e3caac810035
(cherry picked from commit 939fc19aee)
2020-03-26 16:08:41 -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 c69f30ea15 Merge "Pass the os handle to the tls connection." into rvc-dev 2020-03-26 06:12:28 +00: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 bba72d951b 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:18:07 +00:00
Joshua Duong aed3408f47 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
2020-03-26 02:17:34 +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
TreeHugger Robot 80afce0b66 Merge "[adb data server] Initialize variable" into rvc-dev am: 126a1c2dd0
Change-Id: If01b50552b08160da93b4b6b3880133d17b3e2ed
2020-03-19 17:32:33 +00:00
Yurii Zubrytskyi 67caf0ceef [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
2020-03-19 00:21:08 -07:00
Yurii Zubrytskyi 76820308c5 [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
2020-03-18 23:20:00 -07:00
Yurii Zubrytskyi c3ac339daf [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
2020-03-18 22:28:01 -07:00
Josh Gao b567303330 adbd: add apex_available and visibility for internal libs.
abb links against libadbd_core for the shell protocol, and must be
on the system image because it links against cmd, so let's just
expose it to abb for now.

Bug: http://b/151398197
Test: treehugger
Change-Id: Id926bc4324d3259def21ea19d3bd72320311a6e3
2020-03-18 18:36:01 -07:00
Josh Gao b9059f8ad7 adb: add helper binary to do a usb reset on a device.
Bug: http://b/150863651
Test: manual
Change-Id: I70e0e5c49fb1b43f7f21d2e709f4091c41ebcfac
2020-03-18 14:59:15 -07:00
Greg Kaiser 6a2c18a88f [adb data server] Initialize variable
servingComplete_ was left uninitialized and only set to 'true'
in the code.  We initialize it to the 'false' state to avoid
uninitialized references in SkipToRequest().

Bug: 150865433
Test: TreeHugger
Change-Id: Ia8a4d7135c432eb657543c5498fc9dbe8f4718b6
2020-03-18 06:18:10 -07:00
Yurii Zubrytskyi 4e7bede912 Merge changes Ifda7de48,Ie33505f9 into rvc-dev am: c2872d831d
Change-Id: I632830b0a15bdada757230c2a1d6ec4f48ce51ee
2020-03-18 03:38:50 +00:00
Songchun Fan 8cdefd4f95 [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
2020-03-17 20:19:49 -07:00
Songchun Fan c4a9d16ef1 [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
2020-03-17 20:19:47 -07:00
Automerger Merge Worker 6a0d14ac15 Merge "adbd: shrink libadbd.so, libadbd_services.so." am: cb76bf0558 am: e7d5ae30c6
Change-Id: I55dd7c315e2222584972ded39571d845a3f7fffa
2020-03-16 21:38:02 +00:00
Josh Gao c151a1ba28 adbd: shrink libadbd.so, libadbd_services.so.
We were ending up with multiple copies of the proto runtime in the
recovery image, when we need zero.

Before:
    784K	recovery/root/system/lib64/libadbd_services.so
    832K	recovery/root/system/lib64/libadbd.so

After:
    360K	recovery/root/system/lib64/libadbd_services.so
    344K	recovery/root/system/lib64/libadbd.so

Bug: http://b/150317254
Test: treehugger
Change-Id: I39fbb3959128994f0de2ae0ea47dbc0800c516fe
2020-03-16 11:30:09 -07:00
Automerger Merge Worker cde607bfed Merge "Implement the new v4 signing scheme in adb" into rvc-dev am: 742ef23ee9
Change-Id: I1f30ddb248fca223a47a532ad8d02e5dcc6a0c59
2020-03-14 02:35:08 +00:00
TreeHugger Robot 742ef23ee9 Merge "Implement the new v4 signing scheme in adb" into rvc-dev 2020-03-14 02:28:40 +00:00
Alex Buynytskyy 33ac1b05f9 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>

go/apk-v4-signature-format

Bug: b/151241461
Change-Id: I26e187f8e389e31e2759037057b96fc6c9cb1e94
2020-03-13 11:04:17 -07:00
Automerger Merge Worker 1939280381 Merge "adb: support wait-for- with multiple states." am: 4fe694a9c1 am: a13edaac4e
Change-Id: Ia1b1aaf24eb18adf9d3905d6e43ec40367af366a
2020-03-13 15:43:21 +00:00
Elliott Hughes 4fe694a9c1 Merge "adb: support wait-for- with multiple states." 2020-03-13 15:19:34 +00:00
Jiyong Park a94047be70 Merge "Make libselinux a stub library" into rvc-dev 2020-03-13 05:16:49 +00:00
Jiyong Park 8ce4a3067c Make libselinux a stub library
libselinux is currently being copied to APEXes. This is risky because
the library is not designed to be portable; part of it is tied to the
specific version of the Android that it was developed for.

This change fixes the problem by declaring that the library supports
a stub with the list of C APIs that are included in the stub. Then there
is only one copy of libselinux in /system/lib and other APEXes use the
copy by dynamically linking to it.

Also, adbd no longer statically links to it, because doing so brings
libselinux in it.

Bug: 151053366
Test: m com.android.adbd. It doesn't include libselinux in it.
Test: m com.android.adbd-deps-info. then inspect
out/soong/com.android.adbd-deps-info.txt. The dependency to libselinux
is shown as '(external)'.

Exempt-From-Owner-Approval: cherry-pick from AOSP

Merged-In: If418cbe3abdeacb759d59052e6dca4c2067678dd
(cherry picked from commit 3ffdad0cb5)
Change-Id: If418cbe3abdeacb759d59052e6dca4c2067678dd
2020-03-13 05:16:28 +00:00
Jiyong Park c2a354be68 Merge "don't include liblog to APEXes" into rvc-dev 2020-03-12 04:10:15 +00:00
Automerger Merge Worker 18ee520e93 Merge "Make libselinux a stub library" am: b407502c98 am: 9281e97450
Change-Id: Ica4f4de8425f84eb6efb1321df1f5f78e3393464
2020-03-12 03:31:03 +00:00
Treehugger Robot b407502c98 Merge "Make libselinux a stub library" 2020-03-12 02:57:14 +00:00
Automerger Merge Worker 5dc6290c24 Merge "adb: Avoid a couple std::string constructions" am: 2442e64416 am: c2d303231d
Change-Id: I768760f4439b5403025bb3a91a8acedcf6fd4d47
2020-03-12 00:41:33 +00:00
Jiyong Park 3ffdad0cb5 Make libselinux a stub library
libselinux is currently being copied to APEXes. This is risky because
the library is not designed to be portable; part of it is tied to the
specific version of the Android that it was developed for.

This change fixes the problem by declaring that the library supports
a stub with the list of C APIs that are included in the stub. Then there
is only one copy of libselinux in /system/lib and other APEXes use the
copy by dynamically linking to it.

Also, adbd no longer statically links to it, because doing so brings
libselinux in it.

Bug: 151053366
Test: m com.android.adbd. It doesn't include libselinux in it.
Test: m com.android.adbd-deps-info. then inspect
out/soong/com.android.adbd-deps-info.txt. The dependency to libselinux
is shown as '(external)'.

Change-Id: If418cbe3abdeacb759d59052e6dca4c2067678dd
2020-03-12 00:02:18 +00:00
Josh Gao d1ee5085f3 adbd: make libadbd_services cc_library again.
For currently unknown reasons, sideloading is broken with
libadbd_services as a cc_library_static.

Partial revert of commit a9b62d5452.

Bug: http://b/151056300
Test: xunchang@ tested manually
Change-Id: Iaffad9c476ba0adcffc5db512ba4a7ee0fb5cb22
(cherry picked from commit 7f8a37c8c7)
2020-03-11 23:18:41 +00:00
Greg Kaiser edfec96679 adb: Avoid a couple std::string constructions
With some internal API changing from "const char*" to
"const std::string&", we can change a couple calling sites to
directly pass a std::string reference, instead of getting the
c_str() version of the string.  This avoids us creating a
temporary std::string for the call.

Test: TreeHugger
Change-Id: I2fe0760ce8bf7d352010a341005356c0a801d351
2020-03-11 07:07:55 -07:00
Automerger Merge Worker b50e118278 Merge "don't include liblog to APEXes" am: f1e27502e4 am: 872aeede04
Change-Id: I9ee977d29ec01927e41fbeff3922841749571a16
2020-03-11 10:07:26 +00:00
Jiyong Park 01aa81cec5 don't include liblog to APEXes
liblog is a platform library that provides stable C API. There is no
need to include the library, especialy by statically linking to it, in
any APEX. It not only wastes the storage/ram, but also is incorrect
because the socket interface to logd which is implemented in liblog is
not guaranteed to be stable.

Fixing this issue by converting static_libs: ["liblog"] into
shared_libs: ["liblog"], in which case the dependency to the library
is satisfied via the stub variant of the library.

As a result, we could restrict the availablity of the library to
the platform and the runtime APEX.

Exempt-From-Owner-Approval: already approved when this was in internal
master (ag/10572699)

Bug: http://b/151051671
Bug: http://b/150827719
Test: m
Merged-In: I5aab863cb12b8767b6979255c247000a59355b0e
(cherry picked from commit 95b6f45b0e)
Change-Id: I5aab863cb12b8767b6979255c247000a59355b0e
2020-03-11 18:30:06 +09:00
Jiyong Park 95b6f45b0e don't include liblog to APEXes
liblog is a platform library that provides stable C API. There is no
need to include the library, especialy by statically linking to it, in
any APEX. It not only wastes the storage/ram, but also is incorrect
because the socket interface to logd which is implemented in liblog is
not guaranteed to be stable.

Fixing this issue by converting static_libs: ["liblog"] into
shared_libs: ["liblog"], in which case the dependency to the library
is satisfied via the stub variant of the library.

As a result, we could restrict the availablity of the library to
the platform and the runtime APEX.

Exempt-From-Owner-Approval: already approved when this was in internal
master (ag/10572699)

Bug: http://b/151051671
Bug: http://b/150827719
Test: m
Change-Id: I5aab863cb12b8767b6979255c247000a59355b0e
2020-03-11 09:20:08 +00:00
Elliott Hughes a52b458dd4 adb: support wait-for- with multiple states.
Test: manual, adb wait-for-device-recovery
Change-Id: I92034c477d28f847e24ec72bbb87b252fba875e1
2020-03-10 17:01:34 -07:00
Automerger Merge Worker a84a8a225c Merge "adbd: make libadbd_services cc_library again." am: 0ac447ab95 am: 3a3c6ec494
Change-Id: I9472129acc75f78a3ed14452e66241c4d5635b8a
2020-03-10 21:22:08 +00:00
Tianjie Xu 0ac447ab95 Merge "adbd: make libadbd_services cc_library again." 2020-03-10 18:43:30 +00:00
Automerger Merge Worker e6ba52ffbe Merge "adb: defer acknowledgement of pushed files until the end." am: 2263bcb4d0 am: 0cd6658eb0
Change-Id: I351c406ef5abfc55b1607bfa520f3f1d16002bbf
2020-03-10 02:23:32 +00:00
Josh Gao 6519ad6355 adb: defer acknowledgement of pushed files until the end.
Previously, we were waiting for the other end to respond after every
file sent, which results in massive slowdown when there's any amount of
latency on the transport.

This improves performance on a cuttlefish instance with ~7ms RTT from:

    system/: 2037 files pushed, 0 skipped. 2.8 MB/s (762803979 bytes in 262.964s)

to:

    system/: 2037 files pushed, 0 skipped. 11.9 MB/s (762803979 bytes in 61.278s)

Bug: https://issuetracker.google.com/150827486
Test: ./test_device.py
Change-Id: I3a0c893faa5d455cc6ccbc86915a17e1b5abbfbe
(cherry picked from commit 64ff82ba68)
2020-03-09 18:57:15 -07:00
Josh Gao 2263bcb4d0 Merge "adb: defer acknowledgement of pushed files until the end." 2020-03-10 01:55:51 +00:00
Automerger Merge Worker 51d9cee112 Merge "Fix bugprone-string-integer-assignment warnings" am: 262b58cd07 am: 9b69f80df2
Change-Id: I1b35735cae7c6818ae8e003206aaf26d442e419d
2020-03-10 00:48:42 +00:00
Chih-hung Hsieh 262b58cd07 Merge "Fix bugprone-string-integer-assignment warnings" 2020-03-10 00:07:58 +00:00
Josh Gao 7f8a37c8c7 adbd: make libadbd_services cc_library again.
For currently unknown reasons, sideloading is broken with
libadbd_services as a cc_library_static.

Partial revert of commit a9b62d5452.

Bug: http://b/151056300
Test: xunchang@ tested manually
Change-Id: Iaffad9c476ba0adcffc5db512ba4a7ee0fb5cb22
2020-03-09 15:20:55 -07:00
Automerger Merge Worker ce44d55878 Merge ""track-app" service showing debuggable/profileable apps" am: c6e64b3e1d am: d5221600c9
Change-Id: I73c9d269972033589d5744bf48f98e4d03c9e9bb
2020-03-09 22:07:25 +00:00
Chih-Hung Hsieh 5d13645bfe Fix bugprone-string-integer-assignment warnings
* mdns.cpp:153:20: warning: an integer is interpreted as a character code
  when assigning it to a string; if this is intended, cast the integer to
  the appropriate character type; if you want a string representation, use
  the appropriate conversion facility [bugprone-string-integer-assignment]

Test: WITH_TIDY=1 make
Change-Id: Id9a790ac31722c6ee8886703939977b913ce95fe
2020-03-09 15:05:54 -07:00
Treehugger Robot c6e64b3e1d Merge ""track-app" service showing debuggable/profileable apps" 2020-03-09 21:21:38 +00:00
Automerger Merge Worker 4d829510cc Merge "adb: improve logging of key loading slightly." am: 9da07506de am: 05fcfb6d69
Change-Id: Ie614cd70d6417e622430546e8f72b97fbb7ba69c
2020-03-09 20:14:49 +00:00
Elliott Hughes 401c78780f adb: improve logging of key loading slightly.
In particular, always include the file name in the log.

Bug: http://b/144462309
Test: adb kill-server && adb devices -l && cat /tmp/adb.*.log
Change-Id: I66b5e063b00381f9dfa9ace222cad3e415e4f43b
2020-03-07 12:52:36 -08:00
Shukang Zhou f4ffae1055 "track-app" service showing debuggable/profileable apps
Add a "track-app" service in adbd. For every debuggable or
profileable-from-shell process, ART sends related info to
adbd and adbd surfaces the info through the "track-app"
service.

The output format of "track-app" is a line summarizing
the number of reported processes, followed by a protobuf
message in human readable form. For example,

Process count: 2
process {
  pid: 3307
  profileable: true
  architecture: "arm64"
}
process {
  pid: 3341
  debuggable: true
  profileable: true
  architecture: "arm64"
}

Bug: 149050485
Test: manually unplugged/replugged, "adb track-app",
      "adb track-jdwp"
Change-Id: Id1f1a920e1afc148c7e4d2add790baab796178e1
2020-03-06 13:56:27 -08:00
Josh Gao 64ff82ba68 adb: defer acknowledgement of pushed files until the end.
Previously, we were waiting for the other end to respond after every
file sent, which results in massive slowdown when there's any amount of
latency on the transport.

This improves performance on a cuttlefish instance with ~7ms RTT from:

    system/: 2037 files pushed, 0 skipped. 2.8 MB/s (762803979 bytes in 262.964s)

to:

    system/: 2037 files pushed, 0 skipped. 11.9 MB/s (762803979 bytes in 61.278s)

Bug: https://issuetracker.google.com/150827486
Test: ./test_device.py
Change-Id: I3a0c893faa5d455cc6ccbc86915a17e1b5abbfbe
2020-03-05 19:48:11 -08:00
Josh Gao 1e18ac38da Reland "adb: turn CHECKs into an error + transport restart."
This reverts commit 2547f740ea.

Bug: http://b/134695864
Bug: http://b/133872605
Test: manually unplugged/replugged
Change-Id: Ic2af40b81354138a7842eb93aacc303885ac952e
(cherry picked from commit 7b3048446d)
2020-03-02 22:59:54 -08:00
Josh Gao d9684d5943 Reland "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor"
This reverts commit ba4684c2b2.

Bug: http://b/129283234
Test: manually unplugged/replugged
Change-Id: I9c8cfebe09b2855cab986068273a835a13247b77
(cherry picked from commit bfe3dac36d)
2020-03-02 22:59:54 -08:00
Automerger Merge Worker bc38881fd9 Merge changes Ic2af40b8,I9c8cfebe am: 824f0095b0 am: 025b239f1e
Change-Id: I32278a67a749651c02b04cf41eb4d43eb61e7e7d
2020-03-03 06:53:22 +00:00
Treehugger Robot 824f0095b0 Merge changes Ic2af40b8,I9c8cfebe
* changes:
  Reland "adb: turn CHECKs into an error + transport restart."
  Reland "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor"
2020-03-03 06:29:55 +00:00
Automerger Merge Worker a806b70d2c Merge "Disable AdbPairingConnectionTest#MultipleClientsOnePass." am: 49d4dd23ca am: 670c58dbd8
Change-Id: I7f532a4b648d15abeb4bf1e93574b6f1a3f3944a
2020-03-03 01:05:50 +00:00
Joshua Duong 49d4dd23ca Merge "Disable AdbPairingConnectionTest#MultipleClientsOnePass." 2020-03-03 00:36:22 +00:00
Josh Gao 7b3048446d Reland "adb: turn CHECKs into an error + transport restart."
This reverts commit 2547f740ea.

Bug: http://b/134695864
Bug: http://b/133872605
Test: manually unplugged/replugged
Change-Id: Ic2af40b81354138a7842eb93aacc303885ac952e
2020-03-02 13:55:04 -08:00
Josh Gao bfe3dac36d Reland "adb: daemon: Assign valid fd to usb_handle ep0 file descriptor"
This reverts commit ba4684c2b2.

Bug: http://b/129283234
Test: manually unplugged/replugged
Change-Id: I9c8cfebe09b2855cab986068273a835a13247b77
2020-03-02 13:45:52 -08:00
Joshua Duong 2e1ee8ee51 Disable AdbPairingConnectionTest#MultipleClientsOnePass.
Will re-enable once flaky failure is fixed.

Bug: 150529485
Bug: 150388912

Test: atest adb_pairing_connection_test doesn't run above test.
Change-Id: I63ac3fc2fd2d289b977dd3b9f6eccfb65866769c
2020-03-02 12:56:59 -08:00
Josh Gao bbe3385097 adbd: add runtime-configurable logging.
Add some requested logging options that can be turned on at runtime
without having to restart adbd.

Bug: http://b/141959374
Test: manual
Change-Id: Ib97acc6d199e0b91238a6758e18b7cb75f8688d9
(cherry picked from commit 52d0b67f19)
2020-03-02 12:44:54 -08:00
Josh Gao 9ddc42aa93 adb: don't hardcode ports in test_adb.
If we get unlucky and something else (or ourselves, in another thread)
beats us to listening on our hardcoded ports, we can deadlock.

Bug: http://b/149829737
Test: ./test_adb.py
Change-Id: I8f14004a6b2e77366abad6e88786ea8941629020
(cherry picked from commit e8829c6bfc)
2020-03-02 12:44:50 -08:00
Jiyong Park ab8a7e35ec Merge "Mark updatable APEXes" 2020-03-01 00:39:18 +00:00
Joshua Duong ad9d034e7d Merge "Remove pairing_auth, pairing_connection from recovery." 2020-02-29 00:47:44 +00:00
Automerger Merge Worker 46c88995c5 Merge changes Ib97acc6d,Id5bbfd6d,I4dfc3f52 am: 14c65f6fb6 am: d9bc96443f
Change-Id: If092844557c264a730f2875a72590a5dcc61d147
2020-02-28 23:55:53 +00:00
Josh Gao f6b7731868 adbd: add usb thread spawn logging.
Bug: http://b/141959374
Test: adbd shell killall adbd; adb wait-for-device logcat | grep UsbFfs
Change-Id: Id5bbfd6d2198005bf10b94c691499059e130afe7
(cherry picked from commit e3d34e1f8b)
2020-02-28 15:20:29 -08:00
Josh Gao 14c65f6fb6 Merge changes Ib97acc6d,Id5bbfd6d,I4dfc3f52
* changes:
  adbd: add runtime-configurable logging.
  adbd: add usb thread spawn logging.
  base: add CachedProperty.
2020-02-28 23:17:49 +00:00
Automerger Merge Worker 1b9dcfbacb Remove pairing_auth, pairing_connection from recovery. am: caca3a9f5a
Change-Id: Iba87a36fbe4f5549f1109aaa19f664cfc799e46f
2020-02-28 23:11:33 +00:00
Josh Gao 52d0b67f19 adbd: add runtime-configurable logging.
Add some requested logging options that can be turned on at runtime
without having to restart adbd.

Bug: http://b/141959374
Test: manual
Change-Id: Ib97acc6d199e0b91238a6758e18b7cb75f8688d9
2020-02-28 12:58:42 -08:00
Joshua Duong 0f53d1794a Remove pairing_auth, pairing_connection from recovery.
Also remove statically linking libc++, because these libraries are not
exported native shared libraries.

We are slightly over the 12MB limit for ramdisk recovery size, so let's
remove the adb pairing libraries, since they won't be used in recovery
mode.

These are only used in normal boot mode, and currently, only by adb
client. The pairing server is used by system server.

Bug: 150317254

Test: Check size of ramdisk-recovery.img in walleye, walleye-hwasam
build to be under 12MB. Also verify installed-files-recovery.txt no
longer contains libadb_pairing*.
Also put phone into recovery mode, check system/lib64 for no
libadb_pairing*.

Change-Id: Ida7c4fdc9dda2b09091b853feac8df8f125e4274
Merged-In: Ida7c4fdc9dda2b09091b853feac8df8f125e4274
(cherry picked from commit afc2cf0dec)
Exempt-From-Owner-Approval: cherry-pick
2020-02-28 20:45:43 +00:00
Joshua Duong caca3a9f5a Remove pairing_auth, pairing_connection from recovery.
Also remove statically linking libc++, because these libraries are not
exported native shared libraries.

We are slightly over the 12MB limit for ramdisk recovery size, so let's
remove the adb pairing libraries, since they won't be used in recovery
mode.

These are only used in normal boot mode, and currently, only by adb
client. The pairing server is used by system server.

Bug: 150317254

Test: Check size of ramdisk-recovery.img in walleye, walleye-hwasam
build to be under 12MB. Also verify installed-files-recovery.txt no
longer contains libadb_pairing*.
Also put phone into recovery mode, check system/lib64 for no
libadb_pairing*.

Change-Id: Ida7c4fdc9dda2b09091b853feac8df8f125e4274
(cherry picked from commit afc2cf0dec)
Exempt-From-Owner-Approval: cherry-pick
2020-02-28 19:02:28 +00:00
Automerger Merge Worker febeb27e4e Merge "adb: don't hardcode ports in test_adb." am: cb57583949 am: 3efbff8e13
Change-Id: Idbbc3e78dad085a00fdd1426afbc65fb73f98bc3
2020-02-28 03:27:21 +00:00
Josh Gao e8829c6bfc adb: don't hardcode ports in test_adb.
If we get unlucky and something else (or ourselves, in another thread)
beats us to listening on our hardcoded ports, we can deadlock.

Bug: http://b//149829737
Test: ./test_adb.py
Change-Id: I8f14004a6b2e77366abad6e88786ea8941629020
2020-02-27 14:30:35 -08:00
Josh Gao e3d34e1f8b adbd: add usb thread spawn logging.
Bug: http://b/141959374
Test: adbd shell killall adbd; adb wait-for-device logcat | grep UsbFfs
Change-Id: Id5bbfd6d2198005bf10b94c691499059e130afe7
2020-02-27 13:56:48 -08:00
Jiyong Park 49c3dc51c7 Mark updatable APEXes
Mark updatable APEXes as updatable: true so that they are opted-out from
optimizations that make sense only for non-updatable modules; such as
symlinking to the libs in the system partition.

Bug: 149805758
Test: m and check that there is no symlink from the APEX to the system
partition.

Exempt-From-Owner-Approval: cherry-pick from internal

Merged-In: Ic3edc7e285e9eafbdaa20b18ccbc0b2231370779
(cherry picked from commit 7c2ae1f02c)
Change-Id: Ic3edc7e285e9eafbdaa20b18ccbc0b2231370779
2020-02-27 10:52:47 +09:00
Automerger Merge Worker 775883ce2c Merge "Mark updatable APEXes" into rvc-dev am: 7e5f2aa478
Change-Id: I4b67c50762e70e16783bba65dbad71396e4cebf7
2020-02-26 17:31:03 +00:00
Jiyong Park 7e5f2aa478 Merge "Mark updatable APEXes" into rvc-dev 2020-02-26 17:13:12 +00:00
Joshua Duong e36a53e307 Properly remove adb DNS services.
Bug: b/150136878
Bug: b/111434128

Bug: http://b/150032044
Test: make
Change-Id: Ibfb92a7c197a25fd1913107d277fbc5f78108c05
Merged-In: Ibfb92a7c197a25fd1913107d277fbc5f78108c05
(cherry picked from commit 79a452a923)
2020-02-24 17:58:34 -08:00
Josh Gao 3467ef46d4 adbd: fix build breakage.
This broke because two CLs touching the Android.bp file both
independently passed presubmit, but failed when combined.

Clean up a misindentation while we're at it.

Bug: http://b/150032044
Bug: http://b/150032367
Test: mma in system/core/adb
Change-Id: I091ef9dec806c767ffb21a5fd73b2bb37ab29ff9
Merged-In: I091ef9dec806c767ffb21a5fd73b2bb37ab29ff9
(cherry picked from commit 6d949e89a4)
2020-02-24 17:58:21 -08:00
Josh Gao b5778c1fe7 adbd: remove static dependency on libcutils.
We were previously statically linking libcutils into adbd for several
different reasons, which were addressed as follows:

  socket functions: extracted to a statically linked libcutils_network
  fs_config: wrapped with a shared library on /system
  ATRACE: deleted the single use in adbd

Bug: http://b/150032044
Test: treehugger
Change-Id: I821fa174cfcbfa8e29a4be10de4016b817adbaf8
Merged-In: I821fa174cfcbfa8e29a4be10de4016b817adbaf8
(cherry picked from commit a9b62d5452)
2020-02-24 17:58:06 -08:00
George Burgess IV 15c7a3f8f8 incremental_server: fix a use of uninitalized memory
Without this, the caller is likely to assume that their buffer is
fully usable, which clang's analyzer doesn't believe is the case.

Another option is to set `*size` to nonzero.

Caught by the static analyzer:
system/core/adb/client/incremental_server.cpp:111:31: warning: 1st
function call argument is an uninitialized value
[clang-analyzer-core.CallAndMessage]

Bug: http://b/150032044
Test: TreeHugger
Change-Id: Ib844aa4ab3ebb297ca8f6f4289bbe3212275275b
Merged-In: Ib844aa4ab3ebb297ca8f6f4289bbe3212275275b
(cherry picked from commit 19b500bd50)
2020-02-24 17:57:58 -08:00
Automerger Merge Worker b46679f8f7 Merge "Properly remove adb DNS services." am: 7445a87101 am: 75d3bc9875
Change-Id: Ide4cfba8cb654d664a6c8dcf73bb145c2b0b4791
2020-02-24 23:37:16 +00:00
Joshua Duong 79a452a923 Properly remove adb DNS services.
Bug: b/150136878
Bug: b/111434128

Test: make
Change-Id: Ibfb92a7c197a25fd1913107d277fbc5f78108c05
2020-02-24 10:09:35 -08:00
Jiyong Park 7c2ae1f02c Mark updatable APEXes
Mark updatable APEXes as updatable: true so that they are opted-out from
optimizations that make sense only for non-updatable modules; such as
symlinking to the libs in the system partition.

Bug: 149805758
Test: m and check that there is no symlink from the APEX to the system
partition.

Change-Id: Ic3edc7e285e9eafbdaa20b18ccbc0b2231370779
2020-02-24 18:39:23 +09:00
Treehugger Robot b9c95f8e6a Merge "Remove various bits of dead code and unused workarounds." 2020-02-23 04:16:25 +00:00
Elliott Hughes c8a43605c3 Remove various bits of dead code and unused workarounds.
Test: treehugger
Change-Id: I68fcd5da304d04ff4da3c3f3712fb79ce6b5791e
(cherry picked from commit f63926a5c2)
2020-02-22 22:30:13 +00:00
Elliott Hughes f77f6f003c Remove various bits of dead code and unused workarounds.
Test: treehugger
Change-Id: I68fcd5da304d04ff4da3c3f3712fb79ce6b5791e
Merged-In: I68fcd5da304d04ff4da3c3f3712fb79ce6b5791e
2020-02-22 16:53:24 +00:00
Automerger Merge Worker 685a5c4978 Merge "incremental_server: fix a use of uninitalized memory" am: 0ea130eab1 am: dff44256cf
Change-Id: Ice072f2ed2f47b01c7d84dc6ae0a3cbb6e527478
2020-02-22 09:47:58 +00:00
Treehugger Robot 0ea130eab1 Merge "incremental_server: fix a use of uninitalized memory" 2020-02-22 09:18:55 +00:00
Automerger Merge Worker 7f27a8f077 Merge "adbd: fix build breakage." am: af40ce7d57 am: eeb50d0a88
Change-Id: Iff96e234ca3666827027de159d73be52b6c01c3d
2020-02-22 06:05:05 +00:00
Automerger Merge Worker 299a6ea4a4 Merge "adbd: remove static dependency on libcutils." am: 744ba42d2d am: 7ecfa1a7f8
Change-Id: I2f08d3c97b782d7ab8761cd1cb7d6084dd3f736b
2020-02-22 06:02:02 +00:00
Josh Gao 6d949e89a4 adbd: fix build breakage.
This broke because two CLs touching the Android.bp file both
independently passed presubmit, but failed when combined.

Clean up a misindentation while we're at it.

Bug: http://b/150032367
Test: mma in system/core/adb
Change-Id: I091ef9dec806c767ffb21a5fd73b2bb37ab29ff9
2020-02-22 00:43:55 +00:00
Josh Gao 744ba42d2d Merge "adbd: remove static dependency on libcutils." 2020-02-22 00:03:21 +00:00
George Burgess IV 19b500bd50 incremental_server: fix a use of uninitalized memory
Without this, the caller is likely to assume that their buffer is
fully usable, which clang's analyzer doesn't believe is the case.

Another option is to set `*size` to nonzero.

Caught by the static analyzer:
system/core/adb/client/incremental_server.cpp:111:31: warning: 1st
function call argument is an uninitialized value
[clang-analyzer-core.CallAndMessage]

Bug: None
Test: TreeHugger
Change-Id: Ib844aa4ab3ebb297ca8f6f4289bbe3212275275b
2020-02-21 14:36:31 -08:00
Automerger Merge Worker 05b54742ff Merge changes from topic "adbwifi-system-core" am: e20d3a006a am: 7c6cb8b9dc am: 79b10538e0
Change-Id: I8a42f01bb83e944bb724fb2d10f2daca8965ee25
2020-02-21 21:50:42 +00:00
Automerger Merge Worker 68aaeea326 Merge "[adbwifi] Add pairing_auth library." am: df8f1217d0 am: 8cc1101a45 am: 1af041bb06
Change-Id: Id78335484123cd3aa5a0963d64d714000ff14737
2020-02-21 21:50:35 +00:00
Automerger Merge Worker 8c09983efe Merge "adbd_auth function signature changes." am: d62c817cce am: f3c0bcf622 am: 32bac7b483
Change-Id: I74db7c1c915a43251400348e0e11791af566cacd
2020-02-21 21:50:13 +00:00
Joshua Duong 5cf7868b7e [adbwifi] Add A_STLS command.
This command will be sent by adbd to notify the client that the
connection will be over TLS.

When client connects, it will send the CNXN packet, as usual. If the
server connection has TLS enabled, it will send the A_STLS packet
(regardless of whether auth is required). At this point, the client's
only valid response is to send a A_STLS packet. Once both sides have
exchanged the A_STLS packet, both will start the TLS handshake.

If auth is required, then the client will receive a CertificateRequest
with a list of known public keys (SHA256 hash) that it can use in its
certificate. Otherwise, the list will be empty and the client can assume
that either any key will work, or none will work.

If the handshake was successful, the server will send the CNXN packet
and the usual adb protocol is resumed over TLS. If the handshake failed,
both sides will disconnect, as there's no point to retry because the
server's known keys have already been communicated.

Bug: 111434128

Test: WIP; will add to adb_test.py/adb_device.py.

Enable wireless debugging in the Settings, then 'adb connect
<ip>:<port>'. Connection should succeed if key is in keystore. Used
wireshark to check for packet encryption.

Change-Id: I3d60647491c6c6b92297e4f628707a6457fa9420
2020-02-21 21:07:13 +00:00
Joshua Duong d85f5c0130 [adbwifi] Add adbwifi_libs, TLS connection, and MDNS implementation.
Bug: 111434128, 119493510, 119494503

Test: Enable wireless debugging in Settings UI, click "pair with pairing code"
to generate pairing code.
On client, 'adb pair <ip_address>', enter pairing code at prompt and hit
enter. Pairing should complete.
'adb logcat'.
Change-Id: I86527bd3fc52e30a8e08ec5843dc3e100abf91fa
Exempt-From-Owner-Approval: approved already
2020-02-21 21:06:40 +00:00
Joshua Duong 16d5bc6ed5 [adbd-apex] Export adbd libraries used by system_server.
Bug: b/111434128
Bug: b/149181583

Test: cat proc/`pidof system_server`/maps | grep libadb
Test: cat proc/`pidof adbd`/maps | grep libadb
Change-Id: Idd36ca31cba7e4dc2d8836d229b23665e69b42fb
Exempt-From-Owner-Approval: approved already
2020-02-21 21:06:28 +00:00
Joshua Duong c7a1fb8fd9 [adbwifi] Add pairing_connection library.
Bug: 111434128
Bug: 119494503

Test: atest adb_pairing_connection_test
Change-Id: I54d68c65067809832266d6c3043b63222c98a9cd
Exempt-From-Owner-Approval: approved already
2020-02-21 21:06:12 +00:00
Joshua Duong 340a5e86d2 [adbwifi] Add pairing_auth library.
Bug: 111434128
Bug: 119494503

Test: atest adb_pairing_auth_test
Change-Id: Ieada7b8d9d8817292175623af55eac235b938c65
Exempt-From-Owner-Approval: approved already
2020-02-21 21:04:39 +00:00
Joshua Duong 51378f41a1 adbd_auth function signature changes.
Bug: 111434128

Test: make
Change-Id: If801346e436dc7d7a7dfbbc296f7b2393d1e91af
Exempt-From-Owner-Approval: approved already
2020-02-21 20:12:23 +00:00
Automerger Merge Worker 78fde6dd94 Merge "Initialize |sentBlocksCount|" am: b182a3582c am: 0cbea75fce am: c67b5cf8c1
Change-Id: I2ab2be5a58b4de5621121420f9f9ad4a9a8db1ed
2020-02-21 06:04:52 +00:00
Yurii Zubrytskyi b182a3582c Merge "Initialize |sentBlocksCount|" 2020-02-21 05:29:45 +00:00
Automerger Merge Worker be87549d9c Merge "Remove ld.config.txt from adbd APEX" am: 5694a9559b am: 187bf6c184 am: c0b7e9174f
Change-Id: I14bb9216120a7995102de90d5cb638f2e37852b8
2020-02-21 04:46:26 +00:00
Kiyoung Kim 5694a9559b Merge "Remove ld.config.txt from adbd APEX" 2020-02-21 04:10:13 +00:00
Automerger Merge Worker 7d0bdfeb86 Merge "Fix the MacOS build of incremental*" am: f10099d79a am: 1714e21a8f am: 42ef4e2fc1
Change-Id: Ib3bcff33d63bcb78198ed3d710db8b5be71858d5
2020-02-21 02:23:11 +00:00
Yurii Zubrytskyi 12051a0937 Initialize |sentBlocksCount|
It happened to always be 0 during all tests.

Test: manual
Change-Id: I2f5089096a8ecda2ec52756199412c7d43f6903c
2020-02-20 16:03:10 -08:00
Yurii Zubrytskyi b65950642d Fix the MacOS build of incremental*
Test: local build, no feature code changes

Change-Id: Ic0072b06f6bfd6b12f26c4056bd3192cd3fdd778
2020-02-20 15:39:36 -08:00
Automerger Merge Worker 69f44ea75f Merge "[adb] Add a version field to v4 signature format" am: aab85d3b4c am: 7521152cf2 am: 6d309caa59
Change-Id: I56433cae0f16bbabdb34f75f814192bd5dfb309c
2020-02-20 12:04:22 +00:00
Kiyoung Kim f611e41e14 Remove ld.config.txt from adbd APEX
Dynamic linker will use generated linker configuration in general. As
ld.config.txt file in the APEX module will not be used, we can remove
this to avoid confusion.

Bug: 149887007
Test: m -j passed
Test: Boot succeeded from cuttlefish and walleye
Change-Id: Ic98aca819b5a4d0e0af4fe0ea25145a483aa7d53
2020-02-20 16:06:53 +09:00
Josh Gao a9b62d5452 adbd: remove static dependency on libcutils.
We were previously statically linking libcutils into adbd for several
different reasons, which were addressed as follows:

  socket functions: extracted to a statically linked libcutils_network
  fs_config: wrapped with a shared library on /system
  ATRACE: deleted the single use in adbd

Test: treehugger
Change-Id: I821fa174cfcbfa8e29a4be10de4016b817adbaf8
2020-02-19 17:44:38 -08:00
Automerger Merge Worker 6c4efc8ecf Merge "Incremental installations in adb, client/host side." am: 2bca658a3b am: f45c016896 am: 665e15e2a8
Change-Id: Ic75d516b443c7db9a09a77e51282372d5367ee61
2020-02-19 23:14:43 +00:00
Yurii Zubrytskyi 516c441fd8 [adb] Add a version field to v4 signature format
Test: manual
Change-Id: I8a1034d7131905463749d5b131dd9a3c8703fe96
2020-02-19 14:46:16 -08:00
Automerger Merge Worker 8f361f61ba Merge "Some minor fixes to libadb_tls_connection." am: 8f04b0ca58 am: 7a15d5c88f am: 4a36b59bfc
Change-Id: Ib3997fc85907ae75eb6616ce58edcb3b171c6e35
2020-02-19 22:18:04 +00:00
Alex Buynytskyy 96ff54bf34 Incremental installations in adb, client/host side.
Test: adb install --incremental <apk>

Change-Id: I74e3eaf9718a16272bc533bc8298dfcf81120caa
2020-02-19 08:01:06 -08:00
Joshua Duong 663b3c9d88 Some minor fixes to libadb_tls_connection.
Bug: 111434128

Test: atest adb_tls_connection_test
Exempt-From-Owner-Approval: approved
Change-Id: I4c23cc6ba5b14b65122e61297554dedabf43d0b4
2020-02-18 22:14:48 +00:00
Joshua Duong 788b308188 Merge changes from topic "adbwifi-client-mdns" am: a71ba615ea am: 73447676aa am: 560b4a0c94
Change-Id: Ica35bc1d72ed33a2693166a54893491647cdb12d
2020-02-18 06:03:26 +00:00
Lingfeng Yang 39e54b8c5b add a version TXT record to adb secure mdns services
In the context of secure connect, allows adbd and host adb to reject
each other based on incompatible versions without even having to
actually connect (since it is a DNS TXT).

Bug: 111434128, 119490749

Test: N/A
Exempt-From-Owner-Approval: already approved
Change-Id: I54312d8b67370c397ba81ecdbca1b27e3ee58572
2020-02-18 05:13:06 +00:00
Lingfeng Yang 615036f494 adbd: only register dnsservices via explicit API
For privacy/security reasons, let's not broadcast the adb secure
services on startup automatically, and instead leave that up to
the rest of the adbd code somehow.

Instead, this CL adds an API in daemon/mdns.h that lets the user
control when registration happens, potentially only doing so if
the developer option is enabled or something.

Bug: 111434128, 119490749

Test: N/A
Exempt-From-Owner-Approval: already approved
Change-Id: Idc994a59ef9e5d48f08796c21989883497e19ef8
2020-02-18 05:12:52 +00:00
Lingfeng Yang cef4ade8e1 adb client interface for secure services
This CL exposes a callback-based interface to perform some action for
each resolved pairing/connect service as a function of their hostname,
ip address, and port.

The ADB client can then use this information to either set up secure
connections directly, or to tell the adb host server to do so, or
something.

Bug: 111434128, 119490749

Test: N/A
Exempt-From-Owner-Approval: already approved
Change-Id: I2dd04c322df5b0597859f44703cfd2f3f29fd737
2020-02-18 05:12:36 +00:00
Lingfeng Yang 4b62bcde04 get the ip address info for all DNS services
This CL adds functionality to the class ResolvedService where the ip
address associated with a resolved DNS service is recorded.

It also avoids connecting to the device unless it is the Things-related
DNS service.

Next step is to add some kind of interface in other parts of adb code
to retrieve these IP addresses.

Bug: 111434128, 119490749

Test: N/A
Exempt-From-Owner-Approval: already approved
Change-Id: I46895a7a5bf5660f524c7323a9454f1e2c7d385c
2020-02-18 05:12:25 +00:00
Lingfeng Yang c712f2db76 make the client browse for appropriate mdns services
This CL makes it so the client looks for the adb secure pairing
and adb secure connect services. Nothing else should happen,
but this should be useful to see if the right packet traffic for
discoverability is happening.

Bug: 111434128, 119490749

Test: N/A
Exempt-From-Owner-Approval: already approved
Change-Id: I266bdb8526cf39bbfa131344dca2b1bb14c14a7b
2020-02-18 05:10:52 +00:00
Lingfeng Yang be49d8a2a9 Add mDNS services for pairing and connect
- ADB Secure Pairing
- ADB Secure Connect

Nothing else is implemented.

Bug: 111434128, 119490749

Test: N/A
Exempt-From-Owner-Approval: already approved
Change-Id: I2e7873b62a3c7631451e47f6a301f8c4a5ffa2e2
2020-02-18 05:07:32 +00:00
Joshua Duong 450d6e42b0 Merge changes from topic "adbwifi-syscore-base" am: fd8b4ea996 am: 2f7c2255fa am: 59fd702f01
Change-Id: Idd6ef31368cf99986b040c113b980c914b339211
2020-02-14 18:20:20 +00:00
Joshua Duong 4293e322f2 [adbwifi] Add tls_connection library.
Bug: 111434128, 119494503, 119493510

Test: atest adb_tls_connection_test
Exempt-From-Owner-Approval: yolo?
Change-Id: Ie9b629e4cb955702cec890bbb89a6a762e4b71b3
2020-02-14 17:41:36 +00:00
Joshua Duong ef28ca4cdc Move adb RSA utilities into its own library.
Since both the client and daemon will now be generating keys.

BUG: b/111434128

Test: atest adb_crypto_test
Change-Id: I6fac562ae5629ab30b6639fbd88d822dae6e96bd
2020-02-11 20:49:20 -08:00
Joshua Duong 9e96e71067 [adbwifi] Add adb protos.
BUG: b/111434128

Test: make
Change-Id: I7eef85c773e219e1873c9fbc30d14c17c110c3bf
2020-02-11 20:49:15 -08:00
Automerger Merge Worker 7a77da389d Merge changes Ia8f83a53,Ia1f6a659 am: 68f2e9cf1b am: b71ac7f83c am: 8593621b2d
Change-Id: I282326f1ff6158f60d4195a51ad2abdba382d483
2020-02-10 19:53:39 +00:00
Josh Gao 68f2e9cf1b Merge changes Ia8f83a53,Ia1f6a659
* changes:
  adbd: add a perfunctory abb test.
  adb: switch tests to python3.
2020-02-10 19:11:26 +00:00