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

Commit a351e48b authored by Yu-Han Yang's avatar Yu-Han Yang
Browse files

Drop locations with invalid lat or lng

Bug: 280493091
Test: on Cuttlefish
Change-Id: I0c244a27bbfcb0d78f3b0d7360a152c74e3a0b0c
parent e27cec1e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -890,6 +890,15 @@ public class LocationProviderManager extends

                        @Override
                        public boolean test(Location location) {
                            if (Double.isNaN(location.getLatitude()) || location.getLatitude() < -90
                                    || location.getLatitude() > 90
                                    || Double.isNaN(location.getLongitude())
                                    || location.getLongitude() < -180
                                    || location.getLongitude() > 180) {
                                Log.e(TAG, mName + " provider registration " + getIdentity()
                                        + " dropped delivery - invalid latitude or longitude.");
                                return false;
                            }
                            if (mPreviousLocation != null) {
                                // check fastest interval
                                long deltaMs = location.getElapsedRealtimeMillis()