5,604,219 Members 49,125 Now Online
XDA Developers Android and Mobile Development Forum

[FIX] Tasker and the pattern lock

Tip us?
 
terranim
Old
#1  
terranim's Avatar
Member - OP
Thanks Meter 35
Posts: 31
Join Date: Nov 2009
Default [FIX] Tasker and the pattern lock

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: [ Click to Expand ]
 
mljjlm
Old
#2  
Senior Member
Thanks Meter 68
Posts: 379
Join Date: Mar 2010
Location: Copenhagen

 
DONATE TO ME
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: [ Click to Expand ]
 
nightranger73
Old
#3  
Senior Member
Thanks Meter 261
Posts: 970
Join Date: Oct 2010
Location: Reggio Emilia
Quote:
Originally Posted by mljjlm View Post
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
Phones:
Galaxy S I9000 CM10
Galaxy SII I9100 CM10.1 ICS
HTC One X CM10.1
Galaxy Note II N7100 CM10.1


Tablets:
Galaxy Tab P7500 CM10.1
ASUS TF300TG CM10.1
 
bgx
Old
#4  
bgx's Avatar
Senior Member
Thanks Meter 74
Posts: 390
Join Date: Dec 2010

 
DONATE TO ME
Great!

Is there a way to toggle 2G/3G and GPS via tasker on the galaxy s2?
Siemens S6 -> Nokia 6110 -> HTC SDA -> Nokia E61 -> Nokia E71 -> HTC Wildfire -> Samsung Galaxy SII -> LG G2 @ Mahdi-Rom 2.5 [03/18] | kernel: AOSP 4.4.2 [v6]
---------------
If I helped you, hit the thanx button!
Tasker BLN for every SMS App
Volume Boosting for SGS2 with the help of Tasker
 
js931
Old
#5  
Senior Member
Thanks Meter 44
Posts: 263
Join Date: Jul 2010
great thread, thank you!

could you please export your tasker profile and upload it somewhere? i'm a tasker noob :)
 
terranim
Old
#6  
terranim's Avatar
Member - OP
Thanks Meter 35
Posts: 31
Join Date: Nov 2009
@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: [ Click to Expand ]
 
Major_Sarcasm
Old
#7  
Major_Sarcasm's Avatar
Senior Member
Thanks Meter 183
Posts: 756
Join Date: Jan 2009
Location: South Coast, UK
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
Steve - Nexus 4 (Omni) & Nexus 7 (CM10.2)
Quote:
Originally Posted by XEURONIX View Post
Is there possible to install an iOS 4 on the Android. So it will be the same as on iPhone.
If I made you laugh or I helped you in some way, click the 'Thanks' button.
If I upset you or made you cry, get a grip; this isn't real life! It's XDA Developers!
 
terranim
Old
(Last edited by terranim; 6th June 2011 at 12:25 AM.)
#8  
terranim's Avatar
Member - OP
Thanks Meter 35
Posts: 31
Join Date: Nov 2009
Quote:
Originally Posted by Major_Sarcasm View Post
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: [ Click to Expand ]
 
hotsync100
Old
#9  
Senior Member
Thanks Meter 54
Posts: 316
Join Date: Jun 2009
Location: Caracas
It works . Thanks !!!
[PHONE1] MotoX Developer Edition
[PHONE2] Huawei Ascend P1
[TABLET] Nexus7
 
julien.me
Old
#10  
Senior Member
Thanks Meter 35
Posts: 191
Join Date: Jul 2010
Location: Perth
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 !

Tags
pattern lock tasker
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes