Tasker – Lock Apps on Android

Lock your apps, unlock it with a password or a fingertip. Great for keeping any app secure.

Are you still locking apps like it’s 1999? Do you have kids or a very curious partner? This profile could be for you! I came across few online profiles that suppose to protect your apps from unwanted attention using a password or a fingerprint reader.

I can bypass the regular Tasker app lock profiles in seconds! See the video!

I think it’s time to come up with a little bit more robust solution. This time we are using Tasker to lock apps and prevent anyone from accessing it.

Lock Apps on Android with Tasker

Watch the video to understand the limitation of some of the online methods. Secure shortcuts are very easy to bypass with a recent app screen or by launching the app with the voice command instead. Joao Dias’s tutorial can be bypassed with a split screen hack. It’s little too easy to bypass the app this way, and you would be better off buying a designated app that takes care of this for you. What if you wish to automate this with Tasker? Here is what you can do.




Limitations

The locked applications will become inaccessible, this means you won’t be able to receive any notifications issued by the application itself. This could be a good or a bad thing depending on your needs. Locked apps won’t have any access to the internet either. You can take the advantage of this fact as well.

The other limitation is the actual security of the method. Although the idea is simple and very efficient it is not really secure if you know how the application has been locked.  This is not something anyone can figure out on their own.

The process will require root access.

How does it work?

Tasker lock apps profile simply changes the name of the folder in which the application is installed. This renders the application useless.  There is no need to move the files alone (it takes time and it does not increase the security) and unless you know what are you looking for, the app will remain inaccessible. To increase the confusion of the hacker – the name picked can be little more ambiguous than the one I have used in an example (posing as another app).

To restore the access simply reverse the code and rename the folder to the original name. The app will resume where you left it.



Lock Apps

Once the shortcut is activated Tasker will create unlocking notification (optional). The notification has options to unlock the apps via password or fingerprint reader and it is linked to the corresponding tasks. This task will change the name with a run shell action (use root):

mv /data/app/{com.android.chrome-1,this.are.not.the.secret.files.you.looking.for}

In {original_name,new_name} we are listing the current name of the app followed by the name we wish to change it to. Then a simple notification is displayed that process has been completed successfully.

Lock AppUnlock App (fingerprint)Unlock App (password)
Lock App 
	A1: Notify [ Title:Lock Enabled Text:Your application has been locked
            Icon:hd_ab_device_access_secure Number:0 Permanent:On Priority:1 Actions:(2) ] 
	
	A2: Run Shell 
            [ Command:mv /data/app/{com.facebook.orca-2,this.are.not.the.secret.files.you.looking.for}
            Timeout (Seconds):0 Use Root:On Store Output In: Store Errors In: Store Result In: ] 
	A3: Flash [ Text:Locked Long:Off ] 

UnLock App (Fingertip)
	Abort Existing Task
	A1: Status Bar [ Set:Collapsed ] 
	A2: AutoTools Dialog [ Configuration:Dialog Type: Fingerprint
Title: Scan your fingers
Number Of Tries: 1
Text Size: 20
Dim Background: true
Top Margin: 16
Bottom Margin: 16
Bottom Buttons Top Margin: 16
Bottom Buttons Bottom Margin: 16
Cancelable: true
Turn Screen On: true Timeout (Seconds):60 Continue Task After Error:On ] 
	A3: If [ %atbutton ~ 2 ]
	
	A4: Run Shell 
            [ Command:mv /data/app/{this.are.not.the.secret.files.you.looking.for,com.facebook.orca-2}
            Timeout (Seconds):0 Use Root:On Store Output In: Store Errors In: Store Result In: ] 
	A5: Flash [ Text:UnLocked Long:Off ] 
	A6: Notify Cancel [ Title:Lock Enabled Warn Not Exist:Off ] 
	A7: Else 
	A8: Flash [ Text:Wrong Finger Long:On ] 

UnLock App (Password) 
	Abort Existing Task
	A1: Status Bar [ Set:Collapsed ] 
	A2: AutoTools Dialog [ Configuration:Dialog Type: Input
Title: Enter your password (HINT:1234)
Text Size: 20
Input Type: 1
Output Variable: attext
Dim Background: true
Top Margin: 16
Bottom Margin: 16
Bottom Buttons Top Margin: 16
Bottom Buttons Bottom Margin: 16
Cancelable: true
Turn Screen On: true Timeout (Seconds):60 ] 
	A3: If [ %attext ~ 1234 ]
	
	A4: Run Shell 
            [ Command:mv /data/app/{this.are.not.the.secret.files.you.looking.for,com.android.chrome-1}
            Timeout (Seconds):0 Use Root:On Store Output In: Store Errors In: Store Result In: ] 
	A5: Flash [ Text:UnLocked Long:Off ] 
	A6: Notify Cancel [ Title:Lock Enabled Warn Not Exist:Off ] 
	A7: Else 
	A8: Flash [ Text:Cmon I thought you can read! Long:On ] 

Unlock Apps

screenshot_20161024-211612Tasker Lock Apps profile can be unlocked in any way you wish. I will show you the password and the fingerprint method but feel free to link this to any other activity. Bear in mind to lock the tasker access in options, otherwise, the whole purpose of this is wasted.

 

 

 

Fingerprint scanner

screenshot_20161024-211617We will need an AutoTools for this. A dialog is created to read the fingerprint and a variable  %atbutton  is set to 2 if the scan was successful. Please select Continue Task After Error to allow Tasker to complete the task should fingerprint read fail. In AutoTools app disable the warning message, otherwise, you will see the additional notification when the scan fails.
If %atbutton = 2 – your task will unlock the app (or apps) otherwise it will throw an error and wait for the next attempt to unlock it.

 

 

Password

screenshot_20161024-211622I’m also using the AutoTools here, however, you can easily swap this for a scene or similar. A dialog will capture user input and will save it in the %attext variable. If this variable is set to the same value as your password the run shell changes the name of the folder to the original form.
 

 

Conclusion

Tasker  – Lock Apps on the Android profile is a clever and simple way to lock a single app or multiple apps at once. While the method is not 100% secure, it cannot be bypassed by manipulating the screen. Unless unlocked, no one will have any access to the notifications. The final benefit of the project is that you don’t have to explain why the app is locked, the locked application simply won’t launch and appear to be broken.


SHARE