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

Commit 9329069b authored by Omair Kamil's avatar Omair Kamil
Browse files

Merge TransitionalScanHelper into ScanController.

Bug: 327503826
Flag: EXEMPT, mechanical refactor
Test: atest BluetoothInstrumentationTests, atest BumbleBluetoothTests

Change-Id: I7b3d9ef76c2bfac02e16e1bd74dd675ebb956aec
parent ecb352f5
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -6227,10 +6227,9 @@ public class AdapterService extends Service {
            Log.w(TAG, "GATT Service is not running!");
            return;
        }
        if (Flags.scanManagerRefactor()) {
            mScanController.notifyProfileConnectionStateChange(profile, fromState, toState);
        } else {
            mGattService.notifyProfileConnectionStateChange(profile, fromState, toState);
        ScanController controller = getBluetoothScanController();
        if (controller != null) {
            controller.notifyProfileConnectionStateChange(profile, fromState, toState);
        }
    }

+0 −7
Original line number Diff line number Diff line
@@ -284,13 +284,6 @@ public class GattService extends ProfileService {
        return restrictedHandles != null && restrictedHandles.contains(handle);
    }

    /** Notify Scan manager of bluetooth profile connection state changes */
    public void notifyProfileConnectionStateChange(int profile, int fromState, int toState) {
        if (mScanController != null) {
            mScanController.notifyProfileConnectionStateChange(profile, fromState, toState);
        }
    }

    class ServerDeathRecipient implements IBinder.DeathRecipient {
        int mAppIf;
        private String mPackageName;
+0 −4
Original line number Diff line number Diff line
@@ -2036,7 +2036,6 @@ public class LeAudioService extends ProfileService {
            }
            mAdapterService
                    .getBluetoothScanController()
                    .getTransitionalScanHelper()
                    .registerScannerInternal(this, getAttributionSource(), null);
        }

@@ -2047,12 +2046,10 @@ public class LeAudioService extends ProfileService {
            }
            mAdapterService
                    .getBluetoothScanController()
                    .getTransitionalScanHelper()
                    .stopScanInternal(mScannerId);

            mAdapterService
                    .getBluetoothScanController()
                    .getTransitionalScanHelper()
                    .unregisterScannerInternal(mScannerId);
            mScannerId = 0;
        }
@@ -2079,7 +2076,6 @@ public class LeAudioService extends ProfileService {

            mAdapterService
                    .getBluetoothScanController()
                    .getTransitionalScanHelper()
                    .startScanInternal(scannerId, settings, List.of(filter));
        }

+6 −6
Original line number Diff line number Diff line
@@ -65,8 +65,8 @@ public class AppScanStats {
    // ScannerMap here is needed to grab Apps
    ScannerMap mScannerMap;

    // TransitionalScanHelper is needed to add scan event protos to be dumped later
    final TransitionalScanHelper mScanHelper;
    // ScanController is needed to add scan event protos to be dumped later
    final ScanController mScanController;

    // Battery stats is used to keep track of scans and result stats
    BatteryStatsManager mBatteryStatsManager;
@@ -173,13 +173,13 @@ public class AppScanStats {
            WorkSource source,
            ScannerMap map,
            AdapterService adapterService,
            TransitionalScanHelper scanHelper,
            ScanController scanController,
            TimeProvider timeProvider) {
        mAdapterService = requireNonNull(adapterService);
        mTimeProvider = requireNonNull(timeProvider);
        mAppName = name;
        mScannerMap = map;
        mScanHelper = scanHelper;
        mScanController = scanController;
        mBatteryStatsManager = adapterService.getSystemService(BatteryStatsManager.class);

        if (source == null) {
@@ -310,7 +310,7 @@ public class AppScanStats {
                        .setEventTimeMillis(System.currentTimeMillis())
                        .setInitiator(truncateAppName(mAppName))
                        .build();
        mScanHelper.addScanEvent(scanEvent);
        mScanController.addScanEvent(scanEvent);

        if (!isScanning()) {
            mScanStartTime = startTime;
@@ -362,7 +362,7 @@ public class AppScanStats {
                        .setInitiator(truncateAppName(mAppName))
                        .setNumberResults(scan.results)
                        .build();
        mScanHelper.addScanEvent(scanEvent);
        mScanController.addScanEvent(scanEvent);

        mTotalScanTime += scanDuration;
        long activeDuration = scanDuration - scan.suspendDuration;
+1596 −34

File changed.

Preview size limit exceeded, changes collapsed.

Loading