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

Commit fd0082b7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Move reading time field to inside HistoryItem.readFromParcel()."

parents c3b38a55 cb996104
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -1554,7 +1554,10 @@ public abstract class BatteryStats implements Parcelable {
        }
    }

    public final static class HistoryItem implements Parcelable {
    /**
     * Battery history record.
     */
    public static final class HistoryItem {
        public HistoryItem next;

        // The time of this event in milliseconds, as per SystemClock.elapsedRealtime().
@@ -1789,16 +1792,10 @@ public abstract class BatteryStats implements Parcelable {
        public HistoryItem() {
        }

        public HistoryItem(long time, Parcel src) {
            this.time = time;
            numReadInts = 2;
        public HistoryItem(Parcel src) {
            readFromParcel(src);
        }

        public int describeContents() {
            return 0;
        }

        public void writeToParcel(Parcel dest, int flags) {
            dest.writeLong(time);
            int bat = (((int)cmd)&0xff)
@@ -1835,6 +1832,7 @@ public abstract class BatteryStats implements Parcelable {

        public void readFromParcel(Parcel src) {
            int start = src.dataPosition();
            time = src.readLong();
            int bat = src.readInt();
            cmd = (byte)(bat&0xff);
            batteryLevel = (byte)((bat>>8)&0xff);
+3 −6
Original line number Diff line number Diff line
@@ -3478,10 +3478,8 @@ public class BatteryStatsImpl extends BatteryStats {
        if (deltaTimeToken < DELTA_TIME_ABS) {
            cur.time += deltaTimeToken;
        } else if (deltaTimeToken == DELTA_TIME_ABS) {
            cur.time = src.readLong();
            cur.numReadInts += 2;
            if (DEBUG) Slog.i(TAG, "READ DELTA: ABS time=" + cur.time);
            cur.readFromParcel(src);
            if (DEBUG) Slog.i(TAG, "READ DELTA: ABS time=" + cur.time);
            return;
        } else if (deltaTimeToken == DELTA_TIME_INT) {
            int delta = src.readInt();
@@ -13459,9 +13457,8 @@ public class BatteryStatsImpl extends BatteryStats {
            return;
        }
        mHistory = mHistoryEnd = mHistoryCache = null;
        long time;
        while (in.dataAvail() > 0 && (time=in.readLong()) >= 0) {
            HistoryItem rec = new HistoryItem(time, in);
        while (in.dataAvail() > 0) {
            HistoryItem rec = new HistoryItem(in);
            addHistoryRecordLocked(rec);
        }
    }