static int __ps_process_condition(xmlTextReaderPtr reader, condition_x *condition);
static int __ps_process_notification(xmlTextReaderPtr reader, notification_x *notifiation);
static int __ps_process_category(xmlTextReaderPtr reader, category_x *category);
+static int __ps_process_metadata(xmlTextReaderPtr reader, metadata_x *metadata);
+static int __ps_process_permission(xmlTextReaderPtr reader, permission_x *permission);
static int __ps_process_compatibility(xmlTextReaderPtr reader, compatibility_x *compatibility);
static int __ps_process_resolution(xmlTextReaderPtr reader, resolution_x *resolution);
static int __ps_process_request(xmlTextReaderPtr reader, request_x *request);
static void __ps_free_condition(condition_x *condition);
static void __ps_free_notification(notification_x *notifiation);
static void __ps_free_category(category_x *category);
+static void __ps_free_metadata(metadata_x *metadata);
+static void __ps_free_permission(permission_x *permission);
static void __ps_free_compatibility(compatibility_x *compatibility);
static void __ps_free_resolution(resolution_x *resolution);
static void __ps_free_request(request_x *request);
category = NULL;
}
+static void __ps_free_metadata(metadata_x *metadata)
+{
+ if (metadata == NULL)
+ return;
+ if (metadata->name) {
+ free((void *)metadata->name);
+ metadata->name = NULL;
+ }
+ if (metadata->value) {
+ free((void *)metadata->value);
+ metadata->value = NULL;
+ }
+ free((void*)metadata);
+ metadata = NULL;
+}
+
+static void __ps_free_permission(permission_x *permission)
+{
+ if (permission == NULL)
+ return;
+ if (permission->type) {
+ free((void *)permission->type);
+ permission->type = NULL;
+ }
+ if (permission->value) {
+ free((void *)permission->value);
+ permission->value = NULL;
+ }
+ free((void*)permission);
+ permission = NULL;
+}
+
static void __ps_free_icon(icon_x *icon)
{
if (icon == NULL)
icon = NULL;
}
+static void __ps_free_image(image_x *image)
+{
+ if (image == NULL)
+ return;
+ if (image->text) {
+ free((void *)image->text);
+ image->text = NULL;
+ }
+ if (image->lang) {
+ free((void *)image->lang);
+ image->lang = NULL;
+ }
+ if (image->name) {
+ free((void *)image->name);
+ image->name= NULL;
+ }
+ if (image->section) {
+ free((void *)image->section);
+ image->section = NULL;
+ }
+ free((void*)image);
+ image = NULL;
+}
+
static void __ps_free_operation(operation_x *operation)
{
if (operation == NULL)
free((void *)uiapplication->taskmanage);
uiapplication->taskmanage = NULL;
}
+ if (uiapplication->enabled) {
+ free((void *)uiapplication->enabled);
+ uiapplication->enabled = NULL;
+ }
if (uiapplication->hwacceleration) {
free((void *)uiapplication->hwacceleration);
uiapplication->hwacceleration = NULL;
icon = tmp;
}
}
+ /*Free image*/
+ if (uiapplication->image) {
+ image_x *image = uiapplication->image;
+ image_x *tmp = NULL;
+ while(image != NULL)
+ {
+ tmp = image->next;
+ __ps_free_image(image);
+ image = tmp;
+ }
+ }
/*Free AppControl*/
if (uiapplication->appcontrol) {
appcontrol_x *appcontrol = uiapplication->appcontrol;
category = tmp;
}
}
+ /*Free Metadata*/
+ if (uiapplication->metadata) {
+ metadata_x *metadata = uiapplication->metadata;
+ metadata_x *tmp = NULL;
+ while(metadata != NULL)
+ {
+ tmp = metadata->next;
+ __ps_free_metadata(metadata);
+ metadata = tmp;
+ }
+ }
+ /*Free permission*/
+ if (uiapplication->permission) {
+ permission_x *permission = uiapplication->permission;
+ permission_x *tmp = NULL;
+ while(permission != NULL)
+ {
+ tmp = permission->next;
+ __ps_free_permission(permission);
+ permission = tmp;
+ }
+ }
+ /* _PRODUCT_LAUNCHING_ENHANCED_ START */
+ if (uiapplication->indicatordisplay) {
+ free((void *)uiapplication->indicatordisplay);
+ uiapplication->indicatordisplay = NULL;
+ }
+ if (uiapplication->portraitimg) {
+ free((void *)uiapplication->portraitimg);
+ uiapplication->portraitimg = NULL;
+ }
+ if (uiapplication->landscapeimg) {
+ free((void *)uiapplication->landscapeimg);
+ uiapplication->landscapeimg = NULL;
+ }
+ /* _PRODUCT_LAUNCHING_ENHANCED_ END */
+ if (uiapplication->guestmode_visibility) {
+ free((void *)uiapplication->guestmode_visibility);
+ uiapplication->guestmode_visibility = NULL;
+ }
free((void*)uiapplication);
uiapplication = NULL;
}
category = tmp;
}
}
+ /*Free Metadata*/
+ if (serviceapplication->metadata) {
+ metadata_x *metadata = serviceapplication->metadata;
+ metadata_x *tmp = NULL;
+ while(metadata != NULL)
+ {
+ tmp = metadata->next;
+ __ps_free_metadata(metadata);
+ metadata = tmp;
+ }
+ }
+ /*Free permission*/
+ if (serviceapplication->permission) {
+ permission_x *permission = serviceapplication->permission;
+ permission_x *tmp = NULL;
+ while(permission != NULL)
+ {
+ tmp = permission->next;
+ __ps_free_permission(permission);
+ permission = tmp;
+ }
+ }
free((void*)serviceapplication);
serviceapplication = NULL;
}
return 0;
}
+static int __ps_process_metadata(xmlTextReaderPtr reader, metadata_x *metadata)
+{
+ /*name and value both should exist. If any one attribute is missing then dont parse*/
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("name")) && xmlTextReaderGetAttribute(reader, XMLCHAR("value"))) {
+ metadata->name = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("name")));
+ metadata->value = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("value")));
+ }
+ return 0;
+}
+
+static int __ps_process_permission(xmlTextReaderPtr reader, permission_x *permission)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("type")))
+ permission->type = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("type")));
+
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ permission->value = ASCII(xmlTextReaderValue(reader));
+
+}
+
static int __ps_process_compatibility(xmlTextReaderPtr reader, compatibility_x *compatibility)
{
if (xmlTextReaderGetAttribute(reader, XMLCHAR("name")))
return 0;
}
+static int __ps_process_image(xmlTextReaderPtr reader, image_x *image)
+{
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("name")))
+ image->name = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("name")));
+ if (xmlTextReaderConstXmlLang(reader)) {
+ image->lang = strdup(ASCII(xmlTextReaderConstXmlLang(reader)));
+ if (image->lang == NULL)
+ image->lang = strdup(DEFAULT_LOCALE);
+ } else {
+ image->lang = strdup(DEFAULT_LOCALE);
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("section")))
+ image->section = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("section")));
+ xmlTextReaderRead(reader);
+ if (xmlTextReaderValue(reader))
+ image->text = ASCII(xmlTextReaderValue(reader));
+
+ return 0;
+}
+
static int __ps_process_label(xmlTextReaderPtr reader, label_x *label)
{
if (xmlTextReaderGetAttribute(reader, XMLCHAR("name")))
notification_x *tmp6 = NULL;
datashare_x *tmp7 = NULL;
category_x *tmp8 = NULL;
+ metadata_x *tmp9 = NULL;
+ image_x *tmp10 = NULL;
+ permission_x *tmp11 = NULL;
if (xmlTextReaderGetAttribute(reader, XMLCHAR("appid"))) {
uiapplication->appid = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("appid")));
} else {
uiapplication->taskmanage = strdup("true");
}
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("enabled"))) {
+ uiapplication->enabled = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("enabled")));
+ if (uiapplication->enabled == NULL)
+ uiapplication->enabled = strdup("true");
+ } else {
+ uiapplication->enabled = strdup("true");
+ }
if (xmlTextReaderGetAttribute(reader, XMLCHAR("hw-acceleration"))) {
uiapplication->hwacceleration = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("hw-acceleration")));
if (uiapplication->hwacceleration == NULL)
} else {
uiapplication->mainapp = strdup("false");
}
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("indicatordisplay"))) {
+ uiapplication->indicatordisplay = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("indicatordisplay")));
+ if (uiapplication->indicatordisplay == NULL)
+ uiapplication->indicatordisplay = strdup("true");
+ } else {
+ uiapplication->indicatordisplay = strdup("true");
+ }
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("portrait-effectimage")))
+ uiapplication->portraitimg = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("portrait-effectimage")));
+ else
+ uiapplication->portraitimg = NULL;
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("landscape-effectimage")))
+ uiapplication->landscapeimg = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("landscape-effectimage")));
+ else
+ uiapplication->landscapeimg = NULL;
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("guestmode-visibility"))) {
+ uiapplication->guestmode_visibility = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("guestmode-visibility")));
+ if (uiapplication->guestmode_visibility == NULL)
+ uiapplication->guestmode_visibility = strdup("true");
+ } else {
+ uiapplication->guestmode_visibility = strdup("true");
+ }
depth = xmlTextReaderDepth(reader);
while ((ret = __next_child_element(reader, depth))) {
memset(icon, '\0', sizeof(icon_x));
LISTADD(uiapplication->icon, icon);
ret = __ps_process_icon(reader, icon);
+ } else if (!strcmp(ASCII(node), "image")) {
+ image_x *image = malloc(sizeof(image_x));
+ if (image == NULL) {
+ DBG("Malloc Failed\n");
+ return -1;
+ }
+ memset(image, '\0', sizeof(image_x));
+ LISTADD(uiapplication->image, image);
+ ret = __ps_process_image(reader, image);
} else if (!strcmp(ASCII(node), "category")) {
category_x *category = malloc(sizeof(category_x));
if (category == NULL) {
memset(category, '\0', sizeof(category_x));
LISTADD(uiapplication->category, category);
ret = __ps_process_category(reader, category);
+ } else if (!strcmp(ASCII(node), "metadata")) {
+ metadata_x *metadata = malloc(sizeof(metadata_x));
+ if (metadata == NULL) {
+ DBG("Malloc Failed\n");
+ return -1;
+ }
+ memset(metadata, '\0', sizeof(metadata_x));
+ LISTADD(uiapplication->metadata, metadata);
+ ret = __ps_process_metadata(reader, metadata);
+ } else if (!strcmp(ASCII(node), "permission")) {
+ permission_x *permission = malloc(sizeof(permission_x));
+ if (permission == NULL) {
+ DBG("Malloc Failed\n");
+ return -1;
+ }
+ memset(permission, '\0', sizeof(permission_x));
+ LISTADD(uiapplication->permission, permission);
+ ret = __ps_process_permission(reader, permission);
} else if (!strcmp(ASCII(node), "app-control")) {
appcontrol_x *appcontrol = malloc(sizeof(appcontrol_x));
if (appcontrol == NULL) {
LISTHEAD(uiapplication->category, tmp8);
uiapplication->category = tmp8;
}
+ if (uiapplication->metadata) {
+ LISTHEAD(uiapplication->metadata, tmp9);
+ uiapplication->metadata = tmp9;
+ }
+ if (uiapplication->image) {
+ LISTHEAD(uiapplication->image, tmp10);
+ uiapplication->image = tmp10;
+ }
+ if (uiapplication->permission) {
+ LISTHEAD(uiapplication->permission, tmp11);
+ uiapplication->permission = tmp11;
+ }
return ret;
}
notification_x *tmp7 = NULL;
datashare_x *tmp8 = NULL;
category_x *tmp9 = NULL;
+ metadata_x *tmp10 = NULL;
+ permission_x *tmp11 = NULL;
if (xmlTextReaderGetAttribute(reader, XMLCHAR("appid"))) {
serviceapplication->appid = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("appid")));
memset(category, '\0', sizeof(category_x));
LISTADD(serviceapplication->category, category);
ret = __ps_process_category(reader, category);
+ } else if (!strcmp(ASCII(node), "metadata")) {
+ metadata_x *metadata = malloc(sizeof(metadata_x));
+ if (metadata == NULL) {
+ DBG("Malloc Failed\n");
+ return -1;
+ }
+ memset(metadata, '\0', sizeof(metadata_x));
+ LISTADD(serviceapplication->metadata, metadata);
+ ret = __ps_process_metadata(reader, metadata);
+ } else if (!strcmp(ASCII(node), "permission")) {
+ permission_x *permission = malloc(sizeof(permission_x));
+ if (permission == NULL) {
+ DBG("Malloc Failed\n");
+ return -1;
+ }
+ memset(permission, '\0', sizeof(permission_x));
+ LISTADD(serviceapplication->permission, permission);
+ ret = __ps_process_permission(reader, permission);
} else if (!strcmp(ASCII(node), "app-control")) {
appcontrol_x *appcontrol = malloc(sizeof(appcontrol_x));
if (appcontrol == NULL) {
LISTHEAD(serviceapplication->category, tmp9);
serviceapplication->category = tmp9;
}
+ if (serviceapplication->metadata) {
+ LISTHEAD(serviceapplication->metadata, tmp10);
+ serviceapplication->metadata = tmp10;
+ }
+ if (serviceapplication->permission) {
+ LISTHEAD(serviceapplication->permission, tmp11);
+ serviceapplication->permission = tmp11;
+ }
return ret;
}
continue;
} else if (!strcmp(ASCII(node), "livebox")) {
continue;
- } else if (!strcmp(ASCII(node), "Accounts")) {
- continue;
} else if (!strcmp(ASCII(node), "account")) {
continue;
+ } else if (!strcmp(ASCII(node), "notifications")) {
+ continue;
} else
return -1;
mfx->installlocation = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("install-location")));
if (xmlTextReaderGetAttribute(reader, XMLCHAR("type")))
mfx->type = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("type")));
+ if (xmlTextReaderGetAttribute(reader, XMLCHAR("root_path")))
+ mfx->root_path = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("root_path")));
+
/*Assign default values. If required it will be overwritten in __add_preload_info()*/
mfx->preload = strdup("False");
mfx->removable = strdup("True");
return locale;
}
+#define LIBAIL_PATH "/usr/lib/libail.so.0"
+
+/* operation_type */
+typedef enum {
+ AIL_INSTALL = 0,
+ AIL_UPDATE,
+ AIL_REMOVE,
+ AIL_MAX
+} AIL_TYPE;
+
+static int __ail_change_info(int op, const char *appid)
+{
+ void *lib_handle = NULL;
+ int (*ail_desktop_operation) (const char *);
+ char *aop = NULL;
+ int ret = 0;
+
+ if ((lib_handle = dlopen(LIBAIL_PATH, RTLD_LAZY)) == NULL) {
+ DBGE("dlopen is failed LIBAIL_PATH[%s]\n", LIBAIL_PATH);
+ goto END;
+ }
+
+
+ switch (op) {
+ case 0:
+ aop = "ail_desktop_add";
+ break;
+ case 1:
+ aop = "ail_desktop_update";
+ break;
+ case 2:
+ aop = "ail_desktop_remove";
+ break;
+ default:
+ goto END;
+ break;
+ }
+
+ if ((ail_desktop_operation =
+ dlsym(lib_handle, aop)) == NULL || dlerror() != NULL) {
+ DBGE("can not find symbol \n");
+ goto END;
+ }
+
+ ret = ail_desktop_operation(appid);
+
+END:
+ if (lib_handle)
+ dlclose(lib_handle);
+
+ return ret;
+}
+
/* desktop shoud be generated automatically based on manifest */
/* Currently removable, taskmanage, etc fields are not considerd. it will be decided soon.*/
#define BUFMAX 1024*128
-static int __ps_make_nativeapp_desktop(manifest_x * mfx)
+static int __ps_make_nativeapp_desktop(manifest_x * mfx, bool is_update)
{
FILE* file = NULL;
int fd = 0;
fwrite(buf, 1, strlen(buf), file);
}
+ if(mfx->uiapplication->enabled && !strcasecmp(mfx->uiapplication->enabled, "False")) {
+ snprintf(buf, BUFMAX, "X-TIZEN-Enabled=False\n");
+ fwrite(buf, 1, strlen(buf), file);
+ }
+
if(mfx->uiapplication->hwacceleration) {
snprintf(buf, BUFMAX, "Hw-Acceleration=%s\n", mfx->uiapplication->hwacceleration);
fwrite(buf, 1, strlen(buf), file);
fd = fileno(file);
fsync(fd);
fclose(file);
+
+ if (!is_update)
+ __ail_change_info(AIL_INSTALL, mfx->uiapplication->appid);
+ else
+ __ail_change_info(AIL_UPDATE, mfx->uiapplication->appid);
}
free(buf);
static int __ps_remove_nativeapp_desktop(manifest_x *mfx)
{
- char filepath[PKG_STRING_LEN_MAX] = "";
+ char filepath[PKG_STRING_LEN_MAX] = "";
int ret = 0;
for(; mfx->uiapplication; mfx->uiapplication=mfx->uiapplication->next) {
snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RW_PATH, mfx->uiapplication->appid);
+ __ail_change_info(AIL_REMOVE, mfx->uiapplication->appid);
+
ret = remove(filepath);
if (ret <0)
return -1;
free((void *)mfx->type);
mfx->type = NULL;
}
+ if (mfx->package_size) {
+ free((void *)mfx->package_size);
+ mfx->package_size = NULL;
+ }
if (mfx->installed_time) {
free((void *)mfx->installed_time);
mfx->installed_time = NULL;
free((void *)mfx->package_url);
mfx->package_url = NULL;
}
+ if (mfx->root_path) {
+ free((void *)mfx->root_path);
+ mfx->root_path = NULL;
+ }
/*Free Icon*/
if (mfx->icon) {
API int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[])
{
- char *temp[] = {"shortcut-list", "livebox", "Accounts", "account", NULL};
+ char *temp[] = {"shortcut-list", "livebox", "account", "notifications", NULL};
if (manifest == NULL) {
DBG("argument supplied is NULL\n");
return PMINFO_R_EINVAL;
else
DBG("DB Insert Success\n");
- ret = __ps_make_nativeapp_desktop(mfx);
+ ret = __ps_make_nativeapp_desktop(mfx, 0);
if (ret == -1)
DBG("Creating desktop file failed\n");
else
return PMINFO_R_OK;
}
+API int pkgmgr_parser_create_desktop_file(manifest_x *mfx)
+{
+ int ret = 0;
+ if (mfx == NULL) {
+ DBG("Manifest pointer is NULL\n");
+ return -1;
+ }
+ ret = __ps_make_nativeapp_desktop(mfx, 0);
+ if (ret == -1)
+ DBG("Creating desktop file failed\n");
+ else
+ DBG("Creating desktop file Success\n");
+ return ret;
+}
+
+
API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[])
{
- char *temp[] = {"shortcut-list", "livebox", "Accounts", "account", NULL};
+ char *temp[] = {"shortcut-list", "livebox", "account", "notifications", NULL};
if (manifest == NULL) {
DBG("argument supplied is NULL\n");
return PMINFO_R_EINVAL;
else
DBG("DB Update Success\n");
- ret = __ps_make_nativeapp_desktop(mfx);
+ ret = __ps_make_nativeapp_desktop(mfx, 1);
if (ret == -1)
DBG("Creating desktop file failed\n");
else
API int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, char *const tagv[])
{
- char *temp[] = {"shortcut-list", "livebox", "Accounts", "account", NULL};
+ char *temp[] = {"shortcut-list", "livebox", "account", "notifications", NULL};
if (manifest == NULL) {
DBG("argument supplied is NULL\n");
return PMINFO_R_EINVAL;
GList *pkglocale = NULL;
GList *applocale = NULL;
GList *appicon = NULL;
+GList *appimage = NULL;
char *prev = NULL;
#define QUERY_CREATE_TABLE_PACKAGE_INFO "create table if not exists package_info " \
"installed_time text," \
"storeclient_id text," \
"mainapp_id text," \
- "package_url text)"
+ "package_url text," \
+ "root_path text)"
#define QUERY_CREATE_TABLE_PACKAGE_LOCALIZED_INFO "create table if not exists package_localized_info " \
"(package text not null, " \
"app_multiple text DEFAULT 'false', " \
"app_autorestart text DEFAULT 'false', " \
"app_taskmanage text DEFAULT 'false', " \
+ "app_enabled text DEFAULT 'true', " \
"app_hwacceleration text DEFAULT 'use-system-setting', " \
"app_mainapp text, " \
"app_recentimage text, " \
+ "app_indicatordisplay text DEFAULT 'true', " \
+ "app_portraitimg text, " \
+ "app_landscapeimg text, " \
+ "app_guestmodevisibility text DEFAULT 'true', " \
"package text not null, " \
"FOREIGN KEY(package) " \
"REFERENCES package_info(package) " \
"REFERENCES package_app_info(app_id) " \
"ON DELETE CASCADE)"
-#define QUERY_CREATE_TABLE_PACKAGE_APP_ICON_LOCALIZED_INFO "create table if not exists package_app_icon_localized_info " \
+#define QUERY_CREATE_TABLE_PACKAGE_APP_ICON_SECTION_INFO "create table if not exists package_app_icon_section_info " \
"(app_id text not null, " \
- "app_locale text DEFAULT 'No Locale', " \
"app_icon text, " \
"app_icon_section text, " \
"app_icon_resolution text, " \
- "PRIMARY KEY(app_id,app_locale,app_icon_section,app_icon_resolution) " \
+ "PRIMARY KEY(app_id,app_icon_section,app_icon_resolution) " \
+ "FOREIGN KEY(app_id) " \
+ "REFERENCES package_app_info(app_id) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_PACKAGE_APP_IMAGE_INFO "create table if not exists package_app_image_info " \
+ "(app_id text not null, " \
+ "app_locale text DEFAULT 'No Locale', " \
+ "app_image_section text, " \
+ "app_image text, " \
+ "PRIMARY KEY(app_id,app_image_section) " \
"FOREIGN KEY(app_id) " \
"REFERENCES package_app_info(app_id) " \
"ON DELETE CASCADE)"
"REFERENCES package_app_info(app_id) " \
"ON DELETE CASCADE)"
+#define QUERY_CREATE_TABLE_PACKAGE_APP_APP_METADATA "create table if not exists package_app_app_metadata " \
+ "(app_id text not null, " \
+ "md_name text not null, " \
+ "md_value text not null, " \
+ "PRIMARY KEY(app_id, md_name) " \
+ "FOREIGN KEY(app_id) " \
+ "REFERENCES package_app_info(app_id) " \
+ "ON DELETE CASCADE)"
+
+#define QUERY_CREATE_TABLE_PACKAGE_APP_APP_PERMISSION "create table if not exists package_app_app_permission " \
+ "(app_id text not null, " \
+ "pm_type text not null, " \
+ "pm_value text not null, " \
+ "PRIMARY KEY(app_id) " \
+ "FOREIGN KEY(app_id) " \
+ "REFERENCES package_app_info(app_id) " \
+ "ON DELETE CASCADE)"
+
#define QUERY_CREATE_TABLE_PACKAGE_APP_SHARE_ALLOWED "create table if not exists package_app_share_allowed " \
"(app_id text not null, " \
"data_share_path text not null, " \
static int __insert_uiapplication_appcategory_info(manifest_x *mfx);
static int __insert_serviceapplication_appcategory_info(manifest_x *mfx);
static int __insert_uiapplication_appcontrol_info(manifest_x *mfx);
+static int __insert_serviceapplication_appmetadata_info(manifest_x *mfx);
+static int __insert_uiapplication_appmetadata_info(manifest_x *mfx);
static int __insert_serviceapplication_appcontrol_info(manifest_x *mfx);
static int __insert_uiapplication_share_allowed_info(manifest_x *mfx);
static int __insert_serviceapplication_share_allowed_info(manifest_x *mfx);
static int __initialize_package_app_info_db();
static int __initialize_package_cert_info_db();
static int __initialize_package_app_localized_info_db();
-static int __initialize_package_app_icon_localized_info_db();
+static int __initialize_package_app_icon_section_info_db();
+static int __initialize_package_app_image_info_db();
static int __initialize_package_app_app_svc_db();
static int __initialize_package_app_app_category_db();
static int __initialize_package_app_app_control_db();
+static int __initialize_package_app_app_metadata_db();
static int __initialize_package_app_share_allowed_db();
static int __initialize_package_app_share_request_db();
static int __exec_query(char *query);
static void __trimfunc1(gpointer data, gpointer userdata);
static void __trimfunc2(gpointer data, gpointer userdata);
static GList *__create_locale_list(GList *locale, label_x *lbl, license_x *lcn, icon_x *icn, description_x *dcn, author_x *ath);
+static void __preserve_guestmode_visibility_value(manifest_x *mfx);
+static int __guestmode_visibility_cb(void *data, int ncols, char **coltxt, char **colname);
+
+static int __guestmode_visibility_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ manifest_x *mfx = (manifest_x *)data;
+ int i = 0;
+ char *appid = NULL;
+ char *status = NULL;
+ uiapplication_x *uiapp = NULL;
+ for(i = 0; i < ncols; i++)
+ {
+ uiapp = mfx->uiapplication;
+ if (strcmp(colname[i], "app_id") == 0) {
+ if (coltxt[i])
+ appid = strdup(coltxt[i]);
+ } else if (strcmp(colname[i], "app_guestmodevisibility") == 0) {
+ if (coltxt[i])
+ status = strdup(coltxt[i]);
+ }
+ }
+ /*update guest mode visibility*/
+ for (; uiapp != NULL; uiapp = uiapp->next) {
+ if (strcmp(uiapp->appid, appid) == 0) {
+ free((void *)uiapp->guestmode_visibility);
+ uiapp->guestmode_visibility = strdup(status);
+ break;
+ }
+ }
+ if (appid) {
+ free(appid);
+ appid = NULL;
+ }
+ if (status) {
+ free(status);
+ status = NULL;
+ }
+
+ return 0;
+}
+
+static void __preserve_guestmode_visibility_value(manifest_x *mfx)
+{
+ int ret = -1;
+ char *error_message = NULL;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ snprintf(query, MAX_QUERY_LEN - 1, "select app_id, app_guestmodevisibility from package_app_info where package='%s'", mfx->package);
+ if (SQLITE_OK !=
+ sqlite3_exec(pkgmgr_parser_db, query,
+ __guestmode_visibility_cb, (void *)mfx, &error_message)) {
+ DBG("Don't execute query = %s error message = %s\n",
+ query, error_message);
+ sqlite3_free(error_message);
+ }
+ return;
+}
static int __initialize_package_info_db()
{
return 0;
}
-static int __initialize_package_app_icon_localized_info_db()
+static int __initialize_package_app_icon_section_info_db()
{
char *error_message = NULL;
if (SQLITE_OK !=
sqlite3_exec(pkgmgr_parser_db,
- QUERY_CREATE_TABLE_PACKAGE_APP_ICON_LOCALIZED_INFO, NULL,
+ QUERY_CREATE_TABLE_PACKAGE_APP_ICON_SECTION_INFO, NULL,
NULL, &error_message)) {
DBG("Don't execute query = %s error message = %s\n",
- QUERY_CREATE_TABLE_PACKAGE_APP_ICON_LOCALIZED_INFO,
+ QUERY_CREATE_TABLE_PACKAGE_APP_ICON_SECTION_INFO,
+ error_message);
+ sqlite3_free(error_message);
+ return -1;
+ }
+ sqlite3_free(error_message);
+ return 0;
+}
+
+static int __initialize_package_app_image_info_db()
+{
+ char *error_message = NULL;
+ if (SQLITE_OK !=
+ sqlite3_exec(pkgmgr_parser_db,
+ QUERY_CREATE_TABLE_PACKAGE_APP_IMAGE_INFO, NULL,
+ NULL, &error_message)) {
+ DBG("Don't execute query = %s error message = %s\n",
+ QUERY_CREATE_TABLE_PACKAGE_APP_IMAGE_INFO,
error_message);
sqlite3_free(error_message);
return -1;
return 0;
}
+static int __initialize_package_app_app_metadata_db()
+{
+ char *error_message = NULL;
+ if (SQLITE_OK !=
+ sqlite3_exec(pkgmgr_parser_db,
+ QUERY_CREATE_TABLE_PACKAGE_APP_APP_METADATA, NULL, NULL,
+ &error_message)) {
+ DBG("Don't execute query = %s error message = %s\n",
+ QUERY_CREATE_TABLE_PACKAGE_APP_APP_METADATA, error_message);
+ sqlite3_free(error_message);
+ return -1;
+ }
+ sqlite3_free(error_message);
+ return 0;
+}
+
+static int __initialize_package_app_app_permission_db()
+{
+ char *error_message = NULL;
+ if (SQLITE_OK !=
+ sqlite3_exec(pkgmgr_parser_db,
+ QUERY_CREATE_TABLE_PACKAGE_APP_APP_PERMISSION, NULL, NULL,
+ &error_message)) {
+ DBG("Don't execute query = %s error message = %s\n",
+ QUERY_CREATE_TABLE_PACKAGE_APP_APP_PERMISSION, error_message);
+ sqlite3_free(error_message);
+ return -1;
+ }
+ sqlite3_free(error_message);
+ return 0;
+}
+
static int __initialize_package_app_app_svc_db()
{
char *error_message = NULL;
return locale;
}
+static GList *__create_image_list(GList *locale, image_x *image)
+{
+ while(image != NULL)
+ {
+ if (image->section)
+ locale = g_list_insert_sorted_with_data(locale, (gpointer)image->section, __comparefunc, NULL);
+ image = image->next;
+ }
+ return locale;
+}
+
static void __printfunc(gpointer data, gpointer userdata)
{
DBG("%s ", (char*)data);
prev = (char *)data;
}
+static void __trimfunc4(gpointer data, gpointer userdata)
+{
+ if (prev) {
+ if (strcmp((char *)data, prev) == 0) {
+ appimage = g_list_remove(appimage, data);
+ } else
+ prev = (char *)data;
+ }
+ else
+ prev = (char *)data;
+}
+
static gint __comparefunc(gconstpointer a, gconstpointer b, gpointer userdata)
{
if (a == NULL || b == NULL)
}
-static void __extract_icon_data(gpointer data, icon_x *icn, char **lang, char **icon, char **resolution)
+static void __extract_icon_data(gpointer data, icon_x *icn, char **icon, char **resolution)
{
while(icn != NULL)
{
if (icn->section) {
if (strcmp(icn->section, (char *)data) == 0) {
- *lang = (char*)icn->lang;
*icon = (char*)icn->text;
*resolution = (char*)icn->resolution;
break;
}
}
+static void __extract_image_data(gpointer data, icon_x *image, char **lang, char **img)
+{
+ while(image != NULL)
+ {
+ if (image->section) {
+ if (strcmp(image->section, (char *)data) == 0) {
+ *lang = (char*)image->lang;
+ *img = (char*)image->text;
+ break;
+ }
+ }
+ image = image->next;
+ }
+}
+
static void __insert_pkglocale_info(gpointer data, gpointer userdata)
{
int ret = -1;
}
-static void __insert_uiapplication_icon_locale_info(gpointer data, gpointer userdata)
+static void __insert_uiapplication_icon_section_info(gpointer data, gpointer userdata)
{
int ret = -1;
- char *lang = NULL;
char *icon = NULL;
char *resolution = NULL;
char query[MAX_QUERY_LEN] = {'\0'};
uiapplication_x *up = (uiapplication_x*)userdata;
icon_x *icn = up->icon;
- __extract_icon_data(data, icn, &lang, &icon, &resolution);
- if (!lang && !icon && !resolution)
+ __extract_icon_data(data, icn, &icon, &resolution);
+ if (!icon && !resolution)
return;
- sqlite3_snprintf(MAX_QUERY_LEN, query, "insert into package_app_icon_localized_info(app_id, app_locale, " \
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "insert into package_app_icon_section_info(app_id, " \
"app_icon, app_icon_section, app_icon_resolution) values " \
- "('%q', '%q', '%q', '%q', '%q')", up->appid, lang,
+ "('%q', '%q', '%q', '%q')", up->appid,
icon, (char*)data, resolution);
ret = __exec_query(query);
}
+static void __insert_uiapplication_image_info(gpointer data, gpointer userdata)
+{
+ int ret = -1;
+ char *lang = NULL;
+ char *img = NULL;
+ char query[MAX_QUERY_LEN] = {'\0'};
+
+ uiapplication_x *up = (uiapplication_x*)userdata;
+ image_x *image = up->image;
+
+ __extract_image_data(data, image, &lang, &img);
+ if (!lang && !img)
+ return;
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "insert into package_app_image_info(app_id, app_locale, " \
+ "app_image_section, app_image) values " \
+ "('%q', '%q', '%q', '%q')", up->appid, lang, (char*)data, img);
+
+ ret = __exec_query(query);
+ if (ret == -1)
+ DBG("Package UiApp image Info DB Insert failed\n");
+
+}
+
+
static void __insert_serviceapplication_locale_info(gpointer data, gpointer userdata)
{
int ret = -1;
}
if (mfx->mainapp_id == NULL){
- snprintf(query, MAX_QUERY_LEN,
+ if (mfx->uiapplication
+ && mfx->uiapplication->appid) {
+ snprintf(query, MAX_QUERY_LEN,
"update package_app_info set app_mainapp='true' where app_id='%s'", mfx->uiapplication->appid);
+ } else if (mfx->serviceapplication
+ && mfx->serviceapplication->appid) {
+ snprintf(query, MAX_QUERY_LEN,
+ "update package_app_info set app_mainapp='true' where app_id='%s'", mfx->serviceapplication->appid);
+ } else {
+ DBG("Not valid appid\n");
+ return -1;
+ }
+
ret = __exec_query(query);
if (ret == -1) {
DBG("Package UiApp Info DB Insert Failed\n");
return -1;
}
- mfx->mainapp_id = strdup(mfx->uiapplication->appid);
- }
+ if (mfx->uiapplication && mfx->uiapplication->appid)
+ mfx->mainapp_id = strdup(mfx->uiapplication->appid);
+ else if (mfx->serviceapplication && mfx->serviceapplication->appid)
+ mfx->mainapp_id = strdup(mfx->serviceapplication->appid);
+
+}
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN,
return 0;
}
-
+/* _PRODUCT_LAUNCHING_ENHANCED_
+* up->indicatordisplay, up->portraitimg, up->landscapeimg, up->guestmode_appstatus
+*/
static int __insert_uiapplication_info(manifest_x *mfx)
{
uiapplication_x *up = mfx->uiapplication;
{
snprintf(query, MAX_QUERY_LEN,
"insert into package_app_info(app_id, app_component, app_exec, app_nodisplay, app_type, app_onboot, " \
- "app_multiple, app_autorestart, app_taskmanage, app_hwacceleration, app_mainapp , app_recentimage, package) " \
- "values('%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
+ "app_multiple, app_autorestart, app_taskmanage, app_enabled, app_hwacceleration, app_mainapp , app_recentimage, app_indicatordisplay, app_portraitimg, app_landscapeimg, app_guestmodevisibility, package) " \
+ "values('%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
up->appid, "uiapp", up->exec, up->nodisplay, up->type, "\0", up->multiple,
- "\0", up->taskmanage, up->hwacceleration,up->mainapp, up->recentimage, mfx->package);
+ "\0", up->taskmanage, up->enabled, up->hwacceleration,up->mainapp, up->recentimage, up->indicatordisplay, up->portraitimg, up->landscapeimg, up->guestmode_visibility, mfx->package);
ret = __exec_query(query);
if (ret == -1) {
DBG("Package UiApp Info DB Insert Failed\n");
return 0;
}
+static int __insert_uiapplication_appmetadata_info(manifest_x *mfx)
+{
+ uiapplication_x *up = mfx->uiapplication;
+ metadata_x *md = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(up != NULL)
+ {
+ md = up->metadata;
+ while (md != NULL)
+ {
+ if (md->name && md->value) {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_app_metadata(app_id, md_name, md_value) " \
+ "values('%s','%s', '%s')",\
+ up->appid, md->name, md->value);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ DBG("Package UiApp Metadata Info DB Insert Failed\n");
+ return -1;
+ }
+ }
+ md = md->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ up = up->next;
+ }
+ return 0;
+}
+
+static int __insert_uiapplication_apppermission_info(manifest_x *mfx)
+{
+ uiapplication_x *up = mfx->uiapplication;
+ permission_x *pm = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(up != NULL)
+ {
+ pm = up->permission;
+ while (pm != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_app_permission(app_id, pm_type, pm_value) " \
+ "values('%s','%s', '%s')",\
+ up->appid, pm->type, pm->value);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ DBG("Package UiApp permission Info DB Insert Failed\n");
+ return -1;
+ }
+ pm = pm->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ up = up->next;
+ }
+ return 0;
+}
+
static int __insert_uiapplication_appcontrol_info(manifest_x *mfx)
{
uiapplication_x *up = mfx->uiapplication;
while(sp != NULL)
{
snprintf(query, MAX_QUERY_LEN,
- "insert into package_app_info(app_id, app_component, app_exec, app_nodisplay, app_type, app_onboot, " \
- "app_multiple, app_autorestart, package) " \
+ "insert into package_app_info(app_id, app_component, app_exec, app_type, app_onboot, " \
+ "app_multiple, app_autorestart, app_enabled, package) " \
"values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
- sp->appid, "svcapp", sp->exec, "\0", sp->type, sp->onboot, "\0",
- sp->autorestart, mfx->package);
+ sp->appid, "svcapp", sp->exec, sp->type, sp->onboot, "\0",
+ sp->autorestart, sp->enabled, mfx->package);
ret = __exec_query(query);
if (ret == -1) {
DBG("Package ServiceApp Info DB Insert Failed\n");
return 0;
}
+static int __insert_serviceapplication_appmetadata_info(manifest_x *mfx)
+{
+ serviceapplication_x *sp = mfx->serviceapplication;
+ metadata_x *md = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(sp != NULL)
+ {
+ md = sp->metadata;
+ while (md != NULL)
+ {
+ if (md->name && md->value) {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_app_metadata(app_id, md_name, md_value) " \
+ "values('%s','%s', '%s')",\
+ sp->appid, md->name, md->value);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ DBG("Package ServiceApp Metadata Info DB Insert Failed\n");
+ return -1;
+ }
+ }
+ md = md->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ sp = sp->next;
+ }
+ return 0;
+}
+
+static int __insert_serviceapplication_apppermission_info(manifest_x *mfx)
+{
+ serviceapplication_x *sp = mfx->serviceapplication;
+ permission_x *pm = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ while(sp != NULL)
+ {
+ pm = sp->permission;
+ while (pm != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "insert into package_app_app_permission(app_id, pm_type, pm_value) " \
+ "values('%s','%s', '%s')",\
+ sp->appid, pm->type, pm->value);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ DBG("Package ServiceApp permission Info DB Insert Failed\n");
+ return -1;
+ }
+ pm = pm->next;
+ memset(query, '\0', MAX_QUERY_LEN);
+ }
+ sp = sp->next;
+ }
+ return 0;
+}
+
static int __insert_serviceapplication_appcontrol_info(manifest_x *mfx)
{
serviceapplication_x *sp = mfx->serviceapplication;
author_x *ath = mfx->author;
uiapplication_x *up = mfx->uiapplication;
uiapplication_x *up_icn = mfx->uiapplication;
+ uiapplication_x *up_image = mfx->uiapplication;
serviceapplication_x *sp = mfx->serviceapplication;
char query[MAX_QUERY_LEN] = { '\0' };
int ret = -1;
char *type = NULL;
+ char *path = NULL;
char *auth_name = NULL;
char *auth_email = NULL;
char *auth_href = NULL;
type = strdup(mfx->type);
else
type = strdup("rpm");
+ /*Insert in the package_info DB*/
+ if (mfx->root_path)
+ path = strdup(mfx->root_path);
+ else{
+ if (strcmp(type,"rpm")==0)
+ path = strdup("/usr/apps");
+ else
+ path = strdup("/opt/usr/apps");
+ }
snprintf(query, MAX_QUERY_LEN,
"insert into package_info(package, package_type, package_version, install_location, package_size, " \
- "package_removable, package_preload, package_readonly, author_name, author_email, author_href, installed_time, storeclient_id, mainapp_id, package_url) " \
- "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
+ "package_removable, package_preload, package_readonly, author_name, author_email, author_href, installed_time, storeclient_id, mainapp_id, package_url, root_path) " \
+ "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
mfx->package, type, mfx->version, mfx->installlocation, mfx->package_size, mfx->removable, mfx->preload,
- mfx->readonly, auth_name, auth_email, auth_href, mfx->installed_time, mfx->storeclient_id, mfx->mainapp_id, mfx->package_url);
+ mfx->readonly, auth_name, auth_email, auth_href, mfx->installed_time, mfx->storeclient_id, mfx->mainapp_id, mfx->package_url, path);
ret = __exec_query(query);
if (ret == -1) {
DBG("Package Info DB Insert Failed\n");
free(type);
type = NULL;
}
+ if (path) {
+ free(path);
+ path = NULL;
+ }
return -1;
}
if (type) {
free(type);
type = NULL;
}
+ if (path) {
+ free(path);
+ path = NULL;
+ }
/*Insert the package locale and app locale info */
pkglocale = __create_locale_list(pkglocale, lbl, lcn, icn, dcn, ath);
g_list_foreach(pkglocale, __trimfunc1, NULL);
g_list_foreach(appicon, __trimfunc3, NULL);
prev = NULL;
+ /*Insert the image info */
+ while(up_image != NULL)
+ {
+ appimage = __create_image_list(appimage, up_image->image);
+ up_image = up_image->next;
+ }
+ g_list_foreach(appimage, __trimfunc4, NULL);
+ prev = NULL;
+
/*g_list_foreach(pkglocale, __printfunc, NULL);*/
/*DBG("\n");*/
/*g_list_foreach(applocale, __printfunc, NULL);*/
up_icn = mfx->uiapplication;
while(up_icn != NULL)
{
- g_list_foreach(appicon, __insert_uiapplication_icon_locale_info, (gpointer)up_icn);
+ g_list_foreach(appicon, __insert_uiapplication_icon_section_info, (gpointer)up_icn);
up_icn = up_icn->next;
}
+ /*app image info*/
+ up_image = mfx->uiapplication;
+ while(up_image != NULL)
+ {
+ g_list_foreach(appimage, __insert_uiapplication_image_info, (gpointer)up_image);
+ up_image = up_image->next;
+ }
+
g_list_free(pkglocale);
pkglocale = NULL;
g_list_free(applocale);
applocale = NULL;
g_list_free(appicon);
appicon = NULL;
+ g_list_free(appimage);
+ appimage = NULL;
/*Insert in the package_app_info DB*/
if (ret == -1)
return -1;
+ /*Insert in the package_app_app_metadata DB*/
+ ret = __insert_uiapplication_appmetadata_info(mfx);
+ if (ret == -1)
+ return -1;
+ ret = __insert_serviceapplication_appmetadata_info(mfx);
+ if (ret == -1)
+ return -1;
+
+ /*Insert in the package_app_app_permission DB*/
+ ret = __insert_uiapplication_apppermission_info(mfx);
+ if (ret == -1)
+ return -1;
+ ret = __insert_serviceapplication_apppermission_info(mfx);
+ if (ret == -1)
+ return -1;
+
/*Insert in the package_app_app_svc DB*/
ret = __insert_uiapplication_appsvc_info(mfx);
if (ret == -1)
sp = sp->next;
}
+ /*Delete from App icon localized Info*/
+ up = mfx->uiapplication;
+ while(up != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "delete from package_app_icon_section_info where app_id='%s'", up->appid);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ DBG("Package App image Info DB Delete Failed\n");
+ return -1;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+ up = up->next;
+ }
+
+ /*Delete from App image Info*/
+ up = mfx->uiapplication;
+ while(up != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "delete from package_app_image_info where app_id='%s'", up->appid);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ DBG("Package App image Info DB Delete Failed\n");
+ return -1;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+ up = up->next;
+ }
+
/*Delete from Package App App-Svc*/
up = mfx->uiapplication;
sp = mfx->serviceapplication;
sp = sp->next;
}
+ /*Delete from Package App App-Metadata*/
+ up = mfx->uiapplication;
+ sp = mfx->serviceapplication;
+ while(up != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "delete from package_app_app_metadata where app_id='%s'", up->appid);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ DBG("Package App App-Metadata DB Delete Failed\n");
+ return -1;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+ up = up->next;
+ }
+ while(sp != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "delete from package_app_app_metadata where app_id='%s'", sp->appid);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ DBG("Package App App-Metadata DB Delete Failed\n");
+ return -1;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+ sp = sp->next;
+ }
+
+ /*Delete from Package App App-permission*/
+ up = mfx->uiapplication;
+ sp = mfx->serviceapplication;
+ while(up != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "delete from package_app_app_permission where app_id='%s'", up->appid);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ DBG("Package App App-permission DB Delete Failed\n");
+ return -1;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+ up = up->next;
+ }
+ while(sp != NULL)
+ {
+ snprintf(query, MAX_QUERY_LEN,
+ "delete from package_app_app_permission where app_id='%s'", sp->appid);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ DBG("Package App App-permission DB Delete Failed\n");
+ return -1;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+ sp = sp->next;
+ }
+
/*Delete from Package App Share Allowed*/
up = mfx->uiapplication;
sp = mfx->serviceapplication;
DBG("package app localized info DB initialization failed\n");
return ret;
}
- ret = __initialize_package_app_icon_localized_info_db();
+ ret = __initialize_package_app_icon_section_info_db();
if (ret == -1) {
DBG("package app icon localized info DB initialization failed\n");
return ret;
}
+ ret = __initialize_package_app_image_info_db();
+ if (ret == -1) {
+ DBG("package app image info DB initialization failed\n");
+ return ret;
+ }
ret = __initialize_package_app_app_control_db();
if (ret == -1) {
DBG("package app app control DB initialization failed\n");
DBG("package app app category DB initialization failed\n");
return ret;
}
+ ret = __initialize_package_app_app_metadata_db();
+ if (ret == -1) {
+ DBG("package app app category DB initialization failed\n");
+ return ret;
+ }
+ ret = __initialize_package_app_app_permission_db();
+ if (ret == -1) {
+ DBG("package app app permission DB initialization failed\n");
+ return ret;
+ }
ret = __initialize_package_app_app_svc_db();
if (ret == -1) {
DBG("package app app svc DB initialization failed\n");
PKGMGR_PARSER_DB_FILE);
return -1;
}
+ ret = chmod(PKGMGR_PARSER_DB_FILE, 0664);
+ if (ret)
+ DBG("Failed to change mode of manifest DB\n");
return 0;
}
DBG("Pkgmgr DB does not exists. Create one!!\n");
DBG("connect db [%s] failed!\n", PKGMGR_PARSER_DB_FILE);
return -1;
}
+ ret = chmod(PKGMGR_PARSER_DB_FILE, 0664);
+ if (ret)
+ DBG("Failed to change mode of manifest DB\n");
return 0;
}
ret = pkgmgr_parser_initialize_db();
if (ret == -1)
return ret;
-
+ /*Preserve guest mode visibility*/
+ __preserve_guestmode_visibility_value( mfx);
/*Begin transaction*/
ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
"LEFT OUTER JOIN package_app_app_category " \
"ON package_app_info.app_id=package_app_app_category.app_id where "
-#define retv_if(expr, val) do { \
- if(expr) { \
- _LOGE("(%s) -> %s() return\n", #expr, __FUNCTION__); \
- return (val); \
- } \
-} while (0)
-
#define LANGUAGE_LENGTH 2
typedef struct _pkgmgr_instcertinfo_x {
char *iconpath;
} pkgmgr_iconpath_x;
+typedef struct _pkgmgr_image_x {
+ char *imagepath;
+} pkgmgr_image_x;
+
typedef struct _pkgmgr_locale_x {
char *locale;
} pkgmgr_locale_x;
typedef int (*sqlite_query_callback)(void *data, int ncols, char **coltxt, char **colname);
char *pkgtype = "rpm";
-sqlite3 *manifest_db = NULL;
-sqlite3 *datacontrol_db = NULL;
-int gflag[9];/*one for each cert type*/
-char *gpkgcert[9];/*To store pkg cert values*/
+__thread sqlite3 *manifest_db = NULL;
+__thread sqlite3 *datacontrol_db = NULL;
+__thread int gflag[9];/*one for each cert type*/
+__thread char *gpkgcert[9];/*To store pkg cert values*/
static int __open_manifest_db();
static int __exec_pkginfo_query(char *query, void *data);
static int __exec_appinfo_query(char *query, void *data);
static int __exec_certinfo_query(char *query, void *data);
-static int __exec_sqlite_query(char *query, sqlite_query_callback callback, void *data);
static int __pkginfo_cb(void *data, int ncols, char **coltxt, char **colname);
static int __appinfo_cb(void *data, int ncols, char **coltxt, char **colname);
static int __certinfo_cb(void *data, int ncols, char **coltxt, char **colname);
static void __destroy_each_node(gpointer data, gpointer user_data)
{
- if (data == NULL)
- return;
+ ret_if(data == NULL);
pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)data;
if (node->value) {
free(node->value);
return strdup(DEFAULT_LOCALE);
char *locale = NULL;
locale = (char *)calloc(1, 6);
- if (!locale) {
- _LOGE("Malloc Failed\n");
- return NULL;
- }
+ retvm_if(!locale, NULL, "Malloc Failed\n");
+
strncpy(locale, syslocale, 2);
strncat(locale, "-", 1);
locale[3] = syslocale[3] + 32;
static void __cleanup_pkginfo(pkgmgr_pkginfo_x *data)
{
- if (data == NULL)
- return;
+ ret_if(data == NULL);
if (data->tmp_dup){
free((void *)data->tmp_dup);
data->tmp_dup = NULL;
static void __cleanup_appinfo(pkgmgr_appinfo_x *data)
{
- if (data == NULL)
- return;
+ ret_if(data == NULL);
+ if (data->package){
+ free((void *)data->package);
+ data->package = NULL;
+ }
manifest_x *mfx = calloc(1, sizeof(manifest_x));
if (data->app_component == PMINFO_UI_APP)
ret =
db_util_open_with_options(MANIFEST_DB, &manifest_db,
SQLITE_OPEN_READONLY, NULL);
- if (ret != SQLITE_OK) {
- _LOGE("connect db [%s] failed!\n", MANIFEST_DB);
- return -1;
- }
+ retvm_if(ret != SQLITE_OK, -1, "connect db [%s] failed!\n", MANIFEST_DB);
return 0;
}
_LOGE("Manifest DB does not exists !!\n");
ret =
db_util_open_with_options(DATACONTROL_DB, &datacontrol_db,
SQLITE_OPEN_READONLY, NULL);
- if (ret != SQLITE_OK) {
- _LOGE("connect db [%s] failed!\n", DATACONTROL_DB);
- return -1;
- }
+ retvm_if(ret != SQLITE_OK, -1, "connect db [%s] failed!\n", DATACONTROL_DB);
return 0;
}
_LOGE("Datacontrol DB does not exists !!\n");
info->manifest_info->uiapplication->hwacceleration = strdup(coltxt[i]);
else
info->manifest_info->uiapplication->hwacceleration = NULL;
+ } else if (strcmp(colname[i], "app_indicatordisplay") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->indicatordisplay = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->indicatordisplay = NULL;
+ } else if (strcmp(colname[i], "app_portraitimg") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->portraitimg = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->portraitimg = NULL;
+ } else if (strcmp(colname[i], "app_landscapeimg") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->landscapeimg = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->landscapeimg = NULL;
+ } else if (strcmp(colname[i], "app_guestmodevisibility") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->guestmode_visibility = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->guestmode_visibility = NULL;
} else if (strcmp(colname[i], "package") == 0 ){
if (coltxt[i])
info->manifest_info->uiapplication->package = strdup(coltxt[i]);
info->manifest_info->uiapplication->label->text = strdup(coltxt[i]);
else
info->manifest_info->uiapplication->label->text = NULL;
+ } else if (strcmp(colname[i], "app_recentimage") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->recentimage = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->recentimage = NULL;
+ } else if (strcmp(colname[i], "app_mainapp") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->mainapp = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->mainapp = NULL;
} else if (strcmp(colname[i], "app_locale") == 0 ) {
if (coltxt[i]) {
info->manifest_info->uiapplication->icon->lang = strdup(coltxt[i]);
info->manifest_info->uiapplication->hwacceleration = strdup(coltxt[i]);
else
info->manifest_info->uiapplication->hwacceleration = NULL;
+ } else if (strcmp(colname[i], "app_indicatordisplay") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->indicatordisplay = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->indicatordisplay = NULL;
+ } else if (strcmp(colname[i], "app_portraitimg") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->portraitimg = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->portraitimg = NULL;
+ } else if (strcmp(colname[i], "app_landscapeimg") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->landscapeimg = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->landscapeimg = NULL;
+ } else if (strcmp(colname[i], "app_guestmodevisibility") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->uiapplication->guestmode_visibility = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->guestmode_visibility = NULL;
} else if (strcmp(colname[i], "package") == 0 ){
if (coltxt[i])
info->manifest_info->uiapplication->package = strdup(coltxt[i]);
info->manifest_info->uiapplication->label->text = strdup(coltxt[i]);
else
info->manifest_info->uiapplication->label->text = NULL;
+ } else if (strcmp(colname[i], "app_recentimage") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->recentimage = strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->recentimage = NULL;
+ } else if (strcmp(colname[i], "app_mainapp") == 0 ) {
+ if (coltxt[i])
+ info->manifest_info->uiapplication->mainapp= strdup(coltxt[i]);
+ else
+ info->manifest_info->uiapplication->mainapp = NULL;
} else if (strcmp(colname[i], "app_locale") == 0 ) {
if (coltxt[i]) {
info->manifest_info->uiapplication->icon->lang = strdup(coltxt[i]);
info->manifest_info->mainapp_id = strdup(coltxt[i]);
else
info->manifest_info->mainapp_id = NULL;
+ } else if (strcmp(colname[i], "root_path") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->root_path = strdup(coltxt[i]);
+ else
+ info->manifest_info->root_path = NULL;
} else if (strcmp(colname[i], "package_locale") == 0 ){
if (coltxt[i]) {
icon_x *icon = NULL;
label_x *label = NULL;
category_x *category = NULL;
+ metadata_x *metadata = NULL;
+ permission_x *permission = NULL;
+ image_x *image = NULL;
switch (info->app_component) {
case PMINFO_UI_APP:
LISTADD(info->uiapp_info->label, label);
category = calloc(1, sizeof(category_x));
LISTADD(info->uiapp_info->category, category);
+ metadata = calloc(1, sizeof(metadata_x));
+ LISTADD(info->uiapp_info->metadata, metadata);
+ permission = calloc(1, sizeof(permission_x));
+ LISTADD(info->uiapp_info->permission, permission);
+ image = calloc(1, sizeof(image_x));
+ LISTADD(info->uiapp_info->image, image);
+
for(i = 0; i < ncols; i++)
{
if (strcmp(colname[i], "app_id") == 0) {
info->uiapp_info->type = strdup(coltxt[i]);
else
info->uiapp_info->type = NULL;
+ } else if (strcmp(colname[i], "app_icon_section") == 0 ) {
+ if (coltxt[i]){
+ info->uiapp_info->icon->section= strdup(coltxt[i]);
+ _LOGE("isectt == %s \n",info->uiapp_info->icon->section);
+ }
+ else
+ info->uiapp_info->icon->section = NULL;
} else if (strcmp(colname[i], "app_icon") == 0) {
if (coltxt[i])
info->uiapp_info->icon->text = strdup(coltxt[i]);
info->uiapp_info->hwacceleration = strdup(coltxt[i]);
else
info->uiapp_info->hwacceleration = NULL;
+ } else if (strcmp(colname[i], "app_enabled") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->enabled= strdup(coltxt[i]);
+ else
+ info->uiapp_info->enabled = NULL;
+ } else if (strcmp(colname[i], "app_indicatordisplay") == 0){
+ if (coltxt[i])
+ info->uiapp_info->indicatordisplay = strdup(coltxt[i]);
+ else
+ info->uiapp_info->indicatordisplay = NULL;
+ } else if (strcmp(colname[i], "app_portraitimg") == 0){
+ if (coltxt[i])
+ info->uiapp_info->portraitimg = strdup(coltxt[i]);
+ else
+ info->uiapp_info->portraitimg = NULL;
+ } else if (strcmp(colname[i], "app_landscapeimg") == 0){
+ if (coltxt[i])
+ info->uiapp_info->landscapeimg = strdup(coltxt[i]);
+ else
+ info->uiapp_info->landscapeimg = NULL;
+ } else if (strcmp(colname[i], "app_guestmodevisibility") == 0){
+ if (coltxt[i])
+ info->uiapp_info->guestmode_visibility = strdup(coltxt[i]);
+ else
+ info->uiapp_info->guestmode_visibility = NULL;
} else if (strcmp(colname[i], "category") == 0 ) {
if (coltxt[i])
info->uiapp_info->category->name = strdup(coltxt[i]);
else
info->uiapp_info->category->name = NULL;
+ } else if (strcmp(colname[i], "md_name") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->metadata->name = strdup(coltxt[i]);
+ else
+ info->uiapp_info->metadata->name = NULL;
+ } else if (strcmp(colname[i], "md_value") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->metadata->value = strdup(coltxt[i]);
+ else
+ info->uiapp_info->metadata->value = NULL;
+ } else if (strcmp(colname[i], "pm_type") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->permission->type= strdup(coltxt[i]);
+ else
+ info->uiapp_info->permission->type = NULL;
+ } else if (strcmp(colname[i], "pm_value") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->permission->value = strdup(coltxt[i]);
+ else
+ info->uiapp_info->permission->value = NULL;
+ } else if (strcmp(colname[i], "app_recentimage") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->recentimage = strdup(coltxt[i]);
+ else
+ info->uiapp_info->recentimage = NULL;
+ } else if (strcmp(colname[i], "app_mainapp") == 0 ) {
+ if (coltxt[i])
+ info->uiapp_info->mainapp = strdup(coltxt[i]);
+ else
+ info->uiapp_info->mainapp = NULL;
} else if (strcmp(colname[i], "app_locale") == 0 ) {
if (coltxt[i]) {
info->uiapp_info->icon->lang = strdup(coltxt[i]);
info->uiapp_info->icon->lang = NULL;
info->uiapp_info->label->lang = NULL;
}
+ } else if (strcmp(colname[i], "app_image") == 0) {
+ if (coltxt[i])
+ info->uiapp_info->image->text= strdup(coltxt[i]);
+ else
+ info->uiapp_info->image->text = NULL;
+ } else if (strcmp(colname[i], "app_image_section") == 0) {
+ if (coltxt[i])
+ info->uiapp_info->image->section= strdup(coltxt[i]);
+ else
+ info->uiapp_info->image->section = NULL;
} else
continue;
}
LISTADD(info->svcapp_info->label, label);
category = calloc(1, sizeof(category_x));
LISTADD(info->svcapp_info->category, category);
+ metadata = calloc(1, sizeof(metadata_x));
+ LISTADD(info->svcapp_info->metadata, metadata);
for(i = 0; i < ncols; i++)
{
if (strcmp(colname[i], "app_id") == 0) {
info->svcapp_info->autorestart = strdup(coltxt[i]);
else
info->svcapp_info->autorestart = NULL;
+ } else if (strcmp(colname[i], "app_enabled") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->enabled= strdup(coltxt[i]);
+ else
+ info->svcapp_info->enabled = NULL;
} else if (strcmp(colname[i], "category") == 0 ) {
if (coltxt[i])
info->svcapp_info->category->name = strdup(coltxt[i]);
else
info->svcapp_info->category->name = NULL;
+ } else if (strcmp(colname[i], "md_name") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->metadata->name = strdup(coltxt[i]);
+ else
+ info->svcapp_info->metadata->name = NULL;
+ } else if (strcmp(colname[i], "md_value") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->metadata->value = strdup(coltxt[i]);
+ else
+ info->svcapp_info->metadata->value = NULL;
+ } else if (strcmp(colname[i], "pm_type") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->permission->type= strdup(coltxt[i]);
+ else
+ info->svcapp_info->permission->type = NULL;
+ } else if (strcmp(colname[i], "pm_value") == 0 ) {
+ if (coltxt[i])
+ info->svcapp_info->permission->value = strdup(coltxt[i]);
+ else
+ info->svcapp_info->permission->value = NULL;
} else if (strcmp(colname[i], "app_locale") == 0 ) {
if (coltxt[i]) {
info->svcapp_info->icon->lang = strdup(coltxt[i]);
return 0;
}
+static int __image_path_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ pkgmgr_image_x *image_path = (pkgmgr_image_x *)data;
+ int i = 0;
+ for(i = 0; i < ncols; i++)
+ {
+ if (strcmp(colname[i], "app_image") == 0) {
+ if (coltxt[i])
+ image_path->imagepath = strdup(coltxt[i]);
+ else
+ image_path->imagepath = NULL;
+ } else
+ continue;
+ }
+ return 0;
+}
+
static int __cert_cb(void *data, int ncols, char **coltxt, char **colname)
{
pkgmgr_cert_x *info = (pkgmgr_cert_x *)data;
return 0;
}
-static int __exec_sqlite_query(char *query, sqlite_query_callback callback, void *data)
+static int __exec_db_query(sqlite3 *db, char *query, sqlite_query_callback callback, void *data)
{
char *error_message = NULL;
if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, callback, data, &error_message)) {
+ sqlite3_exec(db, query, callback, data, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
error_message);
sqlite3_free(error_message);
return 0;
}
-static int __check_app_locale_from_app_localized_info_by_exact(const char *appid, const char *locale)
+static int __check_app_locale_from_app_localized_info_by_exact(sqlite3 *db, const char *appid, const char *locale)
{
int result_query = -1;
char query[MAX_QUERY_LEN];
snprintf(query, MAX_QUERY_LEN, "select exists(select app_locale from package_app_localized_info where app_id='%s' and app_locale='%s')", appid, locale);
- __exec_sqlite_query(query, __check_validation_of_qurey_cb, (void *)&result_query);
+ __exec_db_query(db, query, __check_validation_of_qurey_cb, (void *)&result_query);
return result_query;
}
-static int __check_app_locale_from_app_localized_info_by_fallback(const char *appid, const char *locale)
+static int __check_app_locale_from_app_localized_info_by_fallback(sqlite3 *db, const char *appid, const char *locale)
{
int result_query = -1;
char wildcard[2] = {'%','\0'};
strncpy(lang, locale, LANGUAGE_LENGTH);
snprintf(query, MAX_QUERY_LEN, "select exists(select app_locale from package_app_localized_info where app_id='%s' and app_locale like '%s%s')", appid, lang, wildcard);
- __exec_sqlite_query(query, __check_validation_of_qurey_cb, (void *)&result_query);
+ __exec_db_query(db, query, __check_validation_of_qurey_cb, (void *)&result_query);
return result_query;
}
-static char* __get_app_locale_from_app_localized_info_by_fallback(const char *appid, const char *locale)
+static char* __get_app_locale_from_app_localized_info_by_fallback(sqlite3 *db, const char *appid, const char *locale)
{
char wildcard[2] = {'%','\0'};
char lang[3] = {'\0'};
strncpy(lang, locale, 2);
snprintf(query, MAX_QUERY_LEN, "select app_locale from package_app_localized_info where app_id='%s' and app_locale like '%s%s'", appid, lang, wildcard);
- __exec_sqlite_query(query, __fallback_locale_cb, (void *)info);
+ __exec_db_query(db, query, __fallback_locale_cb, (void *)info);
locale_new = info->locale;
free(info);
return locale;
}
-static char* __get_app_locale_by_fallback(const char *appid, const char *syslocale)
+static char* __get_app_locale_by_fallback(sqlite3 *db, const char *appid, const char *syslocale)
{
assert(appid);
assert(syslocale);
locale = __convert_syslocale_to_manifest_locale(syslocale);
/*check exact matching */
- check_result = __check_app_locale_from_app_localized_info_by_exact(appid, locale);
+ check_result = __check_app_locale_from_app_localized_info_by_exact(db, appid, locale);
/* Exact found */
if (check_result == 1) {
}
/* fallback matching */
- check_result = __check_app_locale_from_app_localized_info_by_fallback(appid, locale);
+ check_result = __check_app_locale_from_app_localized_info_by_fallback(db, appid, locale);
if(check_result == 1) {
- locale_new = __get_app_locale_from_app_localized_info_by_fallback(appid, locale);
+ locale_new = __get_app_locale_from_app_localized_info_by_fallback(db, appid, locale);
_LOGD("%s found (%s) language-locale in DB by fallback!\n", appid, locale_new);
free(locale);
if (locale_new == NULL)
struct dirent *ep = NULL;
struct stat fileinfo;
char abs_filename[FILENAME_MAX] = { 0, };
- if (dirname == NULL) {
- _LOGE("dirname is NULL");
- return PMINFO_R_ERROR;
- }
+ retvm_if(dirname == NULL, PMINFO_R_ERROR, "dirname is NULL");
+
dp = opendir(dirname);
if (dp != NULL) {
while ((ep = readdir(dp)) != NULL) {
API int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon)
{
-#if 0
- if (handle == NULL) {
- _LOGE("pkginfo handle is NULL\n");
- return PMINFO_R_EINVAL;
- }
- if (icon == NULL) {
- _LOGE("Argument supplied to hold return value is NULL\n");
- return PMINFO_R_EINVAL;
- }
- char *syslocale = NULL;
- char *locale = NULL;
- char *save = NULL;
- icon_x *ptr = NULL;
- syslocale = vconf_get_str(VCONFKEY_LANGSET);
- if (syslocale == NULL) {
- _LOGE("current locale is NULL\n");
- return PMINFO_R_EINVAL;
- }
- locale = __convert_system_locale_to_manifest_locale(syslocale);
- if (locale == NULL) {
- _LOGE("manifest locale is NULL\n");
- return PMINFO_R_EINVAL;
- }
- save = locale;
- *icon = NULL;
- pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
- for(ptr = info->manifest_info->icon; ptr != NULL; ptr = ptr->next)
- {
- if (ptr->lang) {
- if (strcmp(ptr->lang, locale) == 0) {
- *icon = (char *)ptr->text;
- if (strcasecmp(*icon, "(null)") == 0) {
- locale = DEFAULT_LOCALE;
- continue;
- } else
- break;
- } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
- *icon = (char *)ptr->text;
- break;
- }
- }
- }
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
+ retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
- if (syslocale) {
- free(syslocale);
- syslocale = NULL;
- }
- locale = save;
- if (locale) {
- free(locale);
- locale = NULL;
- }
-#else
pkgmgr_pkginfo_x *info_tmp = (pkgmgr_pkginfo_x *)handle;
pkgmgrinfo_appinfo_h apphandle;
+ bool ismainapp = 0;
+ int ret = PMINFO_R_OK;
+
+ ret = pkgmgrinfo_appinfo_get_appinfo(info_tmp->manifest_info->mainapp_id, &apphandle);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "pkgmgrinfo_appinfo_get_appinfo fail");
+
+ ret = pkgmgrinfo_appinfo_is_mainapp(apphandle, &ismainapp);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgrinfo_appinfo_is_mainapp fail");
+
+ if (ismainapp){
+ ret = pkgmgrinfo_appinfo_get_icon(apphandle, &info_tmp->tmp);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgrinfo_appinfo_get_icon fail");
+ tryvm_if(info_tmp->tmp == NULL, ret = PMINFO_R_EINVAL, "icon is NULL");
- pkgmgrinfo_appinfo_get_appinfo(info_tmp->manifest_info->mainapp_id, &apphandle);
- pkgmgrinfo_appinfo_get_icon(apphandle, &info_tmp->tmp);
- if (info_tmp->tmp_dup){
- free((void *)info_tmp->tmp_dup);
- info_tmp->tmp_dup = NULL;
+ if (info_tmp->tmp_dup){
+ free((void *)info_tmp->tmp_dup);
+ info_tmp->tmp_dup = NULL;
+ }
+
+ info_tmp->tmp_dup= strdup(info_tmp->tmp);
+ *icon = info_tmp->tmp_dup;
+ } else {
+ char *syslocale = NULL;
+ char *locale = NULL;
+ char *save = NULL;
+ icon_x *ptr = NULL;
+ syslocale = vconf_get_str(VCONFKEY_LANGSET);
+ tryvm_if(syslocale == NULL, ret = PMINFO_R_EINVAL, "current locale is NULL");
+
+ locale = __convert_system_locale_to_manifest_locale(syslocale);
+ tryvm_if(locale == NULL, ret = PMINFO_R_EINVAL, "manifest locale is NULL");
+
+ save = locale;
+ *icon = NULL;
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ for(ptr = info->manifest_info->icon; ptr != NULL; ptr = ptr->next)
+ {
+ if (ptr->lang) {
+ if (strcmp(ptr->lang, locale) == 0) {
+ *icon = (char *)ptr->text;
+ if (strcasecmp(*icon, "(null)") == 0) {
+ locale = DEFAULT_LOCALE;
+ continue;
+ } else
+ break;
+ } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
+ *icon = (char *)ptr->text;
+ break;
+ }
+ }
+ }
+
+ if (syslocale) {
+ free(syslocale);
+ syslocale = NULL;
+ }
+ locale = save;
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
}
- info_tmp->tmp_dup= strdup(info_tmp->tmp);
- *icon = info_tmp->tmp_dup;
+
+catch:
pkgmgrinfo_appinfo_destroy_appinfo(apphandle);
-#endif
- return PMINFO_R_OK;
+ return ret;
}
API int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label)
{
-#if 0
- if (handle == NULL) {
- _LOGE("pkginfo handle is NULL\n");
- return PMINFO_R_EINVAL;
- }
- if (label == NULL) {
- _LOGE("Argument supplied to hold return value is NULL\n");
- return PMINFO_R_EINVAL;
- }
- char *syslocale = NULL;
- char *locale = NULL;
- char *save = NULL;
- label_x *ptr = NULL;
- syslocale = vconf_get_str(VCONFKEY_LANGSET);
- if (syslocale == NULL) {
- _LOGE("current locale is NULL\n");
- return PMINFO_R_EINVAL;
- }
- locale = __convert_system_locale_to_manifest_locale(syslocale);
- if (locale == NULL) {
- _LOGE("manifest locale is NULL\n");
- return PMINFO_R_EINVAL;
- }
- save = locale;
- *label = NULL;
- pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
- for(ptr = info->manifest_info->label; ptr != NULL; ptr = ptr->next)
- {
- if (ptr->lang) {
- if (strcmp(ptr->lang, locale) == 0) {
- *label = (char *)ptr->text;
- if (strcasecmp(*label, "(null)") == 0) {
- locale = DEFAULT_LOCALE;
- continue;
- } else
- break;
- } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
- *label = (char *)ptr->text;
- break;
- }
- }
- }
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
+ retvm_if(label == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
- if (syslocale) {
- free(syslocale);
- syslocale = NULL;
- }
- locale = save;
- if (locale) {
- free(locale);
- locale = NULL;
- }
-#else
pkgmgr_pkginfo_x *info_tmp = (pkgmgr_pkginfo_x *)handle;
pkgmgrinfo_appinfo_h apphandle;
+ bool ismainapp = 0;
+ int ret = PMINFO_R_OK;
+
+ ret = pkgmgrinfo_appinfo_get_appinfo(info_tmp->manifest_info->mainapp_id, &apphandle);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "pkgmgrinfo_appinfo_get_appinfo fail");
+
+ ret = pkgmgrinfo_appinfo_is_mainapp(apphandle, &ismainapp);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgrinfo_appinfo_is_mainapp fail");
+
+ if (ismainapp){
+ ret = pkgmgrinfo_appinfo_get_label(apphandle, &info_tmp->tmp);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgrinfo_appinfo_get_label fail");
+ tryvm_if(info_tmp->tmp == NULL, ret = PMINFO_R_EINVAL, "label is NULL");
+
+ if (info_tmp->tmp_dup){
+ free((void *)info_tmp->tmp_dup);
+ info_tmp->tmp_dup = NULL;
+ }
+
+ info_tmp->tmp_dup = strdup(info_tmp->tmp);
+ *label = info_tmp->tmp_dup;
+ } else {
+ char *syslocale = NULL;
+ char *locale = NULL;
+ char *save = NULL;
+ label_x *ptr = NULL;
+
+ syslocale = vconf_get_str(VCONFKEY_LANGSET);
+ tryvm_if(syslocale == NULL, ret = PMINFO_R_EINVAL, "current locale is NULL");
- pkgmgrinfo_appinfo_get_appinfo(info_tmp->manifest_info->mainapp_id, &apphandle);
- pkgmgrinfo_appinfo_get_label(apphandle, &info_tmp->tmp);
- if (info_tmp->tmp_dup){
- free((void *)info_tmp->tmp_dup);
- info_tmp->tmp_dup = NULL;
+ locale = __convert_system_locale_to_manifest_locale(syslocale);
+ tryvm_if(locale == NULL, ret = PMINFO_R_EINVAL, "manifest locale is NULL");
+
+ save = locale;
+ *label = NULL;
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ for(ptr = info->manifest_info->label; ptr != NULL; ptr = ptr->next)
+ {
+ if (ptr->lang) {
+ if (strcmp(ptr->lang, locale) == 0) {
+ *label = (char *)ptr->text;
+ if (strcasecmp(*label, "(null)") == 0) {
+ locale = DEFAULT_LOCALE;
+ continue;
+ } else
+ break;
+ } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
+ *label = (char *)ptr->text;
+ break;
+ }
+ }
+ }
+
+ if (syslocale) {
+ free(syslocale);
+ syslocale = NULL;
+ }
+ locale = save;
+ if (locale) {
+ free(locale);
+ locale = NULL;
+ }
}
- info_tmp->tmp_dup = strdup(info_tmp->tmp);
- *label = info_tmp->tmp_dup;
+
+catch:
pkgmgrinfo_appinfo_destroy_appinfo(apphandle);
-#endif
- return PMINFO_R_OK;
+ return ret;
}
API int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **description)
return PMINFO_R_OK;
}
+
+API int pkgmgrinfo_pkginfo_get_root_path(pkgmgrinfo_pkginfo_h handle, char **path)
+{
+ if (handle == NULL) {
+ _LOGE("pkginfo handle is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+ if (path == NULL) {
+ _LOGE("Argument supplied to hold return value is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ if (info->manifest_info->root_path)
+ *path = info->manifest_info->root_path;
+ else
+ return PMINFO_R_ERROR;
+
+ return PMINFO_R_OK;
+}
+
+
API int pkgmgrinfo_pkginfo_compare_pkg_cert_info(const char *lhs_package_id, const char *rhs_package_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
{
if (lhs_package_id == NULL || rhs_package_id == NULL)
API int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
pkgmgrinfo_app_list_cb app_func, void *user_data)
{
- if (handle == NULL) {
- _LOGE("pkginfo handle is NULL\n");
- return PMINFO_R_EINVAL;
- }
- if (app_func == NULL) {
- _LOGE("callback pointer is NULL\n");
- return PMINFO_R_EINVAL;
- }
- if (component != PMINFO_UI_APP && component != PMINFO_SVC_APP && component != PMINFO_ALL_APP) {
- _LOGE("Invalid App Component Type\n");
- return PMINFO_R_EINVAL;
- }
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
+ retvm_if(app_func == NULL, PMINFO_R_EINVAL, "callback pointer is NULL");
+ retvm_if((component != PMINFO_UI_APP) && (component != PMINFO_SVC_APP) && (component != PMINFO_ALL_APP), PMINFO_R_EINVAL, "Invalid App Component Type");
+
char *error_message = NULL;
char *syslocale = NULL;
char *locale = NULL;
pkgmgr_appinfo_x *appinfo = NULL;
icon_x *ptr1 = NULL;
label_x *ptr2 = NULL;
+ sqlite3 *appinfo_db = NULL;
+ /*get system locale*/
syslocale = vconf_get_str(VCONFKEY_LANGSET);
- if (syslocale == NULL) {
- _LOGE("current locale is NULL\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ tryvm_if(syslocale == NULL, ret = PMINFO_R_EINVAL, "current locale is NULL");
+
+ /*get locale on db*/
locale = __convert_system_locale_to_manifest_locale(syslocale);
- if (locale == NULL) {
- _LOGE("manifest locale is NULL\n");
- ret = PMINFO_R_EINVAL;
- goto err;
- }
+ tryvm_if(locale == NULL, ret = PMINFO_R_EINVAL, "manifest locale is NULL");
+ /*calloc allinfo*/
allinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
- if (allinfo == NULL) {
- _LOGE("Failed to allocate memory for appinfo\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ tryvm_if(allinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
+
+ /*calloc manifest_info*/
allinfo->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
- if (allinfo->manifest_info == NULL) {
- _LOGE("Out of Memory!!!\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ tryvm_if(allinfo->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+ /*calloc appinfo*/
appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
- if (appinfo == NULL) {
- _LOGE("Failed to allocate memory for appinfo\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
+
+ /*set component type*/
if (component == PMINFO_UI_APP)
appinfo->app_component = PMINFO_UI_APP;
if (component == PMINFO_SVC_APP)
appinfo->app_component = PMINFO_SVC_APP;
if (component == PMINFO_ALL_APP)
appinfo->app_component = PMINFO_ALL_APP;
- ret = __open_manifest_db();
- if (ret == -1) {
- _LOGE("Fail to open manifest DB\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+
+ /*open db */
+ ret = db_util_open_with_options(MANIFEST_DB, &appinfo_db, SQLITE_OPEN_READONLY, NULL);
+ retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
appinfo->package = strdup(info->manifest_info->package);
snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
switch(component) {
case PMINFO_UI_APP:
- if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __uiapp_list_cb, (void *)info, &error_message)) {
- _LOGE("Don't execute query = %s error message = %s\n", query,
- error_message);
- sqlite3_free(error_message);
- sqlite3_close(manifest_db);
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ /*Populate ui app info */
+ ret = __exec_db_query(appinfo_db, query, __uiapp_list_cb, (void *)info);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info list retrieval failed");
+
uiapplication_x *tmp = NULL;
if (info->manifest_info->uiapplication) {
LISTHEAD(info->manifest_info->uiapplication, tmp);
while(tmp != NULL)
{
appinfo->uiapp_info = tmp;
-
if (strcmp(appinfo->uiapp_info->type,"c++app") == 0){
if (locale) {
free(locale);
}
- locale = __get_app_locale_by_fallback(appinfo->uiapp_info->appid, syslocale);
+ locale = __get_app_locale_by_fallback(appinfo_db, appinfo->uiapp_info->appid, syslocale);
}
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where" \
- " app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, locale);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Localized Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where" \
- " app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, DEFAULT_LOCALE);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Localized Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, DEFAULT_LOCALE);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ /*store setting notification icon section*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_icon_section_info where app_id='%s'", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
+
+ /*store app preview image info*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select app_image_section, app_image from package_app_image_info where app_id='%s'", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
+
if (appinfo->uiapp_info->label) {
LISTHEAD(appinfo->uiapp_info->label, ptr2);
appinfo->uiapp_info->label = ptr2;
}
break;
case PMINFO_SVC_APP:
- if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __svcapp_list_cb, (void *)info, &error_message)) {
- _LOGE("Don't execute query = %s error message = %s\n", query,
- error_message);
- sqlite3_free(error_message);
- sqlite3_close(manifest_db);
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ /*Populate svc app info */
+ ret = __exec_db_query(appinfo_db, query, __svcapp_list_cb, (void *)info);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info list retrieval failed");
+
serviceapplication_x *tmp1 = NULL;
if (info->manifest_info->serviceapplication) {
LISTHEAD(info->manifest_info->serviceapplication, tmp1);
{
appinfo->svcapp_info = tmp1;
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where" \
- " app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, locale);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Localized Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where" \
- " app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, DEFAULT_LOCALE);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Localized Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, DEFAULT_LOCALE);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
if (appinfo->svcapp_info->label) {
LISTHEAD(appinfo->svcapp_info->label, ptr2);
appinfo->svcapp_info->label = ptr2;
case PMINFO_ALL_APP:
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where package='%s'", info->manifest_info->package);
- if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __allapp_list_cb, (void *)allinfo, &error_message)) {
- _LOGE("Don't execute query = %s error message = %s\n", query,
- error_message);
- sqlite3_free(error_message);
- sqlite3_close(manifest_db);
- ret = PMINFO_R_ERROR;
- goto err;
- }
+
+ /*Populate all app info */
+ ret = __exec_db_query(appinfo_db, query, __allapp_list_cb, (void *)allinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info list retrieval failed");
/*UI Apps*/
appinfo->app_component = PMINFO_UI_APP;
{
appinfo->uiapp_info = tmp2;
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where" \
- " app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, locale);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Localized Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where" \
- " app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, DEFAULT_LOCALE);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Localized Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, DEFAULT_LOCALE);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ /*store setting notification icon section*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_icon_section_info where app_id='%s'", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
+
+ /*store app preview image info*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select app_image_section, app_image from package_app_image_info where app_id='%s'", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
+
if (appinfo->uiapp_info->label) {
LISTHEAD(appinfo->uiapp_info->label, ptr2);
appinfo->uiapp_info->label = ptr2;
{
appinfo->svcapp_info = tmp3;
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where" \
- " app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, locale);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Localized Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where" \
- " app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, DEFAULT_LOCALE);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Localized Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, DEFAULT_LOCALE);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
if (appinfo->svcapp_info->label) {
LISTHEAD(appinfo->svcapp_info->label, ptr2);
appinfo->svcapp_info->label = ptr2;
}
ret = PMINFO_R_OK;
-err:
+catch:
if (locale) {
free(locale);
locale = NULL;
}
__cleanup_pkginfo(allinfo);
- sqlite3_close(manifest_db);
+ sqlite3_close(appinfo_db);
return ret;
}
API int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data)
{
- if (app_func == NULL) {
- _LOGE("callback function is NULL\n");
- return PMINFO_R_EINVAL;
- }
+ retvm_if(app_func == NULL, PMINFO_R_EINVAL, "callback function is NULL");
+
char *error_message = NULL;
int ret = PMINFO_R_OK;
char query[MAX_QUERY_LEN] = {'\0'};
serviceapplication_x *ptr2 = NULL;
label_x *tmp1 = NULL;
icon_x *tmp2 = NULL;
+ sqlite3 *appinfo_db = NULL;
+ /*get system locale*/
syslocale = vconf_get_str(VCONFKEY_LANGSET);
- if (syslocale == NULL) {
- _LOGE("current locale is NULL\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ tryvm_if(syslocale == NULL, ret = PMINFO_R_ERROR, "current locale is NULL");
+
+ /*get locale on db*/
locale = __convert_system_locale_to_manifest_locale(syslocale);
- if (locale == NULL) {
- _LOGE("manifest locale is NULL\n");
- ret = PMINFO_R_EINVAL;
- goto err;
- }
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
- ret = __open_manifest_db();
- if (ret == -1) {
- _LOGE("Fail to open manifest DB\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ /*open db*/
+ ret = db_util_open_with_options(MANIFEST_DB, &appinfo_db, SQLITE_OPEN_READONLY, NULL);
+ retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*calloc pkginfo*/
pkgmgr_pkginfo_x *info = NULL;
info = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
- if (info == NULL) {
- _LOGE("Out of Memory!!!\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ tryvm_if(info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ /*calloc manifest_info*/
info->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
- if (info->manifest_info == NULL) {
- _LOGE("Out of Memory!!!\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ tryvm_if(info->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ /*calloc appinfo*/
appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
- if (appinfo == NULL) {
- _LOGE("Out of Memory!!!\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info");
- if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __app_list_cb, (void *)info, &error_message)) {
- _LOGE("Don't execute query = %s error message = %s\n", query,
- error_message);
- sqlite3_free(error_message);
- sqlite3_close(manifest_db);
- ret = PMINFO_R_ERROR;
- goto err;
- }
- memset(query, '\0', MAX_QUERY_LEN);
+ ret = __exec_db_query(appinfo_db, query, __app_list_cb, (void *)info);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
if (info->manifest_info->uiapplication) {
LISTHEAD(info->manifest_info->uiapplication, ptr1);
info->manifest_info->uiapplication = ptr1;
snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
"from package_app_info where " \
"app_id='%s'", ptr1->appid);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
if (strcmp(appinfo->uiapp_info->type,"c++app") == 0){
if (locale) {
free(locale);
}
- locale = __get_app_locale_by_fallback(ptr1->appid, syslocale);
+ locale = __get_app_locale_by_fallback(appinfo_db, ptr1->appid, syslocale);
}
memset(query, '\0', MAX_QUERY_LEN);
"from package_app_localized_info where " \
"app_id='%s' and app_locale='%s'",
ptr1->appid, locale);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Localized Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
"from package_app_localized_info where " \
"app_id='%s' and app_locale='%s'",
ptr1->appid, DEFAULT_LOCALE);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Localized Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ /*store setting notification icon section*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_icon_section_info where app_id='%s'", ptr1->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
+
+ /*store app preview image info*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select app_image_section, app_image from package_app_image_info where app_id='%s'", ptr1->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
+
if (appinfo->uiapp_info->label) {
LISTHEAD(appinfo->uiapp_info->label, tmp1);
appinfo->uiapp_info->label = tmp1;
appinfo->app_component = PMINFO_SVC_APP;
appinfo->package = strdup(ptr2->package);
appinfo->svcapp_info = ptr2;
+ memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
"from package_app_info where " \
"app_id='%s'", ptr2->appid);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
"from package_app_localized_info where " \
"app_id='%s' and app_locale='%s'",
ptr2->appid, locale);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Localized Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
"from package_app_localized_info where " \
"app_id='%s' and app_locale='%s'",
ptr2->appid, DEFAULT_LOCALE);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Localized Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
if (appinfo->svcapp_info->label) {
LISTHEAD(appinfo->svcapp_info->label, tmp1);
appinfo->svcapp_info->label = tmp1;
}
ret = PMINFO_R_OK;
-err:
+catch:
if (locale) {
free(locale);
locale = NULL;
free(syslocale);
syslocale = NULL;
}
- sqlite3_close(manifest_db);
+ sqlite3_close(appinfo_db);
if (appinfo) {
free(appinfo);
appinfo = NULL;
API int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
{
- if (appid == NULL) {
- _LOGE("appid is NULL\n");
- return PMINFO_R_EINVAL;
- }
- if (handle == NULL) {
- _LOGE("Argument supplied to hold return value is NULL\n");
- return PMINFO_R_EINVAL;
- }
+ retvm_if(appid == NULL, PMINFO_R_EINVAL, "appid is NULL");
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+
pkgmgr_appinfo_x *appinfo = NULL;
char *error_message = NULL;
char *syslocale = NULL;
label_x *tmp1 = NULL;
icon_x *tmp2 = NULL;
category_x *tmp3 = NULL;
+ metadata_x *tmp4 = NULL;
+ permission_x *tmp5 = NULL;
char query[MAX_QUERY_LEN] = {'\0'};
+ sqlite3 *appinfo_db = NULL;
- /*Validate appid*/
- ret = __open_manifest_db();
- if (ret == -1) {
- _LOGE("Fail to open manifest DB\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ /*open db*/
+ ret = db_util_open_with_options(MANIFEST_DB, &appinfo_db, SQLITE_OPEN_READONLY, NULL);
+ retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*check appid exist on db*/
snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_app_info where app_id='%s')", appid);
- if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __validate_cb, (void *)&exist, &error_message)) {
- _LOGE("Don't execute query = %s error message = %s\n", query,
- error_message);
- sqlite3_free(error_message);
- sqlite3_close(manifest_db);
- return PMINFO_R_ERROR;
- }
- if (exist == 0) {
- _LOGE("Appid not found in DB\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ ret = __exec_db_query(appinfo_db, query, __validate_cb, (void *)&exist);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "sqlite3_exec fail");
+ tryvm_if(exist == 0, ret = PMINFO_R_ERROR, "Appid not found in DB");
+
+ /*get system locale*/
syslocale = vconf_get_str(VCONFKEY_LANGSET);
- if (syslocale == NULL) {
- _LOGE("current locale is NULL\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ tryvm_if(syslocale == NULL, ret = PMINFO_R_ERROR, "current locale is NULL");
+
+ /*get locale on db*/
locale = __convert_system_locale_to_manifest_locale(syslocale);
- if (locale == NULL) {
- _LOGE("manifest locale is NULL\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ /*calloc appinfo*/
appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
- if (appinfo == NULL) {
- _LOGE("Failed to allocate memory for appinfo\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
/*check app_component from DB*/
+ memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select app_component, package from package_app_info where app_id='%s' ", appid);
- ret = __exec_appcomponent_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ ret = __exec_db_query(appinfo_db, query, __appcomponent_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+ /*calloc app_component*/
if (appinfo->app_component == PMINFO_UI_APP) {
appinfo->uiapp_info = (uiapplication_x *)calloc(1, sizeof(uiapplication_x));
- if (appinfo->uiapp_info == NULL) {
- _LOGE("Failed to allocate memory for uiapp info\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ tryvm_if(appinfo->uiapp_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for uiapp info");
} else {
appinfo->svcapp_info = (serviceapplication_x *)calloc(1, sizeof(serviceapplication_x));
- if (appinfo->svcapp_info == NULL) {
- _LOGE("Failed to allocate memory for svcapp info\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ tryvm_if(appinfo->svcapp_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for svcapp info");
}
/*populate app_info from DB*/
+ memset(query, '\0', MAX_QUERY_LEN);
snprintf(query, MAX_QUERY_LEN, "select * from package_app_info where app_id='%s' ", appid);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
-
- if (strcmp(appinfo->uiapp_info->type,"c++app") == 0){
- if (locale) {
- free(locale);
- }
- locale = __get_app_locale_by_fallback(appid, syslocale);
- }
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where" \
- " app_id='%s' and app_locale='%s'", appid, locale);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Localized Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
/*Also store the values corresponding to default locales*/
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where" \
- " app_id='%s' and app_locale='%s'", appid, DEFAULT_LOCALE);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Localized Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appid, DEFAULT_LOCALE);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
/*Populate app category*/
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from package_app_app_category where" \
- " app_id='%s'", appid);
- ret = __exec_appinfo_query(query, (void *)appinfo);
- if (ret == -1) {
- _LOGE("App Category Info DB Information retrieval failed\n");
- ret = PMINFO_R_ERROR;
- goto err;
- }
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_app_category where app_id='%s'", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Category Info DB Information retrieval failed");
+
+ /*Populate app metadata*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_app_metadata where app_id='%s'", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Metadata Info DB Information retrieval failed");
+
+ /*Populate app permission*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_app_permission where app_id='%s'", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App permission Info DB Information retrieval failed");
+
+ /*store setting notification icon section*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select * from package_app_icon_section_info where app_id='%s'", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
+
+ /*store app preview image info*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN, "select app_image_section, app_image from package_app_image_info where app_id='%s'", appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
+
switch (appinfo->app_component) {
case PMINFO_UI_APP:
if (appinfo->uiapp_info->label) {
LISTHEAD(appinfo->uiapp_info->category, tmp3);
appinfo->uiapp_info->category = tmp3;
}
+ if (appinfo->uiapp_info->metadata) {
+ LISTHEAD(appinfo->uiapp_info->metadata, tmp4);
+ appinfo->uiapp_info->metadata = tmp4;
+ }
+ if (appinfo->uiapp_info->permission) {
+ LISTHEAD(appinfo->uiapp_info->permission, tmp5);
+ appinfo->uiapp_info->permission = tmp5;
+ }
break;
case PMINFO_SVC_APP:
if (appinfo->svcapp_info->label) {
LISTHEAD(appinfo->svcapp_info->category, tmp3);
appinfo->svcapp_info->category = tmp3;
}
+ if (appinfo->svcapp_info->metadata) {
+ LISTHEAD(appinfo->svcapp_info->metadata, tmp4);
+ appinfo->svcapp_info->metadata = tmp4;
+ }
+ if (appinfo->svcapp_info->permission) {
+ LISTHEAD(appinfo->svcapp_info->permission, tmp5);
+ appinfo->svcapp_info->permission = tmp5;
+ }
break;
default:
break;
}
- *handle = (void*)appinfo;
- sqlite3_close(manifest_db);
- if (syslocale) {
- free(syslocale);
- syslocale = NULL;
- }
- if (locale) {
- free(locale);
- locale = NULL;
+ ret = PMINFO_R_OK;
+
+catch:
+ if (ret == PMINFO_R_OK)
+ *handle = (void*)appinfo;
+ else {
+ *handle = NULL;
+ __cleanup_appinfo(appinfo);
}
- return PMINFO_R_OK;
-err:
- *handle = NULL;
- __cleanup_appinfo(appinfo);
- sqlite3_close(manifest_db);
+
+ sqlite3_close(appinfo_db);
if (syslocale) {
free(syslocale);
syslocale = NULL;
API int pkgmgrinfo_appinfo_get_setting_icon(pkgmgrinfo_appinfo_h handle, char **icon)
{
- if (handle == NULL) {
- _LOGE("appinfo handle is NULL\n");
- return PMINFO_R_EINVAL;
- }
- if (icon == NULL) {
- _LOGE("Argument supplied to hold return value is NULL\n");
- return PMINFO_R_EINVAL;
- }
- int ret = -1;
- char *error_message = NULL;
- char query[MAX_QUERY_LEN] = {'\0'};
- char path_buf[PKG_STRING_LEN_MAX] = {'\0'};
- pkgmgr_iconpath_x *data = NULL;
- char *icon_path;
- char *readpath;
- char *appid;
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
- ret = __open_manifest_db();
- if (ret == -1) {
- _LOGE("Fail to open manifest DB\n");
- return PMINFO_R_ERROR;
- }
-
- ret = pkgmgrinfo_appinfo_get_appid(handle,&appid);
- if(ret < 0 || appid == NULL)
- return PMINFO_R_ERROR;
-
- data = (pkgmgr_iconpath_x *)calloc(1, sizeof(pkgmgr_iconpath_x));
- if (data == NULL) {
- _LOGE("Failed to allocate memory for pkgmgr_datacontrol_x\n");
- sqlite3_close(manifest_db);
- return PMINFO_R_ERROR;
- }
+ char *val = NULL;
+ icon_x *ptr = NULL;
+ icon_x *start = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
- snprintf(query, MAX_QUERY_LEN, "select app_icon from package_app_icon_localized_info where app_id='%s' and app_icon_section ='setting'", appid);
- if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __icon_name_cb, (void *)data, &error_message)) {
- _LOGE("Don't execute query = %s error message = %s\n", query,
- error_message);
- free(data);
- sqlite3_free(error_message);
- sqlite3_close(manifest_db);
- return PMINFO_R_ERROR;
- }
- icon_path = __get_icon_with_path(data->iconpath);
- *icon = (char *)icon_path;
+ start = info->uiapp_info->icon;
- if (data) {
- free(data);
- data = NULL;
+ for(ptr = start; ptr != NULL; ptr = ptr->next)
+ {
+ if (ptr->section) {
+ val = (char *)ptr->section;
+ if (strcmp(val, "setting") == 0){
+ *icon = (char *)ptr->text;
+ break;
+ }
+ }
}
- sqlite3_close(manifest_db);
return PMINFO_R_OK;
}
API int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, char **icon)
{
- if (handle == NULL) {
- _LOGE("appinfo handle is NULL\n");
- return PMINFO_R_EINVAL;
- }
- if (icon == NULL) {
- _LOGE("Argument supplied to hold return value is NULL\n");
- return PMINFO_R_EINVAL;
- }
- int ret = -1;
- char *error_message = NULL;
- char query[MAX_QUERY_LEN] = {'\0'};
- char path_buf[PKG_STRING_LEN_MAX] = {'\0'};
- pkgmgr_iconpath_x *data = NULL;
- char *icon_path;
- char *readpath;
- char *appid;
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
- ret = __open_manifest_db();
- if (ret == -1) {
- _LOGE("Fail to open manifest DB\n");
- return PMINFO_R_ERROR;
- }
-
- ret = pkgmgrinfo_appinfo_get_appid(handle,&appid);
- if(ret < 0 || appid == NULL)
- return PMINFO_R_ERROR;
-
- data = (pkgmgr_iconpath_x *)calloc(1, sizeof(pkgmgr_iconpath_x));
- if (data == NULL) {
- _LOGE("Failed to allocate memory for pkgmgr_datacontrol_x\n");
- sqlite3_close(manifest_db);
- return PMINFO_R_ERROR;
- }
+ char *val = NULL;
+ icon_x *ptr = NULL;
+ icon_x *start = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
- snprintf(query, MAX_QUERY_LEN, "select app_icon from package_app_icon_localized_info where app_id='%s' and app_icon_section ='notification'", appid);
- if (SQLITE_OK !=
- sqlite3_exec(manifest_db, query, __icon_name_cb, (void *)data, &error_message)) {
- _LOGE("Don't execute query = %s error message = %s\n", query,
- error_message);
- free(data);
- sqlite3_free(error_message);
- sqlite3_close(manifest_db);
- return PMINFO_R_ERROR;
- }
- icon_path = __get_icon_with_path(data->iconpath);
- *icon = (char *)icon_path;
+ start = info->uiapp_info->icon;
- if (data) {
- free(data);
- data = NULL;
+ for(ptr = start; ptr != NULL; ptr = ptr->next)
+ {
+ if (ptr->section) {
+ val = (char *)ptr->section;
+
+ if (strcmp(val, "notification") == 0){
+ *icon = (char *)ptr->text;
+ break;
+ }
+ }
}
- sqlite3_close(manifest_db);
+
return PMINFO_R_OK;
}
return PMINFO_R_OK;
}
+API int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h handle, char **preview_img)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(preview_img == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ char *val = NULL;
+ image_x *ptr = NULL;
+ image_x *start = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ start = info->uiapp_info->image;
+
+ for(ptr = start; ptr != NULL; ptr = ptr->next)
+ {
+ if (ptr->section) {
+ val = (char *)ptr->section;
+
+ if (strcmp(val, "preview") == 0)
+ *preview_img = (char *)info->uiapp_info->image->text;
+
+ break;
+ }
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(permission == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ char *val = NULL;
+ permission_x *ptr = NULL;
+ permission_x *start = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ if (info->app_component == PMINFO_UI_APP)
+ start = info->uiapp_info->permission;
+ else if (info->app_component == PMINFO_SVC_APP)
+ start = info->svcapp_info->permission;
+ else
+ return PMINFO_R_EINVAL;
+
+ for(ptr = start; ptr != NULL; ptr = ptr->next)
+ {
+ if (ptr->type) {
+ val = (char *)ptr->type;
+
+ if (strcmp(val, "signature") == 0)
+ *permission = PMINFO_PERMISSION_SIGNATURE;
+ else if (strcmp(val, "privilege") == 0)
+ *permission = PMINFO_PERMISSION_PRIVILEGE;
+ else
+ *permission = PMINFO_PERMISSION_NORMAL;
+
+ break;
+ }
+ }
+ return PMINFO_R_OK;
+}
+
API int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
pkgmgrinfo_app_category_list_cb category_func, void *user_data)
{
return PMINFO_R_OK;
}
+API int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
+ pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data)
+{
+ if (handle == NULL) {
+ _LOGE("appinfo handle is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+ if (metadata_func == NULL) {
+ _LOGE("Callback function is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+ int ret = -1;
+ metadata_x *ptr = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ if (info->app_component == PMINFO_UI_APP)
+ ptr = info->uiapp_info->metadata;
+ else if (info->app_component == PMINFO_SVC_APP)
+ ptr = info->svcapp_info->metadata;
+ else
+ return PMINFO_R_EINVAL;
+ for (; ptr; ptr = ptr->next) {
+ ret = metadata_func(ptr->name, ptr->value, user_data);
+ if (ret < 0)
+ break;
+ }
+ return PMINFO_R_OK;
+}
+
API int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data)
{
return PMINFO_R_OK;
}
+API int pkgmgrinfo_appinfo_is_indicator_display_allowed(pkgmgrinfo_appinfo_h handle, bool *indicator_disp)
+{
+ if (handle == NULL) {
+ _LOGE("appinfo handle is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+ if (indicator_disp == NULL) {
+ _LOGE("Argument supplied to hold return value is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ val = (char *)info->uiapp_info->indicatordisplay;
+ if (val) {
+ if (strcasecmp(val, "true") == 0){
+ *indicator_disp = 1;
+ }else if (strcasecmp(val, "false") == 0){
+ *indicator_disp = 0;
+ }else{
+ *indicator_disp = 0;
+ }
+ }
+ return PMINFO_R_OK;
+}
+
+
+API int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h handle, char **portrait_img, char **landscape_img)
+{
+ if (handle == NULL) {
+ _LOGE("appinfo handle is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+ if (portrait_img == NULL) {
+ _LOGE("Argument supplied to hold return value is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+ if (landscape_img == NULL) {
+ _LOGE("Argument supplied to hold return value is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ if (info->app_component == PMINFO_UI_APP){
+ *portrait_img = (char *)info->uiapp_info->portraitimg;
+ *landscape_img = (char *)info->uiapp_info->landscapeimg;
+ }
+
+ return PMINFO_R_OK;
+}
+
API int pkgmgrinfo_appinfo_is_taskmanage(pkgmgrinfo_appinfo_h handle, bool *taskmanage)
{
if (handle == NULL) {
return PMINFO_R_OK;
}
+API int pkgmgrinfo_appinfo_is_enabled(pkgmgrinfo_appinfo_h handle, bool *enabled)
+{
+ if (handle == NULL) {
+ _LOGE("appinfo handle is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+ if (enabled == NULL) {
+ _LOGE("Argument supplied to hold return value is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ if (info->app_component == PMINFO_UI_APP)
+ val = (char *)info->uiapp_info->enabled;
+ else if (info->app_component == PMINFO_SVC_APP)
+ val = (char *)info->uiapp_info->enabled;
+ else {
+ _LOGE("invalid component type\n");
+ return PMINFO_R_EINVAL;
+ }
+
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *enabled = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *enabled = 0;
+ else
+ *enabled = 1;
+ }
+ return PMINFO_R_OK;
+
+}
+
API int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_hwacceleration *hwacceleration)
{
if (handle == NULL) {
}
manifest_x *mfx = (manifest_x *)handle;
if (mfx->installlocation == NULL) {
- mfx->installlocation = (char *)calloc(1, strlen("prefer-external"));
+ mfx->installlocation = (char *)calloc(1, strlen("prefer-external") + 1);
if (mfx->installlocation == NULL) {
_LOGE("Malloc Failed\n");
return PMINFO_R_ERROR;
}
manifest_x *mfx = (manifest_x *)handle;
if (mfx->removable == NULL) {
- mfx->removable = (char *)calloc(1, strlen("false"));
+ mfx->removable = (char *)calloc(1, strlen("false") + 1);
if (mfx->removable == NULL) {
_LOGE("Malloc Failed\n");
return PMINFO_R_ERROR;
}
manifest_x *mfx = (manifest_x *)handle;
if (mfx->preload == NULL) {
- mfx->preload = (char *)calloc(1, strlen("false"));
+ mfx->preload = (char *)calloc(1, strlen("false") + 1);
if (mfx->preload == NULL) {
_LOGE("Malloc Failed\n");
return PMINFO_R_ERROR;
return PMINFO_R_OK;
}
+API int pkgmgrinfo_pkginfo_set_state_enabled(const char *pkgid, bool enabled)
+{
+ /* Should be implemented later */
+ return 0;
+}
+
+API int pkgmgrinfo_appinfo_set_state_enabled(const char *appid, bool enabled)
+{
+ if (appid == NULL) {
+ _LOGE("appid is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ ret = __open_manifest_db();
+
+ if (access(MANIFEST_DB, F_OK) == 0) {
+ ret = db_util_open(MANIFEST_DB, &manifest_db,
+ DB_UTIL_REGISTER_HOOK_METHOD);
+ if (ret != SQLITE_OK) {
+ _LOGE("connect db [%s] failed! Manifest DB does not exists!!\n", MANIFEST_DB);
+ return PMINFO_R_ERROR;
+ }
+ }
+
+ /*Begin transaction*/
+ ret = sqlite3_exec(manifest_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to begin transaction\n");
+ sqlite3_close(manifest_db);
+ return PMINFO_R_ERROR;
+ }
+ _LOGD("Transaction Begin\n");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN,
+ "update package_app_info set app_enabled='%s' where app_id='%s'", enabled?"true":"false", appid);
+
+ char *error_message = NULL;
+ if (SQLITE_OK !=
+ sqlite3_exec(manifest_db, query, NULL, NULL, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ sqlite3_free(error_message);
+ return PMINFO_R_ERROR;
+ }
+ sqlite3_free(error_message);
+
+ /*Commit transaction*/
+ ret = sqlite3_exec(manifest_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to commit transaction. Rollback now\n");
+ sqlite3_exec(manifest_db, "ROLLBACK", NULL, NULL, NULL);
+ sqlite3_close(manifest_db);
+ return PMINFO_R_ERROR;
+ }
+ _LOGD("Transaction Commit and End\n");
+ sqlite3_close(manifest_db);
+
+ return PMINFO_R_OK;
+}
+
+
API int pkgmgrinfo_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access)
{
if (providerid == NULL) {
return PMINFO_R_OK;
}
+
+API int pkgmgrinfo_appinfo_set_default_label(const char *appid, const char *label)
+{
+ if (appid == NULL) {
+ _LOGE("appid is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char *error_message = NULL;
+ ret = __open_manifest_db();
+
+ if (access(MANIFEST_DB, F_OK) == 0) {
+ ret = db_util_open(MANIFEST_DB, &manifest_db,
+ DB_UTIL_REGISTER_HOOK_METHOD);
+ if (ret != SQLITE_OK) {
+ _LOGE("connect db [%s] failed! Manifest DB does not exists!!\n", MANIFEST_DB);
+ return PMINFO_R_ERROR;
+ }
+ }
+
+ /*Begin transaction*/
+ ret = sqlite3_exec(manifest_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to begin transaction\n");
+ sqlite3_close(manifest_db);
+ return PMINFO_R_ERROR;
+ }
+ _LOGD("Transaction Begin\n");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ snprintf(query, MAX_QUERY_LEN,
+ "update package_app_localized_info set app_label='%s' where app_id='%s' and app_locale='No Locale'", label, appid);
+
+ if (SQLITE_OK !=
+ sqlite3_exec(manifest_db, query, NULL, NULL, &error_message)) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ sqlite3_free(error_message);
+ return PMINFO_R_ERROR;
+ }
+
+ /*Commit transaction*/
+ ret = sqlite3_exec(manifest_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to commit transaction. Rollback now\n");
+ sqlite3_exec(manifest_db, "ROLLBACK", NULL, NULL, NULL);
+ sqlite3_close(manifest_db);
+ return PMINFO_R_ERROR;
+ }
+ _LOGD("Transaction Commit and End\n");
+ sqlite3_close(manifest_db);
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_is_guestmode_visibility(pkgmgrinfo_appinfo_h handle, bool *status)
+{
+ if (handle == NULL) {
+ _LOGE("appinfo handle is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+ if (status == NULL) {
+ _LOGE("Argument supplied to hold return value is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ val = (char *)info->uiapp_info->guestmode_visibility;
+ if (val) {
+ if (strcasecmp(val, "true") == 0){
+ *status = 1;
+ }else if (strcasecmp(val, "false") == 0){
+ *status = 0;
+ }else{
+ *status = 1;
+ }
+ }
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_set_guestmode_visibility(pkgmgrinfo_appinfo_h handle, bool status)
+{
+ if (handle == NULL) {
+ _LOGE("appinfo handle is NULL\n");
+ return PMINFO_R_EINVAL;
+ }
+ char *val = NULL;
+ int ret = 0;
+ char *noti_string = NULL;
+ int len = 0;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char *errmsg = NULL;
+ sqlite3 *pkgmgr_parser_db;
+
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ val = (char *)info->uiapp_info->guestmode_visibility;
+ if (val ) {
+ ret =
+ db_util_open_with_options(MANIFEST_DB, &pkgmgr_parser_db,
+ SQLITE_OPEN_READWRITE, NULL);
+
+ if (ret != SQLITE_OK) {
+ _LOGE("DB Open Failed\n");
+ return PMINFO_R_ERROR;
+ }
+
+ /*TODO: Write to DB here*/
+ if (status == true)
+ snprintf(query, MAX_QUERY_LEN, "update package_app_info set app_guestmodevisibility = 'true' where app_id = '%s'", (char *)info->uiapp_info->appid);
+ else
+ snprintf(query, MAX_QUERY_LEN, "update package_app_info set app_guestmodevisibility = 'false' where app_id = '%s'", (char *)info->uiapp_info->appid);
+
+ if (SQLITE_OK != sqlite3_exec(pkgmgr_parser_db, query, NULL, NULL, &errmsg)) {
+ _LOGE("DB update [%s] failed, error message = %s\n", query, errmsg);
+ free(errmsg);
+ sqlite3_close(pkgmgr_parser_db);
+ return PMINFO_R_ERROR;
+ }else{
+ sqlite3_close(pkgmgr_parser_db);
+ len = strlen((char *)info->uiapp_info->appid) + 8;
+ noti_string = calloc(1, len);
+ if (noti_string == NULL){
+ return PMINFO_R_ERROR;
+ }
+ snprintf(noti_string, len, "update:%s", (char *)info->uiapp_info->appid);
+ vconf_set_str(VCONFKEY_AIL_INFO_STATE, noti_string);
+ vconf_set_str(VCONFKEY_MENUSCREEN_DESKTOP, noti_string); // duplicate, will be removed
+ free(noti_string);
+ }
+ }
+ return PMINFO_R_OK;
+}