aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Mertz <scott@cyngn.com>2015-03-10 16:42:55 -0700
committerScott Mertz <scott@cyngn.com>2015-03-12 00:04:42 +0000
commit47b01d6674022b1b5e3696af9d42625f15a9aeeb (patch)
treef68bbed14f370c4fc6f7b222fd9940e674d2b578
parentdf474e4cab391b05b23d12d40940cd91591589a0 (diff)
downloadandroid_packages_apps_LockClock-stable/cm-12.0-YNG1TA.tar.gz
android_packages_apps_LockClock-stable/cm-12.0-YNG1TA.tar.bz2
android_packages_apps_LockClock-stable/cm-12.0-YNG1TA.zip
LockClock: Ignore "inaccurate" locationsstable/cm-12.0-YNG1TA
- Location manager can report locations for any level of accuracy. Filter locations that are generally not useful. - Set location accuracy threshold to 50km. Change-Id: I225ed4e74edec6c5089d886c61f8d78f09b11b34 (cherry picked from commit f1da736e118eb3d4160170c4ae572174186961b2)
-rw-r--r--src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java b/src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java
index 662bab4..a228ec7 100644
--- a/src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java
+++ b/src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java
@@ -58,6 +58,7 @@ public class WeatherUpdateService extends Service {
private static final long LOCATION_REQUEST_TIMEOUT = 5L * 60L * 1000L; // request for at most 5 minutes
private static final long OUTDATED_LOCATION_THRESHOLD_MILLIS = 10L * 60L * 1000L; // 10 minutes
+ private static final float LOCATION_ACCURACY_THRESHOLD_METERS = 50000;
private WeatherUpdateTask mTask;
@@ -169,6 +170,11 @@ public class WeatherUpdateService extends Service {
Location location = lm.getLastKnownLocation(LocationManager.PASSIVE_PROVIDER);
if (D) Log.v(TAG, "Current location is " + location);
+ if (location != null && location.getAccuracy() > LOCATION_ACCURACY_THRESHOLD_METERS) {
+ if (D) Log.d(TAG, "Ignoring inaccurate location");
+ location = null;
+ }
+
// If lastKnownLocation is not present (because none of the apps in the
// device has requested the current location to the system yet) or outdated,
// then try to get the current location use the provider that best matches the criteria.