diff options
author | Mike Lockwood <lockwood@android.com> | 2010-07-17 08:21:33 -0400 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2010-07-17 08:21:33 -0400 |
commit | f4d207b1c2212d6e9adc3e7954a8d14c6b9abc51 (patch) | |
tree | 1dc9c49461ae15e7b6787306a49c4b89f278ee62 /location | |
parent | eec69d2923636b2aaa51df93bacc2b3bbb742736 (diff) | |
download | frameworks_base-f4d207b1c2212d6e9adc3e7954a8d14c6b9abc51.zip frameworks_base-f4d207b1c2212d6e9adc3e7954a8d14c6b9abc51.tar.gz frameworks_base-f4d207b1c2212d6e9adc3e7954a8d14c6b9abc51.tar.bz2 |
Don't throw an exception from isProviderEnabled and getLastKnownLocation
if the location provider does not exist. Instead use the same behavior
as if the provider were disabled in settings
(return false for isProviderEnabled and null from getLastKnownLocation).
This eliminates for a lot of exception handling around some simple
queries to the location manager.
BUG: 2841014
Change-Id: I4fbe0c088e915c90969e13083201dd3e7f4029cb
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'location')
-rw-r--r-- | location/java/android/location/LocationManager.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java index 7d07e4b..9ceda7e 100644 --- a/location/java/android/location/LocationManager.java +++ b/location/java/android/location/LocationManager.java @@ -424,8 +424,7 @@ public class LocationManager { * {@link LocationListener#onLocationChanged} method will be called for * each location update * - * @throws IllegalArgumentException if provider is null or doesn't exist - * @throws IllegalArgumentException if listener is null + * @throws IllegalArgumentException if provider or listener is null * @throws RuntimeException if the calling thread has no Looper * @throws SecurityException if no suitable permission is present for the provider. */ @@ -977,7 +976,7 @@ public class LocationManager { * @return true if the provider is enabled * * @throws SecurityException if no suitable permission is present for the provider. - * @throws IllegalArgumentException if provider is null or doesn't exist + * @throws IllegalArgumentException if provider is null */ public boolean isProviderEnabled(String provider) { if (provider == null) { |