summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConley Owens <cco3@android.com>2011-04-29 09:56:58 -0700
committerAndroid Code Review <code-review@android.com>2011-04-29 09:56:58 -0700
commit2f463ef18bb235be57b39cbda536bcd2df2d0908 (patch)
treed3554f83462ce86dd6d9047348800542af8cfd5f
parentc5505f6a150db8232cc275bedd400f7f5a593530 (diff)
parent3d865240e776374ced4ea50e6cb7f8ac92a32640 (diff)
downloadframeworks_base-2f463ef18bb235be57b39cbda536bcd2df2d0908.zip
frameworks_base-2f463ef18bb235be57b39cbda536bcd2df2d0908.tar.gz
frameworks_base-2f463ef18bb235be57b39cbda536bcd2df2d0908.tar.bz2
Merge "Adding a sanity test in the while loop in readHistory()"
-rw-r--r--core/java/com/android/internal/os/BatteryStatsImpl.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 1339b44..7220983 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -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) {