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

Commit d7f873a8 authored by Yun-Hao Chung's avatar Yun-Hao Chung Committed by Yun-hao Chung
Browse files

Floss: Request Manager DBus name when ready

Some clients immediately call btmanager APIs after the service can be
seen, which can fail if the object manager or interface isn't fully
initialized. While we could change client behavior, modifying
btmanager seems the least disruptive solution.

Bug: 359815670
Test: mmm packages/modules/Bluetooth
Test:stop ui; stop btmanagerd; start ui; start btmanagerd; make sure
Bluetooth Icon exists.
Flag: EXEMPT, Floss-only changes

Change-Id: Iebf1e6d079ad17160105ecb2b38e80b432df2731
parent a0c9568d
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -86,10 +86,6 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
        panic!("Lost connection to D-Bus: {}", err);
    });

    // Let's request a name on the bus, so that clients can find us.
    conn.request_name("org.chromium.bluetooth.Manager", false, true, false).await?;
    log::debug!("D-Bus name: {}", conn.unique_name());

    // Create a new crossroads instance.
    // The instance is configured so that introspection and properties interfaces
    // are added by default on object path additions.
@@ -153,6 +149,9 @@ pub async fn main() -> Result<(), Box<dyn std::error::Error>> {
    });

    cr.lock().unwrap().insert("/org/chromium/bluetooth/Manager", &[iface, iface_exp], mixin);
    // Let's request a name on the bus, so that clients can find us.
    conn.request_name("org.chromium.bluetooth.Manager", false, true, false).await?;
    log::debug!("D-Bus name: {}", conn.unique_name());

    let mut powerd_suspend_manager = PowerdSuspendManager::new(conn.clone(), cr);