summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/include/package-manager.h36
-rw-r--r--client/src/pkgmgr.c75
-rw-r--r--client/src/pkgmgr_client_connection.c2
-rw-r--r--client/src/pkgmgr_client_internal.h1
-rw-r--r--installer/pkgmgr_installer_type.h37
5 files changed, 131 insertions, 20 deletions
diff --git a/client/include/package-manager.h b/client/include/package-manager.h
index 4064d91..1149f48 100644
--- a/client/include/package-manager.h
+++ b/client/include/package-manager.h
@@ -116,8 +116,9 @@ extern "C" {
#define PKGMGR_CLIENT_STATUS_DISABLE_APP_SPLASH_SCREEN 0x0400
#define PKGMGR_CLIENT_STATUS_CLEAR_CACHE 0x0800
#define PKGMGR_CLIENT_STATUS_RES_COPY 0x1000
-#define PKGMGR_CLIENT_STATUS_RES_REMOVE 0x2000
-#define PKGMGR_CLIENT_STATUS_RES_UNINSTALL 0x4000
+#define PKGMGR_CLIENT_STATUS_RES_CREATE_DIR 0x2000
+#define PKGMGR_CLIENT_STATUS_RES_REMOVE 0x4000
+#define PKGMGR_CLIENT_STATUS_RES_UNINSTALL 0x8000
/** @} */
@@ -1252,6 +1253,37 @@ int pkgmgr_client_add_res_copy_path(pkgmgr_client *pc, const char *src_path, con
int pkgmgr_client_res_copy(pkgmgr_client *pc, pkgmgr_res_copy_handler event_cb, void *user_data);
/**
+ * @brief Add directory path to create in the resource sharing directory of the package
+ *
+ * This API adds directory path for resource create directory request.\n
+ *
+ * @param[in] pc The pointer to pkgmgr_client instance
+ * @param[in] dir_path Path of a directory that client want to create
+ * @return 0 if success, error code(<0) if fail\n
+ * @retval PKGMGR_R_OK success
+ * @retval PKGMGR_R_EINVAL invalid argument
+ * @retval PKGMGR_R_ENOMEM out of memory
+ */
+int pkgmgr_client_add_res_create_dir_path(pkgmgr_client *pc, const char *dir_path);
+
+/**
+ * @brief This API create directories in the resource sharing directory of the package
+ *
+ * This API is for package-manager client application.\n
+ *
+ * @param[in] pc pkgmgr_client
+ * @param[in] event_cb user callback
+ * @param[in] data user data
+ * @return request_id (>0) if success, error code(<0) if fail\n
+ * @retval PKGMGR_R_OK success
+ * @retval PKGMGR_R_ECOMM communication error
+ * @retval PKGMGR_R_EINVAL invalid argument
+ * @retval PKGMGR_R_ENOMEM out of memory
+ * @retval PKGMGR_R_EPRIV privilege denied
+*/
+int pkgmgr_client_res_create_dir(pkgmgr_client *pc, pkgmgr_res_copy_handler event_cb, void *user_data);
+
+/**
* @brief Add resource path to remove
*
* This API adds path for resource remove request.\n
diff --git a/client/src/pkgmgr.c b/client/src/pkgmgr.c
index 9478271..4248ac2 100644
--- a/client/src/pkgmgr.c
+++ b/client/src/pkgmgr.c
@@ -418,6 +418,8 @@ API int pkgmgr_client_free(pkgmgr_client *pc)
g_variant_builder_unref(client->res_copy_builder);
if (client->res_remove_builder)
g_variant_builder_unref(client->res_remove_builder);
+ if (client->res_create_dir_builder)
+ g_variant_builder_unref(client->res_create_dir_builder);
free(client);
return PKGMGR_R_OK;
@@ -2867,6 +2869,79 @@ API int pkgmgr_client_res_copy(pkgmgr_client *pc,
return cb_info->req_id;
}
+API int pkgmgr_client_add_res_create_dir_path(pkgmgr_client *pc,
+ const char *dir_path)
+{
+ struct pkgmgr_client_t *client = (struct pkgmgr_client_t *)pc;
+
+ if (pc == NULL || dir_path == NULL) {
+ ERR("invalid parameter");
+ return PKGMGR_R_EINVAL;
+ }
+
+ if (client->res_create_dir_builder == NULL) {
+ client->res_create_dir_builder =
+ g_variant_builder_new(G_VARIANT_TYPE("as"));
+ if (client->res_create_dir_builder == NULL) {
+ ERR("out of memory");
+ return PKGMGR_R_ENOMEM;
+ }
+ }
+
+ g_variant_builder_add(client->res_create_dir_builder, "s", dir_path);
+
+ return PKGMGR_R_OK;
+}
+
+API int pkgmgr_client_res_create_dir(pkgmgr_client *pc,
+ pkgmgr_res_copy_handler event_cb, void *user_data)
+{
+ GVariant *result;
+ int ret;
+ char *req_key = NULL;
+ struct pkgmgr_client_t *client = (struct pkgmgr_client_t *)pc;
+ struct cb_info *cb_info;
+
+ if (pc == NULL || event_cb == NULL) {
+ ERR("invalid parameter");
+ return PKGMGR_R_EINVAL;
+ }
+
+ ret = pkgmgr_client_connection_send_request(client,
+ "res_create_dir",
+ g_variant_new("(as)",
+ client->res_create_dir_builder), &result);
+ if (ret != PKGMGR_R_OK) {
+ ERR("request failed: %d", ret);
+ return ret;
+ }
+
+ g_variant_get(result, "(i&s)", &ret, &req_key);
+ if (req_key == NULL) {
+ g_variant_unref(result);
+ return PKGMGR_R_ECOMM;
+ }
+ if (ret != PKGMGR_R_OK) {
+ g_variant_unref(result);
+ return ret;
+ }
+
+ cb_info = __create_res_copy_event_cb_info(client,
+ event_cb, user_data, req_key);
+ g_variant_unref(result);
+ if (cb_info == NULL)
+ return PKGMGR_R_ENOMEM;
+
+ ret = pkgmgr_client_connection_set_callback(client, cb_info);
+ if (ret != PKGMGR_R_OK) {
+ __free_cb_info(cb_info);
+ return ret;
+ }
+ client->cb_info_list = g_list_append(client->cb_info_list, cb_info);
+
+ return cb_info->req_id;
+}
+
API int pkgmgr_client_add_res_remove_path(pkgmgr_client *pc,
const char *res_path)
{
diff --git a/client/src/pkgmgr_client_connection.c b/client/src/pkgmgr_client_connection.c
index 8f20b46..0832097 100644
--- a/client/src/pkgmgr_client_connection.c
+++ b/client/src/pkgmgr_client_connection.c
@@ -105,6 +105,8 @@ struct signal_map map[] = {
{PKGMGR_INSTALLER_APP_DISABLE_SPLASH_SCREEN_EVENT_STR,
PKGMGR_CLIENT_STATUS_DISABLE_APP_SPLASH_SCREEN},
{PKGMGR_INSTALLER_RES_COPY_EVENT_STR, PKGMGR_CLIENT_STATUS_RES_COPY},
+ {PKGMGR_INSTALLER_RES_CREATE_DIR_EVENT_STR,
+ PKGMGR_CLIENT_STATUS_RES_CREATE_DIR},
{PKGMGR_INSTALLER_RES_REMOVE_EVENT_STR,
PKGMGR_CLIENT_STATUS_RES_REMOVE},
{PKGMGR_INSTALLER_RES_UNINSTALL_EVENT_STR,
diff --git a/client/src/pkgmgr_client_internal.h b/client/src/pkgmgr_client_internal.h
index b984168..e1618b0 100644
--- a/client/src/pkgmgr_client_internal.h
+++ b/client/src/pkgmgr_client_internal.h
@@ -54,6 +54,7 @@ struct pkgmgr_client_t {
GList *cb_info_list;
GVariantBuilder *res_copy_builder;
GVariantBuilder *res_remove_builder;
+ GVariantBuilder *res_create_dir_builder;
char *tep_path;
bool tep_move;
bool debug_mode;
diff --git a/installer/pkgmgr_installer_type.h b/installer/pkgmgr_installer_type.h
index cdb9610..7065f1e 100644
--- a/installer/pkgmgr_installer_type.h
+++ b/installer/pkgmgr_installer_type.h
@@ -33,25 +33,26 @@ extern "C" {
/**
* @brief listening event type in pkgmgr.
*/
-#define PKGMGR_INSTALLER_START_KEY_STR "start"
-#define PKGMGR_INSTALLER_END_KEY_STR "end"
-#define PKGMGR_INSTALLER_ERROR_KEY_STR "error"
-#define PKGMGR_INSTALLER_APPID_KEY_STR "appid"
-#define PKGMGR_INSTALLER_INSTALL_PERCENT_KEY_STR "install_percent"
-#define PKGMGR_INSTALLER_GET_SIZE_KEY_STR "get_size"
-#define PKGMGR_INSTALLER_CLEAR_CACHE_KEY_STR "clear_cache"
+#define PKGMGR_INSTALLER_START_KEY_STR "start"
+#define PKGMGR_INSTALLER_END_KEY_STR "end"
+#define PKGMGR_INSTALLER_ERROR_KEY_STR "error"
+#define PKGMGR_INSTALLER_APPID_KEY_STR "appid"
+#define PKGMGR_INSTALLER_INSTALL_PERCENT_KEY_STR "install_percent"
+#define PKGMGR_INSTALLER_GET_SIZE_KEY_STR "get_size"
+#define PKGMGR_INSTALLER_CLEAR_CACHE_KEY_STR "clear_cache"
-#define PKGMGR_INSTALLER_INSTALL_EVENT_STR "install"
-#define PKGMGR_INSTALLER_UNINSTALL_EVENT_STR "uninstall"
-#define PKGMGR_INSTALLER_CLEAR_EVENT_STR "clear"
-#define PKGMGR_INSTALLER_MOVE_EVENT_STR "move"
-#define PKGMGR_INSTALLER_UPGRADE_EVENT_STR "update"
-#define PKGMGR_INSTALLER_OK_EVENT_STR "ok"
-#define PKGMGR_INSTALLER_FAIL_EVENT_STR "fail"
-#define PKGMGR_INSTALLER_RES_COPY_EVENT_STR "res_copy"
-#define PKGMGR_INSTALLER_RES_REMOVE_EVENT_STR "res_remove"
-#define PKGMGR_INSTALLER_RES_UNINSTALL_EVENT_STR "res_uninstall"
-#define PKGMGR_INSTALLER_UNKNOWN_EVENT_STR ""
+#define PKGMGR_INSTALLER_INSTALL_EVENT_STR "install"
+#define PKGMGR_INSTALLER_UNINSTALL_EVENT_STR "uninstall"
+#define PKGMGR_INSTALLER_CLEAR_EVENT_STR "clear"
+#define PKGMGR_INSTALLER_MOVE_EVENT_STR "move"
+#define PKGMGR_INSTALLER_UPGRADE_EVENT_STR "update"
+#define PKGMGR_INSTALLER_OK_EVENT_STR "ok"
+#define PKGMGR_INSTALLER_FAIL_EVENT_STR "fail"
+#define PKGMGR_INSTALLER_RES_COPY_EVENT_STR "res_copy"
+#define PKGMGR_INSTALLER_RES_CREATE_DIR_EVENT_STR "res_create_dir"
+#define PKGMGR_INSTALLER_RES_REMOVE_EVENT_STR "res_remove"
+#define PKGMGR_INSTALLER_RES_UNINSTALL_EVENT_STR "res_uninstall"
+#define PKGMGR_INSTALLER_UNKNOWN_EVENT_STR ""
#define PKGMGR_INSTALLER_APP_DISABLE_EVENT_STR "disable_app"
#define PKGMGR_INSTALLER_APP_ENABLE_EVENT_STR "enable_app"