Disable pattern lock

1,751 views
Skip to first unread message

Matt

unread,
Jun 5, 2011, 4:22:12 PM6/5/11
to Tasker
I have a profile set up on Tasker to disable pattern lock when at home
and turn it on again when I leave the house. The latter profile works
fine, but to get the pattern lock disabling to kick in I have to
manually restart Tasker when I get home. Is there a way to make this
work properly? I remember reading something a while ago about this
having to do with the screen needing to be on before the pattern lock
can be disabled, but I've tried changing the condition to take this
into account but to no avail.

(I'm using CyanogenMod 6.1 on a HTC Desire by the way.)

sayling

unread,
Jun 6, 2011, 4:04:16 AM6/6/11
to Tasker
I don't think you are able to disable the lock whilst the phone is
locked. The fact you have unlocked it to restart tasker means it is
unlocked, so the disabling of the lock is then possible.

I guess you'll need to do it manually first, then perhaps have a lock
(or Keyguard) toggle widget - there's a few examples in the Profiles
and Step Throughs.

Hope this helps

Matt

unread,
Jun 6, 2011, 9:14:17 AM6/6/11
to tas...@googlegroups.com
OK I think I see what's going on. But if that's the case then is there any way of creating a task that will automate this, so that the first time I manually unlock the phone after arriving home, Tasker automatically turns the pattern lock off?

sayling

unread,
Jun 6, 2011, 11:47:49 AM6/6/11
to Tasker
There is a display context event for 'on' and one for 'unlocked', so
you could use the latter - with some other state context to derive
when you are actually at home (cell near, for example ) to trigger the
task/actions, I would have thought...

Mark

unread,
Jun 6, 2011, 11:57:41 PM6/6/11
to tas...@googlegroups.com
I have this working using two profiles.

1) @Home
2) Unlocked 

When the Home profile detects my home SSID it sets %HOME to 1 amongst other things.

The Unlocked profile turns off Keyguard, triggering when I am unlocking my phone (Display->Unlocked event) and while at home (%HOME is set)

The Exit Task for my Home profile re-enables Keyguard.

I never thought about how awkward it could be to concisely explain Tasker profiles, hope this makes good enough sense :)


Corey Z

unread,
Jun 9, 2011, 12:06:43 PM6/9/11
to tas...@googlegroups.com
Since you're rooted, you could install this plugin. It allows you to toggle the pattern lock (and a few other things as well).
To install it, you need to push the apk to /system/app/ and CHMOD to 644.

I wouldn't rely on disabling the keyguard as it doesn't disable the pattern lock.

Side note, I wrote this plugin so if you have any questions, feel free to reach out to me.

I currently have the following setup working for me:

Event: Display Unlocked (This event triggers after the lock screen has been passed. So, if the phone is locked, it requires you enter the pattern once before unlocking)
Action: IF %HOME ~ True (Based on cell tower, I'm setting this variable)
Variable Set %Unlocked = True (When this is set, the next Event Triggers)

Event: Variable Set (%Unlocked)
Action: 
Secure Settings (Pattern Lock Disabled) IF %Unlocked ~ True
Secure Settings (Pattern Lock Enabled) IF %Unlocked ~ False

Event: Variable Set (%HOME)
Action: (I set phone volumes and such here, not necessary but you need the exit task below)
Exit Action: Set %Unlocked = False (When I'm no longer in the known cell tower location, this exit action triggers and performs the above Task to lock the phone)

Hope this was helpful.

Matt

unread,
Jun 10, 2011, 9:15:07 AM6/10/11
to tas...@googlegroups.com
Thanks for posting the link to your plugin Corey - it's exactly what I needed.

I started out trying to replicate your Tasker profile setup but couldn't get it to work, but eventually discovered that I could simply add the secure settings pattern lock task to my existing 'At home' profile.

For the benefit of anyone else trying to set something like this up, a simple version of the profile looks like this:

Context: State > Wifi connected - SSID=Home network
Task: Plugins > Secure Settings > Pattern Lock - Disabled (Wait for unlock=checked)
Exit task: Plugins > Secure Settings > Pattern Lock - Enabled

Mark

unread,
Jun 10, 2011, 3:29:46 PM6/10/11
to tas...@googlegroups.com
Hmm, I thought that's what Keyguard was referencing.. the pattern lock.

When my profile disables keyguard I no longer get the pattern lock prompt while at home.  Am I missing something?

Gary Lane

unread,
Jun 11, 2011, 1:04:09 AM6/11/11
to Tasker
Mark, for some machines/ROMs keyguard is not accessible in Tasker
(nerver been sure why not).

Corey, your plugin is fantastic - thank you very much for providing
it. I have been setting up the most complex tasks to achieve this
(and only approximating) and this enables me to do exactly what I
wanted. Coupled with a little utility I found on the market called
ExtendLockTime which allows you to precisely set the inactivity period
before the keyguard presents itself (when enabled) I now have a setup
which gives the mixture of protection and convenience that I have
craved since I bought the Desire over a year ago.

I had emailed the dev of ExtendLockTime to see if he could "plugin-
enable" it or indeed even take a data argument, but got no reply. If
you ever felt inclined to modify your "enable" function to allow a
precise setting of the timeout period - it would be a very welcome
modification. Thanks again for providing it. One question: having
installed it as you suggested with ADB PUSH and CHMOD, is there any
reason why the apk couldn't simply be "installed" via ADB (or indeed
HTC Sync for that matter). The ZIP didn't work with my edify-only
recovery image.

Corey Z

unread,
Jun 13, 2011, 10:25:56 AM6/13/11
to tas...@googlegroups.com
Mark,

The Keyguard is temporary. It allows an application to temporarily bypass the lock screen in order to perform some task. The issue with using this, is that the lock screen is not actually disabled. If a low memory event occurs and Tasker is killed, then the device will be locked again. Additionally, there is also the possibility to have undesirable behavior when the Home button is pressed.

My plugin toggles the lock_pattern_enabled value in the secure settings database. When set to false, this tells the phone that it is doesn't have a pattern lock set and is then unlocked. I believe this is the same method that was used in plugins prior to 2.2. The difference in 2.2+ is that the access to modify this setting was moved into a secure location only accessible by applications in the system directory.


---------------------------------------------------------------------------------------------------------------------------------------


Gary,

I believe you could create your delay lock functionality within Tasker.

Example:

Create a Task that responds to the variable %Unlocked getting set. Change this variable to True when you want to unlock your screen (at home, listening to music, etc).
Next create a timer task that will run every 10 minutes (or however long you want the delay) when your phone is unlocked (based on the variable). When this happens, you set the variable to False to lock the phone.

Here is what you would need to do this:

Profile: Delay Lock
Time:  Every 10m
State: Variable Value %UNLOCKED, Matches, True
Enter: Anon 
A1: Flash [ Text:Locking device Long:Off]
A2: Variable Set [ Name:%UNLOCKED To:False Do Maths:Off Append:Off]

Profile: Anon 
Event: Display Unlocked
Enter: Anon
A1: Variable Set [ Name:%UNLOCKED To:True Do Maths:Off Append:Off]

Profile: Unlock Set
Event: Variable %UNLOCKED Set
Enter: Unlocked
A1: Secure Settings [ Configuration:Pattern Lock Disabled] If [ %UNLOCKED ~ True ]
A2: Secure Settings [ Configuration:Pattern Lock Enabled] If [ %UNLOCKED ~ False ]


-------------------------------------------------------------------------------------------------------------------------------------------

As far as the ADB install is concerned: 
Correct me if I'm wrong but I don't believe you are able to use the ADB install command to push an application to the system partition. I know that once an app is in /system, then you are able to update it through ADB if the keys match. It is because of this that my application has to be pushed to the /system/app location manually or through an update.zip.

Additionally, you are correct to point out that my script is not edify compliant. I made that script ages ago while my phone was a Droid 1 (which never got CWR 3.0+). I have not gotten around to creating a new zip but it is on my to-do list :)

golightlygl

unread,
Jul 4, 2011, 6:39:58 AM7/4/11
to Tasker
Sorry Corey, for some reason I missed your reply. Sorry for not having
responded earlier.

Thanks for the script ideas. Yes, I realised I could accomplish it in
Tasker but prefer to keep Tasker timed checks to a minimum to save
battery. The ExtendLockTime app also works well enough to set the
timeout value so I'll leave it at that.

I have just flashed a new ROM and installed your plugin using the
regular ADB INSTALL command. It works perfectly. I am rooted and S-
OFF. I wonder if the S-OFF makes it possible?

On Jun 13, 3:25 pm, Corey Z <czua...@gmail.com> wrote:
> Mark,
>
> The Keyguard is temporary. It allows an application to temporarily bypass
> the lock screen in order to perform some task. The issue with using this, is
> that the lock screen is not actually disabled. If a low memory event occurs
> and Tasker is killed, then the device will be locked again. Additionally,
> there is also the possibility to have undesirable behavior when the Home
> button is pressed.
>
> My plugin toggles the lock_pattern_enabled<http://developer.android.com/reference/android/provider/Settings.Secu...> value
Reply all
Reply to author
Forward
0 new messages