pkgmgrinfo_appinfo_get_zip_mount_file 01/68001/5 accepted/tizen/common/20160512.143623 accepted/tizen/common/20160513.123124 accepted/tizen/common/20160513.123349 accepted/tizen/ivi/20160513.004714 accepted/tizen/mobile/20160513.004742 accepted/tizen/tv/20160513.004658 accepted/tizen/wearable/20160513.004632 submit/tizen/20160511.013048 submit/tizen/20160511.132536 submit/tizen/20160512.083806
authorTomasz Iwanek <t.iwanek@samsung.com>
Fri, 29 Apr 2016 13:53:52 +0000 (15:53 +0200)
committerTomasz Iwanek <t.iwanek@samsung.com>
Tue, 10 May 2016 07:43:30 +0000 (09:43 +0200)
Change-Id: I177cfb6cbeee0670256a861432ae627bed483623

include/pkgmgr-info.h
include/pkgmgrinfo_basic.h
parser/pkgmgr_parser_db.c
src/pkgmgrinfo_appinfo.c
src/pkgmgrinfo_basic.c
src/pkgmgrinfo_pkginfo.c

index ce0d75b..f2777b7 100644 (file)
@@ -491,6 +491,46 @@ static int get_tep_name(const char *pkgid)
 int pkgmgrinfo_pkginfo_get_tep_name(pkgmgrinfo_pkginfo_h handle, char **tep_name);
 
 /**
+ * @fn int pkgmgrinfo_pkginfo_get_zip_mount_file(pkgmgrinfo_pkginfo_h handle, char **zip_mount_file)
+ * @brief      This API gets package mount point path associated with the package
+ *                     if package is mount-installed. Otherwise, zip_mount_file is left as NULL value
+ *
+ * @par        This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle           pointer to the pkginfo handle.
+ * @param[out] zip_mount_file  pointer to hold zip mount file
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @pre        pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post       pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see        pkgmgrinfo_pkginfo_get_pkgid()
+ * @code
+static int get_zip_mount_file(const char *pkgid)
+{
+       int ret = 0;
+       char *zip_mount_file = NULL;
+       pkgmgrinfo_pkginfo_h handle = NULL;
+       ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_pkginfo_get_zip_mount_file(handle, &zip_mount_file);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               return -1;
+       }
+       if (zip_mount_file != NULL)
+               printf("Zip mount path is: %s\n", zip_mount_file);
+       pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_zip_mount_file(pkgmgrinfo_pkginfo_h handle, char **zip_mount_file);
+
+/**
  * @fn int pkgmgrinfo_pkginfo_get_install_location(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_install_location *location)
  * @brief      This API gets the package install location from the package ID
  *
@@ -3486,6 +3526,45 @@ static int get_tep_name(const char *appid)
 int pkgmgrinfo_appinfo_get_tep_name(pkgmgrinfo_appinfo_h handle, char **tep_name);
 
 /**
+ * @fn int pkgmgrinfo_appinfo_get_zip_mount_file(pkgmgrinfo_appinfo_h handle, char **zip_mount_file)
+ * @brief      This API gets zip mount file name associated with the package which contain given application
+ *          If package is not "mount-installed", zip_mount_file is left as NULL pointer.
+ *
+ * @par        This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle           pointer to the appinfo handle.
+ * @param[out] zip_mount_file  pointer to hold zip mount file name
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @pre        pkgmgrinfo_appinfo_get_appinfo()
+ * @post               pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see        pkgmgrinfo_appinfo_get_appid()
+ * @code
+static int get_zip_mount_file(const char *appid)
+{
+       int ret = 0;
+       char *zip_mount_file = NULL;
+       pkgmgrinfo_appinfo_h handle = NULL;
+       ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_appinfo_get_zip_mount_file(handle, &zip_mount_file);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_appinfo_destroy_appinfo(handle);
+               return -1;
+       }
+       printf("Mount file name is: %s\n", zip_mount_file);
+       pkgmgrinfo_appinfo_destroy_appinfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_zip_mount_file(pkgmgrinfo_appinfo_h handle, char **zip_mount_file);
+
+/**
  * @fn int pkgmgrinfo_appinfo_get_root_path(pkgmgrinfo_appinfo_h handle, char **path)
  * @brief      This API gets the root path of application
  *
index e006b12..c19940e 100644 (file)
@@ -139,6 +139,7 @@ typedef struct application_x {
        char *effective_appid;  /*attr*/
        char *package_type;     /*set from package_x*/
        char *tep_name; /*set from package_x*/
+       char *zip_mount_file;   /*set from package_x*/
        char *root_path;        /*set from package_x*/
        char *api_version;      /*set from package_x*/
        char *for_all_users; /**< Flag that indicates if the package is available for everyone or for current user only, no xml part*/
@@ -184,6 +185,7 @@ typedef struct package_x {
        char *support_disable;          /**< package support disable flag, attr, default: "false"*/
        char *api_version;              /**< minimum version of API package using, attr, default: patch_version trimmed version from tizen_full_version*/
        char *tep_name; /*no xml part*/
+       char *zip_mount_file;   /*no xml part*/
        char *backend_installer;                /**< package backend installer, attr*/
        GList *icon;            /**< package icon, element*/
        GList *label;           /**< package label, element*/
index f0b9dee..80a4302 100644 (file)
@@ -91,6 +91,7 @@ sqlite3 *pkgmgr_cert_db;
                                                "package_version text, " \
                                                "package_api_version text, " \
                                                "package_tep_name text, " \
+                                               "package_zip_mount_file text, " \
                                                "install_location text, " \
                                                "package_size text, " \
                                                "package_removable text DEFAULT 'true', " \
@@ -168,6 +169,7 @@ sqlite3 *pkgmgr_cert_db;
                                                "component_type text, " \
                                                "package text not null, " \
                                                "app_tep_name text, " \
+                                               "app_zip_mount_file text, " \
                                                "app_background_category INTEGER DEFAULT 0, " \
                                                "app_root_path text, " \
                                                "app_api_version text, " \
@@ -1230,7 +1232,7 @@ static int __insert_application_info(manifest_x *mfx)
                        "app_indicatordisplay, app_portraitimg, app_landscapeimg, app_guestmodevisibility, app_permissiontype, " \
                        "app_preload, app_submode, app_submode_mainid, app_installed_storage, app_process_pool, " \
                        "app_launch_mode, app_ui_gadget, app_support_disable, component_type, package, " \
-                       "app_tep_name, app_background_category, app_package_type, app_root_path, app_api_version, " \
+                       "app_tep_name, app_zip_mount_file, app_background_category, app_package_type, app_root_path, app_api_version, " \
                        "app_effective_appid, app_splash_screen_display) " \
                        "values(" \
                        "'%s', '%s', '%s', '%s', '%s', " \
@@ -1239,8 +1241,8 @@ static int __insert_application_info(manifest_x *mfx)
                        "'%s', '%s', '%s', '%s', '%s', " \
                        "'%s', '%s', '%s', '%s', '%s', " \
                        "'%s', '%s', '%s', '%s', '%s', " \
-                       "'%s', '%d', '%s', '%s', '%s', " \
-                       "'%s', '%s')", \
+                       "'%s', '%s', '%d', '%s', '%s', " \
+                       "'%s', '%s', '%s')", \
                        app->appid, app->component_type, app->exec, app->nodisplay, app->type,
                        app->onboot, app->multiple, app->autorestart, app->taskmanage, app->enabled,
                        app->hwacceleration, app->screenreader, app->mainapp, __get_str(app->recentimage), app->launchcondition,
@@ -1248,7 +1250,7 @@ static int __insert_application_info(manifest_x *mfx)
                        app->guestmode_visibility, app->permission_type,
                        mfx->preload, app->submode, __get_str(app->submode_mainid), mfx->installed_storage, app->process_pool,
                        app->launch_mode, app->ui_gadget, mfx->support_disable, app->component_type, mfx->package,
-                       __get_str(mfx->tep_name), background_value, type, mfx->root_path, __get_str(mfx->api_version),
+                       __get_str(mfx->tep_name), __get_str(mfx->zip_mount_file), background_value, type, mfx->root_path, __get_str(mfx->api_version),
                        __get_str(effective_appid), app->splash_screen_display);
 
                ret = __exec_query(query);
@@ -1888,7 +1890,7 @@ static int __insert_manifest_info_in_db(manifest_x *mfx, uid_t uid)
        /*Insert in the package_info DB*/
        snprintf(query, MAX_QUERY_LEN,
                "insert into package_info(" \
-               "package, package_type, package_version, package_api_version, package_tep_name, " \
+               "package, package_type, package_version, package_api_version, package_tep_name, package_zip_mount_file, " \
                "install_location, package_size, package_removable, package_preload, package_readonly, " \
                "package_update, package_appsetting, package_nodisplay, package_system, author_name, " \
                "author_email, author_href, installed_time, installed_storage, storeclient_id, " \
@@ -1898,8 +1900,9 @@ static int __insert_manifest_info_in_db(manifest_x *mfx, uid_t uid)
                "'%s', '%s', '%s', '%s', '%s', " \
                "'%s', '%s', '%s', '%s', '%s', " \
                "'%s', '%s', '%s', '%s', '%s', " \
-               "'%s', '%s', '%s', '%s', '%s')", \
-               mfx->package, mfx->type, mfx->version, __get_str(mfx->api_version), __get_str(mfx->tep_name),
+               "'%s', '%s', '%s', '%s', '%s', " \
+               "'%s')", \
+               mfx->package, mfx->type, mfx->version, __get_str(mfx->api_version), __get_str(mfx->tep_name), __get_str(mfx->zip_mount_file),
                __get_str(mfx->installlocation), __get_str(mfx->package_size), mfx->removable, mfx->preload, mfx->readonly,
                mfx->update, mfx->appsetting, mfx->nodisplay_setting, mfx->system, __get_str(auth_name),
                __get_str(auth_email), __get_str(auth_href), mfx->installed_time, mfx->installed_storage,
index 3a713f3..4376dbf 100644 (file)
@@ -625,7 +625,7 @@ static int _appinfo_get_application(sqlite3 *db, const char *appid,
                "app_permissiontype, app_preload, app_submode, "
                "app_submode_mainid, app_launch_mode, app_ui_gadget, "
                "app_support_disable, "
-               "component_type, package, app_tep_name, app_process_pool, "
+               "component_type, package, app_tep_name, app_zip_mount_file, app_process_pool, "
                "app_installed_storage, app_background_category, "
                "app_package_type, app_root_path, app_api_version, "
                "app_effective_appid, app_disable, app_splash_screen_display "
@@ -698,6 +698,7 @@ static int _appinfo_get_application(sqlite3 *db, const char *appid,
        _save_column_str(stmt, idx++, &info->component_type);
        _save_column_str(stmt, idx++, &info->package);
        _save_column_str(stmt, idx++, &info->tep_name);
+       _save_column_str(stmt, idx++, &info->zip_mount_file);
        _save_column_str(stmt, idx++, &info->process_pool);
        _save_column_str(stmt, idx++, &info->installed_storage);
        _save_column_str(stmt, idx++, &bg_category_str);
@@ -844,7 +845,7 @@ int _appinfo_get_applist(uid_t uid, const char *locale, GHashTable **appinfo_tab
                        "app_onboot, app_multiple, app_autorestart, app_taskmanage, "
                        "app_hwacceleration, app_permissiontype, app_preload, "
                        "app_installed_storage, app_process_pool, app_launch_mode, "
-                       "app_package_type, component_type, package, app_tep_name, "
+                       "app_package_type, component_type, package, app_tep_name, app_zip_mount_file, "
                        "app_background_category, app_root_path, app_api_version, "
                         "app_effective_appid, app_disable, app_splash_screen_display, "
                        "(CASE WHEN A.app_disable='true' THEN 'true' "
@@ -896,6 +897,7 @@ int _appinfo_get_applist(uid_t uid, const char *locale, GHashTable **appinfo_tab
                _save_column_str(stmt, idx++, &appinfo->component_type);
                _save_column_str(stmt, idx++, &appinfo->package);
                _save_column_str(stmt, idx++, &appinfo->tep_name);
+               _save_column_str(stmt, idx++, &appinfo->zip_mount_file);
 
                _save_column_str(stmt, idx++, &bg_category_str);
                _save_column_str(stmt, idx++, &appinfo->root_path);
@@ -2184,6 +2186,20 @@ API int pkgmgrinfo_appinfo_get_tep_name(pkgmgrinfo_appinfo_h handle, char **tep_
        return PMINFO_R_OK;
 }
 
+API int pkgmgrinfo_appinfo_get_zip_mount_file(pkgmgrinfo_appinfo_h handle, char **zip_mount_file)
+{
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+       if (handle == NULL || zip_mount_file == NULL) {
+               LOGE("invalid parameter");
+               return PMINFO_R_EINVAL;
+       }
+
+       *zip_mount_file = (char *)info->app_info->zip_mount_file;
+
+       return PMINFO_R_OK;
+}
+
 API int pkgmgrinfo_appinfo_get_root_path(pkgmgrinfo_appinfo_h handle, char **root_path)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
index 54d8ec0..6ab8a98 100644 (file)
@@ -293,6 +293,8 @@ static void __ps_free_application(gpointer data)
                free((void *)application->support_disable);
        if (application->tep_name)
                free((void *)application->tep_name);
+       if (application->zip_mount_file)
+               free((void *)application->zip_mount_file);
        if (application->root_path)
                free((void *)application->root_path);
        if (application->api_version)
@@ -393,6 +395,8 @@ API void pkgmgrinfo_basic_free_package(package_x *package)
                free((void *)package->support_disable);
        if (package->tep_name)
                free((void *)package->tep_name);
+       if (package->zip_mount_file)
+               free((void *)package->zip_mount_file);
 
        /*Free Icon*/
        g_list_free_full(package->icon, __ps_free_icon);
index 0994cfa..f835077 100644 (file)
@@ -641,7 +641,7 @@ static int _pkginfo_get_package(sqlite3 *db, const char *pkgid,
                "package_system, package_type, package_size, installed_time, "
                "installed_storage, storeclient_id, mainapp_id, package_url, "
                "root_path, csc_path, package_nodisplay, package_api_version, "
-               "package_support_disable, package_tep_name "
+               "package_support_disable, package_tep_name, package_zip_mount_file "
                "FROM package_info WHERE package=%Q AND package_disable='false'";
        int ret;
        char *query;
@@ -702,6 +702,7 @@ static int _pkginfo_get_package(sqlite3 *db, const char *pkgid,
        _save_column_str(stmt, idx++, &info->api_version);
        _save_column_str(stmt, idx++, &info->support_disable);
        _save_column_str(stmt, idx++, &info->tep_name);
+       _save_column_str(stmt, idx++, &info->zip_mount_file);
 
        if (_pkginfo_get_author(db, info->package, &info->author)) {
                pkgmgrinfo_basic_free_package(info);
@@ -911,6 +912,22 @@ API int pkgmgrinfo_pkginfo_get_tep_name(pkgmgrinfo_pkginfo_h handle, char **tep_
        return PMINFO_R_OK;
 }
 
+API int pkgmgrinfo_pkginfo_get_zip_mount_file(pkgmgrinfo_pkginfo_h handle, char **zip_mount_file)
+{
+       pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+       retvm_if(zip_mount_file == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+       if (info->pkg_info == NULL)
+               return PMINFO_R_ERROR;
+
+       if (strlen(info->pkg_info->zip_mount_file) > 0)
+               *zip_mount_file = (char *)info->pkg_info->zip_mount_file;
+
+       return PMINFO_R_OK;
+}
+
 API int pkgmgrinfo_pkginfo_get_install_location(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_install_location *location)
 {
        char *val;