HomeTaskerTasker - Lock Apps on Android

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 a 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.

Due to the way Android encrypts the folders, this tutorial is not valid for Android Oreo (or newer). Fortunately, you can use a similar way of blocking the apps with “this tutorial“.

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.

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 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-211612

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-211617

We 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-211622

I’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.

Project Download

Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.

PayPal

Nothing says "Thank you" better than keeping my coffee jar topped up!

Patreon

Support me on Patreon and get an early access to tutorial files and videos.

image/svg+xml

Bitcoin (BTC)

Use this QR to keep me caffeinated with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU

New to Tasker?

Tasker Quick Start – Getting started with Tasker

0
From newb to not so newbie in 10 min

Best Tasker Projects

How to use Raspberry PI as WOL (wake on lan) server

0
While you could wake up your PC from a mobile directly, having a dedicated server capable of doing so is the best solution. The reason is simple. You can hook up as many devices as you wish with a single endpoint. This is why Raspberry Pi is perfect for this.

How to wake on LAN computers and put it to sleep with Power Menu,...

0
How to Wake on LAN properly via Android, Alexa, Google Assistant and Web

7 awesome Bluetooth keyboard shortcuts for Android

0
7 unique Android shortcuts that you can add to any Bluetooth keyboard.

Smart overnight charging with Tasker

0
Still keeping your phone plugged in overnight? Try smarter overnight charging with this profile

One thing that Join app can’t do and how to fix it with Tasker

0
It's not possible to share the clipboard automatically between join accounts registered to 2 different emails. But you can fix this with tasker.

Essential Guides

Tasker: Seconds into DD:HH:MM:SS (dynamic)

0
It's time to.... ok it's a pun, but I will show you how to master time and convert seconds to DD:HH:MM:SS dynamically

4 ways to organise Tasker projects

0
Keep your Tasker tidy!

A better way to store Tasker credentials

0
The more clever way of managing credentials

Annoyed with dozens of AutoApps populating your app drawer? Here is a fix!

0
Clear your app drawer from the clutter in seconds

Putting AutoTools pie chart to a good use – SSID logger

0
Who wants a piece of the pie (chart)?