[Android Software/Hacking General [Developers Only]] hallydamaster:
CASE SCENARIO:

My brother went out having a good time last friday. But then he met this girl who played with his phone. She tried guessing his pattern lock so many times that he eventually got locked out.

So now you just enter your login info, and password for the google account you created it with, right?

My brother is not always that smart, so ofcourse he couldn't remember the login details and came crying to me.

Truth is that many people tend to have an email at another provider and never use their gmail account.

SOLUTION:

YOU WILL NEED TITANIUM BACKUP PRO FROM MARKET, OTHERWISE THIS WILL NOT WORK!

OK, in this case it was my brothers Samsung Galaxy S2, but it should in theory work with any device that has an unlocked, or unlockable bootloader.

If your device is rooted with CWM you can skip the step about flashing a recovery/rooting.

If you device isn't rooted you are going to flash a kernel that has ClockWorkMod recovery in it. For SGS2 you can download Siyah from here:

http://gokhanmoral.com

Ensure that you download the TAR version of the kernel.

This is only for ICS ROMs, so if you run Gingerbread you will have to find another kernel for that. CF-ROOT for instance:

http://xdaforums.com/showthread.php?t=1103399

Ensure that the latest Kies is installed as it contains all drivers needed for connection.

Download Odin from here:

http://www.google.dk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&sqi=2&ved=0CCIQFjAA&url=http%3A%2F%2Fxdaforums.com%2Fattachment.php%3Fattachmentid%3D581913%26d%3D1304094576&ei=l0mcT-f7EsbHtAa37chO&usg=AFQjCNF7sF0f2yJp0IxHp1ISlP2fzGKhtw&sig2=FVQjxEz15dtQzJjNVZ_xZg

Extract contents to a folder and run the EXE file inside.

Now click on the button that says PDA and locate the TAR file you downloaded (the kernel).

Power off the SGS2 and wait a minute or 2. Eventually pull the battery.

Now hold VOLUME DOWN, HOME, POWER in that order, and keep holding them until a menu comes up. It will ask you if you want to enter Download Mode.

Press VOLUME UP once to accept.

It should be in download mode now.

Connect the device and wait until it says added in the textbox (Odin program).

Another box in the upper left corner should turn green as well.

Untick the option were it says Auto Reboot, and press the start button to flash the kernel.

Wait until it says successfull and remove the USB cable.

Hold the POWER button until it turns off or pull the battery.

Now hold VOLUME UP, HOME, POWER in that order, and keep holding them until the recovery comes up.

In the recovery there should be a option to perform a nandroid backup. Choose to backup, and wait for it to finish.

After it finishes, return using the back button and choose Factory Reset/Wipe everything. Don't worry, you just made a backup.

After it finishes, return with back button and choose reboot system.

When it boots up, you can set up your ROM as you like, but please use a Gmail account you remember and write it down this time ;)

You should be back at a very clean ROM without much in it. Open google (Play Store) market and download Titanium Backup. You will need the pro version and that is a must. It is a very good program, so the money is well spent (I am not affiliated with Titanium Track).

On your phone go to Settings -> Applications and tick the checkbox to allow Unknown Sources. Go to Development and enable USB Debugging.

Open Titanium Backup and click past all welcome screens/changelog etc.

In main windows press menu button and click [More]

Choose to Extract from Nandroid Backup

It should show you the nandroid backup you created earlier. Click it and in the next window click Select All and then Restore.

This can take a while, but when it finishes, reboot your device and all should be good.

If you have a HTC Device you should be able to unlock the Bootloader following instructions from htcdev.com and then flash a ClockWorkMod based recovery.

You then need to flash a rooted version of your ROM or root it otherwise, then the procedure is the same with TB.

Please use the thanks button if you find this useful. ;)