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

Commit 5ec09727 authored by hyungseoung.yoo's avatar hyungseoung.yoo Committed by Jaikumar Ganesh
Browse files

Bluetooth : fix for bluetooth turning on issue.(limit: 64times)

Bluetooth fails to turn on after 64 iterations.

When setUpEventLoop is called, Adapter is not ready yet.
However, we have already added the Dbus match rules. These match
rules are not deleted and we hit the dbus limit.

Change-Id: If207d4d33574685520a852b53a641adfbeb45d43
Author: hyungseoung.yoo <hyungseoung.yoo@samsung.com>
parent bc85a087
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -229,6 +229,13 @@ static jboolean setUpEventLoop(native_data_t *nat) {
        DBusError err;
        dbus_error_init(&err);

        const char *agent_path = "/android/bluetooth/agent";
        const char *capabilities = "DisplayYesNo";
        if (register_agent(nat, agent_path, capabilities) < 0) {
            dbus_connection_unregister_object_path (nat->conn, agent_path);
            return JNI_FALSE;
        }

        // Add a filter for all incoming messages
        if (!dbus_connection_add_filter(nat->conn, event_filter, nat, NULL)){
            return JNI_FALSE;
@@ -294,12 +301,6 @@ static jboolean setUpEventLoop(native_data_t *nat) {
            return JNI_FALSE;
        }

        const char *agent_path = "/android/bluetooth/agent";
        const char *capabilities = "DisplayYesNo";
        if (register_agent(nat, agent_path, capabilities) < 0) {
            dbus_connection_unregister_object_path (nat->conn, agent_path);
            return JNI_FALSE;
        }
        return JNI_TRUE;
    }
    return JNI_FALSE;