FORUMS
Remove All Ads from XDA

[FIX] Tasker and the pattern lock

31 posts
Thanks Meter: 35
 
By terranim, Member on 4th June 2011, 07:58 PM
Post Reply Email Thread
One of the things that I wanted to use Tasker for was enable the pattern lock when I was away from home and then disable it at home. Unfortunately due to recent changes in the Android SDK that is no longer possible with Tasker directly.

With a bit of searching I discovered the Secure Settings plugin which can be installed to /system/app and thereby provide Tasker with the functionality. However, it seems that Secure Settings does not work on the Galaxy S2 because Samsung have their own pattern lock and method of controlling it.

I started doing a bit of digging (mainly using logcat to see what the system was doing when the pattern lock was enabled/disabled via the Location and security settings menu). I discovered that the Samsung lock system is controlled by some files in /efs and with a bit of experimentation I was able to enable/disable the pattern lock via a root shell. I contacted the author of Secure Settings who suggested I use the Locale Execute plugin to run shell commands via Tasker.

So I present here the commands I am now using on my phone and hopefully they will be of some use to others. The commands include a check that should ensure that it does not attempt to enable the pattern lock when no pattern has been set, but this has not been fully tested!

WARNING: These commands require root access and you use them at your own risk!

Make sure to install the Locale Execute plugin first and then to enable the pattern lock with a task simply add a new "Plugin/Execute" action and set the contents to:
Code:
@! if [ "`cat /efs/cryptprop_lockscreen.patterneverchosen`" = "true" ]; then echo -n true > /efs/cryptprop_lock_pattern_autolock; fi
To disable the pattern lock create an Execute action with the following contents:
Code:
@! if [ "`cat /efs/cryptprop_lockscreen.patterneverchosen`" = "true" ]; then echo -n false > /efs/cryptprop_lock_pattern_autolock; fi
These have been tested on rooted stock KE7 firmware.

Enjoy,
Dan
The Following 18 Users Say Thank You to terranim For This Useful Post: [ View ] Gift terranim Ad-Free
 
 
4th June 2011, 08:48 PM |#2  
Senior Member
Flag Copenhagen
Thanks Meter: 68
 
Donate to Me
More
Sorry for sounding stupid (I probably will)
But could you make a tasker-noob-proof-tutorial?
I couldn't find where to change, if it should be active inside or outside the given area (home or not home)..

Thanks in advance
The Following User Says Thank You to mljjlm For This Useful Post: [ View ] Gift mljjlm Ad-Free
4th June 2011, 11:40 PM |#3  
Senior Member
Flag Reggio Emilia
Thanks Meter: 260
 
More
Quote:
Originally Posted by mljjlm

Sorry for sounding stupid (I probably will)
But could you make a tasker-noob-proof-tutorial?
I couldn't find where to change, if it should be active inside or outside the given area (home or not home)..

Thanks in advance

He described the command action so you can apply your own rule... Google for tasker and you'll find a lot of howto

Sent from my Galaxy SII

If you find this post usefull please press the "Thanks" button
5th June 2011, 09:28 AM |#4  
bgx's Avatar
Senior Member
Thanks Meter: 126
 
Donate to Me
More
Great!

Is there a way to toggle 2G/3G and GPS via tasker on the galaxy s2?
5th June 2011, 11:39 AM |#5  
Senior Member
Thanks Meter: 94
 
More
great thread, thank you!

could you please export your tasker profile and upload it somewhere? i'm a tasker noob :)
5th June 2011, 11:49 PM |#6  
terranim's Avatar
OP Member
Thanks Meter: 35
 
More
@mljjlm
I'm sorry but this is not a tutorial for Tasker, it simply provides the information necessary to configure your own profiles for toggling the pattern lock. Although the information at the end of this post may prove useful.

@bgx
No idea I'm afraid, I've not had a chance to look into those although I'm pretty sure it's not possible to switch 2G/3G or GPS in the same way that the pattern lock is toggled here.

@js931
My profile is based on location (using the "Cell Near" state) and so will not be much use for anyone else. However I basically configured the following:
  • Create profile called "Home".
  • Add a "Cell Near" state and configure for my local towers.
  • Add a task called "Home" and include the "Execute" action described above for disabling the pattern lock (I also turn off mobile data and turn on wifi here).
  • Add an exit task called "Away" which includes the "Execute" action to enable the pattern lock (I also turn on mobile data here).
The Following User Says Thank You to terranim For This Useful Post: [ View ] Gift terranim Ad-Free
6th June 2011, 12:43 AM |#7  
Major_Sarcasm's Avatar
Senior Member
Flag South Coast, UK
Thanks Meter: 209
 
More
In your code for disabling the pattern, should the code read 'patternneverchosen' rather than 'patterneverchosen' as you have written? I haven't tested, but the spelling seemed odd.

If it's correct, ignore me
6th June 2011, 01:10 AM |#8  
terranim's Avatar
OP Member
Thanks Meter: 35
 
More
Quote:
Originally Posted by Major_Sarcasm

In your code for disabling the pattern, should the code read 'patternneverchosen' rather than 'patterneverchosen' as you have written? I haven't tested, but the spelling seemed odd.

If it's correct, ignore me

It is actually correct (I double checked the first time I tested it out since it was an ambiguous name), it is supposed to be:
pattern-ever-chosen

which is why I check for it being true in my command since we want a pattern to have been set.

Edit:

It has actually been properly tested today, I was away from home and the pattern lock was enabled, when I got back home the pattern lock was disabled.

One thing to be aware of, when setting up the Tasker profile, is that each "Execute" command requires its own root permission, so you have to make sure that these have been allowed before it will work quietly in the background (you should be able to trigger them by testing the task).
The Following User Says Thank You to terranim For This Useful Post: [ View ] Gift terranim Ad-Free
28th June 2011, 10:15 PM |#9  
Senior Member
Flag Caracas
Thanks Meter: 71
 
More
It works . Thanks !!!
29th June 2011, 08:50 AM |#10  
Senior Member
Flag Perth
Thanks Meter: 36
 
More
Question
It works great, however when the Lock Pattern is disabled, I still get the "slide to unlock" type of screen when waking the phone up. Any command for that?
I am running the stock SGS2 ROM (rooted obviously)

Thanks !
29th June 2011, 04:00 PM |#11  
Lennyuk's Avatar
Recognized Developer
Flag Essex, England
Thanks Meter: 1,757
 
Donate to Me
More
I am new to tasker and would like some help/advice

I want to save power a bit so want my gps to only turn on in certain cell tower locations (in order to aid more specific tasks when in those cell locations). my issue is not setting this up, it is in the fact that taskers default gps toggle settings do not work on the sgs2. Can anyone help with this, rather than me having to keep it checking gps all the time (which I have currently delayed to 10 minute checking slots).

Edit: Also not sure if it is me just being dumb, but I cannot see that plugin on that link in the OP..?
Post Reply Subscribe to Thread

Tags
pattern lock tasker

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes