void *user_data,
int *id);
+/**
+ * @platform
+ * @brief Installs the packages located at the given paths, asynchronously.
+ * @since_tizen 6.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/packagemanager.admin
+ * @param[in] request The request handle
+ * @param[in] paths The array of absolute paths to the package to be installed
+ * @param[in] n_paths The number of paths in array
+ * @param[out] id The ID of the request to the package manager
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
+ * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
+ * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
+ * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
+ * @see package_manager_request_uninstall_packages()
+ */
+int package_manager_request_install_packages(package_manager_request_h request,
+ const char **paths,
+ int n_paths,
+ int *id);
+
+/**
+ * @platform
+ * @brief Installs the packages located at the given paths, asynchronously.
+ * @details The progress of the request is asynchronously received by the callback function.
+ * The @a callback is the individual callback only called for the current API call.
+ * The @a callback is the only callback called, even if another callback was set for this request
+ * with package_manager_request_set_event_cb().
+ * @since_tizen 6.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/packagemanager.admin
+ * @param[in] request The request handle
+ * @param[in] paths The array of absolute paths to the package to be installed
+ * @param[in] n_paths The number of paths in array
+ * @param[in] callback The callback function to be invoked
+ * @param[in] user_data The user data to be passed to the callback function
+ * @param[out] id The ID of the request to the package manager
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
+ * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
+ * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
+ * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
+ */
+int package_manager_request_install_packages_with_cb(package_manager_request_h request,
+ const char **paths,
+ int n_paths,
+ package_manager_request_event_cb callback,
+ void *user_data,
+ int *id);
/**
* @platform
void *user_data,
int *id);
+/**
+ * @platform
+ * @brief Uninstalls the packages with the given names, asynchronously.
+ * @since_tizen 6.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/packagemanager.admin
+ * @param[in] request The request handle
+ * @param[in] names The array of names of the package to be uninstalled
+ * @param[in] n_names The number of names in array
+ * @param[out] id The ID of the request to the package manager
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
+ * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
+ * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
+ * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
+ * @see package_manager_request_uninstall_packages()
+ */
+int package_manager_request_uninstall_packages(package_manager_request_h request,
+ const char **names,
+ int n_names,
+ int *id);
+
+/**
+ * @platform
+ * @brief Uninstalls the packages with the given names, asynchronously.
+ * @details The progress of the request is asynchronously received by the callback function.
+ * The @a callback is the individual callback only called for the current API call.
+ * The @a callback is the only callback called, even if another callback was set for this request
+ * with package_manager_request_set_event_cb().
+ * @since_tizen 6.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/packagemanager.admin
+ * @param[in] request The request handle
+ * @param[in] names The array of names of the package to be uninstalled
+ * @param[in] n_names The number of names in array
+ * @param[in] callback The callback function to be invoked
+ * @param[in] user_data The user data to be passed to the callback function
+ * @param[out] id The ID of the request to the package manager
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
+ * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
+ * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
+ * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
+ */
+int package_manager_request_uninstall_packages_with_cb(package_manager_request_h request,
+ const char **names,
+ int n_names,
+ package_manager_request_event_cb callback,
+ void *user_data,
+ int *id);
/**
* @platform
int *id);
/**
+ * @platform
+ * @brief Installs the packages located at the given paths as the runtime mountable package, asynchronously.
+ * @since_tizen 6.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/packagemanager.admin
+ * @param[in] request The request handle
+ * @param[in] paths The array of absolute paths to the package to be installed
+ * @param[in] n_paths The number of paths in array
+ * @param[out] id The ID of the request to the package manager
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
+ * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
+ * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
+ * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
+ * @see package_manager_request_uninstall_packages()
+ */
+int package_manager_request_mount_install_packages(package_manager_request_h request,
+ const char **paths,
+ int n_paths,
+ int *id);
+
+/**
+ * @platform
+ * @brief Installs the packages located at the given paths as the runtime mountable package, asynchronously.
+ * @details The progress of the request is asynchronously received by the callback function.
+ * The @a callback is the individual callback only called for the current API call.
+ * The @a callback is the only callback called, even if another callback was set for this request
+ * with package_manager_request_set_event_cb().
+ * @since_tizen 6.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/packagemanager.admin
+ * @param[in] request The request handle
+ * @param[in] paths The array of absolute paths to the package to be installed
+ * @param[in] n_paths The number of paths in array
+ * @param[in] callback The callback function to be invoked
+ * @param[in] user_data The user data to be passed to the callback function
+ * @param[out] id The ID of the request to the package manager
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #PACKAGE_MANAGER_ERROR_NONE Successful
+ * @retval #PACKAGE_MANAGER_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE No such package
+ * @retval #PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR I/O error
+ * @retval #PACKAGE_MANAGER_ERROR_SYSTEM_ERROR Severe system error
+ */
+int package_manager_request_mount_install_packages_with_cb(package_manager_request_h request,
+ const char **paths,
+ int n_paths,
+ package_manager_request_event_cb callback,
+ void *user_data,
+ int *id);
+
+/**
* @}
*/
return PACKAGE_MANAGER_ERROR_NONE;
}
+static int __request_install_packages(package_manager_request_h request,
+ const char **paths, int n_paths, pkgmgr_handler event_cb,
+ int *id)
+{
+ int retval;
+ retval = check_privilege(PRIVILEGE_PACKAGE_MANAGER_ADMIN);
+ if (retval != PACKAGE_MANAGER_ERROR_NONE)
+ return retval;
+
+ if (package_manager_client_validate_handle(request))
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_INVALID_PARAMETER,
+ __FUNCTION__, NULL);
+
+ if (paths == NULL || n_paths < 1)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_INVALID_PARAMETER,
+ __FUNCTION__, NULL);
+ int request_id = 0;
+ request_id = pkgmgr_client_install_packages(request->pc, paths,
+ n_paths, event_cb ? event_cb : request_event_handler,
+ request);
+
+ if (request_id == PKGMGR_R_EINVAL)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_INVALID_PARAMETER,
+ __FUNCTION__, NULL);
+ else if (request_id == PKGMGR_R_ENOPKG)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE,
+ __FUNCTION__, NULL);
+ else if (request_id == PKGMGR_R_ENOMEM)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY,
+ __FUNCTION__, NULL);
+ else if (request_id == PKGMGR_R_EIO)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_IO_ERROR,
+ __FUNCTION__, NULL);
+ else if (request_id == PKGMGR_R_EPRIV)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_PERMISSION_DENIED,
+ __FUNCTION__, NULL);
+ else if (request_id == PKGMGR_R_ESYSTEM ||
+ request_id == PKGMGR_R_ECOMM ||
+ request_id == PKGMGR_R_ERROR)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_SYSTEM_ERROR,
+ __FUNCTION__, NULL);
+
+ if (id)
+ *id = request_id;
+
+ return PACKAGE_MANAGER_ERROR_NONE;
+}
+
static int __request_uninstall(package_manager_request_h request,
const char *name, pkgmgr_handler event_cb, int *id)
{
return PACKAGE_MANAGER_ERROR_NONE;
}
+static int __request_uninstall_packages(package_manager_request_h request,
+ const char **names, int n_names, pkgmgr_handler event_cb,
+ int *id)
+{
+ int retval;
+ retval = check_privilege(PRIVILEGE_PACKAGE_MANAGER_ADMIN);
+ if (retval != PACKAGE_MANAGER_ERROR_NONE)
+ return retval;
+
+ if (package_manager_client_validate_handle(request))
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_INVALID_PARAMETER,
+ __FUNCTION__, NULL);
+
+ if (names == NULL || n_names < 1)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_INVALID_PARAMETER,
+ __FUNCTION__, NULL);
+ int request_id = 0;
+ request_id = pkgmgr_client_uninstall_packages(request->pc, names,
+ n_names, event_cb ? event_cb : request_event_handler,
+ request);
+
+ if (request_id == PKGMGR_R_EINVAL)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_INVALID_PARAMETER,
+ __FUNCTION__, NULL);
+ else if (request_id == PKGMGR_R_ENOPKG)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE,
+ __FUNCTION__, NULL);
+ else if (request_id == PKGMGR_R_ENOMEM)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY,
+ __FUNCTION__, NULL);
+ else if (request_id == PKGMGR_R_EIO)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_IO_ERROR,
+ __FUNCTION__, NULL);
+ else if (request_id == PKGMGR_R_EPRIV)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_PERMISSION_DENIED,
+ __FUNCTION__, NULL);
+ else if (request_id == PKGMGR_R_ESYSTEM ||
+ request_id == PKGMGR_R_ECOMM ||
+ request_id == PKGMGR_R_ERROR)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_SYSTEM_ERROR,
+ __FUNCTION__, NULL);
+
+ if (id)
+ *id = request_id;
+
+ return PACKAGE_MANAGER_ERROR_NONE;
+}
+
static int __request_move(package_manager_request_h request,
const char *name, package_manager_move_type_e move_type,
pkgmgr_handler event_cb, int *id)
return PACKAGE_MANAGER_ERROR_NONE;
}
+static int __request_mount_install_packages(package_manager_request_h request,
+ const char **paths, int n_paths, pkgmgr_handler event_cb,
+ int *id)
+{
+ int retval;
+ retval = check_privilege(PRIVILEGE_PACKAGE_MANAGER_ADMIN);
+ if (retval != PACKAGE_MANAGER_ERROR_NONE)
+ return retval;
+
+ if (package_manager_client_validate_handle(request))
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_INVALID_PARAMETER,
+ __FUNCTION__, NULL);
+
+ if (paths == NULL || n_paths < 1)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_INVALID_PARAMETER,
+ __FUNCTION__, NULL);
+ int request_id = 0;
+ request_id = pkgmgr_client_mount_install_packages(request->pc, paths,
+ n_paths, event_cb ? event_cb : request_event_handler,
+ request);
+
+ if (request_id == PKGMGR_R_EINVAL)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_INVALID_PARAMETER,
+ __FUNCTION__, NULL);
+ else if (request_id == PKGMGR_R_ENOPKG)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE,
+ __FUNCTION__, NULL);
+ else if (request_id == PKGMGR_R_ENOMEM)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY,
+ __FUNCTION__, NULL);
+ else if (request_id == PKGMGR_R_EIO)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_IO_ERROR,
+ __FUNCTION__, NULL);
+ else if (request_id == PKGMGR_R_EPRIV)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_PERMISSION_DENIED,
+ __FUNCTION__, NULL);
+ else if (request_id == PKGMGR_R_ESYSTEM ||
+ request_id == PKGMGR_R_ECOMM ||
+ request_id == PKGMGR_R_ERROR)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_SYSTEM_ERROR,
+ __FUNCTION__, NULL);
+
+ if (id)
+ *id = request_id;
+
+ return PACKAGE_MANAGER_ERROR_NONE;
+}
API int package_manager_request_install(package_manager_request_h request,
const char *path, int *id)
return ret;
}
+API int package_manager_request_install_packages(
+ package_manager_request_h request, const char **paths,
+ int n_paths, int *id)
+{
+ return __request_install_packages(request, paths, n_paths, NULL, id);
+}
+
+API int package_manager_request_install_packages_with_cb(
+ package_manager_request_h request, const char **paths,
+ int n_paths, package_manager_request_event_cb callback,
+ void *user_data, int *id)
+{
+ int ret;
+ int req_id = 0;
+
+ if (request->request_cb_table == NULL)
+ __initialize_request_cb_table(request);
+
+ ret = __request_install_packages(request, paths, n_paths,
+ internal_request_callback, &req_id);
+
+ if (req_id > 0) {
+ ret = __insert_request_cb_info(request, req_id, callback,
+ user_data);
+ if (ret < 0)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY,
+ __FUNCTION__,
+ "failed to create request cb info");
+ if (id)
+ *id = req_id;
+ }
+
+ return ret;
+}
+
API int package_manager_request_uninstall(package_manager_request_h request,
const char *name, int *id)
{
return ret;
}
+API int package_manager_request_uninstall_packages(
+ package_manager_request_h request, const char **names,
+ int n_names, int *id)
+{
+ return __request_uninstall_packages(request, names, n_names, NULL, id);
+}
+
+API int package_manager_request_uninstall_packages_with_cb(
+ package_manager_request_h request, const char **names,
+ int n_names, package_manager_request_event_cb callback,
+ void *user_data, int *id)
+{
+ int ret;
+ int req_id = 0;
+
+ if (request->request_cb_table == NULL)
+ __initialize_request_cb_table(request);
+
+ ret = __request_uninstall_packages(request, names, n_names,
+ internal_request_callback, &req_id);
+
+ if (req_id > 0) {
+ ret = __insert_request_cb_info(request, req_id, callback,
+ user_data);
+ if (ret < 0)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY,
+ __FUNCTION__,
+ "failed to create request cb info");
+ if (id)
+ *id = req_id;
+ }
+
+ return ret;
+}
+
API int package_manager_request_move(package_manager_request_h request,
const char *name, package_manager_move_type_e move_type)
{
return ret;
}
+API int package_manager_request_mount_install_packages(
+ package_manager_request_h request, const char **paths,
+ int n_paths, int *id)
+{
+ return __request_mount_install_packages(request, paths, n_paths, NULL,
+ id);
+}
+
+API int package_manager_request_mount_install_packages_with_cb(
+ package_manager_request_h request, const char **paths,
+ int n_paths, package_manager_request_event_cb callback,
+ void *user_data, int *id)
+{
+ int ret;
+ int req_id = 0;
+
+ if (request->request_cb_table == NULL)
+ __initialize_request_cb_table(request);
+
+ ret = __request_mount_install_packages(request, paths, n_paths,
+ internal_request_callback, &req_id);
+
+ if (req_id > 0) {
+ ret = __insert_request_cb_info(request, req_id, callback,
+ user_data);
+ if (ret < 0)
+ return package_manager_error(
+ PACKAGE_MANAGER_ERROR_OUT_OF_MEMORY,
+ __FUNCTION__,
+ "failed to create request cb info");
+ if (id)
+ *id = req_id;
+ }
+
+ return ret;
+}
+
API int package_manager_create(package_manager_h *manager)
{
int retval;