I think this is my first-ever comment on HN, and I'm basically just chiming in to say that under no circumstances should you even be talking to police in a situation like this. You can politely ask for a lawyer, politely ask if you're being detained and politely provide your basic information when asked like your name and address, but otherwise do not say anything at all.
This fantasy that you can get away from a situation in which you are being interrogated and your phone is being searched by being compliant and proving your innocence to the nice police officers is extremely dangerous. Being compliant and providing information beyond what's legally required is the exact opposite of what you want to do, and preventing yourself from being charged should be the last thing on your mind. You should take it as a given that you will be charged.
edit: If you're outside the USA ignore this advice and listen to someone more local who knows their stuff.