Previously with Android 4.1, doing something like:

adb shell input keyevent 82  

would unlock the screen at first boot and would then allow further commands to launch applications and have them displayed on the screen, etc.

With 4.2, within 10s of boot, the lockscreen dims to black. Issuing the same ADB command no longer works and the screen remains blank.

If I manually press the menu key, this brings the screen back on, and I can then issue the keyevent to unlock the screen.

Any ideas how I can bring the display back up from ADB and unlock the screen from there?


  • There is a list of keyevents here and here, if anyone needs it for reference... – Wilf Jan 9 '14 at 23:44

If you are on 4.2.2, you might want to read e.g. ADB Whitelist As of the Android 4.2.2: Starting with this Android version, "remote devices" (i.e. those you run ADB commands from) must be authorized by the Android device (i.e. the one those commands are runnin on) -- so your Android device can tell "trusted callers" from "malicious attackers". You can also find this in detail on this article on AndroidPolice:

The way it works is pretty simple - when you connect your PC to your Android device via USB, Android gets your PC's RSA key (an identifier token). In Android 4.2.2, when you have USB debugging enabled, this now causes a prompt to appear on connection, seen below.

Authorization Prompt
(image source: AndroidPolice)

Update from the comments below:

Additionally, as Shurane pointed out, behavior of adb keyevent seems to have changed with Android 4.2.2: while before adb keyevent 26 was a dedicated "screen-off", and adb shell input keyevent 82 a dedicated "screen-on" switch, now adb keyevent 26 is a toggle which turns the screen off (when it's on) and on (when it's off), as noted by Pepelac.

| improve this answer | |
  • Even after adb whitelisting, sending a keyevent in 4.2.2 doesn't work the same way. – Ehtesh Choudhury Apr 26 '13 at 20:21
  • Your comment suggests it works in a different way then. Do you mind to elaborate a little more? Might even be worth a separate answer. – Izzy Apr 26 '13 at 20:25
  • Well, adb shell input keyevent 26 turns the screen off and adb shell input keyevent 82 turns the screen back on, right? But for 4.2.2, only keyevent 26 seems to work. keyevent 82 doesn't work for whatever reason. – Ehtesh Choudhury Apr 26 '13 at 20:37
  • I see. Not having a 4.2+ device, I cannot check myself -- but maybe somebody else has some hints on that. – Izzy Apr 26 '13 at 20:41
  • 4
    @Shurane adb shell input keyevent 26 turns it off/on – Laser May 6 '13 at 12:31

The trick is in 4.4.x and/or other systems you have to send an Enter after the command or else you have to wait x sec/min.

So do it like:

adb shell

@shell: input keyevent 26


@shell: exit

This will work in any case, I think.

| improve this answer | |
  • worked for me on Android 4.1.1 (screen refuses to turn on w power button) – Neil McGuigan Oct 25 '15 at 21:17

Set the device in "no lock" mode in security settings (lock settings in some android versions) so that after reboot the OS goes straight to the home screen.

You can then send any key event, best an unrecognised one so it's not handled by the default handler, to wake up the screen.

EDIT: This works fine on 4.1. I checked on 4.4 and events other than 26 do not work when the screen is off. This is I guess because there is another separate device now defined for the power button and the other ones might be inactive. So you have to check if the screen is off (dumpsys power, look for mScreenOn) and if off send 26. You have to do the check to prevent switching it off while it's on. This will work on all Android versions.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.