int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode);
/**
+ * @fn int pkgmgrinfo_appinfo_is_category_exist(pkgmgrinfo_appinfo_h handle, const char *category, bool *exist)
+ * @brief This API checks if the application has the given category
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle
+ * @param[in] category category
+ * @param[out] exist value Gets whether the application has the given category
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @code
+static int is_category_exist(const char *appid, const char *category)
+{
+ int ret = 0;
+ pkgmgrinfo_appinfo_h handle;
+ bool exist = false;
+
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+
+ ret = pkgmgrinfo_appinfo_is_category_exist(handle, category, &exist);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_category_exist(pkgmgrinfo_appinfo_h handle, const char *category, bool *exist);
+
+/**
* @fn int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
* @brief This API destroys the application information handle freeing up all the resources
*
return PMINFO_R_OK;
}
+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(exist == NULL, PMINFO_R_EINVAL, "exist is NULL");
+
+ category_x *ptr = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ *exist = 0;
+
+ ptr = info->uiapp_info->category;
+
+ for (; ptr; ptr = ptr->next) {
+ if (ptr->name) {
+ if (strcasecmp(ptr->name, category) == 0)
+ {
+ *exist = 1;
+ break;
+ }
+ }
+ }
+
+ 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");