implement app format tag
authorjunsuk77.oh <junsuk77.oh@samsung.com>
Tue, 11 Jun 2013 04:27:38 +0000 (13:27 +0900)
committerjunsuk77.oh <junsuk77.oh@samsung.com>
Tue, 11 Jun 2013 04:27:38 +0000 (13:27 +0900)
Change-Id: I498b1e780c0f7fbd8125ad7734780e5302fd1190
Signed-off-by: junsuk77.oh <junsuk77.oh@samsung.com>
include/pkgmgr-info.h
packaging/pkgmgr-info.spec
parser/manifest.xsd.in
parser/pkgmgr_parser.c
parser/pkgmgr_parser.h
parser/pkgmgr_parser_db.c
src/pkgmgr-info.c

index 4db5042..592f8ad 100755 (executable)
@@ -2860,6 +2860,46 @@ static int get_app_permission(const char *appid)
 int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission);
 
 /**
+ * @fn int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h handle, char **component_type)
+ * @brief      This API gets the component_type
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle           pointer to the application info handle.
+ * @param[out] component_type          pointer to hold component_type
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @pre                pkgmgrinfo_appinfo_get_appinfo()
+ * @post       pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see                pkgmgrinfo_appinfo_get_pkgid()
+ * @see                pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_component_type(const char *appid)
+{
+       int ret = 0;
+       char *component_type = NULL;
+       pkgmgrinfo_appinfo_h handle;
+       ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_appinfo_get_component_type(handle, &component_type);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_appinfo_destroy_appinfo(handle);
+               return -1;
+       }
+       printf("component_type: %s\n", component_type);
+       pkgmgrinfo_appinfo_destroy_appinfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h  handle, char **component_type);
+
+
+/**
  * @fn int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
                        pkgmgrinfo_app_permission_list_cb permission_func, void *user_data);
  * @brief      This API gets the list of permission for a particular application
index 98e19ef..e728532 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       pkgmgr-info
 Summary:    Packager Manager infomation api for package
-Version:    0.0.118
+Version:    0.0.119
 Release:    1
 Group:      Application Framework/Package Management
 License:    Apache-2.0
index 72d7431..1de9261 100755 (executable)
       <xs:attribute name="guestmode-visibility" type="xs:string"/>
          <xs:attribute name="launchcondition" type="xs:boolean"/>
          <xs:attribute name="permission-type" type="xs:string"/>
+         <xs:attribute name="component-type" type="xs:string"/>
     </xs:complexType>
   </xs:element>
   <xs:element name="ime-application">
index 1ded904..ff760d5 100755 (executable)
@@ -1365,6 +1365,10 @@ static void __ps_free_uiapplication(uiapplication_x *uiapplication)
                free((void *)uiapplication->permission_type);
                uiapplication->permission_type = NULL;
        }
+       if (uiapplication->component_type) {
+               free((void *)uiapplication->component_type);
+               uiapplication->component_type = NULL;
+       }
 
        free((void*)uiapplication);
        uiapplication = NULL;
@@ -2549,6 +2553,13 @@ static int __ps_process_uiapplication(xmlTextReaderPtr reader, uiapplication_x *
        } else {
                uiapplication->permission_type = strdup("normal");
        }
+       if (xmlTextReaderGetAttribute(reader, XMLCHAR("component-type"))) {
+               uiapplication->component_type = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("component-type")));
+               if (uiapplication->component_type == NULL)
+                       uiapplication->component_type = strdup("uiapp");
+       } else {
+               uiapplication->component_type = strdup("uiapp");
+       }
 
        depth = xmlTextReaderDepth(reader);
        while ((ret = __next_child_element(reader, depth))) {
index 126f191..e53a85c 100755 (executable)
@@ -374,6 +374,7 @@ typedef struct uiapplication_x {
        const char *guestmode_visibility;
        const char *app_component;
        const char *permission_type;
+       const char *component_type;
        struct label_x *label;
        struct icon_x *icon;
        struct image_x *image;
index ba0568c..20625be 100755 (executable)
@@ -107,6 +107,7 @@ char *prev = NULL;
                                                "app_landscapeimg text, " \
                                                "app_guestmodevisibility text DEFAULT 'true', " \
                                                "app_permissiontype text DEFAULT 'normal', " \
+                                               "component_type text, " \
                                                "package text not null, " \
                                                "FOREIGN KEY(package) " \
                                                "REFERENCES package_info(package) " \
@@ -799,11 +800,11 @@ static int __insert_uiapplication_info(manifest_x *mfx)
                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_enabled, app_hwacceleration, app_mainapp , app_recentimage, " \
-                       "app_launchcondition, app_indicatordisplay, app_portraitimg, app_landscapeimg, app_guestmodevisibility, app_permissiontype, package) " \
-                       "values('%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
+                       "app_launchcondition, app_indicatordisplay, app_portraitimg, app_landscapeimg, app_guestmodevisibility, app_permissiontype, component_type, package) " \
+                       "values('%s', '%s', '%s', '%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->enabled, up->hwacceleration,up->mainapp, up->recentimage,
-                        up->launchcondition, up->indicatordisplay, up->portraitimg, up->landscapeimg, up->guestmode_visibility, up->permission_type, mfx->package);
+                        up->launchcondition, up->indicatordisplay, up->portraitimg, up->landscapeimg, up->guestmode_visibility, up->permission_type, up->component_type, mfx->package);
                ret = __exec_query(query);
                if (ret == -1) {
                        DBG("Package UiApp Info DB Insert Failed\n");
index e52abf8..1f9e5af 100755 (executable)
@@ -657,6 +657,11 @@ static int __uiapp_list_cb(void *data, int ncols, char **coltxt, char **colname)
                                info->manifest_info->uiapplication->permission_type = strdup(coltxt[i]);
                        else
                                info->manifest_info->uiapplication->permission_type = NULL;
+               } else if (strcmp(colname[i], "component_type") == 0 ) {
+                       if (coltxt[i])
+                               info->manifest_info->uiapplication->component_type = strdup(coltxt[i]);
+                       else
+                               info->manifest_info->uiapplication->component_type = NULL;
                } else
                        continue;
        }
@@ -1297,6 +1302,11 @@ static int __mini_appinfo_cb(void *data, int ncols, char **coltxt, char **colnam
                                info->uiapp_info->permission_type = strdup(coltxt[i]);
                        else
                                info->uiapp_info->permission_type = NULL;
+               } else if (strcmp(colname[i], "component_type") == 0 ) {
+                       if (coltxt[i])
+                               info->uiapp_info->component_type = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->component_type = NULL;
                } else
                        continue;
        }
@@ -1471,6 +1481,11 @@ static int __appinfo_cb(void *data, int ncols, char **coltxt, char **colname)
                                        info->uiapp_info->permission_type = strdup(coltxt[i]);
                                else
                                        info->uiapp_info->permission_type = NULL;
+                       } else if (strcmp(colname[i], "component_type") == 0 ) {
+                               if (coltxt[i])
+                                       info->uiapp_info->component_type = strdup(coltxt[i]);
+                               else
+                                       info->uiapp_info->component_type = NULL;
                        } else
                                continue;
                }
@@ -4799,6 +4814,17 @@ API int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h  handle, pkg
        return PMINFO_R_OK;
 }
 
+API int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h  handle, char **component_type)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+       retvm_if(component_type == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+       *component_type = (char *)info->uiapp_info->component_type;
+
+       return PMINFO_R_OK;
+}
+
 API int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
                        pkgmgrinfo_app_permission_list_cb permission_func, void *user_data)
 {