I agree with you, you can’t know for sure that you’re with a good or bad cop.
But you also have to comply with laws if you don’t want to get in trouble.
I can only answer for my country and I can tell you that here you’re gonna waste way less time if you show what’s in your phone and we can see that you’re innocent.
The time not wasted there might also be used to catch the person who’s really guilty.
I’ll just give you an example even if it’s not reated to unlocking phones: A black BMW 335i is filmed hitting a pedestrian and the plate number finishes with a 5. We’re gonna need to have a look at every BMW within these parameters. If you prevent the police from checking your car by hiding it, a guilty guy might have more time to hide his car and a crime is gonna go unpunished, leaving a victim with no one to pay for his injuries.
Of course, that reality might be different elsewhere. It’s just that I have noticed that on Lemmy cops are only seen as bad guys when, in my case, I spend a lot of time helping people.