adapter: Don't remove temporary devices on disconnect
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Sat, 18 Jul 2020 00:34:38 +0000 (17:34 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 12 Apr 2021 09:00:50 +0000 (14:30 +0530)
This makes the disconnect logic just update last seen field of the
device so in case it is temporary it would trigger its timer and be
removed after the timeout which is consistent with the discovery
session givin a grace time for application to react to such events.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/adapter.c
src/device.c

index bc39e6f..d8e6c99 100644 (file)
@@ -12089,13 +12089,11 @@ static void adapter_remove_connection(struct btd_adapter *adapter,
                        device_is_bonded(device, bdaddr_type));
        if ((device_is_temporary(device) && !device_is_retrying(device)) ||
                        (!device_is_bonded(device, bdaddr_type))) {
-#else
-       if (device_is_temporary(device) && !device_is_retrying(device)) {
-#endif
+
                const char *path = device_get_path(device);
 
                DBG("Removing temporary device %s", path);
-#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+
                /* device_is_paired is added incase of tempoary bonded
                 * oop file transfer in that device is not bonded it's paired.
                 */
@@ -12106,8 +12104,6 @@ static void adapter_remove_connection(struct btd_adapter *adapter,
                }
 
                btd_adapter_unpair_device(adapter, device);
-#else
-               btd_adapter_remove_device(adapter, device);
 #endif
        }
 }
index 9f58ff0..d314823 100644 (file)
@@ -4801,6 +4801,8 @@ void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type)
        if (device->bredr_state.connected || device->le_state.connected)
                return;
 
+       device_update_last_seen(device, bdaddr_type);
+
        g_dbus_emit_property_changed(dbus_conn, device->path,
                                                DEVICE_INTERFACE, "Connected");
 #else