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

Commit d2ea9dd3 authored by Ajay Panicker's avatar Ajay Panicker Committed by android-build-merger
Browse files

Merge "Pass all scans to battery stats" into oc-dr1-dev

am: fed92f8c

Change-Id: I5fe1a2c4cc97c18833dd6a499152714c9f5281b8
parents ef4c0809 fed92f8c
Loading
Loading
Loading
Loading
+20 −20
Original line number Diff line number Diff line
@@ -157,15 +157,13 @@ import com.android.bluetooth.btservice.BluetoothProto;
        scanEvent.setInitiator(truncateAppName(appName));
        gattService.addScanEvent(scanEvent);

        if (!isScanning()) {
        if (!isScanning()) mScanStartTime = startTime;
        try {
            boolean isUnoptimized = !(scan.filtered || scan.background || scan.opportunistic);
                mScanStartTime = startTime;
            batteryStats.noteBleScanStarted(workSource, isUnoptimized);
        } catch (RemoteException e) {
            /* ignore */
        }
        }

        ongoingScans.put(scannerId, scan);
    }
@@ -193,20 +191,22 @@ import com.android.bluetooth.btservice.BluetoothProto;
        gattService.addScanEvent(scanEvent);

        if (!isScanning()) {
            try {
            long totalDuration = stopTime - mScanStartTime;
            mTotalScanTime += totalDuration;
            minScanTime = Math.min(totalDuration, minScanTime);
            maxScanTime = Math.max(totalDuration, maxScanTime);
        }

        try {
            // Inform battery stats of any results it might be missing on
            // scan stop
            boolean isUnoptimized = !(scan.filtered || scan.background || scan.opportunistic);
            batteryStats.noteBleScanResults(workSource, scan.results % 100);
                batteryStats.noteBleScanStopped(workSource);
            batteryStats.noteBleScanStopped(workSource, isUnoptimized);
        } catch (RemoteException e) {
            /* ignore */
        }
    }
    }

    synchronized void setScanTimeout(int scannerId) {
        if (!isScanning()) return;