Earlier quoted context omitted.
Just because something is legal doesn't mean it is ethical. The CDC was acting unethically here, though I'm sure they feel everything they do is ethical because they are above question when performing their mission.
Pretty much every cellphone/app user dimension is available for a price on the open market. What you do think Facebook et.al, sells when an app user allows background tracking? Is it unethical to study behavior of the populous? If anything bringing it into a clinical study probably brought more oversight in terms of ethical handling, and aggregation/anonymization of data than the source would provide.
Facebook doesn't sell data. They place ads, but the data stays in-house.