Add app-control-operation on splash screen 85/60185/10 accepted/tizen/common/20160301.025444 accepted/tizen/common/20160301.120604 accepted/tizen/common/20160302.193822 accepted/tizen/ivi/20160302.224045 accepted/tizen/mobile/20160302.223956 accepted/tizen/tv/20160302.224009 accepted/tizen/wearable/20160302.224028 submit/tizen/20160229.005700 submit/tizen/20160229.102401 submit/tizen/20160302.020013 submit/tizen/20160302.065807 submit/tizen_common/20160229.190608
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 23 Feb 2016 22:55:48 +0000 (07:55 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 26 Feb 2016 08:32:48 +0000 (17:32 +0900)
- Modify package_app_splash_screen table
- Modify pkgmgrinfo_appinfo_foreach_splash_screen API

Change-Id: I3fe80cc595c271dbd4550154aff1fb7bac7edeab
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 22a0c63..c12c2fd 100644 (file)
@@ -96,6 +96,7 @@ typedef struct splashscreen_x {
        const char *dpi;
        const char *orientation;
        const char *indicatordisplay;
+       const char *operation;
 } splashscreen_x;
 
 typedef struct application_x {
index 3bace31..503b26a 100644 (file)
@@ -308,6 +308,7 @@ typedef int (*pkgmgrinfo_app_background_category_list_cb ) (const char *category
  * @param[in] type the type of the splashscreen
  * @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] 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
@@ -316,7 +317,8 @@ typedef int (*pkgmgrinfo_app_background_category_list_cb ) (const char *category
  */
 typedef 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 *operation,
+               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 22e149a..1506d03 100644 (file)
       <xs:attribute name="dpi" type="xs:string"/>
       <xs:attribute name="orientation" use="required" type="xs:string"/>
       <xs:attribute name="indicator-display" type="xs:string"/>
-      <xs:attribute name="operation" type="xs:string"/>
+      <xs:attribute name="app-control-operation" type="xs:string"/>
       <xs:anyAttribute namespace="##any" processContents="lax"/>
     </xs:complexType>
   </xs:element>
index d2c7dde..3dd65b4 100644 (file)
       <xs:attribute name="dpi" type="xs:string"/>
       <xs:attribute name="orientation" use="required" type="xs:string"/>
       <xs:attribute name="indicator-display" type="xs:string"/>
-      <xs:attribute name="operation" type="xs:string"/>
+      <xs:attribute name="app-control-operation" type="xs:string"/>
     </xs:complexType>
   </xs:element>
 </xs:schema>
index 7486ac6..7b45023 100644 (file)
@@ -1618,6 +1618,7 @@ static int __ps_process_splashscreen(xmlTextReaderPtr reader, splashscreen_x *sp
        __save_xml_attribute(reader, "dpi", &splashscreen->dpi, NULL);
        __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);
        return 0;
 }
 
index 98d61e6..c45d40c 100644 (file)
@@ -331,7 +331,8 @@ sqlite3 *pkgmgr_cert_db;
        "type text not null, " \
        "orientation text not null, " \
        "indicatordisplay text, " \
-       "PRIMARY KEY(app_id, orientation) " \
+       "operation text, " \
+       "PRIMARY KEY(app_id, orientation, operation) " \
        "FOREIGN KEY(app_id) " \
        "REFERENCES package_app_info(app_id) " \
        "ON DELETE CASCADE)"
@@ -1468,6 +1469,9 @@ static gint __compare_splashscreen_with_orientation_dpi(gconstpointer a, gconstp
        const char *orientation = (const char *)b;
        int dpi = -1;
 
+       if (ss->operation || ss->dpi == NULL)
+               return -1;
+
        system_info_get_platform_int("http://tizen.org/feature/screen.dpi", &dpi);
        if (!dpi)
                return -1;
@@ -1483,13 +1487,17 @@ static gint __compare_splashscreen_with_orientation(gconstpointer a, gconstpoint
        splashscreen_x *ss = (splashscreen_x *)a;
        const char *orientation = (const char *)b;
 
-       if (strcasecmp(ss->orientation, orientation) == 0 && (ss->dpi == NULL))
+       if (ss->operation || ss->dpi)
+               return -1;
+
+       if (strcasecmp(ss->orientation, orientation) == 0)
                return 0;
 
        return -1;
 }
 
-static splashscreen_x *__find_splashscreen(GList *splashscreens, const char *orientation)
+static splashscreen_x *__find_default_splashscreen(GList *splashscreens,
+                                       const char *orientation)
 {
        GList *tmp;
 
@@ -1506,11 +1514,73 @@ static splashscreen_x *__find_splashscreen(GList *splashscreens, const char *ori
        return NULL;
 }
 
+static void __find_appcontrol_splashscreen_with_dpi(gpointer data, gpointer user_data)
+{
+       splashscreen_x *ss = (splashscreen_x *)data;
+       GList **list = (GList **)user_data;
+       int dpi = -1;
+
+       if (ss->operation == NULL || ss->dpi == NULL)
+               return;
+
+       system_info_get_platform_int("http://tizen.org/feature/screen.dpi", &dpi);
+       if (!dpi)
+               return;
+
+       if (__check_dpi(ss->dpi, dpi) != 0)
+               return;
+
+       *list = g_list_append(*list, ss);
+}
+
+static void __find_appcontrol_splashscreen(gpointer data, gpointer user_data)
+{
+       splashscreen_x *ss = (splashscreen_x *)data;
+       GList **list = (GList **)user_data;
+       splashscreen_x *ss_tmp;
+       GList *tmp;
+
+       if (ss->operation == NULL || ss->dpi)
+               return;
+
+       for (tmp = *list; tmp; tmp = tmp->next) {
+               ss_tmp = (splashscreen_x *)tmp->data;
+               if (ss_tmp->operation
+                       && strcmp(ss_tmp->operation, ss->operation) == 0
+                       && strcmp(ss_tmp->orientation, ss->orientation) == 0)
+                       return;
+       }
+
+       *list = g_list_append(*list, ss);
+}
+
+static GList *__find_splashscreens(GList *splashscreens)
+{
+       GList *list = NULL;
+       splashscreen_x *ss;
+
+       g_list_foreach(splashscreens,
+                       __find_appcontrol_splashscreen_with_dpi, &list);
+       g_list_foreach(splashscreens,
+                       __find_appcontrol_splashscreen, &list);
+
+       ss = __find_default_splashscreen(splashscreens, "portrait");
+       if (ss)
+               list = g_list_append(list, ss);
+       ss = __find_default_splashscreen(splashscreens, "landscape");
+       if (ss)
+               list = g_list_append(list, ss);
+
+       return list;
+}
+
 static int __insert_application_splashscreen_info(manifest_x *mfx)
 {
        GList *app_tmp;
        application_x *app;
+       GList *ss_tmp;
        splashscreen_x *ss;
+       GList *tmp;
        int ret = -1;
        char query[MAX_QUERY_LEN];
 
@@ -1519,29 +1589,18 @@ static int __insert_application_splashscreen_info(manifest_x *mfx)
                if (app == NULL || app->splashscreens == NULL)
                        continue;
 
-               ss = __find_splashscreen(app->splashscreens, "portrait");
-               if (ss) {
-                       snprintf(query, sizeof(query),
-                                       "insert into package_app_splash_screen" \
-                                       "(app_id, src, type, orientation, indicatordisplay) " \
-                                       "values('%s', '%s', '%s', '%s', '%s')",
-                                       app->appid, ss->src, ss->type, ss->orientation,
-                                       ss->indicatordisplay);
-                       ret = __exec_query(query);
-                       if (ret == -1) {
-                               _LOGD("Package UiApp Splash Screen DB Insert Failed");
-                               return -1;
-                       }
-                       memset(query, '\0', MAX_QUERY_LEN);
-               }
-               ss = __find_splashscreen(app->splashscreens, "landscape");
-               if (ss) {
+               ss_tmp = __find_splashscreens(app->splashscreens);
+               if (ss_tmp == NULL)
+                       continue;
+
+               for (tmp = ss_tmp; tmp; tmp = tmp->next) {
+                       ss = (splashscreen_x *)tmp->data;
                        snprintf(query, sizeof(query),
                                        "insert into package_app_splash_screen" \
-                                       "(app_id, src, type, orientation, indicatordisplay) " \
-                                       "values('%s', '%s', '%s', '%s', '%s')",
+                                       "(app_id, src, type, orientation, indicatordisplay, operation) " \
+                                       "values('%s', '%s', '%s', '%s', '%s', '%s')",
                                        app->appid, ss->src, ss->type, ss->orientation,
-                                       ss->indicatordisplay);
+                                       ss->indicatordisplay, __get_str(ss->operation));
                        ret = __exec_query(query);
                        if (ret == -1) {
                                _LOGD("Package UiApp Splash Screen DB Insert Failed");
@@ -1549,6 +1608,7 @@ static int __insert_application_splashscreen_info(manifest_x *mfx)
                        }
                        memset(query, '\0', MAX_QUERY_LEN);
                }
+               g_list_free(ss_tmp);
        }
        return 0;
 }
@@ -1563,6 +1623,7 @@ static int __insert_application_legacy_splashscreen_info(manifest_x *mfx)
        const char *image_type;
        const char *indicatordisplay;
        const char *orientation;
+       const char *operation = NULL;
 
        for (app_tmp = mfx->application; app_tmp; app_tmp = app_tmp->next) {
                app = (application_x *)app_tmp->data;
@@ -1582,10 +1643,10 @@ 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) " \
-                                       "values('%s', '%s', '%s', '%s', '%s')",
+                                       "(app_id, src, type, orientation, indicatordisplay, operation) " \
+                                       "values('%s', '%s', '%s', '%s', '%s', '%s')",
                                        app->appid, app->portraitimg, image_type,
-                                       orientation, indicatordisplay);
+                                       orientation, indicatordisplay, __get_str(operation));
                        ret = __exec_query(query);
                        if (ret == -1) {
                                _LOGD("Package UiApp Splash Screen DB Insert Failed");
@@ -1596,10 +1657,10 @@ 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) " \
-                                       "values('%s', '%s', '%s', '%s', '%s')",
+                                       "(app_id, src, type, orientation, indicatordisplay, operation) " \
+                                       "values('%s', '%s', '%s', '%s', '%s', '%s')",
                                        app->appid, app->landscapeimg, image_type,
-                                       orientation, indicatordisplay);
+                                       orientation, indicatordisplay, __get_str(operation));
                        ret = __exec_query(query);
                        if (ret == -1) {
                                _LOGD("Package UiApp Splash Screen DB Insert Failed");
index 4928b73..86bab49 100644 (file)
@@ -491,7 +491,7 @@ static int _appinfo_get_splashscreens(sqlite3 *db, const char *appid,
                GList **splashscreens)
 {
        static const char query_raw[] =
-               "SELECT src, type, orientation, indicatordisplay "
+               "SELECT src, type, orientation, indicatordisplay, operation "
                "FROM package_app_splash_screen WHERE app_id=%Q";
        int ret;
        char *query;
@@ -524,6 +524,7 @@ static int _appinfo_get_splashscreens(sqlite3 *db, const char *appid,
                _save_column_str(stmt, idx++, &info->type);
                _save_column_str(stmt, idx++, &info->orientation);
                _save_column_str(stmt, idx++, &info->indicatordisplay);
+               _save_column_str(stmt, idx++, &info->operation);
                *splashscreens = g_list_append(*splashscreens, info);
        }
 
@@ -961,6 +962,8 @@ static gpointer __copy_splashscreens(gconstpointer src, gpointer data)
                splashscreen->orientation = strdup(tmp->orientation);
        if (tmp->indicatordisplay)
                splashscreen->indicatordisplay = strdup(tmp->indicatordisplay);
+       if (tmp->operation)
+               splashscreen->operation = strdup(tmp->operation);
 
        return splashscreen;
 }
@@ -2136,6 +2139,7 @@ API int pkgmgrinfo_appinfo_foreach_splash_screen(pkgmgrinfo_appinfo_h handle,
                                splashscreen->type,
                                splashscreen->orientation,
                                splashscreen->indicatordisplay,
+                               splashscreen->operation,
                                user_data);
                if (ret < 0)
                        break;
index f2882c6..8736811 100644 (file)
@@ -214,6 +214,8 @@ static void __ps_free_splashscreen(gpointer data)
                free((void *)splashscreen->orientation);
        if (splashscreen->indicatordisplay)
                free((void *)splashscreen->indicatordisplay);
+       if (splashscreen->operation)
+               free((void *)splashscreen->operation);
        free((void *)splashscreen);
 }