Commit graph

188 commits

Author SHA1 Message Date
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
e6413fcd94 Merge "Restrict scanning port range, not emulator count" 2019-03-08 19:29:43 +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
Dario Freni
455f12446e Merge "Support splitAPK in install-multi-package." 2019-02-27 19:00:14 +00: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
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
Josh Gao
7b1cb66a83 adb: update symlink timestamps.
Bug: http://b/120162375
Test: adb sync; adb shell touch -h -d 2008-01-0101:01:01 /system/bin/ls; adb sync; adb sync
Change-Id: Iedf54528b164913739c66c71d20006e484a4f5e4
2019-02-20 13:17:56 -08:00
Dario Freni
a2f3f9558f Fix: Propagate cmd args to multi-package sessions.
Test: adb install-multi-package --staged file1.apk file2.apk. Verified
that --staged is propagated.
Bug: 118865310
Change-Id: I59cd5c49b4a60ab7bf7481732cd3bd3205820d7a
2019-01-30 16:40:02 +00:00
Josh Gao
287e442dc4 adb: turn off fastdeploy.
The PDK doesn't have frameworks/base, so having a dependency from adb to
a library in there breaks the build. #ifdef out fastdeploy until we
figure out what we're going to do here, to unbreak the PDK build.

Bug: http://b/118782743
Test: treehugger
Change-Id: I638cf09e5013935e112c7a57dae0e7e94e1a4680
2019-01-29 11:21:15 -08:00
Josh Gao
74ccdf984b adb: convert more stuff to unique_fd.
Test: adb_test
Test: adbd_test
Test: test_device.py
Change-Id: Ie75f0b811d2c75d508e6ecffb40579308f5789d0
2019-01-23 17:11:13 -08:00
Henry Daitx
09158b1d5a Merge "Fix fastdeploy failure in Windows" 2019-01-23 20:52:01 +00:00
Henry Daitx
f788f67c23 Fix fastdeploy failure in Windows
adb --fastdeploy creates a TemporaryFile to which the stdout for a shell
command is redirected. This happens while the file is still open (the
TemporaryFile object holds the file handle). In Linux this works, but
Windows blocks the operation with an error of "The process cannot access
the file because it is being used by another process".

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

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

Bug: 122592986
Change-Id: Iaaaf62cda43e4714d7f979e6a690549b383a7b82
2019-01-23 11:00:45 +00:00
Josh Gao
89a6fdc4b3 Merge "adb: win32: LinePrinter Unicode support" 2019-01-23 03:47:21 +00:00
Alex Buynytskyy
01a65eebbf Adding new feature to adb "abb".
It will allow clients to detect if abb is supported.

Test: manual
BUG: 111621042

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

Bug:121166534
Test: adb connect against a cuttlefish instance over the shm proxy.
Change-Id: Ic7fc848c60a85eef968c3735838c87cb7fdaf38b
2019-01-17 15:58:41 -08:00
Dario Freni
bc54c3670f Multi-package support for APEX.
This CL introduces two changes to adb install-multi-package:
- If there is at least one apex package in the list of packages, use the
  --staged parameter for both the parent and the child sessions
- When the package being sent is an apex, use the --apex parameter

Bug: 118865310
Test: Printed out the resulting commands and verified that both
non-staged and staged workflow are accepted by PackageManager. Tried
scheduling install sessions for a mix of APK/APEX, only APKs, only APEX.
Change-Id: I8d1a6a7c5408fb95c10d79e38ddaf115a46f5d8b
2019-01-16 21:59:34 +00:00
Treehugger Robot
6410fd2434 Merge "adb: switch install to unique_fd." 2019-01-16 05:45:26 +00:00
Treehugger Robot
e5f61a9bcd Merge "Admit that there's more adb install help available." 2019-01-12 06:21:31 +00:00
Josh Gao
61f872f2a8 adb: switch install to unique_fd.
Test: mma
Change-Id: I9474c003e0eb4a8cb183090a2e525d78932d3bea
2019-01-11 13:57:36 -08:00
Elliott Hughes
0d4bf80968 Admit that there's more adb install help available.
Test: adb --help
Change-Id: I1e4d4250ef8bc55cfa660f87ebdbd7d664509266
2019-01-11 13:50:05 -08:00
Patrick Baumann
dc58b0a388 Adds atomic install support to adb
This change adds an install-atomic command to adb that is shorthand for
creating an atomic install session and an individual session for each
APK supplied to the command.

Bug: 109941548
Test: run command with multiple APKs, observe atomic install
Change-Id: I2817a1ed2d312925d9c7bd621e6c82670a6275fd
2019-01-11 18:13:36 +00:00
David Anderson
22a8462336 Merge "adbd: Automatically disable verity in adb remount." 2019-01-09 19:48:47 +00:00
Alex Buynytskyy
640407d632 Adding Android Binder Bridge (abb) utility launched from adbd.
Once launched, abb will listen for incoming Binder cli requests.
Executing in-process provides 6x latency improvement (125ms vs 25ms on
PixelXL) for commands like 'package path'

Intended usage by Android Studio for fast deployment and patching of APKs.

Test: manual
BUG: 111621042

Change-Id: Ica84eb2ec9628efa441ecd627b119f3361feaf9f
2019-01-07 15:45:11 +00:00
Josh Gao
5021cfc135 adb: switch usb_linux helper to string_view.
Test: test_adb.py
Test: test_device.py
Test: $ANDROID_HOST_OUT/nativetest64/adb_test/adb_test
Test: adb shell /data/nativetest64/adbd_test/adbd_test
Change-Id: Iccbeb61905852b72fceec1bca498895b38a2e7d4
2018-12-21 01:43:34 -08:00
Josh Gao
0f29cbc750 adb: switch unix_open to string_view.
Test: test_adb.py
Test: test_device.py
Test: $ANDROID_HOST_OUT/nativetest64/adb_test/adb_test
Test: adb shell /data/nativetest64/adbd_test/adbd_test
Change-Id: Ieecc9b1b7f2111f4da45d4bbd1b7703535fe7d4d
2018-12-21 01:43:31 -08:00
David Anderson
a5db1d72cf adbd: Automatically disable verity in adb remount.
Before overlayfs, we supported deduplicated filesystems by undoing
deduplication in recovery. This required an extra reboot cycle, so we
changed "adb remount" to disable verity and boot to recovery in one
command.

After overlayfs, adb remount is still trying to undo deduplication,
which leads to very confusing messages. This patch makes things a bit
clearer. "adb remount" will disable verity, which installs overlayfs.
"adb remount -R" will do the same except automatically reboot.

Bug: N/A
Test: adb remount on dynamic partitions device
Change-Id: Id72f6b9e2297c2f4d5722d5679f6264fe660e631
2018-12-17 13:15:05 -08:00
Treehugger Robot
17d41711c6 Merge "Change --fastdeploy behaviour" 2018-12-17 11:10:18 +00:00
Henry Daitx
ee01c80afe Change --fastdeploy behaviour
--fastdeploy does not require -r anymore, and reverts to a normal install
if the application is not already on the device.

Bug: 120828611

Test: mm -j72
Test: adb install --fastdeploy --force-agent --local-agent /mnt/raid/boat-attack-apk/boat-attack-swappy.apk
Change-Id: Ice2a71493a34ee7d0debabcce6a9aebb0af79e62
2018-12-14 15:25:15 +00:00
Josh Gao
e89a55dd41 adb: make adb raw bidirectional.
Test: adb raw shell:
Change-Id: I973f42c55c71ffd125e58f76d29100a2d5b0c308
2018-12-12 12:54:28 -08:00
Treehugger Robot
bcc2d60826 Merge "Removes ASEC-related install flags" 2018-12-07 18:11:09 +00:00
Patrick Baumann
24439442a8 Removes ASEC-related install flags
Bug: 109941548
Test: install still works
Change-Id: Ibaf87e678217a1ce140b4024d16ceb8d27fadec0
2018-12-07 16:15:31 +00:00
Henry Daitx
f21edf3edd Fix adb not correctly reading return code from DeployAgent
Certain error conditions were getting lost because adb was wrongly
reading DeployAgent's return code as always 0.

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

Bug: 120197330
Change-Id: If835fd6ca2051be8e5ff6c957e08b1e458053989
2018-12-06 15:46:38 +00:00
Treehugger Robot
fa105049d8 Merge "adb: stop using adbkey.pub." 2018-11-27 21:35:44 +00:00
Josh Gao
2dc4cabe06 adb: stop using adbkey.pub.
An adbkey/adbkey.pub pair that doesn't match up results in a
hard-to-diagnose scenario where "Always allow from this computer"
doesn't work. The private key contains all of the information that's
in the public key, so just extract the public key out of the private
key instead of storing them separately.

Bug: http://b/119634232
Test: rm ~/.android/adbkey.pub; adb kill-server; adb shell true
Test: rm ~/.android/adbkey*; adb kill-server; adb shell true
Change-Id: I0ae9033dbcd119c12cfb2b3977f1f1954ac800c1
2018-11-15 17:50:57 -08:00
Mark Salyzyn
9f1cf25332 switch to using android-base/file.h instead of android-base/test_utils.h
Test: compile
Bug: 119313545
Change-Id: I4f7ad84743e974b4b4d1d7256088f6c8b749a237
2018-11-14 09:35:34 -08:00
Josh Gao
cd85556151 adb: libusb: don't set interface alternate setting.
Match behavior with the legacy implementation.

Test: ADB_TRACE=1 adb server nodaemon
Change-Id: If1451871f252ef4499b3bb887e947169f8d2432f
2018-11-12 14:08:40 -08:00
Josh Gao
b35ee22887 adb: pin USB interface versions on darwin.
It's possible to build against an SDK that's newer than the OS that
we're actually running via Xcode update, and Apple increments the
unversioned IOKit interface IDs to the newest version on every release,
which leads to mysterious failures to acquire an interface.

Pin the interface versions to IOUSBFamily 5.0.0, which shipped on OS X
10.7.3.

Bug: http://b/119264733
Test: ./test_device.py
Change-Id: Id26760bc62c89a1f7ef67511b21f9d9252ab69f3
2018-11-08 16:49:46 -08:00
bohu
09faa66006 adb: print emulator console output
It is very helpful to see the output of the following adb command:
adb emu <emulator commands...>

Change-Id: I7905370fb955de4d457a323a7e9e780aaca5d45e
2018-10-30 14:36:33 -07:00
Victor Hsieh
02ef4bb190 adb install-multiple to also accept .fsv_sig
.fsv_sig will be fs-verity signature in PKCS#7 format.

Test: adb install-multiple foo.apk foo.apk.fsv_sig
Bug: 112037636
Change-Id: I4a9b2203334d4974602c7f138222ade1aa319ccb
2018-10-29 16:55:06 -07:00
bohu
ea0c3cbc18 adb: correct tcpip help message
'adb tcpip <mode>' is meant to affect adbd, not
the host adb server.

BUG: 111434128
Change-Id: I78c958bfbede60b20fb7e0f2444e5b21ecb90f7a
2018-10-24 10:38:33 -07:00
Josh Gao
fb08510784 Add feature flag for b/110953234 fix.
Bug: http://b/110953234
Bug: http://b/117946501
Test: adb features
Test: test_device.py
Change-Id: I340a30544a6d0ab1b2545e5371c8f98d04158c56
2018-10-23 18:28:46 +00:00
Dario Freni
29814deaa7 Accept apex packages as argument.
Bug: 112669193
Test: Successfully reaches PackageManager. Doesn't break existing flows.
Change-Id: If4a173e290ebf0b70beb97111a6d75400da7ec8d
2018-10-23 11:07:16 +01:00
Elliott Hughes
d2aaede610 adb: don't use <error.h>.
This should fix the bloody Mac build, which doesn't have <error.h>. Since
we weren't entirely happy with error(3) anyway, switch to the toybox
style of error_exit and perror_exit, which are slightly briefer and quite
a bit more intention-revealing.

Bug: N/A
Test: builds
Change-Id: Ic8e411906c363af51657da5ce947b25a0b6bb1f3
2018-10-22 17:04:32 -07:00
Elliott Hughes
4679a39610 adb: rationalize fatal/error logging.
Let's use LOG(FATAL)/PLOG(FATAL) for actual fatal stuff.

Add a Windows error(3) and move folks who didn't really mean "abort"
fatal over to it. Also get rid of syntax_error which wasn't adding a
lot of value, and most of the places it was adding "usage: " didn't seem
entirely appropriate anyway.

In particular, we seemed to have confused fastdeploy.cpp into aborting
in most user error cases, and none of the reviewers noticed. Clearly
we'd all lost track of far too many options.

(I've also cleaned up a few random instances of fprintf(3) + exit(2).)

Bug: N/A
Test: manual
Change-Id: I3e8440848a24e30d928de9eded505916bc324786
2018-10-19 14:04:24 -07:00
Treehugger Robot
11cbf7d711 Merge "adb: add reboot-fastboot command" 2018-10-12 03:38:05 +00:00
Mark Salyzyn
d8e94bd3f2 adb: add reboot-fastboot command
Alias reboot-fastboot to reboot fastboot

Test: manual
Bug: 117604012
Change-Id: I5f7842e420fbc0b1d9ae8e1231887fb8644b29e9
2018-10-11 13:21:16 -07:00
Pirama Arumuga Nainar
a2ccce870c Merge changes from topic "windows-libcxx"
* changes:
  Do not enable -Wold-style-cast for Windows
  Add sys/types.h in utf8.h
  Adapt to switch to libc++ for Windows
2018-10-11 17:00:53 +00:00
Idries Hamadi
86554e949b Merge "Reverted aapt dependency to be a dependency on libandroidfw" 2018-10-11 06:15:04 +00:00