initialize import info when SIM import is canceled 19/94919/1 accepted/tizen/3.0/common/20161116.144225 accepted/tizen/3.0/ivi/20161102.075305 accepted/tizen/3.0/mobile/20161102.075229 accepted/tizen/3.0/wearable/20161102.075246 submit/tizen_3.0/20161102.044545 submit/tizen_3.0_common/20161116.085115
authorJongkyu Koo <jk.koo@samsung.com>
Mon, 24 Oct 2016 06:08:07 +0000 (15:08 +0900)
committerJongkyu Koo <jk.koo@samsung.com>
Wed, 2 Nov 2016 04:21:57 +0000 (21:21 -0700)
Change-Id: I3c3e0720469f8b7f70bd01437c23586dca4e6fab
Signed-off-by: Jongkyu Koo <jk.koo@samsung.com>
(cherry picked from commit 84de1169cb49b42cc2333470f3fd6cd7ef71dddf)

server/ctsvc_server_sim.c

index 2e71d5e..7b4a10e 100644 (file)
@@ -396,15 +396,6 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result,
        sim_contact_s *record = NULL;
        ctsvc_sim_info_s *info;
 
-       if (sim_import_cancel) {
-               DBG("SIM contacts import is canceled");
-               ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_NONE, 0, NULL);
-               WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
-               __ctsvc_server_sim_set_return_data(NULL);
-               sim_import_cancel = false;
-               return;
-       }
-
        if (NULL == sim_info) {
                /* LCOV_EXCL_START */
                ERR("sim_info is NULL, result = %d", access_rt);
@@ -426,6 +417,16 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result,
                /* LCOV_EXCL_STOP */
        }
 
+       if (sim_import_cancel) {
+               DBG("SIM contacts import is canceled");
+               ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_NONE, 0, NULL);
+               WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
+               __ctsvc_server_sim_init_import_info(info);
+               __ctsvc_server_sim_set_return_data(NULL);
+               sim_import_cancel = false;
+               return;
+       }
+
        if (TAPI_SIM_PB_INVALID_INDEX == access_rt) {
                int start_index = 0;
                if (user_data)
@@ -511,10 +512,12 @@ static void __ctsvc_server_sim_import_contact_cb(TapiHandle *handle, int result,
                        /* LCOV_EXCL_STOP */
                }
        } else {
-               if (info->file_record[TAPI_PB_3G_NAME].used_count == info->imported_cnt)
+               if (info->file_record[TAPI_PB_3G_NAME].used_count == info->imported_cnt) {
                        ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_NONE, 0, NULL);
-               else
+               } else {
+                       ERR("ctsvc_server_sim_import_contact() Fail(expectd %d but got %d)", info->file_record[TAPI_PB_3G_NAME].used_count, info->imported_cnt);
                        ret = ctsvc_server_socket_return(__ctsvc_server_sim_get_return_data(), CONTACTS_ERROR_SYSTEM, 0, NULL);
+               }
                WARN_IF(CONTACTS_ERROR_NONE != ret, "ctsvc_server_socket_return() Fail(%d)", ret);
                __ctsvc_server_sim_init_import_info(info);
                __ctsvc_server_sim_set_return_data(NULL);