Commit graph

1587 commits

Author SHA1 Message Date
Elliott Hughes
ee5910c3ee Merge "Give adb a proper progress bar." am: 0e6a23c7d5
am: 91c228f1ef

* commit '91c228f1ef6845535e7e490f0d938cf5e4271f11':
  Give adb a proper progress bar.
2015-12-19 09:20:36 -08:00
Elliott Hughes
a00e6ef1ff Give adb a proper progress bar.
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-18 14:43:31 -08:00
Elliott Hughes
f6e7622aea Merge "adb host: add device state in "adb wait-for-*"" am: 82509e7925
am: ba7a198c29

* commit 'ba7a198c2976baf9574dd01d7719ec0443caba47':
  adb host: add device state in "adb wait-for-*"
2015-12-18 18:40:17 +00:00
Josh Gao
3f165e8d5b Merge "adb: extract USB FFS read/write limit constants." am: 1ff73936a7
am: 67a6d861ce

* commit '67a6d861ce47b2d555a0e6d4288f3c3d35a9155b':
  adb: extract USB FFS read/write limit constants.
2015-12-18 18:39:54 +00:00
Elliott Hughes
c85c7e84cc Merge "Improve "adb install"\'s error message slightly." am: d361582dc0
am: 79abeb68f2

* commit '79abeb68f26c3ff9b99929fe15b25fd202225ffc':
  Improve "adb install"'s error message slightly.
2015-12-18 18:39:33 +00:00
Jorge Lucangeli Obes
135405fd20 Merge "adb: Use Minijail for privilege dropping." am: 297a8381b5
am: f733d6acad

* commit 'f733d6acad6582fb7d816ef65bbeecfd745af5ec':
  adb: Use Minijail for privilege dropping.
2015-12-18 01:52:10 +00:00
Tom Cherry
065c723db2 Merge "Use selinux_android_setcon() instead of setcon()" am: 64cc0825a6
am: 4692984e92

* commit '4692984e92de83299f4c03ec176c9a4b4dcb0292':
  Use selinux_android_setcon() instead of setcon()
2015-12-18 01:48:52 +00:00
Elliott Hughes
82509e7925 Merge "adb host: add device state in "adb wait-for-*"" 2015-12-17 22:44:15 +00:00
Josh Gao
1ff73936a7 Merge "adb: extract USB FFS read/write limit constants." 2015-12-17 22:29:12 +00:00
Josh Gao
ae72b5aa4b adb: extract USB FFS read/write limit constants.
Change-Id: I5e9fb7959a1c4744cb8d53ece4634138239d4e49
2015-12-17 14:28:24 -08:00
Elliott Hughes
d361582dc0 Merge "Improve "adb install"'s error message slightly." 2015-12-17 22:17:38 +00:00
Elliott Hughes
fe01885c9b Improve "adb install"'s error message slightly.
We still don't really have a clue what went wrong, but "Failed to write"
made it sound like we did.

Change-Id: Ic58b13202e2d8ea6b095f7046db9d0771d77ce65
2015-12-17 14:04:38 -08:00
Jorge Lucangeli Obes
683dc4817f adb: Use Minijail for privilege dropping.
By using Minijail we avoid writing the same priv-dropping code over
and over again. This also enables future hardening opportunities.
We're already using Minijail for priv-dropping on Brillo.

Minijail is unit- and integration-tested on the
Chrome OS CI infrastructure (pulling from the same repo, see
https://wmatrix.googleplex.com/security?tests=security_Minijail0).
Once CI comes to Android, it will be continuously tested there as well.

Both 'adb root' and 'adb unroot' still work.

Bug: 26099611
Change-Id: I52c456ea272d27bd6fbc71200f4fdd928a592158
2015-12-17 10:49:53 -08:00
Tom Cherry
64cc0825a6 Merge "Use selinux_android_setcon() instead of setcon()" 2015-12-17 17:54:05 +00:00
Leo Sartre
1fbc9dbd0f adb host: add device state in "adb wait-for-*"
The current implementation of the host commands "adb wait-for-*" allows
to specify only the transport layer (local, usb or any).
This patch allows the specification of the expected device state
(bootloader, recovery, device or sideload), this is usefull for
scripting purposes.

Use case:
$ adb reboot sideload-auto-reboot
$ adb wait-for-usb-sideload && adb sideload package.zip

Change-Id: I276a6be4d82f8b7901f74e1e5395b86d16548e8f
Signed-off-by: Leo Sartre <leox.sartre@intel.com>
2015-12-16 18:11:18 -08:00
Tom Cherry
38cd57a145 Use selinux_android_setcon() instead of setcon()
Bug 26114086

Change-Id: I02d20ee7a5f487fc73d7a33d50b0b8f1cd9ad3a4
2015-12-16 17:42:08 -08:00
Josh Gao
a61bd45f83 Merge "adb: split up reads longer than 16k." am: 56d7d4e85f
am: bf2c482b56

* commit 'bf2c482b5625d7f0722e85415221a02795cb72ca':
  adb: split up reads longer than 16k.
2015-12-16 14:20:33 -08:00
Josh Gao
0b19540dee adb: split up reads longer than 16k.
Reads from functionfs allocate contiguous buffers in the kernel, causing
long ones to sometimes fail because of memory fragmentation.

Bug: http://b/26206622
Change-Id: Id40753d6f29b37b5ca97c3e2fa3921f52b4242de
2015-12-16 11:40:38 -08:00
Elliott Hughes
0eb8f2942a Merge "More idiomatic cleanup of 9f75a035713d216469f1cabfe4a65f7864e2145a." am: a48dc55f32
am: 14f74dae87

* commit '14f74dae876482a2eb41e8a3802cc5b39224662a':
  More idiomatic cleanup of 9f75a03571.
2015-12-16 18:44:25 +00:00
Elliott Hughes
9e7893bf86 More idiomatic cleanup of 9f75a03571.
Change-Id: Id936946375d2be56ba10bf3aa5804f52cdbecc2d
2015-12-16 08:45:05 -08:00
Nick Kralevich
eba19367fe Merge "adbd: make a PR_CAPBSET_DROP error fatal." am: 57134adecb
am: 85ac05f480

* commit '85ac05f4805c3f12a923817ab4939f760ac460ca':
  adbd: make a PR_CAPBSET_DROP error fatal.
2015-12-16 02:01:33 +00:00
Nick Kralevich
9f75a03571 adbd: make a PR_CAPBSET_DROP error fatal.
Back in 080427e4e2, we said:

  If the kernel doesn't support file capabilities, we ignore
  a prctl(PR_CAPBSET_DROP) failure. In a future CL, this could
  become a fatal error.

Make it a fatal error. With SELinux support, all devices are
required to support file capabilities.

Change-Id: I0ce0c4cb9387c42e325cbf1a63c5d82e6aab530c
2015-12-15 16:54:53 -08:00
Elliott Hughes
2e83684537 Merge "Share the new adb USB diagnostic code with fastboot." am: efd8c3289e
am: 40f80e25d3

* commit '40f80e25d3f399ece26d5f1ac145921ccb7f5f80':
  Share the new adb USB diagnostic code with fastboot.
2015-12-14 12:47:44 -08:00
Elliott Hughes
1b708d368f Share the new adb USB diagnostic code with fastboot.
Bug: http://b/26134129
Change-Id: Ieaf0651c7b3f8a028760982091ec63a21a5484ba
2015-12-14 10:50:21 -08:00
Josh Gao
9b42cea202 Merge "adb: handle some edge cases with process environments." am: 80f3b0438d
am: 412f6aaead

* commit '412f6aaead3c414fe65e8a9ca129e3218d28f633':
  adb: handle some edge cases with process environments.
2015-12-13 13:15:34 -08:00
Josh Gao
80f3b0438d Merge "adb: handle some edge cases with process environments." 2015-12-12 00:43:38 +00:00
Josh Gao
e03c988748 adb: handle some edge cases with process environments.
Change-Id: I0c20e58e14ef756a8c45dd5ea85f7301157a3c8e
2015-12-11 15:58:32 -08:00
Josh Gao
25ec5c097a Merge "adb: don\'t use setenv after forking." am: 5e15568c07
am: 7b74dc83e6

* commit '7b74dc83e6e3c81f534f4422c14402ecd04b9015':
  adb: don't use setenv after forking.
2015-12-11 15:57:19 -08:00
Josh Gao
5e15568c07 Merge "adb: don't use setenv after forking." 2015-12-11 23:32:19 +00:00
Josh Gao
9b3fd67213 adb: don't use setenv after forking.
Previously, for `adb shell`, we were using setenv after forking to set
up the child's environment. This would occasionally deadlock in the
child, which would cause the main thread to deadlock waiting for the
child to complete. This patch constructs the environment before forking
and passes it to execle, eliminating the deadlock.

Bug: http://b/25847115
Change-Id: I720d472770564b1449819ddaab945a89844244a8
2015-12-11 15:10:12 -08:00
Josh Gao
c56e68f0eb Merge "adb: make pulling symlinks and devices work." am: c8e793685c
am: 8b99185552

* commit '8b99185552fd49e7902404352e0b5fda266263fd':
  adb: make pulling symlinks and devices work.
2015-12-11 14:18:54 -08:00
Josh Gao
c8e793685c Merge "adb: make pulling symlinks and devices work." 2015-12-11 21:04:25 +00:00
Josh Gao
f264224191 adb: make pulling symlinks and devices work.
Bug: http://b/25972989
Bug: http://b/26085751
Change-Id: I43842871522ea5f67a8c258dcb6ddafa8dd744c8
2015-12-11 12:51:38 -08:00
Mike Frysinger
7e4d906f2f Merge "adbd: refactor priv dropping logic" am: 6945e36060
am: e2d0403e1c

* commit 'e2d0403e1c6fc610e1536090e903ddced58a2015':
  adbd: refactor priv dropping logic
2015-12-11 10:58:00 -08:00
Mike Frysinger
6945e36060 Merge "adbd: refactor priv dropping logic" 2015-12-11 17:03:19 +00:00
Josh Gao
eaad29ed53 Merge "adb: shell: add -n flag to not read from stdin." am: aae38d9704
am: 5abed250dd

* commit '5abed250dd8a808271527c02a8c7758a863541fc':
  adb: shell: add -n flag to not read from stdin.
2015-12-10 15:43:31 -08:00
Nick Kralevich
d1de91b26c Merge "Revert "adb: Make HOME=/data/local/tmp"" am: ce4bbcfb08
am: a09565ad1d

* commit 'a09565ad1d4c552b6d1dc8be28cf674d2ec8b3ec':
  Revert "adb: Make HOME=/data/local/tmp"
2015-12-10 15:43:17 -08:00
Josh Gao
0f871e8257 Merge "adb: make the test_pull_dir test actually test something." am: f31aba9e8d
am: e0dcc75107

* commit 'e0dcc751072591e471a489e18d2d30abc045ffa4':
  adb: make the test_pull_dir test actually test something.
2015-12-10 15:42:48 -08:00
Josh Gao
12debfc4cb Merge "Move adb tests to system/core/adb." am: 4d0e10b24e
am: fe5c23b388

* commit 'fe5c23b388d1c4166558f4b3d3222f9015528afb':
  Move adb tests to system/core/adb.
2015-12-10 15:42:30 -08:00
Josh Gao
aae38d9704 Merge "adb: shell: add -n flag to not read from stdin." 2015-12-10 21:30:19 +00:00
Josh Gao
7d58607360 adb: shell: add -n flag to not read from stdin.
Shell scripts of the following form do not work properly with adb:
    echo "foo\nbar\nbaz" | {
        read FOO
        while [ "$FOO" != "" ]; do
            adb shell echo $FOO
            read FOO
        done
    }
The first run of adb shell will consume all of the contents of stdin,
causing the loop to immediately end. ssh solves this by providing a -n
flag that causes it to not read from stdin. This commit adds the same.

Bug: http://b/25817224
Change-Id: Id74ca62ef520bcf03678b50f4bf203916fd81038
2015-12-10 12:52:06 -08:00
Nick Kralevich
ce4bbcfb08 Merge "Revert "adb: Make HOME=/data/local/tmp"" 2015-12-10 20:48:08 +00:00
Nick Kralevich
b118762241 Revert "adb: Make HOME=/data/local/tmp"
During early boot, we may be mounting and unmounting /data.
Having the home directory for adb shell commands, such as
"adb shell logcat", on the /data directory prevents unmounting.

This reverts commit 173eb396c7.

Bug: 26132185
Change-Id: Ib7c2f9e696f52bf5bbb79223d90dd76791779587
2015-12-10 20:42:18 +00:00
Mike Frysinger
4120ebc635 adbd: refactor priv dropping logic
Makes the code a little cleaner.

Change-Id: I961b6fc8730c45d8fd4f9fd2981a6d6ab8f51fb6
2015-12-10 13:35:10 -05:00
Josh Gao
f31aba9e8d Merge "adb: make the test_pull_dir test actually test something." 2015-12-10 18:09:53 +00:00
Josh Gao
4d0e10b24e Merge "Move adb tests to system/core/adb." 2015-12-10 18:09:47 +00:00
Elliott Hughes
ffc39903c6 Merge "Simplify adb LinePrinter newline handling." am: 9fa5cefea4
am: ab31c07ce9

* commit 'ab31c07ce9a9d6df3483c326c42a50c63f737695':
  Simplify adb LinePrinter newline handling.
2015-12-09 18:53:19 -08:00
Elliott Hughes
77f539ab49 Simplify adb LinePrinter newline handling.
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-09 18:42:41 -08:00
Josh Gao
ce8f2cdcd0 adb: make the test_pull_dir test actually test something.
Change-Id: I8b525377557528d5bc70c44d587891fad9f739bd
2015-12-09 14:41:33 -08:00
Josh Gao
191c154832 Move adb tests to system/core/adb.
Change-Id: If240f45817a46d1e055a8e5173ee7191b9d6c8ea
2015-12-09 11:26:11 -08:00