diff options
author | Soonil Nagarkar <sooniln@google.com> | 2015-01-29 21:58:52 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-01-29 21:58:55 +0000 |
commit | 9f74b337b0fff087addf3d3f0792cd4321cf5198 (patch) | |
tree | f9507a9b9e56be3962efb50dc2670e4991440e70 /packages | |
parent | 81f63a60f3db45fcadc5c223dbafe9349c1b57f9 (diff) | |
parent | 55fc40cbb7e7d3ef1bda96109d5ed005fef72f85 (diff) | |
download | frameworks_base-9f74b337b0fff087addf3d3f0792cd4321cf5198.zip frameworks_base-9f74b337b0fff087addf3d3f0792cd4321cf5198.tar.gz frameworks_base-9f74b337b0fff087addf3d3f0792cd4321cf5198.tar.bz2 |
Merge "Fix FusionEngine so it isn't confused by location providers enabling/disabling."
Diffstat (limited to 'packages')
-rw-r--r-- | packages/FusedLocation/src/com/android/location/fused/FusionEngine.java | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java b/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java index 7cee066..5e9ec10 100644 --- a/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java +++ b/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java @@ -97,14 +97,18 @@ public class FusionEngine implements LocationListener { /** Called on mLooper thread */ public void enable() { - mEnabled = true; - updateRequirements(); + if (!mEnabled) { + mEnabled = true; + updateRequirements(); + } } /** Called on mLooper thread */ public void disable() { - mEnabled = false; - updateRequirements(); + if (mEnabled) { + mEnabled = false; + updateRequirements(); + } } /** Called on mLooper thread */ @@ -131,16 +135,14 @@ public class FusionEngine implements LocationListener { private void enableProvider(String name, long minTime) { ProviderStats stats = mStats.get(name); - if (stats.available) { - if (!stats.requested) { - stats.requestTime = SystemClock.elapsedRealtime(); - stats.requested = true; - stats.minTime = minTime; - mLocationManager.requestLocationUpdates(name, minTime, 0, this, mLooper); - } else if (stats.minTime != minTime) { - stats.minTime = minTime; - mLocationManager.requestLocationUpdates(name, minTime, 0, this, mLooper); - } + if (!stats.requested) { + stats.requestTime = SystemClock.elapsedRealtime(); + stats.requested = true; + stats.minTime = minTime; + mLocationManager.requestLocationUpdates(name, minTime, 0, this, mLooper); + } else if (stats.minTime != minTime) { + stats.minTime = minTime; + mLocationManager.requestLocationUpdates(name, minTime, 0, this, mLooper); } } |