This is actually two different cases which both made it up to the Supreme Court on a similar issue. The facts were these:
In Riley v. California: Riley (who is a blood) was stopped for driving with an expired license plate, and his license was also suspended. The car was towed, and loaded handguns were found concealed under the hood. Riley was arrested. During a search incident to arrest, a smart phone was found in his pocket. The arresting officer found entries (in the contact list or text messages, the record apparently wasn't all that clear on this) with the label "CK" in front of them. Two hours later, a gangs detective went through the phone at the station. This was basically a fishing expedition for evidence of anything, and evidence they found. Based on some of the pictures and videos, Riley was identified as a gang member and implicated in a shooting a few weeks earlier, and charged with attempted murder. He was sentenced to 15 to life, and he appealed.
In US v. Wurie: Wurie was arrested for selling drugs out of his car. While at the station, he was receiving multiple calls (on a flip phone) from a contact labeled "my house." Police accessed the phone, saw that the home screen was a picture of a woman and a child, and looked at the contact information for "my house." They used a reverse lookup to trace that number to an apartment. When they went to the apartment, Wurie's name was on the mailbox, and through the window they saw a woman who looked like the picture on Wurie's phone. They got a warrant for his apartment, where they found drugs, a gun, and money. Wurie was convicted, but the First Circuit reversed his conviction. The prosecution appealed.
That brings us to the Supreme Court's decision. In reasoning out its decision, the Court reviewed three landmark cases in search incident to arrest: Chimel, Robinson, and Gant. In Chimel, the court recognized police authority to search the area under the immediate control of an arrestee (in this case, the police had far overstepped that boundary and they were getting slapped for it). The rule was already pretty entrenched in common law, but the Court recognized it here and held that it was reasonable because it allows an officer to find an remove weapons that the prisoner may use to attack him, and because it allows an officer to find evidence that the prisoner may attempt to destroy. In Robinson, the Court held that these two risks were inherent in all arrests without need for specific articulation. In other words, it made it clear that search incident to arrest was justified by any custodial arrest, not just one where the police had some specific reason to believe that there were weapons or evidence to be found (in this case, the police searched a cigarette pack that was in an arrested traffic offender's pocket, and found drugs). And in Gant, the Court narrowed the police's authority to search a vehicle incident to arrest. The Court held that the reasoning set forth in Chimel only makes sense in the context of a vehicle when the arrestee is unsecured and within reaching distance of the passenger compartment, but it also created another exception. Gant allows police to search a vehicle incident to arrest when there is reason to believe that evidence of the crime for which the person has been arrested will be found.
The Court also discussed that the reasonableness of a warrantless search is determined by balancing the government interest in the immediacy of the search against the privacy interest at stake. And this line of reasoning becomes a wooden stake in the heart of search incident to arrest as it relates to digital information.
One thing the court makes very clear is that Chimel's reasoning doesn't make sense at all when we're talking about the digital contents of a cell phone. The pictures, call log, videos, messages, and files that are stored in a cell phone can't be used as a weapon against a police officer. In cases where those items are evidence, the arrestee isn't usually in a position to destroy them once you take away the phone. Remote wiping exists, but it's normally something that a third party does or something that is built into the phone itself. That's not the same thing as a prisoner himself destroying evidence the way that Chimel was talking about (and besides, law enforcement can address that by shutting off the phone, taking out the battery, or using a device like a Faraday bag to isolate it from receiving signals).
Since the Chimel reasoning doesn't work here, we're left with balancing interests. Given that there isn't (ordinarily) any real emergency when it comes to reviewing digital information, the government interest in warrantless searches here is slight. On the other hand, the privacy concerns are staggering; a modern cell phone isn't so much a phone as it is a small computer. It either contains or provides remote access to detailed information about almost every aspect of a person's private life. The Court makes an argument that searching through someone's phone might even provide more information about their private affairs and daily activities than searching through their house would.
In light of that, the Court has now ruled that search incident to arrest simply does not apply to data. Digital information isn't immune from search, but you generally need a warrant. Exigent circumstances can still justify a warrantless search (the court mentions hypotheticals like a child abduction case where the suspect's phone is believed to have information about the location of the victim, or text messages to someone who is getting ready to detonate a bomb).