Unregister obex-server and media-player 83/107183/1
authorNagaraj D R <nagaraj.dr@samsung.com>
Thu, 15 Dec 2016 10:47:55 +0000 (16:17 +0530)
committerNagaraj D R <nagaraj.dr@samsung.com>
Tue, 27 Dec 2016 05:21:57 +0000 (10:51 +0530)
In case of recovery adapter, flightmode, and UPS
media player and obex-server are not unregistered.
This might lead to problmes if bt-service is kept alive.

Change-Id: Ib5e299572ae528facfaf62db4f2959c4acd83f69

bt-service/bt-service-adapter.c

index 27300e0..0168758 100644 (file)
@@ -875,6 +875,18 @@ void _bt_handle_adapter_removed(void)
        if (0 != ret)
                ERR("vconf_ignore_key_changed failed\n");
 
+/* unregister all the services/servers/profiles registered on bluez-adapter
+    once adapter is removed, reinitializing of the state-varaibles becomes
+    a problem */
+       if (_bt_unregister_obex_server() != BLUETOOTH_ERROR_NONE)
+               BT_ERR("Fail to unregister obex server");
+
+       if (_bt_unregister_media_player() != BLUETOOTH_ERROR_NONE)
+               BT_ERR("Fail to unregister media player");
+
+/* Other unregister APIs should be placed here */
+
+
 #ifndef TIZEN_FEATURE_BT_USB_DONGLE
        _bt_destroy_agent(adapter_agent);
        adapter_agent = NULL;
@@ -1331,7 +1343,16 @@ int _bt_disable_adapter(void)
                g_source_remove(timer_id);
                timer_id = 0;
        }
+/* unregister all the services/servers/profiles registered on bluez-adapter
+    once adapter is removed, reinitializing of the state-varaibles becomes
+    a problem */
+       if (_bt_unregister_obex_server() != BLUETOOTH_ERROR_NONE)
+               BT_ERR("Fail to unregister obex server");
+
+       if (_bt_unregister_media_player() != BLUETOOTH_ERROR_NONE)
+               BT_ERR("Fail to unregister media player");
 
+/* Other unregister APIs should be placed here */
        __bt_disconnect_all();
        ret = _bt_disable_cb();