According to this website:

# This is an example of a key layout file for basic system controls,
# such as volume and power keys which are typically implemented as GPIO pins
# the device decodes into key presses.

key 114   VOLUME_DOWN
key 115   VOLUME_UP
key 116   POWER

POWER turns off the display and makes the phone go to sleep. Is there a key layout for just turning off the display (without putting the phone to sleep)? If not, can I create one?

  • Yes, kinda. It is ran in a terminal/adb (root needed for the former, but not for the latter) in a terminal, run 'input keyevent 26' in adb, run 'adb shell input key event 26' (no ' marks for either) – Dan Brown Aug 5 '16 at 21:01
  • @DanB This puts the phone to sleep (locks the device). As I said, I need a key layout for just turning off the display (without putting the phone to sleep). – That's me. Aug 6 '16 at 14:53
  • @TheGameChanger What behaviour are you trying to get? Are you trying to turn off the screen without causing the lock screen to appear when you next turn the screen on? – Ash Aug 6 '16 at 15:18
  • If what @Josh said is what is what you mean, try setting up a tasker profile to display a black screen – Dan Brown Aug 6 '16 at 15:41
  • @Josh No. When I press a button, I'd like to only turn off the display without putting the phone to sleep – That's me. Aug 6 '16 at 15:55

Your Answer

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

Browse other questions tagged or ask your own question.