summaryrefslogtreecommitdiffstats
path: root/packages/FusedLocation
diff options
context:
space:
mode:
Diffstat (limited to 'packages/FusedLocation')
-rw-r--r--packages/FusedLocation/src/com/android/location/fused/FusionEngine.java30
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);
}
}