How to turn the screen off (no root)

Post your questions and help other users.

Moderator: Martin

Post Reply
Koelle
Posts: 7
Joined: 22 Nov 2015 21:46

How to turn the screen off (no root)

Post by Koelle » 02 Aug 2019 07:12

Hi guys,
I switched phones and decided to go this time without root. However, that gives me issues with my AM flows. E.g. what is the action to turn the screen off?
:oops:

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

Re: How to turn the screen off (no root)

Post by Martin » 05 Aug 2019 14:23

Hi,

Either use action Lock Device or turn the screen timeout temporarily to a short value with action Set Screen Timeout or use action Control UI: lockScreen() (Android 9+).

Regards,
Martin

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: How to turn the screen off (no root)

Post by Desmanto » 05 Aug 2019 16:02

I almost forgot about the lockScreen() feature in Control UI. Yeah, that works fine in Android Pie 9.0, lock the screen and still can unlock using fingerprint
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Koelle
Posts: 7
Joined: 22 Nov 2015 21:46

Re: How to turn the screen off (no root)

Post by Koelle » 06 Aug 2019 12:29

Hi again,
Controul UI / lockScreen() is a brilliant idea. Danke!
Only issue with that is, it triggers a Samsung bug in my S10e. If face recognition is turned on as unlock method, calling this function will turn off the device, but it comes back on half a second later on the lock screen. As I am still looking at it, the phone immediately unlocks again and I'm back where I started. :roll:
With face recognition completely disabled, this does not happen and the phone stays off after calling lockScreen().

IDK what I will do now. Has anybody an idea how I could fight the bug and suppress the immediate re-turn-on by any Automagic magic?

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: How to turn the screen off (no root)

Post by Desmanto » 07 Aug 2019 09:03

Do the face unlock count in as Trust Agents feature from play service? If yes, you can disable the face unlock before lockScreen(), enable it shortly after, maybe 3 seconds later. This will ensure the face unlock feature won't triggered immediately after the lockScreen(). Use action Set Disable Keyguard Features, Trust Agents. Try other option too if trust agents doesn't work.

So the flow should do something like this
- Set Disabled Keyguard Features - Trust Agents
- Control UI - lockScreen()
- Sleep 3 seconds
- Set Disabled Keyguard Features - all unchecked. (enable back the face unlock)
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Koelle
Posts: 7
Joined: 22 Nov 2015 21:46

Re: How to turn the screen off (no root)

Post by Koelle » 07 Aug 2019 09:46

Another good concept. However, it didn't work for me. Tried also to manipulate this in secure settings, but that didn't do the trick either.
For future reference, here is the workaround now working for me:
Installed the Samsung app "One Handed Operation +" which seems to be the only piece of software capable to switch off the device into the exact state I want to have via a swiping gesture. This gesture I can replay in AM with action "Control UI / touchGesture" and it actually does what I want.
8-)

Post Reply