diff options
author | Victoria Lease <violets@google.com> | 2013-10-13 12:15:40 -0700 |
---|---|---|
committer | Victoria Lease <violets@google.com> | 2013-10-13 12:15:40 -0700 |
commit | b30f38383e4691bf23311f62649aa504832731db (patch) | |
tree | a76acadffd2e70c248cc8e7005a98088952d0f6b /packages/FusedLocation | |
parent | d38b1302b7506ae7eef6c6680228c0f07f6e1895 (diff) | |
download | frameworks_base-b30f38383e4691bf23311f62649aa504832731db.zip frameworks_base-b30f38383e4691bf23311f62649aa504832731db.tar.gz frameworks_base-b30f38383e4691bf23311f62649aa504832731db.tar.bz2 |
do not request location from unavailable providers
This commit prevents a system_server crash when applications attempt
to use the fused location provider on systems that do not have a
network location provider available.
Bug: 10845061
Change-Id: I85b33806e05566e8b68ee2ccc401b1c565fd7b9a
Diffstat (limited to 'packages/FusedLocation')
-rw-r--r-- | packages/FusedLocation/src/com/android/location/fused/FusionEngine.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java b/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java index 4ba6c34..7cee066 100644 --- a/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java +++ b/packages/FusedLocation/src/com/android/location/fused/FusionEngine.java @@ -131,14 +131,16 @@ public class FusionEngine implements LocationListener { private void enableProvider(String name, long minTime) { ProviderStats stats = mStats.get(name); - 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.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); + } } } |