return 0;
}
+static int widget_get_content(int clifd, bundle *kb)
+{
+ int ret;
+ int fd = 0;
+ char *widget_id = NULL;
+ char *instance_id = NULL;
+ char *content_info = NULL;
+
+ bundle_get_str(kb, AUL_K_WIDGET_ID, &widget_id);
+ bundle_get_str(kb, AUL_K_WIDGET_INSTANCE_ID, &instance_id);
+
+ ret = aul_sock_recv_reply_sock_fd(clifd, &fd, 1);
+ if (ret < 0) {
+ _E("failed to recv sock fd");
+ return ret;
+ }
+
+ if (!widget_id || !instance_id) {
+ aul_sock_send_raw_with_fd(fd, -EINVAL, 0, 0, AUL_SOCK_NOREPLY);
+ return 0;
+ }
+
+ __call_aul_handler(AUL_WIDGET_CONTENT, kb);
+
+ bundle_get_str(kb, AUL_K_WIDGET_CONTENT_INFO, &content_info);
+ if (content_info) {
+ ret = aul_sock_send_raw_with_fd(fd, 0,
+ (unsigned char *)content_info,
+ strlen(content_info) + 1, AUL_SOCK_NOREPLY);
+ } else {
+ ret = aul_sock_send_raw_with_fd(fd, -ENOENT,
+ NULL, 0, AUL_SOCK_NOREPLY);
+ }
+
+ if (ret < 0)
+ _E("failed to send content %d (%d)", fd, ret);
+
+ return ret;
+}
+
/**
* @brief caller & callee's sock handler
*/
if (pkt->opt & AUL_SOCK_NOREPLY) {
close(clifd);
- } else {
+ } else if (pkt->cmd != WIDGET_GET_CONTENT) {
ret = __send_result_to_launchpad(clifd, 0);
if (ret < 0) {
free(pkt);
case APP_STATUS_NOTIFICATION:
app_status_event(kbundle);
break;
+ case WIDGET_GET_CONTENT:
+ widget_get_content(clifd, kbundle);
+ break;
default:
_E("no support packet");
}