extern int client_orientation(const struct client_node *client);
extern void client_set_orientation(struct client_node *client, int orientation);
+
+extern const char *client_appid(const struct client_node *client);
+extern int client_is_sdk_viewer(const struct client_node *client);
/* End of a file */
extern int slave_valid(const struct slave_node *slave);
extern void slave_set_valid(struct slave_node *slave);
+extern void slave_set_extra_bundle_data(struct slave_node *slave, const char *extra_bundle_data);
+extern const char *slave_extra_bundle_data(struct slave_node *slave);
+
/* End of a file */
#include <Eina.h>
#include <Ecore.h>
+#include <aul.h>
#include <dlog.h>
+
#include <packet.h>
#include <widget_errno.h>
#include <widget_service.h>
#include <widget_service_internal.h>
+#include <widget_conf.h>
#include "client_life.h"
#include "instance.h"
};
struct client_node {
+ char *appid;
pid_t pid;
int refcnt;
int faulted;
char *direct_addr;
int orientation;
+ int is_sdk_viewer;
};
static inline void invoke_global_destroyed_cb(struct client_node *client)
DbgFree(client->direct_addr);
}
+ DbgFree(client->appid);
+
s_info.client_list = eina_list_remove(s_info.client_list, client);
DbgFree(client);
static inline struct client_node *create_client_data(pid_t pid, const char *direct_addr)
{
struct client_node *client;
+ char pid_pkgname[pathconf("/", _PC_PATH_MAX)];
client = calloc(1, sizeof(*client));
if (!client) {
client->pid = pid;
client->refcnt = 1;
+ if (aul_app_get_pkgname_bypid(pid, pid_pkgname, sizeof(pid_pkgname)) == AUL_R_OK) {
+ client->appid = strdup(pid_pkgname);
+ if (client->appid) {
+ if (WIDGET_CONF_SDK_VIEWER) {
+ client->is_sdk_viewer = !strcmp(client->appid, WIDGET_CONF_SDK_VIEWER);
+ }
+ } else {
+ ErrPrint("strdup: %d\n", errno);
+ }
+ }
+
if (direct_addr && direct_addr[0]) {
client->direct_addr = strdup(direct_addr);
if (!client->direct_addr) {
return client->orientation;
}
+HAPI const char *client_appid(const struct client_node *client)
+{
+ return client->appid;
+}
+
+HAPI int client_is_sdk_viewer(const struct client_node *client)
+{
+ return client ? client->is_sdk_viewer : 0;
+}
+
/* End of a file */
HAPI struct inst_info *instance_create(struct client_node *client, double timestamp, const char *pkgname, const char *content, const char *cluster, const char *category, double period, int width, int height)
{
struct inst_info *inst;
+ char *extra_bundle_data = NULL;
inst = calloc(1, sizeof(*inst));
if (!inst) {
inst->widget.width = width;
inst->widget.height = height;
- inst->content = strdup(content);
- if (!inst->content) {
- ErrPrint("strdup: %d\n", errno);
- DbgFree(inst);
- return NULL;
+ if (client_is_sdk_viewer(client)) {
+ char *tmp;
+
+ tmp = strdup(content);
+ if (tmp) {
+ int length;
+
+ if (sscanf(content, "%d:%s", &length, tmp) == 2) {
+ extra_bundle_data = malloc(length + 1);
+ if (extra_bundle_data) {
+ strncpy(extra_bundle_data, tmp, length);
+ extra_bundle_data[length] = '\0';
+ tmp += length;
+ DbgPrint("Extra Bundle Data extracted: [%s]\n", extra_bundle_data);
+ }
+
+ if (*tmp) {
+ inst->content = strdup(tmp);
+ if (!inst->content) {
+ ErrPrint("strdup: %d\n", errno);
+ }
+ DbgPrint("Content Info extracted: [%d]\n", inst->content);
+ }
+ }
+
+ DbgFree(tmp);
+ }
+ } else {
+ inst->content = strdup(content);
+ if (!inst->content) {
+ ErrPrint("strdup: %d\n", errno);
+ DbgFree(extra_bundle_data);
+ DbgFree(inst);
+ return NULL;
+ }
}
inst->cluster = strdup(cluster);
if (!inst->cluster) {
ErrPrint("strdup: %d\n", errno);
+ DbgFree(extra_bundle_data);
DbgFree(inst->content);
DbgFree(inst);
return NULL;
inst->category = strdup(category);
if (!inst->category) {
ErrPrint("strdup: %d\n", errno);
+ DbgFree(extra_bundle_data);
DbgFree(inst->cluster);
DbgFree(inst->content);
DbgFree(inst);
inst->title = strdup(WIDGET_CONF_DEFAULT_TITLE); /*!< Use the DEFAULT Title "" */
if (!inst->title) {
ErrPrint("strdup: %d\n", errno);
+ DbgFree(extra_bundle_data);
DbgFree(inst->category);
DbgFree(inst->cluster);
DbgFree(inst->content);
if (fork_package(inst, pkgname) < 0) {
(void)client_unref(inst->client);
+ DbgFree(extra_bundle_data);
DbgFree(inst->title);
DbgFree(inst->category);
DbgFree(inst->cluster);
instance_ref(inst);
if (package_add_instance(inst->info, inst) < 0) {
+ DbgFree(extra_bundle_data);
DbgFree(inst->widget.extra_buffer);
DbgFree(inst->gbar.extra_buffer);
unfork_package(inst);
}
slave_load_instance(package_slave(inst->info));
+ slave_set_extra_bundle_data(package_slave(inst->info), extra_bundle_data);
+ DbgFree(extra_bundle_data);
/**
* @note
char *hw_acceleration;
int valid;
+ char *extra_bundle_data;
};
struct event {
DbgFree(slave->name);
DbgFree(slave->pkgname);
DbgFree(slave->hw_acceleration);
+ DbgFree(slave->extra_bundle_data);
DbgFree(slave);
return;
}
if (WIDGET_CONF_DEBUG_MODE || g_conf.debug_mode) {
DbgPrint("Debug Mode enabled. name[%s] secured[%d] abi[%s]\n", slave_name(slave), slave->secured, slave->abi);
} else {
- bundle *param;
+ bundle *param = NULL;
slave->relaunch_count = WIDGET_CONF_SLAVE_RELAUNCH_COUNT;
- param = bundle_create();
+ if (slave->extra_bundle_data) {
+ param = bundle_decode(slave->extra_bundle_data, strlen(slave->extra_bundle_data));
+ if (!param) {
+ ErrPrint("Invalid extra_bundle_data[%s]\n", slave->extra_bundle_data);
+ }
+ }
+
if (!param) {
- ErrPrint("Failed to create a bundle\n");
- return WIDGET_ERROR_FAULT;
+ param = bundle_create();
+ if (!param) {
+ ErrPrint("Failed to create a bundle\n");
+ return WIDGET_ERROR_FAULT;
+ }
}
bundle_add_str(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN);
slave->valid = 1;
}
+HAPI void slave_set_extra_bundle_data(struct slave_node *slave, const char *extra_bundle_data)
+{
+ char *tmp;
+
+ if (!slave) {
+ return;
+ }
+
+ if (extra_bundle_data) {
+ tmp = strdup(extra_bundle_data);
+ if (!tmp) {
+ ErrPrint("strdup: %d\n", errno);
+ return;
+ }
+ }
+
+ DbgFree(slave->extra_bundle_data);
+ slave->extra_bundle_data = tmp;
+}
+
+HAPI const char *slave_extra_bundle_data(struct slave_node *slave)
+{
+ return slave ? slave->extra_bundle_data : NULL;
+}
+
/* End of a file */