Commit graph

767 commits

Author SHA1 Message Date
Esteban de la Canal
f41ee3d5a1 Merge "74602: Fixes adb not seeing connected devices on Mac." 2014-09-12 21:11:14 +00:00
Esteban de la Canal
9dd83dc96e 74602: Fixes adb not seeing connected devices on Mac.
Every alternate time an adb server was started already connected devices were
not being seen. This was caused by opened usb connections being "stalled".
See this thread for more information: http://lists.apple.com/archives/usb/2011/Jun/msg00050.html

Change-Id: Ic35b7a66c3f14a837b960066557f44e105609dcb
Fixes: https://code.google.com/p/android/issues/detail?id=74602
2014-09-11 11:36:50 -07:00
Elliott Hughes
8fa75e44f1 am 6608a46c: am c4ff0389: Merge "adb: Add USB vendor ID for Alco Digital Devices Limited"
* commit '6608a46c59abd72bd42a5104937fb276b6b0ccbd':
  adb: Add USB vendor ID for Alco Digital Devices Limited
2014-09-10 18:26:35 +00:00
DanielMo
553630e423 adb: Add USB vendor ID for Alco Digital Devices Limited
Change-Id: I50d343d583e688e9f8a72d1c61618b384e310fe1
Signed-off-by: DanielMo <DanielMo@fih-foxconn.com>
2014-09-10 13:58:32 +08:00
Jeff Sharkey
84e533d7b0 am 228f8261: Merge "delete_file() should force removal." into lmp-dev
* commit '228f8261fd778e1c03184b5f79f979d1a25abf50':
  delete_file() should force removal.
2014-09-09 21:56:14 +00:00
Jeff Sharkey
41b3cfa296 delete_file() should force removal.
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
2014-09-09 12:38:30 -07:00
Christopher Ferris
fb849bd46e am fc8e16bf: am 2c805883: Merge "Add -Wno-deprecated-declarations to makefiles."
* commit 'fc8e16bfc59fcebaf554e266aae808eed5f2d078':
  Add -Wno-deprecated-declarations to makefiles.
2014-09-06 17:25:48 +00:00
Christopher Ferris
2c80588340 Merge "Add -Wno-deprecated-declarations to makefiles." 2014-09-06 16:56:46 +00:00
Chih-Hung Hsieh
6d94763b2f am 379ca94d: am 299a32c8: Merge "Include ADB_HOST only code in #if ADB_HOST."
* commit '379ca94d00cab91a77ad8991cc92e2b4d4236d56':
  Include ADB_HOST only code in #if ADB_HOST.
2014-09-05 23:58:09 +00:00
Chih-Hung Hsieh
299a32c803 Merge "Include ADB_HOST only code in #if ADB_HOST." 2014-09-05 23:38:07 +00:00
Chih-Hung Hsieh
f787b381b6 Include ADB_HOST only code in #if ADB_HOST.
BUG: 17409892
Change-Id: Ic1199dd745191aba718fdb18343e87c0ccbe530b
2014-09-05 16:34:02 -07:00
Elliott Hughes
709569febf am 0dcc3f65: am 9c814648: Merge "Add USB Vendor ID for Micromax Informatics Ltd."
* commit '0dcc3f65b1ff5fa771618436ee4bfdd44cd2f672':
  Add USB Vendor ID for Micromax Informatics Ltd.
2014-09-05 23:31:15 +00:00
Abhishek Karmakar
4d10523be8 Add USB Vendor ID for Micromax Informatics Ltd.
Signed-off-by: Abhishek Karmakar <abhishek.karmakar@micromaxinfo.com>
Change-Id: I63462eb15575cc953ac0246ee5d4c883d3678c08
2014-09-05 16:06:25 -07:00
Adam Langley
179d9d6587 Switch from using base64 BIOs to encoding funcs.
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>
2014-09-05 15:54:30 -07:00
Christopher Ferris
51448eb39e Add -Wno-deprecated-declarations to makefiles.
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
2014-09-04 16:13:42 -07:00
Ying Wang
0c3d98b02b am 87ad7cdc: am e1ba39aa: Merge "Fix 64-bit host build."
* commit '87ad7cdc590aa4033f0b7ae23d83e2fbc119d07a':
  Fix 64-bit host build.
2014-08-14 23:20:06 +00:00
Ying Wang
42a809ba06 Fix 64-bit host build.
Bug: 13751317
Change-Id: Ibf62935b7d12a55ffc57242a26a2581b52796847
2014-08-14 15:52:54 -07:00
Elliott Hughes
e772705a59 am 771f6f29: am 29c5a78f: Merge "Fix build of adb with gcc-4.9."
* commit '771f6f299f16704b251d6adb8fb185c8fb517d07':
  Fix build of adb with gcc-4.9.
2014-08-06 18:06:33 +00:00
Alexander Ivchenko
678bd2e822 Fix build of adb with gcc-4.9.
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
2014-08-06 10:59:53 -07:00
Brian Carlstrom
8a01917da1 am 46a8ffe8: Fix Windows adb build by avoiding "bool"
* commit '46a8ffe87f3cba070fb18a90e3c5c1f73468f99c':
  Fix Windows adb build by avoiding "bool"
2014-08-06 12:57:22 +00:00
Brian Carlstrom
46a8ffe87f Fix Windows adb build by avoiding "bool"
Change-Id: I9ca59e400c199d497a1a18d5e64c2cafe628097b
2014-08-05 22:51:18 -07:00
Jeff Sharkey
8c9b155ea1 am 43d65b69: Merge "Escape single quotes in arguments." into lmp-dev
* commit '43d65b6903249a409031b081bb6175b9ad3e5c2a':
  Escape single quotes in arguments.
2014-08-06 01:23:28 +00:00
Elliott Hughes
440df7b61f am 830a8641: am a8d0c4a2: Merge "Move host \'get-state\' service up so that it works."
* commit '830a8641bb960d208ad2a5b3bc3d9fb91bc31c2b':
  Move host 'get-state' service up so that it works.
2014-08-06 01:22:09 +00:00
Elliott Hughes
29c5a78fdc Merge "Fix build of adb with gcc-4.9." 2014-08-05 00:30:25 +00:00
Alexander Ivchenko
5372333885 Fix build of adb with gcc-4.9.
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>
2014-08-06 16:07:17 +04:00
Elliott Hughes
a8d0c4a2b8 Merge "Move host 'get-state' service up so that it works." 2014-08-05 00:30:25 +00:00
Jeff Sharkey
0cc642c82d Partially revert argument escaping.
Commands chained with && need to be passed through literally instead
of always being quoted.

(cherry-pick of 7c460351f53cb683097fe4071b9ec1e4cd7cdf82.)

Bug: 15479704
Change-Id: I2998e40a92a3bfd092098cd526403b469c86c9a6
2014-08-05 22:55:39 +00:00
Jeff Sharkey
dcd2f0ef2f Uniformly escape shell arguments.
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
2014-08-05 22:54:35 +00:00
Jeff Sharkey
43d65b6903 Merge "Escape single quotes in arguments." into lmp-dev 2014-08-05 00:19:02 +00:00
Simon Ye
d9c4b14b44 Move host 'get-state' service up so that it works.
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
2014-08-05 17:23:35 -07:00
Jeff Sharkey
d0eee747f6 Escape single quotes in arguments.
Verified that these use-cases continue working:

$ adb shell arg a a 'b b'
$ adb shell arg a a "b b"
|arg|a|a|b b|

$ adb shell arg "a a 'b b'"
|arg|a a 'b b'|

$ adb shell arg 'a a "b b"'
|arg|a a "b b"|

$ adb shell arg a\"b\'c
|arg|a"b'c|

$ adb shell "arg a && arg b"
|arg|a|
|arg|b|

$ adb shell "arg 'a' \"b\" c"
|arg|a|b|c|

Bug: 16139781
Change-Id: I3b010b6cdf57281695c11fda318c9bea0a7221cc
2014-08-05 16:53:25 -07:00
leozwang
05004026d9 am a361503e: Merge "Consolidate adb trace macro defines into its own header file." into lmp-dev
* commit 'a361503e3e68d1b26ce737547c4e1d53a03ec2d9':
  Consolidate adb trace macro defines into its own header file.
2014-07-30 16:44:52 +00:00
Elliott Hughes
43eb2ea5f8 am ec531e5c: am 47a12389: Merge "Fix adb "ptsname is not thread-safe; use ptsname_r instead" build break."
* commit 'ec531e5cdde5e0b120bd88aeb2c3d36d18cedfb4':
  Fix adb "ptsname is not thread-safe; use ptsname_r instead" build break.
2014-07-29 18:42:53 +00:00
Simon Ye
dc22c3c7a8 Move host 'get-state' service up so that it works.
Due to previous bad merge, the get-state service was moved out of the
ADB_HOST #ifdef block.

Change-Id: Id4b72a051ff04104659925e63a02eb340db2f807
2014-07-28 11:44:46 -07:00
Elliott Hughes
d235288553 Fix adb "ptsname is not thread-safe; use ptsname_r instead" build break.
Change-Id: I633dc4d6d421862473e7267cc0d2c1b0933392e0
2014-07-29 11:32:16 -07:00
leozwang
a361503e3e Merge "Consolidate adb trace macro defines into its own header file." into lmp-dev 2014-07-25 21:16:23 +00:00
leozwang
d3fc15f484 Consolidate adb trace macro defines into its own header file.
Most code is copied and pasted from adb.h.
Any file can just include it to enable tracing.
Removed some duplications.

Change-Id: Ie1ed9e9edbf92158aac84669fbcbf7dc85fe2cf0
2014-07-29 14:07:46 -07:00
Elliott Hughes
a6ff5c95a3 Fix adb "ptsname is not thread-safe; use ptsname_r instead" build break.
(cherry picked from commit d235288553)

Change-Id: I05f8160bc8c356cb8a57e2bc5677517750700456
2014-07-29 11:34:14 -07:00
Jeff Sharkey
555a904f7c am 74ff4fcf: Merge "Follow refactoring of install-abandon command." into lmp-dev
* commit '74ff4fcfc46e853ecd9fe34b5cedb47fc379f1af':
  Follow refactoring of install-abandon command.
2014-07-25 19:19:33 +00:00
leozwang
75619aabb3 am 5a255238: Merge "Redirect debug output to logcat." into lmp-dev
* commit '5a2552388e698fec4efda270d2d88bb18ed3f299':
  Redirect debug output to logcat.
2014-07-25 16:45:39 +00:00
Colin Cross
6cc961c7cb am edf41f98: am 8d9d362b: Merge "adb: Add USB vendor ID for SONIM TECHNOLOGIES, INC."
* commit 'edf41f981c47d857bd130e8ecc95cd7cf0a0fe0a':
  adb: Add USB vendor ID for SONIM TECHNOLOGIES, INC.
2014-07-25 03:39:11 +00:00
Tim Murray
2cc4fd73d1 am 6ebaf311: am 721f189a: Merge "fix adb build on Darwin"
* commit '6ebaf311a7af8d20979deba279f9d5096ed8f193':
  fix adb build on Darwin
2014-07-25 02:24:29 +00:00
DanielMo
43222b3f0a adb: Add USB vendor ID for SONIM TECHNOLOGIES, INC.
Change-Id: Id66997709fec55b1efd389abf2efa644b9a8ccf4
Signed-off-by: DanielMo <DanielMo@fih-foxconn.com>
2014-07-25 11:17:55 +08:00
leozwang
5a2552388e Merge "Redirect debug output to logcat." into lmp-dev 2014-07-24 22:43:15 +00:00
Tim Murray
1efcdeffe5 fix adb build on Darwin
bug 16172793

Change-Id: Ia34b7148afc4c909f29037df91c04d6fd29a731e
2014-07-24 18:33:12 -07:00
Jeff Sharkey
ac77e1f4e4 Follow refactoring of install-abandon command.
Bug: 16543552
Change-Id: I1f54254813fd7d7f4341b8815f816535a39de079
2014-07-25 10:09:18 -07:00
leozwang
48a904240b Redirect debug output to logcat.
If ADB_TRACE is enabled, debug output will be redirected to logcat.

Change-Id: I9c36ada7690a2b946ecd6a926d04e36a8313c36a
2014-07-23 22:45:02 -07:00
Nick Kralevich
9866a66d6d adb: set O_CLOEXEC on lots of file descriptors
Too many leaking FDs.

Fixes bug: https://code.google.com/p/android/issues/detail?id=65857
(and more)

(cherrypicked from commit fe8d7f4f2e)

Change-Id: I67d8683244e54288a8105f6f65ee40abe2378d7e
2014-07-21 19:34:31 -07:00
Greg Hackmann
7046773595 adb: replace utimes() with utime()
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
2014-07-21 17:10:34 -07:00
Nick Kralevich
ef16a17afb Merge "adb: set O_CLOEXEC on lots of file descriptors" into lmp-dev 2014-07-21 15:42:19 +00:00
Rom Lemarchand
1b3f2ff028 adb: use oom_score_adj instead of oom_adj
(cherry picked from commit 07ce7cab72)

Change-Id: I1730d1df34039a5502200002ac813ce96a3eaa1a
2014-07-18 21:55:38 -07:00
Jeff Sharkey
eb97987332 Add "exec" service: shell commands with no pty.
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
2014-07-18 21:46:23 -07:00
Lajos Molnar
4b35c01e3e adb: added support for adb pull -a to preserve time stamps and mode
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
2014-07-18 21:46:18 -07:00
Nick Kralevich
fe8d7f4f2e adb: set O_CLOEXEC on lots of file descriptors
Too many leaking FDs.

Fixes bug: https://code.google.com/p/android/issues/detail?id=65857
(and more)

Change-Id: I67d8683244e54288a8105f6f65ee40abe2378d7e
2014-07-18 20:57:35 -07:00
Elliott Hughes
cbbb83b0eb Fix implicit declaration of function 'prctl' in adb.
(cherry picked from commit b4dd6ef223)

Change-Id: Ia64bec746ae8d2c45663f61afb46702838b1e5bf
2014-07-18 16:46:39 -07:00
Elliott Hughes
b4dd6ef223 Fix implicit declaration of function 'prctl' in adb.
Change-Id: I9f14cabbb36d658510c11833b3314565a2445e10
2014-07-18 16:44:58 -07:00
Christopher Tate
71bbc6789f Fix the build in clang
"fprintf(stderr, buf)" is a warning in some compilers, and we're
building with all warnings promoted to error.

Change-Id: Ie3c6ddcd74cf4dda40cf7b742df955dde1d1a5ff
2014-07-14 16:53:57 -07:00
Jeff Sharkey
c03064ea71 Fix 64-bit builds.
Change-Id: I1ff5c9c3dc8d870aef2885f8a1989c6c913ccb3d
2014-07-14 13:57:54 -07:00
Jeff Sharkey
960df97c23 Add install-multiple to adb.
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
2014-07-14 10:26:21 -07:00
Badhri Jagan Sridharan
77a2c22dcb Merge "adbd: adb root should terminate adbd only if it's debuggable" 2014-07-09 21:40:17 +00:00
Badhri Jagan Sridharan
bf9ef51969 am cb7be1e8: am 87c7a0d7: am 77a2c22d: Merge "adbd: adb root should terminate adbd only if it\'s debuggable"
* commit 'cb7be1e8cd4e4388d014a5c48df455a5715f2180':
  adbd: adb root should terminate adbd only if it's debuggable
2014-07-10 00:49:56 +00:00
Badhri Jagan Sridharan
cb7be1e8cd am 87c7a0d7: am 77a2c22d: Merge "adbd: adb root should terminate adbd only if it\'s debuggable"
* commit '87c7a0d74b9dadaedfe6805c57d221d9c445aaf6':
  adbd: adb root should terminate adbd only if it's debuggable
2014-07-10 00:16:15 +00:00
Doug Zongker
4b39c6aca9 fix windows build
Change-Id: Ia7b236f1a915630fe85d488072efb9784ba10dad
2014-07-07 15:28:58 -07:00
Colin Cross
6d6a898b0c adb: fix 64-bit build
strlen returns a size_t, but the * modifier in printf expects an int.
On arm64 size_t != int.

Change-Id: I11e84a7b62c935162abc0aba910d14e63d11efd3
2014-07-07 14:13:30 -07:00
Doug Zongker
7df14ef339 Merge "add sideload-host mode to adb" 2014-07-07 17:47:39 +00:00
Doug Zongker
71fe584a1a add sideload-host mode to adb
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
2014-07-07 07:51:58 -07:00
Daniel Rosenberg
686bce6390 Added support for vendor partition to adb
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>
2014-07-02 20:00:49 +00:00
Elliott Hughes
ce10b191c5 am f6d86d75: am d08b80cc: am 20bda70f: Merge "Add Smartisan usb config"
* commit 'f6d86d75461ae3a246522932759e045dcc7a4952':
  Add Smartisan usb config
2014-06-24 19:38:50 +00:00
Elliott Hughes
f6d86d7546 am d08b80cc: am 20bda70f: Merge "Add Smartisan usb config"
* commit 'd08b80ccc6f7d106a8bfc410f89e466b798e2ebe':
  Add Smartisan usb config
2014-06-24 19:35:21 +00:00
Elliott Hughes
20bda70f9a Merge "Add Smartisan usb config" 2014-06-23 21:50:22 +00:00
Rom Lemarchand
07ce7cab72 adb: use oom_score_adj instead of oom_adj
Change-Id: I76c6ce83d7d400c8b84bfece5d30189640cb2505
2014-06-20 23:40:18 +00:00
Colin Cross
b10fb88e1e am d7d9b6fc: am f02fd9f0: am 5e504a4e: Merge "adb: Add USB vendor ID for Honeywell"
* commit 'd7d9b6fcaa415ea6251e45d84b95a95740ea807e':
  adb: Add USB vendor ID for Honeywell
2014-06-19 15:48:25 +00:00
Colin Cross
d7d9b6fcaa am f02fd9f0: am 5e504a4e: Merge "adb: Add USB vendor ID for Honeywell"
* commit 'f02fd9f0b061d29bb872664479ed4a5949d23ac9':
  adb: Add USB vendor ID for Honeywell
2014-06-19 15:44:14 +00:00
DanielMo
8c4c8e8988 adb: Add USB vendor ID for Honeywell
Change-Id: Ib92eca23a6c75ec9323bb1b0e7d7f8cd5f9ca207
Signed-off-by: DanielMo <DanielMo@fih-foxconn.com>
2014-06-19 16:02:14 +08:00
Nick Kralevich
4224edf51d am 89e4fad0: am 4e6aa6a2: Merge "adbd: unconditionally call setgroups"
* commit '89e4fad09e1ae765ab0be1580a468bc0837ef7e4':
  adbd: unconditionally call setgroups
2014-06-18 20:07:54 +00:00
Nick Kralevich
000a62f644 am 4224edf5: am 89e4fad0: am 4e6aa6a2: Merge "adbd: unconditionally call setgroups"
* commit '4224edf51dcddf9e014b198bb23fc40ef61a5834':
  adbd: unconditionally call setgroups
2014-06-18 21:40:27 +00:00
Nick Kralevich
e5cbf4e044 adbd: unconditionally call setgroups
We should ensure that the appropriate supplementary groups are
set, regardless of whether we're running UID=0 or UID=shell.

Change-Id: I3a1624a574102be08176a41f9c7eb5f82af2b3e5
2014-06-18 11:24:27 -07:00
Elliott Hughes
def14fc4ed am cd0d5935: am 6c65cd5d: am 60218f19: Merge "Add gionee USB vendor id."
* commit 'cd0d593569d7f2b8f8ec81ab3ef6dd942230e973':
  Add gionee USB vendor id.
2014-06-16 18:11:41 +00:00
Elliott Hughes
cd0d593569 am 6c65cd5d: am 60218f19: Merge "Add gionee USB vendor id."
* commit '6c65cd5db84361c66983903638ddb251762f9151':
  Add gionee USB vendor id.
2014-06-16 17:41:49 +00:00
xuefeng cai
4f8d3be3b2 Add gionee USB vendor id.
Change-Id: I3745f0e8462d0bffcd2eb4d926a9d2f9af8578f9
2014-06-16 17:29:42 +00:00
Jeff Sharkey
7c460351f5 Partially revert argument escaping.
Commands chained with && need to be passed through literally instead
of always being quoted.

Bug: 15479704
Change-Id: I2998e40a92a3bfd092098cd526403b469c86c9a6
2014-06-11 08:40:58 -07:00
Jeff Sharkey
fd546e8c35 Uniformly escape shell arguments.
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
2014-06-10 12:28:32 -07:00
Nick Kralevich
5c70f7e310 am f3af14e6: am ef47eb19: am 30136150: Merge "adb: avoid leaking file descriptors"
* commit 'f3af14e6df266f466e0bf7868d002cfe8104c128':
  adb: avoid leaking file descriptors
2014-06-07 00:19:51 +00:00
Nick Kralevich
f3af14e6df am ef47eb19: am 30136150: Merge "adb: avoid leaking file descriptors"
* commit 'ef47eb1948ba394866f53c41c459561fc372a3b5':
  adb: avoid leaking file descriptors
2014-06-07 00:16:32 +00:00
Nick Kralevich
8fcb631389 adb: avoid leaking file descriptors
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
2014-06-05 20:26:25 -07:00
Narayan Kamath
8f4ac8e1d3 am 7cf8e1cb: am 4e26c95a: Merge "Skip the "--abi" flag on "adb install" if present."
* commit '7cf8e1cb88c44963ccb2128113d8a804d85645b9':
  Skip the "--abi" flag on "adb install" if present.
2014-06-03 13:58:44 +00:00
Narayan Kamath
7cf8e1cb88 am 4e26c95a: Merge "Skip the "--abi" flag on "adb install" if present."
* commit '4e26c95a6363da4885bb9178c9d42c273b357043':
  Skip the "--abi" flag on "adb install" if present.
2014-06-03 13:29:03 +00:00
Narayan Kamath
4e26c95a63 Merge "Skip the "--abi" flag on "adb install" if present." 2014-06-03 09:58:24 +00:00
Jeff Sharkey
b81708146f Merge "Add "exec" service: shell commands with no pty." 2014-06-02 16:54:23 +00:00
Jeff Sharkey
5d9d434efa Add "exec" service: shell commands with no pty.
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
2014-05-30 11:27:56 -07:00
Narayan Kamath
a284f8b214 Skip the "--abi" flag on "adb install" if present.
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
2014-05-29 15:54:10 +01:00
Elliott Hughes
bccac026e9 am 8ed26bd6: am 769db021: am b24085d5: Merge "adb: Add USB vendor ID for Unowhy"
* commit '8ed26bd6531a8d52dcaff6c14b6fc59749791679':
  adb: Add USB vendor ID for Unowhy
2014-05-27 21:49:02 +00:00
Elliott Hughes
8ed26bd653 am 769db021: am b24085d5: Merge "adb: Add USB vendor ID for Unowhy"
* commit '769db021e6b61d10c13a7b17a72750f18ebdee16':
  adb: Add USB vendor ID for Unowhy
2014-05-27 21:32:01 +00:00
Elliott Hughes
769db021e6 am b24085d5: Merge "adb: Add USB vendor ID for Unowhy"
* commit 'b24085d55b082d802eba699243dba26fbc6ac712':
  adb: Add USB vendor ID for Unowhy
2014-05-27 21:29:15 +00:00
Wing Tseng
56266c75e2 adb: Add USB vendor ID for Unowhy
Change-Id: I8bab07734d5b6acb4d8ceaf45b0bab0723f5fe03
Signed-off-by: Wing Tseng <Wing_Tseng@pegatroncorp.com>
2014-05-27 14:23:11 -07:00
David 'Digit' Turner
7291ac6082 am 97267755: am c3358875: am 6e7343b8: Merge "adb: implement "adb reverse <local> <remote>""
* commit '972677557bd2c3a0678a945765783e85c7ec7b9c':
  adb: implement "adb reverse <local> <remote>"
2014-05-27 16:43:45 +00:00
David 'Digit' Turner
972677557b am c3358875: am 6e7343b8: Merge "adb: implement "adb reverse <local> <remote>""
* commit 'c3358875169b920847a72428f4e8b8f09f7bdf05':
  adb: implement "adb reverse <local> <remote>"
2014-05-27 16:36:30 +00:00
David 'Digit' Turner
c335887516 am 6e7343b8: Merge "adb: implement "adb reverse <local> <remote>""
* commit '6e7343b8993fecb2f0600a9e5cff91dd4480a877':
  adb: implement "adb reverse <local> <remote>"
2014-05-27 16:33:16 +00:00
David 'Digit' Turner
2525869419 adb: implement "adb reverse <local> <remote>"
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
2014-05-27 16:42:13 +02:00
Colin Cross
6fb1557fda am b696bec3: am 28c30518: am 1742b7d2: Merge "Modify VID for Compal"
* commit 'b696bec3541dc3091fb7c8764750f8ba21f64636':
  Modify VID for Compal
2014-05-21 20:49:01 +00:00