When connecting to an address, we construct a transport first, and then
check whether we've already connected to that address. The consequent
destruction of the BlockingConnectionAdapter attempts to join threads
that haven't been started, which aborts.
Make it safe to destruct a BlockingConnectionAdapter without calling
Start on it first, to solve this.
Bug: http://b/69137547
Test: nc -l 12345 & (adb connect localhost:12345; adb connect localhost:12345)
Test: python test_adb.py
Change-Id: I6cb968a62dbac6332907e06575893d764905ee62
* changes:
adb: try harder to fill our test sockets.
adb: don't set has_write_error on success.
adb: move ownership of the fdevent thread into FdeventTest.
adb: guarantee that fdevent_run_on_main_thread happens last.
The argument would set the boot header
version for flash:raw and boot
commands when they are used for boot
image creation.
Bug: 77154616
Test: Dumped the created boot image and checked
the header version using unpack_bootimg
Change-Id: I2c458996817615f4351db102b4234984108d47c0
Merged-In: I2c458996817615f4351db102b4234984108d47c0
(cherry picked from commit 88de5556ec)
On platforms that implement sockets via underlying sockets (e.g. Wine),
a socket can appear to be full, and then become available for writes
again without read being called on the other end. Add a sleep after
each write to give the underlying implementation time to flush.
This doesn't help us if the buffer size is smaller than MAX_PAYLOAD,
but at least in the case of Wine, that doesn't seem to be the case.
Test: adb_test
Test: wine adb_test.exe
Change-Id: Iff1ec14bbf318b9742ec7e2fb72e34e3d6bbe6ad
Previously, each of the tests was spawning the fdevent thread manually,
in order to be able to set up listeners and such before running
fdevent_loop. Now that we have a way to run arbitrary code on the
fdevent thread, switch to having a generic fdevent thread and running
setup code via fdevent_run_on_main_thread.
Test: adb_test
Test: wine adb_test.exe
Change-Id: I517dbcbad31067b45087d9fbed67a75b75a75aec
Make it so that we handle run_on_main_thread calls after regular socket
events, so that we can use it as a way to ensure we've processed all
pending socket events.
Test: adb_test
Test: wine adb_test.exe
Change-Id: Ic215c7fed19a8e1699e759970658b3775aa08c45
Test: Modified Pixel to support and use Speck encryption, booted.
Bug: 77227248
Change-Id: I6ec272db5e4f16e9dd4f759203c14ad2a8772cd1
Merged-In: I6ec272db5e4f16e9dd4f759203c14ad2a8772cd1
Bail out immediately in our poll emulation if we have any invalid file
descriptors, instead of actually calling WSAPoll (which might block
forever).
Test: wine adb_test.exe
Change-Id: I06ccca305783ee7a1721b1585ddf73e022bd02d7
Make it easier to replace the sleep with something that actually waits
for the event loop to quiesce.
Test: adb_test
Change-Id: Iee86b058abbb607256dbfce43d8c70252b6bb0f6
Decoding the DWARF opcodes is expensive so make sure we cache it.
This speeds unwinding in simpleperf by over a factor of 3x.
Add unit tests for this new behavior.
Bug: 77258731
Test: libbacktrace/libunwindstack unit tests on host and target.
Test: Ran debuggerd -b on various processes on target.
Change-Id: Ia516c0fa5d3e5f76746190bb4b6fdf49fd1c9388
This commit adds a wildcard linker namespace link between the "vndk"
namespace and the "sphal" namespace of the system processes. This is
created for VNDK-SP-Ext to load vendor libs in "sphal" namespace.
Bug: 77249955
Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests
Test: lunch aosp_sailfish-userdebug && make -j8 # runs unit tests
Test: Create a VNDK-SP-Ext, link to vendor libs, and run it.
Change-Id: I71b0fb604a84272156aa119130c272f891847008
ro.board.platform and sys.boot_from_charger_mode are already
public-readable, but they should be used as action triggers as well for
some products including Android Go devices.
Bug: 75987246
Test: succeeded building and tested with taimen
Change-Id: I140a8f7ef3fa9823ceced94b00a413800518c240
Fix RegsArm::GetPcAdjustment to check for an invalid elf before trying
to read memory.
Modify the tests for this so it crashes without this change.
Also modify the GetPcAdjustment for all different architectures so
that unless the relative pc is too small, it will return the minimum
amount that should be adjusted. This is to handle cases where we still
want to adjust the pc but it's in an invalid elf. Mostly this is for
handling cases when the pc is in jit gdb debug code so that we use the
right unwind information.
Bug: 77233204
Test: Passes unit tests for libbacktrace/libunwindstack.
Change-Id: Id73609adaf3b80a583584441de228156fec3afa7
Previously, processes started via `adb shell` have an oom_score_adj of
-1000, making them invisible to the oom killer. This makes running a
process that consumes all memory (e.g. by leaking in a loop) lead to
the entire rest of the system (including adbd, because of bad
heuristics in the kernel) being oom killed before getting to it.
Bug: http://b/63143027
Test: `adb shell cat /proc/self/oom_score_adj` with adb root
Change-Id: I59111134e36dc271adf4c1dd4bd4400d4fe6aee0
The script prints out the boot image header
contents and extracts the kernel, ramdisk,
second bootloader and recovery DTBO images.
Bug: 74763691
Test: unpack_bootimg --boot_img $OUT/recovery.img
Change-Id: Iadbca81c157d9e4607f808a14468ab5542347507
For non-A/B devices, the recovery partition should
be self-sufficient and not depend on any other
partition. Since recovery may need access to devices
added to the DT by overlays(for eg.display), we need to
make sure that the the recovery image also contains
the information from the DTBO image.
The following fields are added to the boot image
header for this purpose:
-boot header version
-header size
-recovery dtbo size
-recovery dtbo address
Bug: 74763691
Test: unpack_bootimage --boot_img $OUT/recovery.img
diff out/extracted_dtbo $TOP/device/google/wahoo-kernel/dtbo.img
Change-Id: I1969859038b84fac1e4a71f79f2f546b9cacffc8
The Pixel 2 system images release was a bit of a disaster because anyone
using an old version of fastboot would blindly flash too few partitions,
potentially bricking their device. This change lets us add a line to
the android-info.txt file for a device with a new partition.
Also error out sooner in such cases by checking the requirements
immediately, rather than optimistically unpacking everything first.
Switch Action over to C++ to fix memory issues.
Bug: http://b/77158188 (partition checking)
Bug: http://b/74444116 (error out sooner)
Test: manual testing with a modified android-info.txt
Change-Id: I58b426cad410107e368f35f5725216d07281dd97
Some partners are using ro.debuggable as action trigger to config a
product differently according to its value.
Bug: 75987246
Test: succeeded building and tested taimen
Change-Id: I4cc57e7b52e17fc89e585afa0a8a10925e47fac8
This change lets android::base::ScopeGuard be useful in STL containers
(e.g. std::vector<android::base::ScopeGuard<std::function<void()>>>). It
also provides perfect forwarding for android::base::make_scope_guard.
Bug: 34764308
Test: libbase_test
Change-Id: I7d1e5494b0f0695763cff0700efdb9ec18ae85c8