Does a US Citizen have to comply?
In practice, courts have generally allowed manual, cursory searches of electronic devices (such as looking at recent photos) as being similar to a search of luggage. However, courts have disagreed on how intrusive the search can be and whether a more invasive search at the border can be conducted without some additional suspicion.
https://www.americanbar.org/groups/business_law/publications...
Do one of these things at the beginning of any custodial situation.