[Magisk] pndwal:
Well you made me go back and check this stuff!:

Seems adb.reboot.recovery is a thing, but no adb.boot.recovery afaics...

So this may be a moot point:

But if such a command were available I now believe you may have been right. 😜

Well it does detect when a user continues to hold 'volume key up' in particular "to toggle whether system-as-root mode" (boots SAR via magiskinit in recovery ramdisk) "is enabled", so release is implicit... The 10ms checks of test_bit KEY_VOLUMEUP are for 3s, and if still detected after this count of 300, button is deemed not released and "system-as-root mode is disabled" and "magiskinit will boot with ramdisk" (ie 'hijacking' is bypassed) "instead of cloning rootfs from system, which in this case will boot to the recovery."

I don't see that Magisk needing to 'wake up' enters into the mechanics of this...

Here's the early commits for recovery mode support you can check, but just the notes should help here:

Support recovery based Magisk …

Some devices (mainly new Samsung phones we're talking here...) using A only system-as-root refuse to load ramdisk when booted with boot no matter what we do. With many A only system-as-root devices, even though their boot image is kernel only, we can still be able to add a ramdisk section into the image and force the kernel to use it as rootfs. However the bootloader on devices like the S10 simply does not load anything within boot image into memory other than the kernel. This gives as the only option is to install Magisk on the recovery partition. This commits adds proper support for these kind of scenarios.

topjohnwu committed on 30 Mar 2019

Reboot to recovery when running as recovery

topjohnwu committed on 30 Mar 2019

So this fixes reboot system actually by adding RECOVERY_MODE: exec_command_sync("/system/bin/reboot", "recovery") to boot system w/ Magisk instead of standard system... Makes me wonder about what actual 'Reboot to Recovery' will do... 🤔

Boot to recovery if volume up key is held …

Forseeing the future that more and more A only system-as-root devices would have similar bootloader behavior as the latest Samsung devices (that is, no ramdisk will be loaded into memory when booting from the boot partition), a solution/workaround has to be made when Magisk is installed to the recovery partition, making custom recoveries unable to co-exist with Magisk.

This commit allows magiskinit to read input device events from the kernel to detect when a user holds volume key up to toggle whether system-as-root mode is enabled. When system-as-root mode is disabled, magiskinit will boot with ramdisk instead of cloning rootfs from system, which in this case will boot to the recovery.

topjohnwu committed on 1 Apr 2019

(Some thought it was April fools joke!... It's not.)... 10ms checks of test_bit KEY_VOLUMEUP continue for 3s, for a count of 300 before "system-as-root mode is disabled"...

Track all input devices with KEY_VOLUMEUP …

This should in theory should support more devices for detecting the volume up press on boot.

Close #1346

topjohnwu committed on 22 Apr 2019

Proper fix for Galaxy S10 etc

2019.3.28 Magisk v19.0 had initial support...

2019.5.1 Magisk v19.1 fixed many issues...

... So I thought erroneously that an early key release actually Enabled Magiskinit booting system w/ Magisk, but in fact it seems that the hijacking of recovery means this will occur by default and a late release actually disables this, ie. SAR mode w/ Magisk bypass is triggered allowing recovery to boot... 🤪

I'm still not sure (less now) of the effect of reboot menu items on these devices, or whether Reboot to recovery etc from normally booted system (no root) actually has a different effect...

Sorry for delaying with this reply, but I've had a few long (10 hr) days on roofs and shelved it... 😆 PW