Isnt that standard procedure in Australia? I watched a few Border Security: Australia's Front Line episodes and I remember seeing them take someones phone and text/call few listed contacts pretending to be the user. Australian border as a whole is very communist Russia/East Berlin like, papers, where are ze nuts? who do you know? why do you come here to terk urr jerbs? and obligatory 'are you a criminal?', as if they still only let criminals in (btw they really dont like this joke).
"During the time he was detained and searched, the man said he was asked weird questions including how many times a day he prayed? Was his family religious? And did they have a lot of money?"
Things like that make me laugh and cry. The goverments are insane (I don't mean people, I mean the system they create).
Free advice you won't take until it happens to you. The way you travel with anything that you want to keep or not have examined is to send it to yourself instead. It's inconvenient but so is having to spend 2h hours at the airport yet you're not trying to circumvent that problem and just put up with it.