add permission type on attribution, new api to get installed list with minimum info tizen_2.1 accepted/tizen/20130520.100925 submit/tizen/20130517.044818 submit/tizen_2.1/20130516.045836
authorjunsuk77.oh <junsuk77.oh@samsung.com>
Tue, 14 May 2013 04:44:41 +0000 (13:44 +0900)
committerjunsuk77.oh <junsuk77.oh@samsung.com>
Tue, 14 May 2013 05:47:20 +0000 (14:47 +0900)
Change-Id: I10b84c61e37d6f8ca5d6a18f387e5d346242df95
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 a3f57de..6703c52 100755 (executable)
@@ -237,6 +237,21 @@ typedef int (*pkgmgrinfo_app_category_list_cb ) (const char *category_name,
                                                        void *user_data);
 
 /**
+ * @fn int (*pkgmgrinfo_app_permission_list_cb ) (const char *permission_type, void *user_data)
+ *
+ * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_category()
+ *
+ * @param[in] permission_name the name of the permission
+ * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_category()
+ *
+ * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
+ *
+ * @see  pkgmgrinfo_appinfo_foreach_category()
+ */
+typedef int (*pkgmgrinfo_app_permission_list_cb ) (const char *permission_type,
+                                                       void *user_data);
+
+/**
  * @fn int (*pkgmgrinfo_pkg_privilege_list_cb ) (const char *privilege_name, void *user_data)
  *
  * @brief Specifies the type of function passed to pkgmgrinfo_pkginfo_foreach_privilege()
@@ -2015,6 +2030,47 @@ static int list_apps(const char *pkgid)
  */
 int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
                                                        pkgmgrinfo_app_list_cb app_func, void *user_data);
+/**
+ * @fn int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
+ * @brief      This API gets list of installed applications from all packages with  minimum informaion.
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in]  app_func                iteration function for list
+ * @param[in] user_data        user data to be passed to callback function
+ * @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                None
+ * @post               None
+ * @code
+int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+       char *pkgid1 = NULL;
+       char *pkgid2 = NULL;
+       pkgid1 = (char *)user_data;
+       pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid2);
+       if (strcmp(pkgid1, pkgid2) == 0) {
+               return -1;
+       } else {
+               return 0;
+       }
+}
+
+static int list_apps()
+{
+       int ret = 0;
+       char *name = "helloworld";
+       ret = pkgmgrinfo_appinfo_get_install_list(app_list_cb, (void *)name);
+       if (ret != PMINFO_R_OK) {
+               return -1;
+       }
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
 
 /**
  * @fn int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
@@ -2767,6 +2823,51 @@ 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_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
+ *
+ * @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[in]  permission_func         callback function for list
+ * @param[in] user_data        user data to be passed to callback function
+ * @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()
+ * @code
+int permission_func(const char *name, void *user_data)
+{
+       if (strcmp(name, (char *)user_data) == 0)
+               return -1;
+       else
+               return 0;
+}
+
+static int list_permission(const char *appid, char *permission)
+{
+       int ret = 0;
+       pkgmgrinfo_appinfo_h handle;
+       ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_appinfo_foreach_permission(handle, permission_func, (void *)permission);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_appinfo_destroy_appinfo(handle);
+               return -1;
+       }
+       pkgmgrinfo_appinfo_destroy_appinfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
+                       pkgmgrinfo_app_permission_list_cb permission_func, void *user_data);
+
+/**
  * @fn int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
                        pkgmgrinfo_app_category_list_cb category_func, void *user_data);
  * @brief      This API gets the list of category for a particular application
index c27a355..8e63e75 100755 (executable)
@@ -1,7 +1,7 @@
 Name:       pkgmgr-info
 Summary:    Packager Manager infomation api for package
-Version:    0.0.108
-Release:    2
+Version:    0.0.110
+Release:    1
 Group:      Application Framework/Package Management
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
index 5531d70..a817cbb 100755 (executable)
       <xs:attribute name="exec" use="required"/>
       <xs:attribute name="on-boot" use="required" type="xs:boolean"/>
       <xs:attribute name="type" use="required" type="packages:TypeType"/>
+         <xs:attribute name="permission-type" type="xs:string"/>
     </xs:complexType>
   </xs:element>
   <xs:element name="ui-application">
       <xs:attribute name="landscape-effectimage" type="xs:string"/>
       <xs:attribute name="guestmode-visibility" type="xs:string"/>
          <xs:attribute name="launchcondition" type="xs:boolean"/>
+         <xs:attribute name="permission-type" type="xs:string"/>
     </xs:complexType>
   </xs:element>
   <xs:element name="ime-application">
index e594d47..80f7314 100755 (executable)
@@ -1357,6 +1357,15 @@ static void __ps_free_uiapplication(uiapplication_x *uiapplication)
                free((void *)uiapplication->guestmode_visibility);
                uiapplication->guestmode_visibility = NULL;
        }
+       if (uiapplication->app_component) {
+               free((void *)uiapplication->app_component);
+               uiapplication->app_component = NULL;
+       }
+       if (uiapplication->permission_type) {
+               free((void *)uiapplication->permission_type);
+               uiapplication->permission_type = NULL;
+       }
+
        free((void*)uiapplication);
        uiapplication = NULL;
 }
@@ -1393,6 +1402,10 @@ static void __ps_free_serviceapplication(serviceapplication_x *serviceapplicatio
                free((void *)serviceapplication->package);
                serviceapplication->package = NULL;
        }
+       if (serviceapplication->permission_type) {
+               free((void *)serviceapplication->permission_type);
+               serviceapplication->permission_type = NULL;
+       }
        /*Free Label*/
        if (serviceapplication->label) {
                label_x *label = serviceapplication->label;
@@ -2528,6 +2541,13 @@ static int __ps_process_uiapplication(xmlTextReaderPtr reader, uiapplication_x *
        } else {
                uiapplication->guestmode_visibility = strdup("true");
        }
+       if (xmlTextReaderGetAttribute(reader, XMLCHAR("permission-type"))) {
+               uiapplication->permission_type = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("permission-type")));
+               if (uiapplication->permission_type == NULL)
+                       uiapplication->permission_type = strdup("normal");
+       } else {
+               uiapplication->permission_type = strdup("normal");
+       }
 
        depth = xmlTextReaderDepth(reader);
        while ((ret = __next_child_element(reader, depth))) {
@@ -2749,6 +2769,13 @@ static int __ps_process_serviceapplication(xmlTextReaderPtr reader, serviceappli
        } else {
                serviceapplication->autorestart = strdup("false");
        }
+       if (xmlTextReaderGetAttribute(reader, XMLCHAR("permission-type"))) {
+               serviceapplication->permission_type = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("permission-type")));
+               if (serviceapplication->permission_type == NULL)
+                       serviceapplication->permission_type = strdup("normal");
+       } else {
+               serviceapplication->permission_type = strdup("normal");
+       }
 
        depth = xmlTextReaderDepth(reader);
        while ((ret = __next_child_element(reader, depth))) {
@@ -4019,7 +4046,7 @@ API manifest_x *pkgmgr_parser_process_manifest_xml(const char *manifest)
 
 API int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[])
 {
-       char *temp[] = {"shortcut-list", "livebox", "account", "notifications", "privileges", "ime", NULL};
+       char *temp[] = {"shortcut-list", "livebox", "account", "notifications", "privileges", "ime", "font", NULL};
        if (manifest == NULL) {
                DBG("argument supplied is NULL\n");
                return PMINFO_R_EINVAL;
@@ -4084,7 +4111,7 @@ API int pkgmgr_parser_create_desktop_file(manifest_x *mfx)
 
 API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[])
 {
-       char *temp[] = {"shortcut-list", "livebox", "account", "notifications", "privileges", "ime", NULL};
+       char *temp[] = {"shortcut-list", "livebox", "account", "notifications", "privileges", "ime", "font", NULL};
        if (manifest == NULL) {
                DBG("argument supplied is NULL\n");
                return PMINFO_R_EINVAL;
@@ -4141,7 +4168,7 @@ API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *con
 
 API int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, char *const tagv[])
 {
-       char *temp[] = {"shortcut-list", "livebox", "account", "notifications", "privileges", "ime", NULL};
+       char *temp[] = {"shortcut-list", "livebox", "account", "notifications", "privileges", "ime", "font", NULL};
        if (manifest == NULL) {
                DBG("argument supplied is NULL\n");
                return PMINFO_R_EINVAL;
index a6b8369..401e32c 100755 (executable)
@@ -372,6 +372,8 @@ typedef struct uiapplication_x {
        const char *portraitimg;
        const char *landscapeimg;
        const char *guestmode_visibility;
+       const char *app_component;
+       const char *permission_type;
        struct label_x *label;
        struct icon_x *icon;
        struct image_x *image;
@@ -395,6 +397,7 @@ typedef struct serviceapplication_x {
        const char *enabled;
        const char *type;
        const char *package;
+       const char *permission_type;
        struct label_x *label;
        struct icon_x *icon;
        struct appsvc_x *appsvc;
index c7d692e..ea3e382 100755 (executable)
@@ -105,6 +105,7 @@ char *prev = NULL;
                                                "app_portraitimg text, " \
                                                "app_landscapeimg text, " \
                                                "app_guestmodevisibility text DEFAULT 'true', " \
+                                               "app_permissiontype text DEFAULT 'normal', " \
                                                "package text not null, " \
                                                "FOREIGN KEY(package) " \
                                                "REFERENCES package_info(package) " \
@@ -183,7 +184,7 @@ char *prev = NULL;
                                                "(app_id text not null, " \
                                                "pm_type text not null, " \
                                                "pm_value text not null, " \
-                                               "PRIMARY KEY(app_id) " \
+                                               "PRIMARY KEY(app_id, pm_type, pm_value) " \
                                                "FOREIGN KEY(app_id) " \
                                                "REFERENCES package_app_info(app_id) " \
                                                "ON DELETE CASCADE)"
@@ -801,10 +802,12 @@ 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, package) " \
-                       "values('%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
+                       "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')",\
                         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, mfx->package);
+                        "\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);
                ret = __exec_query(query);
                if (ret == -1) {
                        DBG("Package UiApp Info DB Insert Failed\n");
@@ -1133,10 +1136,10 @@ static int __insert_serviceapplication_info(manifest_x *mfx)
        {
                snprintf(query, MAX_QUERY_LEN,
                         "insert into package_app_info(app_id, app_component, app_exec, app_type, app_onboot, " \
-                       "app_multiple, app_autorestart, app_enabled, package) " \
-                       "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
+                       "app_multiple, app_autorestart, app_enabled, app_permissiontype, package) " \
+                       "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
                         sp->appid, "svcapp", sp->exec, sp->type, sp->onboot, "\0",
-                        sp->autorestart, sp->enabled, mfx->package);
+                        sp->autorestart, sp->enabled, sp->permission_type, mfx->package);
                ret = __exec_query(query);
                if (ret == -1) {
                        DBG("Package ServiceApp Info DB Insert Failed\n");
index 0b1a6e6..e5b6224 100755 (executable)
@@ -647,6 +647,11 @@ static int __uiapp_list_cb(void *data, int ncols, char **coltxt, char **colname)
                                info->manifest_info->uiapplication->icon->lang = NULL;
                                info->manifest_info->uiapplication->label->lang = NULL;
                        }
+               } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+                       if (coltxt[i])
+                               info->manifest_info->uiapplication->permission_type = strdup(coltxt[i]);
+                       else
+                               info->manifest_info->uiapplication->permission_type = NULL;
                } else
                        continue;
        }
@@ -718,6 +723,11 @@ static int __svcapp_list_cb(void *data, int ncols, char **coltxt, char **colname
                                info->manifest_info->serviceapplication->icon->lang = NULL;
                                info->manifest_info->serviceapplication->label->lang = NULL;
                        }
+               } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+                       if (coltxt[i])
+                               info->manifest_info->serviceapplication->permission_type = strdup(coltxt[i]);
+                       else
+                               info->manifest_info->serviceapplication->permission_type = NULL;
                } else
                        continue;
        }
@@ -833,6 +843,11 @@ static int __allapp_list_cb(void *data, int ncols, char **coltxt, char **colname
                                                                info->manifest_info->uiapplication->icon->lang = NULL;
                                                                info->manifest_info->uiapplication->label->lang = NULL;
                                                        }
+                                               } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+                                                       if (coltxt[i])
+                                                               info->manifest_info->uiapplication->permission_type = strdup(coltxt[i]);
+                                                       else
+                                                               info->manifest_info->uiapplication->permission_type = NULL;
                                                } else
                                                        continue;
                                        }
@@ -894,6 +909,11 @@ static int __allapp_list_cb(void *data, int ncols, char **coltxt, char **colname
                                                                info->manifest_info->serviceapplication->icon->lang = NULL;
                                                                info->manifest_info->serviceapplication->label->lang = NULL;
                                                        }
+                                               } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+                                                       if (coltxt[i])
+                                                               info->manifest_info->serviceapplication->permission_type = strdup(coltxt[i]);
+                                                       else
+                                                               info->manifest_info->serviceapplication->permission_type = NULL;
                                                } else
                                                        continue;
                                        }
@@ -1162,6 +1182,118 @@ static int __certinfo_cb(void *data, int ncols, char **coltxt, char **colname)
        return 0;
 }
 
+static int __mini_appinfo_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)data;
+       int i = 0;
+       uiapplication_x *uiapp = NULL;
+       uiapp = calloc(1, sizeof(uiapplication_x));
+       if (uiapp == NULL) {
+               _LOGE("Out of Memory!!!\n");
+               return -1;
+       }
+
+       LISTADD(info->uiapp_info, uiapp);
+
+       for(i = 0; i < ncols; i++)
+       {
+               if (strcmp(colname[i], "app_id") == 0) {
+                       /*appid being foreign key, is column in every table
+                       Hence appid gets strduped every time leading to memory leak.
+                       If appid is already set, just continue.*/
+                       if (info->uiapp_info->appid)
+                               continue;
+                       if (coltxt[i])
+                               info->uiapp_info->appid = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->appid = NULL;
+               } else if (strcmp(colname[i], "app_exec") == 0) {
+                       if (coltxt[i])
+                               info->uiapp_info->exec = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->exec = NULL;
+               } else if (strcmp(colname[i], "app_nodisplay") == 0) {
+                       if (coltxt[i])
+                               info->uiapp_info->nodisplay = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->nodisplay = NULL;
+               } else if (strcmp(colname[i], "app_type") == 0 ) {
+                       if (coltxt[i])
+                               info->uiapp_info->type = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->type = NULL;
+               } else if (strcmp(colname[i], "app_multiple") == 0 ) {
+                       if (coltxt[i])
+                               info->uiapp_info->multiple = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->multiple = NULL;
+               } else if (strcmp(colname[i], "app_taskmanage") == 0 ) {
+                       if (coltxt[i])
+                               info->uiapp_info->taskmanage = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->taskmanage = NULL;
+               } else if (strcmp(colname[i], "app_hwacceleration") == 0 ) {
+                       if (coltxt[i])
+                               info->uiapp_info->hwacceleration = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->hwacceleration = NULL;
+               } else if (strcmp(colname[i], "app_enabled") == 0 ) {
+                       if (coltxt[i])
+                               info->uiapp_info->enabled= strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->enabled = NULL;
+               } else if (strcmp(colname[i], "app_indicatordisplay") == 0){
+                       if (coltxt[i])
+                               info->uiapp_info->indicatordisplay = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->indicatordisplay = NULL;
+               } else if (strcmp(colname[i], "app_portraitimg") == 0){
+                       if (coltxt[i])
+                               info->uiapp_info->portraitimg = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->portraitimg = NULL;
+               } else if (strcmp(colname[i], "app_landscapeimg") == 0){
+                       if (coltxt[i])
+                               info->uiapp_info->landscapeimg = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->landscapeimg = NULL;
+               } else if (strcmp(colname[i], "app_guestmodevisibility") == 0){
+                       if (coltxt[i])
+                               info->uiapp_info->guestmode_visibility = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->guestmode_visibility = NULL;
+               } else if (strcmp(colname[i], "app_recentimage") == 0 ) {
+                       if (coltxt[i])
+                               info->uiapp_info->recentimage = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->recentimage = NULL;
+               } else if (strcmp(colname[i], "app_mainapp") == 0 ) {
+                       if (coltxt[i])
+                               info->uiapp_info->mainapp = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->mainapp = NULL;
+               } else if (strcmp(colname[i], "package") == 0 ) {
+                       if (coltxt[i])
+                               info->uiapp_info->package = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->package = NULL;
+               } else if (strcmp(colname[i], "app_component") == 0) {
+                       if (coltxt[i])
+                               info->uiapp_info->app_component = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->app_component = NULL;
+               } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+                       if (coltxt[i])
+                               info->uiapp_info->permission_type = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->permission_type = NULL;
+               } else
+                       continue;
+       }
+
+       return 0;
+}
+
 static int __appinfo_cb(void *data, int ncols, char **coltxt, char **colname)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)data;
@@ -1324,6 +1456,11 @@ static int __appinfo_cb(void *data, int ncols, char **coltxt, char **colname)
                                                info->uiapp_info->image->section= strdup(coltxt[i]);
                                        else
                                                info->uiapp_info->image->section = NULL;
+                       } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+                               if (coltxt[i])
+                                       info->uiapp_info->permission_type = strdup(coltxt[i]);
+                               else
+                                       info->uiapp_info->permission_type = NULL;
                        } else
                                continue;
                }
@@ -1420,6 +1557,11 @@ static int __appinfo_cb(void *data, int ncols, char **coltxt, char **colname)
                                        info->svcapp_info->icon->lang = NULL;
                                        info->svcapp_info->label->lang = NULL;
                                }
+                       } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
+                               if (coltxt[i])
+                                       info->svcapp_info->permission_type = strdup(coltxt[i]);
+                               else
+                                       info->svcapp_info->permission_type = NULL;
                        } else
                                continue;
                }
@@ -3868,6 +4010,68 @@ catch:
        return ret;
 }
 
+API int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data)
+{
+       retvm_if(app_func == NULL, PMINFO_R_EINVAL, "callback function is NULL");
+
+       int ret = PMINFO_R_OK;
+       char query[MAX_QUERY_LEN] = {'\0'};
+       pkgmgr_appinfo_x *info = NULL;
+       pkgmgr_appinfo_x *appinfo = NULL;
+       uiapplication_x *ptr1 = NULL;
+       sqlite3 *appinfo_db = NULL;
+
+       /*open db*/
+       ret = db_util_open_with_options(MANIFEST_DB, &appinfo_db, SQLITE_OPEN_READONLY, NULL);
+       retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+       /*calloc appinfo*/
+       info = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+       tryvm_if(info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+       /*calloc uiapplication_x*/
+       info->uiapp_info= (uiapplication_x *)calloc(1, sizeof(uiapplication_x));
+       tryvm_if(info->uiapp_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+       /*calloc appinfo*/
+       appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+       tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+       /*query package_app_info*/
+       snprintf(query, MAX_QUERY_LEN, "select * from package_app_info");
+       ret = __exec_db_query(appinfo_db, query, __mini_appinfo_cb, (void *)info);
+       tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+       LISTHEAD(info->uiapp_info, ptr1);
+
+       /*call back*/
+       for(ptr1 = ptr1->next ; ptr1 ; ptr1 = ptr1->next)
+       {
+               appinfo->uiapp_info= ptr1;
+               appinfo->package = strdup(ptr1->package);
+               if (strcmp(ptr1->app_component, "uiapp") == 0)
+                       appinfo->app_component = PMINFO_UI_APP;
+               else
+                       appinfo->app_component = PMINFO_SVC_APP;
+
+               ret = app_func((void *)appinfo, user_data);
+               if (ret < 0)
+                       break;
+               free((void *)appinfo->package);
+               appinfo->package = NULL;
+       }
+
+catch:
+       sqlite3_close(appinfo_db);
+
+       if (appinfo) {
+               free(appinfo);
+               appinfo = NULL;
+       }
+       __cleanup_appinfo(info);
+       return ret;
+}
+
 API int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data)
 {
        retvm_if(app_func == NULL, PMINFO_R_EINVAL, "callback function is NULL");
@@ -4562,31 +4766,45 @@ API int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h  handle, pkg
        retvm_if(permission == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
 
        char *val = NULL;
-       permission_x *ptr = NULL;
-       permission_x *start = NULL;
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_component == PMINFO_UI_APP)
-               start = info->uiapp_info->permission;
+               val = info->uiapp_info->permission_type;
        else if (info->app_component == PMINFO_SVC_APP)
-               start = info->svcapp_info->permission;
-       else
+               val = info->svcapp_info->permission_type;
+       else {
+               _LOGE("app_component is not supported\n");
                return PMINFO_R_EINVAL;
+       }
 
-       for(ptr = start; ptr != NULL; ptr = ptr->next)
-       {
-               if (ptr->type) {
-                       val = (char *)ptr->type;
+       if (strcmp(val, "signature") == 0)
+               *permission = PMINFO_PERMISSION_SIGNATURE;
+       else if (strcmp(val, "privilege") == 0)
+               *permission = PMINFO_PERMISSION_PRIVILEGE;
+       else
+               *permission = PMINFO_PERMISSION_NORMAL;
 
-                       if (strcmp(val, "signature") == 0)
-                               *permission = PMINFO_PERMISSION_SIGNATURE;
-                       else if (strcmp(val, "privilege") == 0)
-                               *permission = PMINFO_PERMISSION_PRIVILEGE;
-                       else
-                               *permission = PMINFO_PERMISSION_NORMAL;
+       return PMINFO_R_OK;
+}
 
+API int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
+                       pkgmgrinfo_app_permission_list_cb permission_func, void *user_data)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+       retvm_if(permission_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
+       int ret = -1;
+       permission_x *ptr = NULL;
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+       if (info->app_component == PMINFO_UI_APP)
+               ptr = info->uiapp_info->permission;
+       else if (info->app_component == PMINFO_SVC_APP)
+               ptr = info->svcapp_info->permission;
+       else
+               return PMINFO_R_EINVAL;
+       for (; ptr; ptr = ptr->next) {
+               ret = permission_func(ptr->value, user_data);
+               if (ret < 0)
                        break;
-               }
        }
        return PMINFO_R_OK;
 }