By Some Guy

2012-09-23 17:06:31 8 Comments

Using Jelly Bean, 4.1.1, on a Galaxy Nexus, I want this: You lock the phone. For the first 5 minutes, if you try to unlock, you can just slide and unlock it; after that, you have to enter a pattern.

I don't know how to get the slide to unlock to be activated for the 5 minutes in the middle. I have it set up right now so that it unlocks right away in the first 5 minutes, and asks for the pattern after that. Is this even possible?


@Andy o 2013-01-18 17:18:15

just commenting cause I found this by googling for an answer, and actually I achieved exactly what the OP wants, with Tasker and Secure settings. No caveats here, working fine. Using it both on a Nexus 4 and N7 on CM 10.1.

First of all, have the slide to unlock enabled, then enable your pattern. When Secure Settings disables pattern unlock, it goes back to what the phone was set to before.

Profile: display off (7)

Event: Display Off

Enter: Slide/pattern (12)

Abort Existing Task

A1: Secure Settings [ Configuration:Pattern Lock Disabled/Wait For Unlock Package:com.intangibleobject.securesettings.plugin Name:Secure Settings Continue Task After Error:On ]

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

A3: Secure Settings [ Configuration:Pattern Lock Enabled Package:com.intangibleobject.securesettings.plugin Name:Secure Settings Continue Task After Error:On ] If [ %SCREEN ~ off ]

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

A5: Secure Settings [ Configuration:Pattern Lock Disabled/Wait For Unlock Package:com.intangibleobject.securesettings.plugin Name:Secure Settings Continue Task After Error:On ] If [ %SCREEN ~ off ]

The "continue task after error" setting is probably not required, I was just testing and left it there. Two key settings are on Tasker, disable beginner mode on settings so you get the task properties icon, then there, change collision handling to "abort existing task". In Secure Settings you need to install and enable the helper or the pattern unlock will work but may be unstable (it was on my N4).

Note that in A3 and A5 I enable pattern and disable it again. This is done because if you just enable it, it will ask you for pattern twice in a row, cause you set in Secure Settings' pattern unlock to ask you for pattern the first time. If you don't set it to ask you for it, then the pattern can be bypassed by simply turning off the screen twice.

@Izzy 2012-09-24 18:30:44

Adding to Scott's answer, this should even be possible without the addition of Secure Settings, just with Tasker alone:

  • Event
    • Screen off
  • Task
    • Keyguard Off
    • Wait [ MS:0 Seconds:0 Minutes:5 Hours:0 Days:0 ]
    • Keyguard On
  • Collision: Stop running task

So what does this do? Whenever the screen is switched off, Keyguard will be turned off (that's the one locking the screen). Then it will wait for 5 min, and turn Keyguard on again (re-activate locking). If the task is already running (i.e. you switched the screen off for the 2nd time within the 5 min window), the running (waiting) task is aborted (collision), and the "counter" starts over again.

And what is the catch here? This profile looks simpler, there must be one. And there is: This probably disables the "slide to unlock" as well -- so as soon as the screen is switched on, there's no protection against unwanted input. So what do we do? Adding a second condition:

  • State: Sensor -> Orientation -> Face Up

Fine. You probably never put it into your pocket face-up unless you're lying on your back :) So if you only put it on the table and switch off the screen (I often do while reading my news feeds at breakfast), it's fine and simple.

@Scott Severance 2012-09-24 22:02:06

This was also the direction I was going at first, until I realized that it was effectively the same as what the OP was doing in the question: setting a screen lock timeout.

@Izzy 2012-09-24 22:18:23

Admitted, it's quite similar -- only that with this Tasker profile the additional condition kicks in: Screen lock won't be activated if you e.g. hold the device facing you, switch it of, and tuck it into your pocket. With the usual screen lock timeout, you'd still have the danger of accidentally switching on the screen and unwantingly trigger some activity. So my solution adds some protection, however minor.

@Scott Severance 2012-09-24 00:25:33

I was able to set up what you want with one caveat: You have to use a PIN or a password, not a pattern. My solution depends on the apps Tasker (trial version here) and Secure Settings. Secure Settings requires root for some of its features. I don't know if this is one of them. If you aren't rooted, you can try it and see if it works.

Posting a complete how-to on Tasker is beyond the scope of my answer. Instead, here's the official documentation and links to user-created guides. My solution involves setting up two Tasker profiles. The first one sets the PIN or password after a timeout. The second one clears the PIN/password once the screen is unlocked.

Here are my profiles:

Profile: Screen Locked (98)
    Event: Display Off
Enter: Anon (106)
    A1: Wait [ MS:0 Seconds:0 Minutes:5 Hours:0 Days:0 ] 
    A2: If [ %SCREEN ~ off ]
    A3: Secure Settings [ Configuration:Set Pin Package:com.intangibleobject.securesettings.plugin Name:Secure Settings ] 
    A4: End If 

Profile: Screen Unlocked (107)
    Event: Display Unlocked
Enter: Anon (108)
    A1: Secure Settings [ Configuration:Clear Password Package:com.intangibleobject.securesettings.plugin Name:Secure Settings ] 

Once you've got Tasker configured, go to your phone settings and set slide unlock (and set he timeout to be whatever you find to be an appropriate amount of time for the slide lock to come up) . Note that when the password/PIN is enabled, you'll first have to slide unlock, and then enter your PIN/password.

@Some Guy 2012-09-24 12:48:49

It worked without needing to root my phone. Thanks!

@Some Guy 2012-09-25 13:09:25

There was one problem with this that I'd like to point out for others. If you lock the phone, unlock it right away, use it for a bit, and lock it again, your phone will ask for a PIN / password sooner than the timeout because the first lock's "wait" ended after you'd locked it for a second time. This can be fixed by adding a variable for the time the phone was locked and setting the pin only if the time passed from the variable is long enough.

@Raghav Sood 2012-09-23 17:45:53

This isn't possible. The best you can do is:

  1. Go to Security
  2. Uncheck the Power button instantly locks option
  3. Above that, set the timeout for Automatically lock to 5 minutes

Now whenever you lock the phone by using the power button, it will not ask you for a passcode unless you let it be with no activity. The screen will turn off, but if you press the power button again it will come on and not ask you for a password unless 5 minutes have elapsed.

NOTE: With this setting, any button can unlock the device for the set timeout, including the volume button.

@Some Guy 2012-09-23 17:46:38

Yeah, that's how I have it set up now. Thanks, anyway.

@Scott Severance 2012-09-24 00:28:09

Actually, it's mostly possible, as long as you're willing to accept a PIN or password lock instead of a pattern.

Related Questions

Sponsored Content

2 Answered Questions

[SOLVED] Lock screen stuck in landscape mode on Galaxy Tab 10.1

  • 2012-12-17 18:21:36
  • Questioner
  • 2601 View
  • 1 Score
  • 2 Answer
  • Tags:   lock-screens

2 Answered Questions

[SOLVED] How to switch screen unlock from Pattern to Slide

3 Answered Questions

5 Answered Questions

[SOLVED] How can I re-enable my keyguard?

1 Answered Questions

[SOLVED] How do I use a pattern to unlock the phone screen?

1 Answered Questions

[SOLVED] avoid both screen lock and pattern lock

1 Answered Questions

[SOLVED] Only use pattern lock instead of swipe screen and pattern lock

  • 2011-08-04 15:40:32
  • Gady
  • 1745 View
  • 5 Score
  • 1 Answer
  • Tags:   lock-screens

Sponsored Content