From b88ebe006b900e9c73f6112341ad2c904a224580 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 9 May 2016 16:19:46 +0900 Subject: [PATCH] Add color-depth field for package_app_splash_screen table - Modify pkgmgrinfo_appinfo_foreach_splash_screen API Change-Id: Ief85a8e3748ee5f93eea386db1415fdcd71b8db0 Signed-off-by: Hwankyu Jhun --- include/pkgmgrinfo_basic.h | 1 + include/pkgmgrinfo_type.h | 10 ++++++---- parser/manifest.xsd.in | 1 + parser/manifest.xsd.ref | 1 + parser/pkgmgr_parser.c | 1 + parser/pkgmgr_parser_db.c | 38 +++++++++++++++++++++++--------------- src/pkgmgrinfo_appinfo.c | 6 +++++- src/pkgmgrinfo_basic.c | 2 ++ 8 files changed, 40 insertions(+), 20 deletions(-) diff --git a/include/pkgmgrinfo_basic.h b/include/pkgmgrinfo_basic.h index 2cd11a5..e006b12 100644 --- a/include/pkgmgrinfo_basic.h +++ b/include/pkgmgrinfo_basic.h @@ -97,6 +97,7 @@ typedef struct splashscreen_x { char *orientation; char *indicatordisplay; char *operation; + char *color_depth; } splashscreen_x; typedef struct application_x { diff --git a/include/pkgmgrinfo_type.h b/include/pkgmgrinfo_type.h index 1e1591c..b912568 100644 --- a/include/pkgmgrinfo_type.h +++ b/include/pkgmgrinfo_type.h @@ -289,9 +289,10 @@ typedef int (*pkgmgrinfo_app_control_list_cb ) (const char *operation, const cha typedef int (*pkgmgrinfo_app_background_category_list_cb ) (const char *category_name, void *user_data); /** - * @fn int (*pkgmgrinfo_app_splash_screen_list_cb) (const char *src, + * @fn int (*pkgmgrinfo_app_splash_screen_list_cb)(const char *src, * const char *type, const char *orientation, - * const char *indicatordisplay, void *user_data); + * const char *indicatordisplay, const char *color_depth, + * void *user_data); * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_splash_screen() * * @param[in] src the source of the splashscreen @@ -299,16 +300,17 @@ typedef int (*pkgmgrinfo_app_background_category_list_cb ) (const char *category * @param[in] orientation the orientation of the splashscreen * @param[in] indicatordisplay the indicator-display of the splashscreen * @param[in] operation the app-control operation of the splashscreen + * @param[in] color_depth the color-depth of the splashscreen * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_splash_screen() * * @return 0 if success, negative value(<0) if fail, Callback is not called if return value is negative.\n * * @see pkgmgrinfo_appinfo_foreach_splash_screen() */ -typedef int (*pkgmgrinfo_app_splash_screen_list_cb) (const char *src, +typedef int (*pkgmgrinfo_app_splash_screen_list_cb)(const char *src, const char *type, const char *orientation, const char *indicatordisplay, const char *operation, - void *user_data); + const char *color_depth, void *user_data); typedef int (*pkgmgrinfo_handler)(uid_t target_uid, int req_id, const char *pkg_type, const char *pkgid, const char *key, diff --git a/parser/manifest.xsd.in b/parser/manifest.xsd.in index 3150bbd..4df10a5 100644 --- a/parser/manifest.xsd.in +++ b/parser/manifest.xsd.in @@ -361,6 +361,7 @@ + diff --git a/parser/manifest.xsd.ref b/parser/manifest.xsd.ref index 1341b5e..21370bd 100644 --- a/parser/manifest.xsd.ref +++ b/parser/manifest.xsd.ref @@ -414,6 +414,7 @@ + diff --git a/parser/pkgmgr_parser.c b/parser/pkgmgr_parser.c index 885ae8e..75ad043 100644 --- a/parser/pkgmgr_parser.c +++ b/parser/pkgmgr_parser.c @@ -1549,6 +1549,7 @@ static int __ps_process_splashscreen(xmlTextReaderPtr reader, splashscreen_x *sp __save_xml_attribute(reader, "orientation", &splashscreen->orientation, NULL); __save_xml_attribute(reader, "indicator-display", &splashscreen->indicatordisplay, NULL); __save_xml_attribute(reader, "app-control-operation", &splashscreen->operation, NULL); + __save_xml_attribute(reader, "color-depth", &splashscreen->color_depth, NULL); return 0; } diff --git a/parser/pkgmgr_parser_db.c b/parser/pkgmgr_parser_db.c index 16f701b..f0b9dee 100644 --- a/parser/pkgmgr_parser_db.c +++ b/parser/pkgmgr_parser_db.c @@ -349,6 +349,7 @@ sqlite3 *pkgmgr_cert_db; "orientation text not null, " \ "indicatordisplay text, " \ "operation text, " \ + "color_depth text not null DEFAULT '24', " \ "PRIMARY KEY(app_id, orientation, operation) " \ "FOREIGN KEY(app_id) " \ "REFERENCES package_app_info(app_id) " \ @@ -1650,10 +1651,11 @@ static int __insert_application_splashscreen_info(manifest_x *mfx) ss = (splashscreen_x *)tmp->data; snprintf(query, sizeof(query), "insert into package_app_splash_screen" \ - "(app_id, src, type, orientation, indicatordisplay, operation) " \ - "values('%s', '%s', '%s', '%s', '%s', '%s')", + "(app_id, src, type, orientation, indicatordisplay, operation, color_depth) " \ + "values('%s', '%s', '%s', '%s', '%s', '%s', '%s')", app->appid, ss->src, ss->type, ss->orientation, - ss->indicatordisplay, __get_str(ss->operation)); + ss->indicatordisplay, __get_str(ss->operation), + ss->color_depth); ret = __exec_query(query); if (ret == -1) { _LOGD("Package UiApp Splash Screen DB Insert Failed"); @@ -1677,6 +1679,7 @@ static int __insert_application_legacy_splashscreen_info(manifest_x *mfx) const char *indicatordisplay; const char *orientation; const char *operation = NULL; + const char *color_depth = "24"; /* default */ for (app_tmp = mfx->application; app_tmp; app_tmp = app_tmp->next) { app = (application_x *)app_tmp->data; @@ -1696,10 +1699,11 @@ static int __insert_application_legacy_splashscreen_info(manifest_x *mfx) orientation = "portrait"; snprintf(query, sizeof(query), "insert into package_app_splash_screen" \ - "(app_id, src, type, orientation, indicatordisplay, operation) " \ - "values('%s', '%s', '%s', '%s', '%s', '%s')", + "(app_id, src, type, orientation, indicatordisplay, operation, color_depth) " \ + "values('%s', '%s', '%s', '%s', '%s', '%s', '%s')", app->appid, app->portraitimg, image_type, - orientation, indicatordisplay, __get_str(operation)); + orientation, indicatordisplay, __get_str(operation), + color_depth); ret = __exec_query(query); if (ret == -1) { _LOGD("Package UiApp Splash Screen DB Insert Failed"); @@ -1711,10 +1715,11 @@ static int __insert_application_legacy_splashscreen_info(manifest_x *mfx) orientation = "landscape"; snprintf(query, sizeof(query), "insert into package_app_splash_screen" \ - "(app_id, src, type, orientation, indicatordisplay, operation) " \ - "values('%s', '%s', '%s', '%s', '%s', '%s')", + "(app_id, src, type, orientation, indicatordisplay, operation, color_depth) " \ + "values('%s', '%s', '%s', '%s', '%s', '%s', '%s')", app->appid, app->landscapeimg, image_type, - orientation, indicatordisplay, __get_str(operation)); + orientation, indicatordisplay, __get_str(operation), + color_depth); ret = __exec_query(query); if (ret == -1) { _LOGD("Package UiApp Splash Screen DB Insert Failed"); @@ -1742,6 +1747,7 @@ static int __insert_application_metadata_splashscreen_info(manifest_x *mfx) 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; @@ -1800,10 +1806,11 @@ static int __insert_application_metadata_splashscreen_info(manifest_x *mfx) image_type = "edj"; snprintf(query, sizeof(query), "insert into package_app_splash_screen" \ - "(app_id, src, type, orientation, indicatordisplay, operation) " \ - "values('%s', '%s', '%s', '%s', '%s', '%s')", + "(app_id, src, type, orientation, indicatordisplay, operation, color_depth) " \ + "values('%s', '%s', '%s', '%s', '%s', '%s', '%s')", app->appid, portraitimg, image_type, - orientation, indicatordisplay, __get_str(operation)); + orientation, indicatordisplay, __get_str(operation), + color_depth); ret = __exec_query(query); if (ret == -1) { _LOGD("Package UiApp Splash Screen DB Insert Failed"); @@ -1818,10 +1825,11 @@ static int __insert_application_metadata_splashscreen_info(manifest_x *mfx) image_type = "edj"; snprintf(query, sizeof(query), "insert into package_app_splash_screen" \ - "(app_id, src, type, orientation, indicatordisplay, operation) " \ - "values('%s', '%s', '%s', '%s', '%s', '%s')", + "(app_id, src, type, orientation, indicatordisplay, operation, color_depth) " \ + "values('%s', '%s', '%s', '%s', '%s', '%s', '%s')", app->appid, landscapeimg, image_type, - orientation, indicatordisplay, __get_str(operation)); + orientation, indicatordisplay, __get_str(operation), + color_depth); ret = __exec_query(query); if (ret == -1) { _LOGD("Package UiApp Splash Screen DB Insert Failed"); diff --git a/src/pkgmgrinfo_appinfo.c b/src/pkgmgrinfo_appinfo.c index 1c6c2c2..3a713f3 100644 --- a/src/pkgmgrinfo_appinfo.c +++ b/src/pkgmgrinfo_appinfo.c @@ -497,7 +497,7 @@ static int _appinfo_get_splashscreens(sqlite3 *db, const char *appid, GList **splashscreens) { static const char query_raw[] = - "SELECT src, type, orientation, indicatordisplay, operation " + "SELECT src, type, orientation, indicatordisplay, operation, color_depth " "FROM package_app_splash_screen WHERE app_id=%Q"; int ret; char *query; @@ -531,6 +531,7 @@ static int _appinfo_get_splashscreens(sqlite3 *db, const char *appid, _save_column_str(stmt, idx++, &info->orientation); _save_column_str(stmt, idx++, &info->indicatordisplay); _save_column_str(stmt, idx++, &info->operation); + _save_column_str(stmt, idx++, &info->color_depth); *splashscreens = g_list_append(*splashscreens, info); } @@ -1140,6 +1141,8 @@ static gpointer __copy_splashscreens(gconstpointer src, gpointer data) splashscreen->indicatordisplay = strdup(tmp->indicatordisplay); if (tmp->operation) splashscreen->operation = strdup(tmp->operation); + if (tmp->color_depth) + splashscreen->color_depth = strdup(tmp->color_depth); return splashscreen; } @@ -2449,6 +2452,7 @@ API int pkgmgrinfo_appinfo_foreach_splash_screen(pkgmgrinfo_appinfo_h handle, splashscreen->orientation, splashscreen->indicatordisplay, splashscreen->operation, + splashscreen->color_depth, user_data); if (ret < 0) break; diff --git a/src/pkgmgrinfo_basic.c b/src/pkgmgrinfo_basic.c index 5d03253..54d8ec0 100644 --- a/src/pkgmgrinfo_basic.c +++ b/src/pkgmgrinfo_basic.c @@ -216,6 +216,8 @@ static void __ps_free_splashscreen(gpointer data) free((void *)splashscreen->indicatordisplay); if (splashscreen->operation) free((void *)splashscreen->operation); + if (splashscreen->color_depth) + free((void *)splashscreen->color_depth); free((void *)splashscreen); } -- 2.7.4