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

Commit a326b418 authored by Gokula's avatar Gokula Committed by Steve Kondik
Browse files

GPS: GpsLocationProvider is changed to accept NTP time always

The logic is changed within GpsLocationProvider to accept NTP time
irrespective of the system time. This is because NTP time is guranteed
to be accurate and system time may or not be accurate depending on
whether the phone is camped on the network or not. This results in the
GPS engine getting the best estimate of time always.

CRs-Fixed : 242488

Change-Id: I4fe8847ad0619d3e3f2a7db5d2fb5f90c54320e6
parent d922d1bd
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ public class GpsLocationProvider implements LocationProviderInterface {

    private static final String TAG = "GpsLocationProvider";

    private static final boolean DEBUG = false;
    private static final boolean DEBUG = true;
    private static final boolean VERBOSE = false;

    /**
@@ -500,15 +500,16 @@ public class GpsLocationProvider implements LocationProviderInterface {
                    + " certainty: " + certainty
                    + " system time offset: " + systemTimeOffset);

            // sanity check NTP time and do not use if it is too far from system time
            // sanity check NTP time
            if (systemTimeOffset < 0) {
                systemTimeOffset = -systemTimeOffset;
            }
            if (systemTimeOffset < MAX_NTP_SYSTEM_TIME_OFFSET) {
                native_inject_time(time, timeReference, certainty);
            } else {

            if (systemTimeOffset > MAX_NTP_SYSTEM_TIME_OFFSET) {
                Log.e(TAG, "NTP time differs from system time by " + systemTimeOffset
                        + "ms.  Ignoring.");
                        + ".Injecting NTP time anyway as it is guranteed to be accurate.");

            }
            delay = NTP_INTERVAL;
        } else {