Maria Sophia wrote:
> And I needed to take a screenshot of the date and time, but the phone was
> tucked away somewhere (since I mirror onto my Windows monitor at home).
>
> I needed a way to bring the phone to the lock screen w/o touching it.
> adb shell input keyevent 26
>
> That sent a power button event,turning the screen off & locking the phone.
>
> Then, this awoke the phone, which gave me the clock lock screen I needed.
> adb shell input keyevent 224
>
> Voila!
>
> With adb I was able to both lock & unlock the phone for the screenshots.
Also, plenty of apps on the phone will blank the screen, using adb.
# in ladb on the phone
adb shell input keyevent 223
# in Termux, on the phone (pkg install android-tools)
adb pair <phone-ip>:<pair-port>
adb connect <phone-ip>:<port>
adb shell input keyevent 223
.# In Termux, with Shizuku remote interactive shell
rish -c "input keyevent 223".
Or, if a desktop is handy (the phone can be on Wi-Fi or USB).
1. Blank the screen (sleep, no lock)
adb shell input keyevent 223
-> KEYCODE_SLEEP, turns the display off
2. Wake up the screen
adb shell input keyevent 224
-> KEYCODE_WAKEUP
3. Sleep & lock (same as pressing power)
adb shell input keyevent 26
-> KEYCODE_POWER
4. Let it fall asleep on its own over a given time
adb shell settings put system screen_off_timeout 1000
adb shell svc power stayon false
-> short timeout, then normal sleep behavior
--
Every post to Usenet should strive to add value that wasn't there.