diff options
author | Mike Lockwood <lockwood@android.com> | 2009-05-12 10:52:03 -0400 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2009-05-12 10:52:03 -0400 |
commit | 3681f2614fa8c10560c790f6b4287f65d6fd2663 (patch) | |
tree | e63317d42231df5146a9406efe18ae47208971b1 /location | |
parent | 2677d0da34acad93cd7f164d587ccc30c46facc6 (diff) | |
download | frameworks_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 'location')
-rw-r--r-- | location/java/com/android/internal/location/LocationProviderProxy.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/location/java/com/android/internal/location/LocationProviderProxy.java b/location/java/com/android/internal/location/LocationProviderProxy.java index 80303f4..b40cdca 100644 --- a/location/java/com/android/internal/location/LocationProviderProxy.java +++ b/location/java/com/android/internal/location/LocationProviderProxy.java @@ -21,6 +21,7 @@ import android.location.ILocationProvider; import android.location.Location; import android.location.LocationManager; import android.os.Bundle; +import android.os.IBinder; import android.os.RemoteException; import android.util.Log; @@ -31,7 +32,7 @@ import java.util.List; * * {@hide} */ -public class LocationProviderProxy { +public class LocationProviderProxy implements IBinder.DeathRecipient { private static final String TAG = "LocationProviderProxy"; @@ -39,16 +40,27 @@ public class LocationProviderProxy { private final ILocationProvider mProvider; private boolean mLocationTracking = false; private long mMinTime = 0; + private boolean mDead; public LocationProviderProxy(String name, ILocationProvider provider) { mName = name; mProvider = provider; + try { + provider.asBinder().linkToDeath(this, 0); + } catch (RemoteException e) { + Log.e(TAG, "linkToDeath failed", e); + mDead = true; + } } public String getName() { return mName; } + public boolean isDead() { + return mDead; + } + public boolean requiresNetwork() { try { return mProvider.requiresNetwork(); @@ -231,4 +243,9 @@ public class LocationProviderProxy { Log.e(TAG, "removeListener failed", e); } } + + public void binderDied() { + Log.w(TAG, "Location Provider " + mName + " died"); + mDead = true; + } } |