This happened to me driving from the US into Canada with my significant other on a short vacation. After some routine questioning, the agent asked for our phones and passwords. Naturally, I hesitated and wanted to know why he needed to go through our phones. He didn't give a reason, but said if I refuse they'd hold us until their forensics team cracks the phone password anyway. I wanted to make a bigger deal about it…
I really think these are dangerous times and for some reason I only ever expected this from the US but never from Canada or New Zealand.