From 301719685888589864b56ba4e52ba0eda987d7ee Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 19 Nov 2019 11:41:42 +0900 Subject: [PATCH] Add logs for tracking proper destruction Change-Id: If35c356ee2c1c5849d0b82d1a470076fc45cb370 --- plugins/wakeup-manager/src/wakeup_engine_manager.cpp | 11 +++++++++-- plugins/wakeup-manager/src/wakeup_manager.cpp | 5 +++-- plugins/wakeup-manager/src/wakeup_manager_wrapper.cpp | 4 ++-- src/multi_assistant_service.c | 11 +++++++++-- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp index cef7b6d..896057f 100644 --- a/plugins/wakeup-manager/src/wakeup_engine_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_engine_manager.cpp @@ -27,6 +27,7 @@ CWakeupEngineManager::CWakeupEngineManager() CWakeupEngineManager::~CWakeupEngineManager() { + MWR_LOGI("Wakeup Engine Manager is now being destroyed"); } CWakeupEngineManager::CWakeupEngineManager(IEngineEventObserver *observer) : CWakeupEngineManager() @@ -76,6 +77,7 @@ void CWakeupEngineManager::initialize() void CWakeupEngineManager::deinitialize() { + MWR_LOGI("[START]"); if (mStreamingThread.joinable()) { MWR_LOGD("mStreamingThread is joinable, trying join()"); mStopStreamingThread.store(true); @@ -97,20 +99,25 @@ void CWakeupEngineManager::deinitialize() if (info.interface.set_audio_data_require_status_callback) { info.interface.set_audio_data_require_status_callback(nullptr, nullptr); } + MWR_LOGI("Trying to deinitialize engine : %s", info.engine_name.c_str()); if (info.interface.deinitialize) { - info.interface.deinitialize(); + int ret = info.interface.deinitialize(); + MWR_LOGI("Deinitialization [%s] returned %d", info.engine_name.c_str(), ret); } } catch (const std::exception& e) { MWR_LOGE("[ERROR] wakeup engine %s threw exception : %s", info.engine_name.c_str(), e.what()); } if (info.engine_handle) { - dlclose(info.engine_handle); + int ret = dlclose(info.engine_handle); + MWR_LOGI("Closing [%s] returned %d, [%s]", info.engine_name.c_str(), ret, + ((0 == ret) ? "" : dlerror())); info.engine_handle = nullptr; } } mSelectedEngine = nullptr; mEngineInfo.clear(); + MWR_LOGI("[END]"); } void CWakeupEngineManager::subscribe(IEngineEventObserver *observer) diff --git a/plugins/wakeup-manager/src/wakeup_manager.cpp b/plugins/wakeup-manager/src/wakeup_manager.cpp index a6a6281..75fa067 100644 --- a/plugins/wakeup-manager/src/wakeup_manager.cpp +++ b/plugins/wakeup-manager/src/wakeup_manager.cpp @@ -68,6 +68,7 @@ CWakeupManager::CWakeupManager(IWakeupEventObserver* wakeup_observer, ISettingVa CWakeupManager::~CWakeupManager() { + MWR_LOGI("Wakeup Manager is now being destroyed"); } void CWakeupManager::initialize_wakeup_policy() @@ -122,7 +123,7 @@ bool CWakeupManager::initialize() bool CWakeupManager::deinitialize() { - MWR_LOGD("[ENTER]"); + MWR_LOGI("[ENTER]"); dependency_resolver_deinitialize(); @@ -135,7 +136,7 @@ bool CWakeupManager::deinitialize() mWakeupSettings.deinitialize(); mAssistantLanguageInfo.clear(); - MWR_LOGD("[END]"); + MWR_LOGI("[END]"); return true; } diff --git a/plugins/wakeup-manager/src/wakeup_manager_wrapper.cpp b/plugins/wakeup-manager/src/wakeup_manager_wrapper.cpp index 49b24eb..0d30121 100644 --- a/plugins/wakeup-manager/src/wakeup_manager_wrapper.cpp +++ b/plugins/wakeup-manager/src/wakeup_manager_wrapper.cpp @@ -107,7 +107,7 @@ int wakeup_manager_initialize(void) int wakeup_manager_deinitialize(void) { - MWR_LOGD("[ENTER]"); + MWR_LOGI("[ENTER]"); if (nullptr == g_wakeup_manager) return -1; @@ -122,7 +122,7 @@ int wakeup_manager_deinitialize(void) return -1; } - MWR_LOGD("[END]"); + MWR_LOGI("[END]"); return 0; } diff --git a/src/multi_assistant_service.c b/src/multi_assistant_service.c index 96ff563..8c1101f 100644 --- a/src/multi_assistant_service.c +++ b/src/multi_assistant_service.c @@ -755,12 +755,14 @@ static int init_plugin(void) static int deinit_plugin(void) { + MAS_LOGI("[ENTER]"); if (0 != multi_assistant_service_plugin_deactivate()) { MAS_LOGE("Fail to deactivate"); } if (0 != multi_assistant_service_plugin_deinitialize()) { MAS_LOGE("Fail to deinitialize"); } + MAS_LOGI("[END]"); return 0; } @@ -820,7 +822,7 @@ static int init_wakeup(void) static void deinit_wakeup(void) { - MAS_LOGD("[Enter] deinit_wakeup "); + MAS_LOGI("[Enter] deinit_wakeup"); /* if (NULL != g_current_lang) { free(g_current_lang); @@ -835,6 +837,7 @@ static void deinit_wakeup(void) if (0 != ret) { MAS_LOGE("[ERROR] Fail to close connection"); } + MAS_LOGI("[END]"); } int mas_get_current_client_pid() @@ -1399,6 +1402,7 @@ bool service_app_create(void *data) void service_app_terminate(void *data) { + MAS_LOGI("[ENTER]"); if (g_pkgmgr) { package_manager_unset_event_cb(g_pkgmgr); package_manager_destroy(g_pkgmgr); @@ -1407,6 +1411,7 @@ void service_app_terminate(void *data) // Todo: add your code here. deinit_wakeup(); + MAS_LOGI("[END]"); return; } @@ -1456,5 +1461,7 @@ int main(int argc, char* argv[]) service_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, service_app_lang_changed, &ad); service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, service_app_region_changed, &ad); - return service_app_main(argc, argv, &event_callback, ad); + int ret = service_app_main(argc, argv, &event_callback, ad); + LOGI("Main function exits with : %d", ret); + return ret; } -- 2.7.4