Merge "Change currentTimeMillis to elapsedRealtime" into oc-dev

This commit is contained in:
TreeHugger Robot
2017-05-18 19:25:53 +00:00
committed by Android (Google) Code Review

View File

@@ -937,7 +937,7 @@ public class GnssLocationProvider implements LocationProviderInterface {
long time = mNtpTime.getCachedNtpTime(); long time = mNtpTime.getCachedNtpTime();
long timeReference = mNtpTime.getCachedNtpTimeReference(); long timeReference = mNtpTime.getCachedNtpTimeReference();
long certainty = mNtpTime.getCacheCertainty(); long certainty = mNtpTime.getCacheCertainty();
long now = System.currentTimeMillis(); long now = SystemClock.elapsedRealtime();
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "NTP server returned: " Log.d(TAG, "NTP server returned: "
@@ -1444,7 +1444,8 @@ public class GnssLocationProvider implements LocationProviderInterface {
// reset SV count to zero // reset SV count to zero
updateStatus(LocationProvider.TEMPORARILY_UNAVAILABLE, 0); updateStatus(LocationProvider.TEMPORARILY_UNAVAILABLE, 0);
mFixRequestTime = System.currentTimeMillis(); mFixRequestTime = SystemClock.elapsedRealtime();
if (!hasCapability(GPS_CAPABILITY_SCHEDULING)) { if (!hasCapability(GPS_CAPABILITY_SCHEDULING)) {
// set timer to give up if we do not receive a fix within NO_FIX_TIMEOUT // set timer to give up if we do not receive a fix within NO_FIX_TIMEOUT
// and our fix interval is not short // and our fix interval is not short
@@ -1514,7 +1515,7 @@ public class GnssLocationProvider implements LocationProviderInterface {
} }
} }
mLastFixTime = System.currentTimeMillis(); mLastFixTime = SystemClock.elapsedRealtime();
// report time to first fix // report time to first fix
if (mTimeToFirstFix == 0 && hasLatLong) { if (mTimeToFirstFix == 0 && hasLatLong) {
mTimeToFirstFix = (int)(mLastFixTime - mFixRequestTime); mTimeToFirstFix = (int)(mLastFixTime - mFixRequestTime);
@@ -1629,7 +1630,7 @@ public class GnssLocationProvider implements LocationProviderInterface {
updateStatus(mStatus, usedInFixCount); updateStatus(mStatus, usedInFixCount);
if (mNavigating && mStatus == LocationProvider.AVAILABLE && mLastFixTime > 0 && if (mNavigating && mStatus == LocationProvider.AVAILABLE && mLastFixTime > 0 &&
System.currentTimeMillis() - mLastFixTime > RECENT_FIX_TIMEOUT) { SystemClock.elapsedRealtime() - mLastFixTime > RECENT_FIX_TIMEOUT) {
// send an intent to notify that the GPS is no longer receiving fixes. // send an intent to notify that the GPS is no longer receiving fixes.
Intent intent = new Intent(LocationManager.GPS_FIX_CHANGE_ACTION); Intent intent = new Intent(LocationManager.GPS_FIX_CHANGE_ACTION);
intent.putExtra(LocationManager.EXTRA_GPS_ENABLED, false); intent.putExtra(LocationManager.EXTRA_GPS_ENABLED, false);