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

Commit e83b81a9 authored by Hsin-chen Chuang's avatar Hsin-chen Chuang Committed by Gerrit Code Review
Browse files

Merge "floss: Scanner: Active scan if no filter, otherwise Passive scan" into main

parents 85ebd101 7f82b0e9
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -1168,7 +1168,7 @@ pub enum ScanType {

impl Default for ScanType {
    fn default() -> Self {
        ScanType::Passive
        ScanType::Active
    }
}

@@ -2030,7 +2030,18 @@ impl IBluetoothGatt for BluetoothGatt {
        let settings = settings.unwrap_or_else(|| ScanSettings {
            interval: sysprop::get_i32(sysprop::PropertyI32::LeAdvMonScanInterval),
            window: sysprop::get_i32(sysprop::PropertyI32::LeAdvMonScanWindow),
            scan_type: ScanType::default(),
            // TODO(b/290300475): Use the default value (Active) here after the issue is addressed.
            // TODO(b/262746968): Forward the scanning settings from ARC++ APPs.
            // Either of the TODOs above could fix this workaround for the below issues:
            // - b/290300475: Offloaded filtering would be broken on some hardwares if scan mode is
            //                Active. Thus, if |filter| is not none then the scan type should be set
            //                to Passive.
            // - b/328711786: Android only supports Active scan, i.e., ARC++ APPs always expect
            //                Active scan. However, ARC++ bridge is not able to specify the scan
            //                type through the BluetoothLowEnergyScanSession API. Fortunately ARC++
            //                bridge is not able to specify the filter either, so when |filter| is
            //                none we always set the scan type to Active.
            scan_type: if filter.is_none() { ScanType::Active } else { ScanType::Passive },
        });

        // Multiplexing scanners happens at this layer. The implementations of start_scan