> there is no distinction between hiding a secret compartment in your luggage and a device
Is it really illegal to have a secret compartment in your luggage? I mean, I have no doubt it's highly risky and that they will make the case you've done something wrong, but have you inherently done something illegal by merely having a secret compartment? Maybe only if you've explicitly represented that there are no other compartments? Or you've got contraband in there, or something else they've explicitly inquired about that you claimed you don't have? (But that's more about lying or existing laws, than the compartment itself.)
If you turned over your phone for inspection and could see they were looking in an app you don't use, are you committing a felony to not volunteer that they should look in the other browser for your real history or whatever? If having two profiles and only providing one is illegal, what about having two phones? (like your "real" one in your luggage, turned off.) Do I have to volunteer that when they asked for "my phone" that I actually have multiple? What if I kept the "real" one at home -- do I have to tell them the one they're looking at is only a subset of my property and doesn't represent what they probably actually meant when they asked for "my phone"?
I'm not entirely sure where "the lines" are here, but perhaps the passcode is part of it. Once they require that, they've crossed from dealing with physical items physically crossing the border, passing into things that are in your mind or physically located elsewhere. If they can require a lockscreen code, there's not really any reason they can't require every other password since those are "secret compartments" accessible from your phone, and if just having an undisclosed compartment really is illegal, I guess you'd better volunteer an exhaustive list of all your accounts...