Display OFF via SurfaceControl

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
User avatar
Bluscre
Posts: 145
Joined: 31 Aug 2017 13:58
Location: Germany
Contact:

Display OFF via SurfaceControl

Post by Bluscre » 14 Aug 2019 01:44

There is a display ON action but none for turning the display off

https://android.googlesource.com/platfo ... ol.java#82

Code: Select all

SurfaceControl.setDisplayPowerMode(SurfaceControl.POWER_MODE_OFF)
Unofficial AutoMagic Telegram Group: https://t.me/automagicforandroid
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Display OFF via SurfaceControl

Post by Martin » 15 Aug 2019 19:13

Unfortunately this method is not white listed by Google so it can not even be called with reflection in an action Script.
Best option is to use either action Lock Device, Control UI: lockScreen() or on a rooted device simulate a press of the power button in Execute Root Command: input keyevent 26.

Regards,
Martin

Locked