return PMINFO_R_OK;
}
+static int _pkginfo_get_plugin_execution_info(sqlite3 *db, const char *pkgid,
+ GList **plugins)
+{
+ static const char query_raw[] =
+ "SELECT appid, plugin_type, plugin_name FROM package_plugin_info "
+ "WHERE pkgid=%Q";
+ int ret;
+ char *query;
+ sqlite3_stmt *stmt;
+ plugin_x *plugin;
+
+ query = sqlite3_mprintf(query_raw, pkgid);
+ if (query == NULL) {
+ LOGE("out of memory");
+ return PMINFO_R_ERROR;
+ }
+
+ ret = sqlite3_prepare_v2(db, query, strlen(query),
+ &stmt, NULL);
+ sqlite3_free(query);
+ if (ret != SQLITE_OK) {
+ LOGE("prepare failed: %s", sqlite3_errmsg(db));
+ return PMINFO_R_ERROR;
+ }
+
+ while (sqlite3_step(stmt) == SQLITE_ROW) {
+ plugin = calloc(1, sizeof(plugin_x));
+ if (!plugin) {
+ LOGE("out of memory");
+ sqlite3_finalize(stmt);
+ return PMINFO_R_ERROR;
+ }
+ plugin->pkgid = strdup(pkgid);
+ _save_column_str(stmt, 0, &plugin->appid);
+ _save_column_str(stmt, 1, &plugin->plugin_type);
+ _save_column_str(stmt, 2, &plugin->plugin_name);
+ *plugins = g_list_append(*plugins,
+ (gpointer)plugin);
+ }
+
+ sqlite3_finalize(stmt);
+
+ return PMINFO_R_OK;
+}
+
static int _pkginfo_get_privilege(sqlite3 *db, const char *pkgid,
GList **privileges)
{
info->for_all_users =
strdup((uid != global_user_uid) ? "false" : "true");
+ if (_pkginfo_get_plugin_execution_info(db, info->package, &info->plugin)) {
+ ret = PMINFO_R_ERROR;
+ goto catch;
+ }
+
if (flag & PMINFO_PKGINFO_GET_AUTHOR) {
/* TODO : author should be retrieved at package_localized_info */
author = calloc(1, sizeof(author_x));
return PMINFO_R_OK;
}
+API int pkgmgrinfo_pkginfo_foreach_plugin(pkgmgrinfo_pkginfo_h handle,
+ pkgmgrinfo_plugin_list_cb plugin_func, void *user_data)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
+ retvm_if(plugin_func == NULL, PMINFO_R_EINVAL,
+ "Callback function is NULL");
+ int ret;
+ plugin_x *plugin;
+ GList *tmp;
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+
+ if (info->pkg_info == NULL)
+ return PMINFO_R_ERROR;
+
+ for (tmp = info->pkg_info->plugin; tmp; tmp = tmp->next) {
+ plugin = (plugin_x *)tmp->data;
+ if (plugin == NULL)
+ continue;
+ ret = plugin_func(plugin->pkgid, plugin->appid,
+ plugin->plugin_type, plugin->plugin_name, user_data);
+ if (ret < 0)
+ return PMINFO_R_OK;
+ }
+
+ return PMINFO_R_OK;
+}
+
API int pkgmgrinfo_pkginfo_foreach_appdefined_privilege(
pkgmgrinfo_pkginfo_h handle,
pkgmgrinfo_pkg_appdefined_privilege_list_cb privilege_func,