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

Commit afa81a58 authored by yingying's avatar yingying Committed by Gerrit - the friendly Code Review server
Browse files

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
parent 6e7671c1
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -2242,10 +2242,9 @@ public class SyncManager {
                    final long shiftedLastPollTimeAbsolute =
                            (0 < lastPollTimeAbsolute - mSyncRandomOffsetMillis) ?
                                    (lastPollTimeAbsolute - mSyncRandomOffsetMillis) : 0;
                    long remainingMillis
                        = periodInMillis - (shiftedNowAbsolute % periodInMillis);
                    long timeSinceLastRunMillis
                        = (nowAbsolute - lastPollTimeAbsolute);
                    long remainingMillis = periodInMillis - timeSinceLastRunMillis;
                    // Schedule this periodic sync to run early if it's close enough to its next
                    // runtime, and far enough from its last run time.
                    // If we are early, there will still be time remaining in this period.