app query will check package disable 99/94199/4
authorJunghyun Yeon <jungh.yeon@samsung.com>
Thu, 27 Oct 2016 11:23:27 +0000 (20:23 +0900)
committerjongmyeong ko <jongmyeong.ko@samsung.com>
Thu, 3 Nov 2016 14:04:47 +0000 (07:04 -0700)
Change-Id: Ia015094e44f571d7a23e2bb1b5e98ccc03f20204
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/pkgmgrinfo_appinfo.c

index e16d0ef..c231d28 100644 (file)
@@ -61,13 +61,19 @@ static int _get_filtered_query(pkgmgrinfo_filter_x *filter,
        char *condition = NULL;
        char buf[MAX_QUERY_LEN] = { '\0' };
        char tmp_query[MAX_QUERY_LEN] = { '\0' };
+       static const char query_pkg_disable[] = " AND ai.package IN "
+                       "(SELECT package FROM package_info WHERE package_disable='false')";
        GSList *list;
 
-       if (filter == NULL)
-               return PMINFO_R_OK;
-
        len += strlen(" WHERE 1=1");
        strncat(buf, " WHERE 1=1", MAX_QUERY_LEN - len - 1);
+
+       if (filter == NULL) {
+               strncat(buf, query_pkg_disable, MAX_QUERY_LEN - len - 1);
+               *query = strdup(buf);
+               return PMINFO_R_OK;
+       }
+
        for (list = filter->list; list; list = list->next) {
                joined |= __get_filter_condition(list->data, &condition, bind_params);
                if (condition == NULL)
@@ -101,6 +107,9 @@ static int _get_filtered_query(pkgmgrinfo_filter_x *filter,
        }
        strncat(tmp_query, buf, MAX_QUERY_LEN - len - 1);
 
+       len += strlen(buf);
+       strncat(tmp_query, query_pkg_disable, MAX_QUERY_LEN - len - 1);
+
        *query = strdup(tmp_query);
        if (*query == NULL)
                return PMINFO_R_ERROR;