14

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?

2
  • Thanks for this question. I originally worked on it because I didn't believe the other answer (that it was impossible) was correct. I ended up with a useful setup for myself. Commented Sep 24, 2012 at 1:01
  • I'm surprised this is not possible :( This behaviour worked on my Galaxy S3 and iPhone 3GS. In fact it works on all Apple products. I'm here because it doesn't work on my HTC One M9... Its a shame because if you want non-auto lock for a few minutes you risk pocket dialing. Especially when an SMS turns on your screen to show the notification but its unlocked and opens the last app. Commented Apr 11, 2016 at 6:12

4 Answers 4

10

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.

2
  • It worked without needing to root my phone. Thanks!
    – Some Guy
    Commented Sep 24, 2012 at 12:48
  • 2
    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.
    – Some Guy
    Commented Sep 25, 2012 at 13:09
2

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.

2
  • Yeah, that's how I have it set up now. Thanks, anyway.
    – Some Guy
    Commented Sep 23, 2012 at 17:46
  • 1
    Actually, it's mostly possible, as long as you're willing to accept a PIN or password lock instead of a pattern. Commented Sep 24, 2012 at 0:28
2

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.

2
  • 1
    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. Commented Sep 24, 2012 at 22:02
  • 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.
    – Izzy
    Commented Sep 24, 2012 at 22:18
2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .