diff options
author | Soonil Nagarkar <sooniln@google.com> | 2015-01-28 16:51:25 -0800 |
---|---|---|
committer | Soonil Nagarkar <sooniln@google.com> | 2015-01-28 16:55:01 -0800 |
commit | 55fc40cbb7e7d3ef1bda96109d5ed005fef72f85 (patch) | |
tree | e705761683b87f94a5adbd6c04e205ee25ae14ae /packages | |
parent | 8bd95f16235fccbcdcaf102fea56b4c436827527 (diff) | |
download | frameworks_base-55fc40cbb7e7d3ef1bda96109d5ed005fef72f85.zip frameworks_base-55fc40cbb7e7d3ef1bda96109d5ed005fef72f85.tar.gz frameworks_base-55fc40cbb7e7d3ef1bda96109d5ed005fef72f85.tar.bz2 |
Fix FusionEngine so it isn't confused by location providers enabling/disabling.
Bug: 18900529
Change-Id: I80ebf9e0482148897eb943b44bf711577b6dcf7a
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); } } |