Merge "Adding a sanity test in the while loop in readHistory()"

This commit is contained in:
Conley Owens
2011-04-29 09:56:58 -07:00
committed by Android Code Review

View File

@@ -4708,7 +4708,7 @@ public final class BatteryStatsImpl extends BatteryStats {
mHistory = mHistoryEnd = mHistoryCache = null;
mHistoryBaseTime = 0;
long time;
while ((time=in.readLong()) >= 0) {
while (in.dataAvail() > 0 && (time=in.readLong()) >= 0) {
HistoryItem rec = new HistoryItem(time, in);
addHistoryRecordLocked(rec);
if (rec.time > mHistoryBaseTime) {