A police officer certainly may want you to unlock your phone if they are arresting you for an alleged crime. Say that they accuse you of selling drugs or stolen goods. They may want to look at direct social media messages or text messages on your phone to find out who you were selling to.
Usually, the officer is going to need your consent to unlock the phone or they are going to need a search warrant. They cannot force you to do it without the warrant. They first have to get probable cause, demonstrate to a judge that the court order is necessary, receive the search warrant and then properly execute that warrant to get you to unlock your device. They cannot just force you to tell them the numerical code during the arrest.
Will they even need your phone?
One thing to keep in mind, though, is that the police officer may not even need your phone at all. There is a chance that they could recover the information they want elsewhere.
For instance, perhaps they are interested in your location data or want to see a record of the phone calls that you have made. Your cellphone provider already has all that information, so the police may be able to get it from them, rather than unlocking your device.
Similarly, some information is stored on cloud servers, such as social media messages. Even if you refuse to unlock your phone and the officer cannot get a search warrant for the device, they may be able to get the information they need from the social media company.
Your defense options
It is becoming more and more common for criminal cases to involve digital evidence. This can be complicated, so it is crucial that you understand all of your legal defense options at this time.



