I watch Border Security, which shows Canadian border officials at land crossings and airports. They show the officers in secondary looking through people’s phones very frequently. (Typically their lies fall apart because they have all these texts and emails about what they are going to do when they get to Canada, and once shown these emails or texts they abandon their cover story.) There was one episode where a returning Canadian absolutely refused to provide his password and got super irate, demanding a written copy of the law that allowed them to ask for it. They gave him a printout (I didn’t read it, but I presume it was of the relevant law) and he reluctantly signed them in to the laptop.
What’s more, this is not a case of you signing in and them telling you to click stuff. They take the phone or laptop away out of your sight and poke around in it. Gives me the chills, really. But as this answer to a similar question says, basically every country can do this, though the chances of them doing so are very low.
Credit:stackoverflow.com‘