frame_context_h pre_context;
};
+struct request_s {
+ frame_broker_h broker;
+ app_control_h app_control;
+ app_control_result_cb result_cb;
+ app_control_reply_cb reply_cb;
+ void *user_data;
+ bool shared_widget;
+ bool resume_request;
+};
+
static GList *__win_list;
static gint __compare_win(gconstpointer a, gconstpointer b)
return FRAME_BROKER_ERROR_NONE;
}
-static int __send_launch_request(frame_broker_h handle,
- app_control_h app_control,
- app_control_result_cb result_cb,
- app_control_reply_cb reply_cb,
- void *user_data,
- bool shared_widget)
+static int __send_request(struct request_s *req)
{
+ frame_broker_h broker = req->broker;
aul_running_context_h context = NULL;
char buf[12];
uint32_t serial;
int pid = -1;
int ret;
- if (!handle || !app_control || !result_cb) {
+ if (!req->broker || !req->app_control || !req->result_cb) {
_E("Invalid parameter");
return FRAME_BROKER_ERROR_INVALID_PARAMETER;
}
- ret = app_control_get_app_id(app_control, &app_id);
+ ret = app_control_get_app_id(req->app_control, &app_id);
if (ret != APP_CONTROL_ERROR_NONE) {
_E("Failed to get app id. error(%d)", ret);
return ret;
}
- app_control_get_component_id(app_control, &comp_id);
- app_control_get_instance_id(app_control, &inst_id);
+ app_control_get_component_id(req->app_control, &comp_id);
+ app_control_get_instance_id(req->app_control, &inst_id);
ret = aul_running_context_create(app_id, comp_id, inst_id, &context);
if (ret != AUL_R_OK)
aul_running_context_get_inst_id(context, (const char **)&inst_id);
aul_running_context_get_pid(context, &pid);
- if (shared_widget) {
- ret = frame_broker_launch_with_shared_widget(handle, app_id,
- inst_id, pid, &serial);
+ if (req->shared_widget) {
+ ret = frame_broker_launch_with_shared_widget(broker,
+ app_id, inst_id, pid, &serial);
} else {
- ret = frame_broker_launch(handle, app_id, inst_id, pid,
+ ret = frame_broker_launch(broker, app_id, inst_id, pid,
&serial);
}
if (inst_id && pid > 0) {
- frame_context_destroy(handle->pre_context);
- handle->pre_context = NULL;
+ frame_context_destroy(broker->pre_context);
+ broker->pre_context = NULL;
- frame_context_create(handle, app_id, inst_id, pid, serial,
- &handle->callback, handle->user_data,
- &handle->pre_context);
+ frame_context_create(broker, app_id, inst_id, pid, serial,
+ &broker->callback, broker->user_data,
+ &broker->pre_context);
}
aul_running_context_destroy(context);
free(app_id);
if (ret != FRAME_BROKER_ERROR_NONE) {
- frame_context_destroy(handle->pre_context);
- handle->pre_context = NULL;
+ frame_context_destroy(broker->pre_context);
+ broker->pre_context = NULL;
return ret;
}
snprintf(buf, sizeof(buf), "%u", serial);
- ret = app_control_add_extra_data(app_control,
+ ret = app_control_add_extra_data(req->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;
+ frame_context_destroy(broker->pre_context);
+ broker->pre_context = NULL;
return ret;
}
- ret = app_control_add_extra_data(app_control,
- AUL_K_LAUNCHER_SERVICE, handle->name);
+ ret = app_control_add_extra_data(req->app_control,
+ AUL_K_LAUNCHER_SERVICE, broker->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;
+ frame_context_destroy(broker->pre_context);
+ broker->pre_context = NULL;
return ret;
}
- ret = app_control_send_launch_request_async(app_control,
- result_cb, reply_cb, user_data);
+ if (req->resume_request) {
+ ret = app_control_send_resume_request(req->app_control,
+ req->result_cb, req->user_data);
+ } else {
+ ret = app_control_send_launch_request_async(req->app_control,
+ req->result_cb, req->reply_cb, req->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;
+ frame_context_destroy(broker->pre_context);
+ broker->pre_context = NULL;
return ret;
}
app_control_reply_cb reply_cb,
void *user_data)
{
- return __send_launch_request(handle, app_control, result_cb, reply_cb,
- user_data, false);
+ struct request_s req = {
+ .broker = handle,
+ .app_control = app_control,
+ .result_cb = result_cb,
+ .reply_cb = reply_cb,
+ .user_data = user_data,
+ .shared_widget = false,
+ .resume_request = false
+ };
+
+ return __send_request(&req);
}
API int frame_broker_send_launch_request_to_provider(
app_control_reply_cb reply_cb,
void *user_data)
{
- return __send_launch_request(handle, app_control, result_cb, reply_cb,
- user_data, true);
+ struct request_s req = {
+ .broker = handle,
+ .app_control = app_control,
+ .result_cb = result_cb,
+ .reply_cb = reply_cb,
+ .user_data = user_data,
+ .shared_widget = true,
+ .resume_request = false
+ };
+
+ return __send_request(&req);
+}
+
+API int frame_broker_send_resume_request(frame_broker_h handle,
+ app_control_h app_control,
+ app_control_result_cb result_cb,
+ void *user_data)
+{
+ struct request_s req = {
+ .broker = handle,
+ .app_control = app_control,
+ .result_cb = result_cb,
+ .reply_cb = NULL,
+ .user_data = user_data,
+ .shared_widget = false,
+ .resume_request = true
+ };
+
+ return __send_request(&req);
}
void frame_broker_set_frame_context(frame_broker_h handle,