And while AT&T doesn’t seem to have done this, other companies such as Apple have enacted privacy measures which directly contravene the stated wishes of the government - but which are legal.
In China, I believe the way it works is, whatever the government wants becomes legal. The US is far from perfect but the rule of law exists here to some degree.