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

Commit b410edc9 authored by Dmitri Plotnikov's avatar Dmitri Plotnikov
Browse files

Remove constructors used exlusively for tests

Bug: 323970018
Test: atest --host PowerStatsTestsRavenwood
Test: atest PowerStatsTests
Change-Id: I8d56c0da3749b067ee9c115b529d7a92e2f0a53a
parent 926af4ed
Loading
Loading
Loading
Loading
+14 −49
Original line number Diff line number Diff line
@@ -582,23 +582,6 @@ public class BatteryStatsHistory {
     * @param maxHistoryFiles      the largest number of history buffer files to keep
     * @param maxHistoryBufferSize the most amount of RAM to used for buffering of history steps
     */
    public BatteryStatsHistory(File systemDir, int maxHistoryFiles, int maxHistoryBufferSize,
            HistoryStepDetailsCalculator stepDetailsCalculator, Clock clock,
            MonotonicClock monotonicClock) {
        this(systemDir, maxHistoryFiles, maxHistoryBufferSize,
                stepDetailsCalculator, clock, monotonicClock, new TraceDelegate(),
                new EventLogger());
    }

    public BatteryStatsHistory(File systemDir, int maxHistoryFiles, int maxHistoryBufferSize,
            HistoryStepDetailsCalculator stepDetailsCalculator, Clock clock,
            MonotonicClock monotonicClock, TraceDelegate tracer, EventLogger eventLogger) {
        this(Parcel.obtain(), systemDir, maxHistoryFiles, maxHistoryBufferSize,
                stepDetailsCalculator, clock, monotonicClock, tracer, eventLogger);
        initHistoryBuffer();
    }

    @VisibleForTesting
    public BatteryStatsHistory(Parcel historyBuffer, File systemDir,
            int maxHistoryFiles, int maxHistoryBufferSize,
            HistoryStepDetailsCalculator stepDetailsCalculator, Clock clock,
@@ -607,12 +590,11 @@ public class BatteryStatsHistory {
                clock, monotonicClock, tracer, eventLogger, null);
    }

    private BatteryStatsHistory(Parcel historyBuffer, File systemDir,
    private BatteryStatsHistory(@Nullable Parcel historyBuffer, @Nullable File systemDir,
            int maxHistoryFiles, int maxHistoryBufferSize,
            HistoryStepDetailsCalculator stepDetailsCalculator, Clock clock,
            MonotonicClock monotonicClock, TraceDelegate tracer, EventLogger eventLogger,
            BatteryStatsHistory writableHistory) {
        mHistoryBuffer = historyBuffer;
            @NonNull HistoryStepDetailsCalculator stepDetailsCalculator, @NonNull Clock clock,
            @NonNull MonotonicClock monotonicClock, @NonNull TraceDelegate tracer,
            @NonNull EventLogger eventLogger, @Nullable BatteryStatsHistory writableHistory) {
        mSystemDir = systemDir;
        mMaxHistoryBufferSize = maxHistoryBufferSize;
        mStepDetailsCalculator = stepDetailsCalculator;
@@ -625,9 +607,16 @@ public class BatteryStatsHistory {
            mMutable = false;
        }

        if (historyBuffer != null) {
            mHistoryBuffer = historyBuffer;
        } else {
            mHistoryBuffer = Parcel.obtain();
            initHistoryBuffer();
        }

        if (writableHistory != null) {
            mHistoryDir = writableHistory.mHistoryDir;
        } else {
        } else if (systemDir != null) {
            mHistoryDir = new BatteryHistoryDirectory(new File(systemDir, HISTORY_DIR),
                    monotonicClock, maxHistoryFiles);
            mHistoryDir.load();
@@ -636,33 +625,9 @@ public class BatteryStatsHistory {
                activeFile = mHistoryDir.makeBatteryHistoryFile();
            }
            setActiveFile(activeFile);
        }
    }

    public BatteryStatsHistory(int maxHistoryBufferSize,
            HistoryStepDetailsCalculator stepDetailsCalculator, Clock clock,
            MonotonicClock monotonicClock) {
        this(maxHistoryBufferSize, stepDetailsCalculator, clock, monotonicClock,
                new TraceDelegate(), new EventLogger());
    }

    @VisibleForTesting
    public BatteryStatsHistory(int maxHistoryBufferSize,
            HistoryStepDetailsCalculator stepDetailsCalculator, Clock clock,
            MonotonicClock monotonicClock, TraceDelegate traceDelegate,
            EventLogger eventLogger) {
        mMaxHistoryBufferSize = maxHistoryBufferSize;
        mStepDetailsCalculator = stepDetailsCalculator;
        mTracer = traceDelegate;
        mClock = clock;
        mMonotonicClock = monotonicClock;
        mEventLogger = eventLogger;

        mHistoryBuffer = Parcel.obtain();
        mSystemDir = null;
        } else {
            mHistoryDir = null;
        mWritableHistory = null;
        initHistoryBuffer();
        }
    }

    /**
+63 −84
Original line number Diff line number Diff line
@@ -290,8 +290,8 @@ public class BatteryStatsImpl extends BatteryStats {
    private KernelMemoryBandwidthStats mKernelMemoryBandwidthStats;
    private final LongSparseArray<SamplingTimer> mKernelMemoryStats = new LongSparseArray<>();
    private int[] mCpuPowerBracketMap;
    private CpuPowerStatsCollector mCpuPowerStatsCollector;
    private MobileRadioPowerStatsCollector mMobileRadioPowerStatsCollector;
    private final CpuPowerStatsCollector mCpuPowerStatsCollector;
    private final MobileRadioPowerStatsCollector mMobileRadioPowerStatsCollector;
    private final SparseBooleanArray mPowerStatsCollectorEnabled = new SparseBooleanArray();
    public LongSparseArray<SamplingTimer> getKernelMemoryStats() {
@@ -1777,7 +1777,7 @@ public class BatteryStatsImpl extends BatteryStats {
        return mMaxLearnedBatteryCapacityUah;
    }
    public class FrameworkStatsLogger {
    public static class FrameworkStatsLogger {
        public void uidProcessStateChanged(int uid, int state) {
            // TODO(b/155216561): It is possible for isolated uids to be in a higher
            // state than its parent uid. We should track the highest state within the union of host
@@ -1786,25 +1786,24 @@ public class BatteryStatsImpl extends BatteryStats {
                    ActivityManager.processStateAmToProto(state));
        }
        public void wakelockStateChanged(int uid, WorkChain wc, String name, int type,
                int procState, boolean acquired) {
        public void wakelockStateChanged(int uid, WorkChain wc, String name,
                int procState, boolean acquired, int powerManagerWakeLockLevel) {
            int event = acquired
                    ? FrameworkStatsLog.WAKELOCK_STATE_CHANGED__STATE__ACQUIRE
                    : FrameworkStatsLog.WAKELOCK_STATE_CHANGED__STATE__RELEASE;
            if (wc != null) {
                FrameworkStatsLog.write(FrameworkStatsLog.WAKELOCK_STATE_CHANGED, wc.getUids(),
                        wc.getTags(), getPowerManagerWakeLockLevel(type), name,
                        event, procState);
                        wc.getTags(), powerManagerWakeLockLevel, name, event, procState);
            } else {
                FrameworkStatsLog.write_non_chained(FrameworkStatsLog.WAKELOCK_STATE_CHANGED,
                        mapIsolatedUid(uid), null, getPowerManagerWakeLockLevel(type), name,
                        event, procState);
                FrameworkStatsLog.write_non_chained(FrameworkStatsLog.WAKELOCK_STATE_CHANGED, uid,
                        null, powerManagerWakeLockLevel, name, event, procState);
            }
        }
        public void kernelWakeupReported(long deltaUptimeUs) {
            FrameworkStatsLog.write(FrameworkStatsLog.KERNEL_WAKEUP_REPORTED, mLastWakeupReason,
                    /* duration_usec */ deltaUptimeUs, mLastWakeupElapsedTimeMs);
        public void kernelWakeupReported(long deltaUptimeUs, String lastWakeupReason,
                long lastWakeupElapsedTimeMs) {
            FrameworkStatsLog.write(FrameworkStatsLog.KERNEL_WAKEUP_REPORTED, lastWakeupReason,
                    /* duration_usec */ deltaUptimeUs, lastWakeupElapsedTimeMs);
        }
        public void gpsScanStateChanged(int uid, WorkChain workChain, boolean stateOn) {
@@ -1868,41 +1867,6 @@ public class BatteryStatsImpl extends BatteryStats {
    private final FrameworkStatsLogger mFrameworkStatsLogger;
    @VisibleForTesting
    public BatteryStatsImpl(@NonNull BatteryStatsConfig config, Clock clock, File historyDirectory,
            @NonNull Handler handler,
            @NonNull PowerStatsUidResolver powerStatsUidResolver,
            @NonNull FrameworkStatsLogger frameworkStatsLogger,
            @NonNull BatteryStatsHistory.TraceDelegate traceDelegate,
            @NonNull BatteryStatsHistory.EventLogger eventLogger) {
        mBatteryStatsConfig = config;
        mClock = clock;
        initKernelStatsReaders();
        mHandler = handler;
        mPowerStatsUidResolver = powerStatsUidResolver;
        mFrameworkStatsLogger = frameworkStatsLogger;
        mConstants = new Constants(mHandler);
        mStartClockTimeMs = clock.currentTimeMillis();
        mDailyFile = null;
        mMonotonicClock = new MonotonicClock(0, mClock);
        if (historyDirectory == null) {
            mCheckinFile = null;
            mStatsFile = null;
            mHistory = new BatteryStatsHistory(mConstants.MAX_HISTORY_BUFFER,
                    mStepDetailsCalculator, mClock, mMonotonicClock, traceDelegate, eventLogger);
        } else {
            mCheckinFile = new AtomicFile(new File(historyDirectory, "batterystats-checkin.bin"));
            mStatsFile = new AtomicFile(new File(historyDirectory, "batterystats.bin"));
            mHistory = new BatteryStatsHistory(historyDirectory, mConstants.MAX_HISTORY_FILES,
                    mConstants.MAX_HISTORY_BUFFER, mStepDetailsCalculator, mClock, mMonotonicClock,
                    traceDelegate, eventLogger);
        }
        mPlatformIdleStateCallback = null;
        mEnergyConsumerRetriever = null;
        mUserInfoProvider = null;
        initPowerStatsCollectors();
    }
    private void initKernelStatsReaders() {
        if (!isKernelStatsAvailable()) {
            return;
@@ -2006,19 +1970,6 @@ public class BatteryStatsImpl extends BatteryStats {
    private final PowerStatsCollectorInjector mPowerStatsCollectorInjector =
            new PowerStatsCollectorInjector();
    @SuppressWarnings("GuardedBy")      // Accessed from constructor only
    private void initPowerStatsCollectors() {
        mCpuPowerStatsCollector = new CpuPowerStatsCollector(mPowerStatsCollectorInjector,
                mBatteryStatsConfig.getPowerStatsThrottlePeriod(
                        BatteryConsumer.POWER_COMPONENT_CPU));
        mCpuPowerStatsCollector.addConsumer(this::recordPowerStats);
        mMobileRadioPowerStatsCollector = new MobileRadioPowerStatsCollector(
                mPowerStatsCollectorInjector, mBatteryStatsConfig.getPowerStatsThrottlePeriod(
                BatteryConsumer.POWER_COMPONENT_MOBILE_RADIO));
        mMobileRadioPowerStatsCollector.addConsumer(this::recordPowerStats);
    }
    /**
     * TimeBase observer.
     */
@@ -4975,8 +4926,9 @@ public class BatteryStatsImpl extends BatteryStats {
            Uid uidStats = getUidStatsLocked(mappedUid, elapsedRealtimeMs, uptimeMs);
            uidStats.noteStartWakeLocked(pid, name, type, elapsedRealtimeMs);
            mFrameworkStatsLogger.wakelockStateChanged(mapIsolatedUid(uid), wc, name, type,
                    uidStats.mProcessState, true /* acquired */);
            mFrameworkStatsLogger.wakelockStateChanged(mapIsolatedUid(uid), wc, name,
                    uidStats.mProcessState, true /* acquired */,
                    getPowerManagerWakeLockLevel(type));
        }
    }
@@ -5019,8 +4971,9 @@ public class BatteryStatsImpl extends BatteryStats {
            Uid uidStats = getUidStatsLocked(mappedUid, elapsedRealtimeMs, uptimeMs);
            uidStats.noteStopWakeLocked(pid, name, type, elapsedRealtimeMs);
            mFrameworkStatsLogger.wakelockStateChanged(mapIsolatedUid(uid), wc, name, type,
                    uidStats.mProcessState, false /* acquired */);
            mFrameworkStatsLogger.wakelockStateChanged(mapIsolatedUid(uid), wc, name,
                    uidStats.mProcessState, false/* acquired */,
                    getPowerManagerWakeLockLevel(type));
            if (mappedUid != uid) {
                // Decrement the ref count for the isolated uid and delete the mapping if uneeded.
@@ -5036,8 +4989,8 @@ public class BatteryStatsImpl extends BatteryStats {
     * TODO: Delete this. Instead, FrameworkStatsLog.write should be called from
     * PowerManager's Notifier.
     */
    private int getPowerManagerWakeLockLevel(int battertStatsWakelockType) {
        switch (battertStatsWakelockType) {
    private int getPowerManagerWakeLockLevel(int batteryStatsWakelockType) {
        switch (batteryStatsWakelockType) {
            // PowerManager.PARTIAL_WAKE_LOCK or PROXIMITY_SCREEN_OFF_WAKE_LOCK
            case BatteryStats.WAKE_TYPE_PARTIAL:
                return PowerManager.PARTIAL_WAKE_LOCK;
@@ -5055,7 +5008,7 @@ public class BatteryStatsImpl extends BatteryStats {
                return -1;
            default:
                Slog.e(TAG, "Illegal wakelock type in batterystats: " + battertStatsWakelockType);
                Slog.e(TAG, "Illegal wakelock type in batterystats: " + batteryStatsWakelockType);
                return -1;
        }
    }
@@ -5257,7 +5210,8 @@ public class BatteryStatsImpl extends BatteryStats {
            long deltaUptimeMs = uptimeMs - mLastWakeupUptimeMs;
            SamplingTimer timer = getWakeupReasonTimerLocked(mLastWakeupReason);
            timer.add(deltaUptimeMs * 1000, 1, elapsedRealtimeMs); // time in in microseconds
            mFrameworkStatsLogger.kernelWakeupReported(deltaUptimeMs * 1000);
            mFrameworkStatsLogger.kernelWakeupReported(deltaUptimeMs * 1000, mLastWakeupReason,
                    mLastWakeupElapsedTimeMs);
            mLastWakeupReason = null;
        }
    }
@@ -11094,11 +11048,27 @@ public class BatteryStatsImpl extends BatteryStats {
    public BatteryStatsImpl(@NonNull BatteryStatsConfig config, @NonNull Clock clock,
            @NonNull MonotonicClock monotonicClock, @Nullable File systemDir,
            @NonNull Handler handler, @Nullable PlatformIdleStateCallback cb,
            @Nullable EnergyStatsRetriever energyStatsCb,
            @NonNull Handler handler, @Nullable PlatformIdleStateCallback platformIdleStateCallback,
            @Nullable EnergyStatsRetriever energyStatsRetriever,
            @NonNull UserInfoProvider userInfoProvider, @NonNull PowerProfile powerProfile,
            @NonNull CpuScalingPolicies cpuScalingPolicies,
            @NonNull PowerStatsUidResolver powerStatsUidResolver) {
        this(config, clock, monotonicClock, systemDir, handler, platformIdleStateCallback,
                energyStatsRetriever, userInfoProvider, powerProfile, cpuScalingPolicies,
                powerStatsUidResolver, new FrameworkStatsLogger(),
                new BatteryStatsHistory.TraceDelegate(), new BatteryStatsHistory.EventLogger());
    }
    public BatteryStatsImpl(@NonNull BatteryStatsConfig config, @NonNull Clock clock,
            @NonNull MonotonicClock monotonicClock, @Nullable File systemDir,
            @NonNull Handler handler, @Nullable PlatformIdleStateCallback platformIdleStateCallback,
            @Nullable EnergyStatsRetriever energyStatsRetriever,
            @NonNull UserInfoProvider userInfoProvider, @NonNull PowerProfile powerProfile,
            @NonNull CpuScalingPolicies cpuScalingPolicies,
            @NonNull PowerStatsUidResolver powerStatsUidResolver,
            @NonNull FrameworkStatsLogger frameworkStatsLogger,
            @NonNull BatteryStatsHistory.TraceDelegate traceDelegate,
            @NonNull BatteryStatsHistory.EventLogger eventLogger) {
        mClock = clock;
        initKernelStatsReaders();
@@ -11110,25 +11080,34 @@ public class BatteryStatsImpl extends BatteryStats {
        mPowerProfile = powerProfile;
        mCpuScalingPolicies = cpuScalingPolicies;
        mPowerStatsUidResolver = powerStatsUidResolver;
        mFrameworkStatsLogger = new FrameworkStatsLogger();
        mFrameworkStatsLogger = frameworkStatsLogger;
        initPowerProfile();
        if (systemDir == null) {
            mStatsFile = null;
            mCheckinFile = null;
            mDailyFile = null;
            mHistory = new BatteryStatsHistory(mConstants.MAX_HISTORY_BUFFER,
                    mStepDetailsCalculator, mClock, mMonotonicClock);
        } else {
        if (systemDir != null) {
            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,
                    mConstants.MAX_HISTORY_BUFFER, mStepDetailsCalculator, mClock, mMonotonicClock);
        } else {
            mStatsFile = null;
            mCheckinFile = null;
            mDailyFile = null;
        }
        initPowerStatsCollectors();
        mHistory = new BatteryStatsHistory(null /* historyBuffer */, systemDir,
                mConstants.MAX_HISTORY_FILES, mConstants.MAX_HISTORY_BUFFER, mStepDetailsCalculator,
                mClock, mMonotonicClock, traceDelegate, eventLogger);
        mCpuPowerStatsCollector = new CpuPowerStatsCollector(mPowerStatsCollectorInjector,
                mBatteryStatsConfig.getPowerStatsThrottlePeriod(
                        BatteryConsumer.POWER_COMPONENT_CPU));
        mCpuPowerStatsCollector.addConsumer(this::recordPowerStats);
        mMobileRadioPowerStatsCollector = new MobileRadioPowerStatsCollector(
                mPowerStatsCollectorInjector, mBatteryStatsConfig.getPowerStatsThrottlePeriod(
                BatteryConsumer.POWER_COMPONENT_MOBILE_RADIO));
        mMobileRadioPowerStatsCollector.addConsumer(this::recordPowerStats);
        mStartCount++;
        initTimersAndCounters();
        mOnBattery = mOnBatteryInternal = false;
@@ -11138,8 +11117,8 @@ public class BatteryStatsImpl extends BatteryStats {
        mStartPlatformVersion = mEndPlatformVersion = Build.ID;
        initDischarge(realtimeUs);
        updateDailyDeadlineLocked();
        mPlatformIdleStateCallback = cb;
        mEnergyConsumerRetriever = energyStatsCb;
        mPlatformIdleStateCallback = platformIdleStateCallback;
        mEnergyConsumerRetriever = energyStatsRetriever;
        mUserInfoProvider = userInfoProvider;
        mPowerStatsUidResolver.addListener(new PowerStatsUidResolver.Listener() {
+21 −21
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ import android.hardware.power.stats.EnergyConsumerType;
import android.hardware.power.stats.EnergyMeasurement;
import android.hardware.power.stats.PowerEntity;
import android.hardware.power.stats.StateResidencyResult;
import android.os.Handler;
import android.os.Looper;
import android.platform.test.ravenwood.RavenwoodRule;
import android.power.PowerStatsInternal;
import android.util.IntArray;
@@ -45,6 +47,7 @@ import androidx.test.InstrumentationRegistry;

import com.android.internal.os.Clock;
import com.android.internal.os.CpuScalingPolicies;
import com.android.internal.os.MonotonicClock;
import com.android.internal.os.PowerProfile;

import org.junit.Before;
@@ -65,18 +68,23 @@ import java.util.concurrent.CompletableFuture;
public class BatteryExternalStatsWorkerTest {
    @Rule
    public final RavenwoodRule mRavenwood = new RavenwoodRule();

    private BatteryExternalStatsWorker mBatteryExternalStatsWorker;
    private TestBatteryStatsImpl mBatteryStatsImpl;
    private TestPowerStatsInternal mPowerStatsInternal;

    @Before
    public void setUp() {
        final Context context = InstrumentationRegistry.getContext();

        mBatteryStatsImpl = new TestBatteryStatsImpl(context);
        BatteryStatsImpl batteryStats = new BatteryStatsImpl(
                new BatteryStatsImpl.BatteryStatsConfig.Builder().build(), Clock.SYSTEM_CLOCK,
                new MonotonicClock(0, Clock.SYSTEM_CLOCK), null,
                new Handler(Looper.getMainLooper()), null, null, null,
                new PowerProfile(context, true /* forTest */), buildScalingPolicies(),
                new PowerStatsUidResolver());
        mPowerStatsInternal = new TestPowerStatsInternal();
        mBatteryExternalStatsWorker = new BatteryExternalStatsWorker(new TestInjector(context),
                mBatteryStatsImpl);
        mBatteryExternalStatsWorker =
                new BatteryExternalStatsWorker(new TestInjector(context), batteryStats);
    }

    @Test
@@ -218,25 +226,17 @@ public class BatteryExternalStatsWorkerTest {
        }
    }

    public class TestBatteryStatsImpl extends BatteryStatsImpl {
        public TestBatteryStatsImpl(Context context) {
            super(new BatteryStatsConfig.Builder().build(), Clock.SYSTEM_CLOCK, null, null, null,
                    null, null, null);
            mPowerProfile = new PowerProfile(context, true /* forTest */);

    private static CpuScalingPolicies buildScalingPolicies() {
        SparseArray<int[]> cpusByPolicy = new SparseArray<>();
        cpusByPolicy.put(0, new int[]{0, 1, 2, 3});
        cpusByPolicy.put(4, new int[]{4, 5, 6, 7});
        SparseArray<int[]> freqsByPolicy = new SparseArray<>();
        freqsByPolicy.put(0, new int[]{300000, 1000000, 2000000});
        freqsByPolicy.put(4, new int[]{300000, 1000000, 2500000, 3000000});
            mCpuScalingPolicies = new CpuScalingPolicies(freqsByPolicy, freqsByPolicy);

            initTimersAndCounters();
        }
        return new CpuScalingPolicies(freqsByPolicy, freqsByPolicy);
    }

    public class TestPowerStatsInternal extends PowerStatsInternal {
    private static class TestPowerStatsInternal extends PowerStatsInternal {
        private final SparseArray<EnergyConsumer> mEnergyConsumers = new SparseArray();
        private final SparseArray<EnergyConsumerResult> mEnergyConsumerResults = new SparseArray();
        private final int mTimeSinceBoot = 0;
+7 −3
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import com.android.internal.os.KernelCpuUidTimeReader.KernelCpuUidClusterTimeRea
import com.android.internal.os.KernelCpuUidTimeReader.KernelCpuUidFreqTimeReader;
import com.android.internal.os.KernelCpuUidTimeReader.KernelCpuUidUserSysTimeReader;
import com.android.internal.os.KernelSingleUidTimeReader;
import com.android.internal.os.MonotonicClock;
import com.android.internal.os.PowerProfile;
import com.android.internal.power.EnergyConsumerStats;

@@ -73,10 +74,13 @@ public class MockBatteryStatsImpl extends BatteryStatsImpl {

    MockBatteryStatsImpl(BatteryStatsConfig config, Clock clock, File historyDirectory,
            Handler handler, PowerStatsUidResolver powerStatsUidResolver) {
        super(config, clock, historyDirectory, handler, powerStatsUidResolver,
                mock(FrameworkStatsLogger.class), mock(BatteryStatsHistory.TraceDelegate.class),
        super(config, clock, new MonotonicClock(0, clock), historyDirectory, handler,
                mock(PlatformIdleStateCallback.class), mock(EnergyStatsRetriever.class),
                mock(UserInfoProvider.class), mock(PowerProfile.class),
                new CpuScalingPolicies(new SparseArray<>(), new SparseArray<>()),
                powerStatsUidResolver, mock(FrameworkStatsLogger.class),
                mock(BatteryStatsHistory.TraceDelegate.class),
                mock(BatteryStatsHistory.EventLogger.class));
        initTimersAndCounters();
        setMaxHistoryBuffer(128 * 1024);

        setExternalStatsSyncLocked(mExternalStatsSync);
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ public class PowerStatsAggregatorTest {

    @Before
    public void setup() throws ParseException {
        mHistory = new BatteryStatsHistory(1024,
        mHistory = new BatteryStatsHistory(null, null, 0, 1024,
                mock(BatteryStatsHistory.HistoryStepDetailsCalculator.class), mClock,
                mMonotonicClock, mock(BatteryStatsHistory.TraceDelegate.class), null);