*/
int pkgmgr_client_decrypt_package(pkgmgr_client *pc, const char *drm_file_path, const char *decrypted_file_path);
+/**
+ * @brief Add a package to blacklist
+ *
+ * This API adds a package to blacklist.\n
+ *
+ * @param[in] pc The pointer to pkgmgr_client instance
+ * @param[in] pkgid package id
+ * @return 0 if success, error code(<0) if fail\n
+ * @retval PKGMGR_R_OK success
+ * @retval PKGMGR_R_EINVAL invalid argument
+ * @retval PKGMGR_R_ECOMM communication error
+ * @retval PKGMGR_R_EPRIV privilege denied
+ */
+int pkgmgr_client_add_blacklist(pkgmgr_client *pc, const char *pkgid);
+int pkgmgr_client_usr_add_blacklist(pkgmgr_client *pc, const char *pkgid, uid_t uid);
+
+/**
+ * @brief Remove a package to blacklist
+ *
+ * This API removes a package to blacklist.\n
+ *
+ * @param[in] pc The pointer to pkgmgr_client instance
+ * @param[in] pkgid package id
+ * @return 0 if success, error code(<0) if fail\n
+ * @retval PKGMGR_R_OK success
+ * @retval PKGMGR_R_EINVAL invalid argument
+ * @retval PKGMGR_R_ECOMM communication error
+ * @retval PKGMGR_R_EPRIV privilege denied
+ */
+int pkgmgr_client_remove_blacklist(pkgmgr_client *pc, const char *pkgid);
+int pkgmgr_client_usr_remove_blacklist(pkgmgr_client *pc, const char *pkgid, uid_t uid);
+
+/**
+ * @brief Check whether a package is blacklisted
+ *
+ * This API checks whether the given package is blacklisted.\n
+ *
+ * @param[in] pc The pointer to pkgmgr_client instance
+ * @param[in] pkgid package id
+ * @param[out] blacklist whether blacklisted or not
+ * @return 0 if success, error code(<0) if fail\n
+ * @retval PKGMGR_R_OK success
+ * @retval PKGMGR_R_EINVAL invalid argument
+ * @retval PKGMGR_R_ECOMM communication error
+ * @retval PKGMGR_R_EPRIV privilege denied
+ */
+int pkgmgr_client_check_blacklist(pkgmgr_client *pc, const char *pkgid, bool *blacklist);
+int pkgmgr_client_usr_check_blacklist(pkgmgr_client *pc, const char *pkgid, bool *blacklist, uid_t uid);
+
/** @} */
return PKGMGR_R_OK;
}
+
+API int pkgmgr_client_usr_add_blacklist(pkgmgr_client *pc, const char *pkgid,
+ uid_t uid)
+{
+ GVariant *result;
+ int ret = PKGMGR_R_ECOMM;
+ pkgmgr_client_t *mpc = (pkgmgr_client_t *)pc;
+
+ if (pc == NULL || pkgid == NULL) {
+ ERR("invalid parameter");
+ return PKGMGR_R_EINVAL;
+ }
+
+ result = comm_client_request(mpc->info.request.cc, "add_blacklist",
+ g_variant_new("(us)", uid, pkgid));
+ if (result == NULL)
+ return PKGMGR_R_ECOMM;
+ g_variant_get(result, "(i)", &ret);
+ g_variant_unref(result);
+
+ return ret;
+}
+
+API int pkgmgr_client_add_blacklist(pkgmgr_client *pc, const char *pkgid)
+{
+ return pkgmgr_client_usr_add_blacklist(pc, pkgid, GLOBAL_USER);
+}
+
+API int pkgmgr_client_usr_remove_blacklist(pkgmgr_client *pc,
+ const char *pkgid, uid_t uid)
+{
+ GVariant *result;
+ int ret = PKGMGR_R_ECOMM;
+ pkgmgr_client_t *mpc = (pkgmgr_client_t *)pc;
+
+ if (pc == NULL || pkgid == NULL) {
+ ERR("invalid parameter");
+ return PKGMGR_R_EINVAL;
+ }
+
+ result = comm_client_request(mpc->info.request.cc, "remove_blacklist",
+ g_variant_new("(us)", uid, pkgid));
+ if (result == NULL)
+ return PKGMGR_R_ECOMM;
+ g_variant_get(result, "(i)", &ret);
+ g_variant_unref(result);
+
+ return ret;
+}
+
+API int pkgmgr_client_remove_blacklist(pkgmgr_client *pc,
+ const char *pkgid)
+{
+ return pkgmgr_client_usr_remove_blacklist(pc, pkgid, GLOBAL_USER);
+}
+
+API int pkgmgr_client_usr_check_blacklist(pkgmgr_client *pc, const char *pkgid,
+ bool *blacklist, uid_t uid)
+{
+ GVariant *result;
+ int ret = PKGMGR_R_ECOMM;
+ gint b;
+ pkgmgr_client_t *mpc = (pkgmgr_client_t *)pc;
+
+ if (pc == NULL || pkgid == NULL) {
+ ERR("invalid parameter");
+ return PKGMGR_R_EINVAL;
+ }
+
+ result = comm_client_request(mpc->info.request.cc, "check_blacklist",
+ g_variant_new("(us)", uid, pkgid));
+ if (result == NULL)
+ return PKGMGR_R_ECOMM;
+ g_variant_get(result, "(ii)", &b, &ret);
+ g_variant_unref(result);
+
+ if (ret != PKGMGR_R_OK)
+ return ret;
+
+ if (b)
+ *blacklist = true;
+ else
+ *blacklist = false;
+
+ return PKGMGR_R_OK;
+}
+
+API int pkgmgr_client_check_blacklist(pkgmgr_client *pc, const char *pkgid,
+ bool *blacklist)
+{
+ return pkgmgr_client_usr_check_blacklist(pc, pkgid, blacklist,
+ GLOBAL_USER);
+}