implement app screen reader
[platform/core/appfw/pkgmgr-info.git] / src / pkgmgr-info.c
index 6377ec9..b0568ee 100755 (executable)
@@ -114,8 +114,7 @@ typedef struct _pkgmgr_certindexinfo_x {
 
 typedef struct _pkgmgr_pkginfo_x {
        manifest_x *manifest_info;
-       char *tmp;
-       char *tmp_dup;
+       char *locale;
 
        struct _pkgmgr_pkginfo_x *prev;
        struct _pkgmgr_pkginfo_x *next;
@@ -146,6 +145,7 @@ typedef struct _pkgmgr_locale_x {
 
 typedef struct _pkgmgr_appinfo_x {
        const char *package;
+       char *locale;
        pkgmgrinfo_app_component app_component;
        union {
                uiapplication_x *uiapp_info;
@@ -175,15 +175,16 @@ typedef struct _pkgmgrinfo_appcontrol_x {
        int operation_count;
        int uri_count;
        int mime_count;
+       int subapp_count;
        char **operation;
        char **uri;
        char **mime;
+       char **subapp;
 } pkgmgrinfo_appcontrol_x;
 
 typedef int (*sqlite_query_callback)(void *data, int ncols, char **coltxt, char **colname);
 
 char *pkgtype = "rpm";
-static char glocale[PKG_LOCALE_STRING_LEN_MAX];
 __thread sqlite3 *manifest_db = NULL;
 __thread sqlite3 *datacontrol_db = NULL;
 __thread sqlite3 *cert_db = NULL;
@@ -314,6 +315,10 @@ static void __get_filter_condition(gpointer data, char **condition)
        case E_PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING:
                snprintf(buf, MAX_QUERY_LEN, "package_info.package_appsetting IN %s", node->value);
                break;
+       case E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING:
+               snprintf(buf, MAX_QUERY_LEN, "package_info.package_nodisplay IN %s", node->value);
+               break;
+
        case E_PMINFO_APPINFO_PROP_APP_ID:
                snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_id='%s'", node->value);
                break;
@@ -363,6 +368,12 @@ static void __get_filter_condition(gpointer data, char **condition)
        case E_PMINFO_APPINFO_PROP_APP_HWACCELERATION:
                snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_hwacceleration='%s'", node->value);
                break;
+       case E_PMINFO_APPINFO_PROP_APP_SCREENREADER:
+               snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_screenreader='%s'", node->value);
+               break;
+       case E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION:
+               snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_launchcondition IN %s", node->value);
+               break;
        default:
                _LOGE("Invalid Property Type\n");
                *condition = NULL;
@@ -390,9 +401,9 @@ static char* __convert_system_locale_to_manifest_locale(char *syslocale)
 static void __cleanup_pkginfo(pkgmgr_pkginfo_x *data)
 {
        ret_if(data == NULL);
-       if (data->tmp_dup){
-               free((void *)data->tmp_dup);
-               data->tmp_dup = NULL;
+       if (data->locale){
+               free((void *)data->locale);
+               data->locale = NULL;
        }
 
        pkgmgr_parser_free_manifest_xml(data->manifest_info);
@@ -408,6 +419,10 @@ static void __cleanup_appinfo(pkgmgr_appinfo_x *data)
                free((void *)data->package);
                data->package = NULL;
        }
+       if (data->locale){
+               free((void *)data->locale);
+               data->locale = NULL;
+       }
 
        manifest_x *mfx = calloc(1, sizeof(manifest_x));
        if (data->app_component == PMINFO_UI_APP)
@@ -583,6 +598,11 @@ static int __uiapp_list_cb(void *data, int ncols, char **coltxt, char **colname)
                                info->manifest_info->uiapplication->hwacceleration = strdup(coltxt[i]);
                        else
                                info->manifest_info->uiapplication->hwacceleration = NULL;
+               } else if (strcmp(colname[i], "app_screenreader") == 0 ){
+                       if (coltxt[i])
+                               info->manifest_info->uiapplication->screenreader = strdup(coltxt[i]);
+                       else
+                               info->manifest_info->uiapplication->screenreader = NULL;
                } else if (strcmp(colname[i], "app_indicatordisplay") == 0 ){
                        if (coltxt[i])
                                info->manifest_info->uiapplication->indicatordisplay = strdup(coltxt[i]);
@@ -613,6 +633,11 @@ static int __uiapp_list_cb(void *data, int ncols, char **coltxt, char **colname)
                                info->manifest_info->uiapplication->icon->text = strdup(coltxt[i]);
                        else
                                info->manifest_info->uiapplication->icon->text = NULL;
+               } else if (strcmp(colname[i], "app_enabled") == 0 ) {
+                       if (coltxt[i])
+                               info->manifest_info->uiapplication->enabled= strdup(coltxt[i]);
+                       else
+                               info->manifest_info->uiapplication->enabled = NULL;
                } else if (strcmp(colname[i], "app_label") == 0 ) {
                        if (coltxt[i])
                                info->manifest_info->uiapplication->label->text = strdup(coltxt[i]);
@@ -637,6 +662,31 @@ 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 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 if (strcmp(colname[i], "app_preload") == 0 ) {
+                       if (coltxt[i])
+                               info->manifest_info->uiapplication->preload = strdup(coltxt[i]);
+                       else
+                               info->manifest_info->uiapplication->preload = NULL;
+               } else if (strcmp(colname[i], "app_submode") == 0 ) {
+                       if (coltxt[i])
+                               info->manifest_info->uiapplication->submode = strdup(coltxt[i]);
+                       else
+                               info->manifest_info->uiapplication->submode = NULL;
+               } else if (strcmp(colname[i], "app_submode_mainid") == 0 ) {
+                       if (coltxt[i])
+                               info->manifest_info->uiapplication->submode_mainid = strdup(coltxt[i]);
+                       else
+                               info->manifest_info->uiapplication->submode_mainid = NULL;
                } else
                        continue;
        }
@@ -708,6 +758,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;
        }
@@ -769,6 +824,11 @@ static int __allapp_list_cb(void *data, int ncols, char **coltxt, char **colname
                                                                info->manifest_info->uiapplication->hwacceleration = strdup(coltxt[i]);
                                                        else
                                                                info->manifest_info->uiapplication->hwacceleration = NULL;
+                                               } else if (strcmp(colname[i], "app_screenreader") == 0 ){
+                                                       if (coltxt[i])
+                                                               info->manifest_info->uiapplication->screenreader = strdup(coltxt[i]);
+                                                       else
+                                                               info->manifest_info->uiapplication->screenreader = NULL;
                                                } else if (strcmp(colname[i], "app_indicatordisplay") == 0 ){
                                                        if (coltxt[i])
                                                                info->manifest_info->uiapplication->indicatordisplay = strdup(coltxt[i]);
@@ -823,6 +883,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;
                                        }
@@ -884,6 +949,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;
                                        }
@@ -1015,6 +1085,11 @@ static int __pkginfo_cb(void *data, int ncols, char **coltxt, char **colname)
                                info->manifest_info->installed_time = strdup(coltxt[i]);
                        else
                                info->manifest_info->installed_time = NULL;
+               } else if (strcmp(colname[i], "installed_storage") == 0 ){
+                       if (coltxt[i])
+                               info->manifest_info->installed_storage = strdup(coltxt[i]);
+                       else
+                               info->manifest_info->installed_storage = NULL;
                } else if (strcmp(colname[i], "mainapp_id") == 0 ){
                        if (coltxt[i])
                                info->manifest_info->mainapp_id = strdup(coltxt[i]);
@@ -1025,6 +1100,11 @@ static int __pkginfo_cb(void *data, int ncols, char **coltxt, char **colname)
                                info->manifest_info->root_path = strdup(coltxt[i]);
                        else
                                info->manifest_info->root_path = NULL;
+               } else if (strcmp(colname[i], "csc_path") == 0 ){
+                       if (coltxt[i])
+                               info->manifest_info->csc_path = strdup(coltxt[i]);
+                       else
+                               info->manifest_info->csc_path = NULL;
                } else if (strcmp(colname[i], "privilege") == 0 ){
                        if (coltxt[i])
                                info->manifest_info->privileges->privilege->text = strdup(coltxt[i]);
@@ -1043,6 +1123,11 @@ static int __pkginfo_cb(void *data, int ncols, char **coltxt, char **colname)
                                info->manifest_info->label->lang = NULL;
                                info->manifest_info->description->lang = NULL;
                        }
+               } else if (strcmp(colname[i], "package_url") == 0 ){
+                       if (coltxt[i])
+                               info->manifest_info->package_url = strdup(coltxt[i]);
+                       else
+                               info->manifest_info->package_url = NULL;
                } else
                        continue;
        }
@@ -1147,6 +1232,143 @@ 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_screenreader") == 0 ) {
+                       if (coltxt[i])
+                               info->uiapp_info->screenreader = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->screenreader = 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 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 if (strcmp(colname[i], "app_preload") == 0 ) {
+                       if (coltxt[i])
+                               info->uiapp_info->preload = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->preload = NULL;
+               } else if (strcmp(colname[i], "app_submode") == 0 ) {
+                       if (coltxt[i])
+                               info->uiapp_info->submode = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->submode = NULL;
+               } else if (strcmp(colname[i], "app_submode_mainid") == 0 ) {
+                       if (coltxt[i])
+                               info->uiapp_info->submode_mainid = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->submode_mainid = 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;
@@ -1230,6 +1452,11 @@ static int __appinfo_cb(void *data, int ncols, char **coltxt, char **colname)
                                        info->uiapp_info->hwacceleration = strdup(coltxt[i]);
                                else
                                        info->uiapp_info->hwacceleration = NULL;
+                       } else if (strcmp(colname[i], "app_screenreader") == 0 ) {
+                               if (coltxt[i])
+                                       info->uiapp_info->screenreader = strdup(coltxt[i]);
+                               else
+                                       info->uiapp_info->screenreader = NULL;
                        } else if (strcmp(colname[i], "app_enabled") == 0 ) {
                                if (coltxt[i])
                                        info->uiapp_info->enabled= strdup(coltxt[i]);
@@ -1309,6 +1536,31 @@ 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 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 if (strcmp(colname[i], "app_preload") == 0 ) {
+                               if (coltxt[i])
+                                       info->uiapp_info->preload = strdup(coltxt[i]);
+                               else
+                                       info->uiapp_info->preload = NULL;
+                       } else if (strcmp(colname[i], "app_submode") == 0 ) {
+                               if (coltxt[i])
+                                       info->uiapp_info->submode = strdup(coltxt[i]);
+                               else
+                                       info->uiapp_info->submode = NULL;
+                       } else if (strcmp(colname[i], "app_submode_mainid") == 0 ) {
+                               if (coltxt[i])
+                                       info->uiapp_info->submode_mainid = strdup(coltxt[i]);
+                               else
+                                       info->uiapp_info->submode_mainid = NULL;
                        } else
                                continue;
                }
@@ -1405,6 +1657,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;
                }
@@ -1680,7 +1937,6 @@ static char* __get_app_locale_by_fallback(sqlite3 *db, const char *appid, const
        check_result = __check_app_locale_from_app_localized_info_by_fallback(db, appid, locale);
        if(check_result == 1) {
                   locale_new = __get_app_locale_from_app_localized_info_by_fallback(db, appid, locale);
-                  _LOGD("%s found (%s) language-locale in DB by fallback!\n", appid, locale_new);
                   free(locale);
                   if (locale_new == NULL)
                           locale_new =  strdup(DEFAULT_LOCALE);
@@ -1689,7 +1945,6 @@ static char* __get_app_locale_by_fallback(sqlite3 *db, const char *appid, const
 
        /* default locale */
        free(locale);
-       _LOGD("%s DEFAULT_LOCALE)\n", appid);
        return  strdup(DEFAULT_LOCALE);
 }
 
@@ -1873,7 +2128,7 @@ API int pkgmgrinfo_pkginfo_get_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *us
                ret = PMINFO_R_EINVAL;
                goto err;
        }
-       strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX - 1);
+
        ret = __open_manifest_db();
        if (ret == -1) {
                _LOGE("Fail to open manifest DB\n");
@@ -1899,6 +2154,7 @@ API int pkgmgrinfo_pkginfo_get_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *us
 
        for(node = node->next; node ; node = node->next) {
                pkginfo = node;
+               pkginfo->locale = strdup(locale);
                pkginfo->manifest_info->privileges = (privileges_x *)calloc(1, sizeof(privileges_x));
                if (pkginfo->manifest_info->privileges == NULL) {
                        _LOGE("Failed to allocate memory for privileges info\n");
@@ -2016,7 +2272,7 @@ API int pkgmgrinfo_pkginfo_get_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *
 
        /*validate pkgid*/
        ret = db_util_open_with_options(MANIFEST_DB, &pkginfo_db, SQLITE_OPEN_READONLY, NULL);
-       retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+       retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
 
        /*check pkgid exist on db*/
        snprintf(query, MAX_QUERY_LEN, "select exists(select * from package_info where package='%s')", pkgid);
@@ -2032,10 +2288,11 @@ API int pkgmgrinfo_pkginfo_get_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *
        locale = __convert_system_locale_to_manifest_locale(syslocale);
        tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
 
-       strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX  - 1);
        pkginfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
        tryvm_if(pkginfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for pkginfo");
 
+       pkginfo->locale = strdup(locale);
+
        pkginfo->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
        tryvm_if(pkginfo->manifest_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for manifest info");
 
@@ -2357,58 +2614,33 @@ API int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
        retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-
-       pkgmgr_pkginfo_x *info_tmp = (pkgmgr_pkginfo_x *)handle;
-       pkgmgrinfo_appinfo_h apphandle;
-       bool ismainapp = 0;
        int ret = PMINFO_R_OK;
+       char *locale = NULL;
+       icon_x *ptr = NULL;
+       *icon = NULL;
 
-       ret = pkgmgrinfo_appinfo_get_appinfo(info_tmp->manifest_info->mainapp_id, &apphandle);
-       retvm_if(ret < 0, PMINFO_R_ERROR, "pkgmgrinfo_appinfo_get_appinfo fail");
-
-       ret = pkgmgrinfo_appinfo_is_mainapp(apphandle, &ismainapp);
-       tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgrinfo_appinfo_is_mainapp fail");
-
-       if (ismainapp){
-               ret = pkgmgrinfo_appinfo_get_icon(apphandle, &info_tmp->tmp);
-               tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgrinfo_appinfo_get_icon fail");
-               tryvm_if(info_tmp->tmp == NULL, ret = PMINFO_R_EINVAL, "icon is NULL");
+       pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
 
-               if (info_tmp->tmp_dup){
-                       free((void *)info_tmp->tmp_dup);
-                       info_tmp->tmp_dup = NULL;
-               }
+       locale = info->locale;
+       retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
 
-               info_tmp->tmp_dup= strdup(info_tmp->tmp);
-               *icon = info_tmp->tmp_dup;
-       } else {
-               char *locale = NULL;
-               icon_x *ptr = NULL;
-               *icon = NULL;
-               locale = glocale;
-               tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
-               pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
-               for(ptr = info->manifest_info->icon; ptr != NULL; ptr = ptr->next)
-               {
-                       if (ptr->lang) {
-                               if (strcmp(ptr->lang, locale) == 0) {
-                                       *icon = (char *)ptr->text;
-                                       if (strcasecmp(*icon, "(null)") == 0) {
-                                               locale = DEFAULT_LOCALE;
-                                               continue;
-                                       } else
-                                               break;
-                               } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
-                                       *icon = (char *)ptr->text;
+       for(ptr = info->manifest_info->icon; ptr != NULL; ptr = ptr->next)
+       {
+               if (ptr->lang) {
+                       if (strcmp(ptr->lang, locale) == 0) {
+                               *icon = (char *)ptr->text;
+                               if (strcasecmp(*icon, "(null)") == 0) {
+                                       locale = DEFAULT_LOCALE;
+                                       continue;
+                               } else
                                        break;
-                               }
+                       } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
+                               *icon = (char *)ptr->text;
+                               break;
                        }
                }
-               
        }
 
-catch:
-       pkgmgrinfo_appinfo_destroy_appinfo(apphandle);
        return ret;
 }
 
@@ -2416,57 +2648,32 @@ API int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
        retvm_if(label == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-
-       pkgmgr_pkginfo_x *info_tmp = (pkgmgr_pkginfo_x *)handle;
-       pkgmgrinfo_appinfo_h apphandle;
-       bool ismainapp = 0;
        int ret = PMINFO_R_OK;
+       char *locale = NULL;
+       label_x *ptr = NULL;
+       *label = NULL;
 
-       ret = pkgmgrinfo_appinfo_get_appinfo(info_tmp->manifest_info->mainapp_id, &apphandle);
-       retvm_if(ret < 0, PMINFO_R_ERROR, "pkgmgrinfo_appinfo_get_appinfo fail");
-
-       ret = pkgmgrinfo_appinfo_is_mainapp(apphandle, &ismainapp);
-       tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgrinfo_appinfo_is_mainapp fail");
-
-       if (ismainapp){
-               ret = pkgmgrinfo_appinfo_get_label(apphandle, &info_tmp->tmp);
-               tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgrinfo_appinfo_get_label fail");
-               tryvm_if(info_tmp->tmp == NULL, ret = PMINFO_R_EINVAL, "label is NULL");
-
-               if (info_tmp->tmp_dup){
-                       free((void *)info_tmp->tmp_dup);
-                       info_tmp->tmp_dup = NULL;
-               }
+       pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+       locale = info->locale;
+       retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
 
-               info_tmp->tmp_dup = strdup(info_tmp->tmp);
-               *label = info_tmp->tmp_dup;
-       } else {
-               char *locale = NULL;
-               label_x *ptr = NULL;
-               *label = NULL;
-               locale = glocale;
-               tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
-               pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
-               for(ptr = info->manifest_info->label; ptr != NULL; ptr = ptr->next)
-               {
-                       if (ptr->lang) {
-                               if (strcmp(ptr->lang, locale) == 0) {
-                                       *label = (char *)ptr->text;
-                                       if (strcasecmp(*label, "(null)") == 0) {
-                                               locale = DEFAULT_LOCALE;
-                                               continue;
-                                       } else
-                                               break;
-                               } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
-                                       *label = (char *)ptr->text;
+       for(ptr = info->manifest_info->label; ptr != NULL; ptr = ptr->next)
+       {
+               if (ptr->lang) {
+                       if (strcmp(ptr->lang, locale) == 0) {
+                               *label = (char *)ptr->text;
+                               if (strcasecmp(*label, "(null)") == 0) {
+                                       locale = DEFAULT_LOCALE;
+                                       continue;
+                               } else
                                        break;
-                               }
+                       } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
+                               *label = (char *)ptr->text;
+                               break;
                        }
                }
        }
 
-catch:
-       pkgmgrinfo_appinfo_destroy_appinfo(apphandle);
        return ret;
 }
 
@@ -2477,9 +2684,11 @@ API int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **d
        char *locale = NULL;
        description_x *ptr = NULL;
        *description = NULL;
-       locale = glocale;
-       retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
+
        pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+       locale = info->locale;
+       retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
+
        for(ptr = info->manifest_info->description; ptr != NULL; ptr = ptr->next)
        {
                if (ptr->lang) {
@@ -2506,9 +2715,11 @@ API int pkgmgrinfo_pkginfo_get_author_name(pkgmgrinfo_pkginfo_h handle, char **a
        char *locale = NULL;
        author_x *ptr = NULL;
        *author_name = NULL;
-       locale = glocale;
-       retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
+
        pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+       locale = info->locale;
+       retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
+
        for(ptr = info->manifest_info->author; ptr != NULL; ptr = ptr->next)
        {
                if (ptr->lang) {
@@ -2551,55 +2762,16 @@ API int pkgmgrinfo_pkginfo_get_installed_storage(pkgmgrinfo_pkginfo_h handle, pk
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
        retvm_if(storage == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
 
-       char *pkgid = NULL;
-       pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
-       if (pkgid == NULL){
-                _LOGE("invalid func parameters\n");
-                return PMINFO_R_ERROR;
-       }
-
-       FILE *fp = NULL;
-       char app_mmc_path[FILENAME_MAX] = { 0, };
-       char app_dir_path[FILENAME_MAX] = { 0, };
-       char app_mmc_internal_path[FILENAME_MAX] = { 0, };
-       snprintf(app_dir_path, FILENAME_MAX,
-       "%s%s", PKG_INSTALLATION_PATH, pkgid);
-       snprintf(app_mmc_path, FILENAME_MAX,
-       "%s%s", PKG_SD_PATH, pkgid);
-       snprintf(app_mmc_internal_path, FILENAME_MAX,
-       "%s%s/.mmc", PKG_INSTALLATION_PATH, pkgid);
+       pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
 
-       /*check whether application is in external memory or not */
-       fp = fopen(app_mmc_path, "r");
-       if (fp == NULL) {
-               _LOGE(" app path in external memory not accesible\n");
-       } else {
-               fclose(fp);
-               fp = NULL;
-               *storage = PMINFO_EXTERNAL_STORAGE;
-               return PMINFO_R_OK;
-       }
+        if (strcmp(info->manifest_info->installed_storage,"installed_internal") == 0)
+               *storage = PMINFO_INTERNAL_STORAGE;
+        else if (strcmp(info->manifest_info->installed_storage,"installed_external") == 0)
+                *storage = PMINFO_EXTERNAL_STORAGE;
+        else
+                return PMINFO_R_ERROR;
 
-       /*check whether application is in internal or not */
-       fp = fopen(app_dir_path, "r");
-       if (fp == NULL) {
-               _LOGE(" app path in internal memory not accesible\n");
-               *storage = -1;
-               return PMINFO_R_ERROR;
-       } else {
-               fclose(fp);
-               /*check whether the application is installed in SD card
-                       but SD card is not present*/
-               fp = fopen(app_mmc_internal_path, "r");
-               if (fp == NULL) {
-                       *storage = PMINFO_INTERNAL_STORAGE;
-                       return PMINFO_R_OK;
-               } else {
-                       fclose(fp);
-                       *storage = PMINFO_EXTERNAL_STORAGE;
-                       return PMINFO_R_OK;
-               }
-       }
+       return PMINFO_R_OK;
 }
 
 API int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time)
@@ -2762,6 +2934,19 @@ API int pkgmgrinfo_pkginfo_get_root_path(pkgmgrinfo_pkginfo_h handle, char **pat
        return PMINFO_R_OK;
 }
 
+API int pkgmgrinfo_pkginfo_get_csc_path(pkgmgrinfo_pkginfo_h handle, char **path)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+       retvm_if(path == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+       pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+       if (info->manifest_info->csc_path)
+               *path = (char *)info->manifest_info->csc_path;
+       else
+               *path = (char *)info->manifest_info->csc_path;
+
+       return PMINFO_R_OK;
+}
 
 API int pkgmgrinfo_pkginfo_compare_pkg_cert_info(const char *lhs_package_id, const char *rhs_package_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
 {
@@ -2975,6 +3160,8 @@ API int pkgmgrinfo_pkginfo_is_accessible(pkgmgrinfo_pkginfo_h handle, bool *acce
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
        retvm_if(accessible == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+#if 0 //smack issue occured, check later
        char *pkgid = NULL;
        pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
        if (pkgid == NULL){
@@ -3027,6 +3214,9 @@ API int pkgmgrinfo_pkginfo_is_accessible(pkgmgrinfo_pkginfo_h handle, bool *acce
        }
 
        _LOGD("pkgmgr_get_pkg_external_validation() end\n");
+#endif
+
+       *accessible = 1;
        return PMINFO_R_OK;
 }
 
@@ -3087,6 +3277,25 @@ API int pkgmgrinfo_pkginfo_is_preload(pkgmgrinfo_pkginfo_h handle, bool *preload
        return PMINFO_R_OK;
 }
 
+API int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+       retvm_if(system == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+       char *preload = NULL;
+       char *removable = NULL;
+       pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+       preload = (char *)info->manifest_info->preload;
+       removable = (char *)info->manifest_info->removable;
+
+       if ((strcasecmp(preload, "true") == 0) && (strcasecmp(removable, "false") == 0))
+               *system = 1;
+       else
+               *system = 0;
+
+       return PMINFO_R_OK;
+}
+
 API int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
@@ -3318,7 +3527,7 @@ API int pkgmgrinfo_pkginfo_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int
                free(syslocale);
                return PMINFO_R_ERROR;
        }
-       strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX - 1);
+
        ret = __open_manifest_db();
        if (ret == -1) {
                _LOGE("Fail to open manifest DB\n");
@@ -3410,7 +3619,7 @@ API int pkgmgrinfo_pkginfo_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h ha
                free(syslocale);
                return PMINFO_R_ERROR;
        }
-       strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX  - 1);
+
        ret = __open_manifest_db();
        if (ret == -1) {
                _LOGE("Fail to open manifest DB\n");
@@ -3460,6 +3669,7 @@ API int pkgmgrinfo_pkginfo_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h ha
        LISTHEAD(tmphead, node);
        for(node = node->next ; node ; node = node->next) {
                pkginfo = node;
+               pkginfo->locale = strdup(locale);
                pkginfo->manifest_info->privileges = (privileges_x *)calloc(1, sizeof(privileges_x));
                if (pkginfo->manifest_info->privileges == NULL) {
                        _LOGE("Failed to allocate memory for privileges info\n");
@@ -3550,9 +3760,11 @@ API int pkgmgrinfo_pkginfo_foreach_privilege(pkgmgrinfo_pkginfo_h handle,
        pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
        ptr = info->manifest_info->privileges->privilege;
        for (; ptr; ptr = ptr->next) {
-               ret = privilege_func(ptr->text, user_data);
-               if (ret < 0)
-                       break;
+               if (ptr->text){
+                       ret = privilege_func(ptr->text, user_data);
+                       if (ret < 0)
+                               break;
+               }
        }
        return PMINFO_R_OK;
 }
@@ -3588,7 +3800,6 @@ API int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_
        tryvm_if(locale == NULL, ret = PMINFO_R_EINVAL, "manifest locale is NULL");
 
        /*calloc allinfo*/
-       strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX  - 1);
        allinfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
        tryvm_if(allinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
 
@@ -3634,6 +3845,7 @@ API int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_
                /*If the callback func return < 0 we break and no more call back is called*/
                while(tmp != NULL)
                {
+                       appinfo->locale = strdup(locale);
                        appinfo->uiapp_info = tmp;
                        if (strcmp(appinfo->uiapp_info->type,"c++app") == 0){
                                if (locale) {
@@ -3708,6 +3920,7 @@ API int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_
                /*If the callback func return < 0 we break and no more call back is called*/
                while(tmp1 != NULL)
                {
+                       appinfo->locale = strdup(locale);
                        appinfo->svcapp_info = tmp1;
                        memset(query, '\0', MAX_QUERY_LEN);
                        snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, locale);
@@ -3764,6 +3977,7 @@ API int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_
                /*If the callback func return < 0 we break and no more call back is called*/
                while(tmp2 != NULL)
                {
+                       appinfo->locale = strdup(locale);
                        appinfo->uiapp_info = tmp2;
                        memset(query, '\0', MAX_QUERY_LEN);
                        snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, locale);
@@ -3828,6 +4042,7 @@ API int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_
                /*If the callback func return < 0 we break and no more call back is called*/
                while(tmp3 != NULL)
                {
+                       appinfo->locale = strdup(locale);
                        appinfo->svcapp_info = tmp3;
                        memset(query, '\0', MAX_QUERY_LEN);
                        snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->svcapp_info->appid, locale);
@@ -3893,6 +4108,65 @@ 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);
+               appinfo->app_component = PMINFO_UI_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");
@@ -3925,7 +4199,6 @@ API int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, v
        retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
 
        /*calloc pkginfo*/
-       strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX  - 1);
        pkgmgr_pkginfo_x *info = NULL;
        info = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
        tryvm_if(info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
@@ -3954,6 +4227,7 @@ API int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, v
        /*UI Apps*/
        for(ptr1 = info->manifest_info->uiapplication; ptr1; ptr1 = ptr1->next)
        {
+               appinfo->locale = strdup(locale);
                appinfo->app_component = PMINFO_UI_APP;
                appinfo->package = strdup(ptr1->package);
                appinfo->uiapp_info = ptr1;
@@ -4032,6 +4306,7 @@ API int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, v
        /*Service Apps*/
        for(ptr2 = info->manifest_info->serviceapplication; ptr2; ptr2 = ptr2->next)
        {
+               appinfo->locale = strdup(locale);
                appinfo->app_component = PMINFO_SVC_APP;
                appinfo->package = strdup(ptr2->package);
                appinfo->svcapp_info = ptr2;
@@ -4142,7 +4417,6 @@ API int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *
        tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
 
        /*calloc appinfo*/
-       strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX - 1);
        appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
        tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
 
@@ -4160,6 +4434,7 @@ API int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *
                appinfo->svcapp_info = (serviceapplication_x *)calloc(1, sizeof(serviceapplication_x));
                tryvm_if(appinfo->svcapp_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for svcapp info");
        }
+       appinfo->locale = strdup(locale);
 
        /*populate app_info from DB*/
        memset(query, '\0', MAX_QUERY_LEN);
@@ -4343,9 +4618,11 @@ API int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h  handle, char **icon)
         icon_x *ptr = NULL;
         icon_x *start = NULL;
         *icon = NULL;
-       locale= glocale;
-       retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
+
         pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+               locale = info->locale;
+               retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
+
         if (info->app_component == PMINFO_UI_APP)
                 start = info->uiapp_info->icon;
         if (info->app_component == PMINFO_SVC_APP)
@@ -4378,9 +4655,11 @@ API int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h  handle, char **label)
        label_x *ptr = NULL;
        label_x *start = NULL;
        *label = NULL;
-       locale = glocale;
-       retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
+
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+       locale = info->locale;
+       retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
+
        if (info->app_component == PMINFO_UI_APP)
                start = info->uiapp_info->label;
        if (info->app_component == PMINFO_SVC_APP)
@@ -4478,6 +4757,18 @@ API int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h  handle,
        return PMINFO_R_OK;
 }
 
+API int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h  handle,
+                                       int *subapp_count, char ***subapp)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+       retvm_if(subapp == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(subapp_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
+       *subapp_count = data->subapp_count;
+       *subapp = data->subapp;
+       return PMINFO_R_OK;
+}
+
 API int pkgmgrinfo_appinfo_get_setting_icon(pkgmgrinfo_appinfo_h  handle, char **icon)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
@@ -4568,7 +4859,7 @@ API int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h  handle, char
                        val = (char *)ptr->section;
 
                        if (strcmp(val, "preview") == 0)
-                               *preview_img = (char *)info->uiapp_info->image->text;
+                               *preview_img = (char *)ptr->text;
 
                        break;
                }
@@ -4582,31 +4873,111 @@ 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;
-       else if (info->app_component == PMINFO_SVC_APP)
-               start = info->svcapp_info->permission;
+       val = info->uiapp_info->permission_type;
+
+       if (strcmp(val, "signature") == 0)
+               *permission = PMINFO_PERMISSION_SIGNATURE;
+       else if (strcmp(val, "privilege") == 0)
+               *permission = PMINFO_PERMISSION_PRIVILEGE;
        else
-               return PMINFO_R_EINVAL;
+               *permission = PMINFO_PERMISSION_NORMAL;
 
-       for(ptr = start; ptr != NULL; ptr = ptr->next)
-       {
-               if (ptr->type) {
-                       val = (char *)ptr->type;
+       return PMINFO_R_OK;
+}
 
-                       if (strcmp(val, "signature") == 0)
-                               *permission = PMINFO_PERMISSION_SIGNATURE;
-                       else if (strcmp(val, "privilege") == 0)
-                               *permission = PMINFO_PERMISSION_PRIVILEGE;
-                       else
-                               *permission = PMINFO_PERMISSION_NORMAL;
+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_get_hwacceleration(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_hwacceleration *hwacceleration)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+       retvm_if(hwacceleration == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       char *val = NULL;
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+       val = (char *)info->uiapp_info->hwacceleration;
+       if (val) {
+               if (strcasecmp(val, "not-use-GL") == 0)
+                       *hwacceleration = PMINFO_HWACCELERATION_NOT_USE_GL;
+               else if (strcasecmp(val, "use-GL") == 0)
+                       *hwacceleration = PMINFO_HWACCELERATION_USE_GL;
+               else
+                       *hwacceleration = PMINFO_HWACCELERATION_USE_SYSTEM_SETTING;
+       }
+       return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_screenreader *screenreader)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+       retvm_if(screenreader == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       char *val = NULL;
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+       val = (char *)info->uiapp_info->screenreader;
+       if (val) {
+               if (strcasecmp(val, "screenreader-off") == 0)
+                       *screenreader = PMINFO_SCREENREADER_OFF;
+               else if (strcasecmp(val, "screenreader-on") == 0)
+                       *screenreader = PMINFO_SCREENREADER_ON;
+               else
+                       *screenreader = PMINFO_SCREENREADER_USE_SYSTEM_SETTING;
+       }
+       return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h  handle, char **portrait_img, char **landscape_img)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+       retvm_if(portrait_img == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(landscape_img == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+       if (info->app_component == PMINFO_UI_APP){
+               *portrait_img = (char *)info->uiapp_info->portraitimg;
+               *landscape_img = (char *)info->uiapp_info->landscapeimg;
+       }
+
+       return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h  handle, char **submode_mainid)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+       retvm_if(submode_mainid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+       *submode_mainid = (char *)info->uiapp_info->submode_mainid;
+
+       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;
 }
@@ -4648,9 +5019,11 @@ API int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
        else
                return PMINFO_R_EINVAL;
        for (; ptr; ptr = ptr->next) {
-               ret = metadata_func(ptr->key, ptr->value, user_data);
-               if (ret < 0)
-                       break;
+               if (ptr->key) {
+                       ret = metadata_func(ptr->key, ptr->value, user_data);
+                       if (ret < 0)
+                               break;
+               }
        }
        return PMINFO_R_OK;
 }
@@ -4665,16 +5038,19 @@ API int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
        int oc = 0;
        int mc = 0;
        int uc = 0;
+       int sc = 0;
        char *pkgid = NULL;
        char *manifest = NULL;
        char **operation = NULL;
        char **uri = NULL;
        char **mime = NULL;
+       char **subapp = NULL;
        appcontrol_x *appcontrol = NULL;
        manifest_x *mfx = NULL;
        operation_x *op = NULL;
        uri_x *ui = NULL;
        mime_x *mi = NULL;
+       subapp_x *sa = NULL;
        pkgmgrinfo_app_component component;
        pkgmgrinfo_appcontrol_x *ptr = NULL;
        ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid);
@@ -4710,15 +5086,15 @@ API int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
        switch (component) {
        case PMINFO_UI_APP:
                if (mfx->uiapplication) {
-                       if (mfx->uiapplication->appcontrol) {
-                               appcontrol = mfx->uiapplication->appcontrol;
+                       if (mfx->uiapplication->appsvc) {
+                               appcontrol = mfx->uiapplication->appsvc;
                        }
                }
                break;
        case PMINFO_SVC_APP:
                if (mfx->serviceapplication) {
-                       if (mfx->serviceapplication->appcontrol) {
-                               appcontrol = mfx->serviceapplication->appcontrol;
+                       if (mfx->serviceapplication->appsvc) {
+                               appcontrol = mfx->serviceapplication->appsvc;
                        }
                }
                break;
@@ -4741,6 +5117,11 @@ API int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
                        mc = mc + 1;
                mi = appcontrol->mime;
 
+               sa = appcontrol->subapp;
+               for (; sa; sa = sa->next)
+                       sc = sc + 1;
+               sa = appcontrol->subapp;
+
                operation = (char **)calloc(oc, sizeof(char *));
                for (i = 0; i < oc; i++) {
                        operation[i] = strndup(op->name, PKG_STRING_LEN_MAX - 1);
@@ -4758,13 +5139,23 @@ API int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
                        mime[i] = strndup(mi->name, PKG_STRING_LEN_MAX - 1);
                        mi = mi->next;
                }
+
+               subapp = (char **)calloc(sc, sizeof(char *));
+               for (i = 0; i < sc; i++) {
+                       subapp[i] = strndup(sa->name, PKG_STRING_LEN_MAX - 1);
+                       sa = sa->next;
+               }
+
                /*populate appcontrol handle*/
                ptr->operation_count = oc;
                ptr->uri_count = uc;
                ptr->mime_count = mc;
+               ptr->subapp_count = sc;
                ptr->operation = operation;
                ptr->uri = uri;
                ptr->mime = mime;
+               ptr->subapp = subapp;
+
                ret = appcontrol_func((void *)ptr, user_data);
                for (i = 0; i < oc; i++) {
                        if (operation[i]) {
@@ -4796,11 +5187,22 @@ API int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
                        free(mime);
                        mime = NULL;
                }
+               for (i = 0; i < sc; i++) {
+                       if (subapp[i]) {
+                               free(subapp[i]);
+                               subapp[i] = NULL;
+                       }
+               }
+               if (subapp) {
+                       free(subapp);
+                       subapp = NULL;
+               }
                if (ret < 0)
                        break;
                uc = 0;
                mc = 0;
                oc = 0;
+               sc = 0;
        }
        pkgmgr_parser_free_manifest_xml(mfx);
        if (ptr) {
@@ -4865,22 +5267,6 @@ API int pkgmgrinfo_appinfo_is_indicator_display_allowed(pkgmgrinfo_appinfo_h han
        return PMINFO_R_OK;
 }
 
-
-API int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h  handle, char **portrait_img, char **landscape_img)
-{
-       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(portrait_img == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       retvm_if(landscape_img == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
-
-       if (info->app_component == PMINFO_UI_APP){
-               *portrait_img = (char *)info->uiapp_info->portraitimg;
-               *landscape_img = (char *)info->uiapp_info->landscapeimg;
-       }
-
-       return PMINFO_R_OK;
-}
-
 API int pkgmgrinfo_appinfo_is_taskmanage(pkgmgrinfo_appinfo_h  handle, bool *taskmanage)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
@@ -4926,24 +5312,6 @@ API int pkgmgrinfo_appinfo_is_enabled(pkgmgrinfo_appinfo_h  handle, bool *enable
 
 }
 
-API int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_hwacceleration *hwacceleration)
-{
-       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(hwacceleration == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       char *val = NULL;
-       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
-       val = (char *)info->uiapp_info->hwacceleration;
-       if (val) {
-               if (strcasecmp(val, "not-use-GL") == 0)
-                       *hwacceleration = PMINFO_HWACCELERATION_NOT_USE_GL;
-               else if (strcasecmp(val, "use-GL") == 0)
-                       *hwacceleration = PMINFO_HWACCELERATION_USE_GL;
-               else
-                       *hwacceleration = PMINFO_HWACCELERATION_USE_SYSTEM_SETTING;
-       }
-       return PMINFO_R_OK;
-}
-
 API int pkgmgrinfo_appinfo_is_onboot(pkgmgrinfo_appinfo_h  handle, bool *onboot)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
@@ -4998,6 +5366,42 @@ API int pkgmgrinfo_appinfo_is_mainapp(pkgmgrinfo_appinfo_h  handle, bool *mainap
        return PMINFO_R_OK;
 }
 
+API int pkgmgrinfo_appinfo_is_preload(pkgmgrinfo_appinfo_h handle, bool *preload)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+       retvm_if(preload == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+       char *val = NULL;
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+       val = (char *)info->uiapp_info->preload;
+       if (val) {
+               if (strcasecmp(val, "true") == 0)
+                       *preload = 1;
+               else if (strcasecmp(val, "false") == 0)
+                       *preload = 0;
+               else
+                       *preload = 0;
+       }
+       return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+       retvm_if(submode == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+       char *val = NULL;
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+       val = (char *)info->uiapp_info->submode;
+       if (val) {
+               if (strcasecmp(val, "true") == 0)
+                       *submode = 1;
+               else if (strcasecmp(val, "false") == 0)
+                       *submode = 0;
+               else
+                       *submode = 0;
+       }
+       return PMINFO_R_OK;
+}
+
 API int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h  handle)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
@@ -5205,7 +5609,7 @@ API int pkgmgrinfo_appinfo_filter_count(pkgmgrinfo_appinfo_filter_h handle, int
                free(syslocale);
                return PMINFO_R_ERROR;
        }
-       strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX - 1);
+
        ret = __open_manifest_db();
        if (ret == -1) {
                _LOGE("Fail to open manifest DB\n");
@@ -5290,7 +5694,7 @@ API int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h ha
                free(syslocale);
                return PMINFO_R_ERROR;
        }
-       strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX - 1);
+
        ret = __open_manifest_db();
        if (ret == -1) {
                _LOGE("Fail to open manifest DB\n");
@@ -5407,6 +5811,7 @@ API int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h ha
        /*If the callback func return < 0 we break and no more call back is called*/
        while(ptr1 != NULL)
        {
+               appinfo->locale = strdup(locale);
                appinfo->uiapp_info = ptr1;
                appinfo->app_component = PMINFO_UI_APP;
                ret = app_cb((void *)appinfo, user_data);
@@ -5422,6 +5827,7 @@ API int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h ha
        /*If the callback func return < 0 we break and no more call back is called*/
        while(ptr2 != NULL)
        {
+               appinfo->locale = strdup(locale);
                appinfo->svcapp_info = ptr2;
                appinfo->app_component = PMINFO_SVC_APP;
                ret = app_cb((void *)appinfo, user_data);
@@ -5524,7 +5930,7 @@ API int pkgmgrinfo_appinfo_metadata_filter_foreach(pkgmgrinfo_appinfo_metadata_f
        retvm_if(syslocale == NULL, PMINFO_R_ERROR, "current locale is NULL\n");
        locale = __convert_system_locale_to_manifest_locale(syslocale);
        tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL\n");
-       strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX - 1);
+
        ret = __open_manifest_db();
        tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Fail to open manifest DB\n");
 
@@ -5605,6 +6011,7 @@ API int pkgmgrinfo_appinfo_metadata_filter_foreach(pkgmgrinfo_appinfo_metadata_f
        /*If the callback func return < 0 we break and no more call back is called*/
        while(ptr1 != NULL)
        {
+               appinfo->locale = strdup(locale);
                appinfo->uiapp_info = ptr1;
                appinfo->app_component = PMINFO_UI_APP;
                ret = app_cb((void *)appinfo, user_data);
@@ -5620,6 +6027,7 @@ API int pkgmgrinfo_appinfo_metadata_filter_foreach(pkgmgrinfo_appinfo_metadata_f
        /*If the callback func return < 0 we break and no more call back is called*/
        while(ptr2 != NULL)
        {
+               appinfo->locale = strdup(locale);
                appinfo->svcapp_info = ptr2;
                appinfo->app_component = PMINFO_SVC_APP;
                ret = app_cb((void *)appinfo, user_data);