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

Commit 7b1b070a authored by Dmitri Plotnikov's avatar Dmitri Plotnikov Committed by Automerger Merge Worker
Browse files

Merge "Fix Bluetooth power accounting after a BT crash" into sc-dev am: cfc8359f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15055646

Change-Id: I189d02f2a0b756953d54f8826babd895a77b5b31
parents 2d499be9 cfc8359f
Loading
Loading
Loading
Loading
+18 −0
Original line number Original line Diff line number Diff line
@@ -12141,6 +12141,15 @@ public class BatteryStatsImpl extends BatteryStats {
                }
                }
            }
            }
        }
        }
        void reset() {
            idleTimeMs = 0;
            rxTimeMs = 0;
            txTimeMs = 0;
            energy = 0;
            uidRxBytes.clear();
            uidTxBytes.clear();
        }
    }
    }
    private final BluetoothActivityInfoCache mLastBluetoothActivityInfo
    private final BluetoothActivityInfoCache mLastBluetoothActivityInfo
@@ -12167,6 +12176,15 @@ public class BatteryStatsImpl extends BatteryStats {
        mHasBluetoothReporting = true;
        mHasBluetoothReporting = true;
        if (info.getControllerRxTimeMillis() < mLastBluetoothActivityInfo.rxTimeMs
                || info.getControllerTxTimeMillis() < mLastBluetoothActivityInfo.txTimeMs
                || info.getControllerIdleTimeMillis() < mLastBluetoothActivityInfo.idleTimeMs
                || info.getControllerEnergyUsed() < mLastBluetoothActivityInfo.energy) {
            // A drop in accumulated Bluetooth stats is a sign of a Bluetooth crash.
            // Reset the preserved previous snapshot in order to restart accumulating deltas.
            mLastBluetoothActivityInfo.reset();
        }
        final long rxTimeMs =
        final long rxTimeMs =
                info.getControllerRxTimeMillis() - mLastBluetoothActivityInfo.rxTimeMs;
                info.getControllerRxTimeMillis() - mLastBluetoothActivityInfo.rxTimeMs;
        final long txTimeMs =
        final long txTimeMs =