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

Commit 62242bdc authored by Dmitri Plotnikov's avatar Dmitri Plotnikov
Browse files

Breaking history writing out of BatteryStatsImpl

Bug: 242230266
Test: atest FrameworksServicesTests:BatteryStatsTests
NoNonSdkCheck: BatteryStats.getHistoryBaseTime was only used locally within BatteryStats itself.  It was assigned to an unused variable, so removing this method is a no-op
Change-Id: Ib132f3e0a13d639c02e51188358fb4525b00ca9c
parent ad2359e6
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -2325,11 +2325,6 @@ public abstract class BatteryStats {

    public abstract void finishIteratingHistoryLocked();

    /**
     * Return the base time offset for the battery history.
     */
    public abstract long getHistoryBaseTime();

    /**
     * Returns the number of times the device has been started.
     */
@@ -7615,8 +7610,6 @@ public abstract class BatteryStats {
                CHECKIN_VERSION, getParcelVersion(), getStartPlatformVersion(),
                getEndPlatformVersion());

        long now = getHistoryBaseTime() + SystemClock.elapsedRealtime();

        if ((flags & (DUMP_INCLUDE_HISTORY | DUMP_HISTORY_ONLY)) != 0) {
            if (startIteratingHistoryLocked()) {
                try {
+1254 −62

File changed.

Preview size limit exceeded, changes collapsed.

+7 −1
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ public class BatteryStatsHistoryIterator {

    public BatteryStatsHistoryIterator(@NonNull BatteryStatsHistory history) {
        mBatteryStatsHistory = history;
        mBatteryStatsHistory.startIteratingHistory();
    }

    /**
@@ -231,4 +230,11 @@ public class BatteryStatsHistoryIterator {
        out.batteryTemperature = (short) ((batteryLevelInt & 0x01ff8000) >>> 15);
        out.batteryVoltage = (char) ((batteryLevelInt & 0x00007ffe) >>> 1);
    }

    /**
     * Should be called when iteration is complete.
     */
    public void close() {
        mBatteryStatsHistory.finishIteratingHistory();
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -657,7 +657,7 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat

        // Now that we have finally received all the data, we can tell mStats about it.
        synchronized (mStats) {
            mStats.addHistoryEventLocked(
            mStats.recordHistoryEventLocked(
                    elapsedRealtime,
                    uptime,
                    BatteryStats.HistoryItem.EVENT_COLLECT_EXTERNAL_STATS,
+491 −1305

File changed.

Preview size limit exceeded, changes collapsed.

Loading