Commit Graph

39212 Commits

Author SHA1 Message Date
Tomasz Wasilczyk 081b710b2e Merge "Remove unused logging symbols." 2018-08-01 16:37:38 +00:00
Treehugger Robot 52126a414b Merge "adb: win32: fix Unicode console output" 2018-08-01 05:25:09 +00:00
Treehugger Robot 24f9fc7fee Merge changes Ib55d304d,I6fa078ea,I18e9213d,Ife58f0aa,Iccc55557
* changes:
  adb: disable ReconnectHandler in adbd.
  adb: fix error message for `adb {forward,reverse}`
  adb: more immediately try to reconnect connections.
  adb: don't pass time_point::max to condition_variable::wait_until.
  adb: move list-forward, kill-forward back into handle_forward_request.
2018-08-01 04:19:16 +00:00
Treehugger Robot 8b8d7d67f2 Merge "Add product-services.img for `fastboot flashall`." 2018-08-01 02:00:40 +00:00
Josh Gao def91c0abf adb: disable ReconnectHandler in adbd.
Previously, when a TCP connection was disconnected from adbd, we were
registering it with ReconnectHandler, which led to the transport
sticking around after the socket was closed. Due to the naming of
TCP transports in adbd (host-<fd number>), this results in incoming
connections being immediately closed if their file descriptor number
ends up being the same as a TCP transport that had previously
disconnected.

Guard all of the reconnect logic with ADB_HOST, to fix this.

Bug: http://b/112054041
Test: while true; do adb connect <device>; adb connect <device>; adb shell true; done
Change-Id: Ib55d304d7e07d6d744e8321d34671bb6d4b91afe
2018-07-31 18:28:32 -07:00
Tomasz Wasilczyk 3b70eedfa0 Remove unused logging symbols.
Bug: 35361699
Test: flash sailfish, it boots
Change-Id: Ie545145789faa299e1228b6c91566e0767f7ea79
2018-07-31 16:33:38 -07:00
Dario Freni c7ea1afe90 Add product-services.img for `fastboot flashall`.
This CL is largely and adaptation of
Ifd119650dd3316508870df0dfc770099e95ae1d1

Bug: 80741439
Test: Successfully built product-services.img with one module in it, and
flashed on device. Also successfully built image with
/system/product-services and no dedicated /product-services partition.

Change-Id: I204a831e052d018018ab124d70ad1ff1610ee007
2018-08-01 00:08:52 +01:00
Josh Gao 258d4a91c9 adb: fix error message for `adb {forward,reverse}`
Test: `adb reverse`
Change-Id: I6fa078ea7a0e019df5c6309df99ffdf2a3219194
2018-07-31 15:57:52 -07:00
Josh Gao e445a6d8a2 adb: more immediately try to reconnect connections.
Most disconnects we're likely to encounter are cases where either we
notice immediately and can start reconnecting almost immediately (adbd
restarting because of `adb root`, etc.), or where we won't notice for a
while anyway, so a 10 second sleep is somewhat meaningless.

Test: adb root; time adb wait-for-device shell
Change-Id: I18e9213dc4e84d735e9240118a368dcb38f21c78
2018-07-31 15:57:49 -07:00
Josh Gao 95af641bd6 adb: don't pass time_point::max to condition_variable::wait_until.
libstdc++ implements wait_until by calculating the offset between its
default clock and the clock that it's given by calling now() on each
and subtracting, and then adds that offset to the time_point argument.
When time_point::max is used, this overflows, resulting in the
reconnection thread spinning.

Test: wine adb.exe server nodaemon
Change-Id: Ife58f0aad14bc44c0804483d3ff2351c28b3d576
2018-07-31 15:56:31 -07:00
Josh Gao 1906243017 adb: move list-forward, kill-forward back into handle_forward_request.
The daemon-side reverse functions depended on handle_forward_request:
move them back instead of duplicating the logic we had in
handle_host_request. Accomplish what we originally wanted to do in this
change by changing the transport argument of handle_forward_request to a
std::function that acquires a transport, either via
acquire_one_transport or immediately returning a value that we already
have.

As a side effect, fix a bug where we would emit spurious errors for host
service requests.

Bug: http://b/112009742
Test: echo "001chost:connect:127.0.0.1:5555" | nc localhost 5037
Test: python test_device.py
Test: python test_adb.py
Change-Id: Iccc555575df6dbd7de10382854c4ea2c6f4beeaa
2018-07-31 15:36:55 -07:00
Treehugger Robot 4c87c1743e Merge "adb: Correctly detect deduplicated ext4 partitions." 2018-07-31 16:20:02 +00:00
Spencer Low 771ba0c057 adb: win32: fix Unicode console output
commandline.cpp includes commandline.h which defines
StandardStreamsCallbackInterface which calls fwrite(). In the
compilation unit for commandline.cpp, fwrite is getting remapped to
adb_fwrite (good), but the compilation unit for bugreport.cpp includes
sysdeps.h pretty late, which prevents fwrite from getting remapped to
adb_fwrite.

Apparently when linking, the version of StandardStreamsCallbackInterface
that gets used is the one from bugreport.cpp's compilation unit, which
doesn't call adb_fwrite().

And it's necessary to call adb_fwrite() to get Unicode console output on
Windows.

The fix is to #include "sysdeps.h" earlier in bugreport.cpp. I searched
the other object files for other unremapped calls to printf/fwrite/etc.
and didn't find any.

Bug: https://issuetracker.google.com/issues/111972753
Test: mma, manual test on Windows 10 x64

Change-Id: I322dff75a878397f5e10227e746e77b0024129d0
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2018-07-30 19:53:23 -07:00
Treehugger Robot d0d7d0a6b9 Merge "fastboot: Fix hang when sparse images end in small chunks." 2018-07-30 23:40:36 +00:00
Treehugger Robot f2878cf15b Merge "Make /acct have 0555 permissions after mounting" 2018-07-30 23:37:59 +00:00
David Anderson 6dc508671b adb: Correctly detect deduplicated ext4 partitions.
The fs_has_shared_blocks function had two problems. One, it called
statfs() on the mount point, which will return information about the
file system the mount point is on, rather than the filesystem mounted at
that location. Second, the check for EXT4_SUPER_MAGIC was inverted.

Bug: N/A
Test: adb remount -R works on an ext4 deduplicated device
Change-Id: I2e5ef895ea274cb7cc3c35295120da90a026d0d2
2018-07-30 16:08:29 -07:00
David Anderson 0c7bde8de6 fastboot: Fix hang when sparse images end in small chunks.
When host fastboot sends sparse blocks to the device, it tries to only
send blocks in multiples of 1024 bytes. If a block is not aligned to this
size, the excess bytes are prepended to the next write operation. This
is implemented by doing the write in two steps: first the previous
excess from the last write (plus new data up to alignment), then a
second write for the aligned remainder of the new data.

This logic has a bug if the final block plus the previous excess data
contains >= 1024 but < 2048 bytes. In this case the first write will
drain 1024 bytes from the data, and the second write will not have 1024
bytes to write. Instead of retaining this data for the next write, it
tries to write 0 chunks (and thus 0 bytes), which hangs the ioctl() call.

Bug: N/A
Test: "fastboot flash super super.img" where super.img is generated by
      lpmake, containing system and product_services partitions and
      images.

Change-Id: I9e8523c976ec84d5a57b36a28f4b1ca800edb7e7
2018-07-30 14:48:13 -07:00
Luis Hector Chavez 0451fd6584 Make /acct have 0555 permissions after mounting
This change adds a `chmod 0555 /acct` just after mounting the cgroup fs
on it. This makes it such that even on systems where the rootdir+system
partitions are shared, the permissions allow for the system user to open
files within /acct, which in turn makes libprocessgroup not complain
that it can never do anything with those files.

Bug: 111996377
Test: adb shell 'ls -ldZ /acct'  # Before and after, on an aosp_sailfish
      dr-xr-xr-x 48 root root u:object_r:cgroup:s0 0 1971-12-29 17:41 /acct

Change-Id: Iee6531126c6e81aa7794e44500555bd3c1cdf7b8
2018-07-30 13:06:46 -07:00
Tao Bao bc31fc62ce Merge "charger: minui error handling fixups" 2018-07-30 17:32:32 +00:00
Treehugger Robot d5f825c78b Merge "BOARD_USES_PRODUCT_SERVICES_IMAGE => BOARD_USES_PRODUCT_SERVICESIMAGE" 2018-07-30 16:20:08 +00:00
Todd Poynor e5d1b62300 charger: minui error handling fixups
Log an error if minui init fails, and avoid subsequent calls to minui
in this case (which are likely to crash).

Warn if no system text font available.  This is now expected on most
devices, and the fallback text is not expected to be needed, but just
in case.

Avoid the attempt to print text if no system font available, log
warnings instead.

Bug: 80249440
Test: manual: charger mode with no system font
Change-Id: Ib0c761d37e41a893b2a192438eebcf48c4827049
Merged-In: Ib0c761d37e41a893b2a192438eebcf48c4827049
(cherry picked from commit 8211515fbe)
2018-07-30 08:45:52 -07:00
Treehugger Robot a8dcef2012 Merge "healthd_mode_charger: unblank the screen only on first frame" 2018-07-30 10:46:15 +00:00
Thierry Strudel 2cbe2c7b29 healthd_mode_charger: unblank the screen only on first frame
Original code is unblank screen for all frames of the first
cycle, unblank is needed only before the first frame of the
first cycle.

Bug: 74771887
Change-Id: I51d8390e359335a0b1cb127b096db1a8b889b169
Signed-off-by: Thierry Strudel <tstrudel@google.com>
2018-07-30 00:18:06 -07:00
Treehugger Robot 2756339c77 Merge "liblp: Allow building liblp as a shared library." 2018-07-28 22:52:23 +00:00
David Anderson f792e4163d liblp: Allow building liblp as a shared library.
Bug: 79173901
Test: system image, partition_tools both build
Change-Id: I70f45d4cebfbddc39d03aa3fb3a56b6c48a20d7e
2018-07-27 19:34:56 -07:00
Treehugger Robot f6b823141e Merge "init: Cleanly shut down subcontext processes" 2018-07-28 02:30:22 +00:00
Treehugger Robot d81c4f07fb Merge "adbd: fix check of `remount -R`." 2018-07-28 01:00:36 +00:00
Treehugger Robot 44c2010d47 Merge "NDK: add availability comments to <sync.h>." 2018-07-28 00:16:22 +00:00
Josh Gao 1ba2e6a27f Merge "adb: split daemon services out of service_to_fd." 2018-07-27 23:17:18 +00:00
Josh Gao 2712192e12 adbd: fix check of `remount -R`.
The check was accidentally flipped when refactoring from strcmp to
std::string::operator==, inverting the behavior of `remount -R`.

Test: `adb remount` with verity enabled
Change-Id: Ib43889f1f4cc2f8fe1fd5d6e17e47d538dbe91bd
2018-07-27 16:08:56 -07:00
Elliott Hughes d1c5c5baaa NDK: add availability comments to <sync.h>.
Bug: N/A
Test: N/A
Change-Id: I0cc16cc9c32c6679098aa875d5f81829215868d4
2018-07-27 15:13:33 -07:00
Treehugger Robot 0937a84521 Merge "Move recovery to /system/bin" 2018-07-27 20:25:53 +00:00
Treehugger Robot c1dabd8f76 Merge "adb: use WriteFdExactly when no format" 2018-07-27 20:06:32 +00:00
Treehugger Robot fe732d108b Merge "Restore tcpdump." 2018-07-27 18:54:35 +00:00
Luis Hector Chavez 92c49bcb30 init: Cleanly shut down subcontext processes
This change adds an explicit cleanup for the subcontext processes and
avoids them from respawning, which causes a bunch of LOG(FATAL)s when
the system is going down.

Bug: 80425914
Test: kill -TERM $INIT_PID, no crashes for subcontext inits

Change-Id: I135191d959c1dd921b102af316b24d2bc161d6c9
2018-07-27 11:19:44 -07:00
Yifan Hong bcdfe0d795 BOARD_USES_PRODUCT_SERVICES_IMAGE => BOARD_USES_PRODUCT_SERVICESIMAGE
This is the name used by envsetup.sh.

Test: `m init.environ.rc` and see directory
$OUT/root/product-services and see symlink $OUT/system/product-services

Change-Id: Ie615b6d76e2c60e6472900c33d9a87cfe99c4064
2018-07-27 11:14:43 -07:00
Mark Salyzyn c29bf192b5 adb: use WriteFdExactly when no format
Minor cleanup

Test: compile
Bug: 109821005
Bug: 110985612
Change-Id: I15e33a9136675afe7a9498516301ad4960ad2a82
2018-07-27 10:53:54 -07:00
Treehugger Robot 18be1e2f7e Merge "Add support for /product-services partition." 2018-07-27 17:15:05 +00:00
Elliott Hughes 887133101c Restore tcpdump.
tcpdump accidentally fell off the device when its Android.mk was converted
to Android.bp.

Bug: http://b/111654811
Test: builds
Change-Id: Ia49a6722b47c9017b6e573cb88f7a93f3d95db5d
2018-07-27 09:31:01 -07:00
Elliott Hughes 78f5431ff1 Merge "Revert "Switch to PCRE grep."" 2018-07-27 15:06:58 +00:00
Treehugger Robot ff01e54285 Merge "Suppress gnu-zero-variadic-macro-arguments warning." 2018-07-26 23:22:44 +00:00
Elliott Hughes f9408d5cdf Revert "Switch to PCRE grep."
This reverts commit 90a018a87a.

Not a clean revert because things have changed slightly, and I'm sticking
with the egrep/fgrep shell scripts for now.

Bug: http://b/111849261
Bug: https://bugs.exim.org/show_bug.cgi?id=2294
Test: manual
Change-Id: I72ae637c84f0eb1c2b5291db73ebff1628d54110
2018-07-26 14:52:45 -07:00
Tom Cherry 8b25b87074 Merge "ueventd: Add dynamic kernel module loading" 2018-07-26 21:40:36 +00:00
Chih-Hung Hsieh cd3965e425 Suppress gnu-zero-variadic-macro-arguments warning.
Bug: 111614304
Test: make with WITH_TIDY=1
Change-Id: I2a52073202f42d1912363ae864f2f7f892589cea
2018-07-26 14:33:12 -07:00
Treehugger Robot 46f281edf5 Merge changes Ic90fac0b,Id9c12303,I2d9bdcb1,I9d699af1,Ia4d03f9e, ...
* changes:
  adbd: turn on fdsan warnings.
  adb: add error-generating overload of adb_close(unique_fd).
  adb: fix register_socket_transport related double-closes.
  adb: fix double close in local_connect_arbitrary_ports.
  adb: use adb's unique_fd instead of android::base.
  adb: move remount_service.h into daemon.
  adb: split shell_service.h into client/daemon/protocol parts.
  adb: split file_sync_service.h into client and daemon parts.
2018-07-26 20:10:04 +00:00
Christopher Ferris d1a1202eb7 Merge "Create lookup table of DEX symbols." 2018-07-26 20:01:15 +00:00
Chris Fries d6f97d67e0 Merge "Add support for fastboot transport timeouts and USB Reset() on linux" 2018-07-26 19:52:59 +00:00
Dario Freni 3613710099 Add support for /product-services partition.
This CL is largely and adaptation of
Ie996def20e25dc1afe0c74af2096af844934b2dc

Bug: 80741439
Test: Successfully built product-services.img with one module in it, and
flashed on device. Also successfully built image with
/system/product-services and no dedicated /product-services partition.

Change-Id: I1046dfe19bf874da929c9131b76a1f85422fbb80
Merged-In: I1046dfe19bf874da929c9131b76a1f85422fbb80
2018-07-26 16:27:28 +00:00
Aaron Wisner acf78d462f Add support for fastboot transport timeouts and USB Reset() on linux
USB Reset() allows simulating unplugging and replugging device.

Test: build and run fastboot on mac 10.13.3
Test: glinux build and run fastboot
Change-Id: Id924d063e549a4cca9dda03afd8f8fe266f6d2ab
2018-07-26 11:19:44 -05:00
Andrew F. Davis 9963847419 ueventd: Add dynamic kernel module loading
For some platforms it is not known at build time what devices
will be attached at runtime. Building into the kernel or pre-loading
at init all the modules that could be needed would unnecessary bloat
the kernel. The solution is dynamic kernel module loading.

The kernel will generate uevents when devices are added, userspace
should monitor for these events and load the compatible modules.

The init process already monitors for uevents, add here the ability
to respond to modalias events and preform the correct action.

Adding this to init is preferred over an external program as we
can read and process the module alias and dependency files once,
instead of for each module needing to be loaded.

Test: Run on Beagle-X15, check all needed modules are loaded (lsmod)
Change-Id: I1b57d9aeb0a9770f309207183dc4bc2b7b905f14
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
2018-07-26 09:42:22 -05:00