mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2025-01-09 13:03:23 +08:00
android/main: Call unregister for all registered services on exit
This commit is contained in:
parent
85512df86d
commit
13d5e9c49b
@ -493,6 +493,38 @@ static void cleanup_hal_connection(void)
|
||||
ipc_cleanup();
|
||||
}
|
||||
|
||||
static void cleanup_services(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
DBG("");
|
||||
|
||||
for (i = HAL_SERVICE_ID_BLUETOOTH; i < HAL_SERVICE_ID_MAX; i++) {
|
||||
if (!services[i])
|
||||
continue;
|
||||
|
||||
switch (i) {
|
||||
case HAL_SERVICE_ID_BLUETOOTH:
|
||||
bt_bluetooth_unregister();
|
||||
break;
|
||||
case HAL_SERVICE_ID_SOCK:
|
||||
bt_socket_unregister();
|
||||
break;
|
||||
case HAL_SERVICE_ID_HIDHOST:
|
||||
bt_hid_unregister();
|
||||
break;
|
||||
case HAL_SERVICE_ID_A2DP:
|
||||
bt_a2dp_unregister();
|
||||
break;
|
||||
case HAL_SERVICE_ID_PAN:
|
||||
bt_pan_unregister();
|
||||
break;
|
||||
}
|
||||
|
||||
services[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool set_capabilities(void)
|
||||
{
|
||||
#if defined(ANDROID)
|
||||
@ -598,6 +630,8 @@ int main(int argc, char *argv[])
|
||||
if (bluetooth_start_timeout > 0)
|
||||
g_source_remove(bluetooth_start_timeout);
|
||||
|
||||
cleanup_services();
|
||||
|
||||
cleanup_hal_connection();
|
||||
stop_sdp_server();
|
||||
bt_bluetooth_cleanup();
|
||||
|
Loading…
Reference in New Issue
Block a user