Some info on password locks and locking your phone:
you should always lock your phone in case you leave it at a bar or on public transit etc. That's all the password is good for... to make sure nobody reads your stuff if they randomly find your phone.
This is of NO use at the border though. They do have devices to bypass the passwords. They usually don't have to do that... the threat of denying you entry, locking you up, and siezing all your stuff including your phone/tablet/car is usually enough to get people to give out their password.
They have a device the size of a small suitcase. It opens up and has about 100 connectors which allow the device to plug into any type of phone. They plug your phone in and bam, they have a copy of all your data. They can then go through it with the device at their leisure. It allows them to preload certain words (escort, gay, underage, etc.) and it can scan your phone for those words in seconds. Better hope you dont have a file called underage-hot-girl.jpg on your phone or you're screwed! Even the word appearing in an email is found very quickly.
If you really want to avoid this hassle, store your stuff in the cloud. Google Drive, Gmail, etc. Then unload the app from your phone if you're really worried. You can store all the porn you want in Google Drive, then just unload or sign out of the G Drive app on your phone before crossing the border.
Another way to avoid detection is what's called "plausible deniability". That means you have a hotmail account with a bunch of emails in it, yet you really use gmail. If you delete the Gmail icon/app, they would normally be suspicious because who has a smartphone with no email? Instead they find the hotmail account with a bunch of innocent messages in it and they dig through that, not knowing you really use gmail.
I have been asked by Canada Customs for my eBay receipt, then I saw the guy go in the back and pull up eBay on the computer and search for all purchases under my username. He was trying to see if I bought a watch, iPhone, set of tires, or anything else I didn't declare. You can bet your ass if I had bought a Gucci watch on eBay (undeclared) and was wearing an identical watch I'd be screwed and/or in jail right now
Don't underestimate these guys. Password lock on your phone is the same as a $5 bike lock on your bike parked in downtown Detroit. It will stop the casual joker/passerby, but anyone who wants to get in will get in within a minute or two....