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

Commit 0d60b024 authored by Michael Sun's avatar Michael Sun
Browse files

floss: Add on_device_connection_failed callback

Add a callback to immediately notify the browser that a pending
connection attempt failed.

Uprev btmanagerd version to 0.7.1,  this is backward compatible API change.

Bug: 353527430
Test: mmm packages/modules/Bluetooth
Flag: EXEMPT, Floss only change

Change-Id: I27cc51c76731c8d9113ad5bf025a14bec48d27ca
parent d1fddbc7
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -377,6 +377,14 @@ impl IBluetoothConnectionCallback for BtConnectionCallback {
            remote_device.name
        );
    }

    fn on_device_connection_failed(&mut self, remote_device: BluetoothDevice, status: BtStatus) {
        print_info!(
            "Connection to [{}] failed, status = {:?}",
            remote_device.address.to_string(),
            status
        );
    }
}

impl RPCProxy for BtConnectionCallback {
+3 −0
Original line number Diff line number Diff line
@@ -677,6 +677,9 @@ impl IBluetoothConnectionCallback for IBluetoothConnectionCallbackDBus {

    #[dbus_method("OnDeviceDisconnected", DBusLog::Disable)]
    fn on_device_disconnected(&mut self, remote_device: BluetoothDevice) {}

    #[dbus_method("OnDeviceConnectionFailed", DBusLog::Disable)]
    fn on_device_connection_failed(&mut self, remote_device: BluetoothDevice, status: BtStatus) {}
}

#[allow(dead_code)]
+1 −1
Original line number Diff line number Diff line
[package]
name = "manager_service"
version = "0.7.0"
version = "0.7.1"
edition = "2018"
build = "build.rs"

+8 −0
Original line number Diff line number Diff line
@@ -196,6 +196,14 @@ impl IBluetoothConnectionCallback for BluetoothConnectionCallbackDBus {
    fn on_device_disconnected(&mut self, remote_device: BluetoothDevice) {
        dbus_generated!()
    }

    #[dbus_method(
        "OnDeviceConnectionFailed",
        DBusLog::Enable(DBusLogOptions::LogAll, DBusLogVerbosity::Verbose)
    )]
    fn on_device_connection_failed(&mut self, remote_device: BluetoothDevice, status: BtStatus) {
        dbus_generated!()
    }
}

impl_dbus_arg_enum!(BtSdpType);
+9 −0
Original line number Diff line number Diff line
@@ -574,6 +574,9 @@ pub trait IBluetoothConnectionCallback: RPCProxy {

    /// Notification sent when a remote device completes HCI disconnection.
    fn on_device_disconnected(&mut self, remote_device: BluetoothDevice);

    /// Notification sent when a remote device fails to complete HCI connection.
    fn on_device_connection_failed(&mut self, remote_device: BluetoothDevice, status: BtStatus);
}

/// Implementation of the adapter API.
@@ -2061,6 +2064,12 @@ impl BtifBluetoothCallbacks for Bluetooth {
                conn_direction,
                hci_reason,
            );
            self.connection_callbacks.for_all_callbacks(|callback| {
                callback.on_device_connection_failed(
                    BluetoothDevice::new(addr, String::from("")),
                    status,
                );
            });
            return;
        }