Merge "Initialize max history buffer size when reading checkin file" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
7fb87efd44
@@ -330,7 +330,10 @@ public class BatteryStatsHistory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BatteryStatsHistory(HistoryStepDetailsCalculator stepDetailsCalculator, Clock clock) {
|
public BatteryStatsHistory(int maxHistoryFiles, int maxHistoryBufferSize,
|
||||||
|
HistoryStepDetailsCalculator stepDetailsCalculator, Clock clock) {
|
||||||
|
mMaxHistoryFiles = maxHistoryFiles;
|
||||||
|
mMaxHistoryBufferSize = maxHistoryBufferSize;
|
||||||
mStepDetailsCalculator = stepDetailsCalculator;
|
mStepDetailsCalculator = stepDetailsCalculator;
|
||||||
mTracer = new TraceDelegate();
|
mTracer = new TraceDelegate();
|
||||||
mClock = clock;
|
mClock = clock;
|
||||||
|
|||||||
@@ -1743,7 +1743,8 @@ public class BatteryStatsImpl extends BatteryStats {
|
|||||||
if (historyDirectory == null) {
|
if (historyDirectory == null) {
|
||||||
mCheckinFile = null;
|
mCheckinFile = null;
|
||||||
mStatsFile = null;
|
mStatsFile = null;
|
||||||
mHistory = new BatteryStatsHistory(mStepDetailsCalculator, mClock);
|
mHistory = new BatteryStatsHistory(mConstants.MAX_HISTORY_FILES,
|
||||||
|
mConstants.MAX_HISTORY_BUFFER, mStepDetailsCalculator, mClock);
|
||||||
} else {
|
} else {
|
||||||
mCheckinFile = new AtomicFile(new File(historyDirectory, "batterystats-checkin.bin"));
|
mCheckinFile = new AtomicFile(new File(historyDirectory, "batterystats-checkin.bin"));
|
||||||
mStatsFile = new AtomicFile(new File(historyDirectory, "batterystats.bin"));
|
mStatsFile = new AtomicFile(new File(historyDirectory, "batterystats.bin"));
|
||||||
@@ -10881,14 +10882,17 @@ public class BatteryStatsImpl extends BatteryStats {
|
|||||||
|
|
||||||
if (systemDir == null) {
|
if (systemDir == null) {
|
||||||
mStatsFile = null;
|
mStatsFile = null;
|
||||||
mHistory = new BatteryStatsHistory(mStepDetailsCalculator, mClock);
|
mCheckinFile = null;
|
||||||
|
mDailyFile = null;
|
||||||
|
mHistory = new BatteryStatsHistory(mConstants.MAX_HISTORY_FILES,
|
||||||
|
mConstants.MAX_HISTORY_BUFFER, mStepDetailsCalculator, mClock);
|
||||||
} else {
|
} else {
|
||||||
mStatsFile = new AtomicFile(new File(systemDir, "batterystats.bin"));
|
mStatsFile = new AtomicFile(new File(systemDir, "batterystats.bin"));
|
||||||
|
mCheckinFile = new AtomicFile(new File(systemDir, "batterystats-checkin.bin"));
|
||||||
|
mDailyFile = new AtomicFile(new File(systemDir, "batterystats-daily.xml"));
|
||||||
mHistory = new BatteryStatsHistory(systemDir, mConstants.MAX_HISTORY_FILES,
|
mHistory = new BatteryStatsHistory(systemDir, mConstants.MAX_HISTORY_FILES,
|
||||||
mConstants.MAX_HISTORY_BUFFER, mStepDetailsCalculator, mClock);
|
mConstants.MAX_HISTORY_BUFFER, mStepDetailsCalculator, mClock);
|
||||||
}
|
}
|
||||||
mCheckinFile = new AtomicFile(new File(systemDir, "batterystats-checkin.bin"));
|
|
||||||
mDailyFile = new AtomicFile(new File(systemDir, "batterystats-daily.xml"));
|
|
||||||
mStartCount++;
|
mStartCount++;
|
||||||
initTimersAndCounters();
|
initTimersAndCounters();
|
||||||
mOnBattery = mOnBatteryInternal = false;
|
mOnBattery = mOnBatteryInternal = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user