Turn Screen On is not working

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
regissg
Posts: 22
Joined: 23 Apr 2018 13:13

Turn Screen On is not working

Post by regissg » 05 Dec 2018 16:44

I have a widget showing a full screen clock.

I want to show this widget when the tablet is going to standby

My flow is as followed:

Trigger: Display State Off
Action: Turn Screen On
Action: Show custom widget Clock

The screen does not turn on when the tablet is going to standby even though the flow is executed (the clock is visible when I exit standby by pressing the home or power key). Any idea why?

I have tried to add a sleep delay before the Turn Screen On action but it does not help.

I am using an un-rooted Samsung Galaxy Tab S2 with Automagic V 1.36.0

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

Re: Turn Screen On is not working

Post by Martin » 07 Dec 2018 20:57

That's strange. This action uses an official API and should be supported on all devices. Maybe it's simply not properly supported on this device. What Android version are you using?
Are you using any apps that could prevent wake locks from working (usually requires a rooted device)?

Maybe as a workaround you could use action Input Dialog with option Turn screen on and maybe with option Show when locked and a short timeout to see if this could work.

Regards,
Martin

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

Re: Turn Screen On is not working

Post by Desmanto » 09 Dec 2018 17:34

Try to make sure you have granted Automagic the device administrator permission. It is related to lock security, but probably somehow the ROM need it.
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.

docb
Posts: 3
Joined: 09 Jan 2018 08:25

Re: Turn Screen On is not working

Post by docb » 06 Sep 2019 18:10

Hi, sorry to bring up this old topic, but I have the same issue. It worked all the time but i think it was the Oreo 8.1 update which damaged that.
I have all rights set and your workaround with InputDialog works - but does not look so cool when having a dialog on the screen for a second for no reason ;-) (although I put the timeout on 101ms, the diaolog is shown for about 1 sek.
Is there any other more "not visible" workaround?
Best

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

Re: Turn Screen On is not working

Post by Desmanto » 07 Sep 2019 04:23

What is your phone model and ROM type? You need to try to grant device admin. Check the notification permission too, make sure all are granted.

Do you have root? If yes, then you can try action Execute root Command : input keyevent WAKEUP
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.

docb
Posts: 3
Joined: 09 Jan 2018 08:25

Re: Turn Screen On is not working

Post by docb » 07 Sep 2019 06:46

I have a Samsung Galaxy Tab A (2016) SM-T580 with Android 8.1.0 Original Rom (M1AJQ.T580XXXU4CSA1) and Automagic has all permissions. Unfortunately no root.
And my second device Samsung Galaxy Tab A SM-T555 with Android 7.1.1 Original Rom

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

Re: Turn Screen On is not working

Post by Desmanto » 07 Sep 2019 14:45

So the Oreo one have problem but the nougat one has no problem with the turn screen on?

It can be limitation on samsung ROM. Maybe there is additional setting deep down somewhere that can be toggled to solve it. But you have to try to find it. Maybe looking at the developer option.

The other workaround beside timeout, is to use no timeout at all (or you can just leave it there). Add another control UI parallel to the input dialog, so they executed at the same time (both input dialog and CUI connected directly to the same previous element). Depends on your input dialog type, it can have cancel button or not. Just use Single Choice, then use this CUI script.

Code: Select all

timer = 0;
while(!existsElementById("android:id/button2") AND sleep(50) AND timer <= 3000)
  timer = timer + 50;

clickById("android:id/button2");
When the input dialog executed, the CUI will be executed at the same time. It sleeps for 50 ms in loop, waiting for the dialog to appear and then click the cancel button. It should be much faster than using timeout. But you still can spot the blink of the input dialog, it is just much faster only. Accessibility services must be enabled for Automagic.

This is my latest method to wait loop for certain element. It consist elementId checking (for the element we are waiting); sleep(), which always return true and another timer to make sure it doesn't loop forever (10000 loop).
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.

docb
Posts: 3
Joined: 09 Jan 2018 08:25

Re: Turn Screen On is not working

Post by docb » 07 Sep 2019 19:07

Thansks for all the help. I just rooted both. Now the T580 is working fine, unfortunately the T555 still does not want.
Did i get your trick right - cause that does not work either:
Execute root commandline - and as a command i put: input keyevent WAKEUP

Ha - Forget it - it works - the I of input was a capital letter. Perfect, this way I get it working!
Thank you so much!

Post Reply