Loading services/java/com/android/server/content/SyncOperation.java +11 −12 Original line number Original line Diff line number Diff line Loading @@ -304,8 +304,9 @@ public class SyncOperation implements Comparable { } } /** /** * If two SyncOperation intervals are disjoint, the smaller is the interval that occurs before. * SyncOperations are sorted based on their earliest effective run time. * If the intervals overlap, the two are considered equal. * This comparator is used to sort the SyncOps at a given time when * deciding which to run, so earliest run time is the best criteria. */ */ @Override @Override public int compareTo(Object o) { public int compareTo(Object o) { Loading @@ -313,17 +314,15 @@ public class SyncOperation implements Comparable { if (expedited != other.expedited) { if (expedited != other.expedited) { return expedited ? -1 : 1; return expedited ? -1 : 1; } } long x1 = effectiveRunTime - flexTime; long thisIntervalStart = Math.max(effectiveRunTime - flexTime, 0); long y1 = effectiveRunTime; long otherIntervalStart = Math.max( long x2 = other.effectiveRunTime - other.flexTime; other.effectiveRunTime - other.flexTime, 0); long y2 = other.effectiveRunTime; if (thisIntervalStart < otherIntervalStart) { // Overlapping intervals. if ((x1 <= y2 && x1 >= x2) || (x2 <= y1 && x2 >= x1)) { return 0; } if (x1 < x2 && y1 < x2) { return -1; return -1; } } else if (otherIntervalStart < thisIntervalStart) { return 1; return 1; } else { return 0; } } } } } Loading
services/java/com/android/server/content/SyncOperation.java +11 −12 Original line number Original line Diff line number Diff line Loading @@ -304,8 +304,9 @@ public class SyncOperation implements Comparable { } } /** /** * If two SyncOperation intervals are disjoint, the smaller is the interval that occurs before. * SyncOperations are sorted based on their earliest effective run time. * If the intervals overlap, the two are considered equal. * This comparator is used to sort the SyncOps at a given time when * deciding which to run, so earliest run time is the best criteria. */ */ @Override @Override public int compareTo(Object o) { public int compareTo(Object o) { Loading @@ -313,17 +314,15 @@ public class SyncOperation implements Comparable { if (expedited != other.expedited) { if (expedited != other.expedited) { return expedited ? -1 : 1; return expedited ? -1 : 1; } } long x1 = effectiveRunTime - flexTime; long thisIntervalStart = Math.max(effectiveRunTime - flexTime, 0); long y1 = effectiveRunTime; long otherIntervalStart = Math.max( long x2 = other.effectiveRunTime - other.flexTime; other.effectiveRunTime - other.flexTime, 0); long y2 = other.effectiveRunTime; if (thisIntervalStart < otherIntervalStart) { // Overlapping intervals. if ((x1 <= y2 && x1 >= x2) || (x2 <= y1 && x2 >= x1)) { return 0; } if (x1 < x2 && y1 < x2) { return -1; return -1; } } else if (otherIntervalStart < thisIntervalStart) { return 1; return 1; } else { return 0; } } } } }