}
static int __send_update_status(const char *class_id, const char *instance_id,
- int status, bundle *extra)
+ int status, int err, bundle *extra)
{
bundle *b;
int lifecycle = -1;
bundle_raw *raw = NULL;
int len;
char *viewer_endpoint = _widget_app_get_viewer_endpoint();
+ char err_str[256];
b = bundle_create();
if (!b) {
return -1; /* LCOV_EXCL_LINE */
}
+ if (err < 0) {
+ snprintf(err_str, sizeof(err_str), "%d", err);
+ bundle_add_str(b, AUL_K_WIDGET_ERROR_CODE, err_str);
+ }
+
bundle_add_str(b, AUL_K_WIDGET_ID, class_id);
bundle_add_str(b, AUL_K_WIDGET_INSTANCE_ID, instance_id);
bundle_add_byte(b, AUL_K_WIDGET_STATUS, &status, sizeof(int));
_D("%s is resumed", id);
if (send_update) {
ret = __send_update_status(handle->classid, wc->id,
- WIDGET_INSTANCE_EVENT_RESUME, NULL);
+ WIDGET_INSTANCE_EVENT_RESUME, 0, NULL);
if (!fg_signal) {
_D("Send fg signal to resourceD");
aul_send_app_status_change_signal(getpid(),
_D("%s is paused", id);
if (send_update) {
ret = __send_update_status(handle->classid, wc->id,
- WIDGET_INSTANCE_EVENT_PAUSE, NULL);
+ WIDGET_INSTANCE_EVENT_PAUSE, 0, NULL);
wc = __find_context_by_state(WC_RUNNING);
if (!wc && fg_signal) {
_D("Send bg signal to resourceD");
_D("%s is resized to %dx%d", id, w, h);
ret = __send_update_status(handle->classid, wc->id,
- WIDGET_INSTANCE_EVENT_SIZE_CHANGED, NULL);
+ WIDGET_INSTANCE_EVENT_SIZE_CHANGED, 0, NULL);
return ret;
}
handle->ops.update(wc, b, force, handle->user_data);
ret = __send_update_status(handle->classid, wc->id,
- WIDGET_INSTANCE_EVENT_UPDATE, NULL);
+ WIDGET_INSTANCE_EVENT_UPDATE, 0, NULL);
_D("updated:%s", wc->id);
}
}
if (handle->ops.update) {
handle->ops.update(wc, b, force, handle->user_data);
ret = __send_update_status(handle->classid, wc->id,
- WIDGET_INSTANCE_EVENT_UPDATE, NULL);
+ WIDGET_INSTANCE_EVENT_UPDATE, 0, NULL);
_D("updated:%s", id);
}
if (ret < 0) {
_W("Create callback resturns error(%d)", ret);
send_ret = __send_update_status(handle->classid, wc->id,
- WIDGET_INSTANCE_EVENT_CREATE_ABORTED, NULL);
+ WIDGET_INSTANCE_EVENT_CREATE_ABORTED, ret, NULL);
if (send_ret < 0)
_E("Fail to send abort status (%d)", send_ret);
widget_app_exit();
} else {
ret = __send_update_status(handle->classid, wc->id,
- WIDGET_INSTANCE_EVENT_CREATE, NULL);
+ WIDGET_INSTANCE_EVENT_CREATE, 0, NULL);
if (content == NULL)
content = "NULL";
} else {
is_permanent = false;
ret = __send_update_status(handle->classid, id,
- WIDGET_INSTANCE_EVENT_EXTRA_UPDATED, content_info);
+ WIDGET_INSTANCE_EVENT_EXTRA_UPDATED, 0, content_info);
}
if (content_info)
bundle_free(content_info);
- ret = __send_update_status(handle->classid, id, event, NULL);
+ ret = __send_update_status(handle->classid, id, event, 0, NULL);
_widget_app_remove_context(wc);
return widget_app_error(WIDGET_ERROR_FAULT, __FUNCTION__, NULL);
ret = __send_update_status(class_id, context->id,
- WIDGET_INSTANCE_EVENT_EXTRA_UPDATED, content_info);
+ WIDGET_INSTANCE_EVENT_EXTRA_UPDATED, 0, content_info);
if (context->content)
free(context->content);