}
/* These APIs are intended to call parser directly */
+API int pkgmgr_parser_parse_manifest_for_installation_withtep(const char *manifest, const char *tep_path, char *const tagv[])
+{
+ retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+ _LOGD("parsing manifest for installation: %s\n", manifest);
+
+ manifest_x *mfx = NULL;
+ int ret = -1;
+
+ xmlInitParser();
+ mfx = pkgmgr_parser_process_manifest_xml(manifest);
+ retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+
+ _LOGD("Parsing Finished\n");
+
+ __add_preload_info(mfx, manifest, GLOBAL_USER);
+
+ _LOGD("Added preload infomation\n");
+
+ __ps_process_tag(mfx, tagv);
+
+ if (tep_path != NULL && strlen(tep_path) != 0)
+ mfx->tep_name = strdup(tep_path);
+ else
+ mfx->tep_name = NULL;
+
+ ret = pkgmgr_parser_insert_manifest_info_in_db(mfx);
+ retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "DB Insert failed");
+
+ _LOGD("DB Insert Success\n");
+
+ __ps_process_tag_parser(mfx, manifest, ACTION_INSTALL);
+ ret = __ps_process_metadata_parser(mfx, ACTION_INSTALL);
+ if (ret == -1)
+ _LOGD("Creating metadata parser failed\n");
+
+ ret = __ps_process_category_parser(mfx, ACTION_INSTALL);
+ if (ret == -1)
+ _LOGD("Creating category parser failed\n");
+
+ pkgmgr_parser_free_manifest_xml(mfx);
+ _LOGD("Free Done\n");
+ xmlCleanupParser();
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgr_parser_parse_usr_manifest_for_installation_withtep(const char *manifest, const char *tep_path, uid_t uid, char *const tagv[])
+{
+ retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+ _LOGD("parsing manifest for installation: %s\n", manifest);
+ manifest_x *mfx = NULL;
+ int ret = -1;
+
+ xmlInitParser();
+ mfx = pkgmgr_parser_usr_process_manifest_xml(manifest, uid);
+ retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
+
+ _LOGD("Parsing Finished\n");
+
+ __ps_process_tag(mfx, tagv);
+
+ if (tep_path != NULL && strlen(tep_path) != 0)
+ mfx->tep_name = strdup(tep_path);
+ else
+ mfx->tep_name = NULL;
+
+ ret = pkgmgr_parser_insert_manifest_info_in_usr_db(mfx, uid);
+ retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "DB Insert failed");
+
+ _LOGD("DB Insert Success\n");
+
+ __ps_process_tag_parser(mfx, manifest, ACTION_INSTALL);
+ ret = __ps_process_metadata_parser(mfx, ACTION_INSTALL);
+ if (ret == -1)
+ _LOGD("Creating metadata parser failed\n");
+ ret = __ps_process_category_parser(mfx, ACTION_INSTALL);
+ if (ret == -1)
+ _LOGD("Creating category parser failed\n");
+
+ pkgmgr_parser_free_manifest_xml(mfx);
+ _LOGD("Free Done\n");
+ xmlCleanupParser();
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgr_parser_usr_update_tep(const char *pkgid, const char *tep_path, uid_t uid)
+{
+ return pkgmgr_parser_update_tep_info_in_usr_db(pkgid, tep_path, uid);
+}
+
+API int pkgmgr_parser_update_tep(const char *pkgid, const char *tep_path)
+{
+ return pkgmgr_parser_update_tep_info_in_db(pkgid, tep_path);
+}
API int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[])
{
int pkgmgr_parser_parse_usr_manifest_for_installation(const char *manifest, uid_t uid, char *const tagv[]);
/**
+ * @fn int pkgmgr_parser_parse_manifest_for_installation_withtep(const char *manifest, const char *tep_path, char *const tagv[])
+ * @fn int pkgmgr_parser_parse_usr_manifest_for_installation_withtep(const char *manifest, const char *tep_path, uid_t uid, char *const tagv[])
+ * @brief This API parses the manifest file of the package after installation and stores the parsed data and tep information in DB if exists.
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] manifest pointer to package manifest file
+ * @param[in] uid the addressee user id of the instruction
+ * @param[in] tagv array of xml tags or NULL
+ * @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 None
+ * @post None
+ * @code
+static int parse_manifest_file_for_installation(const char *manifest, const char *tep_path)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_parse_manifest_for_installation_withtep(manifest, tep_path, NULL);
+ if (ret)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_parse_manifest_for_installation_withtep(const char *manifest, const char *tep_path, char *const tagv[]);
+int pkgmgr_parser_parse_usr_manifest_for_installation_withtep(const char *manifest, const char *tep_path, uid_t uid, char *const tagv[]);
+
+/**
+ * @fn int pkgmgr_parser_update_tep(const char* pkgid, const char * tep_path)
+ * @fn int pkgmgr_parser_usr_update_tep(const char* pkgid, const char* tep_path, uid_t uid)
+ * @brief This API updates tep path information stored in DB.
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to package ID
+ * @param[in]tep_path pointer to path of TEP file
+ * @param[in] uid the addressee user id of the instruction
+ * @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 None
+ * @post None
+ * @code
+static int update_tep_info_for_upgrade(const char *pkgid, const char *tep_path)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_update_tep(pkgid, tep_path);
+ if (ret)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_update_tep(const char* pkgid, const char* tep_path);
+int pkgmgr_parser_usr_update_tep(const char* pkgid, const char* tep_path, uid_t uid);
+
+/**
* @fn int pkgmgr_parser_parse_usr_manifest_for_upgrade(const char *manifest, uid_t uid, char *const tagv[])
* @fn int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[])
* @brief This API parses the manifest file of the package after upgrade and stores the data in DB.
"package_type text DEFAULT 'rpm', " \
"package_version text, " \
"package_api_version text, " \
+ "package_tep_name text, " \
"install_location text, " \
"package_size text, " \
"package_removable text DEFAULT 'true', " \
"app_support_disable text DEFAULT 'false', " \
"component_type text, " \
"package text not null, " \
+ "app_tep_name text, " \
"FOREIGN KEY(package) " \
"REFERENCES package_info(package) " \
"ON DELETE CASCADE)"
app = (application_x *)tmp->data;
if (app == NULL)
continue;
+
snprintf(query, MAX_QUERY_LEN,
"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_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_launch_mode, app_ui_gadget, app_support_disable, component_type, package) " \
- "values('%s', '%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
+ "app_preload, app_submode, app_submode_mainid, app_launch_mode, app_ui_gadget, app_support_disable, component_type, package, app_tep_name) " \
+ "values('%s', '%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
app->appid,
app->component_type,
app->exec,
app->ui_gadget,
mfx->support_disable,
app->component_type,
- mfx->package);
+ mfx->package,
+ __get_str(mfx->tep_name));
ret = __exec_query(query);
if (ret == -1) {
/*Insert in the package_info DB*/
snprintf(query, MAX_QUERY_LEN,
- "insert into package_info(package, package_type, package_version, package_api_version, install_location, package_size, " \
+ "insert into package_info(package, package_type, package_version, package_api_version, package_tep_name, 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_disable) " \
- "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
+ "values('%s', '%s', '%s', '%s', '%s', '%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),
__get_str(mfx->installlocation),
__get_str(mfx->package_size),
mfx->removable,
_LOGD("package cert index info DB initialization failed\n");
return ret;
}
-
+
if( 0 != __parserdb_change_perm(getUserPkgCertDBPathUID(uid), uid)) {
_LOGD("Failed to change cert db permission\n");
}
return ret;
}
+API int pkgmgr_parser_update_tep_info_in_db(const char *pkgid, const char *tep_path)
+{
+ return pkgmgr_parser_update_tep_info_in_usr_db(pkgid, tep_path, GLOBAL_USER);
+}
+
+API int pkgmgr_parser_update_tep_info_in_usr_db(const char *pkgid, const char *tep_path, uid_t uid)
+{
+ if (pkgid == NULL || tep_path == NULL) {
+ _LOGE("invalid parameter");
+ return -1;
+ }
+
+ int ret = -1;
+ char *query = NULL;
+
+ ret = pkgmgr_parser_check_and_create_db(uid);
+ if (ret == -1) {
+ _LOGD("Failed to open DB\n");
+ return ret;
+ }
+ ret = pkgmgr_parser_initialize_db(uid);
+ if (ret == -1)
+ goto err;
+
+ /*Begin transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGD("Failed to begin transaction\n");
+ ret = -1;
+ goto err;
+ }
+ _LOGD("Transaction Begin\n");
+
+
+ /* Updating TEP info in "package_info" table */
+ query = sqlite3_mprintf("UPDATE package_info "\
+ "SET package_tep_name = %Q "\
+ "WHERE package = %Q", tep_path, pkgid);
+
+ ret = __exec_query(query);
+ sqlite3_free(query);
+ if (ret != SQLITE_OK) {
+ ret = PM_PARSER_R_ERROR;
+ _LOGE("sqlite exec failed to insert entries into package_info!!");
+ goto err;
+ }
+
+ /* Updating TEP info in "package_app_info" table */
+ query = sqlite3_mprintf("UPDATE package_app_info "\
+ "SET app_tep_name = %Q "\
+ "WHERE package = %Q", tep_path, pkgid);
+
+ ret = __exec_query(query);
+ sqlite3_free(query);
+ if (ret != SQLITE_OK) {
+ ret = PM_PARSER_R_ERROR;
+ _LOGE("sqlite exec failed to insert entries into package_app_info!!");
+ goto err;
+ }
+
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to commit transaction, Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to Rollback\n");
+
+ ret = PM_PARSER_R_ERROR;
+ goto err;
+ }
+ _LOGD("Transaction Commit and End\n");
+ ret = PM_PARSER_R_OK;
+
+err:
+ pkgmgr_parser_close_db();
+ return ret;
+}
+
+
API int pkgmgr_parser_update_manifest_info_in_usr_db(manifest_x *mfx, uid_t uid)
{
if (mfx == NULL) {