diff options
| author | 2010-03-02 20:49:47 -0500 | |
|---|---|---|
| committer | 2010-03-02 20:52:46 -0500 | |
| commit | faa7e8363e71cb441bf1cf5f17cb1679d9ced99f (patch) | |
| tree | 4dcf401805f566fe2d0e3efb063f4e5ce538c630 | |
| parent | c018f3cfdd8a8277dbb3b61d4761974862876ab9 (diff) | |
DockObserver: Watch for exceptions in LocationManger.isProviderEnabled().
Change-Id: Ieb9f6b0c20a6ce2223cb4b4956580b8543094c2f
Signed-off-by: Mike Lockwood <lockwood@android.com>
| -rw-r--r-- | services/java/com/android/server/DockObserver.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/services/java/com/android/server/DockObserver.java b/services/java/com/android/server/DockObserver.java index 25ebee459589..547a2a1d42f3 100644 --- a/services/java/com/android/server/DockObserver.java +++ b/services/java/com/android/server/DockObserver.java @@ -421,9 +421,19 @@ class DockObserver extends UEventObserver { } break; case MSG_ENABLE_LOCATION_UPDATES: - if (mLocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { + boolean networkLocationEnabled; + try { + networkLocationEnabled = + mLocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); + } catch (Exception e) { + // we may get IllegalArgumentException if network location provider + // does not exist or is not yet installed. + networkLocationEnabled = false; + } + if (networkLocationEnabled) { mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, - LOCATION_UPDATE_MS, LOCATION_UPDATE_DISTANCE_METER, mLocationListener); + LOCATION_UPDATE_MS, LOCATION_UPDATE_DISTANCE_METER, + mLocationListener); retrieveLocation(); if (mCarModeEnabled && mLocation != null && mNightMode == MODE_NIGHT_AUTO) { try { |