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

Commit d908e7bd authored by Sonny Sasaka's avatar Sonny Sasaka
Browse files

Floss: Workaround D-Bus timing

Under D-Bus spec, when a service announces an availability of an
Interface via InterfacesAdded signal, it signifies that it is ready to
accept calls on that interface. However, it seems that `dbus-rs` library
does not guarantee the readiness of accepting calls after emitting
InterfacesAdded.

This is a temporary workaround to wait for a certain amount before
making method calls after receiving InterfacesAdded of btadapterd's
Suspend API.

Bug: 224606285
Tag: #floss
Test: Manual - Enabling adapter should not crash btmanagerd

Change-Id: Iad6a932e6d4cf99dc6857b015052405f1879c568
parent f6cd7254
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -236,6 +236,13 @@ impl PowerdSuspendManager {
                Box::new(move |path| {
                    let tx_clone = tx1.clone();
                    tokio::spawn(async move {
                        // When dbus-rs announces that an interface is added, it does not guarantee
                        // that the interface is ready to accept calls. The workaround is to wait
                        // for a non-zero short amount of time.
                        // TODO(b/232565047): Ideally dbus-rs should be fixed to reliably announce
                        // the availability of an interface.
                        tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;

                        let _ = tx_clone.send(SuspendManagerMessage::AdapterFound(path)).await;
                    });
                }),