I normally wipe my devices while crossing the border, phone and laptop but one time while I was doing a much shorter round trip, I decided not to wipe my phone.
on my way into Canada, i was identified for enhanced screening at like 10pm, After waiting an hour, the agent asked for my return flight ticket, which I didn't have printed. so it's late, im dangerously close to missing my connection, and I think, "Oh! I probably have the confirmation email on my phone!"
So i pull out my trusty CIA surveillance device, unlock it, and pull up the confirmation email. The agent then takes it directly out of my hands and walks into the back. I don't know how long he was gone (long enough to miss my flight) but when he came back he had a bunch of questions about a girl I had been texting and who had sent me some provocative photos. I don't know that helped Canada's national security but sure, whatever.
To be fair, the US CBP has never taken any devices from me but they do stop me routinely and dump my bag and ask all sorts of ridiculous questions. I used to fight it but now I just sit/stand quietly until they are done. On my latest trip, i guess I was too polite so the agent decided that was suspicious. His face got all twisted as he began asking me the questions.
There are no rights at the border so don't cross with anything.