static void __generate_best_pattern(i18n_udatepg_h pattern_generator, const char *locale, const i18n_uchar *skeleton, char *formatted_string, const time_t *time);
static char *__get_date_text(i18n_udatepg_h pattern_generator, const char *locale, const char *skeleton, const time_t *time);
static void __app_launch_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data);
-static void __update_params_according_lockstate(callui_app_data_t *ad);
+static void __try_send_app_launch_request(callui_app_data_t *ad, app_control_h app_control);
static bool __bt_device_connected_profile(bt_profile_e profile, void *user_data)
{
}
}
-/**
- * @brief Updates application params according to lockstate
- *
- * @param[in] ad App data
- */
-static void __update_params_according_lockstate(callui_app_data_t *ad)
-{
- callui_idle_lock_type_t type = _callui_common_get_idle_lock_type();
- if (type == CALLUI_LOCK_TYPE_SECURITY_LOCK) {
- _callui_window_set_above_lockscreen_state(ad->window, false);
- }
-
- if (type != CALLUI_LOCK_TYPE_UNLOCK) {
- _callui_common_unlock_swipe_lock();
- }
-}
-
static void __app_launch_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
{
debug_enter();
CALLUI_RETURN_IF_FAIL(user_data);
callui_app_data_t *ad = user_data;
+ callui_idle_lock_type_t type = _callui_common_get_idle_lock_type();
if (result == APP_CONTROL_RESULT_APP_STARTED) {
ad->on_background = true;
- __update_params_according_lockstate(ad);
} else if (result == APP_CONTROL_RESULT_FAILED) {
- if (ad->start_lock_manager_on_resume) {
+ if (ad->start_lock_manager_on_resume && type != CALLUI_LOCK_TYPE_SECURITY_LOCK) {
_callui_lock_manager_start(ad->lock_handle);
ad->start_lock_manager_on_resume = false;
}
}
/**
+ * @brief Tries to send application launch request
+ *
+ * @param[in] ad Application data
+ * @param[in] app_control App_control to send launch request
+ */
+static void __try_send_app_launch_request(callui_app_data_t *ad, app_control_h app_control)
+{
+ int ret;
+ callui_idle_lock_type_t type = _callui_common_get_idle_lock_type();
+
+ if (type == CALLUI_LOCK_TYPE_SWIPE_LOCK) {
+ if (ad->delayed_app_control) {
+ dbg("Ignored. Delayed app launch request is already registered.");
+ return;
+ }
+ ret = app_control_clone(&ad->delayed_app_control, app_control);
+ CALLUI_RETURN_IF_FAIL(ret == APP_CONTROL_ERROR_NONE);
+
+ dbg("Delayed app launch request successfully registered.");
+ _callui_common_unlock_swipe_lock();
+ return;
+ }
+
+ dbg("Make launch request.");
+ if ((ret = app_control_send_launch_request(app_control, __app_launch_reply_cb, ad)) != APP_CONTROL_ERROR_NONE) {
+ err("app_control_send_launch_request() is failed. ret[%d]", ret);
+ } else {
+ if (type == CALLUI_LOCK_TYPE_SECURITY_LOCK) {
+ _callui_window_set_above_lockscreen_state(ad->window, false);
+ }
+ __try_to_stop_lock_manager(ad);
+
+ if (type != CALLUI_LOCK_TYPE_UNLOCK) {
+ _callui_common_unlock_swipe_lock();
+ }
+ }
+}
+
+/**
* @brief Launches bluetooth application
*
* @param[in] appdata App data
err("app_control_set_operation() is failed. ret[%d]", ret);
} else if ((ret = app_control_enable_app_started_result_event(app_control)) != APP_CONTROL_ERROR_NONE) {
err("app_control_enable_app_started_result_event() is failed. ret[%d]", ret);
- } else if ((ret = app_control_send_launch_request(app_control, __app_launch_reply_cb, ad)) != APP_CONTROL_ERROR_NONE) {
- err("app_control_send_launch_request() is failed. ret[%d]", ret);
} else {
- __try_to_stop_lock_manager(ad);
+ __try_send_app_launch_request(ad, app_control);
}
+
if (app_control) {
app_control_destroy(app_control);
}
err("app_control_add_extra_data() is failed. ret[%d]", ret);
} else if ((ret = app_control_enable_app_started_result_event(app_control)) != APP_CONTROL_ERROR_NONE) {
err("app_control_enable_app_started_result_event() is failed. ret[%d]", ret);
- } else if ((ret = app_control_send_launch_request(app_control, __app_launch_reply_cb, ad)) != APP_CONTROL_ERROR_NONE) {
- err("app_control_send_launch_request() is failed. ret[%d]", ret);
} else {
- __try_to_stop_lock_manager(ad);
+ __try_send_app_launch_request(ad, app_control);
}
+
if (app_control) {
app_control_destroy(app_control);
}
err("app_control_set_operation() is failed. ret[%d]", ret);
} else if ((ret = app_control_enable_app_started_result_event(app_control)) != APP_CONTROL_ERROR_NONE) {
err("app_control_enable_app_started_result_event() is failed. ret[%d]", ret);
- } else if ((ret = app_control_send_launch_request(app_control, __app_launch_reply_cb, ad)) != APP_CONTROL_ERROR_NONE) {
- err("app_control_send_launch_request() is failed. ret[%d]", ret);
} else {
- __try_to_stop_lock_manager(ad);
+ __try_send_app_launch_request(ad, app_control);
}
+
if (app_control) {
app_control_destroy(app_control);
}
return powerkey_mode;
}
+static void _check_and_try_make_delayed_app_launch_request(callui_app_data_t *ad)
+{
+ if (!ad->delayed_app_control) {
+ dbg("No delayed app launch request");
+ return;
+ }
+
+ int ret;
+ if ((ret = app_control_send_launch_request(ad->delayed_app_control, __app_launch_reply_cb, ad)) != APP_CONTROL_ERROR_NONE) {
+ err("app_control_send_launch_request() is failed. ret[%d]", ret);
+ }
+ app_control_destroy(ad->delayed_app_control);
+ ad->delayed_app_control = NULL;
+}
+
static void __lock_state_changed_cb(system_settings_key_e key, void *user_data)
{
debug_enter();
ad->need_win_minimize = false;
_callui_window_minimize(ad->window);
}
+ _check_and_try_make_delayed_app_launch_request(ad);
} else {
dbg("Device lock state [LOCKED]");
if (!ad->on_background) {