Screen Timeout Issue

dhj49er

Well-known member
I like to have different screen timeouts for different modes and include a the scree Timeout action with values when the mode changes.
Unfortunately the screen Timeout doesn't change.
I have tried using the system setting with and without using helper, whilst the setting value changes, the actual timeout doesn't change.
I have tried invoking the macro with and without the screen on, it doesn't change the actual screen Timeout.
I am running these macros on an Oppo Find X3 Neo and thought it probably is the Oppo software preventing the change.
However, if I open the macro and run test action, the timeout changes. So I'm not sure it's the Oppo software.
So what is the difference between running the macro from a trigger (which never works) and manually running test action (which always works).
I've checked the system log and it correctly shows the actions executed without error in all the above cases.
Also I have used a simple test macro, that uses date time trigger (with alarm enabled) to one action to set a screen Timeout value, with no constraints.
I have tried running this macro with the screen off, screen on and screen on Macrodroid running with the macro displayed. Trying to see if Macrodroid in the background and foreground influenced the outcome. Unfortunately it didn't.
So I don't know why the action isn't working from a triggered macro.
 

FrameXX

Well-known member
Maybe try restarting your phone. I know it sounds basic, but helps in a lot of situations.
 

dhj49er

Well-known member
Thanks for the suggestion, but I've done quite a few restarts recently and the issue has persisted through all the restarts.
It's not an issue I would do a factory reset, especially as I don't know for sure it's the phones software.
I might try uninstalling Macrodroid, reinstalling and restoring macros from a backup, to see if that makes a difference.
Why it works when manually invoked is the puzzle to me. Surely if it's the phone software blocking the change, it would block all attempts?
 

dsnz

Well-known member
how are you sure that the test action works correctly ?
after pressing "test action" you stop pressing any button , start a watch chronometer and wait until screen blanks ?? or what's exactly the event sequence that makes you think "test action" works ?
 

dhj49er

Well-known member
how are you sure that the test action works correctly ?
after pressing "test action" you stop pressing any button , start a watch chronometer and wait until screen blanks ?? or what's exactly the event sequence that makes you think "test action" works ?
By checking the value of screen timeout in settings and confirming the new value is working by waiting for the screen to turn off and noting how long it took.
So that confirms the test action is working.
 

dsnz

Well-known member
and when the macro runs, the same same setting gets the same value as in "test action" but the screen timeout is not the same as the value !!!
and what's the true screen timeout ?
the previous one ? or the default in your phone settings or some other value ? perhaps some value you recognize ??

what I'm thinking is that because of some bug in sequence of actions your setting is overwritten by some other setting ... (and you don't notice this in log because of the many log messages)

can you tell us this "system setting" so that we try too ?

can you make a very simple macro with just one action setting this timeout value and see what happens ??
if the issue is reproducible with this simple macro, then ..
does the issue happen for any timeout you set ? (13 sec , 22 sec, 25 sec etc) or some specific ones ? experiment with this
 

dhj49er

Well-known member
and when the macro runs, the same same setting gets the same value as in "test action" but the screen timeout is not the same as the value !!!
and what's the true screen timeout ?
the previous one ? or the default in your phone settings or some other value ? perhaps some value you recognize ??

what I'm thinking is that because of some bug in sequence of actions your setting is overwritten by some other setting ... (and you don't notice this in log because of the many log messages)

can you tell us this "system setting" so that we try too ?

can you make a very simple macro with just one action setting this timeout value and see what happens ??
if the issue is reproducible with this simple macro, then ..
does the issue happen for any timeout you set ? (13 sec , 22 sec, 25 sec etc) or some specific ones ? experiment with this
As I have said, I use a simple macro to test it.
Day time trigger
Screen timeout value
That's it.
It happens whichever of the predefined values I select.
I have checked the system log and there are no errors in the log.
The system setting is screen_off_timeout. It's an integer with value in milliseconds, so 30 sec is 30000.
 

dhj49er

Well-known member
Just to make sure I've explained the issue sufficiently, I'll give you an example of a test.
The screen timeout is set to 1 minute, confirmed in the phone settings and system setting screen_off_timeout is set to 60000.
I run my simple test macro (the version that changes the system setting) with a value set to 30000.
The phone setting is still 1 minute and the screen_off_timeout value is 60000 (NOT the 30000 set in the macro). I confirm the actual timeout is 1 minute. So running the macro has not worked
I open the test macro and manually select test the actions. Now the phone setting is 30 seconds and the screen_off_tineout value is 30000. I confirm that the actual timeout has changed from 60 seconds to 30 seconds. This has worked correctly.
So the same action run manually works but executed in a running macro does not work.
 

dhj49er

Well-known member
I can repeat the above test, replacing the system setting action with screen timeout action and get identical results.
 

dsnz

Well-known member
I tested and noticed same behavior as you say !
However when I ran the macro the log shows no action ! It's as if the macro does not run. I think here is the root of the problem. But I need to do more experiments to explain this (which seems to be a bug... at the moment).
 

dhj49er

Well-known member
When I run my test macro, the system log shows the macro has run - see attached screenshot
 

Attachments

  • Screenshot_2021-06-07-19-27-27-04~2.jpg
    Screenshot_2021-06-07-19-27-27-04~2.jpg
    93 KB · Views: 21

Alan Eaton

New member
I have found that the action 'Set Screen Timeout' is not effective unless the screen is both on and unlocked. I do not know about the system variable.
 

dsnz

Well-known member
I made a small mistake
I used an existing macro which I modify for tests but was disabled 😂🤦‍♂️
after I enabled it , the macro works fine !!
and I run my tests with screen on and unlocked as @Alan Eaton said

I will try now with screen off and locked
 

dhj49er

Well-known member
Unfortunately I've tried that and it doesn't work if executed from a running macro.
Also I know set screen timeout has worked with the screen off and phoned locked on previous versions of Macrodroid running on Samsung phone h this was about a month ago, but I don't have the phone to compare.
 

dsnz

Well-known member
I'm sorry to say but the macro works fine for me even with screen off and locked.
Everything is perfect.

So it's tempting to say it must be your phone but why "test action" works ?? Only macrodroiddev can explain I'm afraid ..
 

Pseudocyclic

Well-known member
Might be worth checking to see if the problem occurs when MacroDroid is not the foreground app but does not occur when MacroDroid is the foreground app.
 

Swap_File

New member
When my One Plus 8 Pro was "Upgraded" from Oxygen OS 11 to Oxygen OS 12 (now Color OS based, like Oppo phones), I lost the ability to set my screen timeout via Macrodroid.

The problem of Set Screen Timeout not working might be an Oppo thing.

I haven't yet found a workaround, but I'm continuing to investigate.
 

Swap_File

New member
On Oxygen OS 12 on my OnePlus 8 Pro, I found I must use

Actions - Shell Script - Rooted : "settings put system screen_off_timeout 30000" (Example 30 seconds) to change the screen timeout

Actions - Shell Script - Non-Rooted : Doesn't work.

Actions - Set Screen Time Out : Doesn't work.
 

FrameXX

Well-known member
Try us
On Oxygen OS 12 on my OnePlus 8 Pro, I found I must use

Actions - Shell Script - Rooted : "settings put system screen_off_timeout 30000" (Example 30 seconds) to change the screen timeout

Actions - Shell Script - Non-Rooted : Doesn't work.

Actions - Set Screen Time Out : Doesn't work.

Try using system settings action > system > the same key and value you used in shell action. Also, do you use MacroDroid Helper?
 
Top