Recent versions of XCode fail to compile the adb and fastboot binaries due to
two functions being deprecated in 10.9 (GetCurrentProcess and
ProcessInformationCopyDictionary), and the use of -Werrror.
This patch replaces the method implementations which use calls to methods
deprecated in the 10.9 SDK with versions which only call non-deprecated methods.
Change-Id: I855bf26aff45093ca9022924f3ecd1b80f2305a8
Bug: 14416410
The proper fix for the error/warning we encountered is to move winsock2.h
in front of windows.h.
Change-Id: I29504ba3a184a85c6636d06c2ad900828fdb5436
Bug: 14416410
1. The new mingw-w64 toolchain x86_64-w64-mingw32-4.8 has ddk
in x86_64-w64-mingw32/include/ddk
2. Add -Wno-error=cpp to suppress a warning that turns into error
thanks to -Werror:
Please include winsock2.h before windows.h
3. Cast GetLastError() return type DWORD to "int"
4. Include direct.h for _mkdir
5. Include stdint.h for uint8_t on Windows
Change-Id: I4bec0587f6573692f08c760da6c98ae551b8b5eb
adbd was spinning between select & read (0 bytes) for an adb_auth
socket. The read documentation states: "On success, the number of
bytes read is returned (zero indicates end of file)" so the code has
been modified to close the connection (like the read error case).
BUG=17419868
Change-Id: I1d8fb70c8e1876225ba8d47ea0a2b6265a7d182b
strlen returns a size_t, but the * modifier in printf expects an int.
On arm64 size_t != int.
(cherry-picked from commit 6d6a898b0c)
Change-Id: I11e84a7b62c935162abc0aba910d14e63d11efd3
The sideload-host mode turns the host into a server capable of sending
the device various pieces of the file on request, rather than
downloading it all in one transfer. It's used to support sideloading
OTA packages to devices without the need for them to hold the whole
package in RAM.
If the connected device doesn't support sideload-host mode, we fall
back to the older sideload connection.
(cherry-picked from commit 71fe584a1a)
Change-Id: I5adaedd8243dc3b76414bba0149879ca2bbf35fa
It's a shell command with a pty, but it's not really interactive,
so force the removal to avoid giving users dead-end prompts.
Bug: 17339227
Change-Id: Iaf5d95c49f032066aa741a711a2c45557d93c598
The OpenSSL base64 BIO is going away in BoringSSL. This change switches
to using the explicit base64 functions which are availible in both
OpenSSL and BoringSSL. The BoringSSL helper functions (i.e. for
calculating the size of the base64 encoding) are wrapped in #ifdefs so
that this change isn't coupled with the switch to BoringSSL. Once that
switch is complete, the #ifdefs can be removed.
Bug: 17409664
Change-Id: I42bac3bc93a1fb39feed39a8917d8e38d97629d3
Signed-off-by: Adam Langley <agl@google.com>
This is in preparation for an update to the uapi v3.16.1
kernel headers that marks the structure usb_functionfs_descs_head
as deprecated.
Change-Id: I25d2f32ce8e95e038e6df201ce2f8126f5a8b6fa
Without this patch we get:
system/core/adb/commandline.c:1629:16: error: array subscript is above
array bounds [-Werror=array-bounds]
Signed-off-by: Alexander Ivchenko <alexander.ivchenko@intel.com>
(cherry picked from commit 5372333885)
Change-Id: I920c1de933ce5ba0a0d57eb8a9b557325a767a2a
Without this patch we get:
system/core/adb/commandline.c:1629:16: error: array subscript is above
array bounds [-Werror=array-bounds]
Change-Id: I494eb8b4d0e8082f8ff57bdd33d8d46c8c481c6f
Signed-off-by: Alexander Ivchenko <alexander.ivchenko@intel.com>
Commands chained with && need to be passed through literally instead
of always being quoted.
(cherry-pick of 7c460351f53cb683097fe4071b9ec1e4cd7cdf82.)
Bug: 15479704
Change-Id: I2998e40a92a3bfd092098cd526403b469c86c9a6
Arguments with embedded spaces need to be wrapped in quotes, which
changes the overall escaping strategy. Instead of mixing the two
strategies, just always wrap arguments in quotes.
(cherry-pick of fd546e8c35341b518873eb4f883afbed92e947af.)
Bug: 15479704
Change-Id: I03eacfa1bd6c220d4ec6617b825ebb0c43c7221e
Due to previous bad merge, the get-state service was moved out of the
ADB_HOST #ifdef block.
(cherry picked from commit dc22c3c7a8)
Change-Id: I08465e7c666104a4c2d15eadef8a4d4be7f91456
Most code is copied and pasted from adb.h.
Any file can just include it to enable tracing.
Removed some duplications.
Change-Id: Ie1ed9e9edbf92158aac84669fbcbf7dc85fe2cf0
Fix the win_sdk host build by replacing utimes() with utime(). utime()
is functionally equivalent to utimes() when dealing with non-fractional
second timestamps, and is supported by the Windows CRT.
(The Windows CRT uses the nonstandard name _utime(), but mingw creates
aliases to the POSIX names.)
Change-Id: I513c6c5de05376c34cbb0894a94259acba8ae6f1
To facilitate device scripts that want to read/write binary data from
the host side, this change introduces a new "exec" service that
behaves like "shell" but without creating a pty, which would otherwise
mangle binary data.
After forking, it hooks up stdin/stdout of the child process to
the socket connected through to the host. The adb transport doesn't
support shutdown(), so the host can't half-close the socket and wait
for device termination. Instead, the host side now has two explicit
commands "exec-in" and "exec-out" for either sending or receiving
data.
Teach host side copy_to_file() to deal with stdin/stdout special
cases. Switch device side backup/restore services to use the new
create_subproc_raw under the hood.
(cherry picked from commit 5d9d434efa)
Change-Id: I42c18cb5bb907449b458c94450ef6c584d84ecdb
Added -a flag to adb pull that preserves time and mode. Mode is
subjected to umask for security. We only receive modification
time from adb server, so creation time will be set to the modification
time as well.
Signed-off-by: Lajos Molnar <lajos@google.com>
(cherry picked from commit de8ff4adca)
Change-Id: I03bb5cc14ce542299cf3b221a8be318a28ee8a8d
"fprintf(stderr, buf)" is a warning in some compilers, and we're
building with all warnings promoted to error.
Change-Id: Ie3c6ddcd74cf4dda40cf7b742df955dde1d1a5ff
The new install-multiple command automates creating an install
session, streaming multiple files into place, and then committing
or destroying the session. This uses the recent "exec" feature to
stream APK contents over stdin directly into their final resting
place, requiring no extra copies.
Blindly pass through command line arguments to "pm" to make adding
new flags easier in future.
Remove support for verifying APK before sending across wire, since it
was reading the entire APK into memory (!) before sending. Also
remove encrypted APKs, since they are no longer supported. Drop
support for undocumented verification files.
Bug: 14975160
Change-Id: I0c538471873061798160e2e47cec4c0424c27361
The sideload-host mode turns the host into a server capable of sending
the device various pieces of the file on request, rather than
downloading it all in one transfer. It's used to support sideloading
OTA packages to devices without the need for them to hold the whole
package in RAM.
If the connected device doesn't support sideload-host mode, we fall
back to the older sideload connection.
Change-Id: I5adaedd8243dc3b76414bba0149879ca2bbf35fa
Remount will now remount the vendor partition as well, if it exists.
Sync will also allow you to sync vendor, and will include it by
default if it exists.
Change-Id: Iea1e8212f445e96233438a8d8a9d3266bf3d6557
Signed-off-by: Daniel Rosenberg <drosen@google.com>
We should ensure that the appropriate supplementary groups are
set, regardless of whether we're running UID=0 or UID=shell.
Change-Id: I3a1624a574102be08176a41f9c7eb5f82af2b3e5
Commands chained with && need to be passed through literally instead
of always being quoted.
Bug: 15479704
Change-Id: I2998e40a92a3bfd092098cd526403b469c86c9a6
Arguments with embedded spaces need to be wrapped in quotes, which
changes the overall escaping strategy. Instead of mixing the two
strategies, just always wrap arguments in quotes.
Bug: 15479704
Change-Id: I03eacfa1bd6c220d4ec6617b825ebb0c43c7221e
If an adb shell connection comes in while taking a screenshot,
an open pipe file descriptor will be leaked to the shell process.
This causes SELinux denials of the form:
avc: denied { read } for path="pipe:[21838]" dev="pipefs" ino=21838 scontext=u:r:shell:s0 tcontext=u:r:adbd:s0 tclass=fifo_file permissive=0
avc: denied { write } for path="pipe:[21838]" dev="pipefs" ino=21838 scontext=u:r:shell:s0 tcontext=u:r:adbd:s0 tclass=fifo_file permissive=0
Set O_CLOEXEC on the pipe connections, to avoid leaking them
across an exec boundary.
Bug: 15437785
Change-Id: Id2304b316bd7082d8baac246dce1f0e0e26e9197
To facilitate device scripts that want to read/write binary data from
the host side, this change introduces a new "exec" service that
behaves like "shell" but without creating a pty, which would otherwise
mangle binary data.
After forking, it hooks up stdin/stdout of the child process to
the socket connected through to the host. The adb transport doesn't
support shutdown(), so the host can't half-close the socket and wait
for device termination. Instead, the host side now has two explicit
commands "exec-in" and "exec-out" for either sending or receiving
data.
Teach host side copy_to_file() to deal with stdin/stdout special
cases. Switch device side backup/restore services to use the new
create_subproc_raw under the hood.
Change-Id: I5993049803519d3959761f2363037b02c50920ee
This flag needs to be passed through to the package manager.
Without this change, the argument to this flag is interpreted
as a filename.
NOTE: If we don't want to add special treatment for this flag,
we'll have to assume that all flags with a -- prefix have an
argument, and that isn't necessarily true.
Change-Id: I78c3fa842bc24148d83d7278e6dee395686240a0
This implements the logical opposite of 'adb forward', i.e.
the ability to reverse network connections from the device
to the host.
This feature is very useful for testing various programs
running on an Android device without root or poking at the
host's routing table.
Options and parameters are exactly the same as those for
'adb forward', except that the direction is reversed.
Examples:
adb reverse tcp:5000 tcp:6000
connections to localhost:5000 on the device will be
forwarded to localhost:6000 on the host.
adb reverse --no-rebind tcp:5000 tcp:6000
same as above, but fails if the socket is already
bound through a previous 'adb reverse tcp:5000 ...'
command.
adb reverse --list
list all active reversed connections for the target
device. Note: there is no command to list all
reversed connections for all devices at once.
adb reverse --remove tcp:5000
remove any reversed connection on the device from
localhost:5000
adb reverse --remove-all
remove all reversed connections form the current
device.
Reversed connections are tied to a transport, in other
words, they disappear as soon as a device is disconnected.
Simple testing protocol:
adb forward tcp:5000 tcp:6000
adb reverse tcp:6000 tcp:7000
nc -l localhost 7000
in another terminal:
echo "Hello" | nc localhost 5000
Will print "Hello" on the first terminal.
Change-Id: I761af790cdb06829b68430afa4145a919fa0e6d5
After a disconnect, the initial blocking connect takes
a long time to return, while subsequent calls return
quicks. Switch to a non-blocking connect to make the
re-connect time more consistent and faster overall.
Change-Id: I21d02b22a8eb9a457c2f1fa95eb17894d5612ccd
Signed-off-by: Ken Lierman <ken.lierman@windriver.com>
Reviewed-by: Gumbel, Matthew K <matthew.k.gumbel@intel.com>
Reviewed-by: Jovanovic, Radivoje <radivoje.jovanovic@intel.com>
Reviewed-by: Boie, Andrew P <andrew.p.boie@intel.com>
Under Linux, ADB manually parses USB Descriptors to check for
possible ADB USB Interfaces. USB Devices connected with SuperSpeed
will exhibit extra USB SuperSpeed Endpoint Companion Descriptors.
This patch handles these USB SuperSpeed specific USB Descriptors.
Change-Id: Icd1e5fdde0b324c7df4f933583499f2c52a922f3
Signed-off-by: Ingo Rohloff <lundril@gmx.de>
1. Close pipe fds[1] as soon as possible. Otherwise it may block when
reading from fds[0] even though the child process has exited early
and closed its copy of fds[1].
2. Waitpid after pipe is closed. Otherwise the screencap child process
may block while writing fds[1], because the fds[0] is not closed
yet. If we close fds[0] first, then the screencap child process will
die because of SIGPIPE, and waitpid will return correctly.
Change-Id: I433c95a5ba2eb3045727fc39a49fd9557fb1a1d1
Signed-off-by: Bao Haojun <baohaojun@gmail.com>