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

Commit d6c80c06 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "floss: Fix disconnect order and gatt cache"

parents 32ef369e 30bacb0a
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -33,6 +33,15 @@ using gatt::StoredAttribute;
using std::string;
using std::vector;

#ifdef TARGET_FLOSS
#define GATT_CACHE_PREFIX "/var/lib/bluetooth/gatt/gatt_cache_"
#define GATT_CACHE_VERSION 6

#define GATT_HASH_MAX_SIZE 30
#define GATT_HASH_PATH_PREFIX "/var/lib/bluetooth/gatt/gatt_hash_"
#define GATT_HASH_PATH "/var/lib/bluetooth/gatt"
#define GATT_HASH_FILE_PREFIX "gatt_hash_"
#else
#define GATT_CACHE_PREFIX "/data/misc/bluetooth/gatt_cache_"
#define GATT_CACHE_VERSION 6

@@ -40,6 +49,7 @@ using std::vector;
#define GATT_HASH_PATH_PREFIX "/data/misc/bluetooth/gatt_hash_"
#define GATT_HASH_PATH "/data/misc/bluetooth"
#define GATT_HASH_FILE_PREFIX "gatt_hash_"
#endif

// Default expired time is 7 days
#define GATT_HASH_EXPIRED_TIME 604800
+2 −7
Original line number Diff line number Diff line
@@ -1734,22 +1734,17 @@ impl BtifGattClientCallbacks for BluetoothGatt {
        client_id: i32,
        addr: RawAddress,
    ) {
        self.context_map.remove_connection(client_id, conn_id);
        let client = self.context_map.get_by_client_id(client_id);
        if let Some(c) = client {
            let cbid = c.cbid;
            self.context_map.get_callback_from_callback_id(cbid).and_then(
                |cb: &mut GattClientCallback| {
                    cb.on_client_connection_state(
                        status,
                        client_id,
                        status == GattStatus::Success,
                        addr.to_string(),
                    );
                    cb.on_client_connection_state(status, client_id, false, addr.to_string());
                    Some(())
                },
            );
        }
        self.context_map.remove_connection(client_id, conn_id);
    }

    fn search_complete_cb(&mut self, conn_id: i32, _status: GattStatus) {