The fact that both of these companies have CEOs that would like to keep their jobs would suffice. Any CEO that would try to exit a country of size and importance of Brazil in the name of "not following local laws" where local laws are about protecting locals from spying will be gone next day.
That goes even for Google. This isn't "we're protecting users (actually protecting our source code from being stolen)".
1. Brazil's around 3% of global GDP. Important, yes. Absolutely vital, no.
2. Gone the next day? That's funny. Have you looked at Google's ownership structure lately? Brin and Page control a majority of the vote by themselves. Keep them happy, and it doesn't matter what any other shareholder thinks.
"The one charm of marriage is that it makes a life of deception a neccessity." - Oscar Wilde