configure_file(parser_path.conf.in parser_path.conf @ONLY)
configure_file(pkgmgr-info.manifest.in pkgmgr-info.manifest @ONLY)
configure_file(pkgmgr-parser.manifest.in pkgmgr-parser.manifest @ONLY)
+configure_file(mdparser_list.txt.in mdparser_list.txt @ONLY)
+
INSTALL(TARGETS pkgmgr-info DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-info.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/pkgmgr-info.h DESTINATION include)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/parser_path.conf DESTINATION ${PREFIX}/etc/package-manager/)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mdparser_list.txt DESTINATION ${PREFIX}/etc/package-manager/parserlib/metadata)
int pkgmgrinfo_pkginfo_is_preload(pkgmgrinfo_pkginfo_h handle, bool *preload);
/**
+ * @fn int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system)
+ * @brief This API gets the value for given handle is system or not
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[out] system pointer to hold system is or not
+ * @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 pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_readonly()
+ * @code
+static int get_pkg_system(const char *pkgid)
+{
+ int ret = 0;
+ bool system = false;
+ pkgmgrinfo_pkginfo_h handle = NULL;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_is_system(handle, &system);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg system: %d\n", system);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system);
+
+/**
* @fn int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly)
* @brief This API gets the package 'readonly' value from the package ID
*
--- /dev/null
+http://developer.samsung.com/tizen/metadata/sticker
+http://developer.samsung.com/tizen/metadata/tts
\ No newline at end of file
Name: pkgmgr-info
Summary: Packager Manager infomation api for package
-Version: 0.0.124
+Version: 0.0.125
Release: 1
Group: Application Framework/Package Management
License: Apache-2.0
%{_prefix}/etc/package-manager/preload/manifest.xsd
%{_prefix}/etc/package-manager/preload/xml.xsd
%{_prefix}/etc/package-manager/parser_path.conf
+%{_prefix}/etc/package-manager/parserlib/metadata/mdparser_list.txt
%files parser-devel
%defattr(-,root,root,-)
#include <libxml/xmlreader.h>
#include <libxml/xmlschemas.h>
#include <vconf.h>
+#include <glib.h>
#include "pkgmgr_parser.h"
#include "pkgmgr_parser_internal.h"
#define ASCII(s) (const char *)s
#define XMLCHAR(s) (const xmlChar *)s
+#define MDPARSER_LIST "/usr/etc/package-manager/parserlib/metadata/mdparser_list.txt"
+#define MDPARSER_NAME "mdparser:"
+
/* operation_type */
typedef enum {
ACTION_INSTALL = 0,
ACTION_MAX
} ACTION_TYPE;
+typedef struct {
+ const char *key;
+ const char *value;
+} __metadata_t;
+
const char *package;
static int __ps_process_label(xmlTextReaderPtr reader, label_x *label);
return 0;
}
+static char * __get_tag_by_key(char *md_key)
+{
+ char *md_tag = NULL;
+
+ if (md_key == NULL) {
+ DBG("md_key is NULL\n");
+ return NULL;
+ }
+
+ md_tag = strrchr(md_key, 47) + 1;
+
+
+ return strdup(md_tag);
+}
+
+static char *__get_mdparser_plugin(const char *type)
+{
+ FILE *fp = NULL;
+ char buffer[1024] = { 0 };
+ char temp_path[1024] = { 0 };
+ char *path = NULL;
+
+ if (type == NULL) {
+ DBGE("invalid argument\n");
+ return NULL;
+ }
+
+ fp = fopen(PKG_PARSER_CONF_PATH, "r");
+ if (fp == NULL) {
+ DBGE("no matching mdparser\n");
+ return NULL;
+ }
+
+ while (fgets(buffer, sizeof(buffer), fp) != NULL) {
+ if (buffer[0] == '#')
+ continue;
+
+ __str_trim(buffer);
+
+ if ((path = strstr(buffer, MDPARSER_NAME)) != NULL) {
+ path = path + strlen(MDPARSER_NAME);
+
+ break;
+ }
+
+ memset(buffer, 0x00, 1024);
+ }
+
+ if (fp != NULL)
+ fclose(fp);
+
+ if (path == NULL) {
+ DBGE("no matching backendlib\n");
+ return NULL;
+ }
+
+ snprintf(temp_path, sizeof(temp_path) - 1, "%slib%s.so", path, type);
+
+ return strdup(temp_path);
+}
static char *__get_parser_plugin(const char *type)
{
}
snprintf(temp_path, sizeof(temp_path) - 1, "%slib%s.so", path, type);
+ DBG("[%s]\n", temp_path);
return strdup(temp_path);
}
+static int __ps_run_mdparser(GList *md_list, const char *tag,
+ ACTION_TYPE action, const char *pkgid, const char *appid)
+{
+ char *lib_path = NULL;
+ void *lib_handle = NULL;
+ int (*mdparser_plugin) (const char *, const char *, GList *);
+ int ret = -1;
+ char *ac = NULL;
+
+ switch (action) {
+ case ACTION_INSTALL:
+ ac = "PKGMGR_MDPARSER_PLUGIN_INSTALL";
+ break;
+ case ACTION_UPGRADE:
+ ac = "PKGMGR_MDPARSER_PLUGIN_UPGRADE";
+ break;
+ case ACTION_UNINSTALL:
+ ac = "PKGMGR_MDPARSER_PLUGIN_UNINSTALL";
+ break;
+ default:
+ goto END;
+ }
+
+ lib_path = __get_mdparser_plugin(tag);
+ if (!lib_path) {
+ DBGE("__get_mdparser_plugin fail\n");
+ goto END;
+ }
+
+ if ((lib_handle = dlopen(lib_path, RTLD_LAZY)) == NULL) {
+ DBGE("dlopen is failed lib_path[%s]\n", lib_path);
+ goto END;
+ }
+
+ if ((mdparser_plugin =
+ dlsym(lib_handle, ac)) == NULL || dlerror() != NULL) {
+ DBGE("can not find symbol \n");
+ goto END;
+ }
+
+ ret = mdparser_plugin(pkgid, appid, md_list);
+ if (ret < 0)
+ DBGE("[appid = %s, libpath = %s] plugin fail\n", appid, lib_path);
+ else
+ DBGE("[appid = %s, libpath = %s] plugin success\n", appid, lib_path);
+
+END:
+ if (lib_path)
+ free(lib_path);
+ if (lib_handle)
+ dlclose(lib_handle);
+ return ret;
+}
+
static int __ps_run_parser(xmlDocPtr docPtr, const char *tag,
ACTION_TYPE action, const char *pkgid)
{
return manifest;
}
+static void __mdparser_clear_dir_list(GList* dir_list)
+{
+ GList *list = NULL;
+ __metadata_t* detail = NULL;
+
+ if (dir_list) {
+ list = g_list_first(dir_list);
+ while (list) {
+ detail = (__metadata_t *)list->data;
+ if (detail) {
+ if (detail->key)
+ free(detail->key);
+ if (detail->value)
+ free(detail->value);
+ free(detail);
+ }
+ list = g_list_next(list);
+ }
+ g_list_free(dir_list);
+ }
+}
+
+static int __run_mdparser_prestep (manifest_x *mfx, char *md_key, ACTION_TYPE action)
+{
+ int ret = -1;
+ int tag_exist = 0;
+ char buffer[1024] = { 0, };
+ uiapplication_x *up = mfx->uiapplication;
+ metadata_x *md = NULL;
+ char *md_tag = NULL;
+
+ GList *md_list = NULL;
+ __metadata_t *md_detail = NULL;
+
+ md_tag = __get_tag_by_key(md_key);
+ if (md_tag == NULL) {
+ DBG("md_tag is NULL\n");
+ return -1;
+ }
+ DBG("md_tag = %s\n", md_tag);
+
+ while(up != NULL)
+ {
+ md = up->metadata;
+ while (md != NULL)
+ {
+ //get glist of meatdata key and value combination
+ memset(buffer, 0x00, 1024);
+ snprintf(buffer, 1024, "%s/", md_key);
+ if ((md->key && md->value) && (strncmp(md->key, md_key, strlen(md_key)) == 0) && (strncmp(buffer, md->key, strlen(buffer)) == 0)) {
+ md_detail = (__metadata_t*) calloc(1, sizeof(__metadata_t));
+ if (md_detail == NULL) {
+ DBG("Memory allocation failed\n");
+ goto END;
+ }
+
+ md_detail->key = (char*) calloc(1, sizeof(char)*(strlen(md->key)+2));
+ if (md_detail->key == NULL) {
+ DBG("Memory allocation failed\n");
+ free(md_detail);
+ goto END;
+ }
+ snprintf(md_detail->key, (strlen(md->key)+1), "%s", md->key);
+
+ md_detail->value = (char*) calloc(1, sizeof(char)*(strlen(md->value)+2));
+ if (md_detail->value == NULL) {
+ DBG("Memory allocation failed\n");
+ free(md_detail->key);
+ free(md_detail);
+ goto END;
+ }
+ snprintf(md_detail->value, (strlen(md->value)+1), "%s", md->value);
+
+ md_list = g_list_append(md_list, (gpointer)md_detail);
+ tag_exist = 1;
+ }
+ md = md->next;
+ }
+
+ //send glist to parser when tags for metadata plugin parser exist.
+ if (tag_exist) {
+ ret = __ps_run_mdparser(md_list, md_tag, action, mfx->package, up->appid);
+ if (ret < 0)
+ DBG("mdparser failed[%d]\n", ret);
+ else
+ DBG("mdparser success, done[%d]\n", ret);
+ }
+ __mdparser_clear_dir_list(md_list);
+ md_list = NULL;
+ tag_exist = 0;
+ up = up->next;
+ }
+
+ return 0;
+END:
+ __mdparser_clear_dir_list(md_list);
+
+ if (md_tag)
+ free(md_tag);
+
+ return ret;
+}
+
static int __run_parser_prestep(xmlTextReaderPtr reader, ACTION_TYPE action, const char *pkgid)
{
int ret = -1;
ime = NULL;
}
+int __ps_process_mdparser(manifest_x *mfx, ACTION_TYPE action)
+{
+ int ret = -1;
+ FILE *fp = NULL;
+ char md_key[PKG_STRING_LEN_MAX] = { 0 };
+
+ fp = fopen(MDPARSER_LIST, "r");
+ if (fp == NULL) {
+ DBG("no preload list\n");
+ return -1;
+ }
+
+ while (fgets(md_key, sizeof(md_key), fp) != NULL) {
+ __str_trim(md_key);
+ DBG("md_key = %s\n", md_key);
+
+ ret = __run_mdparser_prestep(mfx, md_key, action);
+
+ memset(md_key, 0x00, sizeof(md_key));
+ }
+
+ if (fp != NULL)
+ fclose(fp);
+
+ return 0;
+}
static int __ps_process_allowed(xmlTextReaderPtr reader, allowed_x *allowed)
{
else
DBG("DB Insert Success\n");
+ ret = __ps_process_mdparser(mfx, ACTION_INSTALL);
+ if (ret == -1)
+ DBG("Creating metadata parser failed\n");
+
ret = __ps_make_nativeapp_desktop(mfx, NULL, 0);
if (ret == -1)
DBG("Creating desktop file failed\n");
else
DBG("DB Update Success\n");
+ ret = __ps_process_mdparser(mfx, ACTION_UPGRADE);
+ if (ret == -1)
+ DBG("Upgrade metadata parser failed\n");
+
ret = __ps_make_nativeapp_desktop(mfx, manifest, 1);
if (ret == -1)
DBG("Creating desktop file failed\n");
__add_preload_info(mfx, manifest);
DBG("Added preload infomation\n");
+ ret = __ps_process_mdparser(mfx, ACTION_UNINSTALL);
+ if (ret == -1)
+ DBG("Removing metadata parser failed\n");
+
ret = pkgmgr_parser_delete_manifest_info_from_db(mfx);
if (ret == -1)
DBG("DB Delete failed\n");
return PMINFO_R_OK;
}
+API int pkgmgr_parser_parse_manifest_for_preload()
+{
+ return pkgmgr_parser_update_preload_info_in_db();
+}
+
API char *pkgmgr_parser_get_manifest_file(const char *pkgid)
{
return __pkgid_to_manifest(pkgid);
return __ps_run_parser(docPtr, tag, ACTION_UNINSTALL, pkgid);
}
-API int pkgmgr_parser_run_post_for_installation(const char *pkgid, char *const tagv[])
-{
- return PMINFO_R_OK;
-}
-
-API int pkgmgr_parser_run_post_for_upgrade(const char *pkgid, char *const tagv[])
-{
- return PMINFO_R_OK;
-}
-
-API int pkgmgr_parser_run_post_for_uninstallation(const char *pkgid)
-{
- return PMINFO_R_OK;
-}
-
#define SCHEMA_FILE "/usr/etc/package-manager/preload/manifest.xsd"
#if 1
API int pkgmgr_parser_check_manifest_validation(const char *manifest)
int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, char *const tagv[]);
/**
+ * @fn int pkgmgr_parser_parse_manifest_for_preload()
+ * @brief This API update preload information to DB.
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @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 parser_parse_manifest_for_preload()
+{
+ int ret = 0;
+ ret = pkgmgr_parser_parse_manifest_for_preload();
+ if (ret)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_parse_manifest_for_preload();
+
+/**
* @fn int pkgmgr_parser_check_manifest_validation(const char *manifest)
* @brief This API validates the manifest file against the manifest schema.
*
*/
int pkgmgr_parser_run_parser_for_uninstallation(xmlDocPtr docPtr, const char *tag, const char *pkgid);
-/**
- * @fn int pkgmgr_parser_run_post_for_installation(const char *pkgid, char *const tagv[])
- * @brief This API is called by backend installer for post action. It is used during package installation
- *
- * @par This API is for package-manager installer backends.
- * @par Sync (or) Async : Synchronous API
- *
- * @param[in] pkgid the package id
- * @param[in] tagv array of 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_post_for_installation(const char *pkgid)
-{
- int ret = 0;
- ret = pkgmgr_parser_run_post_for_installation(pkgid, NULL);
- if (ret)
- return -1;
- return 0;
-}
- * @endcode
- */
-int pkgmgr_parser_run_post_for_installation(const char *pkgid, char *const tagv[]);
-
-/**
- * @fn int pkgmgr_parser_run_post_for_upgrade(const char *pkgid, char *const tagv[])
- * @brief This API is called by backend installer for post action. It is used during package upgrade
-
- * @par This API is for package-manager installer backends.
- * @par Sync (or) Async : Synchronous API
- *
- * @param[in] pkgid the package id
- * @param[in] tagv array of 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_post_for_upgrade(const char *pkgid)
-{
- int ret = 0;
- ret = pkgmgr_parser_run_post_for_upgrade(pkgid, NULL);
- if (ret)
- return -1;
- return 0;
-}
- * @endcode
- */
-int pkgmgr_parser_run_post_for_upgrade(const char *pkgid, char *const tagv[]);
-
-/**
- * @fn int pkgmgr_parser_run_post_for_uninstallation(const char *pkgid)
- * @brief This API is called by backend installer for run post action. It is used during package uninstallation
- *
- * @par This API is for package-manager installer backends.
- * @par Sync (or) Async : Synchronous API
- *
- * @param[in] pkgid the package id
- * @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_post_for_uninstallation(const char *pkgid)
-{
- int ret = 0;
- ret = pkgmgr_parser_run_post_for_uninstallation(pkgid);
- if (ret)
- return -1;
- return 0;
-}
- * @endcode
- */
-int pkgmgr_parser_run_post_for_uninstallation(const char *pkgid);
/**
return 0;
}
+static int __update_preload_condition_in_db()
+{
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+
+ snprintf(query, MAX_QUERY_LEN, "update package_info set package_preload='true'");
+
+ ret = __exec_query(query);
+ if (ret == -1)
+ DBG("Package preload_condition update failed\n");
+
+ return ret;
+}
int pkgmgr_parser_initialize_db()
{
return 0;
}
+int pkgmgr_parser_close_db()
+{
+ sqlite3_close(pkgmgr_parser_db);
+ sqlite3_close(pkgmgr_cert_db);
+}
+
API int pkgmgr_parser_insert_manifest_info_in_db(manifest_x *mfx)
{
if (mfx == NULL) {
}
DBG("Transaction Commit and End\n");
err:
- sqlite3_close(pkgmgr_parser_db);
- sqlite3_close(pkgmgr_cert_db);
+ pkgmgr_parser_close_db();
return ret;
}
}
DBG("Transaction Commit and End\n");
err:
- sqlite3_close(pkgmgr_parser_db);
- sqlite3_close(pkgmgr_cert_db);
+ pkgmgr_parser_close_db();
return ret;
}
goto err;
}
DBG("Transaction Commit and End\n");
- sqlite3_close(pkgmgr_parser_db);
err:
- sqlite3_close(pkgmgr_parser_db);
- sqlite3_close(pkgmgr_cert_db);
+ pkgmgr_parser_close_db();
return ret;
}
+
+API int pkgmgr_parser_update_preload_info_in_db()
+{
+ int ret = 0;
+ ret = pkgmgr_parser_check_and_create_db();
+ if (ret == -1) {
+ DBG("Failed to open DB\n");
+ return ret;
+ }
+ /*Begin transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ DBG("Failed to begin transaction\n");
+ ret = -1;
+ goto err;
+ }
+ DBG("Transaction Begin\n");
+ ret = __update_preload_condition_in_db();
+ if (ret == -1) {
+ DBG("__update_preload_condition_in_db failed. Rollback now\n");
+ sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ goto err;
+ }
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ DBG("Failed to commit transaction, Rollback now\n");
+ sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ ret = -1;
+ goto err;
+ }
+ DBG("Transaction Commit and End\n");
+err:
+ pkgmgr_parser_close_db();
+ return ret;
+}
+
*/
int pkgmgr_parser_delete_manifest_info_from_db(manifest_x *mfx);
+int pkgmgr_parser_update_preload_info_in_db();
int pkgmgr_parser_check_and_create_db();
int pkgmgr_parser_initialize_db();
/** @} */
# parserlib:directory_path
parserlib:/usr/etc/package-manager/parserlib/
+mdparser:/usr/etc/package-manager/parserlib/metadata/
info->manifest_info->installed_time = strdup(coltxt[i]);
else
info->manifest_info->installed_time = NULL;
+ } else if (strcmp(colname[i], "installed_storage") == 0 ){
+ if (coltxt[i])
+ info->manifest_info->installed_storage = strdup(coltxt[i]);
+ else
+ info->manifest_info->installed_storage = NULL;
} else if (strcmp(colname[i], "mainapp_id") == 0 ){
if (coltxt[i])
info->manifest_info->mainapp_id = strdup(coltxt[i]);
retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
retvm_if(storage == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
- char *pkgid = NULL;
- pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
- if (pkgid == NULL){
- _LOGE("invalid func parameters\n");
- return PMINFO_R_ERROR;
- }
-
- FILE *fp = NULL;
- char app_mmc_path[FILENAME_MAX] = { 0, };
- char app_dir_path[FILENAME_MAX] = { 0, };
- char app_mmc_internal_path[FILENAME_MAX] = { 0, };
- snprintf(app_dir_path, FILENAME_MAX,
- "%s%s", PKG_INSTALLATION_PATH, pkgid);
- snprintf(app_mmc_path, FILENAME_MAX,
- "%s%s", PKG_SD_PATH, pkgid);
- snprintf(app_mmc_internal_path, FILENAME_MAX,
- "%s%s/.mmc", PKG_INSTALLATION_PATH, pkgid);
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
- /*check whether application is in external memory or not */
- fp = fopen(app_mmc_path, "r");
- if (fp != NULL) {
- fclose(fp);
- fp = NULL;
- *storage = PMINFO_EXTERNAL_STORAGE;
- return PMINFO_R_OK;
- }
+ if (strcmp(info->manifest_info->installed_storage,"installed_internal") == 0)
+ *storage = PMINFO_INTERNAL_STORAGE;
+ else if (strcmp(info->manifest_info->installed_storage,"installed_external") == 0)
+ *storage = PMINFO_EXTERNAL_STORAGE;
+ else
+ return PMINFO_R_ERROR;
- /*check whether application is in internal or not */
- fp = fopen(app_dir_path, "r");
- if (fp == NULL) {
- *storage = -1;
- return PMINFO_R_ERROR;
- } else {
- fclose(fp);
- /*check whether the application is installed in SD card
- but SD card is not present*/
- fp = fopen(app_mmc_internal_path, "r");
- if (fp == NULL) {
- *storage = PMINFO_INTERNAL_STORAGE;
- return PMINFO_R_OK;
- } else {
- fclose(fp);
- *storage = PMINFO_EXTERNAL_STORAGE;
- return PMINFO_R_OK;
- }
- }
+ return PMINFO_R_OK;
}
API int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time)
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
retvm_if(accessible == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+#if 0 //smack issue occured, check later
char *pkgid = NULL;
pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
if (pkgid == NULL){
}
_LOGD("pkgmgr_get_pkg_external_validation() end\n");
+#endif
+
+ *accessible = 1;
return PMINFO_R_OK;
}
return PMINFO_R_OK;
}
+API int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(system == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ char *preload = NULL;
+ char *removable = NULL;
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ preload = (char *)info->manifest_info->preload;
+ removable = (char *)info->manifest_info->removable;
+
+ if ((strcasecmp(preload, "true") == 0) && (strcasecmp(removable, "false") == 0))
+ *system = 1;
+ else
+ *system = 0;
+
+ return PMINFO_R_OK;
+}
+
API int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly)
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
else
return PMINFO_R_EINVAL;
for (; ptr; ptr = ptr->next) {
- ret = metadata_func(ptr->key, ptr->value, user_data);
- if (ret < 0)
- break;
+ if (ptr->key) {
+ ret = metadata_func(ptr->key, ptr->value, user_data);
+ if (ret < 0)
+ break;
+ }
}
return PMINFO_R_OK;
}