Tasker script to temporarily disable android security

The goal for this project was to disable the android security features of my phone for a set duration of time once I manually unlock the device (with pattern or pin). I also wanted the ability to disable the security feature while on my home wireless network.┬áThere are several methods of completing such a task, as detailed in the Tasker wiki and other forums. Most of the scripts that I tried didn’t work on my device for one reason or another, so I created this quick script (attached below) to solve my problem.

Android-Pattern-Lock

I accomplished this task using a combination of several Tasker scripts in conjunction with Secure Settings for android. The script works by using and monitoring several variables: %ScreenOff, %TempUnlock, and %TrustedWifi. %ScreenOff is set to 1 whenever the display is powered on, 0 when off. %TempUnlock is set to 1 when the temporary unlock is activated. %TrustedWifi is set to 1 when connected to any of the wifi networks listed as a ‘trusted’ wifi network.

When the display is unlocked and the variable %TempUnlock is not equal to 1, the TempUnlock script (task) is run. This script sets %TempUnlock to 1, disables the pattern lock using Secure Settings, and waits 15 seconds in a loop until %ScreenOff = 1. Once that condition is validated, the script waits an additional 3 minutes before checking the %ScreenOff variable again. If %ScreenOff = 1, the lock is re-enabled, and %TempUnlock is set to 0. Otherwise, the screen is deemed still in use and the task script is restarted using the “Goto” command in Tasker.

tasker_security

One issue I ran into was the script running the TempUnlock multiple times simultaneously. To get around this, I probably could have just set a maximum number of simultaneous processes, but I just created a new profile named “Restart” that runs when the display is unlocked and %TempUnlock = 1–this runs a script that stops and restarts the TempUnlock task.

 

See the attached file for the entire project in XML format. TempUnlock.prj

Leave a Reply

Your email address will not be published. Required fields are marked *

*