Add package_info_get_installed_time as extension API 04/132904/1 accepted/tizen/3.0/common/20170612.121241 accepted/tizen/3.0/ivi/20170611.235759 accepted/tizen/3.0/mobile/20170611.235752 accepted/tizen/3.0/tv/20170611.235754 accepted/tizen/3.0/wearable/20170611.235757 submit/tizen_3.0/20170608.083312
authorSangyoon Jang <jeremy.jang@samsung.com>
Thu, 8 Jun 2017 08:27:28 +0000 (17:27 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Thu, 8 Jun 2017 08:27:28 +0000 (17:27 +0900)
Change-Id: Ic78aa752811537de79e6bc20f4447fb8ae5ef950
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
include/package_info_extension.h
src/package_info.c

index b88144a..fd25fe7 100644 (file)
@@ -48,6 +48,21 @@ extern "C" {
 int package_info_get_main_app_id(package_info_h package_info, char **main_app_id);
 
 /**
+ * @brief Gets the installed time for the given package.
+ * @details If the package was updated, the @a installed_time represents updated time.
+ *          So, the meaning of 'installed time' corresponds with 'last modified time'.
+ * @since_tizen 3.0
+ * @param[in]  package_info   The package information
+ * @param[out] installed_time The integer value of time_t type for installed time
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #PACKAGE_MANAGER_ERROR_NONE              Successful
+ * @retval #PACKAGE_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PACKAGE_MANAGER_ERROR_IO_ERROR          Database error occurred
+ */
+int package_info_get_installed_time(package_info_h package_info, int *installed_time);
+
+/**
 * @}
 */
 
index 9d48ad7..6ecb6fa 100644 (file)
@@ -417,6 +417,23 @@ API int package_info_is_accessible(package_info_h package_info, bool *accessible
        return PACKAGE_MANAGER_ERROR_NONE;
 }
 
+API int package_info_get_installed_time(package_info_h package_info, int *installed_time)
+{
+       int ret;
+       int time_value;
+
+       if (package_info == NULL || installed_time == NULL)
+               return package_manager_error(PACKAGE_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+
+       ret = pkgmgrinfo_pkginfo_get_installed_time(package_info->pkgmgr_pkginfo, &time_value);
+       if (ret < 0)
+               return package_manager_error(PACKAGE_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
+
+       *installed_time = time_value;
+
+       return PACKAGE_MANAGER_ERROR_NONE;
+}
+
 API int package_info_clone(package_info_h *clone, package_info_h package_info)
 {
        int retval;