Merge "Fix bug in NetworkTimeUpdateService" am: aca3aa1748 am: ac9139a6f7 am: a9120ace60

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1999011

Change-Id: I01d4031236074ae72e2e168d81cbebc376df3f14
This commit is contained in:
Kanyinsola Fapohunda
2022-03-01 12:18:53 +00:00
committed by Automerger Merge Worker

View File

@@ -171,7 +171,9 @@ public class NetworkTimeUpdateService extends Binder {
>= mPollingIntervalMs) { >= mPollingIntervalMs) {
if (DBG) Log.d(TAG, "Stale NTP fix; forcing refresh"); if (DBG) Log.d(TAG, "Stale NTP fix; forcing refresh");
boolean isSuccessful = mTime.forceRefresh(); boolean isSuccessful = mTime.forceRefresh();
if (!isSuccessful) { if (isSuccessful) {
mTryAgainCounter = 0;
} else {
String logMsg = "forceRefresh() returned false: cachedNtpResult=" + cachedNtpResult String logMsg = "forceRefresh() returned false: cachedNtpResult=" + cachedNtpResult
+ ", currentElapsedRealtimeMillis=" + currentElapsedRealtimeMillis; + ", currentElapsedRealtimeMillis=" + currentElapsedRealtimeMillis;
@@ -188,7 +190,8 @@ public class NetworkTimeUpdateService extends Binder {
&& cachedNtpResult.getAgeMillis(currentElapsedRealtimeMillis) && cachedNtpResult.getAgeMillis(currentElapsedRealtimeMillis)
< mPollingIntervalMs) { < mPollingIntervalMs) {
// Obtained fresh fix; schedule next normal update // Obtained fresh fix; schedule next normal update
resetAlarm(mPollingIntervalMs); resetAlarm(mPollingIntervalMs
- cachedNtpResult.getAgeMillis(currentElapsedRealtimeMillis));
// Suggest the time to the time detector. It may choose use it to set the system clock. // Suggest the time to the time detector. It may choose use it to set the system clock.
TimestampedValue<Long> timeSignal = new TimestampedValue<>( TimestampedValue<Long> timeSignal = new TimestampedValue<>(