Location updates are requested from the LocationManager directly, which keeps the chosen provider running where a fused provider would pick a cheaper one
What it finds
LocationManager.requestLocationUpdates keeps the GPS or network provider on as asked. The fused location provider of Google Play services combines the sources and saves battery for the same accuracy.
Reported is requestLocationUpdates on a variable declared as LocationManager.
From the rule's source, raw_location_updates.rs.
class Where { void run(LocationManager manager, Object listener) { manager.requestLocationUpdates("gps", 1000, 0, listener);tx0 reports: fused location provider } interface LocationManager { void requestLocationUpdates(String p, long t, float d, Object l); }} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/java:raw-location-updates" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/java:raw-location-updates] reason="..."tx0 explain tx0/java:raw-location-updates shows the same in the terminal. Found a false positive? Report it.