The ACLU says Americans can refuse to give CBP agents their passwords, but at the risk of being detained and having their devices taken from them. Foreign travelers can be denied access to the country if they refuse to comply.
To be very clear, this isn’t Increasing because of Trump, it is just increasing over the past few years.
What would you do in this situation? as much as i hate it, i would probably cave and give over whatever they want after an initial protest/insiting on my right to not hand it over. No one wants to have their travel plans ruined and get stuck at the border.