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

Commit 14f2a23b authored by Vinay Kalia's avatar Vinay Kalia Committed by android-build-merger
Browse files

Merge "Fix time stats in bluetooth_manager dumpsys"

am: 3e506c24

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


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


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


            if (!mScanNative.isOpportunisticScanClient(client) && !isScreenOn() && !isFiltered) {
            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: "
                        "Cannot start unfiltered scan in screen-off. This scan will be resumed later: "
                                + client.scannerId);
                                + client.scannerId);
                mSuspendedScanClients.add(client);
                mSuspendedScanClients.add(client);
                if (client.stats != null) {
                    client.stats.recordScanSuspend(client.scannerId);
                }
                return;
                return;
            }
            }