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

Commit ac4dfec1 authored by Adam Lesinski's avatar Adam Lesinski Committed by Android (Google) Code Review
Browse files

Merge "BatteryStats: Add ble scans to checkin data and start global ble scan timer" into nyc-dev

parents 4938d6e1 d9b99be5
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -212,6 +212,7 @@ public abstract class BatteryStats implements Parcelable {
    private static final String WIFI_CONTROLLER_DATA = "wfcd";
    private static final String GLOBAL_BLUETOOTH_CONTROLLER_DATA = "gble";
    private static final String BLUETOOTH_CONTROLLER_DATA = "ble";
    private static final String BLUETOOTH_MISC_DATA = "blem";
    private static final String MISC_DATA = "m";
    private static final String GLOBAL_NETWORK_DATA = "gn";
    private static final String GLOBAL_MODEM_CONTROLLER_DATA = "gmcd";
@@ -3071,6 +3072,15 @@ public abstract class BatteryStats implements Parcelable {
            dumpControllerActivityLine(pw, uid, category, WIFI_CONTROLLER_DATA,
                    u.getWifiControllerActivity(), which);

            // Dump Bluetooth scan data, per UID.
            final long bleScanTimeUs = u.getBluetoothScanTimer().getTotalTimeLocked(
                    rawRealtime, which);
            final int bleScanCount = u.getBluetoothScanTimer().getCountLocked(which);
            if (bleScanTimeUs != 0 || bleScanCount != 0) {
                dumpLine(pw, uid, category, BLUETOOTH_MISC_DATA,
                        bleScanTimeUs / 1000, bleScanCount);
            }

            dumpControllerActivityLine(pw, uid, category, BLUETOOTH_CONTROLLER_DATA,
                    u.getBluetoothControllerActivity(), which);

+2 −0
Original line number Diff line number Diff line
@@ -4012,6 +4012,7 @@ public class BatteryStatsImpl extends BatteryStats {
            if (DEBUG_HISTORY) Slog.v(TAG, "BLE scan started for: "
                    + Integer.toHexString(mHistoryCur.states2));
            addHistoryRecordLocked(elapsedRealtime, uptime);
            mBluetoothScanTimer.startRunningLocked(elapsedRealtime);
        }
        mBluetoothScanNesting++;
        getUidStatsLocked(uid).noteBluetoothScanStartedLocked(elapsedRealtime);
@@ -4034,6 +4035,7 @@ public class BatteryStatsImpl extends BatteryStats {
            if (DEBUG_HISTORY) Slog.v(TAG, "BLE scan stopped for: "
                    + Integer.toHexString(mHistoryCur.states2));
            addHistoryRecordLocked(elapsedRealtime, uptime);
            mBluetoothScanTimer.stopRunningLocked(elapsedRealtime);
        }
        getUidStatsLocked(uid).noteBluetoothScanStoppedLocked(elapsedRealtime);
    }