summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChanggyu Choi <changyu.choi@samsung.com>2022-10-26 11:37:24 +0900
committerChanggyu Choi <changyu.choi@samsung.com>2024-11-05 14:28:55 +0900
commit0e740854413a9eeedd55baeb5b79b4a374bdc772 (patch)
tree446b3651d081841e065f286f7b88037248cd435d
parenta97d11d260fce3278eb695b126c643c027b5265e (diff)
downloadslp-pkgmgr-tizen_6.5.tar.gz
slp-pkgmgr-tizen_6.5.tar.bz2
slp-pkgmgr-tizen_6.5.zip
Add a new APItizen_6.5
Adds: - pkgmgr_client_clear_user_data_with_path() Change-Id: I30480116398a015605f906209352eac338316a94 Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
-rw-r--r--client/include/package-manager.h25
-rw-r--r--client/src/pkgmgr.c38
2 files changed, 63 insertions, 0 deletions
diff --git a/client/include/package-manager.h b/client/include/package-manager.h
index 7167d98..6e334a5 100644
--- a/client/include/package-manager.h
+++ b/client/include/package-manager.h
@@ -762,6 +762,31 @@ int pkgmgr_client_clear_user_data(pkgmgr_client *pc, const char *pkg_type,
const char *pkgid, pkgmgr_mode mode);
int pkgmgr_client_usr_clear_user_data(pkgmgr_client *pc, const char *pkg_type,
const char *pkgid, pkgmgr_mode mode, uid_t uid);
+
+
+/**
+ * @brief This API deletes application's specific private data.
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @remarks You should call this function with regular uid
+ * @param[in] pc pkgmgr_client
+ * @param[in] pkg_type package type
+ * @param[in] pkgid package id
+ * @param[in] file_path file path that is relative path from the givin package user data directory.
+ * @param[in] mode installation mode - PM_DEFAULT, PM_QUIET
+ * @return request_id (>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
+*/
+int pkgmgr_client_clear_user_data_with_path(pkgmgr_client *pc,
+ const char *pkg_type, const char *pkgid,
+ const char *file_path, pkgmgr_mode mode);
+int pkgmgr_client_usr_clear_user_data_with_path(pkgmgr_client *pc,
+ const char *pkg_type, const char *pkgid, const char *file_path,
+ pkgmgr_mode mode, uid_t uid);
+
/**
* @brief This API set status type to listen for the pkgmgr's broadcasting
*
diff --git a/client/src/pkgmgr.c b/client/src/pkgmgr.c
index 650b2fe..de6dfe6 100644
--- a/client/src/pkgmgr.c
+++ b/client/src/pkgmgr.c
@@ -1809,6 +1809,44 @@ API int pkgmgr_client_clear_user_data(pkgmgr_client *pc, const char *pkg_type,
_getuid());
}
+API int pkgmgr_client_usr_clear_user_data_with_path(pkgmgr_client *pc,
+ const char *pkg_type, const char *pkgid, const char *file_path,
+ pkgmgr_mode mode, uid_t uid)
+{
+ GVariant *result;
+ int ret;
+ struct pkgmgr_client_t *client = (struct pkgmgr_client_t *)pc;
+
+ if (!pc || !pkgid || !file_path || uid == GLOBAL_USER) {
+ ERR("invalid parameter");
+ return PKGMGR_R_EINVAL;
+ }
+
+ if (client->pc_type != PC_REQUEST) {
+ ERR("client->pc_type is not PC_REQUEST");
+ return PKGMGR_R_EINVAL;
+ }
+
+ ret = pkgmgr_client_connection_send_request(client, "cleardata_with_path",
+ g_variant_new("(uss)", uid, pkgid, file_path), &result);
+ if (ret != PKGMGR_R_OK) {
+ ERR("request failed: %d", ret);
+ return ret;
+ }
+
+ g_variant_get(result, "(i)", &ret);
+ g_variant_unref(result);
+
+ return ret;
+}
+
+API int pkgmgr_client_clear_user_data_with_path(pkgmgr_client *pc, const char *pkg_type,
+ const char *pkgid, const char *file_path, pkgmgr_mode mode)
+{
+ return pkgmgr_client_usr_clear_user_data_with_path(pc, pkg_type, pkgid,
+ file_path, mode, _getuid());
+}
+
API int pkgmgr_client_set_status_type(pkgmgr_client *pc, int status_type)
{
struct pkgmgr_client_t *client = (struct pkgmgr_client_t *)pc;