Display OFF via SurfaceControl

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

Moderator: Martin

Post Reply
User avatar
Bluscre
Posts: 121
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: http://t.me/automagic4android
Check out my other flows here: https://github.com/Bluscream/AutoMagicFlows or here.
Sent from my Lenovo TAB 2 A10-70L running Android 6.0.

User avatar
Martin
Posts: 4345
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

Post Reply