Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6c41fead authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 25519 into eclair

* changes:
  LocationManagerService: Take fix accuracy into account in proximity zone logic.
parents 70db3a20 2d2078aa
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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");