Fix appinfo filter for component type 33/68133/1 accepted/tizen/common/20160504.125251 accepted/tizen/ivi/20160503.093013 accepted/tizen/mobile/20160503.092914 accepted/tizen/tv/20160503.092939 accepted/tizen/wearable/20160503.092951 submit/tizen/20160503.003646
authorDaehyeon Jung <darrenh.jung@samsung.com>
Mon, 2 May 2016 11:41:16 +0000 (20:41 +0900)
committerDaehyeon Jung <darrenh.jung@samsung.com>
Mon, 2 May 2016 11:41:16 +0000 (20:41 +0900)
Change-Id: I49a6cb8854cbc74d2d38c6edb18268e41bd6b705

include/pkgmgrinfo_type.h
src/pkgmgrinfo_appinfo.c

index 433b3c3..1e1591c 100644 (file)
@@ -107,16 +107,6 @@ enum {
  */
 #define        PMINFO_PKGINFO_INSTALL_LOCATION_EXTERNAL        "LOCATION_EXTERNAL"
 
-/**
- * @brief Value to be used when filtering based on app-component
- */
-#define        PMINFO_APPINFO_UI_APP                           "UI_APP"
-
-/**
- * @brief Value to be used when filtering based on app-component
- */
-#define        PMINFO_APPINFO_SVC_APP                          "SVC_APP"
-
 typedef enum {
        PMINFO_HWACCELERATION_NOT_USE_GL = 0,           /**< Don't use hardware acceleration*/
        PMINFO_HWACCELERATION_USE_GL = 1,               /**< Use hardware acceleration*/
index 4092952..1c6c2c2 100644 (file)
@@ -1369,6 +1369,8 @@ static int _appinfo_get_filtered_foreach_appinfo(uid_t uid,
        return PMINFO_R_OK;
 }
 
+static const char *__appcomponent_str(pkgmgrinfo_app_component comp);
+
 API int pkgmgrinfo_appinfo_get_usr_list(pkgmgrinfo_pkginfo_h handle,
                pkgmgrinfo_app_component component,
                pkgmgrinfo_app_list_cb app_func, void *user_data, uid_t uid)
@@ -1405,16 +1407,7 @@ API int pkgmgrinfo_appinfo_get_usr_list(pkgmgrinfo_pkginfo_h handle,
                }
        }
 
-       switch (component) {
-       case PMINFO_UI_APP:
-               comp_str = PMINFO_APPINFO_UI_APP;
-               break;
-       case PMINFO_SVC_APP:
-               comp_str = PMINFO_APPINFO_SVC_APP;
-               break;
-       default:
-               break;
-       }
+       comp_str = __appcomponent_str(component);
 
        if (comp_str) {
                if (pkgmgrinfo_appinfo_filter_add_string(filter,
@@ -1768,6 +1761,22 @@ static pkgmgrinfo_app_component __appcomponent_convert(const char *comp)
                return -1;
 }
 
+static const char *__appcomponent_str(pkgmgrinfo_app_component comp)
+{
+       switch (comp) {
+       case PMINFO_UI_APP:
+               return "uiapp";
+       case PMINFO_SVC_APP:
+               return "svcapp";
+       case PMINFO_WIDGET_APP:
+               return "widgetapp";
+       case PMINFO_WATCH_APP:
+               return "watchapp";
+       default:
+               return NULL;
+       }
+}
+
 API int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
@@ -2848,11 +2857,7 @@ API int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
        node->prop = prop;
        switch (prop) {
        case E_PMINFO_APPINFO_PROP_APP_COMPONENT:
-               if (strcmp(value, PMINFO_APPINFO_UI_APP) == 0)
-                       val = strndup("uiapp", PKG_STRING_LEN_MAX - 1);
-               else
-                       val = strndup("svcapp", PKG_STRING_LEN_MAX - 1);
-               node->value = val;
+               node->value = strdup(value);
                link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
                if (link)
                        filter->list = g_slist_delete_link(filter->list, link);