Skip to content

Commit ea876cd

Browse files
yingyinghyperb1iss
authored andcommitted
SyncManager: Adjust sync remaining time calculation.
The sync remaining millis is not right if the period is changed, so changed to set the sync remaining millis as period reduce the time since last run. CRs-fixed: 794898 Change-Id: Ic3f9fbdd8963814af7715f0f005114b6c79afa55
1 parent b4d593b commit ea876cd

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

services/core/java/com/android/server/content/SyncManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2435,10 +2435,9 @@ private long scheduleReadyPeriodicSyncs() {
24352435
final long shiftedLastPollTimeAbsolute =
24362436
(0 < lastPollTimeAbsolute - mSyncRandomOffsetMillis) ?
24372437
(lastPollTimeAbsolute - mSyncRandomOffsetMillis) : 0;
2438-
long remainingMillis
2439-
= periodInMillis - (shiftedNowAbsolute % periodInMillis);
24402438
long timeSinceLastRunMillis
24412439
= (nowAbsolute - lastPollTimeAbsolute);
2440+
long remainingMillis = periodInMillis - timeSinceLastRunMillis;
24422441
// Schedule this periodic sync to run early if it's close enough to its next
24432442
// runtime, and far enough from its last run time.
24442443
// If we are early, there will still be time remaining in this period.

0 commit comments

Comments
 (0)