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

Commit fdc57230 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Persist/pacel # of periodic syncs properly.

(Note it shouldn't be persisting parceled data in the first place.  There's
already a bug filed for that.)

Bug 63935632
Test: manaul test

Change-Id: I5385caa6cd0663c7e13db0256b2c1027abe6c3a1
parent 7b3bd1d5
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ import java.util.ArrayList;
public class SyncStatusInfo implements Parcelable {
    private static final String TAG = "Sync";

    static final int VERSION = 3;
    static final int VERSION = 4;

    private static final int MAX_EVENT_COUNT = 10;

@@ -102,6 +102,7 @@ public class SyncStatusInfo implements Parcelable {
            parcel.writeLong(mLastEventTimes.get(i));
            parcel.writeString(mLastEvents.get(i));
        }
        parcel.writeInt(numSourcePeriodic);
    }

    public SyncStatusInfo(Parcel parcel) {
@@ -146,6 +147,16 @@ public class SyncStatusInfo implements Parcelable {
                }
            }
        }
        if (version < 4) {
            // Before version 4, numSourcePeriodic wasn't persisted.
            numSourcePeriodic = numSyncs - numSourceLocal - numSourcePoll - numSourceServer
                    - numSourceUser;
            if (numSourcePeriodic < 0) { // Sanity check.
                numSourcePeriodic = 0;
            }
        } else {
            numSourcePeriodic = parcel.readInt();
        }
    }

    public SyncStatusInfo(SyncStatusInfo other) {