Loading system/gd/rust/linux/stack/src/bluetooth.rs +14 −25 Original line number Diff line number Diff line Loading @@ -894,12 +894,6 @@ impl Bluetooth { /// Check whether found devices are still fresh. If they're outside the /// freshness window, send a notification to clear the device from clients. fn trigger_freshness_check(&mut self) { if let Some(ref handle) = self.freshness_check { // Abort and drop the previous JoinHandle. handle.abort(); self.freshness_check = None; } // A found device is considered fresh if: // * It was last seen less than |FOUND_DEVICE_FRESHNESS| ago. // * It is currently connected. Loading @@ -926,18 +920,6 @@ impl Bluetooth { self.bluetooth_admin.lock().unwrap().on_device_cleared(&d); } // If we have any fresh devices remaining, re-queue a freshness check. if self.found_devices.len() > 0 { let txl = self.tx.clone(); self.freshness_check = Some(tokio::spawn(async move { time::sleep(FOUND_DEVICE_FRESHNESS).await; let _ = txl .send(Message::DelayedAdapterActions(DelayedActions::DeviceFreshnessCheck)) .await; })); } } /// Makes an LE_RAND call to the Bluetooth interface. Loading Loading @@ -1334,6 +1316,20 @@ impl BtifBluetoothCallbacks for Bluetooth { // Ensure device is connectable so that disconnected device can reconnect self.set_connectable(true); // Spawn a freshness check job in the background. self.freshness_check.take().map(|h| h.abort()); let txl = self.tx.clone(); self.freshness_check = Some(tokio::spawn(async move { loop { time::sleep(FOUND_DEVICE_FRESHNESS).await; let _ = txl .send(Message::DelayedAdapterActions( DelayedActions::DeviceFreshnessCheck, )) .await; } })); if self.get_wake_allowed_device_bonded() { self.create_uhid_for_suspend_wakesource(); } Loading Loading @@ -1474,13 +1470,6 @@ impl BtifBluetoothCallbacks for Bluetooth { callback.on_discovering_changed(state == BtDiscoveryState::Started); }); // Stopped discovering and no freshness check is active. Immediately do // freshness check which will schedule a recurring future until all // entries are cleared. if !is_discovering && self.freshness_check.is_none() { self.trigger_freshness_check(); } // Start or stop BLE scanning based on discovering state if let Some(scanner_id) = self.ble_scanner_id { if is_discovering { Loading Loading
system/gd/rust/linux/stack/src/bluetooth.rs +14 −25 Original line number Diff line number Diff line Loading @@ -894,12 +894,6 @@ impl Bluetooth { /// Check whether found devices are still fresh. If they're outside the /// freshness window, send a notification to clear the device from clients. fn trigger_freshness_check(&mut self) { if let Some(ref handle) = self.freshness_check { // Abort and drop the previous JoinHandle. handle.abort(); self.freshness_check = None; } // A found device is considered fresh if: // * It was last seen less than |FOUND_DEVICE_FRESHNESS| ago. // * It is currently connected. Loading @@ -926,18 +920,6 @@ impl Bluetooth { self.bluetooth_admin.lock().unwrap().on_device_cleared(&d); } // If we have any fresh devices remaining, re-queue a freshness check. if self.found_devices.len() > 0 { let txl = self.tx.clone(); self.freshness_check = Some(tokio::spawn(async move { time::sleep(FOUND_DEVICE_FRESHNESS).await; let _ = txl .send(Message::DelayedAdapterActions(DelayedActions::DeviceFreshnessCheck)) .await; })); } } /// Makes an LE_RAND call to the Bluetooth interface. Loading Loading @@ -1334,6 +1316,20 @@ impl BtifBluetoothCallbacks for Bluetooth { // Ensure device is connectable so that disconnected device can reconnect self.set_connectable(true); // Spawn a freshness check job in the background. self.freshness_check.take().map(|h| h.abort()); let txl = self.tx.clone(); self.freshness_check = Some(tokio::spawn(async move { loop { time::sleep(FOUND_DEVICE_FRESHNESS).await; let _ = txl .send(Message::DelayedAdapterActions( DelayedActions::DeviceFreshnessCheck, )) .await; } })); if self.get_wake_allowed_device_bonded() { self.create_uhid_for_suspend_wakesource(); } Loading Loading @@ -1474,13 +1470,6 @@ impl BtifBluetoothCallbacks for Bluetooth { callback.on_discovering_changed(state == BtDiscoveryState::Started); }); // Stopped discovering and no freshness check is active. Immediately do // freshness check which will schedule a recurring future until all // entries are cleared. if !is_discovering && self.freshness_check.is_none() { self.trigger_freshness_check(); } // Start or stop BLE scanning based on discovering state if let Some(scanner_id) = self.ble_scanner_id { if is_discovering { Loading