- _LOGE("Failed to begin transaction\n");
- __close_manifest_db();
- return PMINFO_R_ERROR;
- }
- _LOGD("Transaction Begin\n");
-
- memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN,
- "update package_app_info set app_enabled='%s' where app_id='%s'", enabled?"true":"false", appid);
-
- if (SQLITE_OK !=
- sqlite3_exec(GET_DB(manifest_db), query, NULL, NULL, &error_message)) {
- _LOGE("Don't execute query = %s error message = %s\n", query,
- error_message);
- sqlite3_free(error_message);
- return PMINFO_R_ERROR;
- }
- sqlite3_free(error_message);
-
- /*Commit transaction*/
- ret = sqlite3_exec(GET_DB(manifest_db), "COMMIT", NULL, NULL, NULL);
- if (ret != SQLITE_OK) {
- _LOGE("Failed to commit transaction. Rollback now\n");
- sqlite3_exec(GET_DB(manifest_db), "ROLLBACK", NULL, NULL, NULL);
- __close_manifest_db();
- return PMINFO_R_ERROR;
- }
- _LOGD("Transaction Commit and End\n");
- __close_manifest_db();
- return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_set_state_enabled(const char *appid, bool enabled)
-{
- return pkgmgrinfo_appinfo_set_usr_state_enabled(appid, enabled, GLOBAL_USER);
-}
-
-API int pkgmgrinfo_appinfo_set_usr_default_label(const char *appid, const char *label, uid_t uid)
-{
- int ret;
- char query[MAX_QUERY_LEN] = {'\0'};
- char *error_message;
-
- retvm_if(appid == NULL, PMINFO_R_EINVAL, "appid is NULL\n");
-
- ret = __open_manifest_db(uid, false);
- if (ret == -1) {
- _LOGE("Fail to open manifest DB\n");