Check telephony status before request telephony init
authorsunyeop.hwnag <sunyeop.hwang@samsung.com>
Wed, 29 Aug 2012 04:34:52 +0000 (13:34 +0900)
committersunyeop.hwnag <sunyeop.hwang@samsung.com>
Wed, 29 Aug 2012 04:34:52 +0000 (13:34 +0900)
Change-Id: I145882478a892f8d674a71d3f8561c108c139ccf

include/pwlock.h
src/pwlock.c

index 1f8b5eb..3e66259 100755 (executable)
@@ -105,7 +105,6 @@ struct appdata {
        Evas_Object *waiting_popup;
        int win_type;           /* it is set if pwlock is set to ECORE_X_WINDOW_TYPE_NOTIFICATION */
        int tapi_smc_sid;       /* it is tapi resgistered sid for smc lab test */
-       int tapi_init_retry_cnt;  /* number of retry to tapi init */
 
        UG_BUTTON_STATE ug_btn_evt_state;
 };
index ac662ed..c48551f 100755 (executable)
@@ -446,14 +446,61 @@ Eina_Bool vconf_tapi_ready_expire_cb(void *pData)
        return ECORE_CALLBACK_CANCEL;
 }
 
+void vconf_tapi_init_ready_changed_cb(keynode_t * node, void *data)
+{
+       int api_ret = 0;
+       int isReady = 0;
+       struct appdata *ad = data;
+
+       _DBG("vconf_tapi_init_ready_changed_cb..!!");
+
+       api_ret = vconf_get_bool(VCONFKEY_TELEPHONY_READY, &isReady);
+       if (api_ret != 0) {
+               _DBG("fail to get vconf key value");
+       } else {
+               if (!isReady) {
+                       _DBG("telephony init is not ready");
+               } else {
+                       _DBG("telephony init is ready");
+                       vconf_ignore_key_changed
+                        (VCONFKEY_TELEPHONY_READY, vconf_tapi_init_ready_changed_cb);
+
+                       _trans(ad, _ST_TAPI_INIT);
+                       do_state(ad);
+               }
+       }
+       return;
+}
+
+void register_vconf_tapi_init_ready_changed(struct appdata *ad)
+{
+       _DBG("%s", __func__);
+       if (vconf_notify_key_changed
+           (VCONFKEY_TELEPHONY_READY, vconf_tapi_init_ready_changed_cb,
+            ad) != 0) {
+               _DBG("Fail to register");
+       }
+}
 static int do_ST_TAPI_INIT(struct appdata *ad)
 {
        int r;
        int is_emul;
        char *model = NULL;
+       int bReady = 0;
 
        _DBG("%s", __func__);
 
+       vconf_get_bool(VCONFKEY_TELEPHONY_READY, &bReady);
+
+       if (!bReady) {
+               _DBG("telephony is not ready");
+               register_vconf_tapi_init_ready_changed(ad);
+
+               return ECORE_CALLBACK_CANCEL;
+       }
+
+       _DBG("telephony is ready for init");
+
        system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &model);
        _DBG("SYSTEM_INFO_KEY_MODEL=%s\n", model);
        if (!strncmp("Emulator", model, sizeof(model)))
@@ -466,21 +513,10 @@ static int do_ST_TAPI_INIT(struct appdata *ad)
        ad->t = pwlock_tapi_init(pwlock_tapi_cb, ad);
        if (ad->t == NULL) {
                _ERR("TAPI init error");
-
-               ad->tapi_init_retry_cnt++;
-               _DBG("Retry count of tapi init : %d\n", ad->tapi_init_retry_cnt);
-               if (ad->tapi_init_retry_cnt < 4) {
-                       ecore_timer_add(1, timer_do, ad);
-                       return ECORE_CALLBACK_CANCEL;
-               } else {
-                       ad->tapi_init_retry_cnt = 0;
-                       _trans(ad, _ST_EXIT);
-                       return ECORE_CALLBACK_RENEW;
-               }
+               _trans(ad, _ST_EXIT);
+               return ECORE_CALLBACK_RENEW;
        }
 
-       ad->tapi_init_retry_cnt = 0;
-
        r = pwlock_tapi_ready_check();
        _DBG("tapi_ready_check : %d", r);
 
@@ -1005,9 +1041,6 @@ static int app_create(void *data)
 
        ad->is_no_sim = 0;
 
-       // set 0 to retry count of tapi init
-       ad->tapi_init_retry_cnt = 0;
-
        ad->state = _ST_FIRST;
        do_state(ad);