Commit graph

1185 commits

Author SHA1 Message Date
Elliott Hughes
9bc8005e07 resolved conflicts for merge of 3ecba7f9 to mnc-dev-plus-aosp
Change-Id: I46452c03bbda9604f2af2e1edce5d48c6865d436
2015-08-25 11:21:58 -07:00
Elliott Hughes
478bca2e72 resolved conflicts for merge of ba8fc829 to mnc-dev-plus-aosp
Change-Id: Ia4daf846df5a86ebca1b6c8d9e41f1633001836f
2015-08-25 11:16:36 -07:00
Elliott Hughes
56bf309843 Fix 32-bit build.
fs_config uses "unsigned int" instead of mode_t. Work around this.

Change-Id: I57b97d5bfc1b88089a41b4e8a50f1391b5c5113b
2015-08-25 11:01:39 -07:00
Elliott Hughes
fdd4e58868 Clean up error handling/reporting in file_sync_service.cpp.
In an earlier code review it was pointed out that there was something
very weird about fail_errno. It didn't seem to make sense that we'd
often try to continue after reporting failure. This patch cleans up
all that and assumes that if we've reported failure to the client,
we should stop what we're doing.

Bug: http://b/23437039
Change-Id: I39c38650ed9f9d5e30adbf68a7545c9e4a6ab812
2015-08-25 08:41:05 -07:00
Elliott Hughes
e3bbb2ab00 am 6c04e9a9: am 42640e52: Merge "Add missing #include <memory> for std::unique_ptr on Windows."
* commit '6c04e9a9eca2903c2496ec735c359ed57467d52f':
  Add missing #include <memory> for std::unique_ptr on Windows.
2015-08-24 22:05:17 +00:00
Elliott Hughes
42640e5224 Merge "Add missing #include <memory> for std::unique_ptr on Windows." 2015-08-24 21:50:26 +00:00
Elliott Hughes
a925dba0e0 Add missing #include <memory> for std::unique_ptr on Windows.
Change-Id: Ic02f53003a20a646cbbf2aa08e0e10be9bd8b97f
2015-08-24 14:49:43 -07:00
Elliott Hughes
201eaa683a am 5c027334: am 93b9e865: Merge "There are no big endian hosts, grandpa."
* commit '5c027334cce4f0106d5d271d7924eafc752bd584':
  There are no big endian hosts, grandpa.
2015-08-24 21:45:12 +00:00
Elliott Hughes
f4465203b6 There are no big endian hosts, grandpa.
Change-Id: I6f64f702f919fe4af10d82c5f395a051571815ed
2015-08-24 14:27:03 -07:00
Elliott Hughes
6b5f77c9bb am c583c511: am 186f1dee: Merge "adb sync cleanup."
* commit 'c583c5112bb6634114cd9759c1cfbad61a13b397':
  adb sync cleanup.
2015-08-24 20:59:50 +00:00
Elliott Hughes
186f1dee2a Merge "adb sync cleanup." 2015-08-24 20:48:01 +00:00
Elliott Hughes
aa24549190 adb sync cleanup.
We can double the speed of "adb sync" (on N9) if we increase SYNC_DATA_MAX
from 64KiB to 256KiB. This change doesn't do that, because I still haven't
managed to plumb through the information about whether we're a new adb/adbd
to file_sync_client.cpp and file_sync_service.cpp. But this is already a big
change with a lot of cleanup, so let's do the cleanup and worry about the
intended change another day...

This change does improve performance somewhat by halving the number of
lstat(2) calls made on the client side, and ensuring that most packets are
sent with a single write. This has the pleasing result of making the null
sync on an AOSP N9 go from just over 300ms to around 100ms, which means it
now seems instantaneous (https://en.wikipedia.org/wiki/Mental_chronometry).

Change-Id: If9f6d4c1f93ec752b95f71211bbbb1c513045166
2015-08-24 11:15:01 -07:00
Badhri Jagan Sridharan
ff490354f4 am 46f24955: am e3c02883: Merge "adbd: enable USB SuperSpeed (again)"
* commit '46f24955c8c30992c8b885fe2c4531777223315d':
  adbd: enable USB SuperSpeed (again)
2015-08-24 17:45:38 +00:00
Badhri Jagan Sridharan
e3c028836f Merge "adbd: enable USB SuperSpeed (again)" 2015-08-24 17:33:20 +00:00
Siva Velusamy
ef39b2613c am 5b476736: am 9498fc68: Merge "Use glog for logging in the OSX USB layer"
* commit '5b476736da368ea679a9da8eb861c74451e4c689':
  Use glog for logging in the OSX USB layer
2015-08-24 15:47:57 +00:00
Siva Velusamy
9498fc68ec Merge "Use glog for logging in the OSX USB layer" 2015-08-24 15:35:51 +00:00
Siva Velusamy
743883b570 Use glog for logging in the OSX USB layer
Change-Id: I8a3a4dfc768fdd335f03dc582c85b410c808aeb7
2015-08-24 08:22:15 -07:00
Tom Cherry
60eb73ed6a am 54b22ca2: am ff5be396: Merge changes from topic \'init-rc-breakup\'
* commit '54b22ca2488e4901265c99a42b5c5e0725a99199':
  init: Queue Triggers instead of Actions
  bundle init.rc contents with its service
2015-08-21 18:20:22 +00:00
Tom Cherry
20391b1de5 bundle init.rc contents with its service
Bug: 23186545
Change-Id: I52616b8ab1165fdef716f9b8f958665f2308c12e
2015-08-21 10:14:43 -07:00
Elliott Hughes
22b510adc5 am 2b0deb91: am a169f3b4: Merge "adb: win32: fix unittest exit code parsing"
* commit '2b0deb91c3dca2b7b2a5ef0445fed73db63a922d':
  adb: win32: fix unittest exit code parsing
2015-08-19 03:50:09 +00:00
Spencer Low
b7e79af048 adb: win32: fix unittest exit code parsing
adb on Windows uses \r\n line-endings, so take that into account when
parsing output for the exit code.

Change-Id: I6a3d7c5ca455b0f0f7dae174866857e0aeee9926
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-08-16 16:38:47 -07:00
David Pursell
f3f5bce204 am 6a701bd9: am b53b521e: Merge "Add adb features."
* commit '6a701bd94b067c2ab873964f63c3d954bc59610f':
  Add `adb features`.
2015-08-14 16:13:13 +00:00
David Pursell
f53c7af156 am be1f5732: am f4bda753: Merge "Add feature list to connection banner."
* commit 'be1f57325f6fe1702b0d18fcdb21efe4731a191d':
  Add feature list to connection banner.
2015-08-14 16:13:11 +00:00
Dan Albert
90d4b739ab Add adb features.
Shows the features supported by the active adb server.

Change-Id: I4a58a2ca082823c43f7a49e2c62ff80df6426756
2015-08-14 08:25:23 -07:00
Dan Albert
1792c23cb8 Add feature list to connection banner.
This allows us to test for features explicitly rather than relying on
the protocol version number, allowing us to fall back gracefully if a
feature is not supported.

This will be needed for the upcoming shell upgrades for stdout/stderr
separation and exit code reporting.

Change-Id: Ibb1d8ad2611f7209901ee76d51346b453e9c5873
2015-08-14 08:24:37 -07:00
Elliott Hughes
2733c14232 am 2416b832: am 15c6de75: Merge "Start iterating USB pipe endpoints from 1."
* commit '2416b8320cdce59ae267d60d89b0ef96de6a9d95':
  Start iterating USB pipe endpoints from 1.
2015-08-14 03:21:47 +00:00
Elliott Hughes
2d4f852da4 Start iterating USB pipe endpoints from 1.
Bug: http://b/22829602
Change-Id: I5051880730ba8fadae5d78f1d19b5d527610d4a5
2015-08-13 16:00:12 -07:00
Siva Velusamy
b3d3e24585 am ba7284ae: am 4d40c03b: Merge "adb: On Mac, clear both host and device endpoints at startup"
* commit 'ba7284aee2df23d80eda3a78e73d98eaed8e16a7':
  adb: On Mac, clear both host and device endpoints at startup
2015-08-13 22:06:28 +00:00
Siva Velusamy
d8b48a6281 adb: On Mac, clear both host and device endpoints at startup
This CL clears both the host and device endpoints right at the
beginning when the bulk endpoints are identified. This is in general
a "good idea", but more specifically for us, it fixes the issue
that sometimes when adb quits, it clears the endpoint on the host,
but not on the device which resulted in a subsequent invocation of
adb was seeing a stall.

Bug: https://code.google.com/p/android/issues/detail?id=182151

Change-Id: I331fa6805c40d1f50c153c010ceecd2f6a4045eb
2015-08-13 14:32:50 -07:00
Elliott Hughes
f36aa8ec5d am 5563b77a: am 57532b2a: Merge "adb: improve network error info"
* commit '5563b77a138faa622d1ba164599bf6be88997f84':
  adb: improve network error info
2015-08-13 18:00:45 +00:00
Elliott Hughes
57532b2a06 Merge "adb: improve network error info" 2015-08-13 17:49:21 +00:00
Elliott Hughes
5e60d25d66 am 1685b099: am 8836031b: Merge "adb: win32: fix shutdown deadlock"
* commit '1685b09921ae2057acbd9655778660a2e81ec6b3':
  adb: win32: fix shutdown deadlock
2015-08-13 17:15:02 +00:00
Elliott Hughes
8836031b27 Merge "adb: win32: fix shutdown deadlock" 2015-08-13 17:02:16 +00:00
Elliott Hughes
56d11898aa am 80e83972: am 9537ca80: Merge "adb: start-server and kill-server error output"
* commit '80e83972d0bce74d218f72b76339e6761ad6b03b':
  adb: start-server and kill-server error output
2015-08-13 16:46:46 +00:00
Spencer Low
f18fc0879b adb: start-server and kill-server error output
- handle_host_request
  - When the host:kill command comes in, shutdown the socket before
    calling exit(). If we don't do this, the client will output error info
    even though everything is working ok.

- adb_connect()
  - If we can't parse the version string, explain this in error output
    and don't goto error which would try to close an fd we already closed.
  - If host:kill doesn't work, output error info. Don't try to close
    already closed fd.

- adb_main()
  - If writing the ACK somehow has an error, output error info (I doubt
    this will ever get hit).

- adb_commandline()
  - Fix typo about max port number.
  - Make 'adb kill-server' and 'adb start-server' output any detailed
    error info.

Change-Id: Id1a309cc1bf516f7f49bd332b34d30f148b406da
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-08-12 20:14:55 -07:00
Spencer Low
87e97ee305 adb: win32: fix shutdown deadlock
adb can hang at shutdown due to a deadlock relating to WSACleanup().
This works around the issue by not calling WSACleanup() which shouldn't
be done anyway since threads aren't done using Winsock at shutdown.

A quick way to reproduce the original problem is to run many instances
of adb, many of which will call exit() soon:

  for /l %i in (1,1,20) do @start adb nodaemon server

You may have to boost the 20 to 200, or set ADB_TRACE=1 or use Windows
10 instead of Windows 7, to affect the timing, but eventually there
should be hung adb processes with that repro.

A more complete fix to prevent problems like this from occuring in the
future, would be to additionally do the following:

- Investigate all static destructors that are called when exit() is
  called.

- If they don't do anything important, switch all calls to exit() to
  instead call _exit() and then ban exit() from being called.

Change-Id: Id1be3bf0053809a45f2eca4461e4c35b5ef9388d
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-08-12 18:19:16 -07:00
David Pursell
6eef56fb7a am 697869c4: am 6fefa36c: Merge "adb: Fix PTY logic for non-interactive shells."
* commit '697869c4fde93a23cda3a0d789c1f101f82eb157':
  adb: Fix PTY logic for non-interactive shells.
2015-08-12 22:29:00 +00:00
David Pursell
d4093f191b adb: Fix PTY logic for non-interactive shells.
Change `adb shell` so that interactive sessions use a PTY but
non-interactive do not. This matches `ssh` functionality better
and also enables future work to split stdout/stderr for
non-interactive sessions.

A test to verify this behavior is added to test_device.py with
supporting modifications in device.py.

Bug: http://b/21215503
Change-Id: Ib4ba40df85f82ddef4e0dd557952271c859d1c7b
2015-08-12 14:16:22 -07:00
Yabin Cui
63a29199f3 am 87f73de9: am 317acfb8: Merge "Remove confusing variable HOST."
* commit '87f73de9e9b0a74e4b963e8b49d90bbe81a38bb0':
  Remove confusing variable HOST.
2015-08-12 21:09:13 +00:00
Yabin Cui
317acfb880 Merge "Remove confusing variable HOST." 2015-08-12 20:55:59 +00:00
Elliott Hughes
efc8077246 am c01231b3: am 2fb00423: Merge "Always include the adb version in the log."
* commit 'c01231b399c38f00afe0872b3a51837518b713dc':
  Always include the adb version in the log.
2015-08-12 17:45:41 +00:00
Elliott Hughes
42ae2604f4 Always include the adb version in the log.
"Are you running the right version?" seems to be a common cause of debugging
confusion.

Change-Id: I4a4ba95e876dafc05e515058ca059ea370273f78
2015-08-12 08:32:10 -07:00
Elliott Hughes
f000f7b250 am 70af6e0b: am 9508dcb9: Merge "adb: make stdin/stdout/stderr redirection errors fatal"
* commit '70af6e0bad17c5d90084738950e72243f0ce3806':
  adb: make stdin/stdout/stderr redirection errors fatal
2015-08-12 15:29:39 +00:00
Spencer Low
155159c545 adb: make stdin/stdout/stderr redirection errors fatal
Make these fatal errors:

- Win32 GetTempPathW() failures.

- Errors opening /dev/null (and don't use LOG(FATAL) for this error
  since that will do a crash-dump on Windows which isn't appropriate for a
  transient runtime error).

- Errors with dup2.

- Errors opening adb.log.

Change-Id: Ided76a5436d8c6f059d8f6799c49ba04c87181ae
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-08-11 23:36:55 -07:00
Elliott Hughes
9cb4af39af am 8bb6b3e1: am b62f6c2a: Merge "adb: call android::base::InitLogging even when adb tracing is disabled"
* commit '8bb6b3e1ffc44336f89eb30cc39a1e96498c7c23':
  adb: call android::base::InitLogging even when adb tracing is disabled
2015-08-12 03:31:19 +00:00
Elliott Hughes
b62f6c2a1c Merge "adb: call android::base::InitLogging even when adb tracing is disabled" 2015-08-12 03:20:04 +00:00
Dan Albert
97a8cd957f am e78292f2: am cef3508b: Merge "Add missing includes."
* commit 'e78292f2c5a1cffd9fdcb76e5be29f6d14445b93':
  Add missing includes.
2015-08-12 02:10:16 +00:00
Dan Albert
cef3508bb6 Merge "Add missing includes." 2015-08-12 01:50:15 +00:00
Spencer Low
bf7c605d87 adb: improve network error info
- handle_forward_request
  - Because we have detailed info about which syscall failed (at least
    on Win32), use a more generic prefix of "cannot bind listener" followed
    by the detailed info.

- install_listener
  - Return string errors for a few errors even though I don't think any
    callers actually output the string for those errors.

  - Remove the printf since the callers print the message themselves.

- adb_main
  - LOG(FATAL) calls abort() which on Windows calls the Windows Error
    Reporting service which pops up a dialog asking if you want a
    crashdump to be uploaded to Microsoft. So really, abort() is
    designed for app bugs. Windows isn't the only one doing this, Chromium
    also makes LOG(FATAL) crashdump-ready. Since an error here is not
    necessarily an app-bug, use a 'normal' error output API like fatal()
    which prints an error and just uses exit().

- sysdeps_win32.cpp
  - When Winsock APIs fail, make the string clarify which API failed.
    Use terse unix-style descriptions (like what you'd get from
    cp/mv/dd/etc.).

  - Don't trace WSAEWOULDBLOCK from recv() which is a normal occurrence.

  - Add a comment about WSAEWOULDBLOCK => EAGAIN.

Change-Id: I58e47f49fa2f6c1b4b92a36d0c4bfe369b456f2a
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-08-11 16:45:32 -07:00
Dan Albert
af9ba4dc6c Add missing includes.
Leaky header cleanup in libc++ means we don't get unistd.h
transitively any more.

Change-Id: I596c24eff418302b19afab6ad3caa55f52241e7c
2015-08-11 16:39:57 -07:00