Apply tizen 3.0 based product patchsets
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-main.c
index 9b10d6d..b9d9fb5 100644 (file)
@@ -130,6 +130,11 @@ static gboolean __bt_check_bt_service(void *data)
        int ps_mode_deactivation = 0;
 #endif
 
+       if (_is_name_acquired() == FALSE) {
+               BT_ERR("dbus name is NOT acquired yet");
+               return TRUE;
+       }
+
        status = _bt_adapter_get_status();
        le_status = _bt_adapter_get_le_status();
        BT_DBG("State: %d, LE State: %d", status, le_status);
@@ -156,6 +161,15 @@ static gboolean __bt_check_bt_service(void *data)
                if (vconf_get_int(BT_OFF_DUE_TO_TIMEOUT, &bt_off_due_to_timeout) != 0)
                        BT_ERR("Fail to get BT_OFF_DUE_TO_TIMEOUT");
 
+               if (bt_off_due_to_timeout) {
+                       /* Set the vconf flag to 0 here, if BT need to be enabled
+                       bt_off_due_to_timeout variable already hold the old value */
+
+                       if (vconf_set_int(BT_OFF_DUE_TO_TIMEOUT, 0) != 0)
+                               BT_ERR("Set vconf failed");
+               }
+
+
                if ((bt_status != VCONFKEY_BT_STATUS_OFF || bt_off_due_to_timeout) &&
                        (status == BT_DEACTIVATED)) {
                        BT_DBG("Previous session was enabled.");