Loading system/gd/rust/linux/stack/src/bluetooth_gatt.rs +5 −5 Original line number Diff line number Diff line Loading @@ -1735,7 +1735,7 @@ impl BluetoothGatt { /// It assumes that scanner.filter has already had the filter data. fn resume_scan(&mut self, scanner_id: u8) -> BtStatus { if !self.enabled { return BtStatus::Fail; return BtStatus::UnexpectedState; } if self.get_scan_suspend_mode() != SuspendMode::Resuming { Loading @@ -1756,7 +1756,7 @@ impl BluetoothGatt { "This Scanner {} is supposed to resume from suspended state", scanner_id ); return BtStatus::Fail; return BtStatus::UnexpectedState; } } else { log::warn!("Scanner {} not found", scanner_id); Loading @@ -1775,7 +1775,7 @@ impl BluetoothGatt { // Add and enable the monitor filter only when the MSFT extension is supported. if !is_msft_supported { log::error!("add_child_monitor: MSFT extension is not supported"); return BtStatus::Fail; return BtStatus::Unsupported; } log::debug!( "add_child_monitor: monitoring address, scanner_id={}, filter={:?}", Loading Loading @@ -2181,7 +2181,7 @@ impl IBluetoothGatt for BluetoothGatt { filter: Option<ScanFilter>, ) -> BtStatus { if !self.enabled { return BtStatus::Fail; return BtStatus::UnexpectedState; } if self.get_scan_suspend_mode() != SuspendMode::Normal { Loading Loading @@ -2231,7 +2231,7 @@ impl IBluetoothGatt for BluetoothGatt { fn stop_scan(&mut self, scanner_id: u8) -> BtStatus { if !self.enabled { return BtStatus::Fail; return BtStatus::UnexpectedState; } let scan_suspend_mode = self.get_scan_suspend_mode(); Loading system/gd/rust/linux/stack/src/socket_manager.rs +10 −10 Original line number Diff line number Diff line Loading @@ -600,7 +600,7 @@ impl BluetoothSocketManager { .any(|(_, v)| v.iter().any(|s| s.uuid.map_or(false, |u| u == uuid))) { log::warn!("Service {} already exists", DisplayUuid(&uuid)); return SocketResult::new(BtStatus::Fail, INVALID_SOCKET_ID); return SocketResult::new(BtStatus::SocketError, INVALID_SOCKET_ID); } } Loading Loading @@ -639,7 +639,7 @@ impl BluetoothSocketManager { Some(v) => v, None => { log::debug!("Converting from file to unixstream failed"); return SocketResult::new(BtStatus::Fail, INVALID_SOCKET_ID); return SocketResult::new(BtStatus::SocketError, INVALID_SOCKET_ID); } }; Loading Loading @@ -773,7 +773,7 @@ impl BluetoothSocketManager { Self::wait_and_read_stream(connection_timeout, &stream, &mut channel_bytes).await; let channel = i32::from_ne_bytes(channel_bytes); if channel <= 0 { status = BtStatus::Fail; status = BtStatus::SocketError; } // If we don't get a valid channel, consider the socket as closed. Loading Loading @@ -971,7 +971,7 @@ impl BluetoothSocketManager { SocketActions::OnIncomingSocketReady( cbid, cloned_socket_info, BtStatus::Fail, BtStatus::SocketError, ), )) .await; Loading Loading @@ -1022,7 +1022,7 @@ impl BluetoothSocketManager { Ok(()) => {} Err(_e) => { // Stream was not readable. This is usually due to some polling error. return BtStatus::Fail; return BtStatus::SocketError; } }, Err(_) => { Loading @@ -1034,12 +1034,12 @@ impl BluetoothSocketManager { match stream.try_read(buf) { Ok(n) => { if n != buf.len() { return BtStatus::Fail; return BtStatus::SocketError; } return BtStatus::Success; } _ => { return BtStatus::Fail; return BtStatus::SocketError; } } } Loading @@ -1065,7 +1065,7 @@ impl BluetoothSocketManager { .send(Message::SocketManagerActions(SocketActions::OnOutgoingConnectionResult( cbid, socket_id, BtStatus::Fail, BtStatus::SocketError, None, ))) .await; Loading @@ -1078,7 +1078,7 @@ impl BluetoothSocketManager { let mut status = Self::wait_and_read_stream(connection_timeout, &stream, &mut channel_bytes).await; if i32::from_ne_bytes(channel_bytes) <= 0 { status = BtStatus::Fail; status = BtStatus::SocketError; } if status != BtStatus::Success { log::info!( Loading Loading @@ -1147,7 +1147,7 @@ impl BluetoothSocketManager { .send(Message::SocketManagerActions(SocketActions::OnOutgoingConnectionResult( cbid, socket_id, BtStatus::Fail, BtStatus::SocketError, None, ))) .await; Loading system/gd/rust/topshim/src/btif.rs +3 −0 Original line number Diff line number Diff line Loading @@ -218,6 +218,9 @@ pub enum BtStatus { JniThreadAttachError, WakeLockError, Timeout, DeviceNotFound, UnexpectedState, SocketError, // Any statuses that couldn't be cleanly converted Unknown = 0xff, Loading Loading
system/gd/rust/linux/stack/src/bluetooth_gatt.rs +5 −5 Original line number Diff line number Diff line Loading @@ -1735,7 +1735,7 @@ impl BluetoothGatt { /// It assumes that scanner.filter has already had the filter data. fn resume_scan(&mut self, scanner_id: u8) -> BtStatus { if !self.enabled { return BtStatus::Fail; return BtStatus::UnexpectedState; } if self.get_scan_suspend_mode() != SuspendMode::Resuming { Loading @@ -1756,7 +1756,7 @@ impl BluetoothGatt { "This Scanner {} is supposed to resume from suspended state", scanner_id ); return BtStatus::Fail; return BtStatus::UnexpectedState; } } else { log::warn!("Scanner {} not found", scanner_id); Loading @@ -1775,7 +1775,7 @@ impl BluetoothGatt { // Add and enable the monitor filter only when the MSFT extension is supported. if !is_msft_supported { log::error!("add_child_monitor: MSFT extension is not supported"); return BtStatus::Fail; return BtStatus::Unsupported; } log::debug!( "add_child_monitor: monitoring address, scanner_id={}, filter={:?}", Loading Loading @@ -2181,7 +2181,7 @@ impl IBluetoothGatt for BluetoothGatt { filter: Option<ScanFilter>, ) -> BtStatus { if !self.enabled { return BtStatus::Fail; return BtStatus::UnexpectedState; } if self.get_scan_suspend_mode() != SuspendMode::Normal { Loading Loading @@ -2231,7 +2231,7 @@ impl IBluetoothGatt for BluetoothGatt { fn stop_scan(&mut self, scanner_id: u8) -> BtStatus { if !self.enabled { return BtStatus::Fail; return BtStatus::UnexpectedState; } let scan_suspend_mode = self.get_scan_suspend_mode(); Loading
system/gd/rust/linux/stack/src/socket_manager.rs +10 −10 Original line number Diff line number Diff line Loading @@ -600,7 +600,7 @@ impl BluetoothSocketManager { .any(|(_, v)| v.iter().any(|s| s.uuid.map_or(false, |u| u == uuid))) { log::warn!("Service {} already exists", DisplayUuid(&uuid)); return SocketResult::new(BtStatus::Fail, INVALID_SOCKET_ID); return SocketResult::new(BtStatus::SocketError, INVALID_SOCKET_ID); } } Loading Loading @@ -639,7 +639,7 @@ impl BluetoothSocketManager { Some(v) => v, None => { log::debug!("Converting from file to unixstream failed"); return SocketResult::new(BtStatus::Fail, INVALID_SOCKET_ID); return SocketResult::new(BtStatus::SocketError, INVALID_SOCKET_ID); } }; Loading Loading @@ -773,7 +773,7 @@ impl BluetoothSocketManager { Self::wait_and_read_stream(connection_timeout, &stream, &mut channel_bytes).await; let channel = i32::from_ne_bytes(channel_bytes); if channel <= 0 { status = BtStatus::Fail; status = BtStatus::SocketError; } // If we don't get a valid channel, consider the socket as closed. Loading Loading @@ -971,7 +971,7 @@ impl BluetoothSocketManager { SocketActions::OnIncomingSocketReady( cbid, cloned_socket_info, BtStatus::Fail, BtStatus::SocketError, ), )) .await; Loading Loading @@ -1022,7 +1022,7 @@ impl BluetoothSocketManager { Ok(()) => {} Err(_e) => { // Stream was not readable. This is usually due to some polling error. return BtStatus::Fail; return BtStatus::SocketError; } }, Err(_) => { Loading @@ -1034,12 +1034,12 @@ impl BluetoothSocketManager { match stream.try_read(buf) { Ok(n) => { if n != buf.len() { return BtStatus::Fail; return BtStatus::SocketError; } return BtStatus::Success; } _ => { return BtStatus::Fail; return BtStatus::SocketError; } } } Loading @@ -1065,7 +1065,7 @@ impl BluetoothSocketManager { .send(Message::SocketManagerActions(SocketActions::OnOutgoingConnectionResult( cbid, socket_id, BtStatus::Fail, BtStatus::SocketError, None, ))) .await; Loading @@ -1078,7 +1078,7 @@ impl BluetoothSocketManager { let mut status = Self::wait_and_read_stream(connection_timeout, &stream, &mut channel_bytes).await; if i32::from_ne_bytes(channel_bytes) <= 0 { status = BtStatus::Fail; status = BtStatus::SocketError; } if status != BtStatus::Success { log::info!( Loading Loading @@ -1147,7 +1147,7 @@ impl BluetoothSocketManager { .send(Message::SocketManagerActions(SocketActions::OnOutgoingConnectionResult( cbid, socket_id, BtStatus::Fail, BtStatus::SocketError, None, ))) .await; Loading
system/gd/rust/topshim/src/btif.rs +3 −0 Original line number Diff line number Diff line Loading @@ -218,6 +218,9 @@ pub enum BtStatus { JniThreadAttachError, WakeLockError, Timeout, DeviceNotFound, UnexpectedState, SocketError, // Any statuses that couldn't be cleanly converted Unknown = 0xff, Loading