In setup_mdns_thread mdns_registered should only be set to true
if DNSServiceRegister was successful.
Test: N/A
Change-Id: I8a2798cced91b05b7d8bf5f0df4d16719c581dee
Signed-off-by: Gustav Svensson <gustav.svensson@volvo.corp-partner.google.com>
Once launched, abb will listen for incoming Binder cli requests.
Executing in-process provides 6x latency improvement (125ms vs 25ms on
PixelXL) for commands like 'package path'
Intended usage by Android Studio for fast deployment and patching of APKs.
Test: manual
BUG: 111621042
Change-Id: Ica84eb2ec9628efa441ecd627b119f3361feaf9f
Before overlayfs, we supported deduplicated filesystems by undoing
deduplication in recovery. This required an extra reboot cycle, so we
changed "adb remount" to disable verity and boot to recovery in one
command.
After overlayfs, adb remount is still trying to undo deduplication,
which leads to very confusing messages. This patch makes things a bit
clearer. "adb remount" will disable verity, which installs overlayfs.
"adb remount -R" will do the same except automatically reboot.
Bug: N/A
Test: adb remount on dynamic partitions device
Change-Id: Id72f6b9e2297c2f4d5722d5679f6264fe660e631
Add some services that skip the service fd to see how much of a benefit
it'll be to eliminate it.
Test: adb raw source:$((300 * 1024 * 1024)) | pv > /dev/null
Test: dd if=/dev/zero bs=1M count=100 | pv | adb raw sink:$((100 * 1024 * 1024))
Change-Id: I042f25f85b16ae9869cb1f1e306d8671b024ed97
Regression introduced commit bb1efbd1c6
By not first checking if overlayfs mount on /system is in /proc/mounts
remount fails to discover the override and take the selected action.
Test: adb-remount-test.sh
Bug: 109821005
Change-Id: I1f0bae22caae1bca84fc1e33b508b54d98f4ed5c
This patch addresses two issues with adb remount.
First, the blk_device field in fstab_rec will be incorrect if referring
to a device-mapper node (fs_mgr_update_logical_partition must be
called).
Second, devices that are not system-as-root now move their mount point
and chroot to "/" during first-stage init. However, the fstab entry will
have "/system" as its mount point. The new logic now reflects this.
Bug: N/A
Test: adb remount on hikey or device with dynamic partitions
Change-Id: I48b379db49d2def555ea49888c4994fbcf501672
This should fix the bloody Mac build, which doesn't have <error.h>. Since
we weren't entirely happy with error(3) anyway, switch to the toybox
style of error_exit and perror_exit, which are slightly briefer and quite
a bit more intention-revealing.
Bug: N/A
Test: builds
Change-Id: Ic8e411906c363af51657da5ce947b25a0b6bb1f3
* changes:
adbd: implement a nonblocking USB Connection.
adbd: rename daemon/usb.cpp to daemon/usb_legacy.cpp.
adbd: open functionfs ep0 as O_RDWR.
adbd: extract functionfs fd creation.
Implement a Connection that implements a nonblocking interface to
functionfs, to replace the existing implementation that uses two
threads that loop and call read and write respectively. The existing
implementation is vulnerable to a race condition that can occur when a
connection is terminated, where one thread can notice failure and
complete reinitialization of the USB endpoints before the other thread
noticed anything went wrong, resulting in either the first packet
coming from the other end disappearing in to the void, or the other end
getting a packet of garbage.
As a side benefit, this improves performance on walleye from:
push 100MiB: 10 runs: median 49.48 MiB/s, mean 50.00 MiB/s, stddev: 2.77 MiB/s
pull 100MiB: 10 runs: median 75.82 MiB/s, mean 76.18 MiB/s, stddev: 6.60 MiB/s
to:
push 100MiB: 10 runs: median 73.90 MiB/s, mean 73.51 MiB/s, stddev: 5.26 MiB/s
pull 100MiB: 10 runs: median 105.90 MiB/s, mean 107.19 MiB/s, stddev: 6.10 MiB/s
Test: python test_device.py
Change-Id: I9b77c1057965edfef739ed9736e5d76613adf60a
Let's use LOG(FATAL)/PLOG(FATAL) for actual fatal stuff.
Add a Windows error(3) and move folks who didn't really mean "abort"
fatal over to it. Also get rid of syntax_error which wasn't adding a
lot of value, and most of the places it was adding "usage: " didn't seem
entirely appropriate anyway.
In particular, we seemed to have confused fastdeploy.cpp into aborting
in most user error cases, and none of the reviewers noticed. Clearly
we'd all lost track of far too many options.
(I've also cleaned up a few random instances of fprintf(3) + exit(2).)
Bug: N/A
Test: manual
Change-Id: I3e8440848a24e30d928de9eded505916bc324786
Extract common functionality that will be useful for implementing a
nonblocking Connection for functionfs.
Test: mma
Change-Id: Iae4f3d55b2f56568d4a5138db9a2af5622eb83ad
Inefficient to always update the symlinks to overlayfs, can
also lead to
failed to copy 'xxx' to 'yyy': remote symlink failed: File exists
on older variants of overlayfs that do not effectively mark them
deleted.
Test: manual
Bug: 109821005
Change-Id: If1286d76f45ce14087cdb515fe8d2fed198fd9d8
This reverts commit 04b9ca8c31.
The original incarnation of this patch was falsely triggering when our
poll would block with no activity happening for an extended amount of
time. When the poll returned, we would immediately flag that as a spin
loop. Solve this by tracking the last time we looped, to detect this.
While we're at it, switch from CLOCK_MONOTONIC to CLOCK_BOOTTIME, for
the same reason.
Change-Id: Ibcdf69d93f7b6012142cafd72066f39494c1f84b
Test: ./test_device.py
Currently `adb remount` won't remount symlink mount points.
In Android Generic System Image, there is a symlink
/product -> /system/product for devices with and without a physical
/product partition to work, respectively:
- Mount product partition under /system/product via
'mount /product' OR
- Keep using /product -> /system/product symlink,
when no product partition
Currently find_proc_mount() is seeking "/product" under /proc/mounts.
But the actual mount path is "/system/product" when GSI is used
on a device with product partition.
Bug: 111539442
Test: adb remount && touch /product/abc on both GSI and non-GSI
Change-Id: I8f15a67109d0a3f4ee18596ef7eb4280c5631b11
We can not mount overlayfs on root / as it will intercept all file
transactions. Thus must remount /system instead.
Test: manual
Bug: 109821005
Bug: 115751838
Change-Id: Idf646b8c1ca8a0d006bf64e23a76a7e909f9162a
Add an fstab argument for fs_mgr_overlayfs_mount_all so that it can
leverage the locally and timely acquired fstab entries. Affects all
callers, adb and init.
Test: manual
Bug: 109821005
Bug: 115751838
Change-Id: I96e2045d88525a6ce39bef63327a0fcf0704e9bc
Devices not supporting logical partitions do not require the command.
Bug: 78793464
Test: 'adb reboot fastboot' reboots to bootloader for a device
not supporting logical partitions.
Change-Id: I0a7b6d4335040e24efbf461e2dd2d56ab1985b7f
The system image is now a root image, even on devices that don't use
system-as-root. Fix remount to always remount /, to account for this.
Bug: http://b/115751838
Test: `adb remount; adb shell mount | grep " / "`
Change-Id: I2d89a795bd0bc53af33fe69c9d049bbb64d26f3b
adb verity-on setup overlayfs directories, do not skip if verity
feature not configured for device.
adb verity-off teardown overlayfs directories, do not skip if verity
feature not configured for device.
adb remount setup overlayfs directories and mount if possible, and
do so without a reboot if possible.
Test: compile
Bug: 109821005
Bug: 110985612
Change-Id: I28c4c23fea44b886c5523f0286a523f0b0485df0
Rebooting to these targets requires writing bootloader
messages and thus root. Moving them into init means that
adb, reboot don't need root to use these targets.
Test: try rebooting to these targets
Bug: 78793464
Change-Id: Ia002d1e3b1cb0c0616f60435fb9af4dce162cf84
An accidental side-effect of the change to unique_fd was that we
started closing the reboot service socket before pausing and waiting
for our death. This results in the client immediately returning, which
means they might get a chance to run other commands before we actually
manage to reboot.
Bug: http://b/112104037
Test: adb reboot; adb devices
Change-Id: Id61321da0c08ebd1ab57f1ce926bafd9109dd9c2
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
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
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