summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2009-05-12 10:52:03 -0400
committerMike Lockwood <lockwood@android.com>2009-05-12 10:52:03 -0400
commit3681f2614fa8c10560c790f6b4287f65d6fd2663 (patch)
treee63317d42231df5146a9406efe18ae47208971b1 /services
parent2677d0da34acad93cd7f164d587ccc30c46facc6 (diff)
downloadframeworks_base-3681f2614fa8c10560c790f6b4287f65d6fd2663.zip
frameworks_base-3681f2614fa8c10560c790f6b4287f65d6fd2663.tar.gz
frameworks_base-3681f2614fa8c10560c790f6b4287f65d6fd2663.tar.bz2
LocationManager: Recover if process containing NetworkLocation provider crashes
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/LocationManagerService.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index 14c834b..05888e0 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -215,8 +215,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
public int hashCode() {
return mKey.hashCode();
}
-
-
+
@Override
public String toString() {
if (mListener != null) {
@@ -611,6 +610,17 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
}
synchronized (mLock) {
+ // check to see if we are reinstalling a dead provider
+ LocationProviderProxy oldProvider = mProvidersByName.get(name);
+ if (oldProvider != null) {
+ if (oldProvider.isDead()) {
+ Log.d(TAG, "replacing dead provider");
+ removeProvider(oldProvider);
+ } else {
+ throw new IllegalArgumentException("Provider \"" + name + "\" already exists");
+ }
+ }
+
LocationProviderProxy proxy = new LocationProviderProxy(name, provider);
addProvider(proxy);
updateProvidersLocked();
@@ -1616,6 +1626,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
mCollector.updateLocation(location);
} catch (RemoteException e) {
Log.w(TAG, "mCollector.updateLocation failed");
+ mCollector = null;
}
}
@@ -1750,6 +1761,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
variant, appName, addrs);
} catch (RemoteException e) {
Log.e(TAG, "getFromLocation failed", e);
+ mGeocodeProvider = null;
}
}
return null;
@@ -1768,6 +1780,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
maxResults, language, country, variant, appName, addrs);
} catch (RemoteException e) {
Log.e(TAG, "getFromLocationName failed", e);
+ mGeocodeProvider = null;
}
}
return null;