return 0;
}
-static int __insert_application_legacy_splashscreen_info(manifest_x *mfx)
-{
- GList *app_tmp;
- application_x *app;
- int ret = -1;
- char query[MAX_QUERY_LEN] = {'\0'};
- char *tmp;
- const char *image_type;
- const char *indicatordisplay;
- const char *orientation;
- const char *operation = "launch-effect";
- const char *color_depth = "24"; /* default */
-
- for (app_tmp = mfx->application; app_tmp; app_tmp = app_tmp->next) {
- app = (application_x *)app_tmp->data;
- if (app == NULL ||
- (app->portraitimg == NULL && app->landscapeimg == NULL))
- continue;
- image_type = "img"; /* default */
- if (app->effectimage_type) {
- tmp = strstr(app->effectimage_type, "edj");
- if (tmp)
- image_type = "edj";
- }
- indicatordisplay = "true"; /* default */
- if (app->indicatordisplay)
- indicatordisplay = app->indicatordisplay;
- if (app->portraitimg) {
- orientation = "portrait";
- sqlite3_snprintf(MAX_QUERY_LEN, query,
- "INSERT INTO package_app_splash_screen" \
- "(app_id, src, type, orientation, indicatordisplay, operation, color_depth) " \
- "VALUES(%Q, %Q, %Q, %Q, %Q, %Q, %Q)",
- app->appid, app->portraitimg, image_type,
- orientation, indicatordisplay, operation,
- color_depth);
- ret = __exec_query(query);
- if (ret == -1) {
- _LOGD("Package UiApp Splash Screen DB Insert Failed");
- return -1;
- }
- memset(query, '\0', MAX_QUERY_LEN);
- }
- if (app->landscapeimg) {
- orientation = "landscape";
- sqlite3_snprintf(MAX_QUERY_LEN, query,
- "INSERT INTO package_app_splash_screen" \
- "(app_id, src, type, orientation, indicatordisplay, operation, color_depth) " \
- "VALUES(%Q, %Q, %Q, %Q, %Q, %Q, %Q)",
- app->appid, app->landscapeimg, image_type,
- orientation, indicatordisplay, operation,
- color_depth);
- ret = __exec_query(query);
- if (ret == -1) {
- _LOGD("Package UiApp Splash Screen DB Insert Failed");
- return -1;
- }
- memset(query, '\0', MAX_QUERY_LEN);
- }
- }
- return 0;
-}
-
-static int __insert_application_metadata_splashscreen_info(manifest_x *mfx)
-{
- GList *app_tmp;
- application_x *app;
- GList *md_tmp;
- metadata_x *md;
- int ret;
- char query[MAX_QUERY_LEN] = {'\0'};
- char *token;
- char *tmpptr = NULL;
- const char *operation;
- const char *portraitimg;
- const char *landscapeimg;
- const char *indicatordisplay;
- const char *orientation;
- const char *image_type;
- const char *color_depth = "24"; /* default */
-
- for (app_tmp = mfx->application; app_tmp; app_tmp = app_tmp->next) {
- app = (application_x *)app_tmp->data;
- if (app == NULL)
- continue;
-
- for (md_tmp = app->metadata; md_tmp; md_tmp = md_tmp->next) {
- md = (metadata_x *)md_tmp->data;
- if (md == NULL || md->key == NULL || md->value == NULL)
- continue;
-
- if (strcasestr(md->key, "operation_effect=")) {
- operation = index(md->key, '=');
- if (operation && operation[1] != '\0')
- operation++;
- else
- operation = "launch-effect";
- } else if (strcasestr(md->key, "launch_effect")) {
- operation = "launch-effect";
- } else {
- continue;
- }
-
- portraitimg = NULL;
- landscapeimg = NULL;
- indicatordisplay = "true"; /* default */
- token = strtok_r(md->value, "|", &tmpptr);
- while (token != NULL) {
- if (strcasestr(token, "portrait-effectimage=")) {
- portraitimg = index(token, '=');
- if (portraitimg && portraitimg[1] != '\0')
- portraitimg++;
- else
- portraitimg = NULL;
- } else if (strcasestr(token, "landscape-effectimage=")) {
- landscapeimg = index(token, '=');
- if (landscapeimg && landscapeimg[1] != '\0')
- landscapeimg++;
- else
- landscapeimg = NULL;
- } else if (strcasestr(token, "indicatordisplay=")) {
- indicatordisplay = index(token, '=');
- if (indicatordisplay && indicatordisplay[1] != '\0')
- indicatordisplay++;
- else
- indicatordisplay = "true";
- }
-
- token = strtok_r(NULL, "|", &tmpptr);
- }
-
- if (portraitimg) {
- orientation = "portrait";
- image_type = "img";
- if (strcasestr(portraitimg, "edj"))
- image_type = "edj";
- sqlite3_snprintf(MAX_QUERY_LEN, query,
- "INSERT INTO package_app_splash_screen" \
- "(app_id, src, type, orientation, indicatordisplay, operation, color_depth) " \
- "VALUES(%Q, %Q, %Q, %Q, %Q, %Q, %Q)",
- app->appid, portraitimg, image_type,
- orientation, indicatordisplay, operation,
- color_depth);
- ret = __exec_query(query);
- if (ret == -1) {
- _LOGD("Package UiApp Splash Screen DB Insert Failed");
- return -1;
- }
- memset(query, '\0', MAX_QUERY_LEN);
- }
- if (landscapeimg) {
- orientation = "landscape";
- image_type = "img";
- if (strcasestr(landscapeimg, "edj"))
- image_type = "edj";
- sqlite3_snprintf(MAX_QUERY_LEN, query,
- "INSERT INTO package_app_splash_screen" \
- "(app_id, src, type, orientation, indicatordisplay, operation, color_depth) " \
- "VALUES(%Q, %Q, %Q, %Q, %Q, %Q, %Q)",
- app->appid, landscapeimg, image_type,
- orientation, indicatordisplay, operation,
- color_depth);
- ret = __exec_query(query);
- if (ret == -1) {
- _LOGD("Package UiApp Splash Screen DB Insert Failed");
- return -1;
- }
- memset(query, '\0', MAX_QUERY_LEN);
- }
- }
- }
-
- return 0;
-}
-
static int __insert_manifest_info_in_db(manifest_x *mfx, uid_t uid)
{
GList *tmp;
if (ret == -1)
return -1;
- /*Insert in the package_app_splash_screen DB (backward compatibility)*/
- ret = __insert_application_legacy_splashscreen_info(mfx);
- if (ret == -1)
- return -1;
-
- /*Insert in the package_app_splash_screen DB (backward compatibility)*/
- ret = __insert_application_metadata_splashscreen_info(mfx);
- if (ret == -1)
- return -1;
-
/*Insert in the package_app_splash_screen DB*/
ret = __insert_application_splashscreen_info(mfx);
if (ret == -1)