aul_launcher_service_h als;
screen_connector_launcher_service_evas_h scls_evas;
frame_context_h context;
+ frame_context_h pre_context;
};
static GList *__win_list;
return (uint32_t)serial;
}
+static void __check_pre_context(frame_broker_h broker)
+{
+ if (broker->context) {
+ _D("Destroy previous context");
+ frame_context_destroy(broker->context);
+ }
+
+ broker->context = broker->pre_context;
+ broker->pre_context = NULL;
+
+ frame_context_on_create(broker->context);
+}
+
static void __aul_launcher_service_cb(const char *app_id,
const char *inst_id,
const int pid,
{
frame_broker_h broker = user_data;
frame_context_h context;
+ int ctx_pid = -1;
+ uint32_t ctx_serial = 0;
int ret;
_D("app_id(%s), inst_id(%s), pid(%d), serial(%u)",
app_id, inst_id, pid, serial);
+
+ if (broker->pre_context) {
+ __check_pre_context(broker);
+ return;
+ }
+
+ if (broker->context) {
+ frame_context_get_pid(broker->context, &ctx_pid);
+ frame_context_get_serial(broker->context, &ctx_serial);
+ if (ctx_pid == pid && ctx_serial == serial) {
+ _D("Frame context already exists");
+ return;
+ }
+ }
+
ret = frame_context_create(broker, app_id, inst_id, pid, serial,
&broker->callback, broker->user_data,
&context);
_D("[__SCLS_EVAS__] Prepare");
if (context == NULL) {
- _E("Invalid context");
- return;
+ if (broker->pre_context) {
+ __check_pre_context(broker);
+ } else {
+ _E("Invalid context");
+ return;
+ }
}
frame_context_set_serial(context, serial);
_D("[__SCLS_EVAS__] Stop");
if (context == NULL) {
- _E("Invalid context");
- return;
+ if (broker->pre_context) {
+ __check_pre_context(broker);
+ } else {
+ _E("Invalid context");
+ return;
+ }
}
_D("Destroy context");
_D("[__SCLS_EVAS__] Error");
if (context == NULL) {
- _E("Invalid context");
- return;
+ if (broker->pre_context) {
+ __check_pre_context(broker);
+ } else {
+ _E("Invalid context");
+ return;
+ }
}
frame_context_on_error(context, __convert_error(error));
ret = frame_broker_launch(handle, app_id, inst_id, pid,
&serial);
}
+
+ if (inst_id && pid > 0) {
+ frame_context_destroy(handle->pre_context);
+ handle->pre_context = NULL;
+
+ frame_context_create(handle, app_id, inst_id, pid, serial,
+ &handle->callback, handle->user_data,
+ &handle->pre_context);
+ }
+
aul_running_context_destroy(context);
free(app_id);
- if (ret != FRAME_BROKER_ERROR_NONE)
+ if (ret != FRAME_BROKER_ERROR_NONE) {
+ frame_context_destroy(handle->pre_context);
+ handle->pre_context = NULL;
return ret;
+ }
snprintf(buf, sizeof(buf), "%u", serial);
ret = app_control_add_extra_data(app_control,
AUL_K_LAUNCHER_SERVICE_SERIAL, buf);
if (ret != APP_CONTROL_ERROR_NONE) {
_E("Failed to add extra data. error(%d)", ret);
+ frame_context_destroy(handle->pre_context);
+ handle->pre_context = NULL;
return ret;
}
AUL_K_LAUNCHER_SERVICE, handle->name);
if (ret != APP_CONTROL_ERROR_NONE) {
_E("Failed to add extra data. error(%d)", ret);
+ frame_context_destroy(handle->pre_context);
+ handle->pre_context = NULL;
return ret;
}
result_cb, reply_cb, user_data);
if (ret != APP_CONTROL_ERROR_NONE) {
_E("Failed to send launch request. error(%d)", ret);
+ frame_context_destroy(handle->pre_context);
+ handle->pre_context = NULL;
return ret;
}