summaryrefslogtreecommitdiff
path: root/adb/file_sync_client.cpp
AgeCommit message (Collapse)Author
2018-02-28adb: switch over to Android.bp.Josh Gao
Rearrange some files while we're doing this. Bug: http://b/71721338 Test: manually ran adb on windows Change-Id: Ie47bda82279e4b9521505ad0353bf9ef649fc7d7
2017-08-10adb: Use kernel aio for functionfs.Jerry Zhang
This method works around the downsides of ENDPOINT_ALLOC, namely that it is not affected by memory fragmentation and it uses an upstream interface. Also add libasyncio to provide the necessary syscalls to both adb and mtp. Add some small optimizations to file_sync. Bug: 37916658 Test: run adb push/pull Change-Id: If3b3be02b5e2d4f9cffec1b8ddc02a5768a51a1f
2017-05-19Add --sync support to push.Dan Albert
Passing --sync only copies files that are older on the device. Test: nose2 Bug: None Change-Id: I2ff6c3d1fe29262c8ee50db316aa92fc38dd7147
2017-02-27Move adb_dirname and adb_basename to libbaseColin Cross
adb already provides an implementation of dirname and basename that take and produce std::strings, move it into libbase so it can be used in the implementation of GetExecutableDirectory. Test: out/host/linux-x86/nativetest64/adb_test/adb_test Test: out/host/linux-x86/nativetest64/libbase_test/libbase_test Test: adb shell /data/nativetest64/libbase_test/libbase_test64 Change-Id: Ideb1627607b14562121316d4ed27fa6fb0930684
2016-12-12adb: remove extraneous stat in sync_recv.Josh Gao
We do a remote stat to get the file's size before pulling in sync_recv, but all of the callers to sync_recv have already done a stat. Pass the expected file size into sync_recv to remove its stat. Bug: http://b/31289465 Test: python test_device.py Change-Id: I7ca8ed11c6134e5954acac86626f880ade3ec696
2016-12-05Revert "Revert "adb: extend sync protocol's stat support.""Josh Gao
This reverts commit afa4b5d6eb45bbee8671a1bb93ea70506fb326e3. Add functions to translate errno to and from the linux asm-generic values, since mips has different values. Bug: http://b/33058958 Test: python test_device.py with both old and new adbd Change-Id: I1a122235f3e793ed10b3bf3ad293388015134150
2016-12-05Revert "Revert "adb: move adb_strerror to sysdeps/win32/errno.cpp.""Josh Gao
This reverts commit 43c02b27cd50a75f0fecb44e56a9bf32c6923aef. Test: mma Change-Id: I6b22ead8a4b964973ee2fdb8deba42bea74880cf
2016-12-05Revert "adb: extend sync protocol's stat support."Josh Gao
This reverts commit d6d5c38469203a63c686517d765a7e6d2bc24656.
2016-12-05Revert "adb: move adb_strerror to sysdeps/win32/errno.cpp."Josh Gao
This reverts commit 4fba3d2638ecec0f87fe8d8913490bfbd7234d19.
2016-11-30adb: move adb_strerror to sysdeps/win32/errno.cpp.Josh Gao
Bug: none Test: mma Change-Id: I9df4d6faf9883a78f50ca6b2b7c35f095d06ae20
2016-11-30adb: extend sync protocol's stat support.Josh Gao
Extend the file sync protocol to support calling regular stat (instead of lstat), return error codes, and provide the entire stat struct. Bug: http://b/33058958 Test: python test_device.py with both old and new adbd Change-Id: I841123debc380f86194a19e91c97d85160112144
2016-11-21adb: make sure that file mode macros match linux.Josh Gao
We use <sys/stat.h> mode macros on the host to parse modes sent over from the device, so they had better match. Add static_asserts to ensure this. (Also, fix the cases where they don't.) Test: mma -j48, compiled the static_asserts on darwin manually Change-Id: I883e4e6c7489ea64d3c02d26790ac8293366d989
2016-11-17adb: fix progress percentage when pulling symlinks.Josh Gao
The adb protocol currently only supports lstat with no way of finding the target of a symlink, so pulling a symlink that points to a file looks like pulling a file with length equal to the length of path to the symlink's target. Pulling a file that's sufficiently large can overflow the int used to calculate percentage, and result in a bogus completion percentage being displayed. Bug: http://b/29277448 Test: adb pull /dev/block/platform/soc.0/f9824900.sdhci/by-name/system Change-Id: I42d180550ac2aa9e4705676ccbb20f5db789fb8d
2016-09-14adb: let `adb push` follow symlinks.Josh Gao
Bug: http://b/31491920 Test: touch foo; ln -s foo bar; adb push bar /data/local/tmp Test: python test_device.py Change-Id: I0a00b3d49fdf7206e27d66ac110b56e22449a1ad
2016-08-05adb: correctly fix merge conflict.Josh Gao
Change-Id: Ic637c0ef5499e2893cd0adfcc41dd5d3481524c2
2016-08-04resolve merge conflicts of e012de5 to stage-aosp-masterJosh Gao
Change-Id: I3d9f8b4421fa6122261dbd821561a2236f810a47
2016-08-04adb: improve display of transfer rate.Josh Gao
Show transfer rate for individual files, and for the overall transfer. Bug: http://b/30411535 Change-Id: If2f3008f1287b1d1add4a23c3430b39885b6c904 Test: inspected output manually
2016-08-04adb: add missing newline when printing transfer rate.Josh Gao
Previously, we weren't printing a newline when reporting transfer rates, so only the last transfer rate printed would be visible. Bug: http://b/30667841 Change-Id: Id341147912d057673de4ad26a8f618f04a8c02f3 Test: inspected output manually
2016-08-04adb: fix output of `sync -l`Josh Gao
sync with list-only was using SyncConnection::Error to print its output persistently, which would prepend "adb: error: " to messages. Change-Id: I90df5fc1123b8c613c811cf66c37aef05663b1e4
2016-08-01Merge \"Fix clang-tidy performance warnings in syste/core.\"Chih-Hung Hsieh
am: 4efbce14b5 Change-Id: I84f6b0134fae6e9f40710f243f4825e3f31fa15f
2016-08-01Fix clang-tidy performance warnings in syste/core.Chih-Hung Hsieh
* Use const reference type for parameters to avoid unnecessary copy. * Suppress warning of not using faster overloaded string find function. Bug: 30407689 Bug: 30411878 Change-Id: I6cfdbbd50cf5e8f3db6e5263076d3a17a9a791ee Test: build with WITH_TIDY=1 Merged-In: Ie79dbe21899867bc62031f8618bb1322b8071525
2016-04-13Implements 'adb bugreport <ZIP_FILE>'.Felipe Leme
Dumpstate now supports zipped bugreport, whose output is more complete than the flat-file bugreports provided prior to N. As such, adb now has a 'adb bugreport <ZIP_FILE>' name whose implementation: - Calls the new bugreportz binary. - Parses its output, which in case of success is the path of the .zip file. - Pulls the device file and renames it according to the command-line argument. BUG: 27653204 Change-Id: I7169fe157c77bbef1684d0cb4e43095d95ddf2b8
2016-03-03adb: mkdir the correct directory name when pulling.Josh Gao
The directory name should be based off of the local path, not the remote path. Change-Id: I75b089b8734e9dbf8e466b1e00ea18549fd101bb (cherry picked from commit 89ec3a8d0feac727257b428a91b6f84b6a4b1395)
2016-03-03adb: cleanup file skipping logic.Josh Gao
Bug: http://b/26355212 Change-Id: Iafa250ce6c5ea8da9f5f00125165e5b67ef1013f (cherry picked from commit a31ea55c555aaa9cddab06c038f6e3285770f664)
2016-03-03adb: report progress for small files.Josh Gao
Bug: http://b/27407725 Change-Id: I7515144402a487fb3d4d403e2f5f82423c1b5ed6 (cherry picked from commit 9fd2f77dcce09aa38bf8f1798ebaac2abeef1598)
2016-03-03adb: fix directory creation logic.Josh Gao
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 71728ca300d1bc168fae89c8139e72db3d4591cb)
2016-03-03adb: mkdir the correct directory name when pulling.Josh Gao
The directory name should be based off of the local path, not the remote path. Change-Id: I75b089b8734e9dbf8e466b1e00ea18549fd101bb
2016-03-03adb: cleanup file skipping logic.Josh Gao
Bug: http://b/26355212 Change-Id: Iafa250ce6c5ea8da9f5f00125165e5b67ef1013f
2016-03-01adb: report progress for small files.Josh Gao
Bug: http://b/27407725 Change-Id: I7515144402a487fb3d4d403e2f5f82423c1b5ed6
2016-02-26adb: fix directory creation logic.Josh Gao
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
2016-02-22adb: check for an error response from adbd between each write.Josh Gao
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 afcdcd703e3023dfc60638cf6b67b530ec18cb18)
2016-02-19adb: check for an error response from adbd between each write.Josh Gao
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
2016-02-03adb: don't append a slash to a path that already ends with one.Josh Gao
Bug: http://b/26964908 Change-Id: I1fbd752fd97f5414a306b46f7bfce3373362f8b3
2015-12-18Give adb a proper progress bar.Elliott Hughes
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
2015-12-11Merge "adb: make pulling symlinks and devices work."Josh Gao
2015-12-11adb: make pulling symlinks and devices work.Josh Gao
Bug: http://b/25972989 Bug: http://b/26085751 Change-Id: I43842871522ea5f67a8c258dcb6ddafa8dd744c8
2015-12-09Simplify adb LinePrinter newline handling.Elliott Hughes
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
2015-12-04Track rename of base/ to android-base/.Elliott Hughes
Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
2015-12-02Merge "adb: don't divide by zero"Josh Gao
2015-12-02Merge "Fix "adb sync" (and "adb push") error reporting."Elliott Hughes
2015-11-30adb: don't divide by zeroJosh Gao
If we stat a file and get a size of 0, and then successfully read bytes from that file, we would previously divide by zero when calculating the percentage completion of the file. This case happens either when we're racing against something else writing to the file, or when we're pulling magical files such as the ones in /dev/cpuctl/ that lie about their size. Bug: http://b/25925733 Change-Id: I980b9c14f44a1eb4a42bc8736c94fa6db06c08d1
2015-11-30adb: don't pull symlinks when pulling a directoryJosh Gao
The previous change to do this (f96dc73b) only skipped individually named symlinks, not symlinks inside of a directory that was being pulled. Bug: http://b/25601283 Change-Id: I25bdcbc546a9d3a0dbd8dacdb065fb134d96022b
2015-11-30adb: remove extraneous newline from skip messageJosh Gao
Change-Id: I12314da589bf0db14b37ae4c1f526665182f4776
2015-11-30adb: correctly count skipped files in push/pullJosh Gao
Bug: http://b/25650207 Change-Id: I055b08216938640c4f7c5e96a7ea3719bf90ba70
2015-11-20Fix "adb sync" (and "adb push") error reporting.Elliott Hughes
This patch ensures that we read any error response from the server if the server closes the connection. Unfortunately, that's not sufficient to ensure that we always see the server's error message --- sometimes the data just gets thrown away because we keep writing without reading. Setting SO_LINGER avoids this. Bug: http://b/25230872 Change-Id: I96c019cc72bd139198de79bf29e6536cc462c20f
2015-11-20Move SendLargeFile into SyncConnection.Elliott Hughes
Just a trivial refactor. Code change comes later. Change-Id: If9e509a8c44649e5be4daaca57972939b037b8db
2015-11-17adb: don't use adb_dirname in between getting and printing errno.Josh Gao
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-13adb: don't pull symlinks.Josh Gao
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-11adb: properly handle path separators on Windows.Josh Gao
Bug: http://b/25573669 Change-Id: Ic82981e1dfe40d5e3b3ffa06e18e62ecf80d81fc
2015-11-11adb: don't explode directories when pushing/pulling.Josh Gao
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