#define MAX_QUERY_LEN 4096
#define BUFSIZE 4096
#define OWNER_ROOT 0
+#define APPFW_USER "app_fw"
#define MAX_INTEGER_LENGTH 10
#define LDPI "ldpi"
"REFERENCES package_info(package) " \
"ON DELETE CASCADE)"
+#define QUERY_CREATE_TABLE_PACKAGE_UPDATE_INFO "CREATE TABLE IF NOT EXISTS package_update_info " \
+ "(package TEXT PRIMARY KEY, " \
+ "update_version TEXT NOT NULL, " \
+ "update_type TEXT NOT NULL DEFAULT 'none', " \
+ "FOREIGN KEY(package) " \
+ "REFERENCES package_info(package) " \
+ "ON DELETE CASCADE)"
+
#define QUERY_CREATE_TABLE_PACKAGE_APP_INFO "CREATE TABLE IF NOT EXISTS package_app_info " \
"(app_id TEXT PRIMARY KEY NOT NULL, " \
"app_component TEXT NOT NULL, " \
"app_multiple TEXT NOT NULL DEFAULT 'false', " \
"app_autorestart TEXT NOT NULL DEFAULT 'false', " \
"app_taskmanage TEXT NOT NULL DEFAULT 'false', " \
- "app_enabled TEXT NOT NULL DEFAULT 'true', " \
"app_hwacceleration TEXT NOT NULL DEFAULT 'use-system-setting', " \
"app_screenreader TEXT NOT NULL DEFAULT 'use-system-setting', " \
"app_mainapp TEXT NOT NULL, " \
"app_package_system TEXT NOT NULL, " \
"app_removable TEXT NOT NULL DEFAULT 'false', " \
"app_package_installed_time TEXT, " \
+ "app_support_ambient TEXT NOT NULL DEFAULT 'false', " \
"component_type TEXT, " \
"package TEXT NOT NULL, " \
"app_tep_name TEXT, " \
"app_effective_appid TEXT, " \
"app_splash_screen_display TEXT NOT NULL DEFAULT 'true', " \
"app_external_path TEXT, " \
+ "app_setup_appid TEXT, " \
"FOREIGN KEY(package) " \
"REFERENCES package_info(package) " \
"ON DELETE CASCADE)"
"providerid TEXT NOT NULL, " \
"access TEXT NOT NULL, " \
"type TEXT NOT NULL, " \
- "PRIMARY KEY(app_id, providerid, access, type) " \
+ "trusted TEXT NOT NULL, " \
+ "PRIMARY KEY(providerid, type) " \
"FOREIGN KEY(app_id) " \
"REFERENCES package_app_info(app_id) " \
"ON DELETE CASCADE)"
return -1;
}
sqlite3_free(error_message);
+
+ if (strncmp(query, "DELETE", 6) && sqlite3_changes(pkgmgr_parser_db) == 0) {
+ _LOGE("No such record matches with given query : %s\n", query);
+ return -1;
+ }
return 0;
}
app = (application_x *)tmp->data;
if (app == NULL)
continue;
-
- sqlite3_snprintf(MAX_QUERY_LEN, query,
- "UPDATE package_app_info SET app_mainapp=%Q WHERE app_id=%Q",
- app->mainapp, app->appid);
- ret = __exec_query(query);
- if (ret == -1) {
- _LOGD("Package App Info DB Insert Failed\n");
- return -1;
- }
if (strcasecmp(app->mainapp, "True") == 0)
mfx->mainapp_id = strdup(app->appid);
}
app = (application_x *)mfx->application->data;
if (app == NULL)
return -1;
- if (app->appid) {
- sqlite3_snprintf(MAX_QUERY_LEN, query,
- "UPDATE package_app_info SET app_mainapp='true' WHERE app_id=%Q",
- app->appid);
- } else {
- _LOGD("Not valid appid\n");
- return -1;
- }
-
- ret = __exec_query(query);
- if (ret == -1) {
- _LOGD("Package UiApp Info DB Insert Failed\n");
- return -1;
- }
-
free((void *)app->mainapp);
app->mainapp = strdup("true");
mfx->mainapp_id = strdup(app->appid);
return (is_true) ? "true" : "false";
}
+static int __insert_pkg_updateinfo_in_db(manifest_x *mfx, uid_t uid)
+{
+ char query[MAX_QUERY_LEN] = {'\0'};
+ int ret;
+
+ if (mfx == NULL)
+ return -1;
+
+ sqlite3_snprintf(MAX_QUERY_LEN, query,
+ "INSERT INTO package_update_info(" \
+ "package, update_version) VALUES(%Q, %Q)",
+ mfx->package, mfx->version);
+ ret = __exec_query(query);
+
+ return ret;
+}
+
/* _PRODUCT_LAUNCHING_ENHANCED_
* app->indicatordisplay, app->portraitimg, app->landscapeimg, app->guestmode_appstatus
*/
sqlite3_snprintf(MAX_QUERY_LEN, query,
"INSERT INTO package_app_info(" \
"app_id, app_component, app_exec, app_nodisplay, app_type, " \
- "app_onboot, app_multiple, app_autorestart, app_taskmanage, app_enabled, " \
+ "app_onboot, app_multiple, app_autorestart, app_taskmanage, " \
"app_hwacceleration, app_screenreader, app_mainapp, app_recentimage, app_launchcondition, " \
"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_mode, app_support_disable, component_type, package, " \
"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, app_package_system, app_removable, " \
- "app_package_installed_time, app_support_mode) " \
+ "app_package_installed_time, app_support_ambient, app_setup_appid) " \
"VALUES(" \
"%Q, %Q, %Q, LOWER(%Q), %Q, " \
- "LOWER(%Q), LOWER(%Q), LOWER(%Q), LOWER(%Q), LOWER(%Q), " \
+ "LOWER(%Q), LOWER(%Q), LOWER(%Q), LOWER(%Q), " \
"%Q, %Q, %Q, %Q, %Q, " \
"LOWER(%Q), %Q, %Q, LOWER(%Q), %Q, " \
"LOWER(%Q), LOWER(%Q), %Q, %Q, LOWER(%Q), " \
"COALESCE(%Q, 'caller'), LOWER(%Q), %Q, LOWER(%Q), %Q, %Q, " \
"%Q, %Q, %d, %Q, %Q, " \
"%Q, %Q, LOWER(%Q), LOWER(%Q), LOWER(%Q), " \
- "%Q, %Q)", \
+ "%Q, LOWER(%Q), %Q)", \
app->appid, app->component_type, app->exec, __get_bool(app->nodisplay, false), app->type,
- __get_bool(app->onboot, false), __get_bool(app->multiple, false), __get_bool(app->autorestart, false), __get_bool(app->taskmanage, false), __get_bool(app->enabled, true),
+ __get_bool(app->onboot, false), __get_bool(app->multiple, false), __get_bool(app->autorestart, false), __get_bool(app->taskmanage, false),
app->hwacceleration, app->screenreader, app->mainapp, app->recentimage, app->launchcondition,
__get_bool(app->indicatordisplay, true), app->portraitimg, app->landscapeimg,
__get_bool(app->guestmode_visibility, true), app->permission_type,
__get_bool(mfx->preload, false), __get_bool(app->submode, false), app->submode_mainid, mfx->installed_storage, __get_bool(app->process_pool, false),
app->launch_mode, __get_bool(app->ui_gadget, false), mfx->support_mode, __get_bool(mfx->support_disable, false), app->component_type, mfx->package,
mfx->tep_name, mfx->zip_mount_file, background_value, type, mfx->root_path, mfx->api_version,
- effective_appid, __get_bool(app->splash_screen_display, false), __get_bool(mfx->system, false), __get_bool(mfx->removable, true), mfx->installed_time, mfx->support_mode);
+ effective_appid, __get_bool(app->splash_screen_display, false), __get_bool(mfx->system, false), __get_bool(mfx->removable, true),
+ mfx->installed_time, __get_bool(app->support_ambient, false), app->setup_appid);
ret = __exec_query(query);
if (ret == -1) {
if (dc == NULL)
continue;
sqlite3_snprintf(MAX_QUERY_LEN, query,
- "INSERT INTO package_app_data_control(app_id, providerid, access, type) " \
- "VALUES(%Q, %Q, %Q, %Q)",\
+ "INSERT INTO package_app_data_control(app_id, providerid, access, type, trusted) " \
+ "VALUES(%Q, %Q, %Q, %Q, %Q)",\
app->appid,
dc->providerid,
dc->access,
- dc->type);
+ dc->type,
+ __get_bool(dc->trusted, false));
ret = __exec_query(query);
if (ret == -1) {
return 0;
}
-static int __insert_application_legacy_splashscreen_info(manifest_x *mfx)
-{
- GList *app_tmp;
- application_x *app;
- int ret = -1;
- char query[MAX_QUERY_LEN] = {'\0'};
- char *tmp;
- const char *image_type;
- const char *indicatordisplay;
- const char *orientation;
- const char *operation = "launch-effect";
- const char *color_depth = "24"; /* default */
-
- for (app_tmp = mfx->application; app_tmp; app_tmp = app_tmp->next) {
- app = (application_x *)app_tmp->data;
- if (app == NULL ||
- (app->portraitimg == NULL && app->landscapeimg == NULL))
- continue;
- image_type = "img"; /* default */
- if (app->effectimage_type) {
- tmp = strstr(app->effectimage_type, "edj");
- if (tmp)
- image_type = "edj";
- }
- indicatordisplay = "true"; /* default */
- if (app->indicatordisplay)
- indicatordisplay = app->indicatordisplay;
- if (app->portraitimg) {
- orientation = "portrait";
- sqlite3_snprintf(MAX_QUERY_LEN, query,
- "INSERT INTO package_app_splash_screen" \
- "(app_id, src, type, orientation, indicatordisplay, operation, color_depth) " \
- "VALUES(%Q, %Q, %Q, %Q, %Q, %Q, %Q)",
- app->appid, app->portraitimg, image_type,
- orientation, indicatordisplay, operation,
- color_depth);
- ret = __exec_query(query);
- if (ret == -1) {
- _LOGD("Package UiApp Splash Screen DB Insert Failed");
- return -1;
- }
- memset(query, '\0', MAX_QUERY_LEN);
- }
- if (app->landscapeimg) {
- orientation = "landscape";
- sqlite3_snprintf(MAX_QUERY_LEN, query,
- "INSERT INTO package_app_splash_screen" \
- "(app_id, src, type, orientation, indicatordisplay, operation, color_depth) " \
- "VALUES(%Q, %Q, %Q, %Q, %Q, %Q, %Q)",
- app->appid, app->landscapeimg, image_type,
- orientation, indicatordisplay, operation,
- color_depth);
- ret = __exec_query(query);
- if (ret == -1) {
- _LOGD("Package UiApp Splash Screen DB Insert Failed");
- return -1;
- }
- memset(query, '\0', MAX_QUERY_LEN);
- }
- }
- return 0;
-}
-
-static int __insert_application_metadata_splashscreen_info(manifest_x *mfx)
-{
- GList *app_tmp;
- application_x *app;
- GList *md_tmp;
- metadata_x *md;
- int ret;
- char query[MAX_QUERY_LEN] = {'\0'};
- char *token;
- char *tmpptr = NULL;
- const char *operation;
- const char *portraitimg;
- const char *landscapeimg;
- const char *indicatordisplay;
- const char *orientation;
- const char *image_type;
- const char *color_depth = "24"; /* default */
-
- for (app_tmp = mfx->application; app_tmp; app_tmp = app_tmp->next) {
- app = (application_x *)app_tmp->data;
- if (app == NULL)
- continue;
-
- for (md_tmp = app->metadata; md_tmp; md_tmp = md_tmp->next) {
- md = (metadata_x *)md_tmp->data;
- if (md == NULL || md->key == NULL || md->value == NULL)
- continue;
-
- if (strcasestr(md->key, "operation_effect=")) {
- operation = index(md->key, '=');
- if (operation && operation[1] != '\0')
- operation++;
- else
- operation = "launch-effect";
- } else if (strcasestr(md->key, "launch_effect")) {
- operation = "launch-effect";
- } else {
- continue;
- }
-
- portraitimg = NULL;
- landscapeimg = NULL;
- indicatordisplay = "true"; /* default */
- token = strtok_r(md->value, "|", &tmpptr);
- while (token != NULL) {
- if (strcasestr(token, "portrait-effectimage=")) {
- portraitimg = index(token, '=');
- if (portraitimg && portraitimg[1] != '\0')
- portraitimg++;
- else
- portraitimg = NULL;
- } else if (strcasestr(token, "landscape-effectimage=")) {
- landscapeimg = index(token, '=');
- if (landscapeimg && landscapeimg[1] != '\0')
- landscapeimg++;
- else
- landscapeimg = NULL;
- } else if (strcasestr(token, "indicatordisplay=")) {
- indicatordisplay = index(token, '=');
- if (indicatordisplay && indicatordisplay[1] != '\0')
- indicatordisplay++;
- else
- indicatordisplay = "true";
- }
-
- token = strtok_r(NULL, "|", &tmpptr);
- }
-
- if (portraitimg) {
- orientation = "portrait";
- image_type = "img";
- if (strcasestr(portraitimg, "edj"))
- image_type = "edj";
- sqlite3_snprintf(MAX_QUERY_LEN, query,
- "INSERT INTO package_app_splash_screen" \
- "(app_id, src, type, orientation, indicatordisplay, operation, color_depth) " \
- "VALUES(%Q, %Q, %Q, %Q, %Q, %Q, %Q)",
- app->appid, portraitimg, image_type,
- orientation, indicatordisplay, operation,
- color_depth);
- ret = __exec_query(query);
- if (ret == -1) {
- _LOGD("Package UiApp Splash Screen DB Insert Failed");
- return -1;
- }
- memset(query, '\0', MAX_QUERY_LEN);
- }
- if (landscapeimg) {
- orientation = "landscape";
- image_type = "img";
- if (strcasestr(landscapeimg, "edj"))
- image_type = "edj";
- sqlite3_snprintf(MAX_QUERY_LEN, query,
- "INSERT INTO package_app_splash_screen" \
- "(app_id, src, type, orientation, indicatordisplay, operation, color_depth) " \
- "VALUES(%Q, %Q, %Q, %Q, %Q, %Q, %Q)",
- app->appid, landscapeimg, image_type,
- orientation, indicatordisplay, operation,
- color_depth);
- ret = __exec_query(query);
- if (ret == -1) {
- _LOGD("Package UiApp Splash Screen DB Insert Failed");
- return -1;
- }
- memset(query, '\0', MAX_QUERY_LEN);
- }
- }
- }
-
- return 0;
-}
-
static int __insert_manifest_info_in_db(manifest_x *mfx, uid_t uid)
{
GList *tmp;
if (mfx->support_mode)
temp_pkg_mode = atoi(mfx->support_mode);
+ /* FIXME : OR-ing should be fixed to not to store whole support mode */
list_up = mfx->application;
while (list_up != NULL) {
up_support_mode = (application_x *)list_up->data;
}
snprintf(pkg_mode, MAX_INTEGER_LENGTH, "%d", temp_pkg_mode);
- if(mfx->support_mode)
+ if (mfx->support_mode)
free((void *)mfx->support_mode);
mfx->support_mode = strdup(pkg_mode);
"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, " \
- "mainapp_id, package_url, root_path, csc_path, package_support_mode, package_support_disable, package_support_mode) " \
+ "mainapp_id, package_url, root_path, csc_path, package_support_mode, package_support_disable) " \
"VALUES(" \
"%Q, %Q, %Q, %Q, %Q, %Q, " \
"%Q, %Q, LOWER(%Q), LOWER(%Q), LOWER(%Q), " \
"LOWER(%Q), LOWER(%Q), LOWER(%Q), LOWER(%Q), %Q, " \
"%Q, %Q, %Q, %Q, %Q, " \
- "%Q, %Q, %Q, %Q, %Q, LOWER(%Q), %Q)",
+ "%Q, %Q, %Q, %Q, %Q, LOWER(%Q))",
mfx->package, mfx->type, mfx->version, mfx->api_version, mfx->tep_name, mfx->zip_mount_file,
mfx->installlocation, mfx->package_size, __get_bool(mfx->removable, true), __get_bool(mfx->preload, false), __get_bool(mfx->readonly, false),
__get_bool(mfx->update, false), __get_bool(mfx->appsetting, false), __get_bool(mfx->nodisplay_setting, false), __get_bool(mfx->system, false), auth_name,
auth_email, auth_href, mfx->installed_time, mfx->installed_storage,
mfx->storeclient_id,
- mfx->mainapp_id, mfx->package_url, mfx->root_path, mfx->csc_path, mfx->support_mode, __get_bool(mfx->support_disable, false), mfx->support_mode);
+ mfx->mainapp_id, mfx->package_url, mfx->root_path, mfx->csc_path, mfx->support_mode, __get_bool(mfx->support_disable, false));
ret = __exec_query(query);
if (ret == -1) {
return -1;
}
+ ret = __insert_pkg_updateinfo_in_db(mfx, uid);
+ if (ret == -1) {
+ _LOGE("Package Update Info DB Insert Failed\n");
+ return -1;
+ }
+
/*Insert in the package_privilege_info DB*/
for (tmp = mfx->privileges; tmp; tmp = tmp->next) {
pv = (privilege_x *)tmp->data;
if (ret == -1)
return -1;
- /*Insert in the package_app_splash_screen DB (backward compatibility)*/
- ret = __insert_application_legacy_splashscreen_info(mfx);
- if (ret == -1)
- return -1;
-
- /*Insert in the package_app_splash_screen DB (backward compatibility)*/
- ret = __insert_application_metadata_splashscreen_info(mfx);
- if (ret == -1)
- return -1;
-
/*Insert in the package_app_splash_screen DB*/
ret = __insert_application_splashscreen_info(mfx);
if (ret == -1)
}
memset(query, '\0', MAX_QUERY_LEN);
+ /*Delete from Package Update Info DB*/
+ sqlite3_snprintf(MAX_QUERY_LEN, query,
+ "DELETE FROM package_update_info WHERE package=%Q", mfx->package);
+ ret = __exec_query(query);
+ if (ret == -1) {
+ _LOGD("Package Update Info DB Delete Failed\n");
+ return -1;
+ }
+ memset(query, '\0', MAX_QUERY_LEN);
+
/*Delete from Package Localized Info*/
sqlite3_snprintf(MAX_QUERY_LEN, query,
"DELETE FROM package_localized_info WHERE package=%Q", mfx->package);
sqlite3_snprintf(MAX_QUERY_LEN, query, "INSERT INTO "
"package_app_info_for_uid(app_id, uid, is_disabled, is_splash_screen_enabled) "
"VALUES(%Q, %d, 'true', "
- "(SELECT app_splash_screen_display FROM package_app_info WHERE appid='%Q'))",
+ "(SELECT app_splash_screen_display FROM package_app_info WHERE app_id=%Q))",
appid, (int)uid, appid);
} else {
sqlite3_snprintf(MAX_QUERY_LEN, query, "UPDATE "
_LOGD("package app app privilege DB initialization failed\n");
return ret;
}
+ ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_UPDATE_INFO);
+ if (ret == -1) {
+ _LOGD("package update info DB initialization failed\n");
+ return ret;
+ }
ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_PACKAGE_APP_INFO);
if (ret == -1) {
_LOGD("package app info DB initialization failed\n");
if (getuid() != OWNER_ROOT) /* At this time we should be root to apply this */
return 0;
snprintf(journal_file, sizeof(journal_file), "%s%s", db_file, "-journal");
- if (uid == OWNER_ROOT)
- uid = GLOBAL_USER;
+ if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
+ ret = getpwnam_r(APPFW_USER, &userinfo, buf, sizeof(buf), &result);
+ if (ret != 0 || result == NULL)
+ return -1;
+ uid = userinfo.pw_uid;
+ }
+
ret = getpwuid_r(uid, &userinfo, pwuid_buf, sizeof(pwuid_buf), &result);
if (ret != 0 || result == NULL) {
_LOGE("FAIL: user %d doesn't exist", uid);
return pkgmgr_parser_delete_manifest_info_from_usr_db(mfx, _getuid());
}
+static int _convert_update_type(pkgmgrinfo_updateinfo_update_type type, char **convert_type)
+{
+ if (type == PMINFO_UPDATEINFO_NONE)
+ *convert_type = PMINFO_UPDATEINFO_TYPE_NONE;
+ else if (type == PMINFO_UPDATEINFO_FORCE)
+ *convert_type = PMINFO_UPDATEINFO_TYPE_FORCE;
+ else if (type == PMINFO_UPDATEINFO_OPTIONAL)
+ *convert_type = PMINFO_UPDATEINFO_TYPE_OPTIONAL;
+ else
+ return -1;
+ return 0;
+}
+
+API int pkgmgr_parser_register_pkg_update_info_in_usr_db(pkgmgrinfo_updateinfo_h handle, uid_t uid)
+{
+ int ret;
+ updateinfo_x *update_info;
+ updateinfo_x *prev_update_info;
+ pkgmgrinfo_updateinfo_h prev_update_handle;
+ pkgmgrinfo_pkginfo_h pkginfo;
+ pkgmgrinfo_version_compare_type compare_result;
+ bool is_global_pkg;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char *convert_type;
+
+ if (handle == NULL)
+ return PMINFO_R_EINVAL;
+
+ update_info = (updateinfo_x *)handle;
+ if (update_info->pkgid == NULL || update_info->version == NULL)
+ return PMINFO_R_EINVAL;
+ if (_convert_update_type(update_info->type, &convert_type) != 0)
+ return PMINFO_R_EINVAL;
+
+ ret = pkgmgrinfo_updateinfo_get_usr_updateinfo(update_info->pkgid,
+ &prev_update_handle, uid);
+ if (ret != PMINFO_R_OK)
+ return PMINFO_R_ERROR;
+
+ prev_update_info = (updateinfo_x *)prev_update_handle;
+ ret = pkgmgrinfo_compare_package_version(update_info->version,
+ prev_update_info->version, &compare_result);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_updateinfo_destroy(prev_update_handle);
+ return PMINFO_R_ERROR;
+ }
+
+ if (compare_result == PMINFO_VERSION_SAME &&
+ prev_update_info->type == PMINFO_UPDATEINFO_NONE) {
+ _LOGI("Given update info version[%s] of pkgid[%s] will be ignored",
+ update_info->version, update_info->pkgid);
+ pkgmgrinfo_updateinfo_destroy(prev_update_handle);
+ return PMINFO_R_OK;
+ }
+ pkgmgrinfo_updateinfo_destroy(prev_update_handle);
+
+ ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(update_info->pkgid, uid,
+ &pkginfo);
+ if (ret != PMINFO_R_OK)
+ return PMINFO_R_ERROR;
+
+ ret = pkgmgrinfo_pkginfo_is_global(pkginfo, &is_global_pkg);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo);
+ return PMINFO_R_ERROR;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo);
+
+ ret = pkgmgr_parser_check_and_create_db(
+ (is_global_pkg) ? GLOBAL_USER : uid);
+ if (ret != PMINFO_R_OK)
+ return PMINFO_R_ERROR;
+
+ sqlite3_snprintf(MAX_QUERY_LEN, query,
+ "UPDATE package_update_info SET update_version=%Q, " \
+ "update_type=%Q WHERE package=%Q",
+ update_info->version,
+ convert_type,
+ update_info->pkgid);
+
+ ret = __exec_query(query);
+ pkgmgr_parser_close_db();
+
+ return ret;
+}
+
+API int pkgmgr_parser_register_pkg_update_info_in_db(pkgmgrinfo_updateinfo_h handle)
+{
+ return pkgmgr_parser_register_pkg_update_info_in_usr_db(handle, _getuid());
+}
+
+API int pkgmgr_parser_unregister_pkg_update_info_in_usr_db(const char *pkgid, uid_t uid)
+{
+ pkgmgrinfo_pkginfo_h pkginfo = NULL;
+ int ret;
+ bool is_global_pkg;
+ char query[MAX_QUERY_LEN] = {'\0'};
+
+ if (pkgid == NULL)
+ return PMINFO_R_EINVAL;
+
+ ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &pkginfo);
+ if (ret != PMINFO_R_OK)
+ return -1;
+
+ ret = pkgmgrinfo_pkginfo_is_global(pkginfo, &is_global_pkg);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo);
+ return PMINFO_R_ERROR;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo);
+ ret = pkgmgr_parser_check_and_create_db((is_global_pkg) ? GLOBAL_USER : uid);
+ if (ret != PMINFO_R_OK)
+ return ret;
+
+ sqlite3_snprintf(MAX_QUERY_LEN, query,
+ "UPDATE package_update_info SET update_type='none' " \
+ "WHERE package=%Q", pkgid);
+
+ ret = __exec_query(query);
+ pkgmgr_parser_close_db();
+
+ return ret;
+}
+
+API int pkgmgr_parser_unregister_pkg_update_info_in_db(const char *pkgid)
+{
+ return pkgmgr_parser_unregister_pkg_update_info_in_usr_db(pkgid, _getuid());
+}
+
+API int pkgmgr_parser_unregister_all_pkg_update_info_in_usr_db(uid_t uid)
+{
+ int ret;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ char *error_message = NULL;
+
+ ret = pkgmgr_parser_check_and_create_db(uid);
+ if (ret != 0)
+ return PMINFO_R_ERROR;
+
+ sqlite3_snprintf(MAX_QUERY_LEN, query,
+ "UPDATE package_update_info SET update_type='none'");
+ ret = sqlite3_exec(pkgmgr_parser_db, query, NULL, NULL, &error_message);
+ if (ret != SQLITE_OK) {
+ _LOGE("Don't execute query = %s error message = %s\n", query,
+ error_message);
+ sqlite3_free(error_message);
+ pkgmgr_parser_close_db();
+ return PMINFO_R_ERROR;
+ }
+ sqlite3_free(error_message);
+ error_message = NULL;
+ pkgmgr_parser_close_db();
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgr_parser_unregister_all_pkg_update_info_in_db(void)
+{
+ return pkgmgr_parser_unregister_all_pkg_update_info_in_usr_db(_getuid());
+}
+
API int pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(const char *appid, uid_t uid, int is_disable)
{
int ret = -1;