Merge change 25519 into eclair
* changes: LocationManagerService: Take fix accuracy into account in proximity zone logic.
This commit is contained in:
@@ -1069,13 +1069,13 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
|
||||
return mIntent;
|
||||
}
|
||||
|
||||
boolean isInProximity(double latitude, double longitude) {
|
||||
boolean isInProximity(double latitude, double longitude, float accuracy) {
|
||||
Location loc = new Location("");
|
||||
loc.setLatitude(latitude);
|
||||
loc.setLongitude(longitude);
|
||||
|
||||
double radius = loc.distanceTo(mLocation);
|
||||
return radius <= mRadius;
|
||||
return radius <= Math.max(mRadius,accuracy);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1115,6 +1115,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
|
||||
long now = System.currentTimeMillis();
|
||||
double latitude = loc.getLatitude();
|
||||
double longitude = loc.getLongitude();
|
||||
float accuracy = loc.getAccuracy();
|
||||
ArrayList<PendingIntent> intentsToRemove = null;
|
||||
|
||||
for (ProximityAlert alert : mProximityAlerts.values()) {
|
||||
@@ -1124,7 +1125,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
|
||||
if ((expiration == -1) || (now <= expiration)) {
|
||||
boolean entered = mProximitiesEntered.contains(alert);
|
||||
boolean inProximity =
|
||||
alert.isInProximity(latitude, longitude);
|
||||
alert.isInProximity(latitude, longitude, accuracy);
|
||||
if (!entered && inProximity) {
|
||||
if (LOCAL_LOGV) {
|
||||
Log.v(TAG, "Entered alert");
|
||||
|
||||
Reference in New Issue
Block a user