TaskerAndroidTutorials

Tasker – Lock Apps on Android devices

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. Would you like to see me bypass it  in a few seconds?  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 other, available 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 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

Tasker lock appsOnce 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.

Unlock Apps

Tasker 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 Android profile is a clever and simple way to lock a single app or multiple apps at once.

Android ver: Any
Plugin: AutoTools (optional)
Needs: Root
Complete project file is available here.

[tabs tab1=”Lock Apps” tab2=”Unlock Apps” tab3=”Unlock Apps Pass”] [tab id=1]
Lock App (46)
A1: Notify [ Title:Lock Enabled Text:Your application has been locked Icon:hd_ab_device_access_secure Number:0 Permanent:On Priority:3 Actions:(2) ]
<Lock>
A2: Run Shell [ Command:mv /data/app/{com.android.chrome-1,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 ]

[/tab] [tab id=2]
UnLock App (47)
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 ]
<Unlock>
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:Wrong Finger Long:On ]

[/tab] [tab id=3]
UnLock App Pass (48)
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 ]
<Unlock>
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 ]

[/tab] [/tabs]

 

Pocketables does not accept targeted advertising, phony guest posts, paid reviews, etc. Help us keep this way with support on Patreon!
Become a patron at Patreon!

Mat Zolnierczyk

I am passionate about technology, cycling, and art. This would explain why my bike has more computing power than your average office. I own notenoughtech.com and I write for xda-developers.com and pocketables.com NotEnoughTECH | Facebook | Twitter |YouTube |Instagram | Google+ |Donate |Patreon

Avatar of Mat Zolnierczyk