• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Avoid lock after 10 minutes

encorez

Newbie
Hi

I have a security app on my phone that lock the phone 10 minutes after screen turned off.

I could have an app that constantly have the screen turned on, but that uses a lot of power.

So my solution if possible was to create a Task with Tasker, that 9 minutes after the screen turns off, the phone should wake up, just for a split second, and then turn the screen off again. And then do that again after 9 minutes.

Can that be done?

Thanks in advance for hints and tips for this
 
There is a way, yes, but first I'd like to understand some context.

What kind of security app is it?
If you can't/don't want to uninstall it, can the feature not be switched off from the app?
What kind of lock are we talking about? A PIN that you don't know?
 
My workplace forces my to have MaaS360 installed, which forces me to have a 8 chars password.

My Nexus 5 is not rooted.

So would it be possible to do what I want?
 
Then I discourage using a way of cheating a security feature put together by your company.
Anyway, the final decision is yours and you'd end up finding out how to do it so let's go... and it's a nice challenge...


First you need Secure Settings to be able to wake the device up.

Then create a profile like this:

Profile "Screen Off":
State > Display > Display State > Off

Task "Pulse"
Task > If > %SCREEN ~ off
Task > Wait > 9min (set it to 5s for testing purposes)
Plugin > Secure Settings > Action = Wake Device (from Actions section), Wake Type = Screen & Keyboard Lights on, Duration= Manual - On
Task > Wait > 100ms (too short a duration will not work)
Display > System Lock
Task > End If

Now add an exit Task and reuse "Pulse".
I know, it doesn't make sense to start another "Pulse" when the screen is back on, but the simplest (and only?) way to kill a task is by starting it again.

Which means you need to do one last thing: in the "Pulse" task settings, set the "Collision Handling" to 'Abort Existing Task'. This is also why I've added a check for the display state inside the task itself as well as having the condition in the profile.
 
Hi

Super, thank you very much for the assistance :)

I have now tested it, and it partly works. I think it might just need a little fineturning.

1. After enabling Tasker, and the screen goes out then after the set seconds the screen come back on. But then it keeps the displey turned on??

2. If I then press the power button in order to shut the display off myself, then it also after X seconds turns the screen back on as it should. Then it does out again after X miliseconds, but when I press the power button to turn it on, it has enabled the lock screen already.

Do you see what can be tweaked to make it work?
 
The issue is probably around the 100ms delay. It worked fine on my Nexus 4 but may not on another device (the Nexus 4 didn't like a 40ms delay, for example).

Try with 1s.
Also, try reducing the 9min delay to 8 or 7.
You may also need a 1s delay before testing the value of %SCREEN (I've seen some random issues since, with a similar test on another case). The alternative being setting up the context directly on the value of %SCREEN rather than checking the display state.
 
I have set the timer for 15 seconds til go to standby before standby.

Task "Pulse"
Task > Wait > 1sec
Task > If > %SCREEN ~ off
Task > Wait > 5s
Plugin > Secure Settings > Action = Wake Device (from Actions section), Wake Type = Screen & Keyboard Lights on, Duration= Manual - On
Task > Wait > 1s
Display > System Lock
Task > End If

Restarted phone. It turns the display on as it should, but then the display keeps being turned on. Even when I turn Taske off, the display keeps being turned on.
 
Well that's interesting, when I rewrite the task with a 1s delay, my screen never gets switched off again!

So I tried a few values, then some more...
And it appears that on my Nexus 4, it only works if the delay is between 61ms and 298ms. Any value that I tested outside of this range resulted in a failure (and yes, I tried 299 and 60).

I'm now really curious to find out what the range is for the Nexus 5 (if there's one)!! :D
 
I now tried a delay of 127ms. After the display turns on, the display is locked with keygard.

After I unlock, the screen never get switched off. If I hit the power button, and the screen goes out, and the after 5 seconds it comes back on and doesn't go out again.

So there are 2 different issues, sometimes the screen gets locked, and sometimes the screen doesn't switch off.

There is another way than "Display > System Lock" ?
Something like "Display > off" or something that switches the display off again?
 
I noticed the 1s delay, yes, and I put it in as well.
It appears the delay boundaries I found yesterday may not always be right. I was just showing the feature off to a workmate and obviously, it didn't work... -_-

Do you have a lot of other profiles in Tasker? I wonder if Tasker is doing something else at the same time, creating some delay.

I'm going to test a 1 min delay instead of 5s, to see if I get more reliable results.

Also, switching the display on for a few ms may not be enough to reset MaaS360's counter.
 
I had one other Profile and Task but it was disabled.

But what triggers the screen to NOT turn off?
Even when I deactivate Tasker, the screen doesn't turn off.
So it must trigger something in the system.
 
It's the Secure Settings command, it might override the Display timeout. Maybe we need to change the 'Manual - on' with a timeout?

After an hour of having it running with a 1 min delay between pulses, only once the screen failed to switch back off.

Try resetting the display timeout in your Display settings.
 
I now set the phone setttings to 30 seconds before screen off.

I have tried to set the secure setting to 1 second instead of manual. So when testing that the display went back on and were on for 30 seconds, went out and came back on. So a small improvement from earlier.
But now while wrtting it has locked the phone :)
 
What about setting the Secure Setting plug in to "CPU awake only"?
In which case you can probably comment out the subsequent Wait and System Lock commands.

Because the screen won't have been on, the profile won't be disabled then reenabled, so the task won't run more than once, so just before the end of the End loop, you need to add a loop back to line 1.

I can't test that because I can't tell if it's going to prevent MaaS360 from locking the phone. And you'll need to let 10 then 20 minutes run to check if this suggestion works (10 min to check the "CPU awake" works and 20 min to check the loop works).
 
So I try this

Task "Pulse"
Task > Wait > 1sec
Task > If > %SCREEN ~ off
Task > Wait > 30s
Plugin > Secure Settings > Action = Wake Device (from Actions section), Wake Type = CPU Awake only 1 second
Goto ->Top of Loop
Task > End If

How about the Exit task? and the Collision Handling?

Thanks :)
 
Hi again.
I have tried this out and it doesn't seem to work. The KeyGuard appears after the X minutes I set it to (tried 5 and 10 minutes).

So perhaps CPU awake is not enough for the phone to "feel" active
 
Guess so.

What's annoying is that on another device (Galaxy Nexus S), the following works so perfectly fine:

Profile:
Display State > off

Task:
1. If %SCREEN ~ off
2. Wait 10s
3. Secure Settings > Wake Device > S & K L On - 1 second
4. Goto 1
5. End If

with no exit task



As for "Manual - On", what it does is the equivalent of the 'Keep awake' toggle available in Power Toggles.
Source: my toggle was switched on. EDIT: no, maybe not... I'm confused...

Still looking...
 
Hehe

This works partly. It awakes the phone after 10 seconds, and then the screen goes after af X seconds, set in the phone. And then all over again.

That probably works, but would very much prefer that the phone does not have to turn on for 15-30 seconds every 10 mins.

Somehow I would like the phone to turn on and back off 1 ms later. I know that's possible not possible but then what close to that.

It the night my wife would not appreciate the phone lights up every 10 minutes :)
 
I've been lacking time to sit down and have a good think about it.
But I'm also less hopeful about finding a solution. It looks like as Android versions go by, these settings are less and less reliable. The fact that behaviours change depending on the device doesn't...

HANG ON!

Did you just say it works?
All we have to do is change the Display timeout. The minimum is 7 seconds (at least on my phone) so it's not perfect but it's better than 15 or 30. And you can add an exit task that will restore the Display timeout to 1 min or whichever value you usually use.
 
I have tried the 7 seconds, but it doesn't seem to work. The screen is on for 30 seconds even with a 7 sec timeout.

Is this "Screen on" in security plugin the ONLY way to to reset the activity-timer? We tried the CPU awake, but isn't anything else that can manipulate the phone to think "I'm" active?
 
Back
Top Bottom