ADB local transport for the emulator based on qemu pipes uses a socket
transport. Before this CL, multiple connection requests accepted by the
qemu pipe device would result in ADB transport with the same serial.
The register function would fail as a result, and all subsequent
connections would fail.
Test:
while true; do adb kill-server; adb devices; done
Doesn't fail for > 10 minutes.
This CL replaces an earlier CL
(I0fdcf2694516151c5f8f8e1580648b940679c981) that was unsafe for real
devices.
BUG=27441661
Change-Id: I7d801b175f3bee10fc7e0ab1b12d5623984371b9
ADB local transport for the emulator based on qemu pipes uses a socket
transport. Before this CL, multiple connection requests accepted by the
qemu pipe device would result in ADB transport with the same serial.
The register function would fail as a result, and all subsequent
connections would fail.
Test:
while true; do adb kill-server; adb devices; done
Doesn't fail for > 10 minutes.
This CL replaces an earlier CL
(I0fdcf2694516151c5f8f8e1580648b940679c981) that was unsafe for real
devices.
BUG=27441661
Change-Id: I7d801b175f3bee10fc7e0ab1b12d5623984371b9
forkpty only returns an fd on the master side; trying to keep track of
it on both sides is incorrect.
Bug: http://b/27504427
Change-Id: Ia4a454d8490c77738f9c3350a4236b3d99c8758b
(cherry picked from commit fcb063ce37)
If we return before waiting for the other side to finish, it'll get sent
SIGHUP.
Bug: http://b/27414382
Change-Id: I93514d2242ed0d7aa93a6ec6836270dc0783506d
(cherry picked from commit d26abed750)
am: 6aafa03c60
* commit '6aafa03c606d06a5cb6549c1cc382a2038552256':
adb: wait for restore to complete before returning.
adb: wait for adbd to die and respawn in root/unroot.
adb: make ScopedFd universally accessible and useful.
* changes:
adb: wait for restore to complete before returning.
adb: wait for adbd to die and respawn in root/unroot.
adb: make ScopedFd universally accessible and useful.
forkpty only returns an fd on the master side; trying to keep track of
it on both sides is incorrect.
Bug: http://b/27504427
Change-Id: Ia4a454d8490c77738f9c3350a4236b3d99c8758b
If we return before waiting for the other side to finish, it'll get sent
SIGHUP.
Bug: http://b/27414382
Change-Id: I93514d2242ed0d7aa93a6ec6836270dc0783506d
The directory name should be based off of the local path, not the remote
path.
Change-Id: I75b089b8734e9dbf8e466b1e00ea18549fd101bb
(cherry picked from commit 89ec3a8d0f)
This matches scp's behavior when pulling a directory that collides
with a symlink to a directory.
Bug: http://b/27362811
Change-Id: I0936d1ad48f13e24cd382e8e8400cc752bac3b66
(cherry picked from commit 1e611a33d5)
Currently targeting a device by serial requires matching the serial
number exactly. This CL relaxes the matching rules for local transports
to ignore protocol prefixes and make the port optional:
[tcp:|udp:]<hostname>[:port]
The purpose of this is to allow a user to set ANDROID_SERIAL to
something like "tcp:100.100.100.100" and have it work for both fastboot
and adb (assuming the device comes up at 100.100.100.100 in both
modes).
This CL also adds some unit tests for the modified functions to make
sure they work as expected.
Bug: 27340240
Change-Id: I006e0c70c84331ab44d05d0a0f462d06592eb879
(cherry picked from commit 3f902aad5b)
On linux we archive both Linux and Windows binaries.
Bug: 27315911
Change-Id: I17d25cd1ea611a9c917f1e78b47f21a8959eea20
(cherry picked from commit 71edfc8b9a)
Previously, for `adb pull $remote $local`, we would do the equivalent of
mkdir -p on `dirname $local`. This patch changes the behavior to only
creating directories that are being pulled, like scp.
Bug: http://b/27362811
Change-Id: I79f975ee9f2d9bc9e8be6a7c4f2de6d7ae2d2d23
(cherry picked from commit 71728ca300)
am: 55592371dc
* commit '55592371dca3ccb25d516635b41bab73ed8b6059':
adb: clean up quotes in test_device.py.
adb: mkdir the correct directory name when pulling.
adb: cleanup file skipping logic.
Currently adb only realizes a TCP transport has gone away when it tries
to send a packet, which caused problems in particular for `adb reboot`
since no packets are sent, leading to the client hanging until Ctrl+C.
This CL turns on TCP keepalive packets to send 1 packet every second,
allowing up to 10 failures before disconnecting. Using built-in TCP
functionality turns out to be much cleaner in this case than trying to
implement our own keepalive packets at the application layer, and
should be more lightweight since it's all done in the TCP stack.
Bug: http://b/23093474
Change-Id: Ifb41cbb85b9752a9f394e1eed3c6ac4da47a4e4d
(cherry picked from commit bfd9503d1d)
This matches scp's behavior when pulling a directory that collides
with a symlink to a directory.
Bug: http://b/27362811
Change-Id: I0936d1ad48f13e24cd382e8e8400cc752bac3b66
Currently targeting a device by serial requires matching the serial
number exactly. This CL relaxes the matching rules for local transports
to ignore protocol prefixes and make the port optional:
[tcp:|udp:]<hostname>[:port]
The purpose of this is to allow a user to set ANDROID_SERIAL to
something like "tcp:100.100.100.100" and have it work for both fastboot
and adb (assuming the device comes up at 100.100.100.100 in both
modes).
This CL also adds some unit tests for the modified functions to make
sure they work as expected.
Bug: 27340240
Change-Id: I006e0c70c84331ab44d05d0a0f462d06592eb879
It does happens that the adb_write only writes to the
qemu pipe partially which throws host side's adb backend
into confusion and crashes.
This CL replaces adb_write with WriteFdExactly;
adb_read with ReadFdExactly.
(cherry picked from commit f66c5938be)
Change-Id: I684f5df79b1e3f00b4b7a2452c2712a73c15973c
It does happens that the adb_write only writes to the
qemu pipe partially which throws host side's adb backend
into confusion and crashes.
This CL replaces adb_write with WriteFdExactly;
adb_read with ReadFdExactly.
Change-Id: I10424ad730c73516d16b0eb7318e8c9beea9b36b
Previously, for `adb pull $remote $local`, we would do the equivalent of
mkdir -p on `dirname $local`. This patch changes the behavior to only
creating directories that are being pulled, like scp.
Bug: http://b/27362811
Change-Id: I79f975ee9f2d9bc9e8be6a7c4f2de6d7ae2d2d23
Move the fdevent for the framework authentication connection out of
atransport into its own static variable in adb_auth_client, since its
lifetime is completely unrelated to that of the USB connection.
Bug: http://b/27297963
Change-Id: Ie6180d0b59d133120c5755e239e76ab33ed3cc1d
(cherry picked from commit 9f48611554)
Move the fdevent for the framework authentication connection out of
atransport into its own static variable in adb_auth_client, since its
lifetime is completely unrelated to that of the USB connection.
Bug: http://b/27297963
Change-Id: Ie6180d0b59d133120c5755e239e76ab33ed3cc1d
This reflects the change in PackageManager service:
frameworks/base commit 921dd754ab49df0cd580ff96503f7616c4c85f4a.
Bug: 27327503
Change-Id: Ifcc7268cd271640417b8cfc9db81ea954b491cb1
Fixes the following warnings:
build/core/binary.mk:894: warning: overriding commands for target
`out/target/product/bullhead/obj/STATIC_LIBRARIES/libadbd_intermediates/fdevent.o'
build/core/binary.mk:894: warning: ignoring old commands for target
`out/target/product/bullhead/obj/STATIC_LIBRARIES/libadbd_intermediates/fdevent.o'
build/core/binary.mk:894: warning: overriding commands for target
`out/target/product/bullhead/obj_arm/STATIC_LIBRARIES/libadbd_intermediates/fdevent.o'
build/core/binary.mk:894: warning: ignoring old commands for target
`out/target/product/bullhead/obj_arm/STATIC_LIBRARIES/libadbd_intermediates/fdevent.o'
Change-Id: Id4b13574e568284cefbc3a763d40843e73ddbd3d
(cherry picked from commit 582c8fe1d4)
Fixes the following warnings:
build/core/binary.mk:894: warning: overriding commands for target
`out/target/product/bullhead/obj/STATIC_LIBRARIES/libadbd_intermediates/fdevent.o'
build/core/binary.mk:894: warning: ignoring old commands for target
`out/target/product/bullhead/obj/STATIC_LIBRARIES/libadbd_intermediates/fdevent.o'
build/core/binary.mk:894: warning: overriding commands for target
`out/target/product/bullhead/obj_arm/STATIC_LIBRARIES/libadbd_intermediates/fdevent.o'
build/core/binary.mk:894: warning: ignoring old commands for target
`out/target/product/bullhead/obj_arm/STATIC_LIBRARIES/libadbd_intermediates/fdevent.o'
Change-Id: Id4b13574e568284cefbc3a763d40843e73ddbd3d
Minijail supports dropping capabilities from the bounding set.
Use that code instead.
This cleans up one small loose end in the work started with
https://android-review.googlesource.com/#/c/187775/
Final diff: fewer lines, more unit-tested code.
"""
$ git diff --stat 52cf4fa6aa3e8d13f61b1 adb/daemon/main.cpp
adb/daemon/main.cpp | 56
1 file changed, 27 insertions(+), 29 deletions(-)
"""
Bug: 27314096
Change-Id: I238975920b85fae376522eb26f5ad6d9fee0762a
Currently adb only realizes a TCP transport has gone away when it tries
to send a packet, which caused problems in particular for `adb reboot`
since no packets are sent, leading to the client hanging until Ctrl+C.
This CL turns on TCP keepalive packets to send 1 packet every second,
allowing up to 10 failures before disconnecting. Using built-in TCP
functionality turns out to be much cleaner in this case than trying to
implement our own keepalive packets at the application layer, and
should be more lightweight since it's all done in the TCP stack.
Bug: http://b/23093474
Change-Id: Ifb41cbb85b9752a9f394e1eed3c6ac4da47a4e4d
Make sure that adb_poll sets revents for all of the structs passed in.
Also, zero initialize all of the adb_pollfd structs in the tests.
Change-Id: Ia639679a7e6f77483655f1552e89081c4673aa87
(cherry picked from commit 2275f7da73)
When sending a file, do a 0-timeout poll to check to see if an error has
occurred, so that we can immediately report failure.
Bug: http://b/26816782
Change-Id: I4a8aa8408a36940bfda7b0ecfa5d13755f4aa14d
(cherry picked from commit afcdcd703e)
Restore the previous file sync error handling behavior of reporting
failure, and then consuming packets from the other end until receiving a
DONE packet.
Bug: http://b/26816782
Change-Id: I9708f2a36c072547e191fa0b6b42dffc31f8a2f2
(cherry picked from commit 20a96c7d79)
Switch pthread_* to use the adb_thread_* abstractions to allow the fdevent
and socket tests to compile on Win32.
Bug: http://b/27105824
Change-Id: I6541bb1398780b999837e701837d7f86a5eee8ca
(cherry picked from commit 022d447e9e)
Add a test for FD exhaustion, and fix cases where we weren't properly
setting errno.
Change-Id: I486055bb9ead31089ce76b210c11de9e973f3256
(cherry picked from commit 6487e74a59)
Windows has a maximum fd limit of 2048, so we can avoid collision with
real file descriptors by starting from there. Also, fds would be
previously be allocated by a linear walk from the last allocated FD,
instead of the lowest available FD, as required by POSIX. Keep track of
the lowest available file descriptor to make things feel more familiar.
Change-Id: Id6ac1c54f4f7964a6cdfa8d3f4f96262e4881964
(cherry picked from commit b6232b96dd)
It was previously -1 (the default from Google style, since it uses 2
space indentation), instead of -2.
Change-Id: I1865505ce17a2cc13b85de58bda55c3b1dfcf08c
(cherry picked from commit 5da522ec45)
Windows restricts the return value of threads to 32-bits, even on 64-bit
platforms. Since we don't actually return meaningful values from thread,
resolve this inconsistency with POSIX by making adb's thread abstraction
only take void functions.
Change-Id: I5c23b4432314f13bf16d606fd5e6b6b7b6ef98b5
(cherry picked from commit b5fea14e13)
Fix pathological case where the directory to be created can't be created
because there is already a file there. This was previously returning
success because the wrong var was passed to directory_exists().
Fix test to exercise this situation. Also clarify tests.
Change-Id: I0dc0f14084e0eda4e1498874d4ab2a6445d322ac
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
(cherry picked from commit 85c45bd5a1)
To create a daemon for adb host server, we should call setsid()
for the daemon process. However, previously we call setsid() for
the adb client process, which results in nothing but EPERM error.
Bug: 26982628
Change-Id: I2763ae3d5a243706927d7ef6af5095138c0ce2d8
(cherry picked from commit 6bf323b97a)
Previously, using ctrl-c in a command that needs to spawn a daemon
because one isn't already available would kill the daemon along with the
foreground process.
Bug: http://b/26982628
Change-Id: I7fefc531c3e4895423e7b466322b5426d01dc9ef
(cherry picked from commit b72b3f8c92)
The behavior of mkdirs was changed a while ago, without updating the
test.
Change-Id: I2aaa73818933b281e911c42a14e3c843d8bd972a
(cherry picked from commit 1172b2ec71)
Make sure that adb_poll sets revents for all of the structs passed in.
Also, zero initialize all of the adb_pollfd structs in the tests.
Change-Id: Ia639679a7e6f77483655f1552e89081c4673aa87
am: fe07481ff9
* commit 'fe07481ff944cde33e6546579f83755000453e63':
adb: check for an error response from adbd between each write.
adbd: restore the old error handling behavior.
am: 0640b14df2
* commit '0640b14df292cf48fc3aaee2058908c88cfc0419':
adb: change unsigned to uint32_t in sync struct definitions.
adb: detect when the client disconnects in wait-for-device.
When sending a file, do a 0-timeout poll to check to see if an error has
occurred, so that we can immediately report failure.
Bug: http://b/26816782
Change-Id: I4a8aa8408a36940bfda7b0ecfa5d13755f4aa14d
Restore the previous file sync error handling behavior of reporting
failure, and then consuming packets from the other end until receiving a
DONE packet.
Bug: http://b/26816782
Change-Id: I9708f2a36c072547e191fa0b6b42dffc31f8a2f2
Switch pthread_* to use the adb_thread_* abstractions to allow the fdevent
and socket tests to compile on Win32.
Bug: http://b/27105824
Change-Id: I6541bb1398780b999837e701837d7f86a5eee8ca
Windows has a maximum fd limit of 2048, so we can avoid collision with
real file descriptors by starting from there. Also, fds would be
previously be allocated by a linear walk from the last allocated FD,
instead of the lowest available FD, as required by POSIX. Keep track of
the lowest available file descriptor to make things feel more familiar.
Change-Id: Id6ac1c54f4f7964a6cdfa8d3f4f96262e4881964
It was previously -1 (the default from Google style, since it uses 2
space indentation), instead of -2.
Change-Id: I1865505ce17a2cc13b85de58bda55c3b1dfcf08c
Windows restricts the return value of threads to 32-bits, even on 64-bit
platforms. Since we don't actually return meaningful values from thread,
resolve this inconsistency with POSIX by making adb's thread abstraction
only take void functions.
Change-Id: I5c23b4432314f13bf16d606fd5e6b6b7b6ef98b5
Fix pathological case where the directory to be created can't be created
because there is already a file there. This was previously returning
success because the wrong var was passed to directory_exists().
Fix test to exercise this situation. Also clarify tests.
Change-Id: I0dc0f14084e0eda4e1498874d4ab2a6445d322ac
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
To create a daemon for adb host server, we should call setsid()
for the daemon process. However, previously we call setsid() for
the adb client process, which results in nothing but EPERM error.
Bug: 26982628
Change-Id: I2763ae3d5a243706927d7ef6af5095138c0ce2d8
Previously, using ctrl-c in a command that needs to spawn a daemon
because one isn't already available would kill the daemon along with the
foreground process.
Bug: http://b/26982628
Change-Id: I7fefc531c3e4895423e7b466322b5426d01dc9ef
fwrite() is a macro that maps to adb_fwrite(), which can write UTF-8 to
the console. Use it to write the output that comes from the subprocess
adb server.
To do this, dup the stdout/stderr file descriptor and make a duplicate
FILE* stream, in binary mode (since we're reading raw bytes from the
subprocess), and unbuffered.
Change-Id: I480761bae0bd576dc9e03fa4d31266f4e49635ed
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
SendFail and SendSyncFail are similarly named, and have the same
prototype. Use `#pragma GCC poison` to prevent use of SendFail in
file_sync_service.cpp, and fix the places where it was used
accidentally.
Change-Id: I6b9a7e565b76dfab10f8ae38f889d046ad80a403
Pulls the Windows error string generation out of adb into libbase so
that it can be used by fastboot as well. Also makes a Unix equivalent
that just wraps strerror() so that upcoming fastboot error reporting
code can be platform-independent.
The intent here is just to provide a portable way to report an error to
the user. More general cross-platform error handling is out of scope.
Bug: http://b/26236380
Change-Id: I5a784a844775949562d069bb41dcb0ebd13a32bc
- Introduces unix_read_interruptible() which is like unix_read() except
that it can return EINTR.
- The big idea is that the Windows ReadConsoleInput() API will return an
event on window resize and then we return EINTR from
unix_read_interruptible() just like Unix.
- Only handles horizontal resize since Windows doesn't seem to give an
event for vertical resize when no special screen buffer is used. This
should be sufficient for the primary use case of adb on Windows
(people are not running vi in the first place).
Change-Id: Id8d1710b559834c8098f2d7fbecedf2d0ade4b88
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
Previously, the various adb_printf, adb_fwrite, etc. functions did not
correctly handle the case of the passed buffer ending with an incomplete
UTF-8 sequence. This is fixed by buffering up incomplete UTF-8 sequences
in g_console_output_buffer (protected by the mutex
g_console_output_buffer) and outputting it later once the full sequence
is available.
A unittest for the main worker function, ParseCompleteUTF8(), was added
to adb_test.
Other fixes:
- Fix the return value of number-of-chars written to be number of UTF-8
bytes instead of number of UTF-16 characters.
- Don't overwrite errno in success cases of various adb_printf, etc.
functions. This might be excessive, but might be useful in the case
when these functions are used for debugging/tracing.
- Add missing UTF-8 stdio functions that aren't currently used by adb,
but might be in the future: vprintf, putc, putchar, puts.
- stdin_raw_init: If we can't get the console handle, don't call
SetConsoleMode(). Not a big deal, but this will prevent erroneous
trace output.
Change-Id: I8730e8af92882c42b884ad921b39a17b54465085
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
http://r.android.com/166419 changed `adb shell` behavior to not
allocate a remote PTY for non-interactive commands, but adbd relied on
having a PTY to properly terminate the subprocess.
One impact of this is that when using older versions of adb or passing
the -x flag, `adb screenrecord` wasn't properly terminating and closing
out the video file.
This CL restores the old behavior for legacy shell connections: always
use a PTY, but put it in raw mode if the client is doing local PTY
input/output processing itself.
Bug: http://b/26742824
Change-Id: I9ee630c0ff0d2d6a0db367387af7123deea79676
Previously GetFeatureSet() on an invalid target would just return an
empty feature set, leading to some invalid assumptions, e.g. if there
isn't exactly one device connected this happens:
$ adb shell -t
error: target doesn't support PTY args -Tt
This CL adds a success/failure return value to GetFeatureSet(), and
also adds an option to print errors to stderr since that's the most
common behavior.
This will cause a slight difference in behavior for install/uninstall.
Previously they would block until the device was available, now they
print an error and quit immediately, which seems to be the more common
behavior for adb functions.
Bug: http://b/26387641
Change-Id: I0ea6ffaec922e04b9946e84f05c3870e5b549fde
This CL moves the network address parsing function from adb to libbase
so that it can be used by fastboot as well as adb.
libbase seemed like the right choice because:
1. It already has some parsing functions (parseint)
2. The net address parsing function uses the libbase string
functions so we have a libbase dependency anyway.
The parsing function has been modified slightly to make the canonical
address optional, and debug logging on success has been removed.
For adb the only functional difference is that parsing a network
address will no longer print the result to the debug log, which seemed
unnecessary.
Bug: http://b/26236380
Change-Id: Ife6df02937225fc66de87884d3572d79c092c522
Also, fix bugs that this uncovered. In particular, the sysdeps_win32
FATAL macro would only print __FUNCTION__.
Change-Id: I6307ec9749edec21b4fee192e135a86ec445c84b
The actual maximum length will depend on the version of the shell
protocol being used, and any additional parameters being passed through
(e.g. TERM=xterm-256color). This should be able to be raised to 64K for
devices with commit 3d2904c (L-MR1 and above), but that'll require some
plumbing.
Bug: http://b/20467103
Change-Id: Idf0c46af5b18b854110aba58df13a53297d2475f
With https://android-review.googlesource.com/#/c/195460,
adbd can depend only on libminijail, without having to include its
dependencies.
Bug: 26099611
Change-Id: I2312d8584dda88b4a4619d3100d0983fa2833ba5
With https://android-review.googlesource.com/#/c/195400, Minijail will
check for this failure so there's no need to do it here, which allows
to simplify the code.
Bug: 26099611
Change-Id: I7c876fdcab874ed403f82bdd5a4048c0f1e5db58
Without -s argument, adb wait-for-device will make a call to
acquire_one_transport() with sinfo->serial.c_str() == "".
Waiting for acquire_one_transport() to be reworked to use std::string
rather than const char * for serial, work around this by passing NULL
when sinfo->serial is not initialized in host_service_to_socket().
Change-Id: Ifef53e0e82850364f5029ee36560376f2a4a5104
Signed-off-by: Leo Sartre <leox.sartre@intel.com>
It uses libadb, which is also only compiled for the primary
architecture. BUILD_HOST_NATIVE_TEST is changing the default
LOCAL_MULTILIB to match BUILD_NATIVE_TEST.
Change-Id: Ia9c002e641125eb996a7f198af1f182d0d6171c6
This factors out the duplication in the single-file progress, and adds a
whole-sync progress percentage to the front of the line. A number that's
both more interesting and easier to read.
This also fixes the >100 percentage reporting for files of unknown size.
Bug: http://b/26189482
Change-Id: I51501ccef6ae1f52425db0eb0862d87e90947a6c
We still don't really have a clue what went wrong, but "Failed to write"
made it sound like we did.
Change-Id: Ic58b13202e2d8ea6b095f7046db9d0771d77ce65
By using Minijail we avoid writing the same priv-dropping code over
and over again. This also enables future hardening opportunities.
We're already using Minijail for priv-dropping on Brillo.
Minijail is unit- and integration-tested on the
Chrome OS CI infrastructure (pulling from the same repo, see
https://wmatrix.googleplex.com/security?tests=security_Minijail0).
Once CI comes to Android, it will be continuously tested there as well.
Both 'adb root' and 'adb unroot' still work.
Bug: 26099611
Change-Id: I52c456ea272d27bd6fbc71200f4fdd928a592158
The current implementation of the host commands "adb wait-for-*" allows
to specify only the transport layer (local, usb or any).
This patch allows the specification of the expected device state
(bootloader, recovery, device or sideload), this is usefull for
scripting purposes.
Use case:
$ adb reboot sideload-auto-reboot
$ adb wait-for-usb-sideload && adb sideload package.zip
Change-Id: I276a6be4d82f8b7901f74e1e5395b86d16548e8f
Signed-off-by: Leo Sartre <leox.sartre@intel.com>
Reads from functionfs allocate contiguous buffers in the kernel, causing
long ones to sometimes fail because of memory fragmentation.
Bug: http://b/26206622
Change-Id: Id40753d6f29b37b5ca97c3e2fa3921f52b4242de
Back in 080427e4e2, we said:
If the kernel doesn't support file capabilities, we ignore
a prctl(PR_CAPBSET_DROP) failure. In a future CL, this could
become a fatal error.
Make it a fatal error. With SELinux support, all devices are
required to support file capabilities.
Change-Id: I0ce0c4cb9387c42e325cbf1a63c5d82e6aab530c
Previously, for `adb shell`, we were using setenv after forking to set
up the child's environment. This would occasionally deadlock in the
child, which would cause the main thread to deadlock waiting for the
child to complete. This patch constructs the environment before forking
and passes it to execle, eliminating the deadlock.
Bug: http://b/25847115
Change-Id: I720d472770564b1449819ddaab945a89844244a8
Shell scripts of the following form do not work properly with adb:
echo "foo\nbar\nbaz" | {
read FOO
while [ "$FOO" != "" ]; do
adb shell echo $FOO
read FOO
done
}
The first run of adb shell will consume all of the contents of stdin,
causing the loop to immediately end. ssh solves this by providing a -n
flag that causes it to not read from stdin. This commit adds the same.
Bug: http://b/25817224
Change-Id: Id74ca62ef520bcf03678b50f4bf203916fd81038
During early boot, we may be mounting and unmounting /data.
Having the home directory for adb shell commands, such as
"adb shell logcat", on the /data directory prevents unmounting.
This reverts commit 173eb396c7.
Bug: 26132185
Change-Id: Ib7c2f9e696f52bf5bbb79223d90dd76791779587
We had mostly-working hacks before, but it's time to just modify LinePrinter
to suit our needs. If we tell LinePrinter what kind of output we're giving
it, it can manage things automatically.
This fixes the minor bug where we'd sometimes have a blank line after an
error message.
Change-Id: I07ff52437f2402de311e237dd1b2dd338d9b668a
Make the home directory for adb shell be /data/local/tmp and
automatically change into that directory.
Change-Id: Ib5cc6e1ecdd31a37e986cf03836f7589ebd40868