Commit graph

1507 commits

Author SHA1 Message Date
Josh Gao
00be90244d Merge "adb: don\'t use adb_dirname in between getting and printing errno." am: 44901f1147 am: 975c9a6863
am: 01f7f6fb03

* commit '01f7f6fb0323187a413dda937b9b893964fca5c9':
  adb: don't use adb_dirname in between getting and printing errno.
2015-11-18 19:18:23 +00:00
Josh Gao
b5d763b053 Merge changes Ice07f892,Ie1f082a0 am: 74a33fbcef am: 053eba0bc1
am: cb601eb981

* commit 'cb601eb981f70d395e9bac5c1bf39c7773141eca':
  libcutils: don't build for Windows.
  adb: don't link against libcutils on Windows.
2015-11-18 19:17:39 +00:00
Josh Gao
44901f1147 Merge "adb: don't use adb_dirname in between getting and printing errno." 2015-11-18 00:44:05 +00:00
Elliott Hughes
9a373a160c Merge "Pass screen to the device." am: c40f213b67 am: 1fd0ea9e0e
am: cc1ef0afae

* commit 'cc1ef0afae0ebbd818232e0252454d5591847f85':
  Pass $TERM to the device.
2015-11-18 00:25:05 +00:00
Josh Gao
f6e65e3f80 adb: don't use adb_dirname in between getting and printing errno.
adb_dirname might trample over the errno value we want to print. Move
the adb_dirname call out to a local to prevent this.

Change-Id: I8a62cb2e1be8704225a9c3b72dd01259c7eaaae4
2015-11-17 14:41:57 -08:00
Josh Gao
a629e2e578 adb: don't link against libcutils on Windows.
Bug: http://b/25693157
Change-Id: Ie1f082a094371124b4d66c87c7ab1a0706271b9d
2015-11-16 16:17:16 -08:00
Elliott Hughes
18ddf5c6a2 Pass $TERM to the device.
Unfortunately, this isn't backwards-compatible with the current shell
protocol because we made unknown shell: arguments errors. We could try
to commit the change to make them just warnings first, but how would
we know when everyone was running adbd with that change? Bumping the
protocol version doesn't help because that only affects the code running
on the host. And although we could add another feature to the reported
features, since shell_v2 is still in development, that doesn't seem
worthwhile.

Bug: http://b/25601436
Change-Id: I12b81aa656cd25b91d14ef691dcbd2b7dab49535
2015-11-16 10:55:34 -08:00
Josh Gao
4fde9d5698 Merge "adb: don\'t pull symlinks." am: 29843cf141 am: e01de06892
am: b5706b5f08

* commit 'b5706b5f0830fa87244e3bf1685050a9b1da5703':
  adb: don't pull symlinks.
2015-11-13 23:34:33 +00:00
Josh Gao
f96dc73b9f adb: don't pull symlinks.
Pulling symlinks was broken for directories, and it doesn't seem like
there's a good way to make it not broken, given that the protocol doesn't
have readlink (and we don't want to create symlinks on Windows, anyway).
The behavior for files doesn't seem to be especially useful, either.

Bug: http://b/25601283
Change-Id: Ie1d27e93dd09cbc0c178623b390041d1cb11f726
2015-11-13 15:17:02 -08:00
Elliott Hughes
28f2388938 Merge "Improve adb help text and adb backup error reporting." am: 82a2b2441c am: da2319bf4d
am: 7274d3fdc7

* commit '7274d3fdc70dc6abb5780f110c113f078a195cf3':
  Improve adb help text and adb backup error reporting.
2015-11-13 20:36:29 +00:00
Elliott Hughes
56e6813e27 Improve adb help text and adb backup error reporting.
Bug: https://code.google.com/p/android/issues/detail?id=188220
Bug: http://b/25677893
Change-Id: If174049e86d65d95db93a6e071c089dcd1d7cd4f
2015-11-13 11:04:10 -08:00
Elliott Hughes
846ba16767 Merge "adb: win32: Unicode USB device names" am: 76aefd5f9b am: 01f5c3afc8
am: 84a2145033

* commit '84a214503382d9bb335a12872aa404c4a643ec12':
  adb: win32: Unicode USB device names
2015-11-13 16:51:54 +00:00
Spencer Low
bb2900098a adb: win32: Unicode USB device names
Cleanup TODO and instead of (poorly) converting the device name from
wchar_t to char, just retrieve and store it as wchar_t, simplifying the
code.

This probably isn't necessary since device names are probably always
ASCII, but this cleans things up.

Change-Id: Ib780dcdc1e0e06b97b61e25d29a23874b35d7800
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-11-12 20:13:21 -08:00
Elliott Hughes
dd6543e4e8 Merge "adb: win32: remove widen()/narrow() in favor of UTF8ToWide()/WideToUTF8()" am: 61a560aeb1 am: 187858496b
am: 395156a270

* commit '395156a270f43eaf4f489b5ef76af6d0f1ddaf06':
  adb: win32: remove widen()/narrow() in favor of UTF8ToWide()/WideToUTF8()
2015-11-13 03:14:54 +00:00
Spencer Low
d21dc825bb adb: win32: remove widen()/narrow() in favor of UTF8ToWide()/WideToUTF8()
Now that we have a more standardized API (also available in Chromium),
switch to it. Another benefit is real error handling instead of just
killing the process on invalid Unicode.

Make UTF8ToWide()/WideToUTF8() set errno to EILSEQ on bad input. This is
the same error code that wcsrtombs(3) uses.

Update the unittest to check for EILSEQ.

Change-Id: Ie92acf74d37adaea116cf610c1bf8cd433741e16
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-11-12 17:13:08 -08:00
Josh Gao
80a9bc872c Merge changes Ic124ecb9,I94de55d2 am: 26f2e1fd4f am: 9a3f299ec0
am: 33bc6f38e7

* commit '33bc6f38e7946108ff2fba947e2a2be0c8d62d7f':
  libbase: remove exit-time destructors.
  adb: remove exit-time destructors.
2015-11-12 23:12:24 +00:00
Josh Gao
3bcdde6286 Merge "adb: properly handle path separators on Windows." am: 8591f719d0 am: 82f9eef468
am: 55e1c43714

* commit '55e1c4371402f202988fd961ab30e66167918588':
  adb: properly handle path separators on Windows.
2015-11-12 23:12:10 +00:00
Josh Gao
26f2e1fd4f Merge changes Ic124ecb9,I94de55d2
* changes:
  libbase: remove exit-time destructors.
  adb: remove exit-time destructors.
2015-11-12 22:50:03 +00:00
Josh Gao
8591f719d0 Merge "adb: properly handle path separators on Windows." 2015-11-12 21:25:00 +00:00
Josh Gao
b7b1edf974 adb: remove exit-time destructors.
On exit, these destructors get invoked while other threads might
still be using them, potentially causing a crash, and definitely
causing tsan to report a race condition.

Bug: http://b/23384853
Change-Id: I94de55d22f97f4edd1d7cc1f34e8c1f8dfd56a5a
2015-11-12 11:20:19 -08:00
Elliott Hughes
14e74b1b92 Merge "Revert "Revert "adb/base: fix adb push of Unicode filenames on Win32""" am: dcb8b288ca am: 1391792ba4
am: 64de36a893

* commit '64de36a89355f2c021adef849654a9e91a3cc94b':
  Revert "Revert "adb/base: fix adb push of Unicode filenames on Win32""
2015-11-12 02:40:47 +00:00
Elliott Hughes
c1fd492ac5 Revert "Revert "adb/base: fix adb push of Unicode filenames on Win32""
This reverts commit cc8cd59456.

With the dependency on libcutils (for gettid for non-bionic) removed,
this no longer breaks the build.

Change-Id: I645bd6876e2502ddc1535b69af1e645c0df9d178
2015-11-11 18:23:00 -08:00
Elliott Hughes
f99c144c15 Merge "adb: win32: fix adb shell" am: 524716889b am: ecdf5f3947
am: acab0b0054

* commit 'acab0b00544f11bd0c95478b1165e5d4831884c4':
  adb: win32: fix adb shell
2015-11-12 01:24:16 +00:00
Spencer Low
32762f4afd adb: win32: fix adb shell
28416d6d33 broke adb shell on Windows
because it was calling unix_read() with a buffer size of 1 byte which
wasn't supported by unix_read()/_console_read().

This change makes _console_read() support such a small buffer by
maintaining an internal input buffer.

This lets us simplify the existing code that was already maintaining a
cached INPUT_RECORD.

Also eliminate some duplicate code in the big switch statement.

Change-Id: I8f0aed4fb9f6f2f5b9a6b68ce60d2e368fec81c7
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-11-11 16:59:06 -08:00
Josh Gao
bf5537dd2c Merge changes from topic \'adb_dir\' am: bf666599b3 am: f30d0aeb55
am: 1cc5459eac

* commit '1cc5459eac3a00eebc188a1b3bed41cfab655356':
  adb: don't explode directories when pushing/pulling.
  adb: improve error handling, comments.
2015-11-11 23:36:47 +00:00
Josh Gao
bf666599b3 Merge changes from topic 'adb_dir'
* changes:
  adb: don't explode directories when pushing/pulling.
  adb: improve error handling, comments.
2015-11-11 23:22:48 +00:00
Josh Gao
abc3544c82 Merge "adb: add 100 column limit to .clang-format." am: 389cab802a am: ddb8244bc8
am: bc74fa9bed

* commit 'bc74fa9bedc4029594221b0b10f345f21d02d6ac':
  adb: add 100 column limit to .clang-format.
2015-11-11 22:31:42 +00:00
Josh Gao
32b24cfb5f adb: add 100 column limit to .clang-format.
Change-Id: I7d96a6d505d2ddd92ffe7ad12ffc777c03c63caf
2015-11-11 14:16:07 -08:00
Jorge Lucangeli Obes
5f160d907d Merge "Fix typo, caps in error messages." am: ae0f53cf69 am: af8f8a1561
am: 9155aa3035

* commit '9155aa30350b2ee444d4061f97d13c1200a79d41':
  Fix typo, caps in error messages.
2015-11-11 22:14:23 +00:00
Josh Gao
1a0253092d adb: properly handle path separators on Windows.
Bug: http://b/25573669
Change-Id: Ic82981e1dfe40d5e3b3ffa06e18e62ecf80d81fc
2015-11-11 14:01:46 -08:00
Josh Gao
07db1196e7 adb: don't explode directories when pushing/pulling.
Previously, `adb pull /data/local/tmp` would spew all of the contents of
/data/local/tmp into the current directory. This patch makes push/pull
keep directories intact.

Bug: http://b/25394682
Change-Id: I2304ae9e61745a2b9536f58a6012640bf8ff422a
2015-11-11 14:01:45 -08:00
Josh Gao
12a2ae9a0c adb: improve error handling, comments.
This commit fixes two cases:
  `adb pull /data/local/tmp nonexistent/path` would succeed.
  `adb pull /data/local/tmp nonexistent/` would fail.

Change-Id: I60c39eb2816946686241af42cfa2ad5cdc63fb0e
2015-11-11 14:00:11 -08:00
Jorge Lucangeli Obes
f39c56456d Fix typo, caps in error messages.
Bug: None
Change-Id: I673189f84812637c240321b72cf77b26b170b6ad
2015-11-11 11:34:14 -08:00
Elliott Hughes
eaeafe13b3 Merge "Revert "adb/base: fix adb push of Unicode filenames on Win32"" am: fdebc26ad5 am: 7d223253cb
am: 210111a0d0

* commit '210111a0d02511d379471700359d9065783b1cb9':
  Revert "adb/base: fix adb push of Unicode filenames on Win32"
2015-11-11 18:18:20 +00:00
Elliott Hughes
fdebc26ad5 Merge "Revert "adb/base: fix adb push of Unicode filenames on Win32"" 2015-11-11 18:01:34 +00:00
Elliott Hughes
cc8cd59456 Revert "adb/base: fix adb push of Unicode filenames on Win32"
This reverts commit ac9514a452.

The new gettid dependency caused other breakage.

Change-Id: I74a75e40c30a45beb275f9dd38eb5c7beac15fbd
2015-11-11 18:01:12 +00:00
Elliott Hughes
b979a787ff Merge "adb/base: fix adb push of Unicode filenames on Win32" am: 332166a31a am: 9cadb93394
am: 9d7da02815

* commit '9d7da028150b1682ab3b686fe3a6a72a329dfd3e':
  adb/base: fix adb push of Unicode filenames on Win32
2015-11-11 17:23:24 +00:00
Elliott Hughes
332166a31a Merge "adb/base: fix adb push of Unicode filenames on Win32" 2015-11-11 17:10:01 +00:00
Spencer Low
ac9514a452 adb/base: fix adb push of Unicode filenames on Win32
ae5a6c06cd made adb push use
android::base::ReadFileToString() for small files, but that API did not
support UTF-8 filenames on Windows, until this fix which does the
following:

- Add android::base::{WideToUTF8,UTF8ToWide}() which are only available
  on Windows. The signatures are based on Chromium's APIs of the same
  name.

- Add the namespace android::base::utf8 which has versions of APIs that
  take UTF-8 strings. To use this, make sure your code is in a namespace
  and then do "using namespace android::base::utf8;". On Windows, this will
  make calls to open() call android::base::utf8::open(), and on other
  platforms, it will just call the regular ::open().

- Make ReadFileToString() and WriteStringToFile() use utf8::open() and
  utf8::unlink().

- Adapt unittests from Chromium.

- fastboot needs to link with libcutils because it links with libbase
  which depends on libcutils for gettid() for logging.

Change-Id: I1aeac40ff358331d7a1ff457ce894bfb17863904
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-11-10 15:48:54 -08:00
Elliott Hughes
ef0ac03c4a Merge "Add -e to the adb shell documentation." am: 3c540aec24 am: eaf0ea050f
am: 992c0f4b5c

* commit '992c0f4b5ccbdd78e8b8a6754dc50b643c96f35c':
  Add -e to the adb shell documentation.
2015-11-10 19:34:25 +00:00
Elliott Hughes
3c540aec24 Merge "Add -e to the adb shell documentation." 2015-11-10 19:25:14 +00:00
Elliott Hughes
0e42c2a4ad Add -e to the adb shell documentation.
Change-Id: I7be5d198ef174e969bbb670e629369894c7b0994
2015-11-10 10:54:44 -08:00
Josh Gao
5a499973ac Merge "adb: don\'t try to pull character or block devices." am: 0bb1ce06ea am: 85a4b33302
am: 155d62feb0

* commit '155d62feb0ae0fe5e119b28a23bb69f22ca52ec5':
  adb: don't try to pull character or block devices.
2015-11-10 02:37:52 +00:00
Josh Gao
bae6190af8 Merge "adb: demote skipping a file from an error to a warning." am: 5a08fd35c9 am: 234dbb840a
am: 1a770d624d

* commit '1a770d624df978444c12ce9af66e807f19463412':
  adb: demote skipping a file from an error to a warning.
2015-11-10 02:36:59 +00:00
Josh Gao
0bb1ce06ea Merge "adb: don't try to pull character or block devices." 2015-11-10 02:22:47 +00:00
Josh Gao
8d00a39eff adb: don't try to pull character or block devices.
Change-Id: I1a9e2c0097fe9c4017a9b338e812366c8e1154f0
2015-11-09 18:12:10 -08:00
Josh Gao
21abf5a7c1 adb: demote skipping a file from an error to a warning.
Change-Id: If6c88e8855369bd7feb570ac5310fc7f44994083
2015-11-09 17:47:56 -08:00
Elliott Hughes
cd8bcd812f Merge "Fix adb shell escape handling." am: 79964cdf86 am: a55d6810b7
am: 1098a6202b

* commit '1098a6202b58989048fc7d9e78b5807583fb8057':
  Fix adb shell escape handling.
2015-11-10 01:14:37 +00:00
Elliott Hughes
79964cdf86 Merge "Fix adb shell escape handling." 2015-11-10 01:06:58 +00:00
Todd Kennedy
51c05ec568 Revert "Revert "use new cmd command""
This reverts commit 3e3b4ec007.

Change-Id: I8bfcd8a2a285f4254539ebca9f70222aa2448ef4
2015-11-09 16:11:09 -08:00