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

Commit d9f98565 authored by Adam Bookatz's avatar Adam Bookatz
Browse files

Fix updateBluetoothStateLocked comments

There was confusion as to whether updateBluetoothStateLocked
took an ActivityInfo representing a cumulative total or a delta.
It is confirmed that it is now a cumulative total. (It had been
a delta in the past, but no longer.)

Bug: 174818545
Test: N/A (just comments)
Change-Id: I62130f22250eb496164f94c0668d1ff65fed7710
parent a7e2b441
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -12070,7 +12070,7 @@ public class BatteryStatsImpl extends BatteryStats {
    /**
     * Distribute Bluetooth energy info and network traffic to apps.
     *
     * @param info The energy information from the bluetooth controller.
     * @param info The accumulated energy information from the bluetooth controller.
     */
    public void updateBluetoothStateLocked(@Nullable final BluetoothActivityEnergyInfo info,
            final long consumedChargeUC, long elapsedRealtimeMs, long uptimeMs) {
@@ -12082,9 +12082,6 @@ public class BatteryStatsImpl extends BatteryStats {
            return;
        }
        if (!mOnBatteryInternal || mIgnoreNextExternalStats) {
            // TODO(174818545): mLastBluetoothActivityInfo is actually extremely suspicious.
            //  Firstly, the following line was originally missing. But even more so, BESW says that
            //  info is a delta, not a total, so this entire algorithm requires review.
            mLastBluetoothActivityInfo.set(info);
            return;
        }
+2 −2
Original line number Diff line number Diff line
@@ -137,8 +137,8 @@ class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStatsSync {
    @GuardedBy("mWorkerLock")
    private PowerStatsInternal mPowerStatsInternal = null;

    // WiFi keeps an accumulated total of stats, unlike Bluetooth.
    // Keep the last WiFi stats so we can compute a delta.
    // WiFi keeps an accumulated total of stats. Keep the last WiFi stats so we can compute a delta.
    // (This is unlike Bluetooth, where BatteryStatsImpl is left responsible for taking the delta.)
    @GuardedBy("mWorkerLock")
    private WifiActivityEnergyInfo mLastWifiInfo =
            new WifiActivityEnergyInfo(0, 0, 0, 0, 0, 0);