[Samsung Galaxy Nexus] Petrovski80:
While unlocking the bootloader on a Galaxy Nexus unleashes the full potential of the bootloader, it also poses a security risk. Even with your lockscreen protected with a pattern/PIN/password, not having flashed a custom recovery, having an anti-theft app installed (maybe even converted/installed as a system app) your phone's data is easily accessible for a knowledgeable thief.

All the thief needs to do is reboot into the bootloader and boot or flash a custom recovery such as ClockWorkMod or TWRP. It's then possible to boot into recovery and use ADB commands to gain access to the phone's data on the internal memory (unless you have it encrypted) and copy/remove files at will.

Granted, the risk seems low. The thief would not only require knowledge of fastboot, he would have to turn off the phone before you have issued a wipe command using an anti-theft app. You could of course flash back the stock recovery & relock the bootloader after being done with flashing stuff, but that would require you to unlock it again if needed which will erase your userdata.

There are two ways to tackle this security risk AND retain unlocked bootloader functionality without losing userdata.

1) Encrypt your phone using Android's built-in encryption feature

Advantages:

- you can leave your bootloader unlocked & leave a custom recovery installed without risk of exposing your data.

Disadvantages:

- unless the custom recovery can decrypt your phone, you cannot use all of its features.

- when decryption fails, you cannot access your phone and need to do a factory reset from recovery. Users have reported not being able to decrypt after applying OTA updates.

- the encryption process is irreversible. The only way to return to an unencrypted phone is to perform a factory data reset which erases all your data.

2) Unlock & relock the bootloader from Android OS

Prerequisites:

- root access

- an app that can unlock/relock the bootloader at will such as BootUnlocker

Steps

Root your device using one of the many guides out there (recommended guide). Install BootUnlocker. Reflash stock recovery and lock the bootloader. Whenever you need an unlocked bootloader again, simply use Bootlocker to unlock it (this won't wipe userdata). When done, relock.

Advantages:

- doesn't require encryption (for those who do not wish to use it).

Disadvantages:

- relies on third-party apps.

- method will not work if you lose root access for whatever reason.

- method will not work when you cannot boot into Android for whatever reason.

USB debugging

Strictly not related to the bootloader, but for maximum security disable USB debugging when not required. Having it enabled allows the execution of ADB commands even if the lockscreen is still locked. Myself, I use Tasker in combination with Secure Settings to automatically enable USB debugging when my device is connected to my home WiFi access point but disabled if not connected.

The following video demonstrates what a knowledgeable thief can do with your phone when you have USB debugging enabled by default: http://www.youtube.com/watch?v=ah7DWawLax8&t=7m0s

More info: recently, an exploit has been discovered that will enable gaining root without going through the 'traditional' process of unlocking the bootloader & flashing a custom recovery in order to flash Superuser or SuperSU packages. See this post for a guide.

Play store devices

Devices bought directly from Google's Play Store apparently do NOT wipe userdata after fastboot oem unlock. So for these devices, method number 2 does not add any security. For more info, read this thread: http://xdaforums.com/showthread.php?t=1650830