How to lock Android screen via ADB?

后端 未结 8 921
长发绾君心
长发绾君心 2021-01-30 03:20

Is there a way to lock the Android screen via the ADB?

I find ways to lock the display in an apk, but I want to lock the screen from the PC via ADB, to simulate a displ

8条回答
  •  梦如初夏
    2021-01-30 03:49

    In addition to the answers before, here's what I do to lock / unlock my screen using adb:

    adb shell input keyevent 26 will lock the screen.
    So, if you execute that command again, while the screen is turned off / locked, it will be turned on / unlocked.
    adb shell input keyevent 26 will also unlock the screen (if the screen is locked).

    Furthermore, I have also tested all commands, such as adb shell input keyevent number, and found out that adb shell input keyevent 3 also unlock the device.

    I had also found out (by testing) that key 3 is the home button. So , if you have a physical home button (not the soft home button on the screen), you can also use this to unlock your device.

提交回复
热议问题