Add error log in multi-assistant-setting 90/279890/3
authorJihoon Kim <jihoon48.kim@samsung.com>
Fri, 19 Aug 2022 01:57:02 +0000 (10:57 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 24 Aug 2022 04:47:42 +0000 (13:47 +0900)
Change-Id: Ica8695fcc21af7396f8351b607193c365b7f7d13
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
common/multi_assistant_settings.c

index 39942f2a975ee2fb1f75355b0401a3e90bd1881c..5847a9c937e9ecf4accbf663f5b42b1877247c90 100644 (file)
@@ -27,18 +27,25 @@ int ma_settings_is_multiple_mode(bool *multiple) {
                res = vconf_get_bool(MODE_URL, &current_multiple);
                if (0 == res) {
                        *multiple = current_multiple;
+                       LOGI("multiple mode(%d)", current_multiple);
                        return MA_ERROR_NONE;
                } else {
+                       LOGE("Operation Failed");
                        return MA_ERROR_OPERATION_FAILED;
                }
        }
+
+       LOGE("Invalid parameter");
        return MA_ERROR_INVALID_PARAMETER;
 }
 
 int ma_settings_set_multiple_mode(bool multiple) {
        if (0 == vconf_set_bool(MODE_URL, multiple)) {
+               LOGI("multiple mode(%d)", multiple);
                return MA_ERROR_NONE;
        }
+
+       LOGE("Operation Failed");
        return MA_ERROR_OPERATION_FAILED;
 }
 
@@ -47,13 +54,16 @@ int ma_settings_get_current_voice_assistant(char** app_id) {
        int res = MA_ERROR_NONE;
 
        res = ma_settings_is_multiple_mode(&multiple);
+       LOGI("multiple mode(%d)", multiple);
        if (MA_ERROR_NONE != res) return res;
 
        char* previous_assistant = vconf_get_str(DEFAULT_ASSISTANT_URL);
        if (!multiple && previous_assistant && app_id) {
                *app_id = previous_assistant;
+               LOGI("appid: %s", *app_id);
                res = MA_ERROR_NONE;
        } else {
+               LOGE("Operation failed");
                res = MA_ERROR_OPERATION_FAILED;
                if (previous_assistant) free(previous_assistant);
        }
@@ -66,16 +76,19 @@ int ma_settings_change_voice_assistant(const char* app_id) {
        int res = MA_ERROR_NONE;
 
        res = ma_settings_is_multiple_mode(&multiple);
+       LOGD("multiple mode(%d). Error(%x)", multiple, res);
        if (MA_ERROR_NONE != res) return res;
 
        if (!multiple && app_id) {
                if (0 == vconf_set_str(DEFAULT_ASSISTANT_URL, app_id)) {
+                       LOGI("appid: %s", app_id);
                        res = MA_ERROR_NONE;
                } else {
+                       LOGE("Operation failed");
                        res = MA_ERROR_OPERATION_FAILED;
                }
-
        } else {
+               LOGE("Operation failed");
                res = MA_ERROR_OPERATION_FAILED;
        }
 
@@ -89,6 +102,7 @@ int ma_settings_set_voice_assistant_enabled(const char* app_id, bool enabled) {
        if (MA_ERROR_NONE != res) return res;
 
        if (!multiple) {
+               LOGE("Not supported");
                return MA_ERROR_NOT_SUPPORTED;
        }
        if (NULL != app_id) {
@@ -97,6 +111,7 @@ int ma_settings_set_voice_assistant_enabled(const char* app_id, bool enabled) {
                        if (NULL != enabled_assistants) {
                                char* tmp = strstr(enabled_assistants, app_id);
                                if (tmp) {
+                                       LOGE("Not supported");
                                        res = MA_ERROR_NOT_SUPPORTED;
                                } else {
                                        char assistants[MAX_LEN] = "";
@@ -104,10 +119,12 @@ int ma_settings_set_voice_assistant_enabled(const char* app_id, bool enabled) {
                                        if (0 == vconf_set_str(ENABLED_ASSISTANT_URL, assistants)) {
                                                res = MA_ERROR_NONE;
                                        } else {
+                                               LOGE("Operation failed");
                                                res = MA_ERROR_OPERATION_FAILED;
                                        }
                                }
                        } else {
+                               LOGE("Operation failed");
                                res = MA_ERROR_OPERATION_FAILED;
                        }
                } else {
@@ -126,6 +143,7 @@ int ma_settings_set_voice_assistant_enabled(const char* app_id, bool enabled) {
                                                                strncat(assistants, as, strlen(as));
                                                                strncat(assistants, ";", 1);
                                                        } else {
+                                                               LOGE("Operation failed");
                                                                res = MA_ERROR_OPERATION_FAILED;
                                                                if (enabled_assistants) {
                                                                        free(enabled_assistants);
@@ -138,12 +156,15 @@ int ma_settings_set_voice_assistant_enabled(const char* app_id, bool enabled) {
                                        if (0 == vconf_set_str(ENABLED_ASSISTANT_URL, assistants)) {
                                                res = MA_ERROR_NONE;
                                        } else {
+                                               LOGE("Operation failed");
                                                res = MA_ERROR_OPERATION_FAILED;
                                        }
                                } else {
+                                       LOGE("Not support");
                                        res = MA_ERROR_NOT_SUPPORTED;
                                }
                        } else {
+                               LOGE("Operation failed");
                                res = MA_ERROR_OPERATION_FAILED;
                        }
                }
@@ -151,6 +172,7 @@ int ma_settings_set_voice_assistant_enabled(const char* app_id, bool enabled) {
                        free(enabled_assistants);
                }
        } else {
+               LOGE("Engine not found");
                res = MA_ERROR_ENGINE_NOT_FOUND;
        }
        return res;
@@ -161,16 +183,22 @@ int ma_settings_get_default_voice_assistant(char** app_id) {
        int res = MA_ERROR_NONE;
 
        res = ma_settings_is_multiple_mode(&multiple);
+       LOGD("multiple mode(%d). Error(%x)", multiple, res);
+
        if (MA_ERROR_NONE != res) return res;
 
        char* previous_assistant = vconf_get_str(DEFAULT_ASSISTANT_URL);
        if (multiple && previous_assistant && app_id) {
                *app_id = previous_assistant;
+               LOGI("Succeeded. app id(%s)", *app_id);
                res = MA_ERROR_NONE;
        } else {
                res = MA_ERROR_OPERATION_FAILED;
+               LOGE("Operation failed");
                if (previous_assistant) free(previous_assistant);
        }
+
+       LOGD("error(%x)", res);
        return res;
 }
 
@@ -179,17 +207,21 @@ int ma_settings_set_default_voice_assistant(const char* app_id) {
        int res = MA_ERROR_NONE;
 
        res = ma_settings_is_multiple_mode(&multiple);
+       LOGD("multiple mode(%d). Error(%x)", multiple, res);
        if (MA_ERROR_NONE != res) return res;
 
        if (multiple && app_id) {
                if (0 == vconf_set_str(DEFAULT_ASSISTANT_URL, app_id)) {
+                       LOGI("Succeeded. app id(%s)", app_id);
                        res = MA_ERROR_NONE;
                } else {
+                       LOGE("Operation failed");
                        res = MA_ERROR_OPERATION_FAILED;
                }
        } else {
+               LOGE("Operation failed");
                res = MA_ERROR_OPERATION_FAILED;
        }
        return res;
 }
-//LCOV_EXCL_STOP
\ No newline at end of file
+//LCOV_EXCL_STOP