Show transfer rate for individual files, and for the overall transfer.
Bug: http://b/30411535
Change-Id: If2f3008f1287b1d1add4a23c3430b39885b6c904
Test: inspected output manually
Previously, we weren't printing a newline when reporting transfer
rates, so only the last transfer rate printed would be visible.
Bug: http://b/30667841
Change-Id: Id341147912d057673de4ad26a8f618f04a8c02f3
Test: inspected output manually
sync with list-only was using SyncConnection::Error to print its output
persistently, which would prepend "adb: error: " to messages.
Change-Id: I90df5fc1123b8c613c811cf66c37aef05663b1e4
stat on Windows fails with ENOENT when passed a path with a trailing
slash or backslash, regardless of whether the target is actually a
directory. Emulate the correct POSIX behavior by stripping trailing
path separators and then checking if the target is a directory if
successful.
Bug: http://b/30481559
Bug: https://code.google.com/p/android/issues/detail?id=214633
Change-Id: I1d398d19a9bce1ecb3fdc4aabc31aa98c82c3f93
Test: Relevant adb_tests pass on Linux and Windows 10.
* Use const reference type for parameters to avoid unnecessary copy.
* Suppress warning of not using faster overloaded string find function.
Bug: 30407689
Bug: 30411878
Change-Id: I6cfdbbd50cf5e8f3db6e5263076d3a17a9a791ee
Test: build with WITH_TIDY=1
Merged-In: Ie79dbe21899867bc62031f8618bb1322b8071525
This keeps regressing, so add a test to keep this from happening.
Bug: http://b/23603716
Bug: http://b/25965770
Bug: http://b/29565233
Test: Ran test with/without commit cd5d737, fails before, passes after
Change-Id: I8c431e10fc76da5a9fd404dd70f17bb8a8df24e6
SIGHUP handling depends on the local socket fd being fully closed in
order to trigger an event on its counterpart. Release the local socket
fd inside of Subprocess when returning it to ensure this.
Functionally, a cherry-pick of internal commit 42afe20.
Bug: http://b/29565233
Change-Id: I13b17bcddf0b396a5f4880f9e410fbbf24d9370d
This commit fixes two somewhat related issues in shell_service.
- The fd returned by StartSubprocess is owned by a unique_fd
contained in the Subprocess object, but also gets closed by the
caller. Resolve this by duping the returned file descriptor.
- A Subprocess object can be destroyed immediately after its initial
construction in StartSubprocess if we're sufficiently unlucky.
Split up the fork/exec and "start management thread" steps, so that
we can safely do everything we need to do on the Subprocess before
handing it over to the thread that'll eventually destroy it.
Bug: http://b/29254462
Change-Id: Id9cf0b7e7a7293bee7176919edc758597691c636
The <hardware/qemu_pipe.h> header isn't related to any loadable
hardware module, this patch thus relocates it to <system/qemu_pipe.h>
which is a much more logical location.
Note the following changes:
- The pipe name must begin with the 'pipe:' prefix to avoid an
un-necessary snprintf() and buffer copy.
- Does not probe for the obsolete /dev/goldfish_pipe device, i.e.
only use /dev/qemu_pipe instead.
- Use QEMU_PIPE_DEBUG() instead of D() as the debugging macro.
+ Update ADB to use the newest <system/qemu_pipe.h>
+ Add qemu_pipe_frame_send() and qemu_pipe_frame_recv() utility
functions which replace the obsolete qemud_channel_send() and
qemud_channel_recv() from the defunct <hardware/qemud.h>
header.
BUG=25875346
Change-Id: Ic290a5b79d466c2af64b49bd9134643277c11bfd
`adb root` would hang for devices connected over TCP/IP, because they
never come back. Unfortunately, there doesn't seem to be an easy way to
find out what we're talking to, so replace it with a long sleep for now.
Bug: http://b/27836058
Change-Id: Icd6e6bf817ca9e2124c2961665c37b2f31f7ef29
Before this, adb will fail to start for the second user who tries because
/tmp/adb.log already exists and isn't writable by the second user.
Also allow $TMPDIR to override the use of /tmp.
Bug: http://b/29201686
Bug: https://code.google.com/p/android/issues/detail?id=211420
(cherry picked from commit d89a6c2285)
Change-Id: Ibb1369e8043feb9774593e317dcd7bb93323fd89
Before this, adb will fail to start for the second user who tries because
/tmp/adb.log already exists and isn't writable by the second user.
Also allow $TMPDIR to override the use of /tmp.
Bug: https://code.google.com/p/android/issues/detail?id=211420
Change-Id: Ic53da981ac0fa45bfed62e7b351d75dca0540235
When non-interactive sessions exit via Ctrl+C, adbd sends SIGHUP
to the child process to let it know to exit. However, adbd was not
closing the pipes to the child process, so if the subprocess ignored
SIGHUP and continued writing it could fill up the pipe and block
forever while adbd waits for it to exit.
This CL adds the necessary calls to close the subprocess pipe after
sending SIGHUP.
Bug: 28981563
Change-Id: I318e322e563241052648361172f4859c297837fb
(cherry picked from commit f2aa186c7b)
When non-interactive sessions exit via Ctrl+C, adbd sends SIGHUP
to the child process to let it know to exit. However, adbd was not
closing the pipes to the child process, so if the subprocess ignored
SIGHUP and continued writing it could fill up the pipe and block
forever while adbd waits for it to exit.
This CL adds the necessary calls to close the subprocess pipe after
sending SIGHUP.
Bug: 28981563
Change-Id: I318e322e563241052648361172f4859c297837fb
Get rid of unused includes + replace a fixed-size buffer with an
std::string
(cherry-pick of 049ebb810f466d916ec9e73cdf28624b57a8c25d.)
Change-Id: I4f9927b900a79a012b5d52908b9d22ac3d2a401c
Emulator console now requires authentication; this means
'adb emu ...' commands silently fail because of it.
This CL adds an 'auth <token>' command to each user command,
making sure it won't be silently ignored.
(cherry-pick of a9e2b99a7fdd31bcd6d852c6db26fe592236a24f.)
Bug: https://code.google.com/p/android/issues/detail?id=211233
Change-Id: Id9ca4999fd2e6393cc88278eaf444243e13c0ec0
Emulator console now requires authentication; this means
'adb emu ...' commands silently fail because of it.
This CL adds an 'auth <token>' command to each user command,
making sure it won't be silently ignored.
Bug: https://code.google.com/p/android/issues/detail?id=211233
Change-Id: Id9ca4999fd2e6393cc88278eaf444243e13c0ec0
Previously we loop through local ports every second, this patch improves
the strategy by retrying only just disconnected emulators.
Bug: 26468076
Bug: 19974213
Bug: 22920867
Change-Id: I43ccb746922d104202b0f81a3d163d850bbc890e
adbd on device kicks the usb connection when usb IO fails. But to notify
adb on host to reconnect it, adbd needs to close ep0 to reset the usb
connection. Otherwise, adb on host cann't connect the device unless the
usb cable is reconnected or adb host server is restarted.
This can be tested by using `adb reconnect device` command.
Bug: 25935458
Change-Id: I80979d6029e60b9cfd218f7b9b5201810238ec07
(cherry picked from commit 69e97e4bee)
close_all_sockets was assuming that all registered local sockets used
local_socket_close as their close function. However, this is not true
for JDWP sockets.
Bug: http://b/28347842
Change-Id: I40a1174845cd33f15f30ce70828a7081cd5a087e
(cherry picked from commit 53eb31d87c)
sockets.cpp was branching on whether a socket close function was
local_socket_close in order to avoid a potential deadlock if the socket
list lock was held while closing a peer socket.
Bug: http://b/28347842
Change-Id: I5e56f17fa54275284787f0f1dc150d1960256ab3
(cherry picked from commit 9b587dec6d)
Our version of mingw doesn't support std::mutex or
std::recursive_mutex, so implement our own using the Windows primitives.
Bug: http://b/28347842
Change-Id: I4e1d56a89bc5fcb5f859bf5014343697a4a85b77
(cherry picked from commit 903b749f78)
am: 43c058e51a
* commit '43c058e51a652874cfdf0c687ba1dee18f13f993':
adb: use asocket's close function when closing.
Change-Id: I0681ff8c31c2f221e246a86857fbff779d2b7dcf
am: 71c062f40a
* commit '71c062f40ac9ac5175f55bce03ce0cb8eb540710':
adb: switch the socket list mutex to a recursive_mutex.
adb: clang-format sockets.cpp.
adb: add implementations of mutex, recursive_mutex.
Change-Id: Icd8a74f1052f7b4c4616ddf23b65c7208195202c
close_all_sockets was assuming that all registered local sockets used
local_socket_close as their close function. However, this is not true
for JDWP sockets.
Bug: http://b/28347842
Change-Id: I40a1174845cd33f15f30ce70828a7081cd5a087e
sockets.cpp was branching on whether a socket close function was
local_socket_close in order to avoid a potential deadlock if the socket
list lock was held while closing a peer socket.
Bug: http://b/28347842
Change-Id: I5e56f17fa54275284787f0f1dc150d1960256ab3
Our version of mingw doesn't support std::mutex or
std::recursive_mutex, so implement our own using the Windows primitives.
Bug: http://b/28347842
Change-Id: I4e1d56a89bc5fcb5f859bf5014343697a4a85b77
This makes it possible to get a core dump from adbd when it decides to
exit.
Bug: http://b/28347842
Change-Id: I4cfe5f273f62b2c32e61232d3c39881ecdd6b582
adb implements its own file descriptor emulation layer on Windows,
which requires the use of adb_close instead of close throughout the
codebase. Add a template argument to unique_fd that allows for this.
Bug: http://b/28347842
Change-Id: I6397261f4973d49f2f8e04257bf67b348585bb63
This CL adds support to forward or reverse TCP port 0 to allow the
system to automatically select an open port. The resolved port number
will be printed to stdout:
$ adb forward tcp:0 tcp:8000
12345
$ adb reverse tcp:0 tcp:9000
23456
This allows testing to be more robust by not hardcoding TCP ports which
may already be in use.
Forwarding port 0 is a host-only change and will work with any device,
but reversing port 0 requires the device to be updated with a new adbd
binary.
This CL also does a little bit of cleanup such as moving the alistener
class out of adb.h, and adds some error checking and additional tests.
Bug: 28051746
Test: python -m unittest discover
Test: adb_test
Test: `adb forward` and `adb reverse` with tcp:0
Change-Id: Icaa87346685b403ab5da7f0e6aa186aa091da572
am: 72e47300fb
* commit '72e47300fb2d7842509c492fcb8ee363d43ef446':
adb: search for a maximum of 16 emulators.
Change-Id: I51d01d4d1d8985c37c6cf3c4dbaa19eba49ae306
Android Wear has unfortunately been using port 5601 for years, which
falls into the range of ports we were previously polling for Android
emulators. Reduce the maximum number of emulators we can support so
that 5601 no longer falls within our range.
Bug: http://b/26468076
Change-Id: I931809cfa412122f4781eebe0164facab12c95f0