Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,809,137 Members 50,443 Now Online
XDA Developers Android and Mobile Development Forum

[GUIDE][HOW-TO]Crack android pattern lock!

Tip us?
(Last edited by m.sabra; 23rd August 2012 at 11:28 AM.)
Senior Member - OP
Thanks Meter 529
Posts: 130
Join Date: Sep 2011
Location: Beirut
Default [GUIDE][HOW-TO]Crack android pattern lock!

Dislcaimer: this is for educational purposes only,you shall not use this on other people phones without permission under any circumstances,and am not responsable to any misuse of this hack
ok so not long ago i had a problem with a locked android device with a pattern and i managed to unlock it using adb,so here's how in case you were stuck one day with a locked device.

the device needs to have usb debugging enabled in case usb debugging isn't enabled and you have cwm you can run the same instructions from cwm,root is not required (though it will be so better if the device was rooted)

this was tested on:gingerbread,ice cream sandwich and jelly bean.

both method are through adb.

method 1:
adb shell
cd /data/data/
sqlite3 settings.db
update system set value=0 where name='lock_pattern_autolock';
update system set value=0 where name='lockscreen.lockedoutpermanently';

method 2:
adb shell rm /data/system/gesture.key
and that's a video showing how method 2 is done (thanks to melvinchng) :

you can try both of them,here is how i managed to remove the lock:
1- run the first method.
3-run the second method

-in the first method each line is a seperate command so click enter after typing each line.
-in the second method type all the command and then press enter.
-after running both methods and rebooting you may see the pattern lock,that doesn't necessarily mean it doesn't work,just try any random pattern and it may unlock then remove the pattern from settings.
-this may and may not work,it may work on some devices and don't on others,so all you can do is trying it but i can't assure it will work.
a small donation would be much appreciated thank (check my signature)
The Following 179 Users Say Thank You to m.sabra For This Useful Post: [ Click to Expand ]
creagrox's Avatar
Senior Member
Thanks Meter 21
Posts: 158
Join Date: Feb 2012
Location: Ranchi, Jharkhand
But What if i remember the password well enough, but didnt have data enabled the moment it got locked?

Explained elaborately here>>>
Senior Member
Thanks Meter 22
Posts: 181
Join Date: Jun 2011
Location: Kaunas
It will unlock either (Loook at the time of message above - I am time traveler )
Nexus 5
The Following 2 Users Say Thank You to ashirviskas For This Useful Post: [ Click to Expand ]
vNa5h's Avatar
Senior Member
Thanks Meter 113
Posts: 660
Join Date: Dec 2011
Location: Mumbai
i have better method than bot the above ones

look for smudges on the phone
Motorola Moto G a.k.a XT1033 a.k.a Falcon
Running Stock KK 4.4.2, Soundmagic PL11 earphones
TV Shows / Movies .....I have watched....
...I listen...
The Following 19 Users Say Thank You to vNa5h For This Useful Post: [ Click to Expand ]
Junior Member
Thanks Meter 3
Posts: 14
Join Date: Aug 2010
Do the files need to be restored or are they just the user data for the pattern locks?
spiderio's Avatar
Senior Member
Thanks Meter 781
Posts: 1,092
Join Date: Aug 2009
Location: Jakarta

This is really great...
i wonder how do you discover this
you must be a hacker
The Following User Says Thank You to spiderio For This Useful Post: [ Click to Expand ]
Senior Member
Thanks Meter 148
Posts: 819
Join Date: Dec 2010
Location: glasgow

Or you could boot into recovery backup data
wipe factory reset and reboot
Could try restoring data but most likely restore pattern lock
Or simply enter your gmail address as requested
The Following 2 Users Say Thank You to manemzjum For This Useful Post: [ Click to Expand ]
Thunder07's Avatar
Recognized Contributor / Recognized Developer
Thanks Meter 1,909
Posts: 1,318
Join Date: Sep 2007

2nd option...
if you have Custom recovery
use AROMA File Explorer and you can do the same thing through the recovery
or adb through the recovery

Device: HTC One X

This is My Design.
[AIO]One X One Click | Thunder's Online Kernel Repacker | Zeus Kernel Lighter
OTA Creator V1.1 | ARHD 9.x (Base 2.17) & CD-Tool Battery Mods | Battery Mods Creator V1.1 |APK (Game) Modder v1.0 Beta


SkyDragon© AIO Team Member

Click Thanks Or Hit That Donate Button.
The Following 3 Users Say Thank You to Thunder07 For This Useful Post: [ Click to Expand ]
zmore's Avatar
Senior Member
Thanks Meter 887
Posts: 1,585
Join Date: Apr 2011
Location: NYC
FWIW, on CM10 neither method works as non-root. Yay CyanogenMod.

Method #1 FAIL:
1|shell@android:/data/data/ $ ll
opendir failed, Permission denied
255|shell@android:/data/data/ $ sqlite3 settings.db
Error: unable to open database "settings.db": unable to open database file

Method #2 FAIL:
shell@android:/data $ ll /data/system/gesture.key
-rw------- system system 20 2012-08-11 04:51 gesture.key
shell@android:/data $ rm /data/system/gesture.key
rm failed for /data/system/gesture.key, Permission denied

(I use faceunlock + pattern (mostly to keep my kid outta my phone), but if I actually cared more about security I'd encrypt my phone and use a passphrase instead)
Primary Phone: Note3 (SM-N900T); ROM: CyanogenMod 11 (KitKat 4.4.*); kernel: Stock @ 2.3GHz; misc: Incipio DualPro; 64GB class10 microSDXC
Other devices: Nexus 10 (stock), Moto X (GSM, unlocked & rooted)
Retired devices: SGS1 Captivate (SGH-i897) (internal flash died), SGS3 (SGH-i747), Nexus 7 (2012), Kindle Fire (otter), OG Galaxy Tab 7, ...)
The Following User Says Thank You to zmore For This Useful Post: [ Click to Expand ]
Senior Member
Thanks Meter 16
Posts: 176
Join Date: Jul 2010
Location: Ankara
This is a useful guide, thanks, I will try it

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes