[Android Q&A, Help & Troubleshooting] myth_237:
This guide will walk you through deleting your security PIN via several methods. This guide is for those who have forgotten your security PIN and cannot do a Google reset for some reason. Have restored your phone from an old backup that had a different PIN than your current PIN, and now the Android system is completely confused which PIN to use and isn’t accepting any of them.

You should have a custom recovery installed on your phone, or ADB installed on your computer, but that is beyond the scope of this guide as custom recovery installation methods varies by device. Check Appuals for how to install TWRP on your specific device, or how to install ADB on Windows.

There are two situations you may encounter after restoring from a backup that contained a different PIN than the one you are most recently using.

Device Uses Two Different PINs

This will happen when you have a recent boot PIN, and your backup contains an old screen-lock PIN. So now the device will have two different PINs, which may in fact add to overall device security, but be a headache when you need to remember both PINs.

To resolve this you simply need to reset your PIN in the Android settings. Just go to Settings > Security > Screen Lock, and enter a new PIN. It will overwrite the boot PIN and default back to using just one PIN.

The Device Won’t Accept Any PIN

This is where things get frustrating. In certain cases, your phone may accept the boot PIN, but not a screen unlock PIN. For this, we are going to completely delete the files that store your PIN (yes, your PIN is stored in system files that can be deleted – shocking?).

Delete your Android PIN – TWRP Method

Boot your phone into TWRP recovery.

Go to Advanced > File Manager and navigate to /data/system.

Find the files that end in the .key extension and any files that have “locksettings” in the filename. They will typically be (but vary by manufacturer):

Gatekeeper.password.key
gatekeeper.pattern.key
locksettings.db
locksettings.db-shm
locksettings.db-wal

After you’ve deleted those files, reboot your phone. You will be greeted by a lock screen, but it will not prompt you for any password or PIN. If it does, you did not delete all the necessary files.

Set a new PIN in your security settings!

Delete your Android PIN – ADB Method

Note: This requires a rooted phone and USB debugging enabled. If USB debugging is not enabled and you are locked out of your phone, you need to try and flash a custom recovery such as TWRP, which can also grant an ADB sideloader.

Connect your phone to your computer via USB and launch an ADB terminal.

Type the following commands into the command prompt:

adb devices
adb shell
cd /data/system
su
rm *.key
rm *.key
adb reboot

Delete your Android PIN – ADB/SQL Method

Note: This is an alternative ADB method for those who have SQLite3 alongside their ADB installation.

Type the following commands into your ADB/SQL terminal:

adb shell
cd /data/data/com.android.providers.settings/databases
sqlite3 settings.db
update system set value=0 where name=’lock_pattern_autolock’;
update system set value=0 where name=’lockscreen.lockedoutpermanently’;
.quit

Delete your Android PIN – Flashable Pattern Password Disable.Zip Method

Note: This is for those who have a custom recovery (it doesn’t matter which) installed and want to flash a .zip that will do the work for you.

Download the Pattern Password Disable .zip from here and transfer it to your phone’s SD card.

Reboot into your custom recovery of choice.

Flash the zip and reboot your phone.