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

Commit 676ba291 authored by Vinay Kalia's avatar Vinay Kalia Committed by android-build-merger
Browse files

Merge "Fix time stats in bluetooth_manager dumpsys" am: c226b556 am: 62caf1f9

am: 3a8587b2

Change-Id: I9b540c34727bf486f298bf1bb3cefd38898d5199
parents 70af4039 3a8587b2
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -185,8 +185,9 @@ import com.android.bluetooth.btservice.BluetoothProto;
        long scanDuration = stopTime - scan.timestamp;
        scan.duration = scanDuration;
        if (scan.isSuspended) {
            scan.suspendDuration += stopTime - scan.suspendStartTime;
            mTotalSuspendTime += scan.suspendDuration;
            long suspendDuration = stopTime - scan.suspendStartTime;
            scan.suspendDuration += suspendDuration;
            mTotalSuspendTime += suspendDuration;
        }
        ongoingScans.remove(scannerId);
        if (lastScans.size() >= NUM_SCAN_DURATIONS_KEPT) {
@@ -230,13 +231,15 @@ import com.android.bluetooth.btservice.BluetoothProto;

    synchronized void recordScanResume(int scannerId) {
        LastScan scan = getScanFromScannerId(scannerId);
        long suspendDuration = 0;
        if (scan == null || !scan.isSuspended) {
            return;
        }
        scan.isSuspended = false;
        stopTime = SystemClock.elapsedRealtime();
        scan.suspendDuration += stopTime - scan.suspendStartTime;
        mTotalSuspendTime += scan.suspendDuration;
        suspendDuration = stopTime - scan.suspendStartTime;
        scan.suspendDuration += suspendDuration;
        mTotalSuspendTime += suspendDuration;
    }

    synchronized void setScanTimeout(int scannerId) {
+4 −1
Original line number Diff line number Diff line
@@ -260,10 +260,13 @@ public class ScanManager {
            }

            if (!mScanNative.isOpportunisticScanClient(client) && !isScreenOn() && !isFiltered) {
                Log.e(TAG,
                Log.w(TAG,
                        "Cannot start unfiltered scan in screen-off. This scan will be resumed later: "
                                + client.scannerId);
                mSuspendedScanClients.add(client);
                if (client.stats != null) {
                    client.stats.recordScanSuspend(client.scannerId);
                }
                return;
            }