"A motion filed by his defense argues the interrogation focused on child sexual abuse material as a pretext for investigating his connections to the protest movement."
So the message was simple: don't protest and you will be not harassed.
And from personal experience, once a border guard is suspicious of you and you're a non-citizen, you're fighting a losing battle to get into that country, regardless of whether you're doing anything shady / illegal.
The most straightforward answer I think is to use common apps for more commonplace social media activities and separate apps that can be removed from your phone when you're crossing a border for things you want to keep private. It's not perfect privacy, but I think a border is one thing that for better or worse you'll need to accept some compromises on.
Again in phone terms, maybe bring a blank phone through that border.