Fix 'PMINFO_APPINFO_PROP_PKG_DISABLE' filter for cache
[platform/core/appfw/pkgmgr-info.git] / src / pkgmgrinfo_appinfo.c
index 42e475f..8ea2611 100644 (file)
@@ -7,13 +7,13 @@
 #include <sys/types.h>
 #include <dlfcn.h>
 
 #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 <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)
 {
 
 static bool _get_bool_value(const char *str)
 {
@@ -36,7 +36,6 @@ static void __cleanup_appinfo(pkgmgr_appinfo_x *data)
                pkgmgrinfo_basic_free_application(info->app_info);
                free((void *)info);
        }
                pkgmgrinfo_basic_free_application(info->app_info);
                free((void *)info);
        }
-       return;
 }
 
 static void __free_applications(gpointer data)
 }
 
 static void __free_applications(gpointer data)
@@ -65,7 +64,8 @@ static bool __check_disable_filter_exist(pkgmgrinfo_filter_x *filter,
        if (filter == NULL)
                return false;
 
        if (filter == NULL)
                return false;
 
-       link = g_slist_find_custom(filter->list, GINT_TO_POINTER(type), __disable_chk_func);
+       link = g_slist_find_custom(filter->list,
+                       GINT_TO_POINTER(type), __disable_chk_func);
        if (link)
                return true;
 
        if (link)
                return true;
 
@@ -80,8 +80,8 @@ static int _pkgmgrinfo_get_appinfo(const char *appid, uid_t uid,
        pkgmgr_appinfo_x *info;
 
        if (appid == NULL || filter == NULL || handle == NULL) {
        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;
        }
 
        list = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
        }
 
        list = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
@@ -89,9 +89,15 @@ static int _pkgmgrinfo_get_appinfo(const char *appid, uid_t uid,
        if (list == NULL)
                return PMINFO_R_ERROR;
 
        if (list == NULL)
                return PMINFO_R_ERROR;
 
-       // TODO: need to use pkginfo-client APIs
+       ret = _appinfo_get_applications(uid, filter,
+                       PMINFO_APPINFO_GET_ALL, list);
+       if (ret != PMINFO_R_OK) {
+               g_hash_table_destroy(list);
+               return ret;
+       }
 
 
-       if (!g_hash_table_size(list)) {
+       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);
                _LOGD("appinfo for [%s] is not existed for user [%d]",
                                appid, uid);
                g_hash_table_destroy(list);
@@ -106,17 +112,17 @@ static int _pkgmgrinfo_get_appinfo(const char *appid, uid_t uid,
        }
 
        info->app_info = (application_x *)g_hash_table_lookup(list, appid);
        }
 
        info->app_info = (application_x *)g_hash_table_lookup(list, appid);
-       if (!info->app_info || !info->app_info->package) {
-               _LOGD("appinfo for [%s] is not existed for user [%d]",
-                               appid, uid);
+       info->locale = strdup(info->app_info->locale);
+       if (!info->locale) {
+               _LOGE("out of memory");
                g_hash_table_destroy(list);
                free(info);
                g_hash_table_destroy(list);
                free(info);
-               return PMINFO_R_ENOENT;
+               return PMINFO_R_ERROR;
        }
        }
-       //info->locale = locale;
        info->package = strdup(info->app_info->package);
        if (!info->package) {
                _LOGE("out of memory");
        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;
                g_hash_table_destroy(list);
                free(info);
                return PMINFO_R_ERROR;
@@ -131,8 +137,8 @@ static int _pkgmgrinfo_get_appinfo(const char *appid, uid_t uid,
        return ret;
 }
 
        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;
 {
        int ret;
        pkgmgrinfo_appinfo_filter_h filter;
@@ -166,9 +172,31 @@ API int pkgmgrinfo_appinfo_get_usr_disabled_appinfo(const char *appid, uid_t uid
        return ret;
 }
 
        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);
+}
+
+static char *__get_real_appid(const char *appid)
 {
 {
-       return pkgmgrinfo_appinfo_get_usr_disabled_appinfo(appid, _getuid(), handle);
+       char *str;
+       char *saveptr;
+       char *token;
+
+       str = strdup(appid);
+       if (str == NULL)
+               return NULL;
+
+       token = strtok_r(str, "::", &saveptr);
+       if (token == NULL)
+               return str;
+
+       LOGD("Real appid = %s", token);
+       token = strdup(token);
+       free(str);
+       return token;
 }
 
 API int pkgmgrinfo_appinfo_get_usr_appinfo(const char *appid, uid_t uid,
 }
 
 API int pkgmgrinfo_appinfo_get_usr_appinfo(const char *appid, uid_t uid,
@@ -176,6 +204,7 @@ API int pkgmgrinfo_appinfo_get_usr_appinfo(const char *appid, uid_t uid,
 {
        int ret;
        pkgmgrinfo_appinfo_filter_h filter;
 {
        int ret;
        pkgmgrinfo_appinfo_filter_h filter;
+       char *real_appid;
 
        if (appid == NULL || handle == NULL) {
                LOGE("invalid parameter");
 
        if (appid == NULL || handle == NULL) {
                LOGE("invalid parameter");
@@ -186,10 +215,18 @@ API int pkgmgrinfo_appinfo_get_usr_appinfo(const char *appid, uid_t uid,
        if (ret != PMINFO_R_OK)
                return ret;
 
        if (ret != PMINFO_R_OK)
                return ret;
 
+       real_appid = __get_real_appid(appid);
+       if (real_appid == NULL) {
+               LOGE("Out of memory");
+               pkgmgrinfo_appinfo_filter_destroy(filter);
+               return PMINFO_R_ERROR;
+       }
+
        ret = pkgmgrinfo_appinfo_filter_add_string(filter,
        ret = pkgmgrinfo_appinfo_filter_add_string(filter,
-                       PMINFO_APPINFO_PROP_APP_ID, appid);
+                       PMINFO_APPINFO_PROP_APP_ID, real_appid);
        if (ret != PMINFO_R_OK) {
                pkgmgrinfo_appinfo_filter_destroy(filter);
        if (ret != PMINFO_R_OK) {
                pkgmgrinfo_appinfo_filter_destroy(filter);
+               free(real_appid);
                return PMINFO_R_ERROR;
        }
 
                return PMINFO_R_ERROR;
        }
 
@@ -197,6 +234,7 @@ API int pkgmgrinfo_appinfo_get_usr_appinfo(const char *appid, uid_t uid,
                        PMINFO_APPINFO_PROP_APP_DISABLE, false);
        if (ret != PMINFO_R_OK) {
                pkgmgrinfo_appinfo_filter_destroy(filter);
                        PMINFO_APPINFO_PROP_APP_DISABLE, false);
        if (ret != PMINFO_R_OK) {
                pkgmgrinfo_appinfo_filter_destroy(filter);
+               free(real_appid);
                return PMINFO_R_ERROR;
        }
 
                return PMINFO_R_ERROR;
        }
 
@@ -204,15 +242,18 @@ API int pkgmgrinfo_appinfo_get_usr_appinfo(const char *appid, uid_t uid,
                        PMINFO_APPINFO_PROP_PKG_DISABLE, false);
        if (ret != PMINFO_R_OK) {
                pkgmgrinfo_appinfo_filter_destroy(filter);
                        PMINFO_APPINFO_PROP_PKG_DISABLE, false);
        if (ret != PMINFO_R_OK) {
                pkgmgrinfo_appinfo_filter_destroy(filter);
+               free(real_appid);
                return PMINFO_R_ERROR;
        }
 
                return PMINFO_R_ERROR;
        }
 
-       ret = _pkgmgrinfo_get_appinfo(appid, uid, filter, handle);
+       ret = _pkgmgrinfo_get_appinfo(real_appid, uid, filter, handle);
+       free(real_appid);
        pkgmgrinfo_appinfo_filter_destroy(filter);
        return ret;
 }
 
        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);
 }
 {
        return pkgmgrinfo_appinfo_get_usr_appinfo(appid, _getuid(), handle);
 }
@@ -252,7 +293,8 @@ API int pkgmgrinfo_appinfo_get_usr_all_appinfo(const char *appid, uid_t uid,
        return ret;
 }
 
        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);
 }
 {
        return pkgmgrinfo_appinfo_get_usr_all_appinfo(appid, _getuid(), handle);
 }
@@ -414,7 +456,32 @@ static gpointer __copy_splashscreens(gconstpointer src, gpointer data)
        return splashscreen;
 }
 
        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;
 {
        application_x *app_info;
        int ret;
@@ -458,7 +525,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)
        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)
        if (data->component != NULL)
                app_info->component = strdup(data->component);
        if (data->permission_type != NULL)
@@ -490,7 +558,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)
        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;
 
        /* GList */
        ret = 0;
@@ -518,7 +587,8 @@ static int _appinfo_copy_appinfo(application_x **application, application_x *dat
        }
 
        ret = 0;
        }
 
        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);
        if (ret < 0) {
                LOGE("memory alloc failed");
                pkgmgrinfo_basic_free_application(app_info);
@@ -526,7 +596,8 @@ static int _appinfo_copy_appinfo(application_x **application, application_x *dat
        }
 
        ret = 0;
        }
 
        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);
        if (ret < 0) {
                LOGE("memory alloc failed");
                pkgmgrinfo_basic_free_application(app_info);
@@ -534,7 +605,8 @@ static int _appinfo_copy_appinfo(application_x **application, application_x *dat
        }
 
        ret = 0;
        }
 
        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);
        if (ret < 0) {
                LOGE("memory alloc failed");
                pkgmgrinfo_basic_free_application(app_info);
@@ -542,7 +614,9 @@ static int _appinfo_copy_appinfo(application_x **application, application_x *dat
        }
 
        ret = 0;
        }
 
        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);
        if (ret < 0) {
                LOGE("memory alloc failed");
                pkgmgrinfo_basic_free_application(app_info);
@@ -550,7 +624,16 @@ static int _appinfo_copy_appinfo(application_x **application, application_x *dat
        }
 
        ret = 0;
        }
 
        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);
        if (ret < 0) {
                LOGE("memory alloc failed");
                pkgmgrinfo_basic_free_application(app_info);
@@ -600,7 +683,8 @@ API int pkgmgrinfo_appinfo_clone_appinfo(pkgmgrinfo_appinfo_h handle,
 }
 
 static int _appinfo_get_filtered_foreach_appinfo(uid_t uid,
 }
 
 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)
 {
        application_x *app;
                void *user_data)
 {
        application_x *app;
@@ -608,18 +692,25 @@ static int _appinfo_get_filtered_foreach_appinfo(uid_t uid,
        GHashTable *list;
        GHashTableIter iter;
        gpointer value;
        GHashTable *list;
        GHashTableIter iter;
        gpointer value;
+       int ret;
 
        list = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
                        __free_applications);
        if (list == NULL)
                return PMINFO_R_ERROR;
 
 
        list = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
                        __free_applications);
        if (list == NULL)
                return PMINFO_R_ERROR;
 
-       // TODO: use pkginfo-client APIs to get appinfo
+       ret = _appinfo_get_applications(uid, filter,
+                       flag | PMINFO_APPINFO_GET_BASICINFO, list);
+       if (ret == PMINFO_R_ERROR) {
+               g_hash_table_destroy(list);
+               return ret;
+       }
+
        g_hash_table_iter_init(&iter, list);
        while (g_hash_table_iter_next(&iter, NULL, &value)) {
                app = (application_x *)value;
                info.app_info = app;
        g_hash_table_iter_init(&iter, list);
        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;
                info.package = app->package;
                if (app_list_cb(&info, user_data) < 0)
                        break;
@@ -688,7 +779,8 @@ API int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle,
                pkgmgrinfo_app_component component,
                pkgmgrinfo_app_list_cb app_func, void *user_data)
 {
                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(
 }
 
 API int pkgmgrinfo_appinfo_get_usr_installed_list_full(
@@ -787,7 +879,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");
        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;
 
        if (info->app_info == NULL || info->app_info->appid == NULL)
                return PMINFO_R_ERROR;
@@ -796,12 +889,14 @@ API int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h handle, char **appid)
        return PMINFO_R_OK;
 }
 
        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");
 {
        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;
 
        if (info->package == NULL)
                return PMINFO_R_ERROR;
@@ -816,7 +911,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");
        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;
 
        if (info->package == NULL)
                return PMINFO_R_ERROR;
@@ -826,10 +922,12 @@ API int pkgmgrinfo_appinfo_get_pkgid(pkgmgrinfo_appinfo_h handle, char **pkgid)
        return PMINFO_R_OK;
 }
 
        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(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;
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        *pkgtype = (char *)info->app_info->package_type;
@@ -842,7 +940,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");
        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;
 
        if (info->app_info == NULL || info->app_info->exec == NULL)
                return PMINFO_R_ERROR;
@@ -858,7 +957,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");
        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;
 
        if (info->app_info == NULL)
                return PMINFO_R_ERROR;
@@ -890,7 +990,8 @@ API int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label)
        GList *tmp;
 
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
        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");
+       retvm_if(label == NULL, PMINFO_R_EINVAL,
+                       "Argument supplied to hold return value is NULL");
 
        if (info->app_info == NULL)
                return PMINFO_R_ERROR;
 
        if (info->app_info == NULL)
                return PMINFO_R_ERROR;
@@ -925,57 +1026,36 @@ API int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label)
        return PMINFO_R_OK;
 }
 
        return PMINFO_R_OK;
 }
 
-static char *_get_localed_label(const char *appid, const char *locale, uid_t uid)
-{
-       char *query = NULL;
-
-       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");
-               return NULL;
-       }
-
-       // TODO: need to use pkginfo-client APIs
-       sqlite3_free(query);
-       return NULL;
-}
-
-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;
 
 {
        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;
        if (val == NULL)
                return PMINFO_R_ERROR;
 
        *label = val;
-
        return PMINFO_R_OK;
 }
 
        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(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;
 
        GList *list_md = NULL;
        metadata_x *metadata = NULL;
@@ -990,7 +1070,8 @@ API int pkgmgrinfo_appinfo_get_metadata_value(pkgmgrinfo_appinfo_h handle, const
                                if (metadata->value == NULL)
                                        *metadata_value = "";
                                else
                                if (metadata->value == NULL)
                                        *metadata_value = "";
                                else
-                                       *metadata_value = (char *)metadata->value;
+                                       *metadata_value =
+                                                       (char *)metadata->value;
                                return PMINFO_R_OK;
                        }
                }
                                return PMINFO_R_OK;
                        }
                }
@@ -1033,13 +1114,16 @@ static const char *__appcomponent_str(pkgmgrinfo_app_component comp)
        }
 }
 
        }
 }
 
-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");
 {
        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;
 
        if (info->app_info == NULL)
                return PMINFO_R_ERROR;
@@ -1053,12 +1137,14 @@ API int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo
        return PMINFO_R_OK;
 }
 
        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");
 {
        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;
 
        if (info->app_info == NULL || info->app_info->type == NULL)
                return PMINFO_R_ERROR;
@@ -1067,7 +1153,8 @@ API int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h handle, char **app_t
        return PMINFO_R_OK;
 }
 
        return PMINFO_R_OK;
 }
 
-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;
 {
        char *val;
        icon_x *ptr;
@@ -1075,7 +1162,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");
        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;
 
        if (info->app_info == NULL)
                return PMINFO_R_ERROR;
@@ -1095,13 +1183,15 @@ API int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, ch
        return PMINFO_R_ERROR;
 }
 
        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");
 {
        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;
 
        if (info->app_info == NULL || info->app_info->recentimage == NULL)
                return PMINFO_R_ERROR;
@@ -1117,7 +1207,8 @@ API int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h handle, pk
        return PMINFO_R_OK;
 }
 
        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;
 {
        char *val;
        image_x *ptr;
@@ -1125,7 +1216,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");
        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;
 
        if (info->app_info == NULL)
                return PMINFO_R_ERROR;
@@ -1145,13 +1237,16 @@ API int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h handle, char *
        return PMINFO_R_ERROR;
 }
 
        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");
 {
        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)
 
        val = info->app_info->permission_type;
        if (val == NULL)
@@ -1167,12 +1262,14 @@ API int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgm
        return PMINFO_R_OK;
 }
 
        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");
 {
        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;
 
        if (info->app_info == NULL || info->app_info->component_type == NULL)
                return PMINFO_R_ERROR;
@@ -1182,13 +1279,16 @@ API int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h handle, char
        return PMINFO_R_OK;
 }
 
        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");
 {
        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;
 
        if (info->app_info == NULL || info->app_info->hwacceleration == NULL)
                return PMINFO_R_ERROR;
@@ -1204,13 +1304,16 @@ API int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h handle, pkgmg
        return PMINFO_R_OK;
 }
 
        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");
 {
        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;
 
        if (info->app_info == NULL || info->app_info->screenreader == NULL)
                return PMINFO_R_ERROR;
@@ -1226,13 +1329,17 @@ API int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h handle, pkgmgri
        return PMINFO_R_OK;
 }
 
        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");
 {
        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;
 
        if (info->app_info == NULL)
                return PMINFO_R_ERROR;
@@ -1250,7 +1357,8 @@ API int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h handle, char **p
        return PMINFO_R_OK;
 }
 
        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;
 
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -1267,12 +1375,14 @@ API int pkgmgrinfo_appinfo_get_effectimage_type(pkgmgrinfo_appinfo_h handle, cha
        return PMINFO_R_OK;
 }
 
        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");
 {
        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;
 
        if (info->app_info == NULL)
                return PMINFO_R_ERROR;
@@ -1285,18 +1395,22 @@ API int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h  handle, char
        return PMINFO_R_OK;
 }
 
        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) {
 {
        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;
                        *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;
        }
        } else {
                return PMINFO_R_ERROR;
        }
@@ -1304,12 +1418,14 @@ API int pkgmgrinfo_appinfo_get_installed_storage_location(pkgmgrinfo_appinfo_h h
        return PMINFO_R_OK;
 }
 
        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");
 {
        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;
 
        if (info->app_info->launch_mode == NULL)
                return PMINFO_R_ERROR;
@@ -1319,7 +1435,8 @@ API int pkgmgrinfo_appinfo_get_launch_mode(pkgmgrinfo_appinfo_h handle, char **m
        return PMINFO_R_OK;
 }
 
        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;
 
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -1336,7 +1453,8 @@ API int pkgmgrinfo_appinfo_get_alias_appid(pkgmgrinfo_appinfo_h handle, char **a
        return PMINFO_R_OK;
 }
 
        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;
 
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -1356,7 +1474,8 @@ API int pkgmgrinfo_appinfo_get_effective_appid(pkgmgrinfo_appinfo_h handle, char
        return PMINFO_R_OK;
 }
 
        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;
 
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -1376,7 +1495,8 @@ API int pkgmgrinfo_appinfo_get_tep_name(pkgmgrinfo_appinfo_h handle, char **tep_
        return PMINFO_R_OK;
 }
 
        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;
 
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -1396,7 +1516,8 @@ API int pkgmgrinfo_appinfo_get_zip_mount_file(pkgmgrinfo_appinfo_h handle, char
        return PMINFO_R_OK;
 }
 
        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;
 
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -1413,7 +1534,8 @@ API int pkgmgrinfo_appinfo_get_root_path(pkgmgrinfo_appinfo_h handle, char **roo
        return PMINFO_R_OK;
 }
 
        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;
 
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -1430,7 +1552,8 @@ API int pkgmgrinfo_appinfo_get_api_version(pkgmgrinfo_appinfo_h handle, char **a
        return PMINFO_R_OK;
 }
 
        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;
 
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -1439,7 +1562,8 @@ API int pkgmgrinfo_appinfo_get_installed_time(pkgmgrinfo_appinfo_h handle, int *
                return PMINFO_R_EINVAL;
        }
 
                return PMINFO_R_EINVAL;
        }
 
-       if (info->app_info == NULL || info->app_info->package_installed_time == NULL)
+       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_ERROR;
 
        *installed_time = atoi(info->app_info->package_installed_time);
@@ -1447,36 +1571,6 @@ API int pkgmgrinfo_appinfo_get_installed_time(pkgmgrinfo_appinfo_h handle, int *
        return PMINFO_R_OK;
 }
 
        return PMINFO_R_OK;
 }
 
-static int _appinfo_get_datacontrol_info(const char *providerid,
-               const char *type, char **appid, char **access)
-{
-       char *query = NULL;
-
-
-       query = sqlite3_mprintf("SELECT app_id, access FROM package_app_data_control "
-               "WHERE providerid=%Q AND type=%Q", providerid, type);
-       if (query == NULL) {
-               LOGE("Out of memory");
-               return PMINFO_R_ERROR;
-       }
-
-       // TODO: need to use pkginfo-client APIs
-       sqlite3_free(query);
-       return PMINFO_R_OK;
-}
-
-static int _pkgmgrinfo_appinfo_get_datacontrol_info(uid_t uid,
-               const char *providerid, const char *type,
-               char **appid, char **access)
-{
-       int ret;
-
-       ret = _appinfo_get_datacontrol_info(providerid, type, appid,
-                       access);
-
-       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_usr_get_datacontrol_info(const char *providerid,
                const char *type, uid_t uid, char **appid, char **access)
 {
@@ -1488,12 +1582,8 @@ API int pkgmgrinfo_appinfo_usr_get_datacontrol_info(const char *providerid,
                return PMINFO_R_EINVAL;
        }
 
                return PMINFO_R_EINVAL;
        }
 
-       ret = _pkgmgrinfo_appinfo_get_datacontrol_info(GLOBAL_USER, providerid,
-                       type, appid, access);
-       if (ret == PMINFO_R_ENOENT && uid != GLOBAL_USER)
-               ret = _pkgmgrinfo_appinfo_get_datacontrol_info(uid, providerid,
-                               type, appid, access);
-
+       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...
        /* FIXME: It should return PMINFO_R_ENOENT but to keep previous
         * implementation, return PMINFO_R_ERROR. This should be
         * modified later...
@@ -1513,32 +1603,6 @@ API int pkgmgrinfo_appinfo_get_datacontrol_info(const char *providerid,
                        type, _getuid(), appid, access);
 }
 
                        type, _getuid(), appid, access);
 }
 
-static int _appinfo_get_datacontrol_appid(const char *providerid,
-               char **appid)
-{
-       char *query = NULL;
-
-       query = sqlite3_mprintf("SELECT app_id FROM package_app_data_control "
-               "WHERE providerid=%Q", providerid);
-       if (query == NULL) {
-               LOGE("Out of memory");
-               return PMINFO_R_ERROR;
-       }
-
-       // TODO: change to use pkginfo-client APIs
-       sqlite3_free(query);
-       return PMINFO_R_OK;
-}
-
-static int _pkgmgrinfo_appinfo_get_datacontrol_appid(uid_t uid,
-               const char *providerid, char **appid)
-{
-       int ret;
-
-       ret = _appinfo_get_datacontrol_appid(providerid, appid);
-       return ret;
-}
-
 API int pkgmgrinfo_appinfo_usr_get_datacontrol_appid(const char *providerid,
                uid_t uid, char **appid)
 {
 API int pkgmgrinfo_appinfo_usr_get_datacontrol_appid(const char *providerid,
                uid_t uid, char **appid)
 {
@@ -1549,12 +1613,7 @@ API int pkgmgrinfo_appinfo_usr_get_datacontrol_appid(const char *providerid,
                return PMINFO_R_EINVAL;
        }
 
                return PMINFO_R_EINVAL;
        }
 
-       ret = _pkgmgrinfo_appinfo_get_datacontrol_appid(GLOBAL_USER, providerid,
-                       appid);
-       if (ret == PMINFO_R_ENOENT && uid != GLOBAL_USER)
-               ret = _pkgmgrinfo_appinfo_get_datacontrol_appid(uid, providerid,
-                               appid);
-
+       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...
        /* FIXME: It should return PMINFO_R_ENOENT but to keep previous
         * implementation, return PMINFO_R_ERROR. This should be
         * modified later...
@@ -1567,26 +1626,11 @@ API int pkgmgrinfo_appinfo_usr_get_datacontrol_appid(const char *providerid,
        return ret;
 }
 
        return ret;
 }
 
-API int pkgmgrinfo_appinfo_get_datacontrol_appid(const char *providerid, char **appid)
-{
-       return pkgmgrinfo_appinfo_usr_get_datacontrol_appid(providerid, _getuid(), appid);
-}
-
-static int _pkgmgrinfo_appinfo_get_datacontrol_trusted_info(uid_t uid,
-               const char *providerid, const char *type, char **appid,
-               bool *is_trusted)
+API int pkgmgrinfo_appinfo_get_datacontrol_appid(
+               const char *providerid, char **appid)
 {
 {
-       char *query = NULL;
-
-       query = sqlite3_mprintf(
-               "SELECT app_id, trusted FROM package_app_data_control "
-               "WHERE providerid=%Q AND type=%Q", providerid, type);
-       if (query == NULL)
-               return -1;
-
-       // TODO: need to use pkginfo-client APIs
-       sqlite3_free(query);
-       return 0;
+       return pkgmgrinfo_appinfo_usr_get_datacontrol_appid(
+                               providerid, _getuid(), appid);
 }
 
 API int pkgmgrinfo_appinfo_usr_get_datacontrol_trusted_info(
 }
 
 API int pkgmgrinfo_appinfo_usr_get_datacontrol_trusted_info(
@@ -1594,6 +1638,7 @@ API int pkgmgrinfo_appinfo_usr_get_datacontrol_trusted_info(
                char **appid, bool *is_trusted)
 {
        int ret;
                char **appid, bool *is_trusted)
 {
        int ret;
+       char *trusted = NULL;
 
        if (providerid == NULL || type == NULL || appid == NULL ||
                        is_trusted == NULL) {
 
        if (providerid == NULL || type == NULL || appid == NULL ||
                        is_trusted == NULL) {
@@ -1601,11 +1646,8 @@ API int pkgmgrinfo_appinfo_usr_get_datacontrol_trusted_info(
                return PMINFO_R_EINVAL;
        }
 
                return PMINFO_R_EINVAL;
        }
 
-       ret = _pkgmgrinfo_appinfo_get_datacontrol_trusted_info(GLOBAL_USER,
-                       providerid, type, appid, is_trusted);
-       if (ret == PMINFO_R_ENOENT && uid != GLOBAL_USER)
-               ret = _pkgmgrinfo_appinfo_get_datacontrol_trusted_info(uid,
-                               providerid, type, appid, is_trusted);
+       ret = _appinfo_get_datacontrol_trusted_info(providerid, type, uid,
+                       appid, &trusted);
 
        /* FIXME: It should return PMINFO_R_ENOENT but to keep previous
         * implementation, return PMINFO_R_ERROR. This should be
 
        /* FIXME: It should return PMINFO_R_ENOENT but to keep previous
         * implementation, return PMINFO_R_ERROR. This should be
@@ -1615,6 +1657,8 @@ API int pkgmgrinfo_appinfo_usr_get_datacontrol_trusted_info(
                LOGE("no datacontrol trusted info of %s", providerid);
                ret = PMINFO_R_ERROR;
        }
                LOGE("no datacontrol trusted info of %s", providerid);
                ret = PMINFO_R_ERROR;
        }
+       *is_trusted = _get_bool_value(trusted);
+       free(trusted);
 
        return ret;
 }
 
        return ret;
 }
@@ -1626,59 +1670,36 @@ API int pkgmgrinfo_appinfo_get_datacontrol_trsuted_info(const char *providerid,
                        type, _getuid(), appid, is_trusted);
 }
 
                        type, _getuid(), appid, is_trusted);
 }
 
-static int _appinfo_foreach_datacontrol_privileges(
-               const char *providerid, const char *type,
-               pkgmgrinfo_pkg_privilege_list_cb callback, void *user_data)
-{
-       char *query = NULL;
-
-       query = sqlite3_mprintf(
-               "SELECT privilege FROM package_app_data_control_privilege "
-               "WHERE providerid=%Q AND type=%Q", providerid, type);
-       if (query == NULL) {
-               LOGE("Out of memory");
-               return PMINFO_R_ERROR;
-       }
-
-       // TODO: need to change to use pkginfo-client APIs
-       sqlite3_free(query);
-       return 0;
-}
-
-static int _pkgmgrinfo_appinfo_foreach_datacontrol_privileges(uid_t uid,
-               const char *providerid, const char *type,
-               pkgmgrinfo_pkg_privilege_list_cb callback, void *user_data)
-{
-       int ret;
-
-       ret = _appinfo_foreach_datacontrol_privileges(providerid, type,
-                       callback, user_data);
-
-       return ret;
-}
-
 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)
 {
        int ret;
 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)
 {
        int ret;
+       int count = 0;
+       GList *list = NULL;
+       GList *tmp = NULL;
 
        if (providerid == NULL || type == NULL || privilege_func == NULL) {
                LOGE("invalid parameter");
                return PMINFO_R_EINVAL;
        }
 
 
        if (providerid == NULL || type == NULL || privilege_func == NULL) {
                LOGE("invalid parameter");
                return PMINFO_R_EINVAL;
        }
 
-       ret = _pkgmgrinfo_appinfo_foreach_datacontrol_privileges(GLOBAL_USER,
-                       providerid, type, privilege_func, user_data);
-       if (ret == PMINFO_R_ENOENT && uid != GLOBAL_USER)
-               ret = _pkgmgrinfo_appinfo_foreach_datacontrol_privileges(uid,
-                               providerid, type, privilege_func, user_data);
+       ret = _appinfo_get_datacontrol_privileges(providerid, type, uid, &list);
+       if (ret == PMINFO_R_ERROR) {
+               g_list_free_full(list, free);
+               return ret;
+       }
 
 
-       if (ret == PMINFO_R_ENOENT)
-               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;
+       }
 
 
-       return ret;
+       g_list_free_full(list, free);
+       return PMINFO_R_OK;
 }
 
 API int pkgmgrinfo_appinfo_foreach_datacontrol_privileges(
 }
 
 API int pkgmgrinfo_appinfo_foreach_datacontrol_privileges(
@@ -1690,12 +1711,15 @@ API int pkgmgrinfo_appinfo_foreach_datacontrol_privileges(
                        providerid, type, privilege_func, user_data, _getuid());
 }
 
                        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(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;
 
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
        if (info->app_info->support_mode)
                *support_mode = atoi(info->app_info->support_mode);
        else
        if (info->app_info->support_mode)
                *support_mode = atoi(info->app_info->support_mode);
        else
@@ -1705,10 +1729,11 @@ API int pkgmgrinfo_appinfo_get_support_mode(pkgmgrinfo_appinfo_h  handle, int *s
 }
 
 API int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
 }
 
 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(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;
        int ret = -1;
        const char *category;
        GList *tmp;
@@ -1729,10 +1754,11 @@ API int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
 }
 
 API int pkgmgrinfo_appinfo_foreach_metadata(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(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;
        int ret = -1;
        metadata_x *ptr;
        GList *tmp;
@@ -1746,7 +1772,8 @@ API int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
                if (ptr == NULL)
                        continue;
                if (ptr->key) {
                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;
                }
                        if (ret < 0)
                                break;
                }
@@ -1754,59 +1781,38 @@ API int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
        return PMINFO_R_OK;
 }
 
        return PMINFO_R_OK;
 }
 
-static int _appinfo_foreach_appcontrol_privileges(
-               const char *appid, const char *operation,
-               pkgmgrinfo_pkg_privilege_list_cb callback, void *user_data)
-{
-       char *query = NULL;
-
-       query = sqlite3_mprintf(
-               "SELECT app_control, privilege FROM package_app_app_control_privilege "
-               "WHERE app_id=%Q", appid);
-       if (query == NULL) {
-               LOGE("Out of memory");
-               return PMINFO_R_ERROR;
-       }
-
-       // TODO: need to remove this codes and change to use pkginfo-client APIs
-       sqlite3_free(query);
-       return 0;
-}
-
-static int _pkgmgrinfo_appinfo_foreach_appcontrol_privileges(uid_t uid,
-               const char *appid, const char *operation,
-               pkgmgrinfo_pkg_privilege_list_cb callback, void *user_data)
-{
-       int ret;
-
-       ret = _appinfo_foreach_appcontrol_privileges(appid, operation,
-                       callback, user_data);
-
-       return ret;
-}
-
 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;
 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;
        }
 
 
        if (appid == NULL || operation == NULL || privilege_func == NULL) {
                LOGE("invalid parameter");
                return PMINFO_R_EINVAL;
        }
 
-       ret = _pkgmgrinfo_appinfo_foreach_appcontrol_privileges(GLOBAL_USER,
-                       appid, operation, privilege_func, user_data);
-       if (ret == PMINFO_R_ENOENT && uid != GLOBAL_USER)
-               ret = _pkgmgrinfo_appinfo_foreach_appcontrol_privileges(uid,
-                               appid, operation, privilege_func, user_data);
+       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;
+       }
 
 
-       if (ret == PMINFO_R_ENOENT)
-               ret = PMINFO_R_OK;
+       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;
+       }
 
 
-       return ret;
+       g_list_free_full(privilege_list, free);
+       return PMINFO_R_OK;
 }
 
 API int pkgmgrinfo_appinfo_foreach_appcontrol_privileges(const char *appid,
 }
 
 API int pkgmgrinfo_appinfo_foreach_appcontrol_privileges(const char *appid,
@@ -1819,10 +1825,11 @@ API int pkgmgrinfo_appinfo_foreach_appcontrol_privileges(const char *appid,
 }
 
 API int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
 }
 
 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(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;
        int ret;
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
        appcontrol_x *appcontrol;
@@ -1833,9 +1840,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;
 
        for (tmp = info->app_info->appcontrol; tmp; tmp = tmp->next) {
                appcontrol = (appcontrol_x *)tmp->data;
-               if (appcontrol == NULL || !strcasecmp(appcontrol->visibility, "remote-only"))
+               if (appcontrol == NULL || !strcasecmp(
+                               appcontrol->visibility, "remote-only"))
                        continue;
                        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;
        }
                if (ret < 0)
                        break;
        }
@@ -1843,11 +1852,13 @@ API int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
        return PMINFO_R_OK;
 }
 
        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)
+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(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;
        int ret;
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
        appcontrol_x *appcontrol;
@@ -1858,9 +1869,11 @@ API int pkgmgrinfo_appinfo_foreach_remote_appcontrol(pkgmgrinfo_appinfo_h handle
 
        for (tmp = info->app_info->appcontrol; tmp; tmp = tmp->next) {
                appcontrol = (appcontrol_x *)tmp->data;
 
        for (tmp = info->app_info->appcontrol; tmp; tmp = tmp->next) {
                appcontrol = (appcontrol_x *)tmp->data;
-               if (appcontrol == NULL || !strcasecmp(appcontrol->visibility, "local-only"))
+               if (appcontrol == NULL || !strcasecmp(
+                               appcontrol->visibility, "local-only"))
                        continue;
                        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;
        }
                if (ret < 0)
                        break;
        }
@@ -1927,10 +1940,42 @@ API int pkgmgrinfo_appinfo_foreach_splash_screen(pkgmgrinfo_appinfo_h handle,
        return PMINFO_R_OK;
 }
 
        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(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(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");
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->nodisplay == NULL)
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->nodisplay == NULL)
@@ -1941,10 +1986,12 @@ API int pkgmgrinfo_appinfo_is_nodisplay(pkgmgrinfo_appinfo_h handle, bool *nodis
        return PMINFO_R_OK;
 }
 
        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(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)
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->multiple == NULL)
@@ -1955,10 +2002,12 @@ API int pkgmgrinfo_appinfo_is_multiple(pkgmgrinfo_appinfo_h handle, bool *multip
        return PMINFO_R_OK;
 }
 
        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(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)
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->indicatordisplay == NULL)
@@ -1969,10 +2018,12 @@ API int pkgmgrinfo_appinfo_is_indicator_display_allowed(pkgmgrinfo_appinfo_h han
        return PMINFO_R_OK;
 }
 
        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(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)
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->taskmanage == NULL)
@@ -1983,10 +2034,12 @@ API int pkgmgrinfo_appinfo_is_taskmanage(pkgmgrinfo_appinfo_h  handle, bool *tas
        return PMINFO_R_OK;
 }
 
        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(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->is_disabled == NULL)
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->is_disabled == NULL)
@@ -1997,10 +2050,12 @@ API int pkgmgrinfo_appinfo_is_enabled(pkgmgrinfo_appinfo_h  handle, bool *enable
        return PMINFO_R_OK;
 }
 
        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(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)
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->onboot == NULL)
@@ -2011,10 +2066,12 @@ API int pkgmgrinfo_appinfo_is_onboot(pkgmgrinfo_appinfo_h  handle, bool *onboot)
        return PMINFO_R_OK;
 }
 
        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(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)
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->autorestart == NULL)
@@ -2025,10 +2082,12 @@ API int pkgmgrinfo_appinfo_is_autorestart(pkgmgrinfo_appinfo_h  handle, bool *au
        return PMINFO_R_OK;
 }
 
        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(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)
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->mainapp == NULL)
@@ -2039,10 +2098,12 @@ API int pkgmgrinfo_appinfo_is_mainapp(pkgmgrinfo_appinfo_h  handle, bool *mainap
        return PMINFO_R_OK;
 }
 
        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(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)
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->preload == NULL)
@@ -2053,10 +2114,12 @@ API int pkgmgrinfo_appinfo_is_preload(pkgmgrinfo_appinfo_h handle, bool *preload
        return PMINFO_R_OK;
 }
 
        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(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)
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->submode == NULL)
@@ -2067,7 +2130,8 @@ API int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode
        return PMINFO_R_OK;
 }
 
        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;
 
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -2084,7 +2148,8 @@ API int pkgmgrinfo_appinfo_is_process_pool(pkgmgrinfo_appinfo_h handle, bool *pr
        return PMINFO_R_OK;
 }
 
        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");
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
        retvm_if(category == NULL, PMINFO_R_EINVAL, "category is NULL");
@@ -2172,10 +2237,12 @@ API int pkgmgrinfo_appinfo_is_system(pkgmgrinfo_appinfo_h handle, bool *system)
        return PMINFO_R_OK;
 }
 
        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(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)
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
        if (info->app_info == NULL || info->app_info->is_disabled == NULL)
@@ -2191,7 +2258,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");
        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;
 
        if (info->app_info == NULL || info->app_info->for_all_users == NULL)
                return PMINFO_R_ERROR;
@@ -2201,7 +2269,8 @@ API int pkgmgrinfo_appinfo_is_global(pkgmgrinfo_appinfo_h handle, bool *global)
        return PMINFO_R_OK;
 }
 
        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;
 
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -2210,15 +2279,18 @@ API int pkgmgrinfo_appinfo_get_splash_screen_display(pkgmgrinfo_appinfo_h handle
                return PMINFO_R_EINVAL;
        }
 
                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;
 
                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;
 }
 
 
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_setup_appid(pkgmgrinfo_appinfo_h handle, char **setup_appid)
+API int pkgmgrinfo_appinfo_get_setup_appid(
+               pkgmgrinfo_appinfo_h handle, char **setup_appid)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
@@ -2252,28 +2324,48 @@ API int pkgmgrinfo_appinfo_is_support_ambient(pkgmgrinfo_appinfo_h handle,
        return PMINFO_R_OK;
 }
 
        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;
 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)
 {
        __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)
 {
 }
 
 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;
 }
 
 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)
        if (node1->prop == node2->prop)
                return 0;
        else if (node1->prop > node2->prop)
@@ -2285,12 +2377,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)
 {
 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;
        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) {
        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) {
@@ -2298,7 +2393,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;
                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;
        if (node == NULL) {
                _LOGE("Out of Memory!!!\n");
                return PMINFO_R_ERROR;
@@ -2313,11 +2409,18 @@ API int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle,
        }
        node->prop = prop;
        node->value = val;
        }
        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_delete_link(filter->list, link);
+       }
        filter->list = g_slist_append(filter->list, (gpointer)node);
        return PMINFO_R_OK;
 
        filter->list = g_slist_append(filter->list, (gpointer)node);
        return PMINFO_R_OK;
 
@@ -2326,11 +2429,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)
 {
 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;
        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) {
        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) {
@@ -2338,7 +2444,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;
                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;
        if (node == NULL) {
                _LOGE("Out of Memory!!!\n");
                return PMINFO_R_ERROR;
@@ -2355,11 +2462,17 @@ API int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle,
        }
        node->prop = prop;
        node->value = val;
        }
        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_delete_link(filter->list, link);
+       }
        filter->list = g_slist_append(filter->list, (gpointer)node);
        return PMINFO_R_OK;
 
        filter->list = g_slist_append(filter->list, (gpointer)node);
        return PMINFO_R_OK;
 
@@ -2368,9 +2481,12 @@ 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)
 {
 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 *val = NULL;
        pkgmgrinfo_node_x *ptr = NULL;
        char prev[PKG_STRING_LEN_MAX] = {'\0'};
@@ -2378,6 +2494,7 @@ API int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
        GSList *link = NULL;
        int prop = -1;
        int ret;
        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) {
        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) {
@@ -2385,7 +2502,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;
                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;
        if (node == NULL) {
                _LOGE("Out of Memory!!!\n");
                return PMINFO_R_ERROR;
@@ -2394,9 +2512,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);
        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_delete_link(filter->list, link);
+               }
                filter->list = g_slist_append(filter->list, (gpointer)node);
                break;
        case E_PMINFO_APPINFO_PROP_APP_CATEGORY:
                filter->list = g_slist_append(filter->list, (gpointer)node);
                break;
        case E_PMINFO_APPINFO_PROP_APP_CATEGORY:
@@ -2407,13 +2528,16 @@ API int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
                        node = NULL;
                        return PMINFO_R_ERROR;
                }
                        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);
                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);
                        filter->list = g_slist_delete_link(filter->list, link);
-                       ret = snprintf(temp, PKG_STRING_LEN_MAX - 1, "%s,%s", prev, value);
+                       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);
                        if (ret < 0 || ret > PKG_STRING_LEN_MAX - 1) {
                                _LOGE("snprintf fail\n");
                                free(node);
@@ -2423,37 +2547,47 @@ API int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
                        strncpy(val, temp, PKG_STRING_LEN_MAX);
                        _LOGI("New value is %s\n", val);
                        node->value = val;
                        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);
                        _LOGI("First value is %s\n", val);
                        node->value = val;
                        memset(temp, '\0', PKG_STRING_LEN_MAX);
                } else {
                        snprintf(temp, PKG_STRING_LEN_MAX - 1, "%s", value);
                        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);
                        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_delete_link(filter->list, link);
+               }
                filter->list = g_slist_append(filter->list, (gpointer)node);
                break;
        }
        return PMINFO_R_OK;
 }
 
                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)
 {
        GHashTable *list;
 {
        GHashTable *list;
+       int ret;
+       int query_count;
+       pkgmgrinfo_filter_x *filter;
 
        if (handle == NULL || count == NULL) {
                _LOGE("invalid parameter");
                return PMINFO_R_EINVAL;
        }
 
 
        if (handle == NULL || count == NULL) {
                _LOGE("invalid parameter");
                return PMINFO_R_EINVAL;
        }
 
+       filter = (pkgmgrinfo_filter_x *)handle;
        list = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
                        __free_applications);
        if (list == NULL)
        list = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
                        __free_applications);
        if (list == NULL)
@@ -2477,14 +2611,18 @@ API int pkgmgrinfo_appinfo_usr_filter_count(pkgmgrinfo_appinfo_filter_h handle,
                }
        }
 
                }
        }
 
-       // TODO: use pkginfo-client APIs
-       *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);
        g_hash_table_destroy(list);
+       if (ret == PMINFO_R_ERROR)
+               return ret;
 
 
+       *count = query_count;
        return PMINFO_R_OK;
 }
 
        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());
 }
 {
        return pkgmgrinfo_appinfo_usr_filter_count(handle, count, _getuid());
 }
@@ -2512,24 +2650,28 @@ API int pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(
                        return PMINFO_R_ERROR;
        }
 
                        return PMINFO_R_ERROR;
        }
 
-       return _appinfo_get_filtered_foreach_appinfo(uid, handle, PMINFO_APPINFO_GET_ALL, app_cb,
-                       user_data);
+       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(
 }
 
 API int pkgmgrinfo_appinfo_metadata_filter_add(
@@ -2573,6 +2715,7 @@ API int pkgmgrinfo_appinfo_usr_metadata_filter_foreach(
        }
 
        pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x *)handle;
        }
 
        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_APP_DISABLE, false))
                return PMINFO_R_ERROR;
@@ -2581,7 +2724,8 @@ API int pkgmgrinfo_appinfo_usr_metadata_filter_foreach(
                        PMINFO_APPINFO_PROP_PKG_DISABLE, false))
                return PMINFO_R_ERROR;
 
                        PMINFO_APPINFO_PROP_PKG_DISABLE, false))
                return PMINFO_R_ERROR;
 
-       return _appinfo_get_filtered_foreach_appinfo(uid, handle, PMINFO_APPINFO_GET_ALL, app_cb,
+       return _appinfo_get_filtered_foreach_appinfo(uid, handle,
+                       PMINFO_APPINFO_GET_ALL, app_cb,
                        user_data);
 }
 
                        user_data);
 }
 
@@ -2593,13 +2737,15 @@ API int pkgmgrinfo_appinfo_metadata_filter_foreach(
                        user_data, _getuid());
 }
 
                        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");
 {
        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);
 
        val = info->app_info->guestmode_visibility;
        *status = _get_bool_value(val);
@@ -2611,7 +2757,8 @@ API int pkgmgrinfo_appinfo_foreach_appcontrol_v2(pkgmgrinfo_appinfo_h handle,
                void *user_data)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
                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;
        int ret;
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
        appcontrol_x *appcontrol;
@@ -2623,7 +2770,8 @@ API int pkgmgrinfo_appinfo_foreach_appcontrol_v2(pkgmgrinfo_appinfo_h handle,
        for (tmp = info->app_info->appcontrol; tmp; tmp = tmp->next) {
                appcontrol = (appcontrol_x *)tmp->data;
                if (appcontrol == NULL ||
        for (tmp = info->app_info->appcontrol; tmp; tmp = tmp->next) {
                appcontrol = (appcontrol_x *)tmp->data;
                if (appcontrol == NULL ||
-                               !strcasecmp(appcontrol->visibility, "remote-only"))
+                               !strcasecmp(appcontrol->visibility,
+                                               "remote-only"))
                        continue;
                ret = appcontrol_func(appcontrol->operation, appcontrol->uri,
                                appcontrol->mime, appcontrol->id, user_data);
                        continue;
                ret = appcontrol_func(appcontrol->operation, appcontrol->uri,
                                appcontrol->mime, appcontrol->id, user_data);
@@ -2640,7 +2788,8 @@ API int pkgmgrinfo_appinfo_foreach_remote_appcontrol_v2(
                void *user_data)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
                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;
        int ret;
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
        appcontrol_x *appcontrol;
@@ -2652,7 +2801,8 @@ API int pkgmgrinfo_appinfo_foreach_remote_appcontrol_v2(
        for (tmp = info->app_info->appcontrol; tmp; tmp = tmp->next) {
                appcontrol = (appcontrol_x *)tmp->data;
                if (appcontrol == NULL ||
        for (tmp = info->app_info->appcontrol; tmp; tmp = tmp->next) {
                appcontrol = (appcontrol_x *)tmp->data;
                if (appcontrol == NULL ||
-                               !strcasecmp(appcontrol->visibility, "local-only"))
+                               !strcasecmp(appcontrol->visibility,
+                                               "local-only"))
                        continue;
                ret = appcontrol_func(appcontrol->operation, appcontrol->uri,
                                appcontrol->mime, appcontrol->id, user_data);
                        continue;
                ret = appcontrol_func(appcontrol->operation, appcontrol->uri,
                                appcontrol->mime, appcontrol->id, user_data);