Pass image path when change pkg db 73/91973/6 accepted/tizen/3.0/common/20161114.082418 accepted/tizen/3.0/ivi/20161110.015539 accepted/tizen/3.0/mobile/20161110.015242 accepted/tizen/3.0/tv/20161110.015417 accepted/tizen/3.0/wearable/20161110.015507 submit/tizen/20161102.115555 submit/tizen_3.0/20161107.133644 submit/tizen_3.0_common/20161110.084657
authorJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 12 Oct 2016 10:47:42 +0000 (19:47 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 2 Nov 2016 10:15:00 +0000 (19:15 +0900)
- Pass image path when change
installed_location column at pkg db

Change-Id: I8ec2b9abe2d967f2756025e9517a2873a19496d0
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
plugin/app2sd/inc/app2sd_internals.h
plugin/app2sd/src/app2sd_interface.c
plugin/app2sd/src/app2sd_internals.c

index ab70a9b..0d63709 100644 (file)
@@ -83,7 +83,7 @@ int _app2sd_get_available_free_memory(char *mmc_path, int *free_mem);
 
 /* function to move the application from/to SD Card */
 int _app2sd_usr_move_app(const char *pkgid, app2ext_move_type move_cmd,
-               GList *dir_list, uid_t uid, char *mmc_path);
+               GList *dir_list, uid_t uid, char *mmc_path, char **image_path);
 
 /* utility to delete symbolic link */
 void _app2sd_delete_symlink(const char *dirname);
index ff96a94..8bc6b29 100644 (file)
@@ -341,7 +341,7 @@ int app2sd_usr_post_app_install(const char *pkgid,
                 * to pkgmgr_parser db
                 */
                pkgmgr_ret = pkgmgrinfo_pkginfo_set_usr_installed_storage(pkgid,
-                       INSTALL_EXTERNAL, uid);
+                       INSTALL_EXTERNAL, loopback_device, uid);
                if (pkgmgr_ret < 0) {
                        _E("fail to update installed location " \
                                "to db[%s, %d] of uid(%d), pkgmgr ret(%d)",
@@ -839,6 +839,7 @@ int app2sd_usr_pre_move_installed_app(const char *pkgid,
        int ret = 0;
        int pkgmgr_ret = 0;
        char *sdpath = NULL;
+       char *image_path = NULL;
        char mmc_path[FILENAME_MAX] = { 0, };
 
        /* validate function arguments */
@@ -865,7 +866,7 @@ int app2sd_usr_pre_move_installed_app(const char *pkgid,
                return ret;
        }
 
-       ret = _app2sd_usr_move_app(pkgid, move_type, dir_list, uid, mmc_path);
+       ret = _app2sd_usr_move_app(pkgid, move_type, dir_list, uid, mmc_path, &image_path);
        if (ret) {
                _D("unable to move application");
                return ret;
@@ -874,7 +875,7 @@ int app2sd_usr_pre_move_installed_app(const char *pkgid,
        /* if move is completed, then update installed storage to pkgmgr_parser db */
        if (move_type == APP2EXT_MOVE_TO_EXT) {
                pkgmgr_ret = pkgmgrinfo_pkginfo_set_usr_installed_storage(pkgid,
-                               INSTALL_EXTERNAL, uid);
+                               INSTALL_EXTERNAL, image_path, uid);
                if (pkgmgr_ret < 0) {
                        _E("failed to update installed location to db " \
                                "[%s, %s] of uid(%d), pkgmgr_ret(%d)",
@@ -883,7 +884,7 @@ int app2sd_usr_pre_move_installed_app(const char *pkgid,
                }
        } else {
                pkgmgr_ret = pkgmgrinfo_pkginfo_set_usr_installed_storage(pkgid,
-                               INSTALL_INTERNAL, uid);
+                               INSTALL_INTERNAL, image_path, uid);
                if (pkgmgr_ret < 0) {
                        _E("failed to update installed location to db " \
                                "[%s, %s] of uid(%d), pkgmgr_ret(%d)",
index dfa8989..e3b712f 100644 (file)
@@ -852,7 +852,7 @@ static int _app2sd_move_to_archive(const char *src_path, const char *arch_path)
 }
 
 static int _app2sd_move_app_to_external(const char *pkgid, GList *dir_list,
-               uid_t uid, char *mmc_path)
+               uid_t uid, char *mmc_path, char **image_path)
 {
        int ret = APP2EXT_SUCCESS;
        mode_t mode = DIR_PERMS;
@@ -1088,6 +1088,7 @@ static int _app2sd_move_app_to_external(const char *pkgid, GList *dir_list,
                goto ERR;
        }
 
+       *image_path = strdup(loopback_device);
        return APP2EXT_SUCCESS;
 
 ERR:
@@ -1096,6 +1097,7 @@ ERR:
                device_node = NULL;
        }
 
+       *image_path = NULL;
        return ret;
 }
 
@@ -1369,14 +1371,14 @@ ERR:
 }
 
 int _app2sd_usr_move_app(const char *pkgid, app2ext_move_type move_type,
-               GList *dir_list, uid_t uid, char *mmc_path)
+               GList *dir_list, uid_t uid, char *mmc_path, char **image_path)
 {
        int ret = APP2EXT_SUCCESS;
 
        switch (move_type) {
        case APP2EXT_MOVE_TO_EXT:
                ret = _app2sd_move_app_to_external(pkgid, dir_list,
-                       uid, mmc_path);
+                       uid, mmc_path, image_path);
                if (ret) {
                        _E("move app to external memory failed(%d)", ret);
                        return ret;