Release version 0.23.2
[platform/core/appfw/pkgmgr-info.git] / src / pkgmgrinfo_appinfo.c
index c083171..ad481a3 100644 (file)
@@ -7,13 +7,13 @@
 #include <sys/types.h>
 #include <dlfcn.h>
 
-#include <sqlite3.h>
 #include <glib.h>
 
 #include "pkgmgr-info.h"
 #include "pkgmgrinfo_debug.h"
 #include "pkgmgrinfo_private.h"
 #include "pkgmgr_parser.h"
+#include "manager/pkginfo_manager.h"
 
 static bool _get_bool_value(const char *str)
 {
@@ -36,396 +36,6 @@ static void __cleanup_appinfo(pkgmgr_appinfo_x *data)
                pkgmgrinfo_basic_free_application(info->app_info);
                free((void *)info);
        }
-       return;
-}
-
-static const char join_localized_info[] =
-       " LEFT OUTER JOIN package_app_localized_info"
-       "  ON ai.app_id=package_app_localized_info.app_id"
-       "  AND package_app_localized_info.app_locale=?";
-static const char join_category[] =
-       " LEFT OUTER JOIN package_app_app_category"
-       " ON ai.app_id=package_app_app_category.app_id";
-static const char join_app_control[] =
-       " LEFT OUTER JOIN package_app_app_control"
-       "  ON ai.app_id=package_app_app_control.app_id";
-static const char join_metadata[] =
-       " LEFT OUTER JOIN package_app_app_metadata"
-       "  ON ai.app_id=package_app_app_metadata.app_id ";
-
-static int _get_filtered_query(pkgmgrinfo_filter_x *filter,
-       const char *locale, char **query, GList **bind_params)
-{
-       int joined = 0;
-       size_t len = 0;
-       char *condition = NULL;
-       char buf[MAX_QUERY_LEN] = { '\0' };
-       char tmp_query[MAX_QUERY_LEN] = { '\0' };
-       static const char query_pkg_disable[] = " AND ai.package IN "
-                       "(SELECT package FROM package_info WHERE package_disable='false')";
-       GSList *list;
-
-       len += strlen(" WHERE 1=1");
-       strncat(buf, " WHERE 1=1", MAX_QUERY_LEN - len - 1);
-
-       if (filter == NULL) {
-               strncat(buf, query_pkg_disable, MAX_QUERY_LEN - len - 1);
-               *query = strdup(buf);
-               return PMINFO_R_OK;
-       }
-
-       for (list = filter->list; list; list = list->next) {
-               joined |= __get_filter_condition(list->data, &condition, bind_params);
-               if (condition == NULL)
-                       continue;
-
-               len += strlen(" AND ");
-               strncat(buf, " AND ", MAX_QUERY_LEN - len - 1);
-
-               len += strlen(condition);
-               strncat(buf, condition, sizeof(buf) - len - 1);
-               free(condition);
-               condition = NULL;
-       }
-
-       if (joined & E_PMINFO_APPINFO_JOIN_LOCALIZED_INFO) {
-               strncat(tmp_query, join_localized_info, MAX_QUERY_LEN - len - 1);
-               len += strlen(join_localized_info);
-               *bind_params = g_list_append(*bind_params, strdup(locale));
-       }
-       if (joined & E_PMINFO_APPINFO_JOIN_CATEGORY) {
-               strncat(tmp_query, join_category, MAX_QUERY_LEN - len - 1);
-               len += strlen(join_category);
-       }
-       if (joined & E_PMINFO_APPINFO_JOIN_APP_CONTROL) {
-               strncat(tmp_query, join_app_control, MAX_QUERY_LEN - len - 1);
-               len += strlen(join_app_control);
-       }
-       if (joined & E_PMINFO_APPINFO_JOIN_METADATA) {
-               strncat(tmp_query, join_metadata, MAX_QUERY_LEN - len - 1);
-               len += strlen(join_metadata);
-       }
-       strncat(tmp_query, buf, MAX_QUERY_LEN - len - 1);
-
-       len += strlen(buf);
-       strncat(tmp_query, query_pkg_disable, MAX_QUERY_LEN - len - 1);
-
-       *query = strdup(tmp_query);
-       if (*query == NULL)
-               return PMINFO_R_ERROR;
-
-       return PMINFO_R_OK;
-}
-
-static int _appinfo_get_category(sqlite3 *db, const char *appid,
-               GList **category)
-{
-       static const char query_raw[] =
-               "SELECT category FROM package_app_app_category WHERE app_id=%Q";
-       int ret;
-       char *query;
-       sqlite3_stmt *stmt;
-       char *val;
-
-       query = sqlite3_mprintf(query_raw, appid);
-       if (query == NULL) {
-               LOGE("out of memory");
-               return PMINFO_R_ERROR;
-       }
-
-       ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
-       sqlite3_free(query);
-       if (ret != SQLITE_OK) {
-               LOGE("prepare failed: %s", sqlite3_errmsg(db));
-               return PMINFO_R_ERROR;
-       }
-
-       while (sqlite3_step(stmt) == SQLITE_ROW) {
-               val = NULL;
-               _save_column_str(stmt, 0, &val);
-               if (val)
-                       *category = g_list_append(*category, (gpointer)val);
-       }
-
-       sqlite3_finalize(stmt);
-
-       return PMINFO_R_OK;
-}
-
-static void __parse_appcontrol(GList **appcontrol, char *appcontrol_str)
-{
-       char *dup;
-       char *token;
-       char *ptr = NULL;
-       appcontrol_x *ac;
-
-       if (appcontrol_str == NULL)
-               return;
-
-       dup = strdup(appcontrol_str);
-       do {
-               ac = calloc(1, sizeof(appcontrol_x));
-               if (ac == NULL) {
-                       _LOGE("out of memory");
-                       break;
-               }
-               token = strtok_r(dup, "|", &ptr);
-               if (token && strcmp(token, "NULL"))
-                       ac->operation = strdup(token);
-               token = strtok_r(NULL, "|", &ptr);
-               if (token && strcmp(token, "NULL"))
-                       ac->uri = strdup(token);
-               token = strtok_r(NULL, "|", &ptr);
-               if (token && strcmp(token, "NULL"))
-                       ac->mime = strdup(token);
-               *appcontrol = g_list_append(*appcontrol, ac);
-       } while ((token = strtok_r(NULL, ";", &ptr)));
-
-       free(dup);
-}
-
-static int _appinfo_get_app_control(sqlite3 *db, const char *appid,
-               GList **appcontrol)
-{
-       static const char query_raw[] =
-               "SELECT app_control FROM package_app_app_control "
-               "WHERE app_id=%Q";
-       int ret;
-       char *query;
-       sqlite3_stmt *stmt;
-       char *str;
-
-       query = sqlite3_mprintf(query_raw, appid);
-       if (query == NULL) {
-               LOGE("out of memory");
-               return PMINFO_R_ERROR;
-       }
-
-       ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
-       sqlite3_free(query);
-       if (ret != SQLITE_OK) {
-               LOGE("prepare failed: %s", sqlite3_errmsg(db));
-               return PMINFO_R_ERROR;
-       }
-
-       while (sqlite3_step(stmt) == SQLITE_ROW) {
-               str = NULL;
-               _save_column_str(stmt, 0, &str);
-               /* TODO: revise */
-               __parse_appcontrol(appcontrol, str);
-               free(str);
-       }
-
-       sqlite3_finalize(stmt);
-
-       return PMINFO_R_OK;
-}
-
-static int _appinfo_get_data_control(sqlite3 *db, const char *appid,
-               GList **datacontrol)
-{
-       static const char query_raw[] =
-               "SELECT providerid, access, type "
-               "FROM package_app_data_control WHERE app_id=%Q";
-       int ret;
-       char *query;
-       sqlite3_stmt *stmt;
-       int idx;
-       datacontrol_x *info;
-
-       query = sqlite3_mprintf(query_raw, appid);
-       if (query == NULL) {
-               LOGE("out of memory");
-               return PMINFO_R_ERROR;
-       }
-
-       ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
-       sqlite3_free(query);
-       if (ret != SQLITE_OK) {
-               LOGE("prepare failed: %s", sqlite3_errmsg(db));
-               return PMINFO_R_ERROR;
-       }
-
-       while (sqlite3_step(stmt) == SQLITE_ROW) {
-               info = calloc(1, sizeof(datacontrol_x));
-               if (info == NULL) {
-                       LOGE("out of memory");
-                       sqlite3_finalize(stmt);
-                       return PMINFO_R_ERROR;
-               }
-               idx = 0;
-               _save_column_str(stmt, idx++, &info->providerid);
-               _save_column_str(stmt, idx++, &info->access);
-               _save_column_str(stmt, idx++, &info->type);
-               *datacontrol = g_list_append(*datacontrol, info);
-       }
-
-       sqlite3_finalize(stmt);
-
-       return PMINFO_R_OK;
-}
-
-static int _appinfo_get_metadata(sqlite3 *db, const char *appid,
-               GList **metadata)
-{
-       static const char query_raw[] =
-               "SELECT md_key, md_value "
-               "FROM package_app_app_metadata WHERE app_id=%Q";
-       int ret;
-       char *query;
-       sqlite3_stmt *stmt;
-       int idx;
-       metadata_x *info;
-
-       query = sqlite3_mprintf(query_raw, appid);
-       if (query == NULL) {
-               LOGE("out of memory");
-               return PMINFO_R_ERROR;
-       }
-
-       ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
-       sqlite3_free(query);
-       if (ret != SQLITE_OK) {
-               LOGE("prepare failed: %s", sqlite3_errmsg(db));
-               return PMINFO_R_ERROR;
-       }
-
-       while (sqlite3_step(stmt) == SQLITE_ROW) {
-               info = calloc(1, sizeof(metadata_x));
-               if (info == NULL) {
-                       LOGE("out of memory");
-                       sqlite3_finalize(stmt);
-                       return PMINFO_R_ERROR;
-               }
-               idx = 0;
-               _save_column_str(stmt, idx++, &info->key);
-               _save_column_str(stmt, idx++, &info->value);
-               *metadata = g_list_append(*metadata, info);
-       }
-
-       sqlite3_finalize(stmt);
-
-       return PMINFO_R_OK;
-
-}
-
-static int _appinfo_get_splashscreens(sqlite3 *db, const char *appid,
-               GList **splashscreens)
-{
-       static const char query_raw[] =
-               "SELECT src, type, orientation, indicatordisplay, operation, color_depth "
-               "FROM package_app_splash_screen WHERE app_id=%Q";
-       int ret;
-       char *query;
-       sqlite3_stmt *stmt;
-       int idx;
-       splashscreen_x *info;
-
-       query = sqlite3_mprintf(query_raw, appid);
-       if (query == NULL) {
-               LOGE("out of memory");
-               return PMINFO_R_ERROR;
-       }
-
-       ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
-       sqlite3_free(query);
-       if (ret != SQLITE_OK) {
-               LOGE("prepare failed: %s", sqlite3_errmsg(db));
-               return PMINFO_R_ERROR;
-       }
-
-       while (sqlite3_step(stmt) == SQLITE_ROW) {
-               info = calloc(1, sizeof(splashscreen_x));
-               if (info == NULL) {
-                       LOGE("out of memory");
-                       sqlite3_finalize(stmt);
-                       return PMINFO_R_ERROR;
-               }
-               idx = 0;
-               _save_column_str(stmt, idx++, &info->src);
-               _save_column_str(stmt, idx++, &info->type);
-               _save_column_str(stmt, idx++, &info->orientation);
-               _save_column_str(stmt, idx++, &info->indicatordisplay);
-               _save_column_str(stmt, idx++, &info->operation);
-               _save_column_str(stmt, idx++, &info->color_depth);
-               *splashscreens = g_list_append(*splashscreens, info);
-       }
-
-       sqlite3_finalize(stmt);
-
-       return PMINFO_R_OK;
-}
-
-static GList *__get_background_category(const char *value)
-{
-       GList *category_list = NULL;
-       int convert_value = 0;
-       if (!value || strlen(value) == 0)
-               return NULL;
-
-       convert_value = atoi(value);
-       if (convert_value < 0)
-               return NULL;
-
-       if (convert_value & APP_BG_CATEGORY_USER_DISABLE_TRUE_VAL)
-               category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_USER_DISABLE_TRUE_STR));
-       else
-               category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_USER_DISABLE_FALSE_STR));
-
-       if (convert_value & APP_BG_CATEGORY_MEDIA_VAL)
-               category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_MEDIA_STR));
-
-       if (convert_value & APP_BG_CATEGORY_DOWNLOAD_VAL)
-               category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_DOWNLOAD_STR));
-
-       if (convert_value & APP_BG_CATEGORY_BGNETWORK_VAL)
-               category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_BGNETWORK_STR));
-
-       if (convert_value & APP_BG_CATEGORY_LOCATION_VAL)
-               category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_LOCATION_STR));
-
-       if (convert_value & APP_BG_CATEGORY_SENSOR_VAL)
-               category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_SENSOR_STR));
-
-       if (convert_value & APP_BG_CATEGORY_IOTCOMM_VAL)
-               category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_IOTCOMM_STR));
-
-       if (convert_value & APP_BG_CATEGORY_SYSTEM_VAL)
-               category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_SYSTEM));
-
-       return category_list;
-
-}
-
-static void __get_splash_screen_display(sqlite3 *db, const char *appid, uid_t uid, char **value)
-{
-       static const char query_raw[] =
-               "SELECT is_splash_screen_enabled FROM package_app_info_for_uid "
-               "WHERE app_id='%s' AND uid='%d'";
-       int ret;
-       char *query;
-       sqlite3_stmt *stmt;
-
-       query = sqlite3_mprintf(query_raw, appid, uid);
-       if (query == NULL) {
-               LOGE("out of memory");
-               return;
-       }
-
-       ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
-       sqlite3_free(query);
-       if (ret != SQLITE_OK) {
-               LOGE("sqlite3_prepare_v2() failed: %s", sqlite3_errmsg(db));
-               return;
-       }
-
-       while (sqlite3_step(stmt) == SQLITE_ROW) {
-               if (*value)
-                       free(*value);
-               _save_column_str(stmt, 0, value);
-       }
-
-       sqlite3_finalize(stmt);
 }
 
 static void __free_applications(gpointer data)
@@ -433,341 +43,64 @@ static void __free_applications(gpointer data)
        pkgmgrinfo_basic_free_application((application_x *)data);
 }
 
-static int __bind_params(sqlite3_stmt *stmt, GList *params)
+static gint __disable_chk_func(gconstpointer data1, gconstpointer data2)
 {
-       GList *tmp_list = NULL;
-       int idx = 0;
-       int ret;
-
-       if (stmt == NULL || params == NULL)
-               return PMINFO_R_EINVAL;
-
-       tmp_list = params;
-       while (tmp_list) {
-               ret = sqlite3_bind_text(stmt, ++idx, (char *)tmp_list->data, -1, SQLITE_STATIC);
-               if (ret != SQLITE_OK)
-                       return PMINFO_R_ERROR;
-               tmp_list = tmp_list->next;
-       }
+       pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x *)data1;
+       pkgmgrinfo_appinfo_disable_type value = GPOINTER_TO_INT(data2);
 
-       return PMINFO_R_OK;
+       if (value == E_APPINFO_DISABLE_TYPE_PKG)
+               return (node->prop == E_PMINFO_APPINFO_PROP_PKG_DISABLE)
+                               ? 0 : 1;
+       else
+               return (node->prop == E_PMINFO_APPINFO_PROP_APP_DISABLE)
+                               ? 0 : 1;
 }
 
-static bool __check_app_storage_status(pkgmgrinfo_filter_x *tmp_filter)
+static bool __check_disable_filter_exist(pkgmgrinfo_filter_x *filter,
+               pkgmgrinfo_appinfo_disable_type type)
 {
-       GSList *tmp_list = NULL;
-       pkgmgrinfo_node_x *tmp_node = NULL;
-       int property = -1;
-
-       if (tmp_filter == NULL)
-               return true;
-
-       property = _pminfo_appinfo_convert_to_prop_bool(PMINFO_APPINFO_PROP_APP_CHECK_STORAGE);
-       for (tmp_list = tmp_filter->list; tmp_list != NULL;
-                       tmp_list = g_slist_next(tmp_list)) {
-               tmp_node = (pkgmgrinfo_node_x *)tmp_list->data;
-               if (property == tmp_node->prop) {
-                       if (strcmp(tmp_node->value, "true") == 0)
-                               return true;
-                       else
-                               return false;
-               }
-       }
-
-       return true;
-}
-
-static int _appinfo_get_applications(uid_t db_uid, uid_t uid,
-               const char *locale, pkgmgrinfo_filter_x *filter, int flag,
-               GHashTable *applications)
-{
-       static const char query_raw[] =
-               "SELECT DISTINCT ai.app_id, ai.app_component, ai.app_exec, "
-               "ai.app_nodisplay, ai.app_type, ai.app_onboot, "
-               "ai.app_multiple, ai.app_autorestart, ai.app_taskmanage, "
-               "ai.app_enabled, ai.app_hwacceleration, ai.app_screenreader, "
-               "ai.app_mainapp, ai.app_recentimage, ai.app_launchcondition, "
-               "ai.app_indicatordisplay, ai.app_portraitimg, "
-               "ai.app_landscapeimg, ai.app_guestmodevisibility, "
-               "ai.app_permissiontype, ai.app_preload, ai.app_submode, "
-               "ai.app_submode_mainid, ai.app_launch_mode, ai.app_ui_gadget, "
-               "ai.app_support_disable, ai.app_process_pool, "
-               "ai.app_installed_storage, ai.app_background_category, "
-               "ai.app_package_type, ai.app_root_path, ai.app_api_version, "
-               "ai.app_effective_appid, ai.app_disable, "
-               "ai.app_splash_screen_display, ai.app_tep_name, "
-               "ai.app_zip_mount_file, ai.component_type, ai.package, "
-               "ai.app_external_path, ai.app_package_system, ai.app_removable, "
-               "ai.app_package_installed_time, ai.app_support_mode, "
-               "ai.app_support_ambient";
-       static const char query_label[] =
-               ", COALESCE("
-               "(SELECT app_label FROM package_app_localized_info WHERE ai.app_id=app_id AND app_locale=?), "
-               "(SELECT app_label FROM package_app_localized_info WHERE ai.app_id=app_id AND app_locale='No Locale'))";
-       static const char query_icon[] =
-               ", COALESCE("
-               "(SELECT app_icon FROM package_app_localized_info WHERE ai.app_id=app_id AND app_locale=?), "
-               "(SELECT app_icon FROM package_app_localized_info WHERE ai.app_id=app_id AND app_locale='No Locale'))";
-       static const char query_from_clause[] = " FROM package_app_info as ai";
-       int ret = PMINFO_R_ERROR;
-       int idx;
-       int len = 0;
-       char *dbpath;
-       char *bg_category_str = NULL;
-       char *constraint = NULL;
-       char *tmp_record = NULL;
-       char query[MAX_QUERY_LEN] = { '\0' };
-       application_x *info = NULL;
-       GList *bind_params = NULL;
-       sqlite3 *db = NULL;
-       sqlite3_stmt *stmt = NULL;
-       bool is_check_storage = true;
-
-       dbpath = getUserPkgParserDBPathUID(db_uid);
-       if (dbpath == NULL)
-               return PMINFO_R_ERROR;
-
-       ret = sqlite3_open_v2(dbpath, &db, SQLITE_OPEN_READONLY, NULL);
-       if (ret != SQLITE_OK) {
-               _LOGE("failed to open db: %d", ret);
-               free(dbpath);
-               return PMINFO_R_ERROR;
-       }
-       free(dbpath);
-
-       len = strlen(query_raw);
-       snprintf(query, MAX_QUERY_LEN - 1, "%s", query_raw);
-       if (flag & PMINFO_APPINFO_GET_LABEL) {
-               strncat(query, query_label, MAX_QUERY_LEN - len - 1);
-               len += strlen(query_label);
-               bind_params = g_list_append(bind_params, strdup(locale));
-       }
-       if (flag & PMINFO_APPINFO_GET_ICON) {
-               strncat(query, query_icon, MAX_QUERY_LEN - len - 1);
-               len += strlen(query_icon);
-               bind_params = g_list_append(bind_params, strdup(locale));
-       }
-
-       is_check_storage = __check_app_storage_status(filter);
-
-       ret = _get_filtered_query(filter, locale, &constraint, &bind_params);
-       if (ret != PMINFO_R_OK) {
-               LOGE("Failed to get WHERE clause");
-               goto catch;
-       }
-       strncat(query, query_from_clause, MAX_QUERY_LEN - len - 1);
-       len += strlen(query_from_clause);
-
-       if (constraint)
-               strncat(query, constraint, MAX_QUERY_LEN - len - 1);
-
-       ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
-       if (ret != SQLITE_OK) {
-               LOGE("prepare failed: %s", sqlite3_errmsg(db));
-               ret = PMINFO_R_ERROR;
-               goto catch;
-       }
-
-       if (g_list_length(bind_params) != 0) {
-               ret = __bind_params(stmt, bind_params);
-               if (ret != SQLITE_OK) {
-                       LOGE("Failed to bind parameters");
-                       goto catch;
-               }
-       }
-
-       while (sqlite3_step(stmt) == SQLITE_ROW) {
-               info = calloc(1, sizeof(application_x));
-               if (info == NULL) {
-                       LOGE("out of memory");
-                       ret = PMINFO_R_ERROR;
-                       goto catch;
-               }
-               idx = 0;
-               _save_column_str(stmt, idx++, &info->appid);
-               if (g_hash_table_contains(applications,
-                                       (gconstpointer)info->appid)) {
-                       free(info->appid);
-                       free(info);
-                       info = NULL;
-                       continue;
-               }
-               _save_column_str(stmt, idx++, &info->component);
-               _save_column_str(stmt, idx++, &info->exec);
-               _save_column_str(stmt, idx++, &info->nodisplay);
-               _save_column_str(stmt, idx++, &info->type);
-               _save_column_str(stmt, idx++, &info->onboot);
-               _save_column_str(stmt, idx++, &info->multiple);
-               _save_column_str(stmt, idx++, &info->autorestart);
-               _save_column_str(stmt, idx++, &info->taskmanage);
-               _save_column_str(stmt, idx++, &info->enabled);
-               _save_column_str(stmt, idx++, &info->hwacceleration);
-               _save_column_str(stmt, idx++, &info->screenreader);
-               _save_column_str(stmt, idx++, &info->mainapp);
-               _save_column_str(stmt, idx++, &info->recentimage);
-               _save_column_str(stmt, idx++, &info->launchcondition);
-               _save_column_str(stmt, idx++, &info->indicatordisplay);
-               _save_column_str(stmt, idx++, &info->portraitimg);
-               _save_column_str(stmt, idx++, &info->landscapeimg);
-               _save_column_str(stmt, idx++, &info->guestmode_visibility);
-               _save_column_str(stmt, idx++, &info->permission_type);
-               _save_column_str(stmt, idx++, &info->preload);
-               _save_column_str(stmt, idx++, &info->submode);
-               _save_column_str(stmt, idx++, &info->submode_mainid);
-               _save_column_str(stmt, idx++, &info->launch_mode);
-               _save_column_str(stmt, idx++, &info->ui_gadget);
-               _save_column_str(stmt, idx++, &info->support_disable);
-               _save_column_str(stmt, idx++, &info->process_pool);
-               _save_column_str(stmt, idx++, &info->installed_storage);
-               _save_column_str(stmt, idx++, &bg_category_str);
-               _save_column_str(stmt, idx++, &info->package_type);
-               _save_column_str(stmt, idx++, &info->root_path);
-               _save_column_str(stmt, idx++, &info->api_version);
-               _save_column_str(stmt, idx++, &info->effective_appid);
-               _save_column_str(stmt, idx++, &info->is_disabled);
-               _save_column_str(stmt, idx++, &info->splash_screen_display);
-               _save_column_str(stmt, idx++, &info->tep_name);
-               _save_column_str(stmt, idx++, &info->zip_mount_file);
-               _save_column_str(stmt, idx++, &info->component_type);
-               _save_column_str(stmt, idx++, &info->package);
-               _save_column_str(stmt, idx++, &info->external_path);
-               _save_column_str(stmt, idx++, &info->package_system);
-               _save_column_str(stmt, idx++, &info->removable);
-               _save_column_str(stmt, idx++, &info->package_installed_time);
-               _save_column_str(stmt, idx++, &info->support_mode);
-               _save_column_str(stmt, idx++, &info->support_ambient);
-
-               info->for_all_users =
-                       strdup((uid != GLOBAL_USER) ? "false" : "true");
-
-               if (db_uid == GLOBAL_USER)
-                       __get_splash_screen_display(db, info->appid, db_uid,
-                                       &info->splash_screen_display);
-
-               info->background_category = __get_background_category(
-                               bg_category_str);
-               free(bg_category_str);
-
-               if (flag & PMINFO_APPINFO_GET_LABEL) {
-                       tmp_record = NULL;
-                       _save_column_str(stmt, idx++, &tmp_record);
-                       if (_add_label_info_into_list(locale, tmp_record, &info->label)) {
-                               ret = PMINFO_R_ERROR;
-                               goto catch;
-                       }
-               }
-
-               if (flag & PMINFO_APPINFO_GET_ICON) {
-                       tmp_record = NULL;
-                       _save_column_str(stmt, idx++, &tmp_record);
-                       if (_add_icon_info_into_list(locale, tmp_record, &info->icon)) {
-                               ret = PMINFO_R_ERROR;
-                               goto catch;
-                       }
-               }
-
-               if (flag & PMINFO_APPINFO_GET_CATEGORY) {
-                       if (_appinfo_get_category(db, info->appid,
-                                               &info->category)) {
-                               ret = PMINFO_R_ERROR;
-                               goto catch;
-                       }
-               }
-
-               if (flag & PMINFO_APPINFO_GET_APP_CONTROL) {
-                       if (_appinfo_get_app_control(db, info->appid,
-                                               &info->appcontrol)) {
-                               ret = PMINFO_R_ERROR;
-                               goto catch;
-                       }
-               }
-
-               if (flag & PMINFO_APPINFO_GET_DATA_CONTROL) {
-                       if (_appinfo_get_data_control(db, info->appid,
-                                               &info->datacontrol)) {
-                               ret = PMINFO_R_ERROR;
-                               goto catch;
-                       }
-               }
-
-               if (flag & PMINFO_APPINFO_GET_METADATA) {
-                       if (_appinfo_get_metadata(db, info->appid,
-                                               &info->metadata)) {
-                               ret = PMINFO_R_ERROR;
-                               goto catch;
-                       }
-               }
-
-               if (flag & PMINFO_APPINFO_GET_SPLASH_SCREEN) {
-                       if (_appinfo_get_splashscreens(db, info->appid,
-                                               &info->splashscreens)) {
-                               ret = PMINFO_R_ERROR;
-                               goto catch;
-                       }
-               }
-
-               if (is_check_storage &&
-                               __appinfo_check_installed_storage(info) != PMINFO_R_OK) {
-                       ret = PMINFO_R_ERROR;
-                       pkgmgrinfo_basic_free_application(info);
-                       info = NULL;
-                       continue;
-               }
-
-               g_hash_table_insert(applications, (gpointer)info->appid,
-                               (gpointer)info);
-       }
+       GSList *link;
 
-       ret = PMINFO_R_OK;
-
-catch:
-       if (constraint)
-               free(constraint);
-
-       if (ret != PMINFO_R_OK && info != NULL)
-               pkgmgrinfo_basic_free_application(info);
+       if (filter == NULL)
+               return false;
 
-       g_list_free_full(bind_params, free);
-       sqlite3_close_v2(db);
-       sqlite3_finalize(stmt);
+       link = g_slist_find_custom(filter->list,
+                       GINT_TO_POINTER(type), __disable_chk_func);
+       if (link)
+               return true;
 
-       return ret;
+       return false;
 }
 
 static int _pkgmgrinfo_get_appinfo(const char *appid, uid_t uid,
        pkgmgrinfo_appinfo_filter_h filter, pkgmgrinfo_appinfo_h *handle)
 {
-       int ret;
-       char *locale;
+       int ret = PMINFO_R_OK;
        GHashTable *list;
        pkgmgr_appinfo_x *info;
 
        if (appid == NULL || filter == NULL || handle == NULL) {
-                       LOGE("invalid parameter");
-                       return PMINFO_R_EINVAL;
+               LOGE("invalid parameter");
+               return PMINFO_R_EINVAL;
        }
 
-       locale = _get_system_locale();
-       if (locale == NULL)
-               return PMINFO_R_ERROR;
-
-       list = g_hash_table_new(g_str_hash, g_str_equal);
-       if (list == NULL) {
-               free(locale);
+       list = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
+                       __free_applications);
+       if (list == NULL)
                return PMINFO_R_ERROR;
-       }
 
-       ret = _appinfo_get_applications(uid, uid, locale, filter,
+       ret = _appinfo_get_applications(uid, filter,
                        PMINFO_APPINFO_GET_ALL, list);
-       if (!g_hash_table_size(list) && uid != GLOBAL_USER)
-               ret = _appinfo_get_applications(GLOBAL_USER, GLOBAL_USER, locale, filter,
-                               PMINFO_APPINFO_GET_ALL, list);
+       if (ret != PMINFO_R_OK) {
+               g_hash_table_destroy(list);
+               return ret;
+       }
 
-       if (!g_hash_table_size(list)) {
-               _LOGI("appinfo for [%s] is not existed for user [%d]",
+       if (!g_hash_table_size(list) || !g_hash_table_lookup(list, appid) ||
+               ((application_x *)g_hash_table_lookup(list, appid))->package == NULL) {
+               _LOGD("appinfo for [%s] is not existed for user [%d]",
                                appid, uid);
                g_hash_table_destroy(list);
-               free(locale);
                return PMINFO_R_ENOENT;
        }
 
@@ -775,15 +108,28 @@ static int _pkgmgrinfo_get_appinfo(const char *appid, uid_t uid,
        if (info == NULL) {
                _LOGE("out of memory");
                g_hash_table_destroy(list);
-               free(locale);
                return PMINFO_R_ERROR;
        }
 
        info->app_info = (application_x *)g_hash_table_lookup(list, appid);
-       info->locale = locale;
+       info->locale = strdup(info->app_info->locale);
+       if (!info->locale) {
+               _LOGE("out of memory");
+               g_hash_table_destroy(list);
+               free(info);
+               return PMINFO_R_ERROR;
+       }
        info->package = strdup(info->app_info->package);
+       if (!info->package) {
+               _LOGE("out of memory");
+               free(info->locale);
+               g_hash_table_destroy(list);
+               free(info);
+               return PMINFO_R_ERROR;
+       }
 
        /* just free list only */
+       g_hash_table_steal(list, (gconstpointer)appid);
        g_hash_table_destroy(list);
 
        *handle = info;
@@ -791,8 +137,8 @@ static int _pkgmgrinfo_get_appinfo(const char *appid, uid_t uid,
        return ret;
 }
 
-API int pkgmgrinfo_appinfo_get_usr_disabled_appinfo(const char *appid, uid_t uid,
-               pkgmgrinfo_appinfo_h *handle)
+API int pkgmgrinfo_appinfo_get_usr_disabled_appinfo(
+               const char *appid, uid_t uid, pkgmgrinfo_appinfo_h *handle)
 {
        int ret;
        pkgmgrinfo_appinfo_filter_h filter;
@@ -826,9 +172,11 @@ API int pkgmgrinfo_appinfo_get_usr_disabled_appinfo(const char *appid, uid_t uid
        return ret;
 }
 
-API int pkgmgrinfo_appinfo_get_disabled_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
+API int pkgmgrinfo_appinfo_get_disabled_appinfo(
+               const char *appid, pkgmgrinfo_appinfo_h *handle)
 {
-       return pkgmgrinfo_appinfo_get_usr_disabled_appinfo(appid, _getuid(), handle);
+       return pkgmgrinfo_appinfo_get_usr_disabled_appinfo(
+                       appid, _getuid(), handle);
 }
 
 API int pkgmgrinfo_appinfo_get_usr_appinfo(const char *appid, uid_t uid,
@@ -860,12 +208,20 @@ API int pkgmgrinfo_appinfo_get_usr_appinfo(const char *appid, uid_t uid,
                return PMINFO_R_ERROR;
        }
 
+       ret = pkgmgrinfo_appinfo_filter_add_bool(filter,
+                       PMINFO_APPINFO_PROP_PKG_DISABLE, false);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_appinfo_filter_destroy(filter);
+               return PMINFO_R_ERROR;
+       }
+
        ret = _pkgmgrinfo_get_appinfo(appid, uid, filter, handle);
        pkgmgrinfo_appinfo_filter_destroy(filter);
        return ret;
 }
 
-API int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
+API int pkgmgrinfo_appinfo_get_appinfo(
+               const char *appid, pkgmgrinfo_appinfo_h *handle)
 {
        return pkgmgrinfo_appinfo_get_usr_appinfo(appid, _getuid(), handle);
 }
@@ -905,7 +261,8 @@ API int pkgmgrinfo_appinfo_get_usr_all_appinfo(const char *appid, uid_t uid,
        return ret;
 }
 
-API int pkgmgrinfo_appinfo_get_all_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
+API int pkgmgrinfo_appinfo_get_all_appinfo(
+               const char *appid, pkgmgrinfo_appinfo_h *handle)
 {
        return pkgmgrinfo_appinfo_get_usr_all_appinfo(appid, _getuid(), handle);
 }
@@ -1011,6 +368,8 @@ static gpointer __copy_datacontrol(gconstpointer src, gpointer data)
                datacontrol->access = strdup(tmp->access);
        if (tmp->type)
                datacontrol->type = strdup(tmp->type);
+       if (tmp->trusted)
+               datacontrol->trusted = strdup(tmp->trusted);
 
        return datacontrol;
 }
@@ -1065,7 +424,32 @@ static gpointer __copy_splashscreens(gconstpointer src, gpointer data)
        return splashscreen;
 }
 
-static int _appinfo_copy_appinfo(application_x **application, application_x *data)
+static gpointer __copy_res_control(gconstpointer src, gpointer data)
+{
+       res_control_x *tmp = (res_control_x *)src;
+       res_control_x *res_control;
+
+       res_control = (res_control_x *)calloc(1, sizeof(res_control_x));
+       if (res_control == NULL) {
+               LOGE("memory alloc failed");
+               *(int *)data = -1;
+               return NULL;
+       }
+
+       if (tmp->res_type)
+               res_control->res_type = strdup(tmp->res_type);
+       if (tmp->min_res_version)
+               res_control->min_res_version = strdup(tmp->min_res_version);
+       if (tmp->max_res_version)
+               res_control->max_res_version = strdup(tmp->max_res_version);
+       if (tmp->auto_close)
+               res_control->auto_close = strdup(tmp->auto_close);
+
+       return res_control;
+}
+
+static int _appinfo_copy_appinfo(
+               application_x **application, application_x *data)
 {
        application_x *app_info;
        int ret;
@@ -1086,8 +470,6 @@ static int _appinfo_copy_appinfo(application_x **application, application_x *dat
                app_info->multiple = strdup(data->multiple);
        if (data->taskmanage != NULL)
                app_info->taskmanage = strdup(data->taskmanage);
-       if (data->enabled != NULL)
-               app_info->enabled = strdup(data->enabled);
        if (data->type != NULL)
                app_info->type = strdup(data->type);
        if (data->categories != NULL)
@@ -1111,7 +493,8 @@ static int _appinfo_copy_appinfo(application_x **application, application_x *dat
        if (data->landscapeimg != NULL)
                app_info->landscapeimg = strdup(data->landscapeimg);
        if (data->guestmode_visibility != NULL)
-               app_info->guestmode_visibility = strdup(data->guestmode_visibility);
+               app_info->guestmode_visibility =
+                               strdup(data->guestmode_visibility);
        if (data->component != NULL)
                app_info->component = strdup(data->component);
        if (data->permission_type != NULL)
@@ -1143,7 +526,8 @@ static int _appinfo_copy_appinfo(application_x **application, application_x *dat
        if (data->effective_appid != NULL)
                app_info->effective_appid = strdup(data->effective_appid);
        if (data->splash_screen_display != NULL)
-               app_info->splash_screen_display = strdup(data->splash_screen_display);
+               app_info->splash_screen_display =
+                               strdup(data->splash_screen_display);
 
        /* GList */
        ret = 0;
@@ -1171,7 +555,8 @@ static int _appinfo_copy_appinfo(application_x **application, application_x *dat
        }
 
        ret = 0;
-       app_info->metadata = g_list_copy_deep(data->metadata, __copy_metadata, &ret);
+       app_info->metadata = g_list_copy_deep(data->metadata,
+                       __copy_metadata, &ret);
        if (ret < 0) {
                LOGE("memory alloc failed");
                pkgmgrinfo_basic_free_application(app_info);
@@ -1179,7 +564,8 @@ static int _appinfo_copy_appinfo(application_x **application, application_x *dat
        }
 
        ret = 0;
-       app_info->datacontrol = g_list_copy_deep(data->datacontrol, __copy_datacontrol, &ret);
+       app_info->datacontrol = g_list_copy_deep(data->datacontrol,
+                       __copy_datacontrol, &ret);
        if (ret < 0) {
                LOGE("memory alloc failed");
                pkgmgrinfo_basic_free_application(app_info);
@@ -1187,7 +573,8 @@ static int _appinfo_copy_appinfo(application_x **application, application_x *dat
        }
 
        ret = 0;
-       app_info->appcontrol = g_list_copy_deep(data->appcontrol, __copy_appcontrol, &ret);
+       app_info->appcontrol = g_list_copy_deep(data->appcontrol,
+                       __copy_appcontrol, &ret);
        if (ret < 0) {
                LOGE("memory alloc failed");
                pkgmgrinfo_basic_free_application(app_info);
@@ -1195,7 +582,9 @@ static int _appinfo_copy_appinfo(application_x **application, application_x *dat
        }
 
        ret = 0;
-       app_info->background_category = g_list_copy_deep(data->background_category, __copy_str, &ret);
+       app_info->background_category =
+                       g_list_copy_deep(data->background_category,
+                                       __copy_str, &ret);
        if (ret < 0) {
                LOGE("memory alloc failed");
                pkgmgrinfo_basic_free_application(app_info);
@@ -1203,7 +592,16 @@ static int _appinfo_copy_appinfo(application_x **application, application_x *dat
        }
 
        ret = 0;
-       app_info->splashscreens = g_list_copy_deep(data->splashscreens, __copy_splashscreens, &ret);
+       app_info->splashscreens = g_list_copy_deep(data->splashscreens,
+                       __copy_splashscreens, &ret);
+       if (ret < 0) {
+               LOGE("memory alloc failed");
+               pkgmgrinfo_basic_free_application(app_info);
+               return PMINFO_R_ERROR;
+       }
+
+       ret = 0;
+       app_info->res_control = g_list_copy_deep(data->res_control, __copy_res_control, &ret);
        if (ret < 0) {
                LOGE("memory alloc failed");
                pkgmgrinfo_basic_free_application(app_info);
@@ -1253,36 +651,26 @@ API int pkgmgrinfo_appinfo_clone_appinfo(pkgmgrinfo_appinfo_h handle,
 }
 
 static int _appinfo_get_filtered_foreach_appinfo(uid_t uid,
-               pkgmgrinfo_filter_x *filter, int flag, pkgmgrinfo_app_list_cb app_list_cb,
+               pkgmgrinfo_filter_x *filter, int flag,
+               pkgmgrinfo_app_list_cb app_list_cb,
                void *user_data)
 {
-       int ret;
-       char *locale;
        application_x *app;
        pkgmgr_appinfo_x info;
        GHashTable *list;
        GHashTableIter iter;
        gpointer value;
-
-       locale = _get_system_locale();
-       if (locale == NULL)
-               return PMINFO_R_ERROR;
+       int ret;
 
        list = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
                        __free_applications);
-       if (list == NULL) {
-               free(locale);
+       if (list == NULL)
                return PMINFO_R_ERROR;
-       }
-
-       ret = _appinfo_get_applications(uid, uid, locale, filter, flag, list);
-       if (ret == PMINFO_R_OK && uid != GLOBAL_USER)
-               ret = _appinfo_get_applications(GLOBAL_USER, uid, locale,
-                               filter, flag, list);
 
-       if (ret != PMINFO_R_OK) {
+       ret = _appinfo_get_applications(uid, filter,
+                       flag | PMINFO_APPINFO_GET_BASICINFO, list);
+       if (ret == PMINFO_R_ERROR) {
                g_hash_table_destroy(list);
-               free(locale);
                return ret;
        }
 
@@ -1290,13 +678,12 @@ static int _appinfo_get_filtered_foreach_appinfo(uid_t uid,
        while (g_hash_table_iter_next(&iter, NULL, &value)) {
                app = (application_x *)value;
                info.app_info = app;
-               info.locale = locale;
+               info.locale = info.app_info->locale;
                info.package = app->package;
                if (app_list_cb(&info, user_data) < 0)
                        break;
        }
        g_hash_table_destroy(list);
-       free(locale);
 
        return PMINFO_R_OK;
 }
@@ -1331,13 +718,10 @@ API int pkgmgrinfo_appinfo_get_usr_list(pkgmgrinfo_pkginfo_h handle,
                return PMINFO_R_ERROR;
        }
 
-       if (uid == GLOBAL_USER) {
-               if (pkgmgrinfo_appinfo_filter_add_int(filter,
-                                       PMINFO_APPINFO_PROP_APP_DISABLE_FOR_USER,
-                                       (int)getuid())) {
-                       pkgmgrinfo_appinfo_filter_destroy(filter);
-                       return PMINFO_R_ERROR;
-               }
+       if (pkgmgrinfo_appinfo_filter_add_bool(filter,
+                       PMINFO_APPINFO_PROP_APP_DISABLE, false)) {
+               pkgmgrinfo_appinfo_filter_destroy(filter);
+               return PMINFO_R_ERROR;
        }
 
        comp_str = __appcomponent_str(component);
@@ -1363,7 +747,8 @@ API int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle,
                pkgmgrinfo_app_component component,
                pkgmgrinfo_app_list_cb app_func, void *user_data)
 {
-       return pkgmgrinfo_appinfo_get_usr_list(handle, component, app_func, user_data, _getuid());
+       return pkgmgrinfo_appinfo_get_usr_list(handle,
+                       component, app_func, user_data, _getuid());
 }
 
 API int pkgmgrinfo_appinfo_get_usr_installed_list_full(
@@ -1382,18 +767,21 @@ API int pkgmgrinfo_appinfo_get_usr_installed_list_full(
                return PMINFO_R_ERROR;
 
        if (pkgmgrinfo_appinfo_filter_add_bool(filter,
-                               PMINFO_APPINFO_PROP_APP_DISABLE, false)) {
+                       PMINFO_APPINFO_PROP_APP_DISABLE, false)) {
                pkgmgrinfo_appinfo_filter_destroy(filter);
                return PMINFO_R_ERROR;
        }
 
-       if (uid == GLOBAL_USER) {
-               if (pkgmgrinfo_appinfo_filter_add_int(filter,
-                                       PMINFO_APPINFO_PROP_APP_DISABLE_FOR_USER,
-                                       (int)getuid())) {
-                       pkgmgrinfo_appinfo_filter_destroy(filter);
-                       return PMINFO_R_ERROR;
-               }
+       if (pkgmgrinfo_appinfo_filter_add_bool(filter,
+                       PMINFO_APPINFO_PROP_PKG_DISABLE, false)) {
+               pkgmgrinfo_appinfo_filter_destroy(filter);
+               return PMINFO_R_ERROR;
+       }
+
+       if (pkgmgrinfo_appinfo_filter_add_bool(filter,
+                       PMINFO_APPINFO_PROP_APP_CHECK_STORAGE, false)) {
+               pkgmgrinfo_appinfo_filter_destroy(filter);
+               return PMINFO_R_ERROR;
        }
 
        ret = _appinfo_get_filtered_foreach_appinfo(uid, filter, flag, app_func,
@@ -1411,30 +799,40 @@ API int pkgmgrinfo_appinfo_get_installed_list_full(
                        _getuid(), flag, user_data);
 }
 
-API int pkgmgrinfo_appinfo_get_usr_install_list(pkgmgrinfo_app_list_cb app_func,
-               uid_t uid, void *user_data)
-{
-       return pkgmgrinfo_appinfo_get_usr_installed_list_full(app_func,
-                       uid, PMINFO_APPINFO_GET_ALL, user_data);
-}
-
-API int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func,
-               void *user_data)
-{
-       return pkgmgrinfo_appinfo_get_usr_installed_list_full(app_func,
-                       _getuid(), PMINFO_APPINFO_GET_ALL, user_data);
-}
-
 API int pkgmgrinfo_appinfo_get_usr_installed_list(
                pkgmgrinfo_app_list_cb app_func, uid_t uid, void *user_data)
 {
+       int ret;
+       pkgmgrinfo_appinfo_filter_h filter;
+
        if (app_func == NULL) {
                LOGE("invalid parameter");
                return PMINFO_R_EINVAL;
        }
 
-       return _appinfo_get_filtered_foreach_appinfo(uid, NULL,
+       /* create an empty filter */
+       ret = pkgmgrinfo_appinfo_filter_create(&filter);
+       if (ret != PMINFO_R_OK)
+               return ret;
+
+       if (pkgmgrinfo_appinfo_filter_add_bool(filter,
+                       PMINFO_APPINFO_PROP_APP_DISABLE, false)) {
+               pkgmgrinfo_appinfo_filter_destroy(filter);
+               return PMINFO_R_ERROR;
+       }
+
+       if (pkgmgrinfo_appinfo_filter_add_bool(filter,
+                       PMINFO_APPINFO_PROP_PKG_DISABLE, false)) {
+               pkgmgrinfo_appinfo_filter_destroy(filter);
+               return PMINFO_R_ERROR;
+       }
+
+       ret = _appinfo_get_filtered_foreach_appinfo(uid, filter,
                        PMINFO_APPINFO_GET_ALL, app_func, user_data);
+
+       pkgmgrinfo_appinfo_filter_destroy(filter);
+
+       return ret;
 }
 
 API int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func,
@@ -1449,7 +847,8 @@ API int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h handle, char **appid)
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(appid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(appid == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
 
        if (info->app_info == NULL || info->app_info->appid == NULL)
                return PMINFO_R_ERROR;
@@ -1458,12 +857,14 @@ API int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h handle, char **appid)
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo_h handle, char **pkg_name)
+API int pkgmgrinfo_appinfo_get_pkgname(
+               pkgmgrinfo_appinfo_h handle, char **pkg_name)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(pkg_name == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(pkg_name == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
 
        if (info->package == NULL)
                return PMINFO_R_ERROR;
@@ -1478,7 +879,8 @@ API int pkgmgrinfo_appinfo_get_pkgid(pkgmgrinfo_appinfo_h handle, char **pkgid)
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(pkgid == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
 
        if (info->package == NULL)
                return PMINFO_R_ERROR;
@@ -1488,10 +890,12 @@ API int pkgmgrinfo_appinfo_get_pkgid(pkgmgrinfo_appinfo_h handle, char **pkgid)
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_pkgtype(pkgmgrinfo_appinfo_h  handle, char **pkgtype)
+API int pkgmgrinfo_appinfo_get_pkgtype(
+               pkgmgrinfo_appinfo_h handle, char **pkgtype)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(pkgtype == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(pkgtype == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        *pkgtype = (char *)info->app_info->package_type;
@@ -1504,7 +908,8 @@ API int pkgmgrinfo_appinfo_get_exec(pkgmgrinfo_appinfo_h handle, char **exec)
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(exec == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(exec == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
 
        if (info->app_info == NULL || info->app_info->exec == NULL)
                return PMINFO_R_ERROR;
@@ -1520,7 +925,8 @@ API int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h handle, char **icon)
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(icon == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
 
        if (info->app_info == NULL)
                return PMINFO_R_ERROR;
@@ -1547,106 +953,77 @@ API int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label)
 {
        label_x *ptr;
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+       char *lbl = NULL;
+       const char *locale;
+       GList *tmp;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(label == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-
-       if (info->app_info == NULL || info->app_info->label == NULL)
-               return PMINFO_R_ERROR;
+       retvm_if(label == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
 
-       ptr = (label_x *)info->app_info->label->data;
-       if (ptr == NULL)
-               return PMINFO_R_ERROR;
-
-       if (ptr->text == NULL)
+       if (info->app_info == NULL)
                return PMINFO_R_ERROR;
-       else
-               *label = ptr->text;
-
-       return PMINFO_R_OK;
-}
 
-static char *_get_localed_label(const char *appid, const char *locale, uid_t uid)
-{
-       char *result = NULL;
-       char *query = NULL;
-       sqlite3_stmt *stmt = NULL;
-       sqlite3 *db = NULL;
-       char *val;
-       char *parser_db;
-
-       parser_db = getUserPkgParserDBPathUID(uid);
-       if (parser_db == NULL) {
-               _LOGE("Failed to get parser db path");
-               goto err;
-       }
-
-       if (sqlite3_open_v2(parser_db, &db, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK) {
-               _LOGE("DB open fail\n");
-               free(parser_db);
-               goto err;
-       }
-       free(parser_db);
+       locale = info->locale;
+       if (locale == NULL)
+               locale = DEFAULT_LOCALE;
 
-       query = sqlite3_mprintf("select app_label from package_app_localized_info where app_id=%Q and app_locale=%Q", appid, locale);
-       if (query == NULL) {
-               _LOGE("Out of memory");
-               goto err;
+       for (tmp = info->app_info->label; tmp; tmp = tmp->next) {
+               ptr = (label_x *)tmp->data;
+               if (ptr == NULL || strcmp(locale, ptr->lang) != 0)
+                       continue;
+               lbl = ptr->text;
+               break;
        }
 
-       if (sqlite3_prepare_v2(db, query, -1, &stmt, NULL) != SQLITE_OK) {
-               _LOGE("prepare_v2 fail\n");
-               goto err;
+       if (lbl != NULL) {
+               *label = lbl;
+               return PMINFO_R_OK;
        }
 
-       if (sqlite3_step(stmt) == SQLITE_ROW) {
-               val = (char *)sqlite3_column_text(stmt, 0);
-               if (val != NULL)
-                       result = strdup(val);
+       for (tmp = info->app_info->label; tmp; tmp = tmp->next) {
+               ptr = (label_x *)tmp->data;
+               if (ptr == NULL || strcmp(DEFAULT_LOCALE, ptr->lang) != 0)
+                       continue;
+               lbl = ptr->text;
+               break;
        }
 
-err:
-       sqlite3_finalize(stmt);
-       sqlite3_free(query);
-       sqlite3_close(db);
+       *label = lbl ? lbl : "";
 
-       return result;
+       return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_usr_get_localed_label(const char *appid, const char *locale, uid_t uid, char **label)
+API int pkgmgrinfo_appinfo_usr_get_localed_label(const char *appid,
+               const char *locale, uid_t uid, char **label)
 {
        char *val;
 
-       retvm_if(appid == NULL || locale == NULL || label == NULL, PMINFO_R_EINVAL, "Argument is NULL");
-
-       val = _get_localed_label(appid, locale, uid);
-       if (val == NULL)
-               val = _get_localed_label(appid, DEFAULT_LOCALE, uid);
-
-       if (val == NULL) {
-               val = _get_localed_label(appid, locale, GLOBAL_USER);
-               if (val == NULL)
-                       val = _get_localed_label(appid, DEFAULT_LOCALE, GLOBAL_USER);
-       }
-
+       retvm_if(appid == NULL || locale == NULL || label == NULL,
+                       PMINFO_R_EINVAL, "Argument is NULL");
+       val = _appinfo_get_localed_label(appid, locale, uid);
        if (val == NULL)
                return PMINFO_R_ERROR;
 
        *label = val;
-
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_localed_label(const char *appid, const char *locale, char **label)
+API int pkgmgrinfo_appinfo_get_localed_label(
+               const char *appid, const char *locale, char **label)
 {
-       return pkgmgrinfo_appinfo_usr_get_localed_label(appid, locale, _getuid(), label);
+       return pkgmgrinfo_appinfo_usr_get_localed_label(
+                       appid, locale, _getuid(), label);
 }
 
-API int pkgmgrinfo_appinfo_get_metadata_value(pkgmgrinfo_appinfo_h handle, const char *metadata_key, char **metadata_value)
+API int pkgmgrinfo_appinfo_get_metadata_value(
+               pkgmgrinfo_appinfo_h handle, const char *metadata_key,
+               char **metadata_value)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
        retvm_if(metadata_key == NULL, PMINFO_R_EINVAL, "metadata_key is NULL");
-       retvm_if(metadata_value == NULL, PMINFO_R_EINVAL, "metadata_value is NULL");
+       retvm_if(metadata_value == NULL, PMINFO_R_EINVAL,
+                       "metadata_value is NULL");
 
        GList *list_md = NULL;
        metadata_x *metadata = NULL;
@@ -1661,7 +1038,8 @@ API int pkgmgrinfo_appinfo_get_metadata_value(pkgmgrinfo_appinfo_h handle, const
                                if (metadata->value == NULL)
                                        *metadata_value = "";
                                else
-                                       *metadata_value = (char *)metadata->value;
+                                       *metadata_value =
+                                                       (char *)metadata->value;
                                return PMINFO_R_OK;
                        }
                }
@@ -1680,6 +1058,8 @@ static pkgmgrinfo_app_component __appcomponent_convert(const char *comp)
                return PMINFO_WIDGET_APP;
        else if (strcasecmp(comp, "watchapp") == 0)
                return PMINFO_WATCH_APP;
+       else if (strcasecmp(comp, "componentbasedapp") == 0)
+               return PMINFO_COMPONENT_BASED_APP;
        else
                return -1;
 }
@@ -1695,18 +1075,23 @@ static const char *__appcomponent_str(pkgmgrinfo_app_component comp)
                return "widgetapp";
        case PMINFO_WATCH_APP:
                return "watchapp";
+       case PMINFO_COMPONENT_BASED_APP:
+               return "componentbasedapp";
        default:
                return NULL;
        }
 }
 
-API int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component)
+API int pkgmgrinfo_appinfo_get_component(
+               pkgmgrinfo_appinfo_h handle,
+               pkgmgrinfo_app_component *component)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
        int comp;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(component == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(component == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
 
        if (info->app_info == NULL)
                return PMINFO_R_ERROR;
@@ -1720,12 +1105,14 @@ API int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h handle, char **app_type)
+API int pkgmgrinfo_appinfo_get_apptype(
+               pkgmgrinfo_appinfo_h handle, char **app_type)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(app_type == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(app_type == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
 
        if (info->app_info == NULL || info->app_info->type == NULL)
                return PMINFO_R_ERROR;
@@ -1734,84 +1121,8 @@ API int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h handle, char **app_t
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h  handle,
-                                       int *operation_count, char ***operation)
-{
-       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(operation == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       retvm_if(operation_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
-       *operation_count = data->operation_count;
-       *operation = data->operation;
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h  handle,
-                                       int *uri_count, char ***uri)
-{
-       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(uri == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       retvm_if(uri_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
-       *uri_count = data->uri_count;
-       *uri = data->uri;
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h  handle,
-                                       int *mime_count, char ***mime)
-{
-       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(mime == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       retvm_if(mime_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
-       *mime_count = data->mime_count;
-       *mime = data->mime;
-       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)
-{
-       char *val;
-       icon_x *ptr;
-       GList *tmp;
-       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
-
-       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
-       retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
-
-       if (info->app_info == NULL)
-               return PMINFO_R_ERROR;
-
-       for (tmp = info->app_info->icon; tmp; tmp = tmp->next) {
-               ptr = (icon_x *)tmp->data;
-               if (ptr == NULL || ptr->section == NULL)
-                       continue;
-
-               val = (char *)ptr->section;
-               if (val && strcmp(val, "setting") == 0) {
-                       *icon = (char *)ptr->text;
-                       return PMINFO_R_OK;
-               }
-       }
-
-       return PMINFO_R_ERROR;
-}
-
-
-API int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, char **icon)
+API int pkgmgrinfo_appinfo_get_notification_icon(
+               pkgmgrinfo_appinfo_h handle, char **icon)
 {
        char *val;
        icon_x *ptr;
@@ -1819,7 +1130,8 @@ API int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, ch
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
-       retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+       retvm_if(icon == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL\n");
 
        if (info->app_info == NULL)
                return PMINFO_R_ERROR;
@@ -1839,13 +1151,15 @@ API int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, ch
        return PMINFO_R_ERROR;
 }
 
-API int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_recentimage *type)
+API int pkgmgrinfo_appinfo_get_recent_image_type(
+               pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_recentimage *type)
 {
        char *val;
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(type == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(type == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
 
        if (info->app_info == NULL || info->app_info->recentimage == NULL)
                return PMINFO_R_ERROR;
@@ -1861,7 +1175,8 @@ API int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h handle, pk
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h handle, char **preview_img)
+API int pkgmgrinfo_appinfo_get_preview_image(
+               pkgmgrinfo_appinfo_h handle, char **preview_img)
 {
        char *val;
        image_x *ptr;
@@ -1869,7 +1184,8 @@ API int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h handle, char *
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
-       retvm_if(preview_img == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+       retvm_if(preview_img == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL\n");
 
        if (info->app_info == NULL)
                return PMINFO_R_ERROR;
@@ -1889,13 +1205,16 @@ API int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h handle, char *
        return PMINFO_R_ERROR;
 }
 
-API int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission)
+API int pkgmgrinfo_appinfo_get_permission_type(
+               pkgmgrinfo_appinfo_h handle,
+               pkgmgrinfo_permission_type *permission)
 {
        const char *val;
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
-       retvm_if(permission == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+       retvm_if(permission == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL\n");
 
        val = info->app_info->permission_type;
        if (val == NULL)
@@ -1911,12 +1230,14 @@ API int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgm
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h handle, char **component_type)
+API int pkgmgrinfo_appinfo_get_component_type(
+               pkgmgrinfo_appinfo_h handle, char **component_type)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        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");
+       retvm_if(component_type == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
 
        if (info->app_info == NULL || info->app_info->component_type == NULL)
                return PMINFO_R_ERROR;
@@ -1926,13 +1247,16 @@ API int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h handle, char
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_hwacceleration *hwacceleration)
+API int pkgmgrinfo_appinfo_get_hwacceleration(
+               pkgmgrinfo_appinfo_h handle,
+               pkgmgrinfo_app_hwacceleration *hwacceleration)
 {
        char *val;
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        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");
+       retvm_if(hwacceleration == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
 
        if (info->app_info == NULL || info->app_info->hwacceleration == NULL)
                return PMINFO_R_ERROR;
@@ -1948,13 +1272,16 @@ API int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h handle, pkgmg
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_screenreader *screenreader)
+API int pkgmgrinfo_appinfo_get_screenreader(
+               pkgmgrinfo_appinfo_h handle,
+               pkgmgrinfo_app_screenreader *screenreader)
 {
        char *val;
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        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");
+       retvm_if(screenreader == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
 
        if (info->app_info == NULL || info->app_info->screenreader == NULL)
                return PMINFO_R_ERROR;
@@ -1970,13 +1297,17 @@ API int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h handle, pkgmgri
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h handle, char **portrait_img, char **landscape_img)
+API int pkgmgrinfo_appinfo_get_effectimage(
+               pkgmgrinfo_appinfo_h handle, char **portrait_img,
+               char **landscape_img)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        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");
+       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");
 
        if (info->app_info == NULL)
                return PMINFO_R_ERROR;
@@ -1994,7 +1325,8 @@ API int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h handle, char **p
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_effectimage_type(pkgmgrinfo_appinfo_h handle, char **effectimage_type)
+API int pkgmgrinfo_appinfo_get_effectimage_type(
+               pkgmgrinfo_appinfo_h handle, char **effectimage_type)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -2011,12 +1343,14 @@ API int pkgmgrinfo_appinfo_get_effectimage_type(pkgmgrinfo_appinfo_h handle, cha
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h  handle, char **submode_mainid)
+API int pkgmgrinfo_appinfo_get_submode_mainid(
+               pkgmgrinfo_appinfo_h  handle, char **submode_mainid)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        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");
+       retvm_if(submode_mainid == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
 
        if (info->app_info == NULL)
                return PMINFO_R_ERROR;
@@ -2029,18 +1363,22 @@ API int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h  handle, char
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_installed_storage_location(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_installed_storage *storage)
+API int pkgmgrinfo_appinfo_get_installed_storage_location(
+               pkgmgrinfo_appinfo_h handle,
+               pkgmgrinfo_installed_storage *storage)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info && info->app_info->installed_storage) {
-                if (strcmp(info->app_info->installed_storage, "installed_internal") == 0)
+               if (strcmp(info->app_info->installed_storage,
+                                       "installed_internal") == 0)
                        *storage = PMINFO_INTERNAL_STORAGE;
-                else if (strcmp(info->app_info->installed_storage, "installed_external") == 0)
-                        *storage = PMINFO_EXTERNAL_STORAGE;
-                else
-                        return PMINFO_R_ERROR;
+               else if (strcmp(info->app_info->installed_storage,
+                               "installed_external") == 0)
+                       *storage = PMINFO_EXTERNAL_STORAGE;
+               else
+                       return PMINFO_R_ERROR;
        } else {
                return PMINFO_R_ERROR;
        }
@@ -2048,12 +1386,14 @@ API int pkgmgrinfo_appinfo_get_installed_storage_location(pkgmgrinfo_appinfo_h h
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_launch_mode(pkgmgrinfo_appinfo_h handle, char **mode)
+API int pkgmgrinfo_appinfo_get_launch_mode(
+               pkgmgrinfo_appinfo_h handle, char **mode)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
-       retvm_if(mode == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+       retvm_if(mode == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL\n");
 
        if (info->app_info->launch_mode == NULL)
                return PMINFO_R_ERROR;
@@ -2063,7 +1403,8 @@ API int pkgmgrinfo_appinfo_get_launch_mode(pkgmgrinfo_appinfo_h handle, char **m
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_alias_appid(pkgmgrinfo_appinfo_h handle, char **alias_appid)
+API int pkgmgrinfo_appinfo_get_alias_appid(
+               pkgmgrinfo_appinfo_h handle, char **alias_appid)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -2080,7 +1421,8 @@ API int pkgmgrinfo_appinfo_get_alias_appid(pkgmgrinfo_appinfo_h handle, char **a
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_effective_appid(pkgmgrinfo_appinfo_h handle, char **effective_appid)
+API int pkgmgrinfo_appinfo_get_effective_appid(
+               pkgmgrinfo_appinfo_h handle, char **effective_appid)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -2100,7 +1442,8 @@ API int pkgmgrinfo_appinfo_get_effective_appid(pkgmgrinfo_appinfo_h handle, char
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_tep_name(pkgmgrinfo_appinfo_h handle, char **tep_name)
+API int pkgmgrinfo_appinfo_get_tep_name(
+               pkgmgrinfo_appinfo_h handle, char **tep_name)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -2120,7 +1463,8 @@ API int pkgmgrinfo_appinfo_get_tep_name(pkgmgrinfo_appinfo_h handle, char **tep_
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_zip_mount_file(pkgmgrinfo_appinfo_h handle, char **zip_mount_file)
+API int pkgmgrinfo_appinfo_get_zip_mount_file(
+               pkgmgrinfo_appinfo_h handle, char **zip_mount_file)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -2140,7 +1484,8 @@ API int pkgmgrinfo_appinfo_get_zip_mount_file(pkgmgrinfo_appinfo_h handle, char
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_root_path(pkgmgrinfo_appinfo_h handle, char **root_path)
+API int pkgmgrinfo_appinfo_get_root_path(
+               pkgmgrinfo_appinfo_h handle, char **root_path)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -2157,7 +1502,8 @@ API int pkgmgrinfo_appinfo_get_root_path(pkgmgrinfo_appinfo_h handle, char **roo
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_api_version(pkgmgrinfo_appinfo_h handle, char **api_version)
+API int pkgmgrinfo_appinfo_get_api_version(
+               pkgmgrinfo_appinfo_h handle, char **api_version)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -2174,114 +1520,174 @@ API int pkgmgrinfo_appinfo_get_api_version(pkgmgrinfo_appinfo_h handle, char **a
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_installed_time(pkgmgrinfo_appinfo_h handle, int *installed_time)
+API int pkgmgrinfo_appinfo_get_installed_time(
+               pkgmgrinfo_appinfo_h handle, int *installed_time)
+{
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+       if (handle == NULL || installed_time == NULL) {
+               LOGE("invalid parameter");
+               return PMINFO_R_EINVAL;
+       }
+
+       if (info->app_info == NULL ||
+                       info->app_info->package_installed_time == NULL)
+               return PMINFO_R_ERROR;
+
+       *installed_time = atoi(info->app_info->package_installed_time);
+
+       return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_usr_get_datacontrol_info(const char *providerid,
+               const char *type, uid_t uid, char **appid, char **access)
+{
+       int ret;
+
+       if (providerid == NULL || type == NULL || appid == NULL ||
+                       access == NULL) {
+               LOGE("invalid parameter");
+               return PMINFO_R_EINVAL;
+       }
+
+       ret = _appinfo_get_datacontrol_info(
+                       providerid, type, uid, appid, access);
+       /* FIXME: It should return PMINFO_R_ENOENT but to keep previous
+        * implementation, return PMINFO_R_ERROR. This should be
+        * modified later...
+        */
+       if (ret == PMINFO_R_ENOENT) {
+               LOGE("no datacontrol info of %s", providerid);
+               ret = PMINFO_R_ERROR;
+       }
+
+       return ret;
+}
+
+API int pkgmgrinfo_appinfo_get_datacontrol_info(const char *providerid,
+               const char *type, char **appid, char **access)
+{
+       return pkgmgrinfo_appinfo_usr_get_datacontrol_info(providerid,
+                       type, _getuid(), appid, access);
+}
+
+API int pkgmgrinfo_appinfo_usr_get_datacontrol_appid(const char *providerid,
+               uid_t uid, char **appid)
 {
-       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+       int ret;
 
-       if (handle == NULL || installed_time == NULL) {
+       if (providerid == NULL || appid == NULL) {
                LOGE("invalid parameter");
                return PMINFO_R_EINVAL;
        }
 
-       if (info->app_info == NULL || info->app_info->package_installed_time == NULL)
-               return PMINFO_R_ERROR;
-
-       *installed_time = atoi(info->app_info->package_installed_time);
+       ret = _appinfo_get_datacontrol_appid(providerid, uid, appid);
+       /* FIXME: It should return PMINFO_R_ENOENT but to keep previous
+        * implementation, return PMINFO_R_ERROR. This should be
+        * modified later...
+        */
+       if (ret == PMINFO_R_ENOENT) {
+               LOGE("no datacontrol appid of %s", providerid);
+               ret = PMINFO_R_ERROR;
+       }
 
-       return PMINFO_R_OK;
+       return ret;
 }
 
-API int pkgmgrinfo_appinfo_usr_get_datacontrol_info(const char *providerid, const char *type, uid_t uid, char **appid, char **access)
+API int pkgmgrinfo_appinfo_get_datacontrol_appid(
+               const char *providerid, char **appid)
 {
-       retvm_if(providerid == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
-       retvm_if(type == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
-       retvm_if(appid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
-       retvm_if(access == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
-
-       int ret = PMINFO_R_OK;
-       char *query = NULL;
-       sqlite3_stmt *stmt = NULL;
-
-       /*open db*/
-       ret = __open_manifest_db(uid, true);
-       retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
-
-       /*Start constructing query*/
-       query = sqlite3_mprintf("select * from package_app_data_control where providerid=%Q and type=%Q", providerid, type);
-       tryvm_if(query == NULL, ret = PMINFO_R_ERROR, "Out of memory");
+       return pkgmgrinfo_appinfo_usr_get_datacontrol_appid(
+                               providerid, _getuid(), appid);
+}
 
-       /*prepare query*/
-       ret = sqlite3_prepare_v2(GET_DB(manifest_db), query, strlen(query), &stmt, NULL);
-       tryvm_if(ret != PMINFO_R_OK, ret = PMINFO_R_ERROR, "sqlite3_prepare_v2 failed[%s]\n", query);
+API int pkgmgrinfo_appinfo_usr_get_datacontrol_trusted_info(
+               const char *providerid, const char *type, uid_t uid,
+               char **appid, bool *is_trusted)
+{
+       int ret;
+       char *trusted = NULL;
 
-       /*step query*/
-       ret = sqlite3_step(stmt);
-       tryvm_if((ret != SQLITE_ROW) || (ret == SQLITE_DONE), ret = PMINFO_R_ERROR, "No records found");
+       if (providerid == NULL || type == NULL || appid == NULL ||
+                       is_trusted == NULL) {
+               LOGE("invalid parameter");
+               return PMINFO_R_EINVAL;
+       }
 
-       *appid = strdup((char *)sqlite3_column_text(stmt, 0));
-       *access = strdup((char *)sqlite3_column_text(stmt, 2));
+       ret = _appinfo_get_datacontrol_trusted_info(providerid, type, uid,
+                       appid, &trusted);
 
-       ret = PMINFO_R_OK;
+       /* FIXME: It should return PMINFO_R_ENOENT but to keep previous
+        * implementation, return PMINFO_R_ERROR. This should be
+        * modified later...
+        */
+       if (ret == PMINFO_R_ENOENT) {
+               LOGE("no datacontrol trusted info of %s", providerid);
+               ret = PMINFO_R_ERROR;
+       }
+       *is_trusted = _get_bool_value(trusted);
+       free(trusted);
 
-catch:
-       sqlite3_free(query);
-       sqlite3_finalize(stmt);
-       __close_manifest_db();
        return ret;
 }
 
-API int pkgmgrinfo_appinfo_get_datacontrol_info(const char *providerid, const char *type, char **appid, char **access)
+API int pkgmgrinfo_appinfo_get_datacontrol_trsuted_info(const char *providerid,
+               const char *type, char **appid, bool *is_trusted)
 {
-       return pkgmgrinfo_appinfo_usr_get_datacontrol_info(providerid, type, _getuid(), appid, access);
+       return pkgmgrinfo_appinfo_usr_get_datacontrol_trusted_info(providerid,
+                       type, _getuid(), appid, is_trusted);
 }
 
-API int pkgmgrinfo_appinfo_usr_get_datacontrol_appid(const char *providerid, uid_t uid, char **appid)
+API int pkgmgrinfo_appinfo_usr_foreach_datacontrol_privileges(
+               const char *providerid, const char *type,
+               pkgmgrinfo_pkg_privilege_list_cb privilege_func,
+               void *user_data, uid_t uid)
 {
-       retvm_if(providerid == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
-       retvm_if(appid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
-
-       int ret = PMINFO_R_OK;
-       char *query = NULL;
-       sqlite3_stmt *stmt = NULL;
-
-       /*open db*/
-       ret = __open_manifest_db(uid, true);
-       retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
-
-       /*Start constructing query*/
-       query = sqlite3_mprintf("select * from package_app_data_control where providerid=%Q", providerid);
-       tryvm_if(query == NULL, ret = PMINFO_R_ERROR, "Out of memory");
-
-       /*prepare query*/
-       ret = sqlite3_prepare_v2(GET_DB(manifest_db), query, strlen(query), &stmt, NULL);
-       tryvm_if(ret != PMINFO_R_OK, ret = PMINFO_R_ERROR, "sqlite3_prepare_v2 failed[%s]\n", query);
+       int ret;
+       int count = 0;
+       GList *list = NULL;
+       GList *tmp = NULL;
 
-       /*step query*/
-       ret = sqlite3_step(stmt);
-       tryvm_if((ret != SQLITE_ROW) || (ret == SQLITE_DONE), ret = PMINFO_R_ERROR, "No records found");
+       if (providerid == NULL || type == NULL || privilege_func == NULL) {
+               LOGE("invalid parameter");
+               return PMINFO_R_EINVAL;
+       }
 
-       *appid = strdup((char *)sqlite3_column_text(stmt, 0));
+       ret = _appinfo_get_datacontrol_privileges(providerid, type, uid, &list);
+       if (ret == PMINFO_R_ERROR) {
+               g_list_free_full(list, free);
+               return ret;
+       }
 
-       ret = PMINFO_R_OK;
+       for (tmp = list; tmp != NULL; tmp = g_list_next(tmp)) {
+               count++;
+               ret = privilege_func((char *)tmp->data, user_data);
+               if (ret < 0)
+                       break;
+       }
 
-catch:
-       sqlite3_free(query);
-       sqlite3_finalize(stmt);
-       __close_manifest_db();
-       return ret;
+       g_list_free_full(list, free);
+       return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_datacontrol_appid(const char *providerid, char **appid)
+API int pkgmgrinfo_appinfo_foreach_datacontrol_privileges(
+               const char *providerid, const char *type,
+               pkgmgrinfo_pkg_privilege_list_cb privilege_func,
+               void *user_data)
 {
-       return pkgmgrinfo_appinfo_usr_get_datacontrol_appid(providerid, _getuid(), appid);
+       return pkgmgrinfo_appinfo_usr_foreach_datacontrol_privileges(
+                       providerid, type, privilege_func, user_data, _getuid());
 }
 
-API int pkgmgrinfo_appinfo_get_support_mode(pkgmgrinfo_appinfo_h  handle, int *support_mode)
+API int pkgmgrinfo_appinfo_get_support_mode(
+               pkgmgrinfo_appinfo_h  handle, int *support_mode)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(support_mode == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(support_mode == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
 
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
        if (info->app_info->support_mode)
                *support_mode = atoi(info->app_info->support_mode);
        else
@@ -2290,37 +1696,12 @@ API int pkgmgrinfo_appinfo_get_support_mode(pkgmgrinfo_appinfo_h  handle, int *s
        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;
-       GList *tmp;
-       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
-
-       if (info->app_info == NULL)
-               return PMINFO_R_ERROR;
-
-       for (tmp = info->app_info->permission; tmp; tmp = tmp->next) {
-               ptr = (permission_x *)tmp->data;
-               if (ptr == NULL)
-                       continue;
-               if (ptr->value) {
-                       ret = permission_func(ptr->value, user_data);
-                       if (ret < 0)
-                               break;
-               }
-       }
-       return PMINFO_R_OK;
-}
-
 API int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
-                       pkgmgrinfo_app_category_list_cb category_func, void *user_data)
+               pkgmgrinfo_app_category_list_cb category_func, void *user_data)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(category_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
+       retvm_if(category_func == NULL, PMINFO_R_EINVAL,
+                       "Callback function is NULL");
        int ret = -1;
        const char *category;
        GList *tmp;
@@ -2341,10 +1722,11 @@ API int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
 }
 
 API int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
-                       pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data)
+               pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(metadata_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
+       retvm_if(metadata_func == NULL, PMINFO_R_EINVAL,
+                       "Callback function is NULL");
        int ret = -1;
        metadata_x *ptr;
        GList *tmp;
@@ -2358,7 +1740,8 @@ API int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
                if (ptr == NULL)
                        continue;
                if (ptr->key) {
-                       ret = metadata_func(ptr->key, ptr->value ? ptr->value : "", user_data);
+                       ret = metadata_func(ptr->key, ptr->value ?
+                                       ptr->value : "", user_data);
                        if (ret < 0)
                                break;
                }
@@ -2366,11 +1749,84 @@ API int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
        return PMINFO_R_OK;
 }
 
+API int pkgmgrinfo_appinfo_usr_foreach_appcontrol_privileges(const char *appid,
+               const char *operation,
+               pkgmgrinfo_pkg_privilege_list_cb privilege_func,
+               void *user_data, uid_t uid)
+{
+       int ret;
+       GList *privilege_list = NULL;
+       GList *tmp_list;
+
+       if (appid == NULL || operation == NULL || privilege_func == NULL) {
+               LOGE("invalid parameter");
+               return PMINFO_R_EINVAL;
+       }
+
+       ret = _appinfo_get_appcontrol_privileges(appid, operation, uid,
+                       &privilege_list);
+       if (ret == PMINFO_R_ENOENT) {
+               return PMINFO_R_OK;
+       } else if (ret != PMINFO_R_OK) {
+               g_list_free_full(privilege_list, free);
+               return ret;
+       }
+
+       for (tmp_list = privilege_list; tmp_list != NULL;
+                       tmp_list = g_list_next(tmp_list)) {
+               ret = privilege_func((char *)tmp_list->data, user_data);
+               if (ret != 0)
+                       break;
+       }
+
+       g_list_free_full(privilege_list, free);
+       return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_foreach_appcontrol_privileges(const char *appid,
+               const char *operation,
+               pkgmgrinfo_pkg_privilege_list_cb privilege_func,
+               void *user_data)
+{
+       return pkgmgrinfo_appinfo_usr_foreach_appcontrol_privileges(appid,
+                       operation, privilege_func, user_data, _getuid());
+}
+
 API int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
-                       pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data)
+               pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+       retvm_if(appcontrol_func == NULL, PMINFO_R_EINVAL,
+                       "Callback function is NULL");
+       int ret;
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+       appcontrol_x *appcontrol;
+       GList *tmp;
+
+       if (info->app_info == NULL)
+               return PMINFO_R_ERROR;
+
+       for (tmp = info->app_info->appcontrol; tmp; tmp = tmp->next) {
+               appcontrol = (appcontrol_x *)tmp->data;
+               if (appcontrol == NULL || !strcasecmp(
+                               appcontrol->visibility, "remote-only"))
+                       continue;
+               ret = appcontrol_func(appcontrol->operation,
+                               appcontrol->uri, appcontrol->mime, user_data);
+               if (ret < 0)
+                       break;
+       }
+
+       return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_foreach_remote_appcontrol(
+               pkgmgrinfo_appinfo_h handle,
+               pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(appcontrol_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
+       retvm_if(appcontrol_func == NULL, PMINFO_R_EINVAL,
+                       "Callback function is NULL");
        int ret;
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
        appcontrol_x *appcontrol;
@@ -2381,9 +1837,11 @@ API int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
 
        for (tmp = info->app_info->appcontrol; tmp; tmp = tmp->next) {
                appcontrol = (appcontrol_x *)tmp->data;
-               if (appcontrol == NULL)
+               if (appcontrol == NULL || !strcasecmp(
+                               appcontrol->visibility, "local-only"))
                        continue;
-               ret = appcontrol_func(appcontrol->operation, appcontrol->uri, appcontrol->mime, user_data);
+               ret = appcontrol_func(appcontrol->operation, appcontrol->uri,
+                               appcontrol->mime, user_data);
                if (ret < 0)
                        break;
        }
@@ -2450,10 +1908,42 @@ API int pkgmgrinfo_appinfo_foreach_splash_screen(pkgmgrinfo_appinfo_h handle,
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_is_nodisplay(pkgmgrinfo_appinfo_h handle, bool *nodisplay)
+API int pkgmgrinfo_appinfo_foreach_res_control(pkgmgrinfo_appinfo_h handle,
+               pkgmgrinfo_app_res_control_list_cb res_control_func,
+               void *user_data)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+       retvm_if(res_control_func == NULL, PMINFO_R_EINVAL,
+                       "Callback function is NULL");
+       int ret = -1;
+       res_control_x *res_control;
+       GList *tmp;
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+       if (info->app_info == NULL)
+               return PMINFO_R_ERROR;
+
+       for (tmp = info->app_info->res_control; tmp; tmp = tmp->next) {
+               res_control = (res_control_x *)tmp->data;
+               if (res_control == NULL)
+                       continue;
+               ret = res_control_func(res_control->res_type,
+                               res_control->min_res_version,
+                               res_control->max_res_version,
+                               res_control->auto_close,
+                               user_data);
+               if (ret < 0)
+                       break;
+       }
+       return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_is_nodisplay(
+               pkgmgrinfo_appinfo_h handle, bool *nodisplay)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(nodisplay == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(nodisplay == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->nodisplay == NULL)
@@ -2464,10 +1954,12 @@ API int pkgmgrinfo_appinfo_is_nodisplay(pkgmgrinfo_appinfo_h handle, bool *nodis
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_is_multiple(pkgmgrinfo_appinfo_h handle, bool *multiple)
+API int pkgmgrinfo_appinfo_is_multiple(
+               pkgmgrinfo_appinfo_h handle, bool *multiple)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(multiple == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(multiple == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->multiple == NULL)
@@ -2478,10 +1970,12 @@ API int pkgmgrinfo_appinfo_is_multiple(pkgmgrinfo_appinfo_h handle, bool *multip
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_is_indicator_display_allowed(pkgmgrinfo_appinfo_h handle, bool *indicator_disp)
+API int pkgmgrinfo_appinfo_is_indicator_display_allowed(
+               pkgmgrinfo_appinfo_h handle, bool *indicator_disp)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(indicator_disp == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(indicator_disp == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->indicatordisplay == NULL)
@@ -2492,10 +1986,12 @@ API int pkgmgrinfo_appinfo_is_indicator_display_allowed(pkgmgrinfo_appinfo_h han
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_is_taskmanage(pkgmgrinfo_appinfo_h  handle, bool *taskmanage)
+API int pkgmgrinfo_appinfo_is_taskmanage(
+               pkgmgrinfo_appinfo_h  handle, bool *taskmanage)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(taskmanage == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(taskmanage == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->taskmanage == NULL)
@@ -2506,24 +2002,28 @@ API int pkgmgrinfo_appinfo_is_taskmanage(pkgmgrinfo_appinfo_h  handle, bool *tas
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_is_enabled(pkgmgrinfo_appinfo_h  handle, bool *enabled)
+API int pkgmgrinfo_appinfo_is_enabled(
+               pkgmgrinfo_appinfo_h  handle, bool *enabled)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(enabled == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(enabled == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
-       if (info->app_info == NULL || info->app_info->enabled == NULL)
+       if (info->app_info == NULL || info->app_info->is_disabled == NULL)
                return PMINFO_R_ERROR;
 
-       *enabled = _get_bool_value(info->app_info->enabled);
+       *enabled = !_get_bool_value(info->app_info->is_disabled);
 
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_is_onboot(pkgmgrinfo_appinfo_h  handle, bool *onboot)
+API int pkgmgrinfo_appinfo_is_onboot(
+               pkgmgrinfo_appinfo_h  handle, bool *onboot)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(onboot == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(onboot == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->onboot == NULL)
@@ -2534,10 +2034,12 @@ API int pkgmgrinfo_appinfo_is_onboot(pkgmgrinfo_appinfo_h  handle, bool *onboot)
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_is_autorestart(pkgmgrinfo_appinfo_h  handle, bool *autorestart)
+API int pkgmgrinfo_appinfo_is_autorestart(
+               pkgmgrinfo_appinfo_h  handle, bool *autorestart)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(autorestart == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(autorestart == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->autorestart == NULL)
@@ -2548,10 +2050,12 @@ API int pkgmgrinfo_appinfo_is_autorestart(pkgmgrinfo_appinfo_h  handle, bool *au
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_is_mainapp(pkgmgrinfo_appinfo_h  handle, bool *mainapp)
+API int pkgmgrinfo_appinfo_is_mainapp(
+               pkgmgrinfo_appinfo_h  handle, bool *mainapp)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(mainapp == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(mainapp == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->mainapp == NULL)
@@ -2562,10 +2066,12 @@ 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)
+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");
+       retvm_if(preload == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL\n");
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->preload == NULL)
@@ -2576,10 +2082,12 @@ API int pkgmgrinfo_appinfo_is_preload(pkgmgrinfo_appinfo_h handle, bool *preload
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode)
+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");
+       retvm_if(submode == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL\n");
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->submode == NULL)
@@ -2590,7 +2098,8 @@ API int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_is_process_pool(pkgmgrinfo_appinfo_h handle, bool *process_pool)
+API int pkgmgrinfo_appinfo_is_process_pool(
+               pkgmgrinfo_appinfo_h handle, bool *process_pool)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -2607,7 +2116,8 @@ API int pkgmgrinfo_appinfo_is_process_pool(pkgmgrinfo_appinfo_h handle, bool *pr
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_is_category_exist(pkgmgrinfo_appinfo_h handle, const char *category, bool *exist)
+API int pkgmgrinfo_appinfo_is_category_exist(
+               pkgmgrinfo_appinfo_h handle, const char *category, bool *exist)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
        retvm_if(category == NULL, PMINFO_R_EINVAL, "category is NULL");
@@ -2695,10 +2205,12 @@ API int pkgmgrinfo_appinfo_is_system(pkgmgrinfo_appinfo_h handle, bool *system)
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_is_disabled(pkgmgrinfo_appinfo_h handle, bool *disabled)
+API int pkgmgrinfo_appinfo_is_disabled(
+               pkgmgrinfo_appinfo_h handle, bool *disabled)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(disabled == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       retvm_if(disabled == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->is_disabled == NULL)
@@ -2714,7 +2226,8 @@ API int pkgmgrinfo_appinfo_is_global(pkgmgrinfo_appinfo_h handle, bool *global)
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
-       retvm_if(global == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+       retvm_if(global == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL\n");
 
        if (info->app_info == NULL || info->app_info->for_all_users == NULL)
                return PMINFO_R_ERROR;
@@ -2724,7 +2237,8 @@ API int pkgmgrinfo_appinfo_is_global(pkgmgrinfo_appinfo_h handle, bool *global)
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_splash_screen_display(pkgmgrinfo_appinfo_h handle, bool *splash_screen_display)
+API int pkgmgrinfo_appinfo_get_splash_screen_display(
+               pkgmgrinfo_appinfo_h handle, bool *splash_screen_display)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -2733,11 +2247,30 @@ API int pkgmgrinfo_appinfo_get_splash_screen_display(pkgmgrinfo_appinfo_h handle
                return PMINFO_R_EINVAL;
        }
 
-       if (info->app_info == NULL || info->app_info->splash_screen_display == NULL)
+       if (info->app_info == NULL ||
+                       info->app_info->splash_screen_display == NULL)
                return PMINFO_R_ERROR;
 
-       *splash_screen_display = _get_bool_value(info->app_info->splash_screen_display);
+       *splash_screen_display =
+                       _get_bool_value(info->app_info->splash_screen_display);
+
+       return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_setup_appid(
+               pkgmgrinfo_appinfo_h handle, char **setup_appid)
+{
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+       if (info == NULL || setup_appid == NULL) {
+               _LOGE("Invalid parameter");
+               return PMINFO_R_EINVAL;
+       }
+
+       if (info->app_info == NULL || info->app_info->setup_appid == NULL)
+               return PMINFO_R_ERROR;
 
+       *setup_appid = info->app_info->setup_appid;
        return PMINFO_R_OK;
 }
 
@@ -2751,7 +2284,7 @@ API int pkgmgrinfo_appinfo_is_support_ambient(pkgmgrinfo_appinfo_h handle,
                return PMINFO_R_EINVAL;
        }
 
-       if (info->app_info == NULL || info->app_info->support_ambient)
+       if (info->app_info == NULL || info->app_info->support_ambient == NULL)
                return PMINFO_R_ERROR;
 
        *support_ambient = _get_bool_value(info->app_info->support_ambient);
@@ -2759,28 +2292,48 @@ API int pkgmgrinfo_appinfo_is_support_ambient(pkgmgrinfo_appinfo_h handle,
        return PMINFO_R_OK;
 }
 
+API int pkgmgrinfo_appinfo_get_light_user_switch_mode(
+               pkgmgrinfo_appinfo_h handle, char **mode)
+{
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+       if (info == NULL || mode == NULL) {
+               _LOGE("Invalid parameter");
+               return PMINFO_R_EINVAL;
+       }
+
+       if (info->app_info == NULL || info->app_info->light_user_switch_mode == NULL)
+               return PMINFO_R_ERROR;
+
+       *mode = info->app_info->light_user_switch_mode;
+
+       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");
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
        __cleanup_appinfo(info);
        return PMINFO_R_OK;
 }
 
 API int pkgmgrinfo_appinfo_filter_create(pkgmgrinfo_appinfo_filter_h *handle)
 {
-       return (pkgmgrinfo_pkginfo_filter_create(handle));
+       return pkgmgrinfo_pkginfo_filter_create(handle);
 }
 
 API int pkgmgrinfo_appinfo_filter_destroy(pkgmgrinfo_appinfo_filter_h handle)
 {
-       return (pkgmgrinfo_pkginfo_filter_destroy(handle));
+       return pkgmgrinfo_pkginfo_filter_destroy(handle);
 }
 
 static gint __compare_func(gconstpointer data1, gconstpointer data2)
 {
        pkgmgrinfo_node_x *node1 = (pkgmgrinfo_node_x *)data1;
        pkgmgrinfo_node_x *node2 = (pkgmgrinfo_node_x *)data2;
+
        if (node1->prop == node2->prop)
                return 0;
        else if (node1->prop > node2->prop)
@@ -2792,12 +2345,15 @@ static gint __compare_func(gconstpointer data1, gconstpointer data2)
 API int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle,
                                const char *property, const int value)
 {
-       retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
-       retvm_if(property == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+       retvm_if(handle == NULL, PMINFO_R_EINVAL,
+                       "Filter handle input parameter is NULL\n");
+       retvm_if(property == NULL, PMINFO_R_EINVAL,
+                       "Filter handle input parameter is NULL\n");
        char buf[PKG_VALUE_STRING_LEN_MAX] = {'\0'};
        char *val = NULL;
        GSList *link = NULL;
        int prop = -1;
+
        prop = _pminfo_appinfo_convert_to_prop_int(property);
        if (prop < E_PMINFO_APPINFO_PROP_APP_MIN_INT ||
                prop > E_PMINFO_APPINFO_PROP_APP_MAX_INT) {
@@ -2805,7 +2361,8 @@ API int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle,
                return PMINFO_R_EINVAL;
        }
        pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x *)handle;
-       pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x *)calloc(1, sizeof(pkgmgrinfo_node_x));
+       pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x *)calloc(1,
+                       sizeof(pkgmgrinfo_node_x));
        if (node == NULL) {
                _LOGE("Out of Memory!!!\n");
                return PMINFO_R_ERROR;
@@ -2820,11 +2377,18 @@ API int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle,
        }
        node->prop = prop;
        node->value = val;
-       /*If API is called multiple times for same property, we should override the previous values.
-       Last value set will be used for filtering.*/
-       link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
-       if (link)
+
+       /*
+        * If API is called multiple times for same property,
+        * we should override the previous values.
+        * Last value set will be used for filtering.
+        */
+       link = g_slist_find_custom(filter->list,
+                       (gconstpointer)node, __compare_func);
+       if (link) {
+               _pkgmgrinfo_node_destroy(link->data);
                filter->list = g_slist_delete_link(filter->list, link);
+       }
        filter->list = g_slist_append(filter->list, (gpointer)node);
        return PMINFO_R_OK;
 
@@ -2833,11 +2397,14 @@ API int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle,
 API int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle,
                                const char *property, const bool value)
 {
-       retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
-       retvm_if(property == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+       retvm_if(handle == NULL, PMINFO_R_EINVAL,
+                       "Filter handle input parameter is NULL\n");
+       retvm_if(property == NULL, PMINFO_R_EINVAL,
+                       "Filter handle input parameter is NULL\n");
        char *val = NULL;
        GSList *link = NULL;
        int prop = -1;
+
        prop = _pminfo_appinfo_convert_to_prop_bool(property);
        if (prop < E_PMINFO_APPINFO_PROP_APP_MIN_BOOL ||
                prop > E_PMINFO_APPINFO_PROP_APP_MAX_BOOL) {
@@ -2845,7 +2412,8 @@ API int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle,
                return PMINFO_R_EINVAL;
        }
        pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x *)handle;
-       pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x *)calloc(1, sizeof(pkgmgrinfo_node_x));
+       pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x *)calloc(1,
+                       sizeof(pkgmgrinfo_node_x));
        if (node == NULL) {
                _LOGE("Out of Memory!!!\n");
                return PMINFO_R_ERROR;
@@ -2862,11 +2430,17 @@ API int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle,
        }
        node->prop = prop;
        node->value = val;
-       /*If API is called multiple times for same property, we should override the previous values.
-       Last value set will be used for filtering.*/
-       link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
-       if (link)
+       /*
+        * If API is called multiple times for same property,
+        * we should override the previous values.
+        * Last value set will be used for filtering.
+        */
+       link = g_slist_find_custom(filter->list,
+                       (gconstpointer)node, __compare_func);
+       if (link) {
+               _pkgmgrinfo_node_destroy(link->data);
                filter->list = g_slist_delete_link(filter->list, link);
+       }
        filter->list = g_slist_append(filter->list, (gpointer)node);
        return PMINFO_R_OK;
 
@@ -2875,15 +2449,20 @@ API int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle,
 API int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
                                const char *property, const char *value)
 {
-       retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
-       retvm_if(property == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
-       retvm_if(value == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+       retvm_if(handle == NULL, PMINFO_R_EINVAL,
+                       "Filter handle input parameter is NULL\n");
+       retvm_if(property == NULL, PMINFO_R_EINVAL,
+                       "Filter handle input parameter is NULL\n");
+       retvm_if(value == NULL, PMINFO_R_EINVAL,
+                       "Filter handle input parameter is NULL\n");
        char *val = NULL;
        pkgmgrinfo_node_x *ptr = NULL;
        char prev[PKG_STRING_LEN_MAX] = {'\0'};
        char temp[PKG_STRING_LEN_MAX] = {'\0'};
        GSList *link = NULL;
        int prop = -1;
+       int ret;
+
        prop = _pminfo_appinfo_convert_to_prop_str(property);
        if (prop < E_PMINFO_APPINFO_PROP_APP_MIN_STR ||
                prop > E_PMINFO_APPINFO_PROP_APP_MAX_STR) {
@@ -2891,7 +2470,8 @@ API int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
                return PMINFO_R_EINVAL;
        }
        pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x *)handle;
-       pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x *)calloc(1, sizeof(pkgmgrinfo_node_x));
+       pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x *)calloc(1,
+                       sizeof(pkgmgrinfo_node_x));
        if (node == NULL) {
                _LOGE("Out of Memory!!!\n");
                return PMINFO_R_ERROR;
@@ -2900,9 +2480,12 @@ API int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
        switch (prop) {
        case E_PMINFO_APPINFO_PROP_APP_COMPONENT:
                node->value = strdup(value);
-               link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
-               if (link)
+               link = g_slist_find_custom(filter->list,
+                               (gconstpointer)node, __compare_func);
+               if (link) {
+                       _pkgmgrinfo_node_destroy(link->data);
                        filter->list = g_slist_delete_link(filter->list, link);
+               }
                filter->list = g_slist_append(filter->list, (gpointer)node);
                break;
        case E_PMINFO_APPINFO_PROP_APP_CATEGORY:
@@ -2913,79 +2496,101 @@ API int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
                        node = NULL;
                        return PMINFO_R_ERROR;
                }
-               link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
+               link = g_slist_find_custom(filter->list,
+                               (gconstpointer)node, __compare_func);
                if (link) {
                        ptr = (pkgmgrinfo_node_x *)link->data;
                        strncpy(prev, ptr->value, PKG_STRING_LEN_MAX - 1);
                        _LOGI("Previous value is %s\n", prev);
+                       _pkgmgrinfo_node_destroy(ptr);
                        filter->list = g_slist_delete_link(filter->list, link);
-                       snprintf(temp, PKG_STRING_LEN_MAX - 1, "%s,%s", prev, value);
-                       strncpy(val, temp, PKG_STRING_LEN_MAX - 1);
+                       ret = snprintf(temp, PKG_STRING_LEN_MAX - 1,
+                                       "%s,%s", prev, value);
+                       if (ret < 0 || ret > PKG_STRING_LEN_MAX - 1) {
+                               _LOGE("snprintf fail\n");
+                               free(node);
+                               free(val);
+                               return PMINFO_R_ERROR;
+                       }
+                       strncpy(val, temp, PKG_STRING_LEN_MAX);
                        _LOGI("New value is %s\n", val);
                        node->value = val;
-                       filter->list = g_slist_append(filter->list, (gpointer)node);
+                       filter->list = g_slist_append(
+                                       filter->list, (gpointer)node);
                        memset(temp, '\0', PKG_STRING_LEN_MAX);
                } else {
                        snprintf(temp, PKG_STRING_LEN_MAX - 1, "%s", value);
-                       strncpy(val, temp, PKG_STRING_LEN_MAX - 1);
+                       strncpy(val, temp, PKG_STRING_LEN_MAX);
                        _LOGI("First value is %s\n", val);
                        node->value = val;
-                       filter->list = g_slist_append(filter->list, (gpointer)node);
+                       filter->list = g_slist_append(
+                                       filter->list, (gpointer)node);
                        memset(temp, '\0', PKG_STRING_LEN_MAX);
                }
                break;
        default:
                node->value = strndup(value, PKG_STRING_LEN_MAX - 1);
-               link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
-               if (link)
+               link = g_slist_find_custom(filter->list,
+                               (gconstpointer)node, __compare_func);
+               if (link) {
+                       _pkgmgrinfo_node_destroy(link->data);
                        filter->list = g_slist_delete_link(filter->list, link);
+               }
                filter->list = g_slist_append(filter->list, (gpointer)node);
                break;
        }
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_usr_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count, uid_t uid)
+API int pkgmgrinfo_appinfo_usr_filter_count(
+               pkgmgrinfo_appinfo_filter_h handle, int *count, uid_t uid)
 {
-       int ret;
-       char *locale;
        GHashTable *list;
+       int ret;
+       int query_count;
+       pkgmgrinfo_filter_x *filter;
 
        if (handle == NULL || count == NULL) {
                _LOGE("invalid parameter");
                return PMINFO_R_EINVAL;
        }
 
-       locale = _get_system_locale();
-       if (locale == NULL)
-               return PMINFO_R_ERROR;
-
+       filter = (pkgmgrinfo_filter_x *)handle;
        list = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
                        __free_applications);
-       if (list == NULL) {
-               free(locale);
+       if (list == NULL)
                return PMINFO_R_ERROR;
-       }
 
-       ret = _appinfo_get_applications(uid, uid, locale, handle, 0, list);
-       if (ret == PMINFO_R_OK && uid != GLOBAL_USER)
-               ret = _appinfo_get_applications(GLOBAL_USER, uid, locale,
-                               handle, 0, list);
+       if (__check_disable_filter_exist(
+                       handle, E_APPINFO_DISABLE_TYPE_APP) == false) {
+               if (pkgmgrinfo_appinfo_filter_add_bool(handle,
+                               PMINFO_APPINFO_PROP_APP_DISABLE, false)) {
+                       g_hash_table_destroy(list);
+                       return PMINFO_R_ERROR;
+               }
+       }
 
-       if (ret != PMINFO_R_OK) {
-               g_hash_table_destroy(list);
-               free(locale);
-               return PMINFO_R_ERROR;
+       if (__check_disable_filter_exist(
+                       handle, E_APPINFO_DISABLE_TYPE_PKG) == false) {
+               if (pkgmgrinfo_appinfo_filter_add_bool(handle,
+                               PMINFO_APPINFO_PROP_PKG_DISABLE, false)) {
+                       g_hash_table_destroy(list);
+                       return PMINFO_R_ERROR;
+               }
        }
 
-       *count = g_hash_table_size(list);
+       ret = _appinfo_get_applications(uid, filter, 0, list);
+       query_count = g_hash_table_size(list);
        g_hash_table_destroy(list);
-       free(locale);
+       if (ret == PMINFO_R_ERROR)
+               return ret;
 
+       *count = query_count;
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count)
+API int pkgmgrinfo_appinfo_filter_count(
+               pkgmgrinfo_appinfo_filter_h handle, int *count)
 {
        return pkgmgrinfo_appinfo_usr_filter_count(handle, count, _getuid());
 }
@@ -2999,47 +2604,72 @@ API int pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(
                return PMINFO_R_EINVAL;
        }
 
-       return _appinfo_get_filtered_foreach_appinfo(uid, handle, PMINFO_APPINFO_GET_ALL, app_cb,
-                       user_data);
+       if (__check_disable_filter_exist(
+                       handle, E_APPINFO_DISABLE_TYPE_APP) == false) {
+               if (pkgmgrinfo_appinfo_filter_add_bool(handle,
+                               PMINFO_APPINFO_PROP_APP_DISABLE, false))
+                       return PMINFO_R_ERROR;
+       }
+
+       if (__check_disable_filter_exist(
+                       handle, E_APPINFO_DISABLE_TYPE_PKG) == false) {
+               if (pkgmgrinfo_appinfo_filter_add_bool(handle,
+                               PMINFO_APPINFO_PROP_PKG_DISABLE, false))
+                       return PMINFO_R_ERROR;
+       }
+
+       return _appinfo_get_filtered_foreach_appinfo(uid,
+                       handle, PMINFO_APPINFO_GET_ALL, app_cb, user_data);
 }
 
-API int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h handle,
-                               pkgmgrinfo_app_list_cb app_cb, void *user_data)
+API int pkgmgrinfo_appinfo_filter_foreach_appinfo(
+               pkgmgrinfo_appinfo_filter_h handle,
+               pkgmgrinfo_app_list_cb app_cb, void *user_data)
 {
-       return pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(handle, app_cb, user_data, _getuid());
+       return pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(
+                       handle, app_cb, user_data, _getuid());
 }
 
-API int pkgmgrinfo_appinfo_metadata_filter_create(pkgmgrinfo_appinfo_metadata_filter_h *handle)
+API int pkgmgrinfo_appinfo_metadata_filter_create(
+               pkgmgrinfo_appinfo_metadata_filter_h *handle)
 {
-       return (pkgmgrinfo_pkginfo_filter_create(handle));
+       return pkgmgrinfo_pkginfo_filter_create(handle);
 }
 
-API int pkgmgrinfo_appinfo_metadata_filter_destroy(pkgmgrinfo_appinfo_metadata_filter_h handle)
+API int pkgmgrinfo_appinfo_metadata_filter_destroy(
+               pkgmgrinfo_appinfo_metadata_filter_h handle)
 {
-       return (pkgmgrinfo_pkginfo_filter_destroy(handle));
+       return pkgmgrinfo_pkginfo_filter_destroy(handle);
 }
 
 API int pkgmgrinfo_appinfo_metadata_filter_add(
                pkgmgrinfo_appinfo_metadata_filter_h handle,
                const char *key, const char *value)
 {
-       int ret;
-
-       ret = pkgmgrinfo_appinfo_filter_add_string(handle,
-                       PMINFO_APPINFO_PROP_APP_METADATA_KEY, key);
-       if (ret != PMINFO_R_OK)
-               return ret;
+       pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x *)handle;
+       pkgmgrinfo_metadata_node_x *node;
 
        /* value can be NULL.
         * In that case all apps with specified key should be displayed
         */
-       if (value && strlen(value)) {
-               ret = pkgmgrinfo_appinfo_filter_add_string(handle,
-                               PMINFO_APPINFO_PROP_APP_METADATA_VALUE, value);
-               if (ret != PMINFO_R_OK)
-                       return ret;
+       if (key == NULL) {
+               LOGE("invalid parameter");
+               return PMINFO_R_EINVAL;
+       }
+
+       node = calloc(1, sizeof(pkgmgrinfo_metadata_node_x));
+       if (node == NULL) {
+               LOGE("out of memory");
+               return PMINFO_R_ERROR;
        }
 
+       node->key = strdup(key);
+       if (value && strlen(value))
+               node->value = strdup(value);
+
+       filter->list_metadata = g_slist_append(filter->list_metadata,
+                       (gpointer)node);
+
        return PMINFO_R_OK;
 }
 
@@ -3052,7 +2682,18 @@ API int pkgmgrinfo_appinfo_usr_metadata_filter_foreach(
                return PMINFO_R_EINVAL;
        }
 
-       return _appinfo_get_filtered_foreach_appinfo(uid, handle, PMINFO_APPINFO_GET_ALL, app_cb,
+       pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x *)handle;
+
+       if (pkgmgrinfo_appinfo_filter_add_bool(filter,
+                       PMINFO_APPINFO_PROP_APP_DISABLE, false))
+               return PMINFO_R_ERROR;
+
+       if (pkgmgrinfo_appinfo_filter_add_bool(filter,
+                       PMINFO_APPINFO_PROP_PKG_DISABLE, false))
+               return PMINFO_R_ERROR;
+
+       return _appinfo_get_filtered_foreach_appinfo(uid, handle,
+                       PMINFO_APPINFO_GET_ALL, app_cb,
                        user_data);
 }
 
@@ -3064,15 +2705,78 @@ API int pkgmgrinfo_appinfo_metadata_filter_foreach(
                        user_data, _getuid());
 }
 
-API int pkgmgrinfo_appinfo_is_guestmode_visibility(pkgmgrinfo_appinfo_h handle, bool *status)
+API int pkgmgrinfo_appinfo_is_guestmode_visibility(
+               pkgmgrinfo_appinfo_h handle, bool *status)
 {
        const char *val;
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
-       retvm_if(status == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+       retvm_if(status == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL\n");
 
        val = info->app_info->guestmode_visibility;
        *status = _get_bool_value(val);
        return PMINFO_R_OK;
 }
+
+API int pkgmgrinfo_appinfo_foreach_appcontrol_v2(pkgmgrinfo_appinfo_h handle,
+               pkgmgrinfo_app_control_list_cb_v2 appcontrol_func,
+               void *user_data)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+       retvm_if(appcontrol_func == NULL,
+                       PMINFO_R_EINVAL, "Callback function is NULL");
+       int ret;
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+       appcontrol_x *appcontrol;
+       GList *tmp;
+
+       if (info->app_info == NULL)
+               return PMINFO_R_ERROR;
+
+       for (tmp = info->app_info->appcontrol; tmp; tmp = tmp->next) {
+               appcontrol = (appcontrol_x *)tmp->data;
+               if (appcontrol == NULL ||
+                               !strcasecmp(appcontrol->visibility,
+                                               "remote-only"))
+                       continue;
+               ret = appcontrol_func(appcontrol->operation, appcontrol->uri,
+                               appcontrol->mime, appcontrol->id, user_data);
+               if (ret < 0)
+                       break;
+       }
+
+       return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_foreach_remote_appcontrol_v2(
+               pkgmgrinfo_appinfo_h handle,
+               pkgmgrinfo_app_control_list_cb_v2 appcontrol_func,
+               void *user_data)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+       retvm_if(appcontrol_func == NULL,
+                       PMINFO_R_EINVAL, "Callback function is NULL");
+       int ret;
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+       appcontrol_x *appcontrol;
+       GList *tmp;
+
+       if (info->app_info == NULL)
+               return PMINFO_R_ERROR;
+
+       for (tmp = info->app_info->appcontrol; tmp; tmp = tmp->next) {
+               appcontrol = (appcontrol_x *)tmp->data;
+               if (appcontrol == NULL ||
+                               !strcasecmp(appcontrol->visibility,
+                                               "local-only"))
+                       continue;
+               ret = appcontrol_func(appcontrol->operation, appcontrol->uri,
+                               appcontrol->mime, appcontrol->id, user_data);
+               if (ret < 0)
+                       break;
+       }
+
+       return PMINFO_R_OK;
+}