The Fourth Amendment codified the Founders' understanding of what was required to contain thuggery by the state. The role of the cop was to search to collect evidence, and the Fourth Amendment made sure that such searches couldn’t take place “unreasonably”. The "Spook" role, searching to collect information, is a more recent development.
United States v. Montoya de Hernandez (4), which took place in the escalation of the “war on drugs” relied on Carroll and Ramsey and distinguished between “routine” and “nonroutine” searches. While declining to clarify exactly what fell in each category the Court found that for a routine search of persons and effects no reasonable suspicion, probable cause or warrant was required, whereas for a more intrusive nonroutine search some level of suspicion was required.
Last September the ACLU filed Alasaad v. Nielsen challenging the constitutionality of the border searches of electronic devices belonging to 11 travelers, including journalists, under the First and Fourth Amendments (ten US citizens and a lawful permanent resident). The government's motion to dismiss was rejected in early May 2018. The Court said that while the border may be different to the interior of a country Riley (and Wurie (9)) indicate that electronic device searches are, categorically, more intrusive than searches of one's person or effects.(10) The Court also found a plausible First Amendment claim: unlike in Ramsey there are no First Amendment safeguards in the CBP (and ICE) electronic device policies that permit suspicionless searches in pursuit of "information".(11)
It is up to the traveler to take measures to protect their data while they cross the border. However, if you have nothing stored locally on your devices or you cannot produce a functioning passcode, you may well have created the suspicion/concern required for the forensic search which could lead to the detention of the device. This makes it more important to understand technical ways to keep bits secure and make the device an empty disposable container.
Notes
1 : See Act of July 31, 1789, ch. 5 §§ 23 – 24, 1 Stat. 29, 43
2 : Carrol v. United States, 267 U.S. 132 (1935)
3 : United States v. Ramsey, 431 U.S. 606 (1977)
4 : United States v. Montoya de Hernandez, 473 U.S. 531 (1985)
5 : Matthew B Kugler, "The Perceived Intrusiveness of Searching Electronic Devices at the Border: An Empirical Study" (2014) 81:3 U Chicago L Rev 1165, 1209
6 : United States v. Flores-Montano, 541 U.S. 149, 152 (2004)
7 : United States v. Jones, 132 S. Ct. 945 (2012).
8 : Riley v. California, 134 S. Ct 2473 (2014)
9 : United States v. Wurie, 728 F.3d 1 (2013)
10 : Alasaad v. Nielsen, 2018 U.S. Dist. LEXIS 78783, 43 to 45
11 : reference to Directive paragraph 5.1.3. In Ramsey the Supreme Court held that the statutory scheme permitting warrantless search of incoming international mail did not violate the constitution because it applied only when there was reason to believe the envelopes contained physical items and regulations flatly prohibited, under all circumstances, customs officials from reading correspondence without a warrant Ramsey, 431 U.S. at 623