Add color-depth field for package_app_splash_screen table 56/68656/3 accepted/tizen/common/20160511.141657 accepted/tizen/ivi/20160512.045932 accepted/tizen/mobile/20160512.045718 accepted/tizen/tv/20160512.045810 accepted/tizen/wearable/20160512.045748 submit/tizen/20160510.044059
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 9 May 2016 07:19:46 +0000 (16:19 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 10 May 2016 00:36:04 +0000 (09:36 +0900)
- Modify pkgmgrinfo_appinfo_foreach_splash_screen API

Change-Id: Ief85a8e3748ee5f93eea386db1415fdcd71b8db0
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
include/pkgmgrinfo_basic.h
include/pkgmgrinfo_type.h
parser/manifest.xsd.in
parser/manifest.xsd.ref
parser/pkgmgr_parser.c
parser/pkgmgr_parser_db.c
src/pkgmgrinfo_appinfo.c
src/pkgmgrinfo_basic.c

index 2cd11a5..e006b12 100644 (file)
@@ -97,6 +97,7 @@ typedef struct splashscreen_x {
        char *orientation;
        char *indicatordisplay;
        char *operation;
+       char *color_depth;
 } splashscreen_x;
 
 typedef struct application_x {
index 1e1591c..b912568 100644 (file)
@@ -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,
index 3150bbd..4df10a5 100644 (file)
       <xs:attribute name="orientation" use="required" type="xs:string"/>
       <xs:attribute name="indicator-display" type="xs:string"/>
       <xs:attribute name="app-control-operation" type="xs:string"/>
+      <xs:attribute name="color-depth" type="xs:string"/>
       <xs:anyAttribute namespace="##any" processContents="lax"/>
     </xs:complexType>
   </xs:element>
index 1341b5e..21370bd 100644 (file)
       <xs:attribute name="orientation" use="required" type="xs:string"/>
       <xs:attribute name="indicator-display" type="xs:string"/>
       <xs:attribute name="app-control-operation" type="xs:string"/>
+      <xs:attribute name="color-depth" type="xs:string"/>
     </xs:complexType>
   </xs:element>
 </xs:schema>
index 885ae8e..75ad043 100644 (file)
@@ -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;
 }
 
index 16f701b..f0b9dee 100644 (file)
@@ -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");
index 1c6c2c2..3a713f3 100644 (file)
@@ -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;
index 5d03253..54d8ec0 100644 (file)
@@ -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);
 }