[Android Software/Hacking General [Developers Only]] siidheesh:
HOW TO UNROOT (ALMOST) ALL ANDROID DEVICES (SIMPLIFIED)

Firstly, in order to unroot your android device, you need:

1) An update available for your phone or an old nandroid backup that has a previous version of your phone android version

2) A nandroid backup done before you attempt the following steps below

Once the above conditions are met, you are ready to UNROOT your phone!

Before you read the procedure, read how it works

below and get a better picture:

HOW

Firstly, one known method of unrooting is to install an available system update. However, stock updates are signed with official keys and custom recoveries only accept updates signed with their custom keys.

So, to unroot, you need to have stock recovery installed. One way to get your phone`s stock recovery back is contained in the update zip.

The update zip is the key, literally. Look through it and you will find (usually in the system folder) a file called recovery.img, which will be used as your new stock recovery.

By flashing in the image into recovery, you can now install updates, keep your previous applications, enjoy being unrooted and updated.

There are other unroot options that tailor to specific android phones and versions, but this solution should work on all android phones.

Why unroot? Because sending in a rooted phone for repair will void your warranty. Also, by having a rooted phone, you run the risk of a rogue rooted application that does unwanted stuff to your phone.

PROCEDURE

Step 1) If you still have your original stock recovery that came with your phone, continue. Else search for my previous thread: "[RECOVERY] Reverting to original(STOCK) recovery" and follow the steps there. You can use the update file you used to revert to stock recovery here as well or vice versa

Step 2) Reboot you phone

Step 3) Check for system updates and download them

Step 4) Wait until phone reboots. All your applications and user settings will be retained.

Step 5a) Open up a terminal emulator on your phone and enter "su" (Check if unroot)

Step 5b) If you cant turn your phone on to check if unrooted, boot into recovery mode, open up adb enter:

adb shell
su

Step 6) If you get "permission denied" or something like that from step 5a/5b,

CONGRATULATIONS! YOUR PHONE HAS BEEN SUCCESSFULLY UNROOTED!

Step 7) If you don`t want to void your warranty, you should unistall applications that require root, especially Superuser

To date, I have rooted and unrooted my phone (Backflip) 3 times without any problems. In case your phone can`t be booted up, only to the bootloader or recovery, DO NOT WORRY! You can use the adb (android debug bridge) to flash in the stock recovery, push/pull the updates and reboot the phone into recovery mode or normal mode!!!

Useful ADB commands

Reboot Phone

adb shell
reboot

Reboot Phone into recovery mode

adb shell
reboot recovery

Flash a new recovery image temporarily (resets when rebooting)

adb shell
flash_image recovery /sdcard/recovery.img

Flash a new recovery image that does not reset when rebooting

adb shell
flash_image recovery /sdcard/recovery.img
exit
adb shell
cd system
su
mount -o rw,remount /dev/block/mtdblock1 /system
rm recovery.img
mount -o ro,remount /dev/block/mtdblock1 /system
exit
exit

Push file to sdcard

adb push file.blah /sdcard/file.blah

Push file to sdcard

adb pull /sdcard/file.blah file.blah

Here`s wishing you good luck and a belated happy new year!