From b9c3d4c4e1e901dba65a4f449cbbdf23d27ff1f4 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Mon, 31 Jul 2017 15:53:17 +0900 Subject: [PATCH] Add extended storage type for update installed storage Change-Id: I39af4c45fe53bdbbd0324c23783839b12089379b Signed-off-by: Sangyoon Jang --- include/pkgmgrinfo_type.h | 1 + src/pkgmgrinfo_db.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/pkgmgrinfo_type.h b/include/pkgmgrinfo_type.h index 175abf9..a2404f7 100644 --- a/include/pkgmgrinfo_type.h +++ b/include/pkgmgrinfo_type.h @@ -451,6 +451,7 @@ typedef enum { typedef enum { INSTALL_INTERNAL = 0, /**< Internal Installation*/ INSTALL_EXTERNAL, /**< External Installation*/ + INSTALL_EXTENDED, /**< Extended Installation*/ } INSTALL_LOCATION; /** diff --git a/src/pkgmgrinfo_db.c b/src/pkgmgrinfo_db.c index fc19d5c..37f2771 100644 --- a/src/pkgmgrinfo_db.c +++ b/src/pkgmgrinfo_db.c @@ -439,6 +439,7 @@ API int pkgmgrinfo_pkginfo_set_usr_installed_storage(const char *pkgid, INSTALL_ sqlite3 *pkgmgr_parser_db = NULL; char *query = NULL; char *db_path; + const char *location_str; db_path = getUserPkgParserDBPathUID(uid); if (db_path == NULL) { @@ -461,10 +462,16 @@ API int pkgmgrinfo_pkginfo_set_usr_installed_storage(const char *pkgid, INSTALL_ tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Failed to begin transaction\n"); _LOGD("Transaction Begin\n"); + if (location == INSTALL_INTERNAL) + location_str = "installed_internal"; + else if (location == INSTALL_EXTERNAL) + location_str = "installed_external"; + else + location_str = "installed_extended"; /* pkgcakge_info table */ query = sqlite3_mprintf( "update package_info set installed_storage=%Q, external_path=%Q where package=%Q", - location ? "installed_external" : "installed_internal", external_pkg_path, pkgid); + location_str, external_pkg_path, pkgid); ret = sqlite3_exec(pkgmgr_parser_db, query, NULL, NULL, NULL); tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Don't execute query = %s\n", query); @@ -473,7 +480,7 @@ API int pkgmgrinfo_pkginfo_set_usr_installed_storage(const char *pkgid, INSTALL_ /* package_app_info table */ query = sqlite3_mprintf( "update package_app_info set app_installed_storage=%Q, app_external_path=%Q where package=%Q", - location ? "installed_external" : "installed_internal", external_pkg_path, pkgid); + location_str, external_pkg_path, pkgid); ret = sqlite3_exec(pkgmgr_parser_db, query, NULL, NULL, NULL); tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Don't execute query = %s\n", query); -- 2.7.4