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

Commit b45354d3 authored by Ying Hsu's avatar Ying Hsu
Browse files

floss: Extend D-Bus timeout duration for powerd

btmangerd uses 2 seconds timeout duration to register with powerd
when it starts up. However, the duration is not enough as powerd
could spend more than 2 seconds at initialization. This leads to
an extra delay for system suspend as btmanagerd couldn't respond
to powerd's suspend imminent events properly.
This patch fixes this issue by aligning the timeout duration of
btmanagerd with other D-Bus clients.

Bug: 254156834
Tag: #floss
Test: manual - suspend / resume on brya
Change-Id: I00d3a5bdaa04a315f8f3f705f924855ed7762349
parent e4de4806
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -24,7 +24,10 @@ const ADAPTER_SUSPEND_INTERFACE: &str = "org.chromium.bluetooth.Suspend";
const SUSPEND_IMMINENT_SIGNAL: &str = "SuspendImminent";
const SUSPEND_DONE_SIGNAL: &str = "SuspendDone";
const BTMANAGERD_NAME: &str = "Bluetooth Manager";
const DBUS_TIMEOUT: Duration = Duration::from_secs(2);
// powerd might take more than 2 seconds at initialization, and thus we use
// D-Bus default timeout duration herer to cover this case, as other D-Bus
// clients of powerd do.
const POWERD_DBUS_TIMEOUT: Duration = Duration::from_secs(20);
const BLUEZ_SERVICE: &str = "org.bluez";

#[derive(Debug)]
@@ -370,7 +373,7 @@ impl PowerdSuspendManager {

        let conn = self.conn.clone();
        let powerd_proxy =
            dbus::nonblock::Proxy::new(POWERD_SERVICE, POWERD_PATH, DBUS_TIMEOUT, conn);
            dbus::nonblock::Proxy::new(POWERD_SERVICE, POWERD_PATH, POWERD_DBUS_TIMEOUT, conn);

        let mut request = RegisterSuspendDelayRequest::new();
        request.set_description(String::from(BTMANAGERD_NAME));