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

Delayed Lock Screen

Jsin44

Lurker
Hello. I want to set up Tasker so that it activates my lock screen after a certain amount of inactivity and after turning the phone on in case it is lost or stolen, but I'm having a couple of issues.

Here's what I want it to do:
Activate a PIN if the screen has been off for 45 minutes.
Activate a PIN when the phone is turned on.

Here's what I have:
Profile: Display State Off => Task "Delay Lock" (Wait - 45 minute, Secure Settings - Configuration Set PIN)
=> Exit Task "Don't Lock" (Stop - Task "Delay Lock")
Profile: Device Boot => Task "Lock" (Secure Settings - Configuration Set PIN)

What I'd like to fix:
The phone basically just seems to lock every 45 minutes, so I assume that the exit task isn't doing what I want it to. It still does the job but is a little annoying.
The PIN lock take a little while to engage after system boot which leaves my phone vulnerable for able 30 seconds. Is there a better way to do this?
Also, is there a way to deactivate the PIN (Secure Settings - Configuration Clear Password) when the PIN is successfully entered? That would save me a step after each inactivity lock.

Any help would be appreciated. Thanks.
 
Your profiles are logical… I'm not sure why they haven’t worked. I haven’t ever used stop task for one task to stop another task before… I’d read the help on the stop command if I were trying to figure out why your’s doesn’t work. There was something in there about priority of tasks that I didn't understand. Also you might try setting your task properties to "keep device awake".

I do have a set of three profiles that exactly recreate the typica screenl timeout-lock a certain period after screen off (but the lock is cancelled if you turn the screen back on before the lock timer times out). Have been using it for over a year, works perfectly. (Works the same as the stock, but on Samsung the stock lockscreen forces slide to unlock every time you turn your phone on, regardless of whether the keyguard pin timeout engaged.... that's a lot of wasted effort to have to slide every time you turn on your screen ....Grrrr...so I had to do it myself)

Discussion of my profiles (which appear at the end)

The Screen Off profile and Screen On profile tasks have a similar structure:

A1 - They both set a global variable %TimerEntry to a certain value. This global variable is used as a flag/parameter for the task called in A2...

A2 - Then they both call the same timer task: S4KgTimer...
The called task: S4KgTimer (stands for galaxy S4 KeyGuard Timer) figures out which profile called it (by the examining the value of that global variable %TimerEntry), and then acts a little differently depending on which profile called it:

If the screen off profile called it – it starts a timer (wait command) which will lock the phone upon completion.

If the screen on profile called it – it simply stops, but also in the process it cancels any previous timer task…

Why does it cancel any previous timer?.... because the S4KgTimer task properties (press the task settings button in LRHC of the task pane) are adjusted to “abort existing task”…. That means the moment the S4TimerKg task gets called, any previous copy of that task is canceled. (That's the whole reason I used the same task for both screen on and screen off... so I could cancel an in-progress screen off timer upon screen on event.... doesn't use the stop task command)
By the way, the another profile Unlocked removes the keyguard lock after a successful entry of the pin… otherwise the keyguard lock remains enabled and you would have to enter a pin every time the screen goes off (successful pin entry would get you into the phone but wouldn't disable need for future pin entries). If you figure out how to make your method work, you'll still need a profile similar to my unlocked profile.

Set the value %S4KgTimerSeconds to give the timeout time you want. Mine changes based on my location.

Also I apologize it's bad style to use a global variable %TimerEntry in this manner... use of a parameter would have been more elegant.​
============================

Profile: Screen Off (142)

Event: Display Off

Enter: ScreenOffProfTask (148)
Stay Awake [<=THIS IS A PROPERTY OF TASK, SET IN LRHC]

A1: Variable Set [ Name:%TimerEntry To:screenoff Do Maths:Off Append:Off ]

A2: Perform Task [ Name:S4KgTimer Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off ]​


============================

Profile: Screen On (131)

Event: Display On

Enter: ScreenOnProfTask (132)

A1: Variable Set [ Name:%TimerEntry To:screenon Do Maths:Off Append:Off ]

A2: Perform Task [ Name:S4KgTimer Priority:5 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off ]​

============================

Profile: Unlocked (150)

Event: Display Unlocked

Enter: Unlock (123)

<new>

A1: Secure Settings [ Configuration:Clear Password Package:com.intangibleobject.securesettings.plugin Name:Secure Settings Timeout (Seconds):0 ]​


============================

S4KgTimer (130)

Abort Existing Task [<=THIS IS A PROPERTY OF TASK, SET IN LRHC]

A1: If [ %TimerEntry ~ *screenoff* ]

A2: Wait [ MS:0 Seconds:%S4KgTimerSeconds Minutes:0 Hours:0 Days:0 ]

A3: Vibrate [ Time:200 ]

A4: Perform Task [ Name:SetPassAndLock Priority:9 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off ]
A5: Else If [ %TimerEntry ~ *screenon* ]

<kill timer.>

A7: Stop [ With Error:Off Task: ]
A8: Else
< error trap for incorrect value in %TimerEntry>
A9: Notify [ Title:Error In Timer Entry Text: Icon:null Number:0 Permanent:Off Priority:3 ]​
A10: End If​
============================
SetPassAndLock (122)

A1: Secure Settings [ Configuration:Set Pin Package:com.intangibleobject.securesettings.plugin Name:Secure Settings Timeout (Seconds):0 ]

A2: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]

A3: Secure Settings [ Configuration:Lock Device Package:com.intangibleobject.securesettings.plugin Name:Secure Settings Timeout (Seconds):0 ]​
 
Last edited:
I have the same problem. The system lock screen only activates after 30 seconds after the reboot. Is there anyway to get it to come up right away after boot?
 
Back
Top Bottom