Commit graph

218 commits

Author SHA1 Message Date
Joshua Gilpatrick
af3ce0876c Fastdeploy converted to c++ and bin2c on the jar.
Test: Added test for DeployPatchGenerator and PatchUtils cpp files.
Bug: 138130943
Change-Id: I6a128eff4cda00dd05c1bccec71e2678a8b13324
2019-07-29 12:00:09 -07:00
Josh Gao
63e8d9815f adb: switch from system_clock to steady_clock.
Test: treehugger
Change-Id: I10b884dc159a5ba624bc0f7ad53a402bffb14293
2019-07-22 16:18:25 -07:00
Josh Gao
88d23135d2 Merge changes from topic "fdevent_refactor"
* changes:
  adb: fdevent: extract Add/Del/SetTimeout.
  adb: fdevent: extract Create/Destroy from fdevent_context_poll.
  adb: fdevent: move TerminateLoop to fdevent_context.
  adb: fdevent: move CheckMainThread logic to fdevent_context.
  adb: fdevent: delete FDE_CREATED.
  adb: fdevent: move run queue to fdevent_context.
  adb: implement fdevent_reset by constructing a new context.
  adb: move fdevent implementation out to a separate file.
  adb: de-globalize fdevent context.
  adb: move fdevent to its own folder.
  adb: add superfluous include.
2019-07-09 20:02:29 +00:00
Justin Yun
5d0ac62995 Rename product_services to system_ext
Update adb, fastboot and mount point

Bug: 134359158
Test: build and check if system_ext.img can be flashed
Change-Id: I6219f72242c5fe42a508008c0b1fd218d74da5b6
2019-07-09 08:56:53 +00:00
Josh Gao
57e09b16ca adb: move fdevent to its own folder.
Preparatory refactoring for platform-specific implementations.

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

Change-Id: I30eb6e8a4fd43b1548a9398376c72e2cb31223a4
2019-07-08 18:30:26 +00:00
Tao Bao
8eea2cae86 Merge "adb: Allow adb rescue getprop." 2019-06-05 20:43:55 +00:00
Tao Bao
599eee1f37 adb: Allow adb rescue getprop.
Which will dump all the allowed properties, similar to `adb shell
getprop`.

Bug: 134027350
Test: Run the command under rescue mode.
Change-Id: Id668224098006d71ee192c8c2bea5d791d2423c1
2019-06-04 14:59:58 -07:00
Mohammad Samiul Islam
b581ce93bb Allow adb to handle single paramter with install-multi-package flag
Bug: 130164367
Test: $adb install-multi-package dummy.apk
      It installs successfully.

Change-Id: I5775813d10b7a8d865518ce5480a401e8f41e876
2019-05-29 15:00:00 +01:00
Al Sutton
09070afd38 Merge "Add deprecation warning to adb backup/restore" 2019-05-10 08:40:50 +00:00
Treehugger Robot
f0d59e24c3 Merge "NFC: Fix potentially uninitialized 'port' variable." 2019-05-10 01:34:56 +00:00
Stephen Hines
391c40b9ec NFC: Fix potentially uninitialized 'port' variable.
Bug: http://b/131390872
Test: Builds with -Wconditional-uninitialized.
Change-Id: Ie699ec39307fb3b66ade8248cdbe3d6de42533a7
2019-05-09 12:55:41 -07:00
Al Sutton
31d335f39f Add deprecation warning to adb backup/restore
Test: Manual execution and verification of the message
Fixes: 131891013
Change-Id: Idc38fcdace2d79668a4daac0b99fb87d04fb4cb8
2019-05-09 16:14:05 +00:00
Josh Gao
27241a7a96 Revert "Revert "Add a way to turn off unique_fd's operator int.""
The original commit broke aosp-master-with-phones, because of
vendor libraries the depended on the int versions of libbase functions.

This patch reverts the revert, and also adds ABI-compatibility shims for
the replaced functions.

This reverts commit 2c58e1924a.

Bug: http://b/131312539
Test: treehugger
Test: forrest run of aosp-master-with-phones
Change-Id: I75cc84ec8d963e20862f7662e8e2f409471f41cc
2019-05-06 16:18:02 -07:00
Josh Gao
ef4a999343 adb: increase adb [un]root timeout.
3 seconds isn't generous enough, because if we're rapidly restarting
(e.g. `adb root; adb unroot`), init will wait 5 seconds to restart us.

Test: `adb root && adb unroot`
Change-Id: I353e8d1ee14f3b08416445ff627dea4a49afd9a4
2019-05-01 18:53:43 -07:00
Treehugger Robot
fe6cc3e2d3 Merge "adb: restore generation of public key in adb keygen." 2019-04-29 22:31:17 +00:00
Josh Gao
032989a2ba adb: restore generation of public key in adb keygen.
We don't need the public key to be generated at ~/.android/adbkey.pub,
but it's still useful to be able to generate the public key for use with
ADB_VENDOR_KEYS.

Bug: http://b/119634232
Test: manual
Change-Id: Iecd6ff1bba4af4ba142456034f3faf52bb9e017d
2019-04-29 12:36:32 -07:00
xunchang
c2265c5343 Support adb rescue wipe command
Support `adb rescue wipe` command on the host side. This command runs
under the rescue mode and wipes data (and cache/metadata).

Bug: 131037235
Test: run adb rescue wipe

Change-Id: Ib3a3f2d564cc19d0446540d616cc21489ba558c2
2019-04-26 10:37:13 -07:00
Ian Kasprzak
e30fe5fe89 Merge "Revert "Add a way to turn off unique_fd's operator int."" 2019-04-25 17:16:55 +00:00
Ian Kasprzak
2c58e1924a Revert "Add a way to turn off unique_fd's operator int."
This reverts commit 93d63c010a.

Reason for revert: b/131312539 - All aosp-master-with-phones phones failing boot / health check.

Change-Id: Id4239f93484b7d6b8d9bcd355a59cbd40d9766e2
2019-04-25 15:59:28 +00:00
Josh Gao
971bae0bcf Merge "Add a way to turn off unique_fd's operator int." 2019-04-24 22:58:00 +00:00
Josh Gao
93d63c010a Add a way to turn off unique_fd's operator int.
unique_fd's implicit conversion to int has led to tons of problems (see
all of the overloads for close, fdopen, fdopendir, etc.). Add a switch
that can turn it off, and reduce the ridiculous amount of work to fix up
callers by introducing a borrowed_fd type that can be constructed from
either int or unique_fd.

Test: treehugger
Change-Id: If77cf5cbcaddacdaec5919a15b3520fb68f51a62
2019-04-24 12:59:42 -07:00
Tao Bao
11cf30b5ed adb: Support rescue install and getprop.
Bug: 128415917
Test: Enter rescue mode on taimen. Send the following commands:
      `adb rescue getprop ro.build.fingerprint`
      `adb rescue getprop ro.build.date.utc`
      `adb rescue getprop ro.build.invalid`
      `adb rescue install /path/to/package.zip`
Test: Sideload on taimen w/ `adb sideload /path/to/package.zip`.
Change-Id: Ia246b30314fbcd2bd4cc71a8085a280e33041967
2019-04-19 12:51:57 -07:00
Tao Bao
55d407ec4a adb: Recognize rescue mode.
This CL adds client support to recognize the rescue mode (which will be
served by recovery image). It also allows waiting for a device to enter
rescue mode. The support for the actual rescue commands will be added in
follow-up CLs.

Bug: 128415917
Test: `adb devices` recognizes devices under rescue mode.
Test: `adb wait-for-rescue` waits for device to be in rescue mode.
Change-Id: I367d7339fe68006aba09a1e3db6370d472296676
2019-04-17 13:47:02 -07:00
Josh Gao
296ac3f024 adb: fix mac build breakage.
Bug: http://b/129786641
Test: none
Change-Id: Ibe051a0db2f912d1f7e55369e25a5bd38bf86fd5
2019-04-02 16:31:32 -07:00
Josh Gao
3705b346b9 adb: make adb reconnect perform a USB reset.
Bug: http://b/128941083
Test: manual
Change-Id: Iaf46d2c46cc82b590768004486d119244591c8e2
2019-03-28 15:47:44 -07:00
Greg Kaiser
e2125fdeb1 adb: Avoid extra std::string copies
When a function argument takes a std::string, it's inefficient to
pass std::string::c_str(), since that creates an additional copy.
So we change these calling sites.

Test: TreeHugger
Change-Id: I1c0fde7275eb3ebd3baf05ec62581b0243655608
2019-03-26 12:00:19 -07:00
Greg Kaiser
5fe40a66b2 adb: Fix return value in error case
When we introduced __adb_check_server_version() as a function
returning a 'bool', we missed missed converting once instance
of "return -1;" to "return false;".  Thus, we're returning 'true'
in this case as our non-zero value gets implicitly converted to
'true'.

We fix this case as well with this CL.

Test: TreeHugger
Change-Id: I90b01567d927f36d2d963561b676b3bfabfcee49
2019-03-18 07:00:00 -07:00
Josh Gao
1e1ae45a8c adb: avoid sign extension of shell return code.
Windows has int32_t return codes, which results in return codes 128-255
being sign extended into a negative number. Manually truncate the return
codes we get to preserve their values.

Test: test_device.py on windows
Change-Id: If41d6d469350301704f6ecff72ad17b412db3e04
2019-03-15 14:54:32 -07:00
Josh Gao
d10b7c4e02 adb: attempt to exec newer adb servers on Linux.
Test: manual
Change-Id: Iebdfa292f21b2871e6010ab6cc964134fec447e9
2019-03-14 15:41:41 -07:00
Josh Gao
3c99b0f94f adb: make root/unroot wait for the device to come back.
Test: manually unplugged a device after adb root
Change-Id: I588283a666cc5e19d809d7ce81b5300398e8be2d
2019-03-11 15:59:09 -07:00
Josh Gao
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