US government allowed and even helped US firms sell tech used for surveillance in China, AP finds