Update settings management policy 43/294343/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Thu, 15 Jun 2023 12:47:44 +0000 (21:47 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Fri, 16 Jun 2023 07:36:35 +0000 (16:36 +0900)
Change-Id: Ief2e6d5c63c174c9d37e539e720d0eb0d65652bd

common/multi_assistant_settings.c
tests/src/multiassistant_setting_multiple_on_unittest.cpp

index 327431187012bf0712d347a799f68a5983d12a3d..e2b8f55a43aadfade161198276823f27af249386 100644 (file)
@@ -77,7 +77,6 @@ int ma_settings_get_current_voice_assistant(char** app_id) {
 }
 
 int ma_settings_change_voice_assistant(const char* app_id) {
-       bool multiple = false;
        int res = MA_ERROR_NONE;
 
        if (!app_id) {
@@ -85,18 +84,9 @@ int ma_settings_change_voice_assistant(const char* app_id) {
                return MA_ERROR_INVALID_PARAMETER;
        }
 
-       res = ma_settings_is_multiple_mode(&multiple);
-       LOGD("multiple mode(%d). Error(%x)", multiple, res);
-       if (MA_ERROR_NONE != res) return res;
-
-       if (!multiple) {
-               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;
-               }
+       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;
@@ -162,8 +152,8 @@ 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;
+                               LOGI("Already set as ENABLED : %s", app_id);
+                               res = MA_ERROR_NONE;
                        } else {
                                char assistants[MAX_LEN] = "";
                                snprintf(assistants, MAX_LEN, "%s%s;", enabled_assistants, app_id);
@@ -175,7 +165,7 @@ int ma_settings_set_voice_assistant_enabled(const char* app_id, bool enabled) {
                                }
                        }
                } else {
-                       LOGE("Operation failed");
+                       LOGE("Operation failed : Could not get vconf value");
                        res = MA_ERROR_OPERATION_FAILED;
                }
        } else {
index 3131ad0e41257403a4f43152efc4277528dac47b..40d0d62d93e0940bd7ce2387c5fe1055881f0290 100644 (file)
@@ -66,10 +66,10 @@ TEST_F(MultiAssistantSettingMultipleOnTest, utc_ma_settings_change_voice_assista
     EXPECT_EQ(ret, MA_ERROR_INVALID_PARAMETER);
 }
 
-TEST_F(MultiAssistantSettingMultipleOnTest, utc_ma_settings_change_voice_assistant_operation_failed)
+TEST_F(MultiAssistantSettingMultipleOnTest, utc_ma_settings_change_voice_assistant_error_none)
 {
     int ret = ma_settings_change_voice_assistant(TEST_VOICE_ASSISTANT_APPID);
-    EXPECT_EQ(ret, MA_ERROR_OPERATION_FAILED);
+    EXPECT_EQ(ret, MA_ERROR_NONE);
 }
 
 TEST_F(MultiAssistantSettingMultipleOnTest, utc_ma_settings_get_voice_assistant_enabled_invalid_parameter)