The lockscreen is one of the cornerstones of security on Android. It keeps nosy people at bay, it avoids ill-intentions and serves as a barrier of entry to possible thieves. However, sometimes it manages to keep even you at bay – it’s very easy to forget your lockscreen PIN, or to mess up the pattern unlock. So, what can you do once that happens, and you’re locked out of your own device? Well, come with us as we take a look at some of the methods you can use to bypass or even hack your lockscreen completely!
Android Device Manager
This is by far the easiest and most direct method of bypassing the lockscreen, since it’s supported by Google and doesn’t really have any special requirements. It should work for most users, and is very simple to do. All you need is Android Device Manager enabled beforehand, which is something Google automatically does for you anyway in most modern devices, and a data connection. If you’re not sure that Android Device Manager is enabled for you, or if you’d like to find out more, check out this link: https://support.google.com/accounts/answer/3265955?hl=en
1. Go to https://www.google.com/android/devicemanager?hl=en&u=0 and enter your Google account password
2. You’ll see the Device Manager dashboard. It will attempt to locate your device on the map, which if you have GPS and a data connection enabled, it should be able to do.
3. Press the “Lock” button. It will show you a screen where you are able to replace your current lockscreen PIN number with a new one, set by you.
4. Enter the new PIN and select “Lock”. Your device should automatically lock.
5. Unlock your device by entering the new PIN number you just set. After unlocking, feel free to go to Settings and set a new one.
Like we said, this is the most straightforward solution, but it does require a data connection, which is something that won’t be there for everyone, for example, because you are not able to turn on Wi-Fi or mobile data after unlock. In that case, we have a few more solutions you can try…
If You Have USB Debugging Enabled
In case you have USB Debugging enabled (for those that aren’t aware, this option can be found in the Settings, under Developer options), there’s a lot you can do to try and hack the lockscreen to bypass it completely. For this, you’ll need to setup and install ADB, which stands for Android Debug Bridge. This is a feature meant for developers and allows them to directly interact and send commands to the device in order to get accurate and direct data in real time. However, we can use it to send our own commands and try to get rid of the lockscreen completely.
1. Install and set up ADB. This varies from manufacturer to manufacturer, and even within devices, so you’ll need to find a tutorial for your specific device. However, there are a few easier methods depending on your OS, like the 15 Second ADB Installer for Windows that is more or less universal and easy to set up.
2. Open an ADB session. This is done by connecting your device to the computer over USB, opening a command prompt or terminal on your OS, and typing “adb devices”. You should get a code in return that identifies your device, meaning that ADB is working correctly and is able to see your device. If you get an error, you don’t have USB Debugging enabled or ADB set up properly (for example, you may need to navigate to a certain folder and open the command prompt from there – look for solutions for your case)
3. Enter the following commands:
4. These commands will directly send a request to the device asking to delete all the .key files in the data/system directory and subdirectories, which is where lockscreen system data is stored.
5. Reboot the device, and the lockscreen should be gone. If you still get a lockscreen, enter any code and it should unlock.
6. If the above solution didn’t work for you, try these commands instead (make sure you start a new ADB session!):
update system set value=0 where name=’lock_pattern_autolock’;
update system set value=0 where name=’lockscreen.lockedoutpermanently’;
7. Again, reboot and enter any code to get rid of the lockscreen. If that one didn’t work either, you can try this one as a last resort:
adb shell rm /data/system/gesture.key
8. Again, reboot and see if it worked. If none of these commands worked thus far, there’s not much else you can do using this method alone, so you’ll have to try a new one or wipe your device to get rid of it.
If You Have Root and a Custom Recovery
In case your device is rooted and you have a custom recovery installed, you can flash a file directly to the device that will delete the .key file storing the PIN directly using a script. In order to do this:
1. Download this file: https://mega.co.nz/#!NVtyWQDA!7qy58ihYMY07ehADl2tDUIzK4bF0XzO_xh7k-JWj_aY
2. Copy the file over to the device. If your device uses an SD Card, copy it there. Otherwise, you can use ADB with the “push” command in order to send the file to a folder on your device. Look for instructions if you’re unsure about how to do this.
3. Boot into the recovery. Each device has it’s own method to do this, so look it up (generally it’s a combination of volume and power buttons after reboot).
4. Flash the file.
5. Reboot the device. The lockscreen should be gone, or able to accept any code.
If your case doesn’t fall into one of these scenarios, then I’m afraid I have bad news for you. The purpose of the lockscreen is, after all, to be secure first and foremost, so it wouldn’t make much sense if it happened to be trivial to hack or bypass, which is why the alternative methods must use debug or root access. So if you’re not able to use either of them, or the above solutions simply did not work for you, the best bet is really to just wipe the device and get it over with, as most solutions tend to be a variant of the solutions posted above and probably will not work. If you search for your device in particular, you may be able to stumble upon a custom command (for example, certain manufacturers will store the .key files elsewhere) that works for that device in particular, but it’s a long shot, and you may just have to bite the bullet in the end.