SET(VERSION 0.0.17)
SET(VERSION_MAJOR 0)
+IF(_APPFW_FEATURE_EXPANSION_PKG_INSTALL)
+ ADD_DEFINITIONS("-D_APPFW_FEATURE_EXPANSION_PKG_INSTALL")
+ENDIF(_APPFW_FEATURE_EXPANSION_PKG_INSTALL)
+
+IF(_APPFW_FEATURE_DELTA_UPDATE)
+ ADD_DEFINITIONS("-D_APPFW_FEATURE_DELTA_UPDATE")
+ENDIF(_APPFW_FEATURE_DELTA_UPDATE)
+
+IF(_APPFW_FEATURE_MOUNT_INSTALL)
+ ADD_DEFINITIONS("-D_APPFW_FEATURE_MOUNT_INSTALL")
+ENDIF(_APPFW_FEATURE_MOUNT_INSTALL)
+
+
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_PREFIX "\${prefix}")
SET(INCLUDEDIR "\${prefix}/include")
### Required packages
INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED openssl glib-2.0 dlog vconf sqlite3 db-util libxml-2.0 dbus-1 dbus-glib-1 journal)
+pkg_check_modules(pkgs REQUIRED openssl glib-2.0 dlog vconf sqlite3 db-util libxml-2.0 dbus-1 dbus-glib-1 bundle )
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-pkg_check_modules(libpkgs REQUIRED openssl glib-2.0 dlog vconf sqlite3 db-util libxml-2.0 dbus-1 dbus-glib-1 journal)
+pkg_check_modules(libpkgs REQUIRED openssl glib-2.0 dlog vconf sqlite3 db-util libxml-2.0 dbus-1 dbus-glib-1 bundle)
FOREACH(flag ${libpkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
+SET(pc_requires "glib-2.0")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -Wall")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(PC_REQUIRED ${pc_requires})
################## ## build comm libraries
add_subdirectory(parser)
## build pkgmgr-info library
-add_library(pkgmgr-info SHARED src/pkgmgrinfo_client.c src/pkgmgrinfo_db.c src/pkgmgrinfo_certinfo.c
- src/pkgmgrinfo_appinfo.c src/pkgmgrinfo_pkginfo.c
- src/pkgmgrinfo_private.c
- src/pkgmgrinfo_basic.c
- src/pkgmgrinfo_feature.c
- )
-
+add_library(pkgmgr-info SHARED
+ src/pkgmgrinfo_client.c
+ src/pkgmgrinfo_db.c
+ src/pkgmgrinfo_certinfo.c
+ src/pkgmgrinfo_appinfo.c src/pkgmgrinfo_pkginfo.c
+ src/pkgmgrinfo_private.c
+ src/pkgmgrinfo_basic.c
+ src/pkgmgrinfo_resource.c )
SET_TARGET_PROPERTIES(pkgmgr-info PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(pkgmgr-info PROPERTIES VERSION ${VERSION})
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_SOURCE_DIR}/include/pkgmgrinfo_resource.h DESTINATION include)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/pkgmgrinfo_basic.h DESTINATION include)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/pkgmgrinfo_feature.h DESTINATION include)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/pkgmgrinfo_type.h DESTINATION include)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/pkgmgrinfo_zone.h DESTINATION include)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/parser_path.conf DESTINATION ${PREFIX}/etc/package-manager/)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/dump_pkgmgr.sh DESTINATION /opt/etc/dump.d/module.d/)
PKGMGR_DB_DEBUG=$1/pkgmgr
mkdir -p ${PKGMGR_DB_DEBUG}
-/bin/cp /opt/dbspace/.pkgmgr_cert.db* ${PKGMGR_DB_DEBUG}
-/bin/cp /opt/dbspace/.pkgmgr_parser.db* ${PKGMGR_DB_DEBUG}
-/bin/cp -r /opt/usr/data/pkgmgr/ ${PKGMGR_DB_DEBUG}
+/bin/cp /opt/dbspace/.pkgmgr_* ${PKGMGR_DB_DEBUG}
+/bin/cp -r /opt/usr/data/pkgmgr/ ${PKGMGR_DB_DEBUG}
\ No newline at end of file
#include <errno.h>
#include <stdbool.h>
+#include <glib.h>
#include "pkgmgrinfo_type.h"
-#include "pkgmgrinfo_feature.h"
#ifdef __cplusplus
extern "C" {
#define PMINFO_PKGINFO_INSTALL_LOCATION_EXTERNAL "LOCATION_EXTERNAL"
/** String property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_ID "PMINFO_PKGINFO_PROP_PACKAGE_ID"
+#define PMINFO_PKGINFO_PROP_PACKAGE_ID "PMINFO_PKGINFO_PROP_PACKAGE_ID"
/** String property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_TYPE "PMINFO_PKGINFO_PROP_PACKAGE_TYPE"
+#define PMINFO_PKGINFO_PROP_PACKAGE_TYPE "PMINFO_PKGINFO_PROP_PACKAGE_TYPE"
/** String property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_VERSION "PMINFO_PKGINFO_PROP_PACKAGE_VERSION"
+#define PMINFO_PKGINFO_PROP_PACKAGE_VERSION "PMINFO_PKGINFO_PROP_PACKAGE_VERSION"
/** String property for filtering based on package info*/
#define PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION "PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION"
/** String property for filtering based on package info*/
#define PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE "PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE"
/** String property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME"
+#define PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME"
/** String property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL"
+#define PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL"
/** String property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF"
+#define PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF"
/** String property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_STORECLIENT_ID "PMINFO_PKGINFO_PROP_PACKAGE_STORECLIENT_ID"
+#define PMINFO_PKGINFO_PROP_PACKAGE_STORECLIENT_ID "PMINFO_PKGINFO_PROP_PACKAGE_STORECLIENT_ID"
/** Boolean property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE "PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE"
+#define PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE "PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE"
/** Boolean property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD "PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD"
+#define PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD "PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD"
/** Boolean property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_READONLY "PMINFO_PKGINFO_PROP_PACKAGE_READONLY"
+#define PMINFO_PKGINFO_PROP_PACKAGE_READONLY "PMINFO_PKGINFO_PROP_PACKAGE_READONLY"
/** Boolean property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_UPDATE "PMINFO_PKGINFO_PROP_PACKAGE_UPDATE"
+#define PMINFO_PKGINFO_PROP_PACKAGE_UPDATE "PMINFO_PKGINFO_PROP_PACKAGE_UPDATE"
/** Boolean property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING "PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING"
+#define PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING "PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING"
/** Boolean property for filtering based on package info*/
#define PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING "PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING"
/** Boolean property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE "PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE"
+#define PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE "PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE"
/** Boolean property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_DISABLE "PMINFO_PKGINFO_PROP_PACKAGE_DISABLE"
+#define PMINFO_PKGINFO_PROP_PACKAGE_DISABLE "PMINFO_PKGINFO_PROP_PACKAGE_DISABLE"
/** Boolean property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_USE_RESET "PMINFO_PKGINFO_PROP_PACKAGE_USE_RESET"
+#define PMINFO_PKGINFO_PROP_PACKAGE_SYSTEM "PMINFO_PKGINFO_PROP_PACKAGE_SYSTEM"
+
/** Integer property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_SIZE "PMINFO_PKGINFO_PROP_PACKAGE_SIZE"
+#define PMINFO_PKGINFO_PROP_PACKAGE_SIZE "PMINFO_PKGINFO_PROP_PACKAGE_SIZE"
/** Integer property for filtering based on package info*/
-#define PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_MODE "PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_MODE"
+#define PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_MODE "PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_MODE"
/** String property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_ID "PMINFO_APPINFO_PROP_APP_ID"
- /** String property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_COMPONENT "PMINFO_APPINFO_PROP_APP_COMPONENT"
+#define PMINFO_APPINFO_PROP_APP_ID "PMINFO_APPINFO_PROP_APP_ID"
/** String property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_COMPONENT_TYPE "PMINFO_APPINFO_PROP_APP_COMPONENT_TYPE"
+#define PMINFO_APPINFO_PROP_APP_COMPONENT_TYPE "PMINFO_APPINFO_PROP_APP_COMPONENT_TYPE"
/** String property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_EXEC "PMINFO_APPINFO_PROP_APP_EXEC"
+#define PMINFO_APPINFO_PROP_APP_EXEC "PMINFO_APPINFO_PROP_APP_EXEC"
/** String property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_AMBIENT_SUPPORT "PMINFO_APPINFO_PROP_APP_AMBIENT_SUPPORT"
+#define PMINFO_APPINFO_PROP_APP_ICON "PMINFO_APPINFO_PROP_APP_ICON"
/** String property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_ICON "PMINFO_APPINFO_PROP_APP_ICON"
+#define PMINFO_APPINFO_PROP_APP_TYPE "PMINFO_APPINFO_PROP_APP_TYPE"
/** String property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_TYPE "PMINFO_APPINFO_PROP_APP_TYPE"
+#define PMINFO_APPINFO_PROP_APP_OPERATION "PMINFO_APPINFO_PROP_APP_OPERATION"
/** String property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_OPERATION "PMINFO_APPINFO_PROP_APP_OPERATION"
+#define PMINFO_APPINFO_PROP_APP_URI "PMINFO_APPINFO_PROP_APP_URI"
/** String property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_URI "PMINFO_APPINFO_PROP_APP_URI"
+#define PMINFO_APPINFO_PROP_APP_MIME "PMINFO_APPINFO_PROP_APP_MIME"
/** String property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_MIME "PMINFO_APPINFO_PROP_APP_MIME"
+#define PMINFO_APPINFO_PROP_APP_CATEGORY "PMINFO_APPINFO_PROP_APP_CATEGORY"
/** String property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_CATEGORY "PMINFO_APPINFO_PROP_APP_CATEGORY"
- /** String property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_HWACCELERATION "PMINFO_APPINFO_PROP_APP_HWACCELERATION"
+#define PMINFO_APPINFO_PROP_APP_HWACCELERATION "PMINFO_APPINFO_PROP_APP_HWACCELERATION"
/** String property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_SCREENREADER "PMINFO_APPINFO_PROP_APP_SCREENREADER"
+#define PMINFO_APPINFO_PROP_APP_SCREENREADER "PMINFO_APPINFO_PROP_APP_SCREENREADER"
+/** String property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_BG_CATEGORY "PMINFO_APPINFO_PROP_APP_BG_CATEGORY"
/** Boolean property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_NODISPLAY "PMINFO_APPINFO_PROP_APP_NODISPLAY"
+#define PMINFO_APPINFO_PROP_APP_NODISPLAY "PMINFO_APPINFO_PROP_APP_NODISPLAY"
+ /** Boolean property for filtering based on app info*/
+#define PMINFO_APPINFO_PROP_APP_MULTIPLE "PMINFO_APPINFO_PROP_APP_MULTIPLE"
/** Boolean property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_MULTIPLE "PMINFO_APPINFO_PROP_APP_MULTIPLE"
+#define PMINFO_APPINFO_PROP_APP_ONBOOT "PMINFO_APPINFO_PROP_APP_ONBOOT"
/** Boolean property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_ONBOOT "PMINFO_APPINFO_PROP_APP_ONBOOT"
+#define PMINFO_APPINFO_PROP_APP_AUTORESTART "PMINFO_APPINFO_PROP_APP_AUTORESTART"
/** Boolean property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_AUTORESTART "PMINFO_APPINFO_PROP_APP_AUTORESTART"
+#define PMINFO_APPINFO_PROP_APP_TASKMANAGE "PMINFO_APPINFO_PROP_APP_TASKMANAGE"
/** Boolean property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_TASKMANAGE "PMINFO_APPINFO_PROP_APP_TASKMANAGE"
+#define PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION "PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION"
/** Boolean property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION "PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION"
+#define PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE "PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE"
/** Boolean property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE "PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE"
+#define PMINFO_APPINFO_PROP_APP_DISABLE "PMINFO_APPINFO_PROP_APP_DISABLE"
/** Boolean property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_DISABLE "PMINFO_APPINFO_PROP_APP_DISABLE"
+#define PMINFO_APPINFO_PROP_APP_REMOVABLE "PMINFO_APPINFO_PROP_APP_REMOVABLE"
/** Boolean property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_REMOVABLE "PMINFO_APPINFO_PROP_APP_REMOVABLE"
+#define PMINFO_APPINFO_PROP_APP_BG_USER_DISABLE "PMINFO_APPINFO_PROP_APP_BG_USER_DISABLE"
/** Integer property for filtering based on app info*/
-#define PMINFO_APPINFO_PROP_APP_SUPPORT_MODE "PMINFO_APPINFO_PROP_APP_SUPPORT_MODE"
+#define PMINFO_APPINFO_PROP_APP_SUPPORT_MODE "PMINFO_APPINFO_PROP_APP_SUPPORT_MODE"
/** will be updated*/
/** string property for filtering based on pkg info*/
-#define PMINFO_PKGINFO_PROP_RANGE_BASIC "PMINFO_PKGINFO_PROP_RANGE_BASIC"
-
-/** Integer property for mode*/
-#define PMINFO_MODE_PROP_ULTRA_POWER_SAVING 0x00000001
-#define PMINFO_MODE_PROP_COOL_DOWN 0x00000002
-#define PMINFO_MODE_PROP_SCREEN_READER 0x00000004
-
+#define PMINFO_PKGINFO_PROP_RANGE_BASIC "PMINFO_PKGINFO_PROP_RANGE_BASIC"
/**
int pkgmgrinfo_pkginfo_get_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data);
/**
+ * @fn int pkgmgrinfo_pkginfo_get_disabled_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data)
+ * @brief This API gets list of disabled packages
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] pkg_list_cb iteration function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @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
+int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
+{
+ char *pkgid1 = NULL;
+ char *pkgid2 = NULL;
+ pkgid1 = (char *)user_data;
+ pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid2);
+ if (strcmp(pkgid1, pkgid2) == 0) {
+ return -1;
+ } else {
+ return 0;
+ }
+}
+
+static int list_disabled_pkgs()
+{
+ int ret = 0;
+ char *name = "helloworld";
+ ret = pkgmgrinfo_pkginfo_get_disabled_list(pkg_list_cb, (void *)name);
+ if (ret != PMINFO_R_OK) {
+ return -1;
+ }
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_disabled_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data);
+
+/**
* @fn int pkgmgrinfo_pkginfo_get_mounted_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data);
* @brief This API gets list of package which are installed in sd card when sd card is mounted
*
{
int ret = 0;
char *type = NULL;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_unmounted_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *type = NULL;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
int pkgmgrinfo_pkginfo_get_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle);
/**
+ * @fn int pkgmgrinfo_pkginfo_get_disabled_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle)
+ * @brief This API creates the disabled package information handle from db
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to package ID
+ * @param[out] handle pointer to the package info handle.
+ * @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 pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @see pkgmgrinfo_pkginfo_get_pkgid()
+ * @see pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_type(const char *pkgid)
+{
+ int ret = 0;
+ char *type = NULL;
+ pkgmgrinfo_pkginfo_h handle = NULL;
+ ret = pkgmgrinfo_pkginfo_get_disabled_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkgtype: %s\n", type);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_disabled_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle);
+
+/**
* @fn int pkgmgrinfo_pkginfo_get_pkgname(pkgmgrinfo_pkginfo_h handle, char **pkg_name)
* @brief This API gets the package name from the package ID
*
{
int ret = 0;
char *pkgname = NULL;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *pkg_id = NULL;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *type = NULL;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *version = NULL;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
int pkgmgrinfo_pkginfo_get_version(pkgmgrinfo_pkginfo_h handle, char **version);
/**
+ * @fn int pkgmgrinfo_pkginfo_get_api_version(pkgmgrinfo_pkginfo_h handle, char **api_version)
+ * @brief This API gets the package api_version from the package ID
+ *
+ * @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] api_version pointer to hold package api_version
+ * @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_removable()
+ * @code
+static int get_pkg_api_version(const char *pkgid)
+{
+ int ret = 0;
+ char *api_version = NULL;
+ pkgmgrinfo_pkginfo_h handle = NULL;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_api_version(handle, &api_version);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("pkg api_version: %s\n", api_version);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_api_version(pkgmgrinfo_pkginfo_h handle, char **api_version);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_check_api_version(pkgmgrinfo_pkginfo_h handle, const char *api_version, int *result)
+ * @brief This API checks the package api_version from required version information
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to package info handle
+ * @param[in] api_version the required api version
+ * @param[out] result positive integer if the api version of the pkg is higher than the @a api_version, negative integer if the api version of the pkg is lower than the @a api_version, 0 if versions are the same
+ * @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
+ * @see pkgmgrinfo_pkginfo_get_api_version()
+ * @code
+static int check_pkg_api_version(const char *pkgid, const char *api_version)
+{
+ int ret = 0;
+ int result = 0;
+ pkgmgrinfo_pkginfo_h handle = NULL;
+ const char *required_api_version = "2.4"
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_check_api_version(handle, required_api_version, &result);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ if (result > 0)
+ printf("pkgid's api_version is higher\n");
+ if (result == 0)
+ printf("pkgid's api_version is the same\n");
+ if (result < 0)
+ printf("pkgid's api_version is lower\n");
+
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_check_api_version(pkgmgrinfo_pkginfo_h handle, const char *api_version, int *result);
+
+
+/**
* @fn int pkgmgrinfo_pkginfo_get_install_location(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_install_location *location)
* @brief This API gets the package install location from the package ID
*
{
int ret = 0;
pkgmgrinfo_install_location location;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *icon = NULL;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *label = NULL;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *description = NULL;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *author_name = NULL;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *author_email = NULL;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *author_href = NULL;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
pkgmgrinfo_installed_storage storage;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
int installed_time = 0;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
*/
int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time);
+
/**
* @fn int pkgmgrinfo_pkginfo_get_storeclientid(pkgmgrinfo_pkginfo_h handle, char **storeclientid)
* @brief This API gets the store client id of package from the package ID
{
int ret = 0;
char *storeclientid = 0;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *mainappid = 0;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *url = 0;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *path = 0;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *path = 0;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
static int get_support_mode(const char *pkgid)
{
int ret = 0;
- int *support_mode = 0;
+ int support_mode = 0;
pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
*/
int pkgmgrinfo_pkginfo_get_support_mode(pkgmgrinfo_pkginfo_h handle, int *support_mode);
-
/**
- * @fn int pkgmgrinfo_pkginfo_get_hash(pkgmgrinfo_pkginfo_h handle, char **hash)
- * @brief This API gets the package_hash of package
+ * @fn int pkgmgrinfo_pkginfo_get_groupid(pkgmgrinfo_pkginfo_h handle, char **groupid)
+ * @brief This API gets the groupid of package
*
* @par Sync (or) Async : Synchronous API
*
* @param[in] handle pointer to package info handle
- * @param[out] hash pointer to hold package_hash of package
+ * @param[out] groupid pointer to hold groupid of package
* @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
* @code
-static int get_package_hash(const char *pkgid)
+static int get_groupid(const char *pkgid)
{
int ret = 0;
- int *hash = NULL;;
+ char *groupid = 0;
pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
- ret = pkgmgrinfo_pkginfo_get_hash(handle, &hash);
+ ret = pkgmgrinfo_pkginfo_get_groupid(handle, &groupid);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
return -1;
}
- printf("package_hash : %s\n", hash);
+ printf("groupid : %s\n", groupid);
pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
return 0;
}
* @endcode
-*/
-
-int pkgmgrinfo_pkginfo_get_hash(pkgmgrinfo_pkginfo_h handle, char **hash);
+ */
+int pkgmgrinfo_pkginfo_get_groupid(pkgmgrinfo_pkginfo_h handle, char **groupid);
/**
- * @fn int pkgmgrinfo_pkginfo_get_support_reset(pkgmgrinfo_pkginfo_h handle, char **support_reset)
- * @brief This API gets the support reset of package
+ * @fn int pkgmgrinfo_pkginfo_get_backend_installer(pkgmgrinfo_pkginfo_h handle, char **backend_installer)
+ * @brief This API gets the backend_installer of package
*
* @par Sync (or) Async : Synchronous API
*
* @param[in] handle pointer to package info handle
- * @param[out] support_reset pointer to hold support reset of package
+ * @param[out] backend_installer pointer to hold backend_installer of package
* @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
* @code
-static int get_support_reset(const char *pkgid)
+static int get_backend_installer(const char *pkgid)
{
int ret = 0;
- char *support_reset = 0;
+ char *backend_installer = 0;
pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
- ret = pkgmgrinfo_pkginfo_get_support_reset(handle, &support_reset);
+ ret = pkgmgrinfo_pkginfo_get_backend_installer(handle, &backend_installer);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
return -1;
}
- printf("support_reset : %s\n", support_reset);
+ printf("backend_installer : %s\n", backend_installer);
pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
return 0;
}
* @endcode
*/
-int pkgmgrinfo_pkginfo_get_support_reset(pkgmgrinfo_pkginfo_h handle, char **support_reset);
+int pkgmgrinfo_pkginfo_get_backend_installer(pkgmgrinfo_pkginfo_h handle, char **backend_installer);
/**
- * @fn int pkgmgrinfo_pkginfo_get_groupid(pkgmgrinfo_pkginfo_h handle, char **groupid)
- * @brief This API gets the groupid of package
+ * @fn int pkgmgrinfo_pkginfo_get_custom_smack_label(pkgmgrinfo_pkginfo_h handle, char **smack_label)
+ * @brief This API gets the package custom smack_label from the package ID
*
+ * @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] groupid pointer to hold groupid of package
+ * @param[in] handle pointer to package info handle
+ * @param[out] smack_label pointer to hold package custom smack_label
* @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_removable()
* @code
-static int get_groupid(const char *pkgid)
+static int get_pkg_custom_smack_label(const char *pkgid)
{
int ret = 0;
- char *groupid = 0;
+ char *smack_label = NULL;
pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
-
- ret = pkgmgrinfo_pkginfo_get_groupid(handle, &groupid);
+ ret = pkgmgrinfo_pkginfo_get_custom_smack_label(handle, &smack_label);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
return -1;
}
- printf("groupid : %s\n", groupid);
+ printf("pkg custom smack_label: %s\n", smack_label);
pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
-
return 0;
}
* @endcode
*/
-int pkgmgrinfo_pkginfo_get_groupid(pkgmgrinfo_pkginfo_h handle, char **groupid);
+int pkgmgrinfo_pkginfo_get_custom_smack_label(pkgmgrinfo_pkginfo_h handle, char **smack_label);
+
+#ifdef _APPFW_FEATURE_EXPANSION_PKG_INSTALL
+ /**
+ * @fn int pkgmgrinfo_pkginfo_get_tep_name(pkgmgrinfo_pkginfo_h handle, char **tep_name)
+ * @brief This API gets tep(tizen expansion package) file name associated with the package
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the pkginfo handle.
+ * @param[out] tep_name pointer to hold tep name
+ * @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()
+ * @code
+ static int get_tep_name(const char *pkgid)
+ {
+ int ret = 0;
+ char *tep_name = NULL;
+ pkgmgrinfo_pkginfo_h handle = NULL;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_tep_name(handle, &tep_name);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("TEP name is: %s\n", tep_name);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+ }
+ * @endcode
+ */
+ int pkgmgrinfo_pkginfo_get_tep_name(pkgmgrinfo_pkginfo_h handle, char **tep_name);
+#endif
+
/**
* @fn int pkgmgrinfo_pkginfo_compare_pkg_cert_info(const char *lhs_package_id, const char *rhs_package_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
{
int ret = 0;
bool removable;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
bool movable;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
bool preload;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
bool readonly;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
bool update;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
* @par Sync (or) Async : Synchronous API
*
* @param[in] handle pointer to package info handle
- * @param[out] support_disable pointer to hold package support_disable value
+ * @param[out] support_disable pointer to hold package support_disable value
* @return 0 if success, error code(<0) if fail
* @retval PMINFO_R_OK success
* @retval PMINFO_R_EINVAL invalid argument
{
int ret = 0;
bool support_disable;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
bool accessible;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *type = NULL;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
int count = 0;
- pkgmgrinfo_pkginfo_filter_h handle;
+ pkgmgrinfo_pkginfo_filter_h handle = NULL;
ret = pkgmgrinfo_pkginfo_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
int count = 0;
- pkgmgrinfo_pkginfo_filter_h handle;
+ pkgmgrinfo_pkginfo_filter_h handle = NULL;
ret = pkgmgrinfo_pkginfo_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
int count = 0;
- pkgmgrinfo_pkginfo_filter_h handle;
+ pkgmgrinfo_pkginfo_filter_h handle = NULL;
ret = pkgmgrinfo_pkginfo_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
int count = 0;
- pkgmgrinfo_pkginfo_filter_h handle;
+ pkgmgrinfo_pkginfo_filter_h handle = NULL;
ret = pkgmgrinfo_pkginfo_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
int count = 0;
- pkgmgrinfo_pkginfo_filter_h handle;
+ pkgmgrinfo_pkginfo_filter_h handle = NULL;
ret = pkgmgrinfo_pkginfo_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
static int get_rpm_pkg_list()
{
int ret = 0;
- pkgmgrinfo_pkginfo_filter_h handle;
+ pkgmgrinfo_pkginfo_filter_h handle = NULL;
ret = pkgmgrinfo_pkginfo_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
int count = 0;
- pkgmgrinfo_pkginfo_filter_h handle;
+ pkgmgrinfo_pkginfo_filter_h handle = NULL;
ret = pkgmgrinfo_pkginfo_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
static int list_privilege(const char *package, char *privilege)
{
int ret = 0;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
if (ret != PMINFO_R_OK)
return -1;
static int list_apps(const char *pkgid)
{
int ret = 0;
- pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_pkginfo_h handle = NULL;
ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
if (ret != PMINFO_R_OK)
return -1;
*/
int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
pkgmgrinfo_app_list_cb app_func, void *user_data);
+
/**
- * @fn int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
- * @brief This API gets list of installed applications from all packages with minimum informaion.
+ * @fn int pkgmgrinfo_appinfo_get_disabled_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
+ pkgmgrinfo_app_list_cb app_func, void *user_data)
+ * @brief This API gets list of disabled applications for a disabled package
*
* @par This API is for package-manager client application
* @par Sync (or) Async : Synchronous API
+ * @param[in] handle package info handle
+ * @param[in] component application component
* @param[in] app_func iteration function for list
* @param[in] user_data user data to be passed to callback function
* @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
+ * @pre pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post pkgmgrinfo_pkginfo_destroy_pkginfo()
* @code
-int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
+int app_func(pkgmgrinfo_appinfo_h handle, void *user_data)
{
- char *pkgid1 = NULL;
- char *pkgid2 = NULL;
- pkgid1 = (char *)user_data;
- pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid2);
- if (strcmp(pkgid1, pkgid2) == 0) {
- return -1;
- } else {
- return 0;
- }
+ char *appid = NULL;
+ pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ printf("appid : %s\n", appid);
+ return 0;
}
-static int list_apps()
+static int list_disabled_apps(const char *pkgid)
+{
+ int ret = 0;
+ pkgmgrinfo_pkginfo_h handle = NULL;
+ ret = pkgmgrinfo_pkginfo_get_disabled_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, app_func, NULL);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_disabled_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
+ pkgmgrinfo_app_list_cb app_func, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
+ * @brief This API gets list of installed applications from all packages with minimum informaion.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in] app_func iteration function for list
+ * @param[in] user_data user data to be passed to callback function
+ * @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
+int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ char *pkgid1 = NULL;
+ char *pkgid2 = NULL;
+ pkgid1 = (char *)user_data;
+ pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid2);
+ if (strcmp(pkgid1, pkgid2) == 0) {
+ return -1;
+ } else {
+ return 0;
+ }
+}
+
+static int list_apps()
{
int ret = 0;
char *name = "helloworld";
{
int ret = 0;
char *type = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_unmounted_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *type = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle);
/**
+ * @fn int pkgmgrinfo_appinfo_get_disabled_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
+ * @brief This API creates the disabled application information handle from db
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] appid pointer to appid
+ * @param[out] handle pointer to the application info handle.
+ * @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 pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_pkgid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_type(const char *appid)
+{
+ int ret = 0;
+ char *type = NULL;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_disabled_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_apptype(handle, &type);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("apptype: %s\n", type);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_disabled_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle);
+
+/**
* @fn int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h handle, char **appid)
* @brief This API gets the application ID
*
{
int ret = 0;
char *app_id = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *pkgname = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *pkgid = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *pkgtype = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *exec = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
int pkgmgrinfo_appinfo_get_exec(pkgmgrinfo_appinfo_h handle, char **exec);
/**
- * @fn int pkgmgrinfo_appinfo_get_ambient_support(pkgmgrinfo_appinfo_h handle, bool *ambient_support)
- * @brief This API gets the ambient_support of the application
- *
- * @par This API is for package-manager client application
- * @par Sync (or) Async : Synchronous API
- *
- * @param[in] handle pointer to the application info handle.
- * @param[out] ambient_support pointer to hold app ambient_support
- * @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_appinfo_get_appinfo()
- * @post pkgmgrinfo_appinfo_destroy_appinfo()
- * @see pkgmgrinfo_appinfo_get_appid()
- * @see pkgmgrinfo_appinfo_is_multiple()
- * @code
-static int get_ambient_support(const char *appid)
-{
- int ret = 0;
- bool ambient_support;
- pkgmgrinfo_appinfo_h handle;
- ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
- if (ret != PMINFO_R_OK)
- return -1;
- ret = pkgmgrinfo_appinfo_get_ambient_support(handle, &ambient_support);
- if (ret != PMINFO_R_OK) {
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
- return -1;
- }
- printf("ambient_support? : %d\n", ambient_support);
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
- return 0;
-}
- * @endcode
- */
-int pkgmgrinfo_appinfo_get_ambient_support(pkgmgrinfo_appinfo_h handle, bool *ambient_support);
-
-
-/**
* @fn int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h handle, char **icon)
* @brief This API gets the icon name of the application
*
{
int ret = 0;
char *icon = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *label = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label);
/**
- * @fn int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component)
- * @brief This API gets the component of the application
- *
- * @par This API is for package-manager client application
- * @par Sync (or) Async : Synchronous API
- *
- * @param[in] handle pointer to the application info handle.
- * @param[out] component pointer to hold app component
- * @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_appinfo_get_appinfo()
- * @post pkgmgrinfo_appinfo_destroy_appinfo()
- * @see pkgmgrinfo_appinfo_get_appid()
- * @see pkgmgrinfo_appinfo_is_multiple()
- * @code
-static int get_app_component(const char *appid)
-{
- int ret = 0;
- pkgmgrinfo_app_component component;
- pkgmgrinfo_appinfo_h handle;
- ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
- if (ret != PMINFO_R_OK)
- return -1;
- ret = pkgmgrinfo_appinfo_get_component(handle, &component);
- if (ret != PMINFO_R_OK) {
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
- return -1;
- }
- printf("component : %s\n", component);
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
- return 0;
-}
- * @endcode
- */
-int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component);
-
-/**
* @fn int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h handle, char **app_type)
* @brief This API gets the apptype of the application
*
{
int ret = 0;
char *apptype = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h handle, char **app_type);
/**
- * @fn int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h handle,
- int *operation_count, char ***operation)
- * @brief This API gets the list of operation of the application
- *
- * @par This API is for package-manager client application
- * @par Sync (or) Async : Synchronous API
- *
- * @param[in] handle pointer to the appcontrol handle.
- * @param[out] operation_count pointer to hold number of operations
- * @param[out] operation pointer to hold list of operations
- * @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_appinfo_get_appinfo()
- * @post pkgmgrinfo_appinfo_destroy_appinfo()
- * @see pkgmgrinfo_appinfo_get_uri()
- * @see pkgmgrinfo_appinfo_get_mime()
- * @code
-int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
-{
- int oc = 0;
- int i = 0;
- char **operation;
- pkgmgrinfo_appinfo_get_operation(handle, &oc, &operation);
- for (i = 0; i < oc; i++) {
- if (strcmp(operation[i], (char *)user_data) == 0)
- return -1;
- else
- return 0;
- }
-}
-
-static int check_operation(const char *appid, char *operation)
-{
- int ret = 0;
- pkgmgrinfo_appinfo_h handle;
- ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
- if (ret != PMINFO_R_OK)
- return -1;
- ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)operation);
- if (ret != PMINFO_R_OK) {
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
- return -1;
- }
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
- return 0;
-}
- * @endcode
- */
-int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h handle,
- int *operation_count, char ***operation);
-
-/**
- * @fn int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h handle,
- int *uri_count, char ***uri)
- * @brief This API gets the list of uri of the application
- *
- * @par This API is for package-manager client application
- * @par Sync (or) Async : Synchronous API
- *
- * @param[in] handle pointer to the appcontrol handle.
- * @param[out] uri_count pointer to hold number of uris
- * @param[out] uri pointer to hold list of uris
- * @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_appinfo_get_appinfo()
- * @post pkgmgrinfo_appinfo_destroy_appinfo()
- * @see pkgmgrinfo_appinfo_get_operation()
- * @see pkgmgrinfo_appinfo_get_mime()
- * @code
-int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
-{
- int uc = 0;
- int i = 0;
- char **uri;
- pkgmgrinfo_appinfo_get_uri(handle, &uc, &uri);
- for (i = 0; i < uc; i++) {
- if (strcmp(uri[i], (char *)user_data) == 0)
- return -1;
- else
- return 0;
- }
-}
-
-static int check_uri(const char *appid, char *uri)
-{
- int ret = 0;
- pkgmgrinfo_appinfo_h handle;
- ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
- if (ret != PMINFO_R_OK)
- return -1;
- ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)uri);
- if (ret != PMINFO_R_OK) {
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
- return -1;
- }
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
- return 0;
-}
- * @endcode
- */
-int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h handle,
- int *uri_count, char ***uri);
-
-/**
- * @fn int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h handle,
- int *mime_count, char ***mime)
- * @brief This API gets the list of mime of the application
- *
- * @par This API is for package-manager client application
- * @par Sync (or) Async : Synchronous API
- *
- * @param[in] handle pointer to the appcontrol handle.
- * @param[out] mime_count pointer to hold number of mimes
- * @param[out] mime pointer to hold list of mimes
- * @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_appinfo_get_appinfo()
- * @post pkgmgrinfo_appinfo_destroy_appinfo()
- * @see pkgmgrinfo_appinfo_get_uri()
- * @see pkgmgrinfo_appinfo_get_operation()
- * @code
-int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
-{
- int mc = 0;
- int i = 0;
- char **mime;
- pkgmgrinfo_appinfo_get_operation(handle, &mc, &mime);
- for (i = 0; i < mc; i++) {
- if (strcmp(mime[i], (char *)user_data) == 0)
- return -1;
- else
- return 0;
- }
-}
-
-static int check_mime(const char *appid, char *mime)
-{
- int ret = 0;
- pkgmgrinfo_appinfo_h handle;
- ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
- if (ret != PMINFO_R_OK)
- return -1;
- ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)mime);
- if (ret != PMINFO_R_OK) {
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
- return -1;
- }
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
- return 0;
-}
- * @endcode
- */
-int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h handle,
- int *mime_count, char ***mime);
-
-/**
- * @fn int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h handle,
- int *subapp_count, char ***subapp)
- * @brief This API gets the list of subapp of the application
- *
- * @par This API is for package-manager client application
- * @par Sync (or) Async : Synchronous API
- *
- * @param[in] handle pointer to the appcontrol handle.
- * @param[out] subapp_count pointer to hold number of subapp
- * @param[out] subapp pointer to hold list of subapp
- * @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_appinfo_get_appinfo()
- * @post pkgmgrinfo_appinfo_destroy_appinfo()
- * @see pkgmgrinfo_appinfo_get_uri()
- * @see pkgmgrinfo_appinfo_get_operation()
- * @code
-int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
-{
- int sc = 0;
- int i = 0;
- char **subapp = NULL;
- pkgmgrinfo_appinfo_get_subapp(handle, &sc, &subapp);
- for (i = 0; i < sc; i++) {
- if (strcmp(subapp[i], (char *)user_data) == 0)
- return -1;
- else
- return 0;
- }
-}
-
-static int check_subapp(const char *appid, char *subapp)
-{
- int ret = 0;
- pkgmgrinfo_appinfo_h handle = NULL;
- ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
- if (ret != PMINFO_R_OK)
- return -1;
- ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)subapp);
- if (ret != PMINFO_R_OK) {
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
- return -1;
- }
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
- return 0;
-}
- * @endcode
- */
-int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h handle,
- int *subapp_count, char ***subapp);
-
-/**
* @fn int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, char **icon)
* @brief This API gets the notification icon of the application
*
{
int ret = 0;
char *notification_icon = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *setting_icon = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *small_icon = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
pkgmgrinfo_app_recentimage type;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
pkgmgrinfo_permission_type permission = 0;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
{
int ret = 0;
char *component_type = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
pkgmgrinfo_app_hwacceleration hwacceleration;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
int ret = 0;
char *portraitimg = NULL;
char *landscapeimg = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
char *effectimg_type = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
static int get_metadata_value(const char *appid, const char *metadata_key)
{
int ret = 0;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
char *metadata_value = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
{
int ret = 0;
char *multi_instance_mainid = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
int support_mode = 0;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
}
* @endcode
*/
-int pkgmgrinfo_appinfo_get_support_mode(pkgmgrinfo_appinfo_h handle, int *support_mode);
-
+int pkgmgrinfo_appinfo_get_support_mode(pkgmgrinfo_appinfo_h handle, int *support_mode);
+
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_support_feature(pkgmgrinfo_appinfo_h handle, int *support_feature)
+ * @brief This API gets the support_funtion of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] support_feature pointer to hold app support_feature
+ * @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_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @code
+static int get_app_support_feature(const char *appid)
+{
+ int ret = 0;
+ int support_feature = 0;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_support_feature(handle, &support_feature);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("support_feature: %d\n", support_feature);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_support_feature(pkgmgrinfo_appinfo_h handle, int *support_feature);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_support_category(pkgmgrinfo_appinfo_h handle, int *support_category)
+ * @brief This API gets the support_category of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] support_category pointer to hold app support_category
+ * @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_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @code
+static int get_app_support_category(const char *appid)
+{
+ int ret = 0;
+ int support_category= 0;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_support_category(handle, &support_category);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("support_feature: %d\n", support_category);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_support_category(pkgmgrinfo_appinfo_h handle, int *support_category);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_uginfo(const char *ug_name, pkgmgrinfo_appinfo_h *handle)
+ * @brief This API creates the application information handle from ug_name
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] ug_name pointer to ug_name
+ * @param[out] handle pointer to the application info handle.
+ * @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 pkgmgrinfo_appinfo_destroy_appinfo()
+ * @code
+static int get_app_uginfo(const char *ug_name)
+{
+ int ret = 0;
+ char *appid = NULL;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_uginfo(ug_name, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("appid: %s\n", appid);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_uginfo(const char *ug_name, pkgmgrinfo_appinfo_h *handle);
+
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_appid_from_aliasid(const char *alias_id, char** app_id)
+ * @brief This API get alias_id for an appid from pkgmgr DB.
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] alias_id pointer to alias id
+ * @param[out] appid pointer to pointer of application 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 get_appid(const char *aliasid)
+{
+ int ret = 0;
+ char *app_id = NULL;
+ ret = pkgmgrinfo_appinfo_get_appid_from_aliasid(aliasid, &app_id);
+ if (ret != PMINFO_R_OK){
+ printf("Failed to get the appid for [%s]\n",aliasid);
+ return -1;
+ }
+ if(app_id)
+ printf("app_id: %s\n", app_id);
+ else
+ printf("No appid found for %s\n",aliasid);
+
+ if(app_id)
+ free(app_id);
+ return ret;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_appid_from_aliasid(const char *alias_id, char** app_id);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_alias_appid(pkgmgrinfo_appinfo_h handle, char **alias_appid)
+ * @brief This API gets the alias_appid of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] alias_appid pointer to hold app alias_appid
+ * @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_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @code
+static int get_alias_appid(const char *appid)
+{
+ int ret = 0;
+ char *alias_appid= 0;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_alias_appid(handle, &alias_appid);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("alias_appid: %s\n", alias_appid);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_alias_appid(pkgmgrinfo_appinfo_h handle, char **alias_appid);
/**
- * @fn int pkgmgrinfo_appinfo_get_support_feature(pkgmgrinfo_appinfo_h handle, int *support_feature)
- * @brief This API gets the support_funtion of the application
+ * @fn int pkgmgrinfo_appinfo_get_effective_appid(pkgmgrinfo_appinfo_h handle, char **effective_appid)
+ * @brief This API gets the effective_appid of the application
*
* @par This API is for package-manager client application
* @par Sync (or) Async : Synchronous API
*
* @param[in] handle pointer to the application info handle.
- * @param[out] support_feature pointer to hold app support_feature
+ * @param[out] effective_appid pointer to hold app effective_appid
* @return 0 if success, error code(<0) if fail
* @retval PMINFO_R_OK success
* @retval PMINFO_R_EINVAL invalid argument
* @post pkgmgrinfo_appinfo_destroy_appinfo()
* @see pkgmgrinfo_appinfo_get_appid()
* @code
-static int get_app_support_feature(const char *appid)
+static int get_effective_appid(const char *appid)
{
int ret = 0;
- int support_feature = 0;
+ char *effective_appid= 0;
pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
- ret = pkgmgrinfo_appinfo_get_support_feature(handle, &support_feature);
+ ret = pkgmgrinfo_appinfo_get_effective_appid(handle, &effective_appid);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_appinfo_destroy_appinfo(handle);
return -1;
}
- printf("support_feature: %d\n", support_feature);
+ printf("effective_appid: %s\n", effective_appid);
pkgmgrinfo_appinfo_destroy_appinfo(handle);
return 0;
}
* @endcode
*/
-int pkgmgrinfo_appinfo_get_support_feature(pkgmgrinfo_appinfo_h handle, int *support_feature);
+int pkgmgrinfo_appinfo_get_effective_appid(pkgmgrinfo_appinfo_h handle, char **effective_appid);
/**
- * @fn int pkgmgrinfo_appinfo_get_uginfo(const char *ug_name, pkgmgrinfo_appinfo_h *handle)
- * @brief This API creates the application information handle from ug_name
+ * @fn int pkgmgrinfo_appinfo_get_installed_time(pkgmgrinfo_appinfo_h handle, int *installed_time)
+ * @brief This API gets the installed_time of the application
*
* @par This API is for package-manager client application
* @par Sync (or) Async : Synchronous API
*
- * @param[in] ug_name pointer to ug_name
- * @param[out] handle pointer to the application info handle.
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] installed_time pointer to hold installed_time
* @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
+ * @pre pkgmgrinfo_appinfo_get_appinfo()
* @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
* @code
-static int get_app_uginfo(const char *ug_name)
+static int get_app_installed_time(const char *appid)
{
int ret = 0;
- char *appid = NULL;
- pkgmgrinfo_appinfo_h handle;
- ret = pkgmgrinfo_appinfo_get_uginfo(ug_name, &handle);
+ int installed_time = 0;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
- ret = pkgmgrinfo_appinfo_get_appid(handle, &appid);
+ ret = pkgmgrinfo_appinfo_get_installed_time(handle, &installed_time);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_appinfo_destroy_appinfo(handle);
return -1;
}
- printf("appid: %s\n", appid);
+ printf("installed_time: %d\n", installed_time);
pkgmgrinfo_appinfo_destroy_appinfo(handle);
return 0;
}
* @endcode
*/
-int pkgmgrinfo_appinfo_get_uginfo(const char *ug_name, pkgmgrinfo_appinfo_h *handle);
+int pkgmgrinfo_appinfo_get_installed_time(pkgmgrinfo_appinfo_h handle, int *installed_time);
+
+#ifdef _APPFW_FEATURE_EXPANSION_PKG_INSTALL
+ /**
+ * @fn int pkgmgrinfo_appinfo_get_tep_name(pkgmgrinfo_appinfo_h handle, char **tep_name)
+ * @brief This API gets (tizen expansion package))tep file name associated with the applicaiton
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] app_type pointer to hold tep name
+ * @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_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @code
+ static int get_tep_name(const char *appid)
+ {
+ int ret = 0;
+ char *tep_name = NULL;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_tep_name(handle, &tep_name);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("TEP name is: %s\n", tep_name);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+ }
+ * @endcode
+ */
+ int pkgmgrinfo_appinfo_get_tep_name(pkgmgrinfo_appinfo_h handle, char **tep_name);
+#endif
+
+#ifdef _APPFW_FEATURE_MOUNT_INSTALL
+ /**
+ * @fn int pkgmgrinfo_appinfo_get_tpk_name(pkgmgrinfo_appinfo_h handle, char **tpk_name)
+ * @brief This API gets tpk file name associated with the applicaiton
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] tpk_name pointer to hold tpk name
+ * @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_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @code
+ static int get_tpk_name(const char *appid)
+ {
+ int ret = 0;
+ char *tpk_name = NULL;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_tpk_name(handle, &tpk_name);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("TPK name is: %s\n", tpk_name);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+ }
+ * @endcode
+ */
+ int pkgmgrinfo_appinfo_get_tpk_name(pkgmgrinfo_appinfo_h handle, char **tpk_name);
+#endif
+
+
+ /**
+ * @fn int pkgmgrinfo_appinfo_get_installed_storage_location(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_installed_storage *storage)
+ * @brief This API gets the installed storage location of the application
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] app_type pointer to hold installed storage location
+ * @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_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @code
+ static int get_app_installed_location(const char *appid)
+ {
+ int ret = 0;
+ pkgmgrinfo_installed_storage storage;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_get_installed_storage_location(handle, &storage);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("Installed storage location : %d\n", storage);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+ }
+ * @endcode
+ */
+ int pkgmgrinfo_appinfo_get_installed_storage_location(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_installed_storage *storage);
/**
- * @fn int pkgmgrinfo_appinfo_get_aliasid(const char *app_id, char** alias_id)
- * @brief This API get alias_id for an appid from pkgmgr DB.
+ * @fn int pkgmgrinfo_appinfo_get_appcontrol(const char *appid, char **appcontrol)
+ * @brief This API gets the appcontrol of the application
*
* @par This API is for package-manager client application
* @par Sync (or) Async : Synchronous API
*
- * @param[in] appid pointer to application id
- * @param[out] alias_id pointer to pointer of alias id.
+ * @param[in] appid pointer to the application ID.
+ * @param[out] appcontrol pointer to hold appcontrol.
* @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
+ * @post None
* @code
-static int get_app_aliasid(const char *appid)
+static int get_appcontrol(const char *appid)
{
int ret = 0;
- char *alias_id = NULL;
- ret = pkgmgrinfo_appinfo_get_aliasid(appid, &alias_id);
- if (ret != PMINFO_R_OK){
- printf("Failed to get the aliasid for [%s]\n",appid);
+ char *appcontrol = NULL;
+ ret = pkgmgrinfo_appinfo_get_appcontrol(appid, &appcontrol);
+ if (ret != PMINFO_R_OK) {
return -1;
}
- if(alias_id)
- printf("aliasid: %s\n", alias_id);
- else
- printf("No alias_id found for %s\n",appid);
-
- if(alias_id)
- free(alias_id);
- return ret;
+ printf("appcontrol: %s\n", appcontrol);
+ free(appcontrol);
+ return 0;
}
* @endcode
*/
-int pkgmgrinfo_appinfo_get_aliasid(const char* appid, char** alias_id);
+int pkgmgrinfo_appinfo_get_appcontrol(const char *appid, char **appcontrol);
/**
- * @fn int pkgmgrinfo_appinfo_get_installed_time(pkgmgrinfo_appinfo_h handle, int *installed_time)
- * @brief This API gets the installed_time of the application
+ * @fn int pkgmgrinfo_appinfo_get_api_version(pkgmgrinfo_appinfo_h handle, char **api_version)
+ * @brief This API gets the api_version of the application
*
* @par This API is for package-manager client application
* @par Sync (or) Async : Synchronous API
*
* @param[in] handle pointer to the application info handle.
- * @param[out] installed_time pointer to hold installed_time
+ * @param[out] api_version pointer to hold app api_version
* @return 0 if success, error code(<0) if fail
* @retval PMINFO_R_OK success
* @retval PMINFO_R_EINVAL invalid argument
* @pre pkgmgrinfo_appinfo_get_appinfo()
* @post pkgmgrinfo_appinfo_destroy_appinfo()
* @see pkgmgrinfo_appinfo_get_appid()
- * @see pkgmgrinfo_appinfo_is_multiple()
* @code
-static int get_app_installed_time(const char *appid)
+static int get_api_version(const char *appid)
{
int ret = 0;
- int installed_time = 0;
- pkgmgrinfo_appinfo_h handle;
+ char *api_version= 0;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
- ret = pkgmgrinfo_appinfo_get_installed_time(handle, &installed_time);
+ ret = pkgmgrinfo_appinfo_get_api_version(handle, &api_version);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_appinfo_destroy_appinfo(handle);
return -1;
}
- printf("installed_time: %d\n", installed_time);
+ printf("api_version: %s\n", api_version);
pkgmgrinfo_appinfo_destroy_appinfo(handle);
return 0;
}
* @endcode
*/
-int pkgmgrinfo_appinfo_get_installed_time(pkgmgrinfo_appinfo_h handle, int *installed_time);
+int pkgmgrinfo_appinfo_get_api_version(pkgmgrinfo_appinfo_h handle, char **api_version);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_launch_mode(pkgmgrinfo_appinfo_h handle, char **mode)
+ * @brief This API gets the launch mode of package from the package ID
+ *
+ * @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] mode pointer to hold launch mode of package
+ * @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_removable()
+ * @code
+static int get_pkg_launch_mode(const char *pkgid)
+{
+ int ret = 0;
+ char *launch_mode = NULL;
+ pkgmgrinfo_pkginfo_h handle;
+ ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_pkginfo_get_launch_mode(handle, &mode);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return -1;
+ }
+ printf("launch mode: %s\n", mode);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_launch_mode(pkgmgrinfo_appinfo_h handle, char **mode);
/**
* @fn int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
static int list_permission(const char *appid, char *permission)
{
int ret = 0;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
static int list_category(const char *appid, char *category)
{
int ret = 0;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
static int list_metadata(const char *appid, char *key)
{
int ret = 0;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
* @pre pkgmgrinfo_appinfo_get_appinfo()
* @post pkgmgrinfo_appinfo_destroy_appinfo()
* @code
-int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
+int appcontrol_func(const char *operation, const char *uri, const char *mime, void *user_data)
{
- int oc = 0;
- int i = 0;
- char **operation;
- pkgmgrinfo_appinfo_get_operation(handle, &oc, &operation);
- for (i = 0; i < oc; i++) {
- if (strcmp(operation[i], (char *)user_data) == 0)
- return -1;
- else
- return 0;
- }
+ if (strcmp(operation, (char *)user_data) == 0)
+ return 1;
+ else
+ return 0;
}
static int check_operation(const char *appid, char *operation)
{
int ret = 0;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
bool nodisplay;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
bool multiple;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
bool indicator_disp;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
bool taskmanage;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
bool enabled;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
bool onboot;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
bool autorestart;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
bool mainapp;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
static int is_category_exist(const char *appid, const char *category)
{
int ret = 0;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
bool exist = false;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
{
int ret = 0;
bool multi_instance;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
bool multi_window;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
* @par Sync (or) Async : Synchronous API
*
* @param[in] handle pointer to application info handle
- * @param[out] support_disable pointer to hold package support_disable value
+ * @param[out] support_disable pointer to hold package support_disable value
* @return 0 if success, error code(<0) if fail
* @retval PMINFO_R_OK success
* @retval PMINFO_R_EINVAL invalid argument
{
int ret = 0;
bool support_disable;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
* @par Sync (or) Async : Synchronous API
*
* @param[in] handle pointer to application info handle
- * @param[out] ui_gadget pointer to hold package ui_gadget value
+ * @param[out] ui_gadget pointer to hold package ui_gadget value
* @return 0 if success, error code(<0) if fail
* @retval PMINFO_R_OK success
* @retval PMINFO_R_EINVAL invalid argument
* @par Sync (or) Async : Synchronous API
*
* @param[in] handle pointer to application info handle
- * @param[out] removable pointer to hold package removable value
+ * @param[out] removable pointer to hold package removable value
* @return 0 if success, error code(<0) if fail
* @retval PMINFO_R_OK success
* @retval PMINFO_R_EINVAL invalid argument
* @par Sync (or) Async : Synchronous API
*
* @param[in] handle pointer to application info handle
- * @param[out] system pointer to hold package system value
+ * @param[out] system pointer to hold package system value
* @return 0 if success, error code(<0) if fail
* @retval PMINFO_R_OK success
* @retval PMINFO_R_EINVAL invalid argument
int pkgmgrinfo_appinfo_is_system(pkgmgrinfo_appinfo_h handle, bool *system);
/**
+ * @fn int pkgmgrinfo_appinfo_is_companion_type(pkgmgrinfo_appinfo_h handle, bool *companion_type)
+ * @brief This API gets the application 'companion_type' value from the app ID
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to application info handle
+ * @param[out] companion_type pointer to hold package companion_type value
+ * @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_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @see pkgmgrinfo_appinfo_is_multiple()
+ * @code
+static int get_app_companion_type(const char *appid)
+{
+ int ret = 0;
+ bool companion_type;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_is_companion_type(handle, &companion_type);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("app companion_type: %d\n", companion_type);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_companion_type(pkgmgrinfo_appinfo_h handle, bool *companion_type);
+
+#ifdef _APPFW_FEATURE_MOUNT_INSTALL
+ /**
+ * @fn int pkgmgrinfo_appinfo_is_mount_install(pkgmgrinfo_appinfo_h handle, bool *ismount)
+ * @brief This API gets 'mount install' value associated with the applicaiton
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info handle.
+ * @param[out] ismount pointer to hold ismount value.
+ * @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_appinfo_get_appinfo()
+ * @post pkgmgrinfo_appinfo_destroy_appinfo()
+ * @see pkgmgrinfo_appinfo_get_appid()
+ * @code
+ static int get_mount_install_val(const char *appid)
+ {
+ int ret = 0;
+ bool ismount;
+ pkgmgrinfo_appinfo_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_is_mount_install(handle, &ismount);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return -1;
+ }
+ printf("Mount install value is: %d\n", ismount);
+ pkgmgrinfo_appinfo_destroy_appinfo(handle);
+ return 0;
+ }
+ * @endcode
+ */
+ int pkgmgrinfo_appinfo_is_mount_install(pkgmgrinfo_appinfo_h handle, bool *ismount);
+#endif
+
+
+/**
* @fn int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
* @brief This API destroys the application information handle freeing up all the resources
*
{
int ret = 0;
char *type = NULL;
- pkgmgrinfo_appinfo_h handle;
+ pkgmgrinfo_appinfo_h handle = NULL;
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
int count = 0;
- pkgmgrinfo_appinfo_filter_h handle;
+ pkgmgrinfo_appinfo_filter_h handle = NULL;
ret = pkgmgrinfo_appinfo_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
int count = 0;
- pkgmgrinfo_appinfo_filter_h handle;
+ pkgmgrinfo_appinfo_filter_h handle = NULL;
ret = pkgmgrinfo_appinfo_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
int count = 0;
- pkgmgrinfo_appinfo_filter_h handle;
+ pkgmgrinfo_appinfo_filter_h handle = NULL;
ret = pkgmgrinfo_appinfo_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
int count = 0;
- pkgmgrinfo_appinfo_filter_h handle;
+ pkgmgrinfo_appinfo_filter_h handle = NULL;
ret = pkgmgrinfo_appinfo_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
const char *property, const int value);
/**
+ * @fn int pkgmgrinfo_appinfo_filter_add_bg_category(pkgmgrinfo_appinfo_filter_h handle, int category_filter);
+ * @brief This API adds an category filter value about app background category to the filter handle
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle pointer to the application info filter handle.
+ * @param[in] category_filter integer category value.
+ * @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_appinfo_filter_create()
+ * @post pkgmgrinfo_appinfo_filter_destroy()
+ * @see pkgmgrinfo_appinfo_filter_count()
+ * @see pkgmgrinfo_appinfo_filter_foreach_appinfo()
+ * @code
+static int get_taskmanageable_app_count()
+{
+ int ret = 0;
+ int count = 0;
+ pkgmgrinfo_appinfo_filter_h handle = NULL;
+ ret = pkgmgrinfo_appinfo_filter_create(&handle);
+ if (ret != PMINFO_R_OK)
+ return -1;
+ ret = pkgmgrinfo_appinfo_filter_add_bg_category(handle, APP_BG_CATEGORY_MEDIA_VAL | APP_BG_CATEGORY_DOWNLOAD_VAL);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return -1;
+ }
+ printf("No of apps: %d\n", count);
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_filter_add_bg_category(pkgmgrinfo_appinfo_filter_h handle, int category_filter);
+
+/**
* @fn int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle, const char *property, const char *value)
* @brief This API adds a string filter property to the filter handle
*
{
int ret = 0;
int count = 0;
- pkgmgrinfo_appinfo_filter_h handle;
+ pkgmgrinfo_appinfo_filter_h handle = NULL;
ret = pkgmgrinfo_appinfo_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
static int get_capp_list()
{
int ret = 0;
- pkgmgrinfo_appinfo_filter_h handle;
+ pkgmgrinfo_appinfo_filter_h handle = NULL;
ret = pkgmgrinfo_appinfo_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
{
int ret = 0;
int count = 0;
- pkgmgrinfo_appinfo_filter_h handle;
+ pkgmgrinfo_appinfo_filter_h handle = NULL;
ret = pkgmgrinfo_appinfo_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
static int get_app_list(const char *mkey, const char *mvalue)
{
int ret = 0;
- pkgmgrinfo_appinfo_metadata_filter_h handle;
+ pkgmgrinfo_appinfo_metadata_filter_h handle = NULL;
ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
static int get_app_list(const char *mkey, const char *mvalue)
{
int ret = 0;
- pkgmgrinfo_appinfo_metadata_filter_h handle;
+ pkgmgrinfo_appinfo_metadata_filter_h handle = NULL;
ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
static int get_app_list(const char *mkey, const char *mvalue)
{
int ret = 0;
- pkgmgrinfo_appinfo_metadata_filter_h handle;
+ pkgmgrinfo_appinfo_metadata_filter_h handle = NULL;
ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
static int get_app_list(const char *mkey, const char *mvalue)
{
int ret = 0;
- pkgmgrinfo_appinfo_metadata_filter_h handle;
+ pkgmgrinfo_appinfo_metadata_filter_h handle = NULL;
ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
if (ret != PMINFO_R_OK)
return -1;
static int get_cert_info(const char *pkgid)
{
int ret = 0;
- pkgmgrinfo_certinfo_h handle;
+ pkgmgrinfo_certinfo_h handle = NULL;
char *auth_cert = NULL;
ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
if (ret != PMINFO_R_OK)
static int get_cert_info(const char *pkgid)
{
int ret = 0;
- pkgmgrinfo_certinfo_h handle;
+ pkgmgrinfo_certinfo_h handle = NULL;
char *auth_cert = NULL;
ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
if (ret != PMINFO_R_OK)
static int get_cert_info(const char *pkgid)
{
int ret = 0;
- pkgmgrinfo_certinfo_h handle;
+ pkgmgrinfo_certinfo_h handle = NULL;
char *auth_cert = NULL;
ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
if (ret != PMINFO_R_OK)
static int get_cert_info(const char *pkgid)
{
int ret = 0;
- pkgmgrinfo_certinfo_h handle;
+ pkgmgrinfo_certinfo_h handle = NULL;
char *auth_cert = NULL;
ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
if (ret != PMINFO_R_OK)
}
* @endcode
*/
- int pkgmgrinfo_delete_certinfo(const char *pkgid);
+int pkgmgrinfo_delete_certinfo(const char *pkgid);
/**
static int set_cert_in_db(const char *pkgid)
{
int ret = 0;
- pkgmgrinfo_instcertinfo_h handle;
+ pkgmgrinfo_instcertinfo_h handle = NULL;
ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
if (ret != PMINFO_R_OK)
return -1;
static int set_cert_in_db(const char *pkgid)
{
int ret = 0;
- pkgmgrinfo_instcertinfo_h handle;
+ pkgmgrinfo_instcertinfo_h handle = NULL;
ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
if (ret != PMINFO_R_OK)
return -1;
static int set_cert_in_db(const char *pkgid)
{
int ret = 0;
- pkgmgrinfo_instcertinfo_h handle;
+ pkgmgrinfo_instcertinfo_h handle = NULL;
ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
if (ret != PMINFO_R_OK)
return -1;
static int set_cert_in_db(const char *pkgid)
{
int ret = 0;
- pkgmgrinfo_instcertinfo_h handle;
+ pkgmgrinfo_instcertinfo_h handle = NULL;
ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
if (ret != PMINFO_R_OK)
return -1;
int pkgmgrinfo_pkginfo_set_installed_storage(const char *pkgid, INSTALL_LOCATION location);
/**
+ * @fn int pkgmgrinfo_pkginfo_set_data(const char *pkgid, const char *property, const char *value)
+ * @brief This API set the package information
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to the package ID.
+ * @param[in] property pointer to the package property.
+ * @param[in] value pointer to the package value.
+ * @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 set_data(const char *pkgid, const char *property, const char *value)
+{
+ int ret = 0;
+
+ ret = pkgmgrinfo_pkginfo_set_data(pkgid, property, value);
+ if (ret != PMINFO_R_OK) {
+ return -1;
+ }
+
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_set_data(const char *pkgid, const char *property, const char *value);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_set_data(const char *appid, const char *property, const char *value)
+ * @brief This API set the application information
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] appid pointer to the application ID.
+ * @param[in] property pointer to the application property.
+ * @param[in] value pointer to the application value.
+ * @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 set_data(const char *appid, const char *property, const char *value)
+{
+ int ret = 0;
+
+ ret = pkgmgrinfo_appinfo_set_data(appid, property, value);
+ if (ret != PMINFO_R_OK) {
+ return -1;
+ }
+
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_set_data(const char *pkgid, const char *property, const char *value);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_set_appcontrol(const char *appid, const char *appcontrol)
+ * @brief This API set the application appcontrol
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] appid pointer to the application ID.
+ * @param[in] appcontrol pointer to the application appcontrol.
+ * @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 set_appcontrol(const char *appid, const char *appcontrol)
+{
+ int ret = 0;
+
+ ret = pkgmgrinfo_appinfo_set_appcontrol(appid, appcontrol);
+ if (ret != PMINFO_R_OK) {
+ return -1;
+ }
+
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_set_appcontrol(const char *appid, const char *appcontrol);
+
+/**
* @pkgmgrinfo client API
**/
int pkgmgrinfo_client_listen_status(pkgmgrinfo_client *pc, pkgmgrinfo_handler event_cb, void *data);
int pkgmgrinfo_client_free(pkgmgrinfo_client *pc);
int pkgmgrinfo_client_request_enable_external_pkg(char *pkgid);
+int pkgmgrinfo_client_listen_status_with_zone(pkgmgrinfo_client *pc, pkgmgrinfo_handler_zone event_cb, void *data);
+
+int pkgmgrinfo_appinfo_foreach_background_category(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_background_category_list_cb category_func, void *user_data);
/**
* @pkgmgrinfo client API end
#ifndef __PKGMGRINFO_BASIC_H__
#define __PKGMGRINFO_BASIC_H__
+#include <glib.h>
+
#define DEFAULT_LOCALE "No Locale"
#define PKG_STRING_LEN_MAX 1024
#define PKGMGR_PARSER_EMPTY_STR ""
+#define ZONE_HOST "host"
+
typedef struct metadata_x {
const char *key;
const char *value;
- struct metadata_x *prev;
- struct metadata_x *next;
} metadata_x;
-typedef struct privilege_x {
- const char *text;
- struct privilege_x *prev;
- struct privilege_x *next;
-} privilege_x;
-
-typedef struct privileges_x {
- struct privilege_x *privilege;
- struct privileges_x *prev;
- struct privileges_x *next;
-} privileges_x;
-
typedef struct permission_x {
const char *type;
const char *value;
- struct permission_x *prev;
- struct permission_x *next;
} permission_x;
typedef struct icon_x {
const char *section;
const char *size;
const char *resolution;
- struct icon_x *prev;
- struct icon_x *next;
} icon_x;
typedef struct image_x {
const char *text;
const char *lang;
const char *section;
- struct image_x *prev;
- struct image_x *next;
} image_x;
typedef struct allowed_x {
const char *name;
const char *text;
- struct allowed_x *prev;
- struct allowed_x *next;
} allowed_x;
typedef struct request_x {
const char *text;
- struct request_x *prev;
- struct request_x *next;
} request_x;
typedef struct define_x {
const char *path;
- struct allowed_x *allowed;
- struct request_x *request;
- struct define_x *prev;
- struct define_x *next;
+ GList *allowed;
+ GList *request;
} define_x;
typedef struct datashare_x {
- struct define_x *define;
- struct request_x *request;
- struct datashare_x *prev;
- struct datashare_x *next;
+ GList *define;
+ GList *request;
} datashare_x;
typedef struct description_x {
const char *name;
const char *text;
const char *lang;
- struct description_x *prev;
- struct description_x *next;
} description_x;
typedef struct registry_x {
const char *name;
const char *text;
- struct registry_x *prev;
- struct registry_x *next;
} registry_x;
typedef struct database_x {
const char *name;
const char *text;
- struct database_x *prev;
- struct database_x *next;
} database_x;
typedef struct layout_x {
const char *name;
const char *text;
- struct layout_x *prev;
- struct layout_x *next;
} layout_x;
typedef struct label_x {
const char *name;
const char *text;
const char *lang;
- struct label_x *prev;
- struct label_x *next;
} label_x;
typedef struct author_x {
const char *href;
const char *text;
const char *lang;
- struct author_x *prev;
- struct author_x *next;
} author_x;
typedef struct license_x {
const char *text;
const char *lang;
- struct license_x *prev;
- struct license_x *next;
} license_x;
typedef struct operation_x {
const char *name;
const char *text;
- struct operation_x *prev;
- struct operation_x *next;
} operation_x;
typedef struct uri_x {
const char *name;
const char *text;
- struct uri_x *prev;
- struct uri_x *next;
} uri_x;
typedef struct mime_x {
const char *name;
const char *text;
- struct mime_x *prev;
- struct mime_x *next;
} mime_x;
typedef struct subapp_x {
const char *name;
const char *text;
- struct subapp_x *prev;
- struct subapp_x *next;
} subapp_x;
typedef struct condition_x {
const char *name;
const char *text;
- struct condition_x *prev;
- struct condition_x *next;
} condition_x;
typedef struct notification_x {
const char *name;
const char *text;
- struct notification_x *prev;
- struct notification_x *next;
} notification_x;
typedef struct appsvc_x {
const char *text;
- struct operation_x *operation;
- struct uri_x *uri;
- struct mime_x *mime;
- struct subapp_x *subapp;
- struct appsvc_x *prev;
- struct appsvc_x *next;
+ GList *operation;
+ GList *uri;
+ GList *mime;
+ GList *subapp;
} appsvc_x;
-typedef struct category_x{
+typedef struct category_x {
const char *name;
- struct category_x *prev;
- struct category_x *next;
} category_x;
typedef struct launchconditions_x {
const char *text;
- struct condition_x *condition;
- struct launchconditions_x *prev;
- struct launchconditions_x *next;
+ GList *condition;
} launchconditions_x;
typedef struct compatibility_x {
const char *name;
const char *text;
- struct compatibility_x *prev;
- struct compatibility_x *next;
-}compatibility_x;
+} compatibility_x;
typedef struct deviceprofile_x {
const char *name;
const char *text;
- struct deviceprofile_x *prev;
- struct deviceprofile_x *next;
-}deviceprofile_x;
+} deviceprofile_x;
typedef struct resolution_x {
const char *mimetype;
const char *urischeme;
- struct resolution_x *prev;
- struct resolution_x *next;
} resolution_x;
typedef struct capability_x {
const char *operationid;
const char *access;
- struct resolution_x *resolution;
- struct capability_x *prev;
- struct capability_x *next;
+ GList *resolution;
} capability_x;
typedef struct datacontrol_x {
const char *providerid;
const char *access;
const char *type;
- struct datacontrol_x *prev;
- struct datacontrol_x *next;
} datacontrol_x;
+typedef struct appcontrol_x {
+ const char *operation;
+ const char *uri;
+ const char *mime;
+} appcontrol_x;
+
typedef struct uiapplication_x {
const char *appid;
const char *exec;
- const char *ambient_support;
const char *nodisplay;
const char *multiple;
const char *taskmanage;
const char *support_disable;
const char *ui_gadget;
const char *removable;
+ const char *companion_type;
const char *support_mode;
const char *support_feature;
+ const char *support_category;
const char *satui_label;
const char *package_type;
const char *package_system;
const char *package_installed_time;
- struct label_x *label;
- struct icon_x *icon;
- struct image_x *image;
- struct appsvc_x *appsvc;
- struct category_x *category;
- struct metadata_x *metadata;
- struct permission_x *permission;
- struct launchconditions_x *launchconditions;
- struct notification_x *notification;
- struct datashare_x *datashare;
- struct datacontrol_x *datacontrol;
- struct uiapplication_x *prev;
- struct uiapplication_x *next;
+ const char *launch_mode;
+ const char *alias_appid;
+ const char *effective_appid;
+ const char *api_version;
+#ifdef _APPFW_FEATURE_EXPANSION_PKG_INSTALL
+ const char *tep_name;
+#endif
+ GList *label;
+ GList *icon;
+ GList *image;
+ GList *appsvc;
+ GList *category;
+ GList *metadata;
+ GList *permission;
+ GList *launchconditions;
+ GList *notification;
+ GList *datashare;
+ GList *datacontrol;
+ GList *background_category;
+ GList *appcontrol;
+#ifdef _APPFW_FEATURE_MOUNT_INSTALL
+ int ismount;
+ const char *tpk_name;
+#endif
} uiapplication_x;
typedef struct serviceapplication_x {
const char *type;
const char *package;
const char *permission_type;
- struct label_x *label;
- struct icon_x *icon;
- struct appsvc_x *appsvc;
- struct category_x *category;
- struct metadata_x *metadata;
- struct permission_x *permission;
- struct datacontrol_x *datacontrol;
- struct launchconditions_x *launchconditions;
- struct notification_x *notification;
- struct datashare_x *datashare;
- struct serviceapplication_x *prev;
- struct serviceapplication_x *next;
+ GList *label;
+ GList *icon;
+ GList *appsvc;
+ GList *category;
+ GList *metadata;
+ GList *permission;
+ GList *datacontrol;
+ GList *launchconditions;
+ GList *notification;
+ GList *datashare;
+ GList *background_category;
} serviceapplication_x;
typedef struct daemon_x {
const char *name;
const char *text;
- struct daemon_x *prev;
- struct daemon_x *next;
} daemon_x;
typedef struct theme_x {
const char *name;
const char *text;
- struct theme_x *prev;
- struct theme_x *next;
} theme_x;
typedef struct font_x {
const char *name;
const char *text;
- struct font_x *prev;
- struct font_x *next;
} font_x;
typedef struct ime_x {
const char *name;
const char *text;
- struct ime_x *prev;
- struct ime_x *next;
} ime_x;
typedef struct manifest_x {
const char *nodisplay_setting; /**< package no display setting menu*/
const char *support_disable; /**< package support disable flag*/
const char *mother_package; /**< package is mother package*/
+ const char *api_version; /**< minimum version of API package using*/
+#ifdef _APPFW_FEATURE_EXPANSION_PKG_INSTALL
+ const char *tep_name;
+#endif
const char *support_mode; /**< package support mode*/
- const char *support_reset; /**< package support reset*/
- const char *use_reset; /**< package use reset*/
+ const char *backend_installer; /**< package backend installer*/
+ const char *custom_smack_label; /**< package custom smack label*/
const char *groupid; /**< package groupid*/
- const char *hash; /**<manifest file's hash */
- struct icon_x *icon; /**< package icon*/
- struct label_x *label; /**< package label*/
- struct author_x *author; /**< package author*/
- struct description_x *description; /**< package description*/
- struct license_x *license; /**< package license*/
- struct privileges_x *privileges; /**< package privileges*/
- struct uiapplication_x *uiapplication; /**< package's ui application*/
- struct serviceapplication_x *serviceapplication; /**< package's service application*/
- struct daemon_x *daemon; /**< package daemon*/
- struct theme_x *theme; /**< package theme*/
- struct font_x *font; /**< package font*/
- struct ime_x *ime; /**< package ime*/
- struct compatibility_x *compatibility; /**< package compatibility*/
- struct deviceprofile_x *deviceprofile; /**< package device profile*/
+ GList *icon; /**< package icon*/
+ GList *label; /**< package label*/
+ GList *author; /**< package author*/
+ GList *description; /**< package description*/
+ GList *license; /**< package license*/
+ GList *privileges; /**< package privileges*/
+ GList *uiapplication; /**< package's ui application*/
+ GList *serviceapplication; /**< package's service application*/
+ GList *daemon; /**< package daemon*/
+ GList *theme; /**< package theme*/
+ GList *font; /**< package font*/
+ GList *ime; /**< package ime*/
+ GList *compatibility; /**< package compatibility*/
+ GList *deviceprofile; /**< package device profile*/
} manifest_x;
/**
} while (0)
void _pkgmgrinfo_basic_free_manifest_x(manifest_x *mfx);
+void _pkgmgrinfo_basic_free_uiapplication_x(uiapplication_x *uiapplication);
-char* pkgmgrinfo_basic_generate_hash_for_file(const char* file);
#endif /* __PKGMGRINFO_BASIC_H__ */
} \
} while (0)
+#define trym_if(expr, fmt, arg...) do { \
+ if (expr) { \
+ PKGMGR_INFO_DEBUG_ERR("(%s) "fmt, #expr, ##arg); \
+ goto catch; \
+ } \
+} while (0)
+
#define tryvm_if(expr, val, fmt, arg...) do { \
if (expr) { \
PKGMGR_INFO_DEBUG_ERR("(%s) "fmt, #expr, ##arg); \
+++ /dev/null
-/*
- * pkgmgrinfo_feature
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef __PKGMGRINFO_FEATURE_H__
-#define __PKGMGRINFO_FEATURE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int pkgmgrinfo_appinfo_get_disabled_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
- pkgmgrinfo_app_list_cb app_func, void *user_data);
-int pkgmgrinfo_appinfo_get_disabled_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle);
-int pkgmgrinfo_pkginfo_get_disabled_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data);
-int pkgmgrinfo_pkginfo_get_disabled_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __PKGPMGRINFO_FEATURE_H__ */
#endif
#define MMC_PATH "/opt/storage/sdcard"
-#define PKG_SD_PATH MMC_PATH"/app2sd/"
+#define PKG_SD_PATH __pkgmgrinfo_get_default_sd_path()
#define PKG_RW_PATH "/opt/usr/apps/"
#define PKG_RO_PATH "/usr/apps/"
-#define BLOCK_SIZE 4096 /*in bytes*/
#define PKG_TYPE_STRING_LEN_MAX 128
#define PKG_VERSION_STRING_LEN_MAX 128
#define MAX_QUERY_LEN 4096
#define MAX_CERT_TYPE 9
-#define MANIFEST_DB "/opt/dbspace/.pkgmgr_parser.db"
-#define CERT_DB "/opt/dbspace/.pkgmgr_cert.db"
-#define DATACONTROL_DB "/opt/usr/dbspace/.app-package.db"
+#define MANIFEST_DB __pkgmgrinfo_get_default_manifest_db()
+#define CERT_DB __pkgmgrinfo_get_default_cert_db()
+#define DATACONTROL_DB __pkgmgrinfo_get_default_data_control_db()
/*String properties for filtering based on package info*/
typedef enum _pkgmgrinfo_pkginfo_filter_prop_str {
E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING,
E_PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE,
E_PMINFO_PKGINFO_PROP_PACKAGE_DISABLE,
- E_PMINFO_PKGINFO_PROP_PACKAGE_USE_RESET,
- E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_BOOL = E_PMINFO_PKGINFO_PROP_PACKAGE_USE_RESET
+ E_PMINFO_PKGINFO_PROP_PACKAGE_SYSTEM,
+ E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_BOOL = E_PMINFO_PKGINFO_PROP_PACKAGE_SYSTEM
} pkgmgrinfo_pkginfo_filter_prop_bool;
/*Integer properties for filtering based on package info*/
typedef enum _pkgmgrinfo_appinfo_filter_prop_str {
E_PMINFO_APPINFO_PROP_APP_MIN_STR = 401,
E_PMINFO_APPINFO_PROP_APP_ID = E_PMINFO_APPINFO_PROP_APP_MIN_STR,
- E_PMINFO_APPINFO_PROP_APP_COMPONENT,
E_PMINFO_APPINFO_PROP_APP_COMPONENT_TYPE,
E_PMINFO_APPINFO_PROP_APP_EXEC,
- E_PMINFO_APPINFO_PROP_APP_AMBIENT_SUPPORT,
E_PMINFO_APPINFO_PROP_APP_ICON,
E_PMINFO_APPINFO_PROP_APP_TYPE,
E_PMINFO_APPINFO_PROP_APP_OPERATION,
E_PMINFO_APPINFO_PROP_APP_HWACCELERATION,
E_PMINFO_APPINFO_PROP_APP_CATEGORY,
E_PMINFO_APPINFO_PROP_APP_SCREENREADER,
- E_PMINFO_APPINFO_PROP_APP_MAX_STR = E_PMINFO_APPINFO_PROP_APP_CATEGORY
+ E_PMINFO_APPINFO_PROP_APP_BG_CATEGORY,
+ E_PMINFO_APPINFO_PROP_APP_MAX_STR = E_PMINFO_APPINFO_PROP_APP_SCREENREADER
} pkgmgrinfo_appinfo_filter_prop_str;
/*Boolean properties for filtering based on app info*/
E_PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE,
E_PMINFO_APPINFO_PROP_APP_DISABLE,
E_PMINFO_APPINFO_PROP_APP_REMOVABLE,
- E_PMINFO_APPINFO_PROP_APP_MAX_BOOL = E_PMINFO_APPINFO_PROP_APP_REMOVABLE
+ E_PMINFO_APPINFO_PROP_APP_BG_USER_DISABLE,
+ E_PMINFO_APPINFO_PROP_APP_MAX_BOOL = E_PMINFO_APPINFO_PROP_APP_BG_USER_DISABLE
} pkgmgrinfo_appinfo_filter_prop_bool;
/*Integer properties for filtering based on app info*/
typedef struct _pkgmgr_pkginfo_x {
manifest_x *manifest_info;
char *locale;
-
- struct _pkgmgr_pkginfo_x *prev;
- struct _pkgmgr_pkginfo_x *next;
} pkgmgr_pkginfo_x;
typedef struct _pkgmgr_appinfo_x {
char *value;
} pkgmgrinfo_node_x;
+
typedef int (*sqlite_query_callback)(void *data, int ncols, char **coltxt, char **colname);
int __exec_db_query(sqlite3 *db, char *query, sqlite_query_callback callback, void *data);
void __cleanup_pkginfo(pkgmgr_pkginfo_x *data);
void __cleanup_appinfo(pkgmgr_appinfo_x *data);
-void __cleanup_list_pkginfo(pkgmgr_pkginfo_x *list_pkginfo, pkgmgr_pkginfo_x *node);
+void __cleanup_list_pkginfo(GList **list_pkginfo);
int __pkginfo_check_installed_storage(pkgmgr_pkginfo_x *pkginfo);
int __appinfo_check_installed_storage(pkgmgr_appinfo_x *appinfo);
pkgmgrinfo_appinfo_filter_prop_bool _pminfo_appinfo_convert_to_prop_bool(const char *property);
pkgmgrinfo_pkginfo_filter_prop_range _pminfo_pkginfo_convert_to_prop_range(const char *property);
+int _pminfo_db_open(const char *dbfile, sqlite3 **database);
+int _pminfo_db_open_with_options(const char *dbfile, sqlite3 **database, int flags);
+
+void _pminfo_destroy_node(gpointer data);
+
+const char *__pkgmgrinfo_get_default_manifest_db();
+const char *__pkgmgrinfo_get_default_cert_db();
+const char *__pkgmgrinfo_get_default_data_control_db();
+const char *__pkgmgrinfo_get_default_sd_path();
#endif /* __PKGMGRINFO_PRIVATE_H__ */
--- /dev/null
+#ifndef __PKGMGRINFO_RESOURCE_H_
+#define __PKGMGRINFO_RESOURCE_H_
+
+#include <glib.h>
+#include <bundle.h>
+
+#define RSC_GROUP_TYPE_IMAGE "image"
+#define RSC_GROUP_TYPE_LAYOUT "layout"
+#define RSC_GROUP_TYPE_SOUND "sound"
+#define RSC_GROUP_TYPE_BIN "bin"
+
+#define RSC_NODE_ATTR_SCREEN_DPI "screen-dpi"
+#define RSC_NODE_ATTR_SCREEN_DPI_RANGE "screen-dpi-range"
+#define RSC_NODE_ATTR_SCREEN_WIDTH_RANGE "screen-width-range"
+#define RSC_NODE_ATTR_SCREEN_LARGE "screen-large"
+#define RSC_NODE_ATTR_SCREEN_BPP "screen-bpp"
+#define RSC_NODE_ATTR_PLATFORM_VER "platform-version"
+#define RSC_NODE_ATTR_LANGUAGE "language"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ char *folder;
+ bundle *attr;
+} resource_node_t;
+
+typedef struct {
+ char *folder;
+ char *type;
+ GList *node_list;
+} resource_group_t;
+
+typedef struct {
+ char *package;
+ GList *group_list;
+} resource_data_t;
+
+/**
+ * @fn int pkgmgrinfo_resource_close(resource_data_t data)
+ * @brief This API frees given data and its own variables
+ *
+ * @par This API is for capi-appfw-application.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] data structure of resource_data_t
+ * @return 0 on succeed and -1 on failure, -2 on invalid parameter
+ */
+int pkgmgrinfo_resource_close(resource_data_t *data);
+
+/**
+ * @fn int pkgmgrinfo_resource_open(const char *filepath, resource_data_t **data)
+ * @brief This API will get resource data from specified resource xml
+ *
+ * @par This API is for capi-appfw-application.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] filepath path of resource xml
+ * @param[out]data resource_data type structure. it will filled with resource data
+ * @return 0 on succeed and -1 on failure, -2 on invalid parameter
+ */
+int pkgmgrinfo_resource_open(const char *filepath, resource_data_t **data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
extern "C" {
#endif
+/** Integer property for mode*/
+#define PMINFO_SUPPORT_MODE_ULTRA_POWER_SAVING 0x00000001
+#define PMINFO_SUPPORT_MODE_COOL_DOWN 0x00000002
+#define PMINFO_SUPPORT_MODE_SCREEN_READER 0x00000004
+#define PMINFO_SUPPORT_MODE_ACTIVATION_STUB 0x00000008
+
+#define PMINFO_SUPPORT_FEATURE_MULTI_WINDOW 0x00000001
+#define PMINFO_SUPPORT_FEATURE_OOM_TERMINATION 0x00000002
+#define PMINFO_SUPPORT_FEATURE_LARGE_MEMORY 0x00000004
+#define PMINFO_SUPPORT_FEATURE_HIGH_PRIORITY 0x00000008
+
+#define PMINFO_SUPPORT_CATEGORY_LOCK_APP 0x00000001
+#define PMINFO_SUPPORT_CATEGORY_HOME_APP 0x00000002
+#define PMINFO_SUPPORT_CATEGORY_IME_APP 0x00000004
+
+/*app background category value */
+#define APP_BG_CATEGORY_USER_DISABLE_FALSE_VAL 0x00000
+#define APP_BG_CATEGORY_USER_DISABLE_TRUE_VAL 0x00001
+#define APP_BG_CATEGORY_MEDIA_VAL 0x00002
+#define APP_BG_CATEGORY_DOWNLOAD_VAL 0x00004
+#define APP_BG_CATEGORY_BGNETWORK_VAL 0x00008
+#define APP_BG_CATEGORY_LOCATION_VAL 0x00010
+#define APP_BG_CATEGORY_SENSOR_VAL 0x00020
+#define APP_BG_CATEGORY_IOTCOMM_VAL 0x00040
+#define APP_BG_CATEGORY_SYSTEM_VAL 0x00080
+
+#define APP_BG_CATEGORY_USER_DISABLE_FALSE_STR "enable"
+#define APP_BG_CATEGORY_USER_DISABLE_TRUE_STR "disable"
+#define APP_BG_CATEGORY_MEDIA_STR "media"
+#define APP_BG_CATEGORY_DOWNLOAD_STR "download"
+#define APP_BG_CATEGORY_BGNETWORK_STR "background-network"
+#define APP_BG_CATEGORY_LOCATION_STR "location"
+#define APP_BG_CATEGORY_SENSOR_STR "sensor"
+#define APP_BG_CATEGORY_IOTCOMM_STR "iot-communication"
+#define APP_BG_CATEGORY_SYSTEM "system"
+
+
/**
* @brief A handle to insert certificate information
*/
typedef int (*pkgmgrinfo_app_metadata_list_cb ) (const char *metadata_key, const char *metadata_value, void *user_data);
/**
- * @fn int (*pkgmgrinfo_app_control_list_cb ) (pkgmgrinfo_appcontrol_h handle, void *user_data)
+ * @fn int (*pkgmgrinfo_app_control_list_cb ) const char *operation, const char *uri, const char *mime, void *user_data)
*
* @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_appcontrol()
*
- * @param[in] handle the appcontrol handle to be used to get operation, uri and mime info
+ * @param[in] operation, retrieved operation
+ * @param[in] uri, retrieved uri
+ * @param[in] mime, retrieved mime
* @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_appcontrol()
*
* @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
*
* @see pkgmgrinfo_appinfo_foreach_appcontrol()
*/
-typedef int (*pkgmgrinfo_app_control_list_cb ) (pkgmgrinfo_appcontrol_h handle, void *user_data);
+typedef int (*pkgmgrinfo_app_control_list_cb ) (const char *operation, const char *uri, const char *mime, void *user_data);
+
+/**
+ * @fn int (*pkgmgrinfo_app_background_category_list_cb ) (const char *category_name, void *user_data)
+ *
+ * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_background_category()
+ *
+ * @param[in] category_name retrieved background category name
+ * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_background_category
+ *
+ * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
+ *
+ * @see pkgmgrinfo_appinfo_foreach_background_category()
+ */
+typedef int (*pkgmgrinfo_app_background_category_list_cb ) (const char *category_name, void *user_data);
/**
* @brief type definition.
const char *pkgid, const char *key,
const char *val, const void *pmsg, void *data);
+typedef int (*pkgmgrinfo_handler_zone)(int req_id, const char *pkg_type,
+ const char *pkgid, const char *key,
+ const char *val, const void *pmsg, void *data, const char *zone);
#ifdef __cplusplus
}
#endif
--- /dev/null
+#ifndef __PKGMGRINFO_ZONE_H__
+#define __PKGMGRINFO_ZONE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* APIs for zone-feature */
+
+
+/**
+ * @brief Set the zone name so that other APIs will be applied
+ *
+ * @remark This API is only available in host side
+ * @param[in] zone The new zone name. If it is NULL, it means host zone.
+ * @param[out] old_zone The previous zone name. Caller should provide buffer for old_zone.
+ * @param[in] len Length of the old_zone buffer. At most len bytes will be copied to the old_zone
+ * @return 0 if success, negative value(<0) if fail.
+ *
+ */
+int pkgmgrinfo_pkginfo_set_zone(const char *zone, char *old_zone, int len);
+
+int zone_pkgmgr_parser_enable_pkg(const char *pkgid, char *const tagv[], const char *zone);
+
+int zone_pkgmgr_parser_disable_pkg(const char *pkgid, char *const tagv[], const char *zone);
+
+int zone_pkgmgr_parser_set_app_background_operation(const char *appid, bool is_disable, const char *zone);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __PKGPMGRINFO_ZONE_H__ */
Name: pkgmgr-info
Summary: Packager Manager infomation api for package
-Version: 0.0.231
+Version: 0.0.230
Release: 1
Group: Application Framework/Package Management
License: Apache-2.0
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(dbus-glib-1)
-BuildRequires: pkgconfig(journal)
BuildRequires: pkgconfig(openssl)
+BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(vasum)
+
+%define appfw_feature_expansion_pkg_install 1
+%define appfw_feature_delta_update 1
+%define appfw_feature_mount_install 0
%description
Packager Manager infomation api for packaging
export CFLAGS="$CFLAGS -D_APPFW_FEATURE_PROFILE_WEARABLE"
%endif
-%cmake .
+%if 0%{?appfw_feature_expansion_pkg_install}
+_EXPANSION_PKG_INSTALL=ON
+%else
+_EXPANSION_PKG_INSTALL=OFF
+%endif
+
+%if 0%{?appfw_feature_delta_update}
+_DELTA_UPDATE=ON
+%else
+_DELTA_UPDATE=OFF
+%endif
+
+%if 0%{?appfw_feature_mount_install}
+_MOUNT_INSTALL=ON
+%else
+_MOUNT_INSTALL=OFF
+%endif
+
+
+%cmake . -D_APPFW_FEATURE_EXPANSION_PKG_INSTALL:BOOL=${_EXPANSION_PKG_INSTALL} \
+ -D_APPFW_FEATURE_DELTA_UPDATE:BOOL=${_DELTA_UPDATE} \
+ -DTIZEN_FULL_VERSION=%{tizen_full_version} \
+ -D_APPFW_FEATURE_MOUNT_INSTALL:BOOL=${_MOUNT_INSTALL}
+
make %{?jobs:-j%jobs}
%install
cp LICENSE %{buildroot}/usr/share/license/%{name}-parser
%post
-
mkdir -p /opt/usr/apps/tmp
chown 5100:5100 /opt/usr/apps/tmp
chmod 771 /opt/usr/apps/tmp
%files devel
%defattr(-,root,root,-)
%{_includedir}/pkgmgr-info.h
+%{_includedir}/pkgmgrinfo_resource.h
%{_includedir}/pkgmgrinfo_basic.h
-%{_includedir}/pkgmgrinfo_feature.h
%{_includedir}/pkgmgrinfo_type.h
+%{_includedir}/pkgmgrinfo_zone.h
%{_libdir}/pkgconfig/pkgmgr-info.pc
%{_libdir}/libpkgmgr-info.so
%{_libdir}/libpkgmgr_parser.so.*
%{_prefix}/etc/package-manager/preload/manifest.xsd
%{_prefix}/etc/package-manager/preload/xml.xsd
+%{_prefix}/etc/package-manager/preload/res.xsd
%{_prefix}/etc/package-manager/parser_path.conf
%{_prefix}/etc/package-manager/parserlib/pkgmgr_parser_plugin_list.txt
/usr/share/license/%{name}-parser
+%if 0%{?appfw_feature_delta_update}
+%{_prefix}/etc/package-manager/preload/delta_info.xsd
+%endif
%files parser-devel
%defattr(-,root,root,-)
%{_includedir}/pkgmgr/pkgmgr_parser.h
-%{_includedir}/pkgmgr/pkgmgr_parser_feature.h
%{_includedir}/pkgmgr/pkgmgr_parser_db.h
+%{_includedir}/pkgmgr/pkgmgr_parser_resource.h
%{_libdir}/pkgconfig/pkgmgr-parser.pc
%{_libdir}/libpkgmgr_parser.so
endif()
message(STATUS "version/major : ${VERSION} / ${VERSION_MAJOR}")
+IF(_APPFW_FEATURE_EXPANSION_PKG_INSTALL)
+ ADD_DEFINITIONS("-D_APPFW_FEATURE_EXPANSION_PKG_INSTALL")
+ENDIF(_APPFW_FEATURE_EXPANSION_PKG_INSTALL)
+
+IF(TIZEN_FULL_VERSION)
+ ADD_DEFINITIONS("-DTIZEN_FULL_VERSION=\"${TIZEN_FULL_VERSION}\"")
+ELSE(TIZEN_FULL_VERSION)
+ message(FATAL_ERROR "TIZEN_VERSION MUST BE declared on build flag.")
+ENDIF(TIZEN_FULL_VERSION)
+
### Get required CFLAGS, LDFLAGS from pkg-config
include(FindPkgConfig)
-pkg_check_modules(parser_pkgs REQUIRED dlog libxml-2.0 glib-2.0 sqlite3 db-util vconf journal)
+pkg_check_modules(parser_pkgs REQUIRED dlog libxml-2.0 glib-2.0 sqlite3 db-util bundle vconf vasum)
foreach(flag ${parser_pkgs_CFLAGS})
set(parser_pkgs_CFLAGS_str "${parser_pkgs_CFLAGS_str} ${flag}")
## pkgmgr_parser object (by sewook.park)
# This library is for installer backend
-add_library(pkgmgr_parser SHARED pkgmgr_parser.c pkgmgr_parser_feature.c pkgmgr_parser_db.c pkgmgr_parser_db_util.c pkgmgr_parser_plugin.c)
+add_library(pkgmgr_parser SHARED pkgmgr_parser.c pkgmgr_parser_db.c pkgmgr_parser_db_util.c pkgmgr_parser_plugin.c pkgmgr_parser_resource.c)
set_target_properties(pkgmgr_parser PROPERTIES SOVERSION ${VERSION_MAJOR})
set_target_properties(pkgmgr_parser PROPERTIES VERSION ${VERSION})
### Create pc file
configure_file(pkgmgr-parser.pc.in ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-parser.pc @ONLY)
configure_file(manifest.xsd.in manifest.xsd @ONLY)
+configure_file(res.xsd.in res.xsd @ONLY)
configure_file(xml.xsd.in xml.xsd @ONLY)
configure_file(pkgmgr_parser_plugin_list.txt.in pkgmgr_parser_plugin_list.txt @ONLY)
+IF(_APPFW_FEATURE_DELTA_UPDATE)
+ configure_file(delta_info.xsd.in delta_info.xsd @ONLY)
+ENDIF(_APPFW_FEATURE_DELTA_UPDATE)
## Install
INSTALL(TARGETS
pkgmgr_parser
DESTINATION ${LIB_INSTALL_DIR}
COMPONENT RuntimeLibraries)
+
INSTALL(FILES
pkgmgr_parser.h
DESTINATION include/pkgmgr)
+
INSTALL(FILES
pkgmgr_parser_db.h
DESTINATION include/pkgmgr)
INSTALL(FILES
- pkgmgr_parser_feature.h
+ pkgmgr_parser_resource.h
DESTINATION include/pkgmgr)
-
INSTALL(FILES
${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-parser.pc
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.xsd DESTINATION ${PREFIX}/etc/package-manager/preload/)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/res.xsd DESTINATION ${PREFIX}/etc/package-manager/preload/)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/xml.xsd DESTINATION ${PREFIX}/etc/package-manager/preload/)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr_parser_plugin_list.txt DESTINATION ${PREFIX}/etc/package-manager/parserlib/)
-
+IF(_APPFW_FEATURE_DELTA_UPDATE)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/delta_info.xsd DESTINATION ${PREFIX}/etc/package-manager/preload/)
+ENDIF(_APPFW_FEATURE_DELTA_UPDATE)
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://tizen.org/ns/delta" xmlns:delta="http://tizen.org/ns/delta">
+ <xs:element name="delta">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element ref="delta:add-files"/>
+ <xs:element ref="delta:remove-files"/>
+ <xs:element ref="delta:modify-files"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="add-files">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element name="file"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="name"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="remove-files">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element name="file"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="name"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="modify-files">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element name="file"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="name"/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
+
<xs:element ref="packages:description"/>
<xs:element ref="packages:compatibility"/>
<xs:element ref="packages:profile"/>
- <xs:element ref="packages:watch-application"/>
+ <xs:element ref="packages:watch-application"/>
+ <xs:element ref="packages:watchface"/>
<xs:element ref="packages:service-application"/>
<xs:element ref="packages:ui-application"/>
<xs:element ref="packages:ime-application"/>
<xs:element ref="packages:shortcut-list"/>
<xs:element ref="packages:livebox"/>
- <xs:element ref="packages:widget"/>
+ <xs:element ref="packages:widget"/>
+ <xs:element ref="packages:widget-application"/>
<xs:element ref="packages:account"/>
- <xs:element ref="packages:notifications"/>
- <xs:element ref="packages:privileges"/>
+ <xs:element ref="packages:notifications"/>
+ <xs:element ref="packages:privileges"/>
<xs:element ref="packages:font"/>
- <xs:element ref="packages:ime"/>
+ <xs:element ref="packages:ime"/>
</xs:choice>
+ <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##any" processContents="lax"/>
</xs:sequence>
- <xs:attribute name="storeclient-id" type="xs:string"/>
- <xs:attribute name="install-location" type="packages:InstallLocationType"/>
+ <xs:attribute name="storeclient-id" type="xs:string"/>
+ <xs:attribute name="install-location" type="xs:string"/>
<xs:attribute name="package" use="required" type="xs:string"/>
- <xs:attribute name="type" type="packages:PackageType"/>
+ <xs:attribute name="type" type="xs:string"/>
<xs:attribute name="version" use="required" type="xs:NMTOKEN"/>
<xs:attribute name="size" type="xs:NMTOKEN"/>
- <xs:attribute name="root_path" type="xs:string"/>
- <xs:attribute name="csc_path" type="xs:string"/>
- <xs:attribute name="appsetting" type="xs:boolean"/>
- <xs:attribute name="nodisplay-setting" type="xs:boolean"/>
- <xs:attribute name="url" type="xs:string"/>
- <xs:attribute name="support-disable" type="xs:boolean"/>
- <xs:attribute name="mother-package" type="xs:boolean"/>
- <xs:attribute name="api-version" type="xs:string"/>
- <xs:attribute name="support-mode" type="xs:string"/>
- <xs:attribute name="support-reset" type="xs:string"/>
+ <xs:attribute name="root_path" type="xs:string"/>
+ <xs:attribute name="csc_path" type="xs:string"/>
+ <xs:attribute name="appsetting" type="xs:boolean"/>
+ <xs:attribute name="nodisplay-setting" type="xs:boolean"/>
+ <xs:attribute name="url" type="xs:string"/>
+ <xs:attribute name="support-disable" type="xs:boolean"/>
+ <xs:attribute name="mother-package" type="xs:boolean"/>
+ <xs:attribute name="api-version" type="xs:string"/>
+ <xs:attribute name="support-mode" type="xs:string"/>
+ <xs:attribute name="support-reset" type="xs:string"/>
+ <xs:attribute name="backend-installer" type="xs:string"/>
+ <xs:attribute name="smack-label" type="xs:string"/>
+ <xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:complexType>
</xs:element>
- <xs:simpleType name="InstallLocationType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="auto"/>
- <xs:enumeration value="internal-only"/>
- <xs:enumeration value="prefer-external"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="PackageType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="rpm"/>
- <xs:enumeration value="tpk"/>
- <xs:enumeration value="wgt"/>
- <xs:enumeration value="apk"/>
- <xs:enumeration value="coretpk"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="ProfileType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="mobile"/>
- <xs:enumeration value="wearable"/>
- <xs:enumeration value="TV"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="TypeType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="capp"/>
- <xs:enumeration value="c++app"/>
- <xs:enumeration value="webapp"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="HwAccelerationType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="on"/>
- <xs:enumeration value="off"/>
- <xs:enumeration value="default"/>
- <xs:enumeration value="use-GL"/>
- <xs:enumeration value="not-use-GL"/>
- <xs:enumeration value="use-system-setting"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="ScreenReaderType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="screenreader-off"/>
- <xs:enumeration value="screenreader-on"/>
- <xs:enumeration value="use-system-setting"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="RecentImage">
- <xs:restriction base="xs:string">
- <xs:enumeration value="icon"/>
- <xs:enumeration value="capture"/>
- </xs:restriction>
- </xs:simpleType>
-
<xs:element name="author">
<xs:complexType mixed="true">
<xs:attribute name="email"/>
<xs:attribute name="href"/>
<xs:attribute ref="xml:lang"/>
+ <xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:complexType>
</xs:element>
<xs:element name="description">
<xs:complexType mixed="true">
<xs:attribute ref="xml:lang"/>
+ <xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:complexType>
</xs:element>
<xs:element name="compatibility">
- <xs:complexType/>
+ <xs:complexType>
+ <xs:anyAttribute namespace="##any" processContents="lax"/>
+ </xs:complexType>
</xs:element>
<xs:element name="profile">
<xs:complexType>
- <xs:attribute name="name" use="required" type="packages:ProfileType"/>
+ <xs:attribute name="name" use="required" type="xs:string"/>
+ <xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:complexType>
</xs:element>
<xs:element name="watch-application">
</xs:element>
+ <xs:element name="watchface">
+ </xs:element>
<xs:element name="service-application">
</xs:element>
<xs:element name="ui-application">
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element ref="packages:label"/>
<xs:element ref="packages:icon"/>
- <xs:element ref="packages:image"/>
+ <xs:element ref="packages:image"/>
<xs:element ref="packages:application-service"/>
- <xs:element ref="packages:app-control"/>
+ <xs:element ref="packages:app-control"/>
<xs:element ref="packages:category"/>
<xs:element ref="packages:metadata"/>
- <xs:element ref="packages:permission"/>
- <xs:element ref="packages:datacontrol"/>
+ <xs:element ref="packages:permission"/>
+ <xs:element ref="packages:datacontrol"/>
+ <xs:element ref="packages:background-category"/>
</xs:choice>
+ <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##any" processContents="lax"/>
</xs:sequence>
- <xs:attribute name="appid" use="required" type="xs:string"/>
+ <xs:attribute name="appid" use="required" type="xs:ID"/>
<xs:attribute name="exec" use="required"/>
- <xs:attribute name="ambient-support" type="xs:boolean"/>
<xs:attribute name="multiple" type="xs:boolean"/>
<xs:attribute name="nodisplay" type="xs:boolean"/>
<xs:attribute name="taskmanage" type="xs:boolean"/>
<xs:attribute name="enabled" type="xs:boolean"/>
- <xs:attribute name="type" use="required" type="packages:TypeType"/>
+ <xs:attribute name="type" use="required" type="xs:string"/>
<xs:attribute name="categories" type="xs:NCName"/>
<xs:attribute name="extraid"/>
- <xs:attribute name="hw-acceleration" type="packages:HwAccelerationType"/>
- <xs:attribute name="screen-reader" type="packages:ScreenReaderType"/>
- <xs:attribute name="recentimage" type="packages:RecentImage"/>
- <xs:attribute name="mainapp" type="xs:boolean"/>
+ <xs:attribute name="hw-acceleration" type="xs:string"/>
+ <xs:attribute name="screen-reader" type="xs:string"/>
+ <xs:attribute name="recentimage" type="xs:string"/>
+ <xs:attribute name="mainapp" type="xs:boolean"/>
<xs:attribute name="indicatordisplay" type="xs:boolean"/>
<xs:attribute name="portrait-effectimage" type="xs:string"/>
<xs:attribute name="landscape-effectimage" type="xs:string"/>
<xs:attribute name="effectimage-type" type="xs:string"/>
<xs:attribute name="guestmode-visibility" type="xs:string"/>
- <xs:attribute name="launchcondition" type="xs:boolean"/>
- <xs:attribute name="permission-type" type="xs:string"/>
- <xs:attribute name="component-type" type="xs:string"/>
- <xs:attribute name="submode" type="xs:boolean"/>
- <xs:attribute name="submode-mainid" type="xs:string"/>
- <xs:attribute name="process-pool" type="xs:boolean"/>
- <xs:attribute name="auto-restart" type="xs:boolean"/>
- <xs:attribute name="on-boot" type="xs:boolean"/>
- <xs:attribute name="multi-instance" type="xs:boolean"/>
- <xs:attribute name="multi-instance-mainid" type="xs:string"/>
- <xs:attribute name="ui-gadget" type="xs:boolean"/>
+ <xs:attribute name="launchcondition" type="xs:boolean"/>
+ <xs:attribute name="permission-type" type="xs:string"/>
+ <xs:attribute name="component-type" type="xs:string"/>
+ <xs:attribute name="submode" type="xs:boolean"/>
+ <xs:attribute name="submode-mainid" type="xs:string"/>
+ <xs:attribute name="process-pool" type="xs:boolean"/>
+ <xs:attribute name="auto-restart" type="xs:boolean"/>
+ <xs:attribute name="on-boot" type="xs:boolean"/>
+ <xs:attribute name="multi-instance" type="xs:boolean"/>
+ <xs:attribute name="multi-instance-mainid" type="xs:string"/>
+ <xs:attribute name="ui-gadget" type="xs:boolean"/>
+ <xs:attribute name="launch_mode" type="xs:string"/>
+ <xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:complexType>
</xs:element>
<xs:element name="ime-application">
<xs:element ref="packages:label"/>
<xs:element ref="packages:icon"/>
</xs:choice>
+ <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##any" processContents="lax"/>
</xs:sequence>
- <xs:attribute name="appid" use="required" type="xs:string"/>
+ <xs:attribute name="appid" use="required" type="xs:ID"/>
<xs:attribute name="exec" use="required" type="xs:NCName"/>
<xs:attribute name="multiple" type="xs:boolean"/>
<xs:attribute name="nodisplay" type="xs:boolean"/>
- <xs:attribute name="type" use="required" type="packages:TypeType"/>
+ <xs:attribute name="type" use="required" type="xs:string"/>
+ <xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:complexType>
</xs:element>
<xs:element name="shortcut-list">
</xs:element>
<xs:element name="widget">
</xs:element>
+ <xs:element name="widget-application">
+ </xs:element>
<xs:element name="account">
</xs:element>
<xs:element name="notifications">
<xs:element name="label">
<xs:complexType mixed="true">
<xs:attribute ref="xml:lang"/>
+ <xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:complexType>
</xs:element>
<xs:element name="icon">
- <xs:complexType mixed="true">
- <xs:attribute ref="xml:lang"/>
- <xs:attribute name="section" type="xs:string"/>
- <xs:attribute name="resolution" type="packages:ResolutionType"/>
+ <xs:complexType mixed="true">
+ <xs:attribute ref="xml:lang"/>
+ <xs:attribute name="section" type="xs:string"/>
+ <xs:attribute name="resolution" type="xs:string"/>
+ <xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:complexType>
</xs:element>
<xs:element name="image">
- <xs:complexType mixed="true">
- <xs:attribute ref="xml:lang"/>
- <xs:attribute name="section" type="xs:string"/>
- </xs:complexType>
+ <xs:complexType mixed="true">
+ <xs:attribute ref="xml:lang"/>
+ <xs:attribute name="section" type="xs:string"/>
+ <xs:anyAttribute namespace="##any" processContents="lax"/>
+ </xs:complexType>
</xs:element>
- <xs:simpleType name="SectionType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="notification"/>
- <xs:enumeration value="setting"/>
- </xs:restriction>
- </xs:simpleType>
- <xs:simpleType name="ResolutionType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="xhigh"/>
- <xs:enumeration value="high"/>
- </xs:restriction>
- </xs:simpleType>
<xs:element name="application-service">
<xs:complexType>
<xs:sequence>
<xs:element ref="packages:uri"/>
<xs:element ref="packages:mime"/>
<xs:element ref="packages:subapp"/>
+ <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##any" processContents="lax"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:element ref="packages:uri"/>
<xs:element ref="packages:mime"/>
<xs:element ref="packages:subapp"/>
+ <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##any" processContents="lax"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:complexType>
<xs:attribute name="key" use="required" type="xs:string"/>
<xs:attribute name="value" type="xs:string"/>
+ <xs:anyAttribute processContents="lax"/>
</xs:complexType>
</xs:element>
<xs:element name="permission">
- <xs:complexType>
- <xs:attribute name="type" type="xs:string"/>
- </xs:complexType>
+ <xs:complexType>
+ <xs:attribute name="type" type="xs:string"/>
+ <xs:anyAttribute processContents="lax"/>
+ </xs:complexType>
</xs:element>
<xs:element name="datacontrol">
<xs:complexType>
<xs:attribute name="providerid" type="xs:string"/>
<xs:attribute name="access" type="xs:string"/>
<xs:attribute name="type" type="xs:string"/>
+ <xs:anyAttribute processContents="lax"/>
</xs:complexType>
</xs:element>
<xs:element name="operation">
<xs:complexType>
<xs:attribute name="name" use="required"/>
+ <xs:anyAttribute processContents="lax"/>
</xs:complexType>
</xs:element>
<xs:element name="uri">
<xs:complexType>
<xs:attribute name="name" use="required"/>
+ <xs:anyAttribute processContents="lax"/>
</xs:complexType>
</xs:element>
<xs:element name="mime">
<xs:complexType>
<xs:attribute name="name" use="required"/>
+ <xs:anyAttribute processContents="lax"/>
</xs:complexType>
</xs:element>
<xs:element name="subapp">
<xs:complexType>
<xs:attribute name="name" use="required"/>
+ <xs:anyAttribute namespace="##any" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="background-category">
+ <xs:complexType mixed="true">
+ <xs:attribute name="value" type="xs:string"/>
+ <xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:complexType>
</xs:element>
</xs:schema>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://tizen.org/ns/packages" xmlns:packages="http://tizen.org/ns/packages">
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
+
+ <xs:element name="manifest">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element ref="packages:label"/>
+ <xs:element ref="packages:icon"/>
+ <xs:element ref="packages:author"/>
+ <xs:element ref="packages:description"/>
+ <xs:element ref="packages:compatibility"/>
+ <xs:element ref="packages:profile"/>
+ <xs:element ref="packages:watch-application"/>
+ <xs:element ref="packages:watchface"/>
+ <xs:element ref="packages:service-application"/>
+ <xs:element ref="packages:ui-application"/>
+ <xs:element ref="packages:ime-application"/>
+ <xs:element ref="packages:shortcut-list"/>
+ <xs:element ref="packages:livebox"/>
+ <xs:element ref="packages:widget"/>
+ <xs:element ref="packages:widget-application"/>
+ <xs:element ref="packages:account"/>
+ <xs:element ref="packages:notifications"/>
+ <xs:element ref="packages:privileges"/>
+ <xs:element ref="packages:font"/>
+ <xs:element ref="packages:ime"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="storeclient-id" type="xs:string"/>
+ <xs:attribute name="install-location" type="packages:InstallLocationType"/>
+ <xs:attribute name="package" use="required" type="xs:string"/>
+ <xs:attribute name="type" type="packages:PackageType"/>
+ <xs:attribute name="version" use="required" type="xs:NMTOKEN"/>
+ <xs:attribute name="size" type="xs:NMTOKEN"/>
+ <xs:attribute name="root_path" type="xs:string"/>
+ <xs:attribute name="csc_path" type="xs:string"/>
+ <xs:attribute name="appsetting" type="xs:boolean"/>
+ <xs:attribute name="nodisplay-setting" type="xs:boolean"/>
+ <xs:attribute name="url" type="xs:string"/>
+ <xs:attribute name="support-disable" type="xs:boolean"/>
+ <xs:attribute name="mother-package" type="xs:boolean"/>
+ <xs:attribute name="api-version" type="xs:string"/>
+ <xs:attribute name="support-mode" type="xs:string"/>
+ <xs:attribute name="support-reset" type="xs:string"/>
+ <xs:attribute name="backend-installer" type="xs:string"/>
+ <xs:attribute name="smack-label" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:simpleType name="InstallLocationType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="auto"/>
+ <xs:enumeration value="internal-only"/>
+ <xs:enumeration value="prefer-external"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="PackageType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="rpm"/>
+ <xs:enumeration value="tpk"/>
+ <xs:enumeration value="wgt"/>
+ <xs:enumeration value="apk"/>
+ <xs:enumeration value="coretpk"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="ProfileType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="mobile"/>
+ <xs:enumeration value="wearable"/>
+ <xs:enumeration value="TV"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="TypeType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="capp"/>
+ <xs:enumeration value="c++app"/>
+ <xs:enumeration value="webapp"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="HwAccelerationType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="on"/>
+ <xs:enumeration value="off"/>
+ <xs:enumeration value="default"/>
+ <xs:enumeration value="use-GL"/>
+ <xs:enumeration value="not-use-GL"/>
+ <xs:enumeration value="use-system-setting"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="ScreenReaderType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="screenreader-off"/>
+ <xs:enumeration value="screenreader-on"/>
+ <xs:enumeration value="use-system-setting"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="RecentImage">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="icon"/>
+ <xs:enumeration value="capture"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:element name="author">
+ <xs:complexType mixed="true">
+ <xs:attribute name="email"/>
+ <xs:attribute name="href"/>
+ <xs:attribute ref="xml:lang"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="description">
+ <xs:complexType mixed="true">
+ <xs:attribute ref="xml:lang"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="compatibility">
+ <xs:complexType/>
+ </xs:element>
+ <xs:element name="profile">
+ <xs:complexType>
+ <xs:attribute name="name" use="required" type="packages:ProfileType"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="watch-application">
+ </xs:element>
+ <xs:element name="watchface">
+ </xs:element>
+ <xs:element name="service-application">
+ </xs:element>
+ <xs:element name="ui-application">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element ref="packages:label"/>
+ <xs:element ref="packages:icon"/>
+ <xs:element ref="packages:image"/>
+ <xs:element ref="packages:application-service"/>
+ <xs:element ref="packages:app-control"/>
+ <xs:element ref="packages:category"/>
+ <xs:element ref="packages:metadata"/>
+ <xs:element ref="packages:permission"/>
+ <xs:element ref="packages:datacontrol"/>
+ <xs:element ref="packages:background-category"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="appid" use="required" type="xs:ID"/>
+ <xs:attribute name="exec" use="required"/>
+ <xs:attribute name="multiple" type="xs:boolean"/>
+ <xs:attribute name="nodisplay" type="xs:boolean"/>
+ <xs:attribute name="taskmanage" type="xs:boolean"/>
+ <xs:attribute name="enabled" type="xs:boolean"/>
+ <xs:attribute name="type" use="required" type="packages:TypeType"/>
+ <xs:attribute name="categories" type="xs:NCName"/>
+ <xs:attribute name="extraid"/>
+ <xs:attribute name="hw-acceleration" type="packages:HwAccelerationType"/>
+ <xs:attribute name="screen-reader" type="packages:ScreenReaderType"/>
+ <xs:attribute name="recentimage" type="packages:RecentImage"/>
+ <xs:attribute name="mainapp" type="xs:boolean"/>
+ <xs:attribute name="indicatordisplay" type="xs:boolean"/>
+ <xs:attribute name="portrait-effectimage" type="xs:string"/>
+ <xs:attribute name="landscape-effectimage" type="xs:string"/>
+ <xs:attribute name="effectimage-type" type="xs:string"/>
+ <xs:attribute name="guestmode-visibility" type="xs:string"/>
+ <xs:attribute name="launchcondition" type="xs:boolean"/>
+ <xs:attribute name="permission-type" type="xs:string"/>
+ <xs:attribute name="component-type" type="xs:string"/>
+ <xs:attribute name="submode" type="xs:boolean"/>
+ <xs:attribute name="submode-mainid" type="xs:string"/>
+ <xs:attribute name="process-pool" type="xs:boolean"/>
+ <xs:attribute name="auto-restart" type="xs:boolean"/>
+ <xs:attribute name="on-boot" type="xs:boolean"/>
+ <xs:attribute name="multi-instance" type="xs:boolean"/>
+ <xs:attribute name="multi-instance-mainid" type="xs:string"/>
+ <xs:attribute name="ui-gadget" type="xs:boolean"/>
+ <xs:attribute name="launch_mode" type="packages:LaunchType"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ime-application">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element ref="packages:label"/>
+ <xs:element ref="packages:icon"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="appid" use="required" type="xs:ID"/>
+ <xs:attribute name="exec" use="required" type="xs:NCName"/>
+ <xs:attribute name="multiple" type="xs:boolean"/>
+ <xs:attribute name="nodisplay" type="xs:boolean"/>
+ <xs:attribute name="type" use="required" type="packages:TypeType"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="shortcut-list">
+ </xs:element>
+ <xs:element name="livebox">
+ </xs:element>
+ <xs:element name="widget">
+ </xs:element>
+ <xs:element name="widget-application">
+ </xs:element>
+ <xs:element name="account">
+ </xs:element>
+ <xs:element name="notifications">
+ </xs:element>
+ <xs:element name="ime">
+ </xs:element>
+ <xs:element name="privileges">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element ref="packages:privilege"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="privilege">
+ </xs:element>
+ <xs:element name="font">
+ </xs:element>
+ <xs:element name="label">
+ <xs:complexType mixed="true">
+ <xs:attribute ref="xml:lang"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="icon">
+ <xs:complexType mixed="true">
+ <xs:attribute ref="xml:lang"/>
+ <xs:attribute name="section" type="xs:string"/>
+ <xs:attribute name="resolution" type="packages:ResolutionType"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="image">
+ <xs:complexType mixed="true">
+ <xs:attribute ref="xml:lang"/>
+ <xs:attribute name="section" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:simpleType name="SectionType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="notification"/>
+ <xs:enumeration value="setting"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="LaunchType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="caller"/>
+ <xs:enumeration value="single"/>
+ <xs:enumeration value="group"/>
+ <xs:enumeration value="singleton"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="ResolutionType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="xhigh"/>
+ <xs:enumeration value="high"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:element name="application-service">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element ref="packages:operation"/>
+ <xs:element ref="packages:uri"/>
+ <xs:element ref="packages:mime"/>
+ <xs:element ref="packages:subapp"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="app-control">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element ref="packages:operation"/>
+ <xs:element ref="packages:uri"/>
+ <xs:element ref="packages:mime"/>
+ <xs:element ref="packages:subapp"/>
+ </xs:choice>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="category">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice maxOccurs="unbounded">
+ <xs:any minOccurs="0" processContents="lax"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:anyAttribute processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="metadata">
+ <xs:complexType>
+ <xs:attribute name="key" use="required" type="xs:string"/>
+ <xs:attribute name="value" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="permission">
+ <xs:complexType>
+ <xs:attribute name="type" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="datacontrol">
+ <xs:complexType>
+ <xs:attribute name="providerid" type="xs:string"/>
+ <xs:attribute name="access" type="xs:string"/>
+ <xs:attribute name="type" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="operation">
+ <xs:complexType>
+ <xs:attribute name="name" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="uri">
+ <xs:complexType>
+ <xs:attribute name="name" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="mime">
+ <xs:complexType>
+ <xs:attribute name="name" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="subapp">
+ <xs:complexType>
+ <xs:attribute name="name" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="background-category">
+ <xs:complexType mixed="true">
+ <xs:attribute name="value" type="packages:BackgroundCategoryType"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:simpleType name="BackgroundCategoryType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="media"/>
+ <xs:enumeration value="download"/>
+ <xs:enumeration value="background-network"/>
+ <xs:enumeration value="location"/>
+ <xs:enumeration value="sensor"/>
+ <xs:enumeration value="iot-communication"/>
+ <xs:enumeration value="system"/>
+ </xs:restriction>
+ </xs:simpleType>
+</xs:schema>
#include <vconf.h>
#include <glib.h>
#include <db-util.h>
-#include <journal/appcore.h>
+#include <vasum.h>
#include "pkgmgr_parser.h"
#include "pkgmgr_parser_internal.h"
#include "pkgmgr_parser_plugin.h"
#include "pkgmgrinfo_debug.h"
+#include "pkgmgrinfo_zone.h"
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "PKGMGR_PARSER"
-#define WATCH_CLOCK_CATEGORY "http://tizen.org/category/wearable_clock"
-#define MANIFEST_RW_DIRECTORY "/opt/share/packages"
-#define MANIFEST_RO_DIRECTORY "/usr/share/packages"
+#define WATCH_CLOCK_CATEGORY "org.tizen.wmanager.WATCH_CLOCK"
+#define MANIFEST_RW_DIRECTORY "opt/share/packages"
+#define MANIFEST_RO_DIRECTORY "usr/share/packages"
#define ASCII(s) (const char *)s
#define XMLCHAR(s) (const xmlChar *)s
const char *package;
static int __ps_process_label(xmlTextReaderPtr reader, label_x *label);
-static int __ps_process_privilege(xmlTextReaderPtr reader, privilege_x *privilege);
-static int __ps_process_privileges(xmlTextReaderPtr reader, privileges_x *privileges);
+static int __ps_process_privilege(xmlTextReaderPtr reader, manifest_x *mfx);
+static int __ps_process_privileges(xmlTextReaderPtr reader, manifest_x *mfx);
static int __ps_process_deviceprofile(xmlTextReaderPtr reader, deviceprofile_x *deviceprofile);
static int __ps_process_allowed(xmlTextReaderPtr reader, allowed_x *allowed);
static int __ps_process_operation(xmlTextReaderPtr reader, operation_x *operation);
static int __ps_process_metadata(xmlTextReaderPtr reader, metadata_x *metadata);
static int __ps_process_permission(xmlTextReaderPtr reader, permission_x *permission);
static int __ps_process_compatibility(xmlTextReaderPtr reader, compatibility_x *compatibility);
+#if 0
static int __ps_process_resolution(xmlTextReaderPtr reader, resolution_x *resolution);
+#endif
static int __ps_process_request(xmlTextReaderPtr reader, request_x *request);
static int __ps_process_define(xmlTextReaderPtr reader, define_x *define);
static int __ps_process_appsvc(xmlTextReaderPtr reader, appsvc_x *appsvc);
static int __ps_process_icon(xmlTextReaderPtr reader, icon_x *icon);
static int __ps_process_author(xmlTextReaderPtr reader, author_x *author);
static int __ps_process_description(xmlTextReaderPtr reader, description_x *description);
+#if 0
static int __ps_process_capability(xmlTextReaderPtr reader, capability_x *capability);
+#endif
static int __ps_process_license(xmlTextReaderPtr reader, license_x *license);
static int __ps_process_datacontrol(xmlTextReaderPtr reader, datacontrol_x *datacontrol);
static int __ps_process_uiapplication(xmlTextReaderPtr reader, uiapplication_x *uiapplication);
static int __process_manifest(xmlTextReaderPtr reader, manifest_x * mfx);
+static int __get_patch_trimmed_api_version(const char *api_version, char **trim_api_version)
+{
+ char *trim_version = NULL;
+ char *ptr = NULL;
+
+ trim_version = strdup(api_version);
+ if (trim_version == NULL) {
+ _LOGE("out of memory");
+ return -1;
+ }
+ ptr = strchr(trim_version, '.');
+ if (ptr) {
+ ptr = strchr(++ptr, '.');
+ }
+ if (ptr) {
+ if (atoi(++ptr) == 0) {
+ *(--ptr) = '\0';
+ _LOGD("api_version (%s -> %s)", api_version, trim_version);
+ }
+ }
+
+ *trim_api_version = trim_version;
+
+ return 0;
+}
static void __save_xml_attribute(xmlTextReaderPtr reader, char *attribute, const char **xml_attribute, char *default_value)
{
}
}
-static void __save_xml_supportmode(xmlTextReaderPtr reader, manifest_x * mfx)
+static void __save_xml_support_mode(xmlTextReaderPtr reader, manifest_x * mfx)
{
xmlChar *attrib_val = xmlTextReaderGetAttribute(reader, XMLCHAR("support-mode"));
if (attrib_val) {
if (strstr(ASCII(attrib_val), "screen-reader")) {
temp_mode |= PMINFO_SUPPORT_MODE_SCREEN_READER; // PMINFO_MODE_PROP_SCREEN_READER 0x00000004
}
- sprintf(buffer, "%d", temp_mode);
+
+ snprintf(buffer,sizeof(buffer), "%d", temp_mode);
mfx->support_mode = strdup(buffer);
xmlFree(attrib_val);
} else {
}
}
-static void __save_xml_supportfeature(const char *metadata_key, uiapplication_x *uiapplication)
+static void __save_xml_support_mode_metadata(const char *value, uiapplication_x *uiapplication)
+{
+ if (value) {
+ char buffer[10] = {'\0'};
+ int temp_mode = 0;
+
+ if (uiapplication->support_mode)
+ temp_mode = atoi(uiapplication->support_mode);
+
+ if (strstr(value, "ultra-power-saving")) {
+ temp_mode |= PMINFO_SUPPORT_MODE_ULTRA_POWER_SAVING; // PMINFO_MODE_PROP_ULTRA_POWER_SAVING 0x00000001
+ } else if (strstr(value, "cool-down")) {
+ temp_mode |= PMINFO_SUPPORT_MODE_COOL_DOWN; // PMINFO_MODE_PROP_COOL_DOWN 0x00000002
+ } else if (strstr(value, "screen-reader")) {
+ temp_mode |= PMINFO_SUPPORT_MODE_SCREEN_READER; // PMINFO_MODE_PROP_SCREEN_READER 0x00000004
+ } else if (strstr(value, "activation-stub")) {
+ temp_mode |= PMINFO_SUPPORT_MODE_ACTIVATION_STUB; // PMINFO_MODE_ACTIVATION_STUB 0x00000008
+ }
+
+ snprintf(buffer, sizeof(buffer), "%d", temp_mode);
+ if(uiapplication->support_mode)
+ free((void *)uiapplication->support_mode);
+ uiapplication->support_mode = strdup(buffer);
+ }
+}
+
+#define METADATA_KEY_EFFECTIVE_APPID "http://tizen.org/metadata/effective-appid"
+#define METADATA_KEY_PREFIX_BACKGROUND_CATEGORY "http://tizen.org/metadata/background-category/"
+
+static void __save_xml_metadata(metadata_x *metadata, uiapplication_x *uiapplication)
+{
+ if (metadata && metadata->key) {
+ // companian mode check
+ if (strcmp(metadata->key, "master_app_packagename") == 0)
+ FREE_AND_STRDUP("true", uiapplication->companion_type);
+ if (strcmp(metadata->key, METADATA_KEY_EFFECTIVE_APPID) == 0) {
+ if (metadata->value)
+ FREE_AND_STRDUP(metadata->value, uiapplication->effective_appid);
+ }
+ if (strncmp(metadata->key,
+ METADATA_KEY_PREFIX_BACKGROUND_CATEGORY,
+ strlen(METADATA_KEY_PREFIX_BACKGROUND_CATEGORY)) == 0) {
+ char *background_category;
+
+ background_category = strrchr(metadata->key, '/');
+ if (background_category && strlen(background_category + 1))
+ uiapplication->background_category = g_list_append(uiapplication->background_category, strdup(background_category + 1));
+ }
+ }
+}
+
+static void __save_xml_support_feature(const char *metadata_key, uiapplication_x *uiapplication)
{
if (metadata_key) {
int temp_mode = 0;
if (uiapplication->support_feature) {
temp_mode = atoi(uiapplication->support_feature);
- FREE_AND_NULL(uiapplication->support_feature);
}
+ FREE_AND_NULL(uiapplication->support_feature);
+
+ snprintf(buffer, PKG_STRING_LEN_MAX, "%d", temp_mode);
+ uiapplication->support_feature = strdup(buffer);
+ }
+}
- if (strcmp(metadata_key, "http://developer.samsung.com/tizen/metadata/multiwindow") == 0) {
- temp_mode |= PMINFO_SUPPORT_FEATURE_MULTI_WINDOW;
- } else if (strcmp(metadata_key, "http://developer.samsung.com/tizen/metadata/oomtermination") == 0) {
- temp_mode |= PMINFO_SUPPORT_FEATURE_OOM_TERMINATION;
- } else if (strcmp(metadata_key, "http://developer.samsung.com/tizen/metadata/largememory") == 0) {
- temp_mode |= PMINFO_SUPPORT_FEATURE_LARGE_MEMORY;
+static void __save_xml_support_category(const char *category_key, uiapplication_x *uiapplication)
+{
+ if (category_key) {
+ int temp_mode = 0;
+ char buffer[PKG_STRING_LEN_MAX] = {'\0'};
+
+ if (uiapplication->support_category) {
+ temp_mode = atoi(uiapplication->support_category);
+ }
+ FREE_AND_NULL(uiapplication->support_category);
+
+ if (strcmp(category_key, "http://tizen.org/category/lockapp") == 0) {
+ temp_mode |= PMINFO_SUPPORT_CATEGORY_LOCK_APP;
+ } else if (strcmp(category_key, "http://tizen.org/category/homeapp") == 0) {
+ temp_mode |= PMINFO_SUPPORT_CATEGORY_HOME_APP;
+ } else if (strcmp(category_key, "http://tizen.org/category/ime") == 0) {
+ temp_mode |= PMINFO_SUPPORT_CATEGORY_IME_APP;
}
- sprintf(buffer, "%d", temp_mode);
- uiapplication->support_feature = strdup(buffer);
- } else {
- uiapplication->support_feature = strdup("0");
+ snprintf(buffer, PKG_STRING_LEN_MAX, "%d", temp_mode);
+ uiapplication->support_category = strdup(buffer);
}
}
-static void __save_xml_installedtime(manifest_x * mfx)
+static void __save_xml_installed_time(manifest_x * mfx)
{
char buf[PKG_STRING_LEN_MAX] = {'\0'};
char *val = NULL;
mfx->installed_time = val;
}
-static void __save_xml_defaultvalue(manifest_x * mfx)
+static void __save_xml_root_path(manifest_x * mfx)
+{
+ char root[PKG_STRING_LEN_MAX] = { '\0' };
+
+ if (mfx->root_path == NULL) {
+ if (strcmp(mfx->type,"rpm") == 0) {
+ snprintf(root, PKG_STRING_LEN_MAX - 1, "/opt/share/packages/%s.xml", mfx->package);
+ if (access(root, F_OK) == 0) {
+ memset(root, '\0', PKG_STRING_LEN_MAX);
+ snprintf(root, PKG_STRING_LEN_MAX - 1, "/opt/usr/apps/%s", mfx->package);
+ } else {
+ memset(root, '\0', PKG_STRING_LEN_MAX);
+ snprintf(root, PKG_STRING_LEN_MAX - 1, "/usr/apps/%s", mfx->package);
+ }
+ } else if (strcmp(mfx->type,"tpk") == 0) {
+ if (strcmp(mfx->backend_installer,"coretpk") == 0) {
+ snprintf(root, PKG_STRING_LEN_MAX - 1, "/opt/share/packages/%s.xml", mfx->package);
+ if (access(root, F_OK) == 0) {
+ memset(root, '\0', PKG_STRING_LEN_MAX);
+ snprintf(root, PKG_STRING_LEN_MAX - 1, "/opt/usr/apps/%s", mfx->package);
+ } else {
+ memset(root, '\0', PKG_STRING_LEN_MAX);
+ snprintf(root, PKG_STRING_LEN_MAX - 1, "/usr/apps/%s", mfx->package);
+ }
+ }
+ } else {
+ snprintf(root, PKG_STRING_LEN_MAX - 1, "/opt/usr/apps/%s", mfx->package);
+ }
+
+ mfx->root_path = strdup(root);
+ }
+}
+
+static void __save_xml_default_value(manifest_x * mfx)
{
mfx->preload = strdup("False");
mfx->removable = strdup("True");
package = mfx->package;
}
-static char *__pkgid_to_manifest(const char *pkgid)
+static char *__zone_pkgid_to_manifest(const char *pkgid, const char *zone)
{
char *manifest;
int size;
+ char *rootpath = NULL;
if (pkgid == NULL) {
_LOGE("pkgid is NULL");
return NULL;
}
- size = strlen(MANIFEST_RW_DIRECTORY) + strlen(pkgid) + 10;
+ if (zone == NULL || strlen(zone) == 0 || strcmp(zone, ZONE_HOST) == 0) {
+ size = strlen(MANIFEST_RW_DIRECTORY) + strlen(pkgid) + 11;
+ } else {
+ rootpath = __zone_get_root_path(zone);
+ if (rootpath == NULL) {
+ _LOGE("Failed to get rootpath");
+ return NULL;
+ }
+
+ size = strlen(rootpath) + strlen(MANIFEST_RW_DIRECTORY) + strlen(pkgid) + 11;
+ }
+
manifest = malloc(size);
if (manifest == NULL) {
_LOGE("No memory");
return NULL;
}
memset(manifest, '\0', size);
- snprintf(manifest, size, MANIFEST_RW_DIRECTORY "/%s.xml", pkgid);
+
+ if (zone == NULL || strlen(zone) == 0 || strcmp(zone, ZONE_HOST) == 0) {
+ snprintf(manifest, size, "/%s/%s.xml", MANIFEST_RW_DIRECTORY, pkgid);
+ } else {
+ snprintf(manifest, size, "%s%s/%s.xml", rootpath, MANIFEST_RW_DIRECTORY, pkgid);
+ }
if (access(manifest, F_OK)) {
- snprintf(manifest, size, MANIFEST_RO_DIRECTORY "/%s.xml", pkgid);
+ snprintf(manifest, size, "/%s/%s.xml", MANIFEST_RO_DIRECTORY, pkgid);
}
return manifest;
}
+static char *__pkgid_to_manifest(const char *pkgid)
+{
+ return __zone_pkgid_to_manifest(pkgid, NULL);
+}
+
static int __next_child_element(xmlTextReaderPtr reader, int depth)
{
int ret = xmlTextReaderRead(reader);
/*check tag : fota is true */
if (ret_result && strcmp(ret_result, "fota") == 0) {
ret_result = strtok(NULL, delims);
- if (strcmp(ret_result, "true") == 0) {
+ if (ret_result && strcmp(ret_result, "true") == 0) {
ret = PM_PARSER_R_OK;
}
} else
return 0;
}
-static int __ps_process_privilege(xmlTextReaderPtr reader, privilege_x *privilege)
+static int __ps_process_privilege(xmlTextReaderPtr reader, manifest_x* mfx)
{
- __save_xml_value(reader, &privilege->text);
+ xmlTextReaderRead(reader);
+ xmlChar *attrib_val = xmlTextReaderValue(reader);
+ if(attrib_val){
+ mfx->privileges = g_list_append(mfx->privileges,(gpointer)(ASCII(attrib_val)));
+ }
return 0;
}
return 0;
}
+#if 0
static int __ps_process_resolution(xmlTextReaderPtr reader, resolution_x *resolution)
{
__save_xml_attribute(reader, "mime-type", &resolution->mimetype, NULL);
__save_xml_attribute(reader, "uri-scheme", &resolution->urischeme, NULL);
return 0;
}
+#endif
static int __ps_process_request(xmlTextReaderPtr reader, request_x *request)
{
const xmlChar *node;
int ret = -1;
int depth = -1;
- allowed_x *tmp1 = NULL;
- request_x *tmp2 = NULL;
__save_xml_attribute(reader, "path", &define->path, NULL);
return -1;
}
memset(allowed, '\0', sizeof(allowed_x));
- LISTADD(define->allowed, allowed);
+ define->allowed = g_list_append(define->allowed, allowed);
ret = __ps_process_allowed(reader, allowed);
} else if (!strcmp(ASCII(node), "request")) {
request_x *request = malloc(sizeof(request_x));
return -1;
}
memset(request, '\0', sizeof(request_x));
- LISTADD(define->request, request);
+ define->request = g_list_append(define->request, request);
ret = __ps_process_request(reader, request);
} else
return -1;
}
}
- SAFE_LISTHEAD(define->allowed, tmp1);
- SAFE_LISTHEAD(define->request, tmp2);
return ret;
}
const xmlChar *node;
int ret = -1;
int depth = -1;
- operation_x *tmp1 = NULL;
- uri_x *tmp2 = NULL;
- mime_x *tmp3 = NULL;
- subapp_x *tmp4 = NULL;
depth = xmlTextReaderDepth(reader);
while ((ret = __next_child_element(reader, depth))) {
return -1;
}
memset(operation, '\0', sizeof(operation_x));
- LISTADD(appsvc->operation, operation);
+ appsvc->operation = g_list_append(appsvc->operation, operation);
ret = __ps_process_operation(reader, operation);
_LOGD("operation processing\n");
} else if (!strcmp(ASCII(node), "uri")) {
return -1;
}
memset(uri, '\0', sizeof(uri_x));
- LISTADD(appsvc->uri, uri);
+ appsvc->uri = g_list_append(appsvc->uri, uri);
ret = __ps_process_uri(reader, uri);
_LOGD("uri processing\n");
} else if (!strcmp(ASCII(node), "mime")) {
return -1;
}
memset(mime, '\0', sizeof(mime_x));
- LISTADD(appsvc->mime, mime);
+ appsvc->mime = g_list_append(appsvc->mime, mime);
ret = __ps_process_mime(reader, mime);
_LOGD("mime processing\n");
} else if (!strcmp(ASCII(node), "subapp")) {
return -1;
}
memset(subapp, '\0', sizeof(subapp_x));
- LISTADD(appsvc->subapp, subapp);
+ appsvc->subapp = g_list_append(appsvc->subapp, subapp);
ret = __ps_process_subapp(reader, subapp);
_LOGD("subapp processing\n");
} else
- return -1;
+ continue;
if (ret < 0) {
_LOGD("Processing appsvc failed\n");
return ret;
}
}
- SAFE_LISTHEAD(appsvc->operation, tmp1);
- SAFE_LISTHEAD(appsvc->uri, tmp2);
- SAFE_LISTHEAD(appsvc->mime, tmp3);
- SAFE_LISTHEAD(appsvc->subapp, tmp4);
-
__save_xml_value(reader, &appsvc->text);
return ret;
}
-static int __ps_process_privileges(xmlTextReaderPtr reader, privileges_x *privileges)
+static int __ps_process_privileges(xmlTextReaderPtr reader, manifest_x* mfx)
{
const xmlChar *node;
int ret = -1;
int depth = -1;
- privilege_x *tmp1 = NULL;
depth = xmlTextReaderDepth(reader);
while ((ret = __next_child_element(reader, depth))) {
}
if (strcmp(ASCII(node), "privilege") == 0) {
- privilege_x *privilege = malloc(sizeof(privilege_x));
- if (privilege == NULL) {
- _LOGD("Malloc Failed\n");
- return -1;
- }
- memset(privilege, '\0', sizeof(privilege_x));
- LISTADD(privileges->privilege, privilege);
- ret = __ps_process_privilege(reader, privilege);
+ ret = __ps_process_privilege(reader, mfx);
} else
return -1;
if (ret < 0) {
return ret;
}
}
- SAFE_LISTHEAD(privileges->privilege, tmp1);
return ret;
}
const xmlChar *node;
int ret = -1;
int depth = -1;
- condition_x *tmp1 = NULL;
depth = xmlTextReaderDepth(reader);
while ((ret = __next_child_element(reader, depth))) {
return -1;
}
memset(condition, '\0', sizeof(condition_x));
- LISTADD(launchconditions->condition, condition);
+ launchconditions->condition = g_list_append(launchconditions->condition, condition);
ret = __ps_process_condition(reader, condition);
} else
return -1;
}
}
- SAFE_LISTHEAD(launchconditions->condition, tmp1);
-
__save_xml_value(reader, &launchconditions->text);
return ret;
const xmlChar *node;
int ret = -1;
int depth = -1;
- define_x *tmp1 = NULL;
- request_x *tmp2 = NULL;
depth = xmlTextReaderDepth(reader);
while ((ret = __next_child_element(reader, depth))) {
node = xmlTextReaderConstName(reader);
return -1;
}
memset(define, '\0', sizeof(define_x));
- LISTADD(datashare->define, define);
+ datashare->define = g_list_append(datashare->define, define);
ret = __ps_process_define(reader, define);
} else if (!strcmp(ASCII(node), "request")) {
request_x *request= malloc(sizeof(request_x));
return -1;
}
memset(request, '\0', sizeof(request_x));
- LISTADD(datashare->request, request);
+ datashare->request = g_list_append(datashare->request, request);
ret = __ps_process_request(reader, request);
} else
return -1;
}
}
- SAFE_LISTHEAD(datashare->define, tmp1);
- SAFE_LISTHEAD(datashare->request, tmp2);
return ret;
}
snprintf(icon_with_path, len, "/opt/usr/apps/%s/shared/res/icons/default/small/%s", package, icon);
do {
if (access(icon_with_path, R_OK) == 0) break;
+ snprintf(icon_with_path, len, "/opt/usr/apps/%s/shared/res/%s", package, icon);
+ if (access(icon_with_path, R_OK) == 0) break;
snprintf(icon_with_path, len, "/opt/share/icons/%s/small/%s", theme, icon);
if (access(icon_with_path, R_OK) == 0) break;
snprintf(icon_with_path, len, "/usr/share/icons/%s/small/%s", theme, icon);
if (access(icon_with_path, R_OK) == 0) break;
/* icon path is going to be moved intto the app directory */
+ snprintf(icon_with_path, len, "/usr/apps/%s/shared/res/%s", package, icon);
+ if (access(icon_with_path, R_OK) == 0) break;
snprintf(icon_with_path, len, "/usr/apps/%s/shared/res/icons/default/small/%s", package, icon);
if (access(icon_with_path, R_OK) == 0) break;
snprintf(icon_with_path, len, "/opt/apps/%s/res/icons/%s/small/%s", package, theme, icon);
/*check tag : preload */
if (ret_result && strcmp(ret_result, "preload") == 0) {
ret_result = strtok(NULL, delims);
- if (strcmp(ret_result, "true") == 0) {
+ if (ret_result && strcmp(ret_result, "true") == 0) {
FREE_AND_NULL(mfx->preload);
mfx->preload = strdup("true");
- } else if (strcmp(ret_result, "false") == 0) {
+ } else if (ret_result && strcmp(ret_result, "false") == 0) {
FREE_AND_NULL(mfx->preload);
mfx->preload = strdup("false");
}
- /*check tag : removable*/
+ /*check tag : removable*/
} else if (ret_result && strcmp(ret_result, "removable") == 0) {
ret_result = strtok(NULL, delims);
- if (strcmp(ret_result, "true") == 0){
+ if (ret_result && strcmp(ret_result, "true") == 0){
FREE_AND_NULL(mfx->removable);
mfx->removable = strdup("true");
- } else if (strcmp(ret_result, "false") == 0) {
+ } else if (ret_result && strcmp(ret_result, "false") == 0) {
FREE_AND_NULL(mfx->removable);
mfx->removable = strdup("false");
}
- /*check tag : not matched*/
+ /*check tag : not matched*/
} else
_LOGD("tag process [%s]is not defined\n", ret_result);
tag = strdup(tagv[i]);
else {
/*update tag : system*/
- if (mfx->preload && (strcmp(mfx->preload,"true")==0) && (strcmp(mfx->removable,"false")==0)){
- FREE_AND_NULL(mfx->system);
- mfx->system = strdup("true");
+ if (mfx->preload && mfx->removable) {
+ if ((strcmp(mfx->preload, "true")==0) && (strcmp(mfx->removable, "false")==0)){
+ FREE_AND_NULL(mfx->system);
+ mfx->system = strdup("true");
+ }
}
_LOGD("tag process success...\n");
return;
return 0;
}
+#if 0
+//Function is not used anywhere
static int __ps_process_capability(xmlTextReaderPtr reader, capability_x *capability)
{
const xmlChar *node;
int ret = -1;
int depth = -1;
- resolution_x *tmp1 = NULL;
__save_xml_attribute(reader, "operation-id", &capability->operationid, NULL);
return -1;
}
memset(resolution, '\0', sizeof(resolution_x));
- LISTADD(capability->resolution, resolution);
+ capability->resolution = g_list_append(capability->resolution, resolution);
ret = __ps_process_resolution(reader, resolution);
} else
return -1;
}
}
- SAFE_LISTHEAD(capability->resolution, tmp1);
-
return ret;
}
+#endif
static int __ps_process_datacontrol(xmlTextReaderPtr reader, datacontrol_x *datacontrol)
{
const xmlChar *node;
int ret = -1;
int depth = -1;
- label_x *tmp1 = NULL;
- icon_x *tmp2 = NULL;
- appsvc_x *tmp3 = NULL;
- launchconditions_x *tmp4 = NULL;
- notification_x *tmp5 = NULL;
- datashare_x *tmp6 = NULL;
- category_x *tmp7 = NULL;
- metadata_x *tmp8 = NULL;
- image_x *tmp9 = NULL;
- permission_x *tmp10 = NULL;
- datacontrol_x *tmp11 = NULL;
__save_xml_attribute(reader, "appid", &uiapplication->appid, NULL);
retvm_if(uiapplication->appid == NULL, PM_PARSER_R_ERROR, "appid cant be NULL, appid field is mandatory\n");
__save_xml_attribute(reader, "exec", &uiapplication->exec, NULL);
- __save_xml_attribute(reader, "ambient-support", &uiapplication->ambient_support, "false");
__save_xml_attribute(reader, "nodisplay", &uiapplication->nodisplay, "false");
__save_xml_attribute(reader, "multiple", &uiapplication->multiple, "false");
__save_xml_attribute(reader, "type", &uiapplication->type, NULL);
__save_xml_attribute(reader, "multi-instance", &uiapplication->multi_instance, "false");
__save_xml_attribute(reader, "multi-instance-mainid", &uiapplication->multi_instance_mainid, NULL);
__save_xml_attribute(reader, "ui-gadget", &uiapplication->ui_gadget, "false");
+ __save_xml_attribute(reader, "launch_mode", &uiapplication->launch_mode, "single");
+
+ //set defaut value
uiapplication->multi_window = strdup("false");
+ uiapplication->companion_type = strdup("false");
uiapplication->package= strdup(package);
+ uiapplication->support_feature = strdup("0");
+ uiapplication->support_category = strdup("0");
+ uiapplication->support_mode = strdup("0");
/*hw-acceleration values are changed from use-GL/not-use-GL/use-system-setting to on/off/default*/
if (strcmp(uiapplication->hwacceleration, "use-GL") == 0) {
- free(uiapplication->hwacceleration);
+ free((void *)uiapplication->hwacceleration);
uiapplication->hwacceleration = strdup("on");
} else if (strcmp(uiapplication->hwacceleration, "not-use-GL") == 0) {
- free(uiapplication->hwacceleration);
+ free((void *)uiapplication->hwacceleration);
uiapplication->hwacceleration = strdup("off");
} else if (strcmp(uiapplication->hwacceleration, "use-system-setting") == 0) {
- free(uiapplication->hwacceleration);
+ free((void *)uiapplication->hwacceleration);
uiapplication->hwacceleration = strdup("default");
}
return -1;
}
memset(label, '\0', sizeof(label_x));
- LISTADD(uiapplication->label, label);
ret = __ps_process_label(reader, label);
+ uiapplication->label = g_list_append(uiapplication->label, label);
} else if (!strcmp(ASCII(node), "icon")) {
icon_x *icon = malloc(sizeof(icon_x));
if (icon == NULL) {
return -1;
}
memset(icon, '\0', sizeof(icon_x));
- LISTADD(uiapplication->icon, icon);
+ uiapplication->icon = g_list_append(uiapplication->icon, icon);
ret = __ps_process_icon(reader, icon);
} else if (!strcmp(ASCII(node), "image")) {
image_x *image = malloc(sizeof(image_x));
return -1;
}
memset(image, '\0', sizeof(image_x));
- LISTADD(uiapplication->image, image);
+ uiapplication->image = g_list_append(uiapplication->image, image);
ret = __ps_process_image(reader, image);
} else if (!strcmp(ASCII(node), "category")) {
category_x *category = malloc(sizeof(category_x));
return -1;
}
memset(category, '\0', sizeof(category_x));
- LISTADD(uiapplication->category, category);
+ uiapplication->category= g_list_append(uiapplication->category, category);
ret = __ps_process_category(reader, category);
+ __save_xml_support_category(category->name, uiapplication);
} else if (!strcmp(ASCII(node), "metadata")) {
metadata_x *metadata = malloc(sizeof(metadata_x));
if (metadata == NULL) {
return -1;
}
memset(metadata, '\0', sizeof(metadata_x));
- LISTADD(uiapplication->metadata, metadata);
+ uiapplication->metadata = g_list_append(uiapplication->metadata, metadata);
ret = __ps_process_metadata(reader, metadata);
- // multiwindow check
- if (strcmp(metadata->key, "http://developer.samsung.com/tizen/metadata/multiwindow") == 0)
- FREE_AND_STRDUP("true", uiapplication->multi_window);
- __save_xml_supportfeature(metadata->key, uiapplication);
+ __save_xml_metadata(metadata, uiapplication);
+ __save_xml_support_feature(metadata->key, uiapplication);
} else if (!strcmp(ASCII(node), "permission")) {
permission_x *permission = malloc(sizeof(permission_x));
if (permission == NULL) {
return -1;
}
memset(permission, '\0', sizeof(permission_x));
- LISTADD(uiapplication->permission, permission);
+ uiapplication->permission = g_list_append(uiapplication->permission, permission);
ret = __ps_process_permission(reader, permission);
} else if (!strcmp(ASCII(node), "application-service")) {
appsvc_x *appsvc = malloc(sizeof(appsvc_x));
return -1;
}
memset(appsvc, '\0', sizeof(appsvc_x));
- LISTADD(uiapplication->appsvc, appsvc);
+ uiapplication->appsvc = g_list_append(uiapplication->appsvc, appsvc);
ret = __ps_process_appsvc(reader, appsvc);
} else if (!strcmp(ASCII(node), "app-control")) {
appsvc_x *appsvc = malloc(sizeof(appsvc_x));
return -1;
}
memset(appsvc, '\0', sizeof(appsvc_x));
- LISTADD(uiapplication->appsvc, appsvc);
+ uiapplication->appsvc = g_list_append(uiapplication->appsvc, appsvc);
ret = __ps_process_appsvc(reader, appsvc);
} else if (!strcmp(ASCII(node), "data-share")) {
datashare_x *datashare = malloc(sizeof(datashare_x));
return -1;
}
memset(datashare, '\0', sizeof(datashare_x));
- LISTADD(uiapplication->datashare, datashare);
+ uiapplication->datashare = g_list_append(uiapplication->datashare, datashare);
ret = __ps_process_datashare(reader, datashare);
} else if (!strcmp(ASCII(node), "launch-conditions")) {
launchconditions_x *launchconditions = malloc(sizeof(launchconditions_x));
return -1;
}
memset(launchconditions, '\0', sizeof(launchconditions_x));
- LISTADD(uiapplication->launchconditions, launchconditions);
+ uiapplication->launchconditions = g_list_append(uiapplication->launchconditions, launchconditions);
ret = __ps_process_launchconditions(reader, launchconditions);
} else if (!strcmp(ASCII(node), "notification")) {
notification_x *notification = malloc(sizeof(notification_x));
return -1;
}
memset(notification, '\0', sizeof(notification_x));
- LISTADD(uiapplication->notification, notification);
+ uiapplication->notification = g_list_append(uiapplication->notification, notification);
ret = __ps_process_notification(reader, notification);
} else if (!strcmp(ASCII(node), "datacontrol")) {
datacontrol_x *datacontrol = malloc(sizeof(datacontrol_x));
return -1;
}
memset(datacontrol, '\0', sizeof(datacontrol_x));
- LISTADD(uiapplication->datacontrol, datacontrol);
+ uiapplication->datacontrol = g_list_append(uiapplication->datacontrol, datacontrol);
ret = __ps_process_datacontrol(reader, datacontrol);
+ } else if (!strcmp(ASCII(node), "background-category")) {
+ const char *background_category = NULL;
+ __save_xml_attribute(reader, "value", &background_category, NULL);
+ if (background_category != NULL)
+ uiapplication->background_category = g_list_append(uiapplication->background_category, (gpointer)background_category);
+ } else if (!strcmp(ASCII(node), "support-size")) {
+ /*temporary workaround code for widget-application. */
+ FREE_AND_STRDUP("true", uiapplication->nodisplay);
+ FREE_AND_STRDUP("false", uiapplication->multiple);
+ FREE_AND_STRDUP("capp", uiapplication->type);
+ FREE_AND_STRDUP("false", uiapplication->taskmanage);
+ FREE_AND_STRDUP("false", uiapplication->indicatordisplay);
+ FREE_AND_STRDUP("widgetapp", uiapplication->component_type);
} else
- return -1;
+ _LOGD("not handling node[%s]", ASCII(node));
+
if (ret < 0) {
_LOGD("Processing uiapplication failed\n");
return ret;
}
}
- SAFE_LISTHEAD(uiapplication->label, tmp1);
- SAFE_LISTHEAD(uiapplication->icon, tmp2);
- SAFE_LISTHEAD(uiapplication->appsvc, tmp3);
- SAFE_LISTHEAD(uiapplication->launchconditions, tmp4);
- SAFE_LISTHEAD(uiapplication->notification, tmp5);
- SAFE_LISTHEAD(uiapplication->datashare, tmp6);
- SAFE_LISTHEAD(uiapplication->category, tmp7);
- SAFE_LISTHEAD(uiapplication->metadata, tmp8);
- SAFE_LISTHEAD(uiapplication->image, tmp9);
- SAFE_LISTHEAD(uiapplication->permission, tmp10);
- SAFE_LISTHEAD(uiapplication->datacontrol, tmp11);
-
return ret;
}
const xmlChar *node;
int ret = -1;
int depth = -1;
- label_x *tmp1 = NULL;
- author_x *tmp2 = NULL;
- description_x *tmp3 = NULL;
- license_x *tmp4 = NULL;
- uiapplication_x *tmp5 = NULL;
- daemon_x *tmp6 = NULL;
- theme_x *tmp7 = NULL;
- font_x *tmp8 = NULL;
- ime_x *tmp9 = NULL;
- icon_x *tmp10 = NULL;
- compatibility_x *tmp11 = NULL;
- deviceprofile_x *tmp12 = NULL;
- privileges_x *tmp13 = NULL;
depth = xmlTextReaderDepth(reader);
while ((ret = __next_child_element(reader, depth))) {
return -1;
}
memset(label, '\0', sizeof(label_x));
- LISTADD(mfx->label, label);
+ mfx->label = g_list_append(mfx->label,label);
ret = __ps_process_label(reader, label);
} else if (!strcmp(ASCII(node), "author")) {
author_x *author = malloc(sizeof(author_x));
return -1;
}
memset(author, '\0', sizeof(author_x));
- LISTADD(mfx->author, author);
+ mfx->author = g_list_append(mfx->author, author);
ret = __ps_process_author(reader, author);
} else if (!strcmp(ASCII(node), "description")) {
description_x *description = malloc(sizeof(description_x));
return -1;
}
memset(description, '\0', sizeof(description_x));
- LISTADD(mfx->description, description);
+ mfx->description = g_list_append(mfx->description, description);
ret = __ps_process_description(reader, description);
} else if (!strcmp(ASCII(node), "license")) {
license_x *license = malloc(sizeof(license_x));
return -1;
}
memset(license, '\0', sizeof(license_x));
- LISTADD(mfx->license, license);
ret = __ps_process_license(reader, license);
+ mfx->license = g_list_append(mfx->license, license);
} else if (!strcmp(ASCII(node), "privileges")) {
- privileges_x *privileges = malloc(sizeof(privileges_x));
- if (privileges == NULL) {
- _LOGD("Malloc Failed\n");
- return -1;
- }
- memset(privileges, '\0', sizeof(privileges_x));
- LISTADD(mfx->privileges, privileges);
- ret = __ps_process_privileges(reader, privileges);
+ ret = __ps_process_privileges(reader, mfx);
} else if (!strcmp(ASCII(node), "ui-application")) {
uiapplication_x *uiapplication = malloc(sizeof(uiapplication_x));
if (uiapplication == NULL) {
return -1;
}
memset(uiapplication, '\0', sizeof(uiapplication_x));
- LISTADD(mfx->uiapplication, uiapplication);
+ mfx->uiapplication = g_list_append(mfx->uiapplication, uiapplication);
ret = __ps_process_uiapplication(reader, uiapplication);
} else if (!strcmp(ASCII(node), "service-application")) {
uiapplication_x *uiapplication = malloc(sizeof(uiapplication_x));
return -1;
}
memset(uiapplication, '\0', sizeof(uiapplication_x));
- LISTADD(mfx->uiapplication, uiapplication);
+ mfx->uiapplication = g_list_append(mfx->uiapplication, uiapplication);
ret = __ps_process_uiapplication(reader, uiapplication);
FREE_AND_STRDUP("svcapp", uiapplication->component_type);
+ } else if (!strcmp(ASCII(node), "widget-application")) {
+ _LOGD("handling widget-application");
+ uiapplication_x *uiapplication = malloc(sizeof(uiapplication_x));
+ if (uiapplication == NULL) {
+ _LOGE("Malloc Failed\n");
+ return -1;
+ }
+ memset(uiapplication, '\0', sizeof(uiapplication_x));
+ mfx->uiapplication = g_list_append(mfx->uiapplication, uiapplication);
+ ret = __ps_process_uiapplication(reader, uiapplication);
} else if (!strcmp(ASCII(node), "watch-application")) {
- category_x *tmp_category;
- int watch_category_set = 0;
-
uiapplication_x *uiapplication = malloc(sizeof(uiapplication_x));
if (uiapplication == NULL) {
_LOGD("Malloc Failed\n");
return -1;
}
memset(uiapplication, '\0', sizeof(uiapplication_x));
- LISTADD(mfx->uiapplication, uiapplication);
+ mfx->uiapplication = g_list_append(mfx->uiapplication, uiapplication);
ret = __ps_process_uiapplication(reader, uiapplication);
FREE_AND_STRDUP("watchapp", uiapplication->component_type);
FREE_AND_STRDUP("true", uiapplication->nodisplay);
FREE_AND_STRDUP("false", uiapplication->taskmanage);
if (uiapplication->type == NULL)
FREE_AND_STRDUP("capp", uiapplication->type);
-
- for (tmp_category = uiapplication->category;
- tmp_category != NULL;
- tmp_category = tmp_category->next)
- {
- if (strcmp(tmp_category->name,
- WATCH_CLOCK_CATEGORY) == 0) {
- watch_category_set = 1;
- break;
- }
- }
-
- if (watch_category_set == 0) {
- category_x *category = malloc(sizeof(category_x));
- if (category == NULL) {
- _LOGD("Malloc Failed\n");
- return -1;
- }
- memset(category, '\0', sizeof(category_x));
- LISTADD(uiapplication->category, category);
- category->name = strdup(WATCH_CLOCK_CATEGORY);
+ category_x *category = malloc(sizeof(category_x));
+ if (category == NULL) {
+ _LOGD("Malloc Failed\n");
+ return -1;
}
-
- SAFE_LISTHEAD(uiapplication->category, tmp_category);
+ memset(category, '\0', sizeof(category_x));
+ uiapplication->category = g_list_append(uiapplication->category, category);
+ category->name = strdup(WATCH_CLOCK_CATEGORY);
} else if (!strcmp(ASCII(node), "daemon")) {
daemon_x *daemon = malloc(sizeof(daemon_x));
if (daemon == NULL) {
return -1;
}
memset(daemon, '\0', sizeof(daemon_x));
- LISTADD(mfx->daemon, daemon);
ret = __ps_process_daemon(reader, daemon);
+ mfx->daemon = g_list_append(mfx->daemon,daemon);
} else if (!strcmp(ASCII(node), "theme")) {
theme_x *theme = malloc(sizeof(theme_x));
if (theme == NULL) {
return -1;
}
memset(theme, '\0', sizeof(theme_x));
- LISTADD(mfx->theme, theme);
ret = __ps_process_theme(reader, theme);
+ mfx->theme = g_list_append(mfx->theme,theme);
} else if (!strcmp(ASCII(node), "font")) {
font_x *font = malloc(sizeof(font_x));
if (font == NULL) {
return -1;
}
memset(font, '\0', sizeof(font_x));
- LISTADD(mfx->font, font);
ret = __ps_process_font(reader, font);
+ mfx->font = g_list_append(mfx->font,font);
} else if (!strcmp(ASCII(node), "ime")) {
ime_x *ime = malloc(sizeof(ime_x));
if (ime == NULL) {
return -1;
}
memset(ime, '\0', sizeof(ime_x));
- LISTADD(mfx->ime, ime);
ret = __ps_process_ime(reader, ime);
+ mfx->ime = g_list_append(mfx->ime,ime);
} else if (!strcmp(ASCII(node), "icon")) {
icon_x *icon = malloc(sizeof(icon_x));
if (icon == NULL) {
return -1;
}
memset(icon, '\0', sizeof(icon_x));
- LISTADD(mfx->icon, icon);
+ mfx->icon = g_list_append(mfx->icon, icon);
ret = __ps_process_icon(reader, icon);
} else if (!strcmp(ASCII(node), "profile")) {
deviceprofile_x *deviceprofile = malloc(sizeof(deviceprofile_x));
return -1;
}
memset(deviceprofile, '\0', sizeof(deviceprofile_x));
- LISTADD(mfx->deviceprofile, deviceprofile);
ret = __ps_process_deviceprofile(reader, deviceprofile);
+ mfx->deviceprofile = g_list_append(mfx->deviceprofile,deviceprofile);
} else if (!strcmp(ASCII(node), "compatibility")) {
compatibility_x *compatibility = malloc(sizeof(compatibility_x));
if (compatibility == NULL) {
return -1;
}
memset(compatibility, '\0', sizeof(compatibility_x));
- LISTADD(mfx->compatibility, compatibility);
ret = __ps_process_compatibility(reader, compatibility);
+ mfx->compatibility = g_list_append(mfx->compatibility,compatibility);
} else if (!strcmp(ASCII(node), "shortcut-list")) {
continue;
} else if (!strcmp(ASCII(node), "livebox")) { /**< @todo will be deprecated soon */
continue;
} else if (!strcmp(ASCII(node), "ime")) {
continue;
+ } else if (!strcmp(ASCII(node), "watchface")) {
+ continue;
} else
- return -1;
+ continue;
if (ret < 0) {
_LOGD("Processing manifest failed\n");
}
}
- SAFE_LISTHEAD(mfx->label, tmp1);
- SAFE_LISTHEAD(mfx->author, tmp2);
- SAFE_LISTHEAD(mfx->description, tmp3);
- SAFE_LISTHEAD(mfx->license, tmp4);
- SAFE_LISTHEAD(mfx->uiapplication, tmp5);
- SAFE_LISTHEAD(mfx->daemon, tmp6);
- SAFE_LISTHEAD(mfx->theme, tmp7);
- SAFE_LISTHEAD(mfx->font, tmp8);
- SAFE_LISTHEAD(mfx->ime, tmp9);
- SAFE_LISTHEAD(mfx->icon, tmp10);
- SAFE_LISTHEAD(mfx->compatibility, tmp11);
- SAFE_LISTHEAD(mfx->deviceprofile, tmp12);
- SAFE_LISTHEAD(mfx->privileges, tmp13);
-
return ret;
}
{
const xmlChar *node;
int ret = -1;
+ char* default_version = NULL;
if ((ret = __next_child_element(reader, -1))) {
node = xmlTextReaderConstName(reader);
retvm_if(!node, PM_PARSER_R_ERROR, "xmlTextReaderConstName value is NULL\n");
if (!strcmp(ASCII(node), "manifest")) {
+ if (__get_patch_trimmed_api_version(TIZEN_FULL_VERSION, &default_version) < 0) {
+ _LOGE("failed to get patch-trimmed api-version");
+ return -1;
+ }
+
__save_xml_attribute(reader, "xmlns", &mfx->ns, NULL);
__save_xml_attribute(reader, "package", &mfx->package, NULL);
- retvm_if(mfx->package == NULL, PM_PARSER_R_ERROR, "package cant be NULL, package field is mandatory\n");
+ tryvm_if(mfx->package == NULL, PM_PARSER_R_ERROR, "package cant be NULL, package field is mandatory\n");
__save_xml_attribute(reader, "version", &mfx->version, NULL);
__save_xml_attribute(reader, "size", &mfx->package_size, NULL);
__save_xml_attribute(reader, "install-location", &mfx->installlocation, "internal-only");
- __save_xml_attribute(reader, "type", &mfx->type, NULL);
+ __save_xml_attribute(reader, "type", &mfx->type, "rpm");
__save_xml_attribute(reader, "root_path", &mfx->root_path, NULL);
__save_xml_attribute(reader, "csc_path", &mfx->csc_path, NULL);
__save_xml_attribute(reader, "appsetting", &mfx->appsetting, "false");
__save_xml_attribute(reader, "url", &mfx->package_url, NULL);
__save_xml_attribute(reader, "support-disable", &mfx->support_disable, "false");
__save_xml_attribute(reader, "mother-package", &mfx->mother_package, "false");
+ __save_xml_attribute(reader, "api-version", &mfx->api_version, default_version);
+ __save_xml_attribute(reader, "backend-installer", &mfx->backend_installer, NULL);
+ __save_xml_attribute(reader, "smack-label", &mfx->custom_smack_label, NULL);
- /* need to check */
- if (xmlTextReaderGetAttribute(reader, XMLCHAR("support-reset"))) {
- mfx->support_reset = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("support-reset")));
- mfx->use_reset = strdup("false");
- } else {
- mfx->use_reset = strdup("true");
- }
-
- __save_xml_supportmode(reader, mfx);
- __save_xml_installedtime(mfx);
- __save_xml_defaultvalue(mfx);
+ __save_xml_support_mode(reader, mfx);
+ __save_xml_installed_time(mfx);
+ __save_xml_root_path(mfx);
+ __save_xml_default_value(mfx);
+ FREE_AND_NULL(default_version);
ret = __start_process(reader, mfx);
} else {
_LOGD("No Manifest element found\n");
}
}
return ret;
+
+catch:
+ FREE_AND_NULL(default_version);
+ return ret;
}
return locale;
}
-static int __ail_change_info(int op, const char *appid)
-{
- void *lib_handle = NULL;
- int (*ail_desktop_operation) (const char *);
- char *aop = NULL;
- int ret = 0;
-
- if ((lib_handle = dlopen(LIBAIL_PATH, RTLD_LAZY)) == NULL) {
- _LOGE("dlopen is failed LIBAIL_PATH[%s]\n", LIBAIL_PATH);
- goto END;
- }
-
-
- switch (op) {
- case 0:
- aop = "ail_desktop_add";
- break;
- case 1:
- aop = "ail_desktop_update";
- break;
- case 2:
- aop = "ail_desktop_remove";
- break;
- case 3:
- aop = "ail_desktop_clean";
- break;
- case 4:
- aop = "ail_desktop_fota";
- break;
- default:
- goto END;
- break;
- }
-
- if ((ail_desktop_operation =
- dlsym(lib_handle, aop)) == NULL || dlerror() != NULL) {
- _LOGE("can not find symbol \n");
- goto END;
- }
-
- ret = ail_desktop_operation(appid);
-
-END:
- if (lib_handle)
- dlclose(lib_handle);
-
- return ret;
-}
-
-
/* desktop shoud be generated automatically based on manifest */
/* Currently removable, taskmanage, etc fields are not considerd. it will be decided soon.*/
static int __ps_make_nativeapp_desktop(manifest_x * mfx, const char *manifest, ACTION_TYPE action)
char *buf = NULL;
char *buftemp = NULL;
char *locale = NULL;
+ GList *ui_label = NULL;
+ label_x* label = NULL;
+ uiapplication_x *up = NULL;
+ GList *list_up = NULL;
buf = (char *)calloc(1, BUFMAX);
if (!buf) {
return -1;
}
- if (action == ACTION_UPGRADE)
- __ail_change_info(AIL_CLEAN, mfx->package);
-
- for(; mfx->uiapplication; mfx->uiapplication=mfx->uiapplication->next) {
-
- if (manifest != NULL) {
- /* skip making a deskfile and update ail, if preload app is updated */
- if(strstr(manifest, MANIFEST_RO_PREFIX)) {
- __ail_change_info(AIL_INSTALL, mfx->uiapplication->appid);
- _LOGE("preload app is update : skip and update ail : %s", manifest);
- continue;
- }
- }
+ for(list_up = mfx->uiapplication; list_up; list_up = list_up->next) {
+ up = (uiapplication_x *)list_up->data;
if(mfx->readonly && !strcasecmp(mfx->readonly, "True"))
- snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RO_PATH, mfx->uiapplication->appid);
+ snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RO_PATH, up->appid);
else
- snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RW_PATH, mfx->uiapplication->appid);
+ snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RW_PATH, up->appid);
/* skip if desktop exists
if (access(filepath, R_OK) == 0)
snprintf(buf, BUFMAX, "[Desktop Entry]\n");
fwrite(buf, 1, strlen(buf), file);
-
- for( ; mfx->uiapplication->label ; mfx->uiapplication->label = mfx->uiapplication->label->next) {
- if(!strcmp(mfx->uiapplication->label->lang, DEFAULT_LOCALE)) {
- snprintf(buf, BUFMAX, "Name=%s\n", mfx->uiapplication->label->text);
- } else {
- locale = __convert_to_system_locale(mfx->uiapplication->label->lang);
- snprintf(buf, BUFMAX, "Name[%s]=%s\n", locale,
- mfx->uiapplication->label->text);
- FREE_AND_NULL(locale);
+ ui_label = up->label;
+ for( ; ui_label ; ui_label = ui_label->next) {
+ label = (label_x*)ui_label->data;
+ if(label){
+ if(!strcmp(label->lang, DEFAULT_LOCALE)) {
+ snprintf(buf, BUFMAX, "Name=%s\n",label->text);
+ } else {
+ locale = __convert_to_system_locale(label->lang);
+ snprintf(buf, BUFMAX, "Name[%s]=%s\n", locale,
+ label->text);
+ FREE_AND_NULL(locale);
+ }
}
fwrite(buf, 1, strlen(buf), file);
}
- if(mfx->uiapplication->label && mfx->uiapplication->label->text) {
- snprintf(buf, BUFMAX, "Name=%s\n", mfx->uiapplication->label->text);
- fwrite(buf, 1, strlen(buf), file);
- }
/*
else if(mfx->label && mfx->label->text) {
snprintf(buf, BUFMAX, "Name=%s\n", mfx->label->text);
snprintf(buf, BUFMAX, "Type=Application\n");
fwrite(buf, 1, strlen(buf), file);
- if(mfx->uiapplication->exec) {
- snprintf(buf, BUFMAX, "Exec=%s\n", mfx->uiapplication->exec);
+ if(up->exec) {
+ snprintf(buf, BUFMAX, "Exec=%s\n", up->exec);
fwrite(buf, 1, strlen(buf), file);
}
- if(mfx->uiapplication->icon && mfx->uiapplication->icon->text) {
- snprintf(buf, BUFMAX, "Icon=%s\n", mfx->uiapplication->icon->text);
+ if(up->icon && (char*)((icon_x*)up->icon->data)->text) {
+ snprintf(buf, BUFMAX, "Icon=%s\n", (char*)((icon_x*)up->icon->data)->text);
fwrite(buf, 1, strlen(buf), file);
- } else if(mfx->icon && mfx->icon->text) {
- snprintf(buf, BUFMAX, "Icon=%s\n", mfx->icon->text);
+ } else if(mfx->icon && (char*)((icon_x*)mfx->icon->data)->text) {
+ snprintf(buf, BUFMAX, "Icon=%s\n", (char*)((icon_x*)mfx->icon->data)->text);
fwrite(buf, 1, strlen(buf), file);
}
// MIME types
- if(mfx->uiapplication && mfx->uiapplication->appsvc) {
- appsvc_x *asvc = mfx->uiapplication->appsvc;
+ if(up && up->appsvc) {
+ appsvc_x *asvc = NULL;
+ GList *list_asvc = up->appsvc;
mime_x *mi = NULL;
+ GList *list_mime = NULL;
const char *mime = NULL;
const char *mime_delim = "; ";
int mime_count = 0;
strncpy(buf, "MimeType=", BUFMAX-1);
- while (asvc) {
- mi = asvc->mime;
- while (mi) {
+ while (list_asvc) {
+ asvc = (appsvc_x *)list_asvc->data;
+ list_mime = asvc->mime;
+ while (list_mime) {
mime_count++;
- mime = mi->name;
- _LOGD("MIME type: %s\n", mime);
- strncat(buf, mime, BUFMAX-strlen(buf)-1);
- if(mi->next) {
+ mi = (mime_x *)list_mime->data;
+ if(mi && mi->name) {
+ mime = mi->name;
+ _LOGD("MIME type: %s\n", mime);
+ strncat(buf, mime, BUFMAX-strlen(buf)-1);
+ }
+ if(list_mime->next) {
strncat(buf, mime_delim, BUFMAX-strlen(buf)-1);
}
- mi = mi->next;
+ list_mime = list_mime->next;
mime = NULL;
}
- asvc = asvc->next;
+ list_asvc = list_asvc->next;
}
_LOGD("MIME types: buf[%s]\n", buf);
_LOGD("MIME count: %d\n", mime_count);
fwrite(buf, 1, strlen(buf), file);
}
- if(mfx->uiapplication->nodisplay) {
- snprintf(buf, BUFMAX, "NoDisplay=%s\n", mfx->uiapplication->nodisplay);
+ if(up->nodisplay) {
+ snprintf(buf, BUFMAX, "NoDisplay=%s\n", up->nodisplay);
fwrite(buf, 1, strlen(buf), file);
}
- if(mfx->uiapplication->categories) {
- snprintf(buf, BUFMAX, "Categories=%s\n", mfx->uiapplication->categories);
+ if(up->categories) {
+ snprintf(buf, BUFMAX, "Categories=%s\n", up->categories);
fwrite(buf, 1, strlen(buf), file);
}
- if(mfx->uiapplication->taskmanage && !strcasecmp(mfx->uiapplication->taskmanage, "False")) {
+ if(up->taskmanage && !strcasecmp(up->taskmanage, "False")) {
snprintf(buf, BUFMAX, "X-TIZEN-TaskManage=False\n");
fwrite(buf, 1, strlen(buf), file);
}
- if(mfx->uiapplication->enabled && !strcasecmp(mfx->uiapplication->enabled, "False")) {
+ if(up->enabled && !strcasecmp(up->enabled, "False")) {
snprintf(buf, BUFMAX, "X-TIZEN-Enabled=False\n");
fwrite(buf, 1, strlen(buf), file);
}
- if(mfx->uiapplication->hwacceleration) {
- snprintf(buf, BUFMAX, "Hw-Acceleration=%s\n", mfx->uiapplication->hwacceleration);
+ if(up->hwacceleration) {
+ snprintf(buf, BUFMAX, "Hw-Acceleration=%s\n", up->hwacceleration);
fwrite(buf, 1, strlen(buf), file);
}
- if(mfx->uiapplication->multiple && !strcasecmp(mfx->uiapplication->multiple, "True")) {
+ if(up->multiple && !strcasecmp(up->multiple, "True")) {
snprintf(buf, BUFMAX, "X-TIZEN-Multiple=True\n");
fwrite(buf, 1, strlen(buf), file);
}
- if(mfx->uiapplication->extraid) {
- snprintf(buf, BUFMAX, "X-TIZEN-PackageID=%s\n", mfx->uiapplication->extraid);
+ if(up->extraid) {
+ snprintf(buf, BUFMAX, "X-TIZEN-PackageID=%s\n", up->extraid);
fwrite(buf, 1, strlen(buf), file);
}
fwrite(buf, 1, strlen(buf), file);
}
- if(mfx->uiapplication->submode && !strcasecmp(mfx->uiapplication->submode, "True")) {
- snprintf(buf, BUFMAX, "X-TIZEN-Submode=%s\n", mfx->uiapplication->submode);
+ if(up->submode && !strcasecmp(up->submode, "True")) {
+ snprintf(buf, BUFMAX, "X-TIZEN-Submode=%s\n", up->submode);
fwrite(buf, 1, strlen(buf), file);
- snprintf(buf, BUFMAX, "X-TIZEN-SubmodeMainid=%s\n", mfx->uiapplication->submode_mainid);
+ snprintf(buf, BUFMAX, "X-TIZEN-SubmodeMainid=%s\n", up->submode_mainid);
fwrite(buf, 1, strlen(buf), file);
}
// snprintf(buf, BUFMAX, "X-TIZEN-PackageType=rpm\n");
// fwrite(buf, 1, strlen(buf), file);
-
- if(mfx->uiapplication->appsvc) {
+ if(up->appsvc) {
snprintf(buf, BUFMAX, "X-TIZEN-Svc=");
_LOGD("buf[%s]\n", buf);
-
- uiapplication_x *up = mfx->uiapplication;
appsvc_x *asvc = NULL;
+ GList *list_asvc = NULL;
operation_x *op = NULL;
+ GList *list_op = NULL;
mime_x *mi = NULL;
+ GList *list_mime = NULL;
uri_x *ui = NULL;
+ GList *list_uri = NULL;
subapp_x *sub = NULL;
+ GList *list_subapp = NULL;
const char *operation = NULL;
const char *mime = NULL;
const char *uri = NULL;
const char *subapp = NULL;
int i = 0;
-
- asvc = up->appsvc;
- while(asvc != NULL) {
- op = asvc->operation;
- while(op != NULL) {
- if (op)
+ list_asvc = up->appsvc;
+ while(list_asvc != NULL) {
+ asvc = (appsvc_x *)list_asvc->data;
+ list_op = asvc->operation;
+ while(list_op != NULL) {
+ op = (operation_x *)list_op->data;
+ if (op && op->name)
operation = op->name;
- mi = asvc->mime;
-
- do
- {
- if (mi)
- mime = mi->name;
- sub = asvc->subapp;
- do
- {
- if (sub)
- subapp = sub->name;
- ui = asvc->uri;
- do
- {
- if (ui)
- uri = ui->name;
+ list_mime = asvc->mime;
+
+ do{
+ if(list_mime){
+ mi = (mime_x *)list_mime->data;
+ if (mi)
+ mime = mi->name;
+ }
+
+ list_subapp = asvc->subapp;
+ do{
+ if(list_subapp){
+ sub = (subapp_x *)list_subapp->data;
+ if (sub)
+ subapp = sub->name;
+ }
+
+ list_uri = asvc->uri;
+ do{
+ if(list_uri){
+ ui = (uri_x *)list_uri->data;
+ if (ui)
+ uri = ui->name;
+ }
if(i++ > 0) {
strncpy(buftemp, buf, BUFMAX);
snprintf(buf, BUFMAX, "%s;", buftemp);
}
-
strncpy(buftemp, buf, BUFMAX);
snprintf(buf, BUFMAX, "%s%s|%s|%s|%s", buftemp, operation?operation:"NULL", uri?uri:"NULL", mime?mime:"NULL", subapp?subapp:"NULL");
_LOGD("buf[%s]\n", buf);
- if (ui)
- ui = ui->next;
+ if (list_uri)
+ list_uri = list_uri->next;
uri = NULL;
- } while(ui != NULL);
- if (sub)
- sub = sub->next;
+ }while(list_uri != NULL);
+ if (list_subapp)
+ list_subapp = list_subapp->next;
subapp = NULL;
- }while(sub != NULL);
- if (mi)
- mi = mi->next;
+ }while(list_subapp != NULL);
+ if (list_mime)
+ list_mime = list_mime->next;
mime = NULL;
- }while(mi != NULL);
- if (op)
- op = op->next;
+ }while(list_mime != NULL);
+ if (list_op)
+ list_op = list_op->next;
operation = NULL;
}
- asvc = asvc->next;
+ list_asvc = list_asvc->next;
}
-
fwrite(buf, 1, strlen(buf), file);
// strncpy(buftemp, buf, BUFMAX);
fd = fileno(file);
fsync(fd);
fclose(file);
- if (action == ACTION_FOTA)
- __ail_change_info(AIL_FOTA, mfx->uiapplication->appid);
- else
- __ail_change_info(AIL_INSTALL, mfx->uiapplication->appid);
}
FREE_AND_NULL(buf);
{
char filepath[PKG_STRING_LEN_MAX] = "";
int ret = 0;
- uiapplication_x *uiapplication = mfx->uiapplication;
+ uiapplication_x *uiapplication = NULL;
+ GList *list_up = mfx->uiapplication;
- for(; uiapplication; uiapplication=uiapplication->next) {
+ for(; list_up; list_up = list_up->next) {
+ uiapplication = (uiapplication_x *)list_up->data;
snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RW_PATH, uiapplication->appid);
- __ail_change_info(AIL_REMOVE, uiapplication->appid);
-
ret = remove(filepath);
if (ret <0)
return -1;
{
char filepath[PKG_STRING_LEN_MAX] = "";
int ret = 0;
- uiapplication_x *uiapplication = mfx->uiapplication;
+ uiapplication_x *uiapplication = NULL;
+ GList *list_up = g_list_first(mfx->uiapplication);
if(strstr(manifest, MANIFEST_RO_PREFIX)) {
/* if preload app is updated, then remove previous desktop file on RW*/
- for(; uiapplication; uiapplication=uiapplication->next) {
- snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RW_PATH, uiapplication->appid);
+ for(; list_up; list_up = list_up->next) {
+ uiapplication = (uiapplication_x *)list_up->data;
+ snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RW_PATH, uiapplication->appid);
ret = remove(filepath);
if (ret <0)
return -1;
return 0;
}
-static int __get_appid_list(const char *pkgid, void *user_data)
+static int __zone_get_appid_list(const char *pkgid, void *user_data, const char *zone)
{
int col = 0;
int cols = 0;
char *query = sqlite3_mprintf("select app_id from package_app_info where package=%Q", pkgid);
- ret = db_util_open(PKGMGR_PARSER_DB_FILE, &pkgmgr_parser_db, 0);
+
+ char db_path[PKG_STRING_LEN_MAX] = {'\0',};
+
+ if (zone == NULL || strcmp(zone, ZONE_HOST) == 0) {
+ snprintf(db_path, PKG_STRING_LEN_MAX, "%s", PKGMGR_PARSER_DB_FILE);
+ } else {
+ char *rootpath = NULL;
+ rootpath = __zone_get_root_path(zone);
+ if (rootpath == NULL) {
+ _LOGE("Failed to get rootpath");
+ sqlite3_free(query);
+ return -1;
+ }
+
+ snprintf(db_path, PKG_STRING_LEN_MAX, "%s%s", rootpath, PKGMGR_PARSER_DB_FILE);
+ }
+
+ _LOGD("db path(%s)", db_path);
+ ret = db_util_open(db_path, &pkgmgr_parser_db, 0);
+
if (ret != SQLITE_OK) {
_LOGE("open fail\n");
sqlite3_free(query);
return ret;
}
-void __call_uninstall_plugin(const char *pkgid, GList *appid_list)
+static int __get_appid_list(const char *pkgid, void *user_data)
+{
+ return __zone_get_appid_list(pkgid, user_data, NULL);
+}
+
+char *__zone_get_root_path(const char *zone)
+{
+ vsm_context_h context = NULL;
+ vsm_zone_h handle = NULL;
+ char *rootpath = NULL;
+
+ context = vsm_create_context();
+ if (context == NULL) {
+ _LOGE("Failed to create vsm context");
+ return NULL;
+ }
+
+ handle = vsm_lookup_zone_by_name(context, zone);
+ if (handle == NULL) {
+ _LOGE("Failed to lookup zone by name");
+ return NULL;
+ }
+
+ rootpath = (char *)vsm_get_zone_rootpath(handle);
+ if (rootpath == NULL) {
+ _LOGE("Failed to get rootpath");
+ return NULL;
+ }
+
+ _LOGD("rootpath : %s", rootpath);
+
+ return rootpath;
+}
+
+void __zone_call_uninstall_plugin(const char *pkgid, GList *appid_list, const char *zone)
{
char *appid = NULL;
GList *tmp_list;
}
tmp_list = appid_list;
- _pkgmgr_parser_plugin_open_db();
+ _zone_pkgmgr_parser_plugin_open_db(zone);
_pkgmgr_parser_plugin_uninstall_plugin(PKGMGR_PARSER_PLUGIN_TAG, pkgid, pkgid);
_pkgmgr_parser_plugin_close_db();
}
+void __call_uninstall_plugin(const char *pkgid, GList *appid_list)
+{
+ __zone_call_uninstall_plugin(pkgid, appid_list, NULL);
+}
+
static int __delete_pkgid_info_for_uninstallation(const char *pkgid)
{
retvm_if(pkgid == NULL, PM_PARSER_R_ERROR, "argument supplied is NULL");
else
_LOGD("DB appid info Delete Success\n");
- ret = __ail_change_info(AIL_REMOVE, appid);
- if (ret < 0)
- _LOGD("AIL_REMOVE failed\n");
-
snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RW_PATH, appid);
if (access(filepath, R_OK) == 0) {
ret = remove(filepath);
manifest_x *mfx = NULL;
int ret = -1;
- char *hash = NULL;
xmlInitParser();
mfx = pkgmgr_parser_process_manifest_xml(manifest);
_LOGD("Parsing Finished\n");
- _LOGD("Generating the hash for manifest");
- hash = pkgmgrinfo_basic_generate_hash_for_file(manifest);
- if(hash != NULL){
- mfx->hash = hash;
- _LOGD("Hash for [%s] file is [%s]\n",manifest,hash);
- }
-
__add_preload_info(mfx, manifest);
_LOGD("Added preload infomation\n");
ret = pkgmgr_parser_insert_manifest_info_in_db(mfx);
if (ret < 0) {
ret = __delete_pkgid_info_for_uninstallation(mfx->package);
+ trym_if(ret == PM_PARSER_R_ERROR, "DB Delete failed");
ret = pkgmgr_parser_insert_manifest_info_in_db(mfx);
- retvm_if(ret == PM_PARSER_R_ERROR, PM_PARSER_R_ERROR, "DB Insert failed");
+ trym_if(ret == PM_PARSER_R_ERROR, "DB Insert failed");
}
_LOGD("DB Insert Success\n");
tryvm_if(ret == PM_PARSER_R_OK, ret = PM_PARSER_R_OK, "fota install called, dont need desktop generation\n");
ret = __ps_make_nativeapp_desktop(mfx, NULL, ACTION_INSTALL);
-
if (ret == -1)
_LOGD("Creating desktop file failed\n");
else
_LOGD("Creating desktop file Success\n");
+ ret = PM_PARSER_R_OK;
catch:
pkgmgr_parser_free_manifest_xml(mfx);
_LOGD("Free Done\n");
xmlCleanupParser();
- return PM_PARSER_R_OK;
+ return ret;
}
API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[])
manifest_x *mfx = NULL;
int ret = -1;
int package_disabled = 0;
- char *hash = NULL;
xmlInitParser();
mfx = pkgmgr_parser_process_manifest_xml(manifest);
_LOGD("Parsing Finished\n");
- _LOGD("Generating the hash for manifest");
- hash = pkgmgrinfo_basic_generate_hash_for_file(manifest);
- if(hash != NULL){
- mfx->hash = hash;
- _LOGD("Hash for [%s] file is [%s]\n",manifest,hash);
- }
-
__add_preload_info(mfx, manifest);
_LOGD("Added preload infomation\n");
__check_preload_updated(mfx, manifest);
_LOGD("__pkgmgr_db_check_update_condition failed\n");
ret = pkgmgr_parser_update_manifest_info_in_db(mfx);
- retvm_if(ret == PM_PARSER_R_ERROR, PM_PARSER_R_ERROR, "DB Insert failed");
+ trym_if(ret == PM_PARSER_R_ERROR, "DB Insert failed");
_LOGD("DB Update Success\n");
if (package_disabled == 1) {
else
_LOGD("Creating desktop file Success\n");
-catch:
- journal_appcore_app_updated(mfx->package);
+ ret = PM_PARSER_R_OK;
+catch:
pkgmgr_parser_free_manifest_xml(mfx);
_LOGD("Free Done\n");
xmlCleanupParser();
- return PM_PARSER_R_OK;
+ return ret;
}
API int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, char *const tagv[])
else
_LOGD("Removing desktop file Success\n");
+ ret = PM_PARSER_R_OK;
+
pkgmgr_parser_free_manifest_xml(mfx);
_LOGD("Free Done\n");
xmlCleanupParser();
- return PM_PARSER_R_OK;
+ return ret;
}
API int pkgmgr_parser_parse_manifest_for_preload()
xmlSchemaParserCtxtPtr ctx = NULL;
xmlSchemaValidCtxtPtr vctx = NULL;
xmlSchemaPtr xschema = NULL;
+ xmlDocPtr doc = NULL;
+#ifdef _APPFW_FEATURE_DELTA_UPDATE
+ if (strstr(manifest, DELTA_INFO_XML)) {
+ ctx = xmlSchemaNewParserCtxt(DELTA_INFO_SCHEMA_FILE);
+ } else {
+ ctx = xmlSchemaNewParserCtxt(SCHEMA_FILE);
+ }
+#else
ctx = xmlSchemaNewParserCtxt(SCHEMA_FILE);
+#endif
if (ctx == NULL) {
_LOGE("xmlSchemaNewParserCtxt() Failed\n");
return PM_PARSER_R_ERROR;
ret = PM_PARSER_R_ERROR;
goto cleanup;
}
+
vctx = xmlSchemaNewValidCtxt(xschema);
if (vctx == NULL) {
_LOGE("xmlSchemaNewValidCtxt() Failed\n");
- return PM_PARSER_R_ERROR;
+ ret = PM_PARSER_R_ERROR;
+ goto cleanup;
}
xmlSchemaSetValidErrors(vctx, (xmlSchemaValidityErrorFunc) fprintf, (xmlSchemaValidityWarningFunc) fprintf, stderr);
- ret = xmlSchemaValidateFile(vctx, manifest, 0);
- if (ret == -1) {
- _LOGE("xmlSchemaValidateFile() failed\n");
+
+ doc = xmlParseFile(manifest);
+ if (doc == NULL) {
+ _LOGE("xmlParseFile() for %s failed\n", manifest);
ret = PM_PARSER_R_ERROR;
goto cleanup;
- } else if (ret == 0) {
- _LOGE("Manifest is Valid\n");
- ret = PM_PARSER_R_OK;
+ }
+
+ ret = xmlSchemaValidateDoc(vctx, doc);
+ if (ret != 0) {
+ _LOGE("xmlSchemaValidateDoc() for %s failed\n", manifest);
+ ret = PM_PARSER_R_ERROR;
goto cleanup;
} else {
- _LOGE("Manifest Validation Failed with error code %d\n", ret);
- ret = PM_PARSER_R_ERROR;
+ _LOGE("Manifest is Valid\n");
+ ret = PM_PARSER_R_OK;
goto cleanup;
}
cleanup:
- if(vctx != NULL)
+ if (doc != NULL)
+ xmlFreeDoc(doc);
+
+ if (vctx != NULL)
xmlSchemaFreeValidCtxt(vctx);
- if(ctx != NULL)
+ if (ctx != NULL)
xmlSchemaFreeParserCtxt(ctx);
- if(xschema != NULL)
+ if (xschema != NULL)
xmlSchemaFree(xschema);
return ret;
}
-API int pkgmgr_parser_enable_pkg(const char *pkgid, char *const tagv[])
+API int zone_pkgmgr_parser_enable_pkg(const char *pkgid, char *const tagv[], const char *zone)
{
retvm_if(pkgid == NULL, PM_PARSER_R_ERROR, "pkgid is NULL.");
char *manifest = NULL;
manifest_x *mfx = NULL;
- ret = pkgmgr_parser_update_enabled_pkg_info_in_db(pkgid);
+ ret = zone_pkgmgr_parser_update_enabled_pkg_info_in_db(pkgid, zone);
if (ret == -1)
_LOGD("pkgmgr_parser_update_enabled_pkg_info_in_db(%s) failed.\n", pkgid);
else
_LOGD("pkgmgr_parser_update_enabled_pkg_info_in_db(%s) succeed.\n", pkgid);
- manifest = __pkgid_to_manifest(pkgid);
+ manifest = __zone_pkgid_to_manifest(pkgid, zone);
retvm_if(manifest == NULL, PM_PARSER_R_ERROR, "manifest of pkgid(%s) is NULL.", pkgid);
xmlInitParser();
mfx = pkgmgr_parser_process_manifest_xml(manifest);
tryvm_if(mfx == NULL, ret = PM_PARSER_R_ERROR, "process_manifest_xml(%s) failed\n", pkgid);
- _pkgmgr_parser_plugin_process_plugin(mfx, manifest, ACTION_INSTALL);
+ _zone_pkgmgr_parser_plugin_process_plugin(mfx, manifest, ACTION_INSTALL, zone);
ret = PM_PARSER_R_OK;
return ret;
}
-API int pkgmgr_parser_disable_pkg(const char *pkgid, char *const tagv[])
+API int pkgmgr_parser_enable_pkg(const char *pkgid, char *const tagv[])
+{
+ return zone_pkgmgr_parser_enable_pkg(pkgid, tagv, NULL);
+}
+
+API int pkgmgr_parser_set_app_background_operation(const char *appid, bool is_disable)
+{
+ return zone_pkgmgr_parser_set_app_background_operation(appid, is_disable, NULL);
+}
+
+API int zone_pkgmgr_parser_set_app_background_operation(const char *appid, bool is_disable, const char *zone)
+{
+ int ret = -1;
+ retvm_if(appid == NULL, PM_PARSER_R_ERROR, "appid is NULL.");
+
+ ret = zone_pkgmgr_parser_update_app_disable_bg_operation_info_in_db(appid, zone, is_disable);
+ if (ret == -1) {
+ _LOGE("pkgmgr_parser_update_app_disabled_bg_operation_info_in_db[%s] failed.\n", appid);
+ return ret;
+ }
+ else
+ _LOGD("pkgmgr_parser_update_app_disabled_bg_operation_info_in_db[%s] succeed.\n", appid);
+
+ return PM_PARSER_R_OK;
+}
+
+API int zone_pkgmgr_parser_disable_pkg(const char *pkgid, char *const tagv[], const char *zone)
{
retvm_if(pkgid == NULL, PM_PARSER_R_ERROR, "pkgid is NULL.");
GList *appid_list = NULL;
/*get appid list*/
- ret = __get_appid_list(pkgid, &appid_list);
+ ret = __zone_get_appid_list(pkgid, &appid_list, zone);
retvm_if(ret < 0, PM_PARSER_R_ERROR, "Fail to get app_list");
_LOGD("call plugin uninstall\n");
/*call plugin uninstall*/
- __call_uninstall_plugin(pkgid, appid_list);
+ __zone_call_uninstall_plugin(pkgid, appid_list, zone);
- ret = pkgmgr_parser_update_disabled_pkg_info_in_db(pkgid);
+ ret = zone_pkgmgr_parser_update_disabled_pkg_info_in_db(pkgid, zone);
if (ret == -1)
_LOGD("pkgmgr_parser_update_disabled_pkg_info_in_db(%s) failed.\n", pkgid);
else
return PM_PARSER_R_OK;
}
+API int pkgmgr_parser_disable_pkg(const char *pkgid, char *const tagv[])
+{
+ return zone_pkgmgr_parser_disable_pkg(pkgid, tagv, NULL);
+}
+
/* update aliasid entry in package-app-aliasid */
API int pkgmgr_parser_insert_app_aliasid(void )
{
return pkgmgr_parser_update_app_aliasid_info_in_db();
}
+#ifdef _APPFW_FEATURE_EXPANSION_PKG_INSTALL
+API int pkgmgr_parser_insert_tep(const char *pkgid, const char *tep_name)
+{
+ return pkgmgr_parser_insert_tep_in_db(pkgid, tep_name);
+}
+
+API int pkgmgr_parser_update_tep(const char *pkgid, const char *tep_name)
+{
+ return pkgmgr_parser_update_tep_in_db(pkgid, tep_name);
+}
+
+API int pkgmgr_parser_delete_tep(const char *pkgid)
+{
+ return pkgmgr_parser_delete_tep_in_db(pkgid);
+}
+#endif
+
+#ifdef _APPFW_FEATURE_MOUNT_INSTALL
+API int pkgmgr_parser_insert_mount_install_info(const char *pkgid, bool ismount, const char *tpk_name)
+{
+ return pkgmgr_parser_insert_mount_install_info_in_db(pkgid, ismount, tpk_name);
+}
+#endif
#include <libxml/xmlreader.h>
#include "pkgmgrinfo_basic.h"
-#include "pkgmgr_parser_feature.h"
+#include "pkgmgrinfo_type.h"
+#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#define SCHEMA_FILE "/usr/etc/package-manager/preload/manifest.xsd"
+#ifdef _APPFW_FEATURE_DELTA_UPDATE
+#define DELTA_INFO_SCHEMA_FILE "/usr/etc/package-manager/preload/delta_info.xsd"
+#define DELTA_INFO_XML "delta_info.xml"
+#endif
+
#define BUFMAX 1024*128
/* so path */
#define LIBAPPSVC_PATH "/usr/lib/libappsvc.so.0"
-#define LIBAIL_PATH "/usr/lib/libail.so.0"
-
-/** Integer property for mode*/
-#define PMINFO_SUPPORT_MODE_ULTRA_POWER_SAVING 0x00000001
-#define PMINFO_SUPPORT_MODE_COOL_DOWN 0x00000002
-#define PMINFO_SUPPORT_MODE_SCREEN_READER 0x00000004
-
-#define PMINFO_SUPPORT_FEATURE_MULTI_WINDOW 0x00000001
-#define PMINFO_SUPPORT_FEATURE_OOM_TERMINATION 0x00000002
-#define PMINFO_SUPPORT_FEATURE_LARGE_MEMORY 0x00000004
/* operation_type */
typedef enum {
ACTION_MAX
} ACTION_TYPE;
-typedef enum {
- AIL_INSTALL = 0,
- AIL_UPDATE,
- AIL_REMOVE,
- AIL_CLEAN,
- AIL_FOTA,
- AIL_MAX
-} AIL_TYPE;
-
/**
* @brief API return values
*/
int pkgmgr_parser_disable_pkg(const char *pkgid, char *const tagv[]);
/**
+ * @fn int pkgmgr_parser_set_app_background_operation(const char *appid, bool is_disable)
+ * @brief This API updates the background operation flag of the application's DB.
+ *
+ * @par This API is for package-manager.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to pkgid
+ * @param[in] is_disable disable/enable application's background operation
+ * @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 enable_app_bg_operation(const char *pkgid)
+{
+ int ret = 0;
+ ret = pkgmgr_parser_set_app_background_operation(pkgid, FALSE);
+ if (ret)
+ return -1;
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgr_parser_set_app_background_operation(const char *appid, bool is_disable);
+
+/**
* @fn int pkgmgr_parser_insert_app_aliasid(void)
* @brief This API updates the app aliasid table.
*
*/
int pkgmgr_parser_update_app_aliasid(void );
+#ifdef _APPFW_FEATURE_EXPANSION_PKG_INSTALL
+/**
+ * @fn int pkgmgr_parser_insert_tep(const char *pkgid, const char *tep_name)
+ * @brief This API inserts the tep name in the db.
+ *
+ * @par This API is for package manager.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to pkgid
+ * @param[in] tep_name pointer to tep name
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ */
+int pkgmgr_parser_insert_tep(const char *pkgid, const char *tep_name);
+
+/**
+ * @fn int pkgmgr_parser_update_tep(const char *pkgid, const char *tep_name)
+ * @brief This API update the tep name in the db.
+ *
+ * @par This API is for package manager.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to pkgid
+ * @param[in] tep_name pointer to updated tep name
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ */
+int pkgmgr_parser_update_tep(const char *pkgid, const char *tep_name);
+
+/**
+ * @fn int pkgmgr_parser_delete_tep(const char *pkgid)
+ * @brief This API delete the tep path in the db.
+ *
+ * @par This API is for package manager.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] pkgid pointer to pkgid
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_ERROR internal error
+ * @pre None
+ * @post None
+ */
+int pkgmgr_parser_delete_tep(const char *pkgid);
+#endif
+
+#ifdef _APPFW_FEATURE_MOUNT_INSTALL
+int pkgmgr_parser_insert_mount_install_info(const char *pkgid, bool ismount, const char *tpk_name);
+#endif
+
/** @} */
#ifdef __cplusplus
}
#include <db-util.h>
#include <glib.h>
#include <dlfcn.h>
+#include <ctype.h>
#include "pkgmgr_parser_internal.h"
#include "pkgmgr_parser_db.h"
#include "pkgmgrinfo_debug.h"
#include "pkgmgrinfo_type.h"
+#include "pkgmgr-info.h"
#ifdef LOG_TAG
#undef LOG_TAG
#define USR_APPSVC_ALIAS_INI "/usr/share/appsvc/alias.ini"
#define OPT_APPSVC_ALIAS_INI "/opt/usr/share/appsvc/alias.ini"
#define MANIFEST_DB "/opt/dbspace/.pkgmgr_parser.db"
+
typedef int (*sqlite_query_callback)(void *data, int ncols, char **coltxt, char **colname);
sqlite3 *pkgmgr_parser_db;
sqlite3 *pkgmgr_cert_db;
-
#define QUERY_CREATE_TABLE_PACKAGE_INFO "create table if not exists package_info " \
"(package text primary key not null, " \
"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', " \
"package_mother_package text DEFAULT 'false', " \
"package_disable text DEFAULT 'false', " \
"package_support_mode text, " \
- "package_hash text, " \
+ "package_backend_installer text DEFAULT 'rpm', " \
+ "package_custom_smack_label text, " \
"package_reserve1 text," \
"package_reserve2 text," \
"package_reserve3 text," \
"(app_id text primary key not null, " \
"app_component text, " \
"app_exec text, " \
- "app_ambient_support text DEFAULT 'false', " \
"app_nodisplay text DEFAULT 'false', " \
"app_type text, " \
"app_onboot text DEFAULT 'false', " \
"app_disable text DEFAULT 'false', " \
"app_ui_gadget text DEFAULT 'false', " \
"app_removable text DEFAULT 'false', " \
+ "app_companion_type text DEFAULT 'false', " \
"app_support_mode text, " \
"app_support_feature text, " \
+ "app_support_category text, " \
"component_type text, " \
"package text not null, " \
+ "app_tep_name text, " \
"app_package_type text DEFAULT 'rpm', " \
"app_package_system text, " \
"app_package_installed_time text, " \
+ "app_launch_mode text NOT NULL DEFAULT 'caller', " \
+ "app_alias_appid text, " \
+ "app_effective_appid text, " \
+ "app_background_category INTEGER DEFAULT 0, " \
+ "app_api_version text, " \
+ "app_mount_install INTEGER DEFAULT 0, " \
+ "app_tpk_name text, " \
"app_reserve1 text, " \
"app_reserve2 text, " \
"app_reserve3 text, " \
"ON DELETE CASCADE)"
#define QUERY_CREATE_TABLE_PACKAGE_APP_ALIASID "create table if not exists package_app_aliasid" \
- "(app_id text primary key not null, "\
- "alias_id text not null)"
+ "(app_id text not null, "\
+ "alias_id text primary key not null, "\
+ "type INTEGER)"
+typedef enum {
+ ALIAS_APPID_TYPE_PREDEFINED = 0,
+ ALIAS_APPID_TYPE_APPDEFINED = 1
+} alias_appid_type;
+
+// pkgmgr parser DB
static int __insert_uiapplication_info(manifest_x *mfx);
static int __insert_uiapplication_appsvc_info(manifest_x *mfx);
static int __insert_uiapplication_appcategory_info(manifest_x *mfx);
static gint __comparefunc(gconstpointer a, gconstpointer b, gpointer userdata);
static int __pkgmgr_parser_create_db(sqlite3 **db_handle, const char *db_path);
+int __verify_label_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ if (strcasecmp(coltxt[0], PKGMGR_PARSER_EMPTY_STR) == 0) {
+ _LOGE("package_label is PKGMGR_PARSER_EMPTY_STR");
+ return -1;
+ }
+ return 0;
+}
+
+int __exec_verify_label(char *query, sqlite_query_callback callback)
+{
+ if (SQLITE_OK != sqlite3_exec(pkgmgr_parser_db, query, callback, NULL, NULL)) {
+ return -1;
+ }
+ return 0;
+}
+
static void __str_trim(char *input)
{
char *trim_str = input;
_LOGD("connect db [%s] failed!\n", db_path);
return -1;
}
+
+ char *query = NULL;
+ query = sqlite3_mprintf("PRAGMA user_version=%d", PKGMGR_PARSER_DB_VERSION);
+ ret = __evaluate_query(handle, query);
+ sqlite3_free(query);
+
*db_handle = handle;
return 0;
}
int result;
result = sqlite3_prepare_v2(db_handle, query, strlen(query), &p_statement, NULL);
if (result != SQLITE_OK) {
- _LOGE("Sqlite3 error [%d] : <%s> preparing <%s> querry\n", result, sqlite3_errmsg(db_handle), query);
+ _LOGE("Sqlite3 error [%d] : <%s> preparing <%s> query\n", result, sqlite3_errmsg(db_handle), query);
return -1;
}
return 0;
}
-GList *__create_locale_list(GList *locale, label_x *lbl, license_x *lcn, icon_x *icn, description_x *dcn, author_x *ath)
+GList *__create_locale_list(GList *locale, GList *lbl, GList *lcn, GList *icn, GList *dcn, GList *ath)
{
while(lbl != NULL)
{
- if (lbl->lang)
- locale = g_list_insert_sorted_with_data(locale, (gpointer)lbl->lang, __comparefunc, NULL);
+ label_x* label = (label_x*)lbl->data;
+ if (label && label->lang)
+ locale = g_list_insert_sorted_with_data(locale, (gpointer)label->lang, __comparefunc, NULL);
lbl = lbl->next;
}
while(lcn != NULL)
{
- if (lcn->lang)
- locale = g_list_insert_sorted_with_data(locale, (gpointer)lcn->lang, __comparefunc, NULL);
+ license_x *lic = (license_x*)lcn->data;
+ if (lic && lic->lang){
+ locale = g_list_insert_sorted_with_data(locale, (gpointer)lic->lang, __comparefunc, NULL);
+ }
lcn = lcn->next;
}
while(icn != NULL)
{
- if (icn->lang)
- locale = g_list_insert_sorted_with_data(locale, (gpointer)icn->lang, __comparefunc, NULL);
+ icon_x* icon = (icon_x*)icn->data;
+ if (icon && icon->lang){
+ locale = g_list_insert_sorted_with_data(locale, (gpointer)icon->lang, __comparefunc, NULL);
+ }
icn = icn->next;
}
while(dcn != NULL)
{
- if (dcn->lang)
- locale = g_list_insert_sorted_with_data(locale, (gpointer)dcn->lang, __comparefunc, NULL);
+ description_x *desc = (description_x*)dcn->data;
+ if (desc && desc->lang)
+ locale = g_list_insert_sorted_with_data(locale, (gpointer)desc->lang, __comparefunc, NULL);
dcn = dcn->next;
}
while(ath != NULL)
{
- if (ath->lang)
- locale = g_list_insert_sorted_with_data(locale, (gpointer)ath->lang, __comparefunc, NULL);
+ author_x* author = (author_x*)ath->data;
+ if (author && author->lang)
+ locale = g_list_insert_sorted_with_data(locale, (gpointer)author->lang, __comparefunc, NULL);
ath = ath->next;
}
return locale;
}
-static GList *__create_icon_list(GList *locale, icon_x *icn)
+static GList *__create_icon_list(GList *locale, GList *icn)
{
while(icn != NULL)
{
- if (icn->section)
- locale = g_list_insert_sorted_with_data(locale, (gpointer)icn->section, __comparefunc, NULL);
+ icon_x *icon = (icon_x*)icn->data;
+ if (icon && icon->section){
+ locale = g_list_insert_sorted_with_data(locale, (gpointer)icon->section, __comparefunc, NULL);
+ }
icn = icn->next;
}
return locale;
}
-static GList *__create_image_list(GList *locale, image_x *image)
+static GList *__create_image_list(GList *locale, GList *image)
{
while(image != NULL)
{
- if (image->section)
- locale = g_list_insert_sorted_with_data(locale, (gpointer)image->section, __comparefunc, NULL);
+ image_x* img = (image_x*)image->data;
+ if (img && img->section)
+ locale = g_list_insert_sorted_with_data(locale, (gpointer)img->section, __comparefunc, NULL);
image = image->next;
}
return locale;
return 0;
}
-void __extract_data(gpointer data, label_x *lbl, license_x *lcn, icon_x *icn, description_x *dcn, author_x *ath,
+void __extract_data(gpointer data, GList *lbl, GList *lcn, GList *icn, GList *dcn, GList *ath,
char **label, char **license, char **icon, char **description, char **author)
{
while(lbl != NULL)
{
- if (lbl->lang) {
- if (strcmp(lbl->lang, (char *)data) == 0) {
- *label = (char*)lbl->text;
+ label_x *tmp = (label_x*)lbl->data;
+ if (tmp && tmp->lang) {
+ if (strcmp(tmp->lang, (char *)data) == 0) {
+ *label = (char*)tmp->text;
break;
}
}
}
while(lcn != NULL)
{
- if (lcn->lang) {
- if (strcmp(lcn->lang, (char *)data) == 0) {
- *license = (char*)lcn->text;
+ license_x *lic = (license_x*)lcn->data;
+ if (lic && lic->lang) {
+ if (strcmp(lic->lang, (char *)data) == 0) {
+ *license = (char*)lic->text;
break;
}
}
}
while(icn != NULL)
{
- if (icn->section == NULL) {
- if (icn->lang) {
- if (strcmp(icn->lang, (char *)data) == 0) {
- *icon = (char*)icn->text;
- break;
+ icon_x *tmp = (icon_x*)icn->data;
+ if(tmp){
+ if (tmp->section == NULL) {
+ if (tmp->lang) {
+ if (strcmp(tmp->lang, (char *)data) == 0) {
+ *icon = (char*)tmp->text;
+ break;
+ }
}
}
}
}
while(dcn != NULL)
{
- if (dcn->lang) {
- if (strcmp(dcn->lang, (char *)data) == 0) {
- *description = (char*)dcn->text;
+ description_x *desc = (description_x*)dcn->data;
+ if (desc && desc->lang) {
+ if (strcmp(desc->lang, (char *)data) == 0) {
+ *description = (char*)desc->text;
break;
}
}
}
while(ath != NULL)
{
- if (ath->lang) {
- if (strcmp(ath->lang, (char *)data) == 0) {
- *author = (char*)ath->text;
+ author_x* auth = (author_x*)ath->data;
+ if (auth && auth->lang) {
+ if (strcmp(auth->lang, (char *)data) == 0) {
+ *author = (char*)auth->text;
break;
}
}
}
-static void __extract_icon_data(gpointer data, icon_x *icn, char **icon, char **resolution)
+static void __extract_icon_data(gpointer data, GList *icn, char **icon, char **resolution)
{
while(icn != NULL)
{
- if (icn->section) {
- if (strcmp(icn->section, (char *)data) == 0) {
- *icon = (char*)icn->text;
- *resolution = (char*)icn->resolution;
+ icon_x *tmp = (icon_x*)icn->data;
+ if (tmp && tmp->section) {
+ if (strcmp(tmp->section, (char *)data) == 0) {
+ *icon = (char*)tmp->text;
+ *resolution = (char*)tmp->resolution;
break;
}
}
}
}
-static void __extract_image_data(gpointer data, image_x*image, char **lang, char **img)
+static void __extract_image_data(gpointer data, GList *image, char **lang, char **img)
{
while(image != NULL)
{
- if (image->section) {
- if (strcmp(image->section, (char *)data) == 0) {
- *lang = (char*)image->lang;
- *img = (char*)image->text;
+ image_x* tmp = (image_x*)image->data;
+ if (tmp && tmp->section) {
+ if (strcmp(tmp->section, (char *)data) == 0) {
+ *lang = (char*)tmp->lang;
+ *img = (char*)tmp->text;
break;
}
}
char *query = NULL;
manifest_x *mfx = (manifest_x *)userdata;
- label_x *lbl = mfx->label;
- license_x *lcn = mfx->license;
- icon_x *icn = mfx->icon;
- description_x *dcn = mfx->description;
- author_x *ath = mfx->author;
+ GList *lbl = mfx->label;
+ GList *lcn = mfx->license;
+ GList *icn = mfx->icon;
+ GList *dcn = mfx->description;
+ GList *ath = mfx->author;
__extract_data(data, lbl, lcn, icn, dcn, ath, &label, &license, &icon, &description, &author);
if (!label && !description && !icon && !license && !author)
static int __insert_uiapplication_datacontrol_info(manifest_x *mfx)
{
- uiapplication_x *up = mfx->uiapplication;
- datacontrol_x *dc = NULL;
+ uiapplication_x *up = NULL;
+ GList *list_up = mfx->uiapplication;
+ GList *dc = NULL;
+ datacontrol_x *datacontrol = NULL;
int ret = -1;
char *query = NULL;
- while (up != NULL)
+ while (list_up != NULL)
{
+ up = (uiapplication_x *)list_up->data;
dc = up->datacontrol;
while (dc != NULL) {
- query = sqlite3_mprintf("insert into package_app_data_control(app_id, providerid, access, type) " \
- "values(%Q, %Q, %Q, %Q)", \
- up->appid,
- dc->providerid,
- dc->access,
- dc->type);
+ datacontrol = (datacontrol_x*)dc->data;
+ if(datacontrol){
+ query = sqlite3_mprintf("insert into package_app_data_control(app_id, providerid, access, type) " \
+ "values(%Q, %Q, %Q, %Q)", \
+ up->appid,
+ datacontrol->providerid,
+ datacontrol->access,
+ datacontrol->type);
- ret = __exec_query(query);
- sqlite3_free(query);
- if (ret == -1) {
- _LOGD("Package UiApp Data Control DB Insert Failed\n");
- return -1;
+ ret = __exec_query(query);
+ sqlite3_free(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp Data Control DB Insert Failed\n");
+ return -1;
+ }
}
dc = dc->next;
}
- up = up->next;
+ list_up = list_up->next;
}
return 0;
}
char *query = NULL;
uiapplication_x *up = (uiapplication_x*)userdata;
- label_x *lbl = up->label;
- icon_x *icn = up->icon;
+ GList *lbl = up->label;
+ GList *icn = up->icon;
__extract_data(data, lbl, NULL, icn, NULL, NULL, &label, NULL, &icon, NULL, NULL);
if (!label && !icon)
ret = __exec_query_no_msg(update_query);
sqlite3_free(update_query);
}
+
+ update_query = sqlite3_mprintf("select package_label from package_localized_info " \
+ "where package=%Q and package_locale=%Q", up->package, (char*)data);
+ ret = __exec_verify_label(update_query, __verify_label_cb);
+ sqlite3_free(update_query);
+ if (ret < 0) {
+ update_query = sqlite3_mprintf("update package_localized_info set package_label=%Q " \
+ "where package=%Q and package_locale=%Q", __get_str(label), up->package, (char*)data);
+ ret = __exec_query_no_msg(update_query);
+ sqlite3_free(update_query);
+ }
}
}
char * query = NULL;
uiapplication_x *up = (uiapplication_x*)userdata;
- icon_x *icn = up->icon;
+ GList *icn = up->icon;
__extract_icon_data(data, icn, &icon, &resolution);
if (!icon && !resolution)
char *query = NULL;
uiapplication_x *up = (uiapplication_x*)userdata;
- image_x *image = up->image;
+ GList *image = up->image;
__extract_image_data(data, image, &lang, &img);
if (!lang && !img)
static int __insert_ui_mainapp_info(manifest_x *mfx)
{
- uiapplication_x *up = mfx->uiapplication;
+ uiapplication_x *up = NULL;
+ GList *list_up = mfx->uiapplication;
int ret = -1;
char *query = NULL;
- while(up != NULL)
+ while(list_up != NULL)
{
+ up = (uiapplication_x *)list_up->data;
query = sqlite3_mprintf("update package_app_info set app_mainapp=%Q where app_id=%Q", up->mainapp, up->appid);
ret = __exec_query(query);
_LOGD("Package UiApp Info DB Insert Failed\n");
return -1;
}
- if (strcasecmp(up->mainapp, "True") == 0) {
- FREE_AND_NULL(mfx->mainapp_id);
+ if (strcasecmp(up->mainapp, "True")==0) {
+
+ if (mfx->mainapp_id != NULL)
+ free(mfx->mainapp_id);
+
mfx->mainapp_id = strdup(up->appid);
}
- up = up->next;
+ list_up = list_up->next;
}
if (mfx->mainapp_id == NULL){
- if (mfx->uiapplication && mfx->uiapplication->appid) {
- query = sqlite3_mprintf("update package_app_info set app_mainapp='true' where app_id=%Q", mfx->uiapplication->appid);
+ if (mfx->uiapplication && up->appid) {
+ up = (uiapplication_x *)mfx->uiapplication->data;
+ query = sqlite3_mprintf("update package_app_info set app_mainapp='true' where app_id=%Q", up->appid);
} else {
_LOGD("Not valid appid\n");
return -1;
return -1;
}
- FREE_AND_NULL(mfx->uiapplication->mainapp);
- mfx->uiapplication->mainapp= strdup("true");
- mfx->mainapp_id = strdup(mfx->uiapplication->appid);
+ FREE_AND_NULL(up->mainapp);
+ up->mainapp= strdup("true");
+ mfx->mainapp_id = strdup(up->appid);
}
query = sqlite3_mprintf("update package_info set mainapp_id=%Q where package=%Q", mfx->mainapp_id, mfx->package);
return 0;
}
+
+static int __convert_background_category(GList *category_list)
+{
+ int ret = 0;
+ GList *tmp_list = category_list;
+ char *category_data = NULL;
+
+ if (category_list == NULL)
+ return 0;
+
+ while (tmp_list != NULL) {
+ category_data = (char *)tmp_list->data;
+ if (strcmp(category_data, APP_BG_CATEGORY_MEDIA_STR) == 0) {
+ ret = ret | APP_BG_CATEGORY_MEDIA_VAL;
+ } else if (strcmp(category_data, APP_BG_CATEGORY_DOWNLOAD_STR) == 0) {
+ ret = ret | APP_BG_CATEGORY_DOWNLOAD_VAL;
+ } else if (strcmp(category_data, APP_BG_CATEGORY_BGNETWORK_STR) == 0) {
+ ret = ret | APP_BG_CATEGORY_BGNETWORK_VAL;
+ } else if (strcmp(category_data, APP_BG_CATEGORY_LOCATION_STR) == 0) {
+ ret = ret | APP_BG_CATEGORY_LOCATION_VAL;
+ } else if (strcmp(category_data, APP_BG_CATEGORY_SENSOR_STR) == 0) {
+ ret = ret | APP_BG_CATEGORY_SENSOR_VAL;
+ } else if (strcmp(category_data, APP_BG_CATEGORY_IOTCOMM_STR) == 0) {
+ ret = ret | APP_BG_CATEGORY_IOTCOMM_VAL;
+ } else if (strcmp(category_data, APP_BG_CATEGORY_SYSTEM) == 0) {
+ ret = ret | APP_BG_CATEGORY_SYSTEM_VAL;
+ } else {
+ _LOGE("Unidentified category [%s]", category_data);
+ }
+ tmp_list = g_list_next(tmp_list);
+ }
+ return ret;
+}
+
/* _PRODUCT_LAUNCHING_ENHANCED_
* up->indicatordisplay, up->portraitimg, up->landscapeimg, up->guestmode_appstatus
*/
static int __insert_uiapplication_info(manifest_x *mfx)
{
- uiapplication_x *up = mfx->uiapplication;
+ uiapplication_x *up = NULL;
+ GList *list_up = mfx->uiapplication;
int ret = -1;
+ int background_value = 0;
char *query = NULL;
char *type = NULL;
else
type = strdup("rpm");
- while(up != NULL)
+ while(list_up != NULL)
{
- query = sqlite3_mprintf("insert into package_app_info(app_id, app_component, app_exec, app_ambient_support, app_nodisplay, app_type, app_onboot, " \
+ up = (uiapplication_x *)list_up->data;
+ background_value = __convert_background_category(up->background_category);
+ if (background_value < 0) {
+ _LOGE("Failed to retrieve background value[%d]", background_value);
+ background_value = 0;
+ }
+ query = sqlite3_mprintf("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_effectimage_type, app_guestmodevisibility, app_permissiontype, "\
"app_preload, app_submode, app_submode_mainid, app_installed_storage, app_process_pool, app_multi_instance, app_multi_instance_mainid, app_multi_window, app_support_disable, "\
- "app_ui_gadget, app_removable, app_support_mode, app_support_feature, component_type, package, "\
- "app_package_type, app_package_system, app_package_installed_time"\
+ "app_ui_gadget, app_removable, app_companion_type, app_support_mode, app_support_feature, app_support_category, component_type, package, "\
+ "app_package_type, app_package_system, app_package_installed_time, app_launch_mode, app_alias_appid, app_effective_appid, app_background_category, app_api_version"\
") " \
- "values(%Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q)",\
+ "values(%Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, '%d', %Q)",\
up->appid,
"uiapp",
up->exec,
- up->ambient_support,
up->nodisplay,
up->type,
up->onboot,
mfx->support_disable,
up->ui_gadget,
mfx->removable,
+ up->companion_type,
mfx->support_mode,
up->support_feature,
+ up->support_category,
up->component_type,
mfx->package,
type,
mfx->system,
- mfx->installed_time
+ mfx->installed_time,
+ up->launch_mode,
+ __get_str(up->alias_appid),
+ __get_str(up->effective_appid),
+ background_value,
+ __get_str(mfx->api_version)
);
ret = __exec_query(query);
FREE_AND_NULL(type);
return -1;
}
- up = up->next;
+ list_up = list_up->next;
}
FREE_AND_NULL(type);
return 0;
static int __insert_uiapplication_appcategory_info(manifest_x *mfx)
{
- uiapplication_x *up = mfx->uiapplication;
- category_x *ct = NULL;
+ uiapplication_x *up = NULL;
+ GList *list_up = mfx->uiapplication;
+ category_x *category = NULL;
+ GList *ct = NULL;
int ret = -1;
char *query = NULL;
- while(up != NULL)
+ while(list_up != NULL)
{
+ up = (uiapplication_x *)list_up->data;
ct = up->category;
while (ct != NULL)
{
- query = sqlite3_mprintf("insert into package_app_app_category(app_id, category) " \
- "values(%Q, %Q)",\
- up->appid, ct->name);
- ret = __exec_query(query);
- sqlite3_free(query);
- if (ret == -1) {
- _LOGD("Package UiApp Category Info DB Insert Failed\n");
- return -1;
+ category = (category_x*)ct->data;
+ if(category){
+ query = sqlite3_mprintf("insert into package_app_app_category(app_id, category) " \
+ "values(%Q, %Q)",\
+ up->appid, category->name);
+ ret = __exec_query(query);
+ sqlite3_free(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp Category Info DB Insert Failed\n");
+ return -1;
+ }
}
ct = ct->next;
}
- up = up->next;
+ list_up = list_up->next;
+ }
+ return 0;
+}
+
+static int __insert_uiapplication_app_aliasid_info(const char* appid, const char* alisid)
+{
+ int ret = -1;
+ char *query = NULL;
+
+ query = sqlite3_mprintf("insert into package_app_aliasid(app_id, alias_id, type) values(%Q ,%Q, %d)",
+ appid,alisid,ALIAS_APPID_TYPE_APPDEFINED);
+ if(query == NULL) {
+ _LOGE("failed to mprintf query\n");
+ return -1;
+ }
+ ret = __exec_query(query);
+ sqlite3_free(query);
+ if (ret == -1) {
+ _LOGE("sqlite exec failed to insert aliasid(%s)!!\n", alisid);
+ return -1;
}
+
return 0;
}
static int __insert_uiapplication_appmetadata_info(manifest_x *mfx)
{
- uiapplication_x *up = mfx->uiapplication;
- metadata_x *md = NULL;
+ uiapplication_x *up = NULL;
+ GList *list_up = mfx->uiapplication;
+ metadata_x *metadata = NULL;
+ GList *list_md = NULL;
int ret = -1;
char *query = NULL;
- while(up != NULL)
+
+ while(list_up != NULL)
{
- md = up->metadata;
- while (md != NULL)
+ up = (uiapplication_x *)list_up->data;
+ list_md = up->metadata;
+ while (list_md != NULL)
{
- if (md->key) {
+ metadata = (metadata_x *)list_md->data;
+ if (metadata && metadata->key){
query = sqlite3_mprintf("insert into package_app_app_metadata(app_id, md_key, md_value) " \
"values(%Q, %Q, %Q)",\
- up->appid, md->key, __get_str(md->value));
+ up->appid, metadata->key, __get_str(metadata->value));
ret = __exec_query(query);
sqlite3_free(query);
if (ret == -1) {
return -1;
}
}
- md = md->next;
+ list_md = list_md->next;
}
- up = up->next;
+ list_up = list_up->next;
}
return 0;
}
static int __insert_uiapplication_apppermission_info(manifest_x *mfx)
{
- uiapplication_x *up = mfx->uiapplication;
- permission_x *pm = NULL;
+ uiapplication_x *up = NULL;
+ GList *list_up = mfx->uiapplication;
+ permission_x *perm = NULL;
+ GList *list_pm = NULL;
int ret = -1;
char *query = NULL;
- while(up != NULL)
+ while(list_up != NULL)
{
- pm = up->permission;
- while (pm != NULL)
+ up = (uiapplication_x *)list_up->data;
+ list_pm = up->permission;
+ while (list_pm != NULL)
{
- query = sqlite3_mprintf("insert into package_app_app_permission(app_id, pm_type, pm_value) " \
- "values(%Q, %Q, %Q)",\
- up->appid, pm->type, pm->value);
- ret = __exec_query(query);
- sqlite3_free(query);
- if (ret == -1) {
- _LOGD("Package UiApp permission Info DB Insert Failed\n");
- return -1;
+ perm = (permission_x*)list_pm->data;
+ if(perm){
+ query = sqlite3_mprintf("insert into package_app_app_permission(app_id, pm_type, pm_value) " \
+ "values(%Q, %Q, %Q)",\
+ up->appid, perm->type, perm->value);
+ ret = __exec_query(query);
+ sqlite3_free(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp permission Info DB Insert Failed\n");
+ return -1;
+ }
}
- pm = pm->next;
+ list_pm = list_pm->next;
}
- up = up->next;
+ list_up = list_up->next;
}
return 0;
}
char *buf = NULL;
char *buftemp = NULL;
char *query = NULL;
- uiapplication_x *up = mfx->uiapplication;
-
+ uiapplication_x *up = NULL;
+ GList *list_up = mfx->uiapplication;
buf = (char *)calloc(1, BUFMAX);
retvm_if(!buf, PMINFO_R_ERROR, "Malloc Failed\n");
buftemp = (char *)calloc(1, BUFMAX);
tryvm_if(!buftemp, ret = PMINFO_R_ERROR, "Malloc Failed\n");
- for(; up; up=up->next) {
+ for(; list_up; list_up=list_up->next) {
+ up = (uiapplication_x *)list_up->data;
if (up->appsvc) {
appsvc_x *asvc = NULL;
+ GList *list_asvc = NULL;
operation_x *op = NULL;
+ GList *list_op = NULL;
mime_x *mi = NULL;
+ GList *list_mime = NULL;
uri_x *ui = NULL;
+ GList *list_uri = NULL;
subapp_x *sub = NULL;
+ GList *list_subapp = NULL;
const char *operation = NULL;
const char *mime = NULL;
const char *uri = NULL;
memset(buf, '\0', BUFMAX);
memset(buftemp, '\0', BUFMAX);
- asvc = up->appsvc;
- while(asvc != NULL) {
- op = asvc->operation;
- while(op != NULL) {
- if (op)
+ list_asvc = up->appsvc;
+ while(list_asvc != NULL) {
+ asvc = (appsvc_x *)list_asvc->data;
+ list_op= asvc->operation;
+ while(list_op != NULL) {
+ op = (operation_x *)list_op->data;
+ if (op && op->name)
operation = op->name;
- mi = asvc->mime;
+ list_mime = asvc->mime;
+
+ do{
+ if(list_mime){
+ mi = (mime_x *)list_mime->data;
+ if (mi && mi->name)
+ mime = mi->name;
+ }
+
+ list_subapp = asvc->subapp;
+ do{
+ if(list_subapp){
+ sub = (subapp_x *)list_subapp->data;
+ if (sub && sub->name)
+ subapp = sub->name;
+ }
- do
- {
- if (mi)
- mime = mi->name;
- sub = asvc->subapp;
- do
- {
- if (sub)
- subapp = sub->name;
- ui = asvc->uri;
- do
- {
- if (ui)
- uri = ui->name;
+ list_uri = asvc->uri;
+ do{
+ if(list_uri){
+ ui = (uri_x *)list_uri->data;
+ if (ui && ui->name)
+ uri = ui->name;
+ }
if(i++ > 0) {
strncpy(buftemp, buf, BUFMAX);
}
strncpy(buftemp, buf, BUFMAX);
- snprintf(buf, BUFMAX, "%s%s|%s|%s|%s", buftemp, operation?operation:"NULL", uri?uri:"NULL", mime?mime:"NULL", subapp?subapp:"NULL");
+ snprintf(buf, BUFMAX, "%s%s|%s|%s|%s", buftemp, operation ? (strlen(operation) > 0 ? operation : "NULL") : "NULL", uri ? (strlen(uri) > 0 ? uri : "NULL") : "NULL", mime ? (strlen(mime) > 0 ? mime : "NULL") : "NULL", subapp ? (strlen(subapp) > 0 ? subapp : "NULL") : "NULL");
// _LOGD("buf[%s]\n", buf);
- if (ui)
- ui = ui->next;
+ if (list_uri)
+ list_uri = list_uri->next;
uri = NULL;
- } while(ui != NULL);
- if (sub)
- sub = sub->next;
+ }while(list_uri != NULL);
+ if (list_subapp)
+ list_subapp = list_subapp->next;
subapp = NULL;
- }while(sub != NULL);
- if (mi)
- mi = mi->next;
+ }while(list_subapp != NULL);
+ if (list_mime)
+ list_mime = list_mime->next;
mime = NULL;
- }while(mi != NULL);
- if (op)
- op = op->next;
+ }while(list_mime != NULL);
+ if (list_op)
+ list_op = list_op->next;
operation = NULL;
}
- asvc = asvc->next;
+ list_asvc = list_asvc->next;
}
- query= sqlite3_mprintf("insert into package_app_app_control(app_id, app_control) values(%Q, %Q)", up->appid, buf);
+ query= sqlite3_mprintf("insert into package_app_app_control(app_id, app_control) values(%Q, %Q)", up->appid, buf);
ret = __exec_query(query);
if (ret < 0) {
_LOGD("Package UiApp app_control DB Insert Failed\n");
static int __insert_uiapplication_appsvc_info(manifest_x *mfx)
{
- uiapplication_x *up = mfx->uiapplication;
+ uiapplication_x *up = NULL;
+ GList *list_up = mfx->uiapplication;
appsvc_x *asvc = NULL;
+ GList *list_asvc = NULL;
operation_x *op = NULL;
+ GList *list_op = NULL;
mime_x *mi = NULL;
+ GList *list_mime = NULL;
uri_x *ui = NULL;
+ GList *list_uri = NULL;
subapp_x *sub = NULL;
+ GList *list_subapp = NULL;
int ret = -1;
char *query = NULL;
const char *operation = NULL;
const char *mime = NULL;
const char *uri = NULL;
const char *subapp = NULL;
- while(up != NULL)
+
+ while(list_up != NULL)
{
- asvc = up->appsvc;
- while(asvc != NULL)
+ up = (uiapplication_x *)list_up->data;
+ list_asvc = up->appsvc;
+ while(list_asvc != NULL)
{
- op = asvc->operation;
- while(op != NULL)
+ asvc = (appsvc_x *)list_asvc->data;
+ list_op = asvc->operation;
+ while(list_op!= NULL)
{
- if (op)
+ op = (operation_x *)list_op->data;
+ if(op && op->name)
operation = op->name;
- mi = asvc->mime;
- do
- {
- if (mi)
- mime = mi->name;
- sub = asvc->subapp;
- do
- {
- if (sub)
- subapp = sub->name;
- ui = asvc->uri;
- do
- {
- if (ui)
- uri = ui->name;
+ list_mime = asvc->mime;
+ do{
+ if(list_mime){
+ mi = (mime_x *)list_mime->data;
+ if (mi)
+ mime = mi->name;
+ }
+
+ list_subapp = asvc->subapp;
+ do{
+ if(list_subapp){
+ sub = (subapp_x *)list_subapp->data;
+ if (sub)
+ subapp = sub->name;
+ }
+
+ list_uri= asvc->uri;
+ do{
+ if(list_uri){
+ ui = (uri_x *)list_uri->data;
+ if (ui && ui->name)
+ uri = ui->name;
+ }
+
query = sqlite3_mprintf("insert into package_app_app_svc(app_id, operation, uri_scheme, mime_type, subapp_name) " \
"values(%Q, %Q, %Q, %Q, %Q)",\
up->appid,
_LOGD("Package UiApp AppSvc DB Insert Failed\n");
return -1;
}
- if (ui)
- ui = ui->next;
+ if (list_uri)
+ list_uri = list_uri->next;
uri = NULL;
- } while(ui != NULL);
- if (sub)
- sub = sub->next;
+ }while(list_uri != NULL);
+ if (list_subapp)
+ list_subapp = list_subapp->next;
subapp = NULL;
- }while(sub != NULL);
- if (mi)
- mi = mi->next;
+ }while(list_subapp != NULL);
+ if (list_mime)
+ list_mime = list_mime->next;
mime = NULL;
- }while(mi != NULL);
- if (op)
- op = op->next;
+ }while(list_mime != NULL);
+ if (list_op)
+ list_op = list_op->next;
operation = NULL;
}
- asvc = asvc->next;
+ list_asvc = list_asvc->next;
}
- up = up->next;
+ list_up = list_up->next;
}
return 0;
}
static int __insert_uiapplication_share_request_info(manifest_x *mfx)
{
- uiapplication_x *up = mfx->uiapplication;
- datashare_x *ds = NULL;
- request_x *rq = NULL;
+ uiapplication_x *up = NULL;
+ GList *list_up = mfx->uiapplication;
+ GList *ds = NULL;
+ datashare_x *datashare = NULL;
+ GList *rq = NULL;
+ request_x *req = NULL;
int ret = -1;
char *query = NULL;
- while(up != NULL)
+
+ while(list_up != NULL)
{
+ up = (uiapplication_x *)list_up->data;
ds = up->datashare;
while(ds != NULL)
{
- rq = ds->request;
+ datashare = (datashare_x*)ds->data;
+ rq = datashare->request;
while(rq != NULL)
{
- query = sqlite3_mprintf("insert into package_app_share_request(app_id, data_share_request) " \
- "values(%Q, %Q)",\
- up->appid, rq->text);
- ret = __exec_query(query);
- sqlite3_free(query);
- if (ret == -1) {
- _LOGD("Package UiApp Share Request DB Insert Failed\n");
- return -1;
+ req = (request_x*)rq->data;
+ if(req){
+ query = sqlite3_mprintf("insert into package_app_share_request(app_id, data_share_request) " \
+ "values(%Q, %Q)",\
+ up->appid, req->text);
+ ret = __exec_query(query);
+ sqlite3_free(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp Share Request DB Insert Failed\n");
+ return -1;
+ }
}
rq = rq->next;
}
ds = ds->next;
}
- up = up->next;
+ list_up = list_up->next;
}
return 0;
}
static int __insert_uiapplication_share_allowed_info(manifest_x *mfx)
{
- uiapplication_x *up = mfx->uiapplication;
- datashare_x *ds = NULL;
- define_x *df = NULL;
- allowed_x *al = NULL;
+ uiapplication_x *up = NULL;
+ GList *list_up = mfx->uiapplication;
+ GList *ds = NULL;
+ datashare_x* datashare = NULL;
+ GList *df = NULL;
+ define_x* def = NULL;
+ GList *al = NULL;
+ allowed_x *alw = NULL;
int ret = -1;
char *query = NULL;
- while(up != NULL)
+
+ while(list_up != NULL)
{
+ up = (uiapplication_x *)list_up->data;
ds = up->datashare;
while(ds != NULL)
{
- df = ds->define;
+ datashare = (datashare_x*)ds->data;
+ df = datashare->define;
while(df != NULL)
{
- al = df->allowed;
+ def = (define_x*)df->data;
+ al = def->allowed;
while(al != NULL)
{
- query = sqlite3_mprintf("insert into package_app_share_allowed(app_id, data_share_path, data_share_allowed) " \
- "values(%Q, %Q, %Q)",\
- up->appid, df->path, al->text);
- ret = __exec_query(query);
- sqlite3_free(query);
- if (ret == -1) {
- _LOGD("Package UiApp Share Allowed DB Insert Failed\n");
- return -1;
+ alw = (allowed_x*)al->data;
+ if(alw){
+ query = sqlite3_mprintf("insert into package_app_share_allowed(app_id, data_share_path, data_share_allowed) " \
+ "values(%Q, %Q, %Q)",\
+ up->appid, def->path, alw->text);
+ ret = __exec_query(query);
+ sqlite3_free(query);
+ if (ret == -1) {
+ _LOGD("Package UiApp Share Allowed DB Insert Failed\n");
+ return -1;
+ }
}
al = al->next;
}
}
ds = ds->next;
}
- up = up->next;
+ list_up = list_up->next;
}
return 0;
}
static int __insert_manifest_info_in_db(manifest_x *mfx)
{
- label_x *lbl = mfx->label;
- license_x *lcn = mfx->license;
- icon_x *icn = mfx->icon;
- description_x *dcn = mfx->description;
- author_x *ath = mfx->author;
- uiapplication_x *up = mfx->uiapplication;
- uiapplication_x *up_icn = mfx->uiapplication;
- uiapplication_x *up_image = mfx->uiapplication;
- privileges_x *pvs = NULL;
- privilege_x *pv = NULL;
+ GList *lbl = mfx->label;
+ GList *lcn = mfx->license;
+ GList *icn = mfx->icon;
+ GList *dcn = mfx->description;
+ GList *ath = mfx->author;
+ uiapplication_x *up = NULL;
+ uiapplication_x *up_icn = NULL;
+ uiapplication_x *up_image = NULL;
+ uiapplication_x *up_support_mode = NULL;
+ GList *list_up = NULL;
+ int temp_pkg_mode = 0;
+ int temp_app_mode = 0;
+ char pkg_mode[10] = {'\0'};
+ GList *pvs = NULL;
+ char *pv = NULL;
char *query = NULL;
- char root[MAX_QUERY_LEN] = { '\0' };
int ret = -1;
- char *type = NULL;
- char *path = NULL;
const char *auth_name = NULL;
const char *auth_email = NULL;
const char *auth_href = NULL;
GList *appimage = NULL;
if (ath) {
- if (ath->text)
- auth_name = ath->text;
- if (ath->email)
- auth_email = ath->email;
- if (ath->href)
- auth_href = ath->href;
+ author_x* auth = (author_x*)ath->data;
+ if(auth){
+ if (auth->text)
+ auth_name = auth->text;
+ if (auth->email)
+ auth_email = auth->email;
+ if (auth->href)
+ auth_href = auth->href;
+ }
+ }
+
+ // support-mode ORing
+ if (mfx->support_mode) {
+ temp_pkg_mode = atoi(mfx->support_mode);
}
+ list_up = mfx->uiapplication;
+ while (list_up != NULL) {
+ up_support_mode = (uiapplication_x *)list_up->data;
+ if (up_support_mode->support_mode) {
+ temp_app_mode = atoi(up_support_mode->support_mode);
+ temp_pkg_mode |= temp_app_mode;
+ }
+ list_up = list_up->next;
+ }
+ snprintf(pkg_mode, sizeof(pkg_mode), "%d", temp_pkg_mode);
+
+ if(mfx->support_mode)
+ free((void *)mfx->support_mode);
+ mfx->support_mode = strdup(pkg_mode);
/*Insert in the package_info DB*/
+ char *backend = NULL;
if (mfx->type)
- type = strdup(mfx->type);
+ backend = strdup(mfx->type);
else
- type = strdup("rpm");
- /*Insert in the package_info DB*/
- if (mfx->root_path) {
- path = strdup(mfx->root_path);
- } else {
- if (type && strcmp(type,"rpm")==0) {
- snprintf(root, MAX_QUERY_LEN - 1, "/opt/share/packages/%s.xml", mfx->package);
- if (access(root, F_OK) == 0) {
- memset(root, '\0', MAX_QUERY_LEN);
- snprintf(root, MAX_QUERY_LEN - 1, "/opt/usr/apps/%s", mfx->package);
- } else {
- memset(root, '\0', MAX_QUERY_LEN);
- snprintf(root, MAX_QUERY_LEN - 1, "/usr/apps/%s", mfx->package);
- }
- } else {
- snprintf(root, MAX_QUERY_LEN - 1, "/opt/usr/apps/%s", mfx->package);
- }
+ backend = strdup("rpm");
- path = strdup(root);
+ if (backend == NULL) {
+ _LOGE("Out of memory");
+ return -1;
}
- query = sqlite3_mprintf("insert into package_info(package, package_type, package_version, install_location, package_size, " \
+ if (!mfx->backend_installer)
+ mfx->backend_installer = strdup(backend);
+
+ FREE_AND_NULL(backend);
+
+ query = sqlite3_mprintf("insert into package_info(package, package_type, package_version, package_api_version, 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, " \
- "package_mother_package, package_support_mode, package_reserve1, package_reserve2, package_hash) " \
+ "package_mother_package, package_support_mode, package_backend_installer, package_custom_smack_label) " \
"values(%Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q)",\
- mfx->package,
- type,
- mfx->version,
- __get_str(mfx->installlocation),
- __get_str(mfx->package_size),
- mfx->removable,
- mfx->preload,
- mfx->readonly,
- mfx->update,
- mfx->appsetting,
- mfx->nodisplay_setting,
- mfx->system,
- __get_str(auth_name),
- __get_str(auth_email),
- __get_str(auth_href),
- mfx->installed_time,
- mfx->installed_storage,
- __get_str(mfx->storeclient_id),
- mfx->mainapp_id,
- __get_str(mfx->package_url),
- path,
- __get_str(mfx->csc_path),
- mfx->support_disable,
- mfx->mother_package,
- mfx->support_mode,
- __get_str(mfx->support_reset),
- mfx->use_reset,
- mfx->hash
- );
+ mfx->package,
+ mfx->type,
+ mfx->version,
+ __get_str(mfx->api_version),
+ __get_str(mfx->installlocation),
+ __get_str(mfx->package_size),
+ mfx->removable,
+ mfx->preload,
+ mfx->readonly,
+ mfx->update,
+ mfx->appsetting,
+ mfx->nodisplay_setting,
+ mfx->system,
+ __get_str(auth_name),
+ __get_str(auth_email),
+ __get_str(auth_href),
+ mfx->installed_time,
+ mfx->installed_storage,
+ __get_str(mfx->storeclient_id),
+ mfx->mainapp_id,
+ __get_str(mfx->package_url),
+ mfx->root_path,
+ __get_str(mfx->csc_path),
+ mfx->support_disable,
+ mfx->mother_package,
+ mfx->support_mode,
+ mfx->backend_installer,
+ mfx->custom_smack_label);
ret = __exec_query(query);
sqlite3_free(query);
if (ret == -1) {
_LOGD("Package Info DB Insert Failed\n");
- FREE_AND_NULL(type);
- FREE_AND_NULL(path);
return -1;
}
- FREE_AND_NULL(type);
- FREE_AND_NULL(path);
-
/*Insert in the package_privilege_info DB*/
pvs = mfx->privileges;
while (pvs != NULL) {
- pv = pvs->privilege;
- while (pv != NULL) {
+ pv = (char*)pvs->data;
+ if (pv != NULL) {
query = sqlite3_mprintf("insert into package_privilege_info(package, privilege) " \
"values(%Q, %Q)",\
- mfx->package, pv->text);
+ mfx->package, pv);
ret = __exec_query(query);
sqlite3_free(query);
if (ret == -1) {
_LOGD("Package Privilege Info DB Insert Failed\n");
return -1;
}
- pv = pv->next;
}
pvs = pvs->next;
}
__trimfunc(pkglocale);
/*Insert the app locale info */
- while(up != NULL)
+ list_up = mfx->uiapplication;
+ while(list_up != NULL)
{
+ up = (uiapplication_x *)list_up->data;
applocale = __create_locale_list(applocale, up->label, NULL, up->icon, NULL, NULL);
- up = up->next;
+ list_up = list_up->next;
}
+
/*remove duplicated data in applocale*/
__trimfunc(applocale);
/*Insert the app icon info */
- while(up_icn != NULL)
+ list_up = mfx->uiapplication;
+ while(list_up != NULL)
{
+ up_icn = (uiapplication_x *)list_up->data;
appicon = __create_icon_list(appicon, up_icn->icon);
- up_icn = up_icn->next;
+ list_up = list_up->next;
}
/*remove duplicated data in appicon*/
__trimfunc(appicon);
/*Insert the image info */
- while(up_image != NULL)
+ list_up = mfx->uiapplication;
+ while(list_up != NULL)
{
+ up_image = (uiapplication_x *)list_up->data;
appimage = __create_image_list(appimage, up_image->image);
- up_image = up_image->next;
+ list_up = list_up->next;
}
/*remove duplicated data in appimage*/
__trimfunc(appimage);
g_list_foreach(pkglocale, __insert_pkglocale_info, (gpointer)mfx);
/*native app locale info*/
- up = mfx->uiapplication;
- while(up != NULL)
- {
- g_list_foreach(applocale, __insert_uiapplication_locale_info, (gpointer)up);
- up = up->next;
- }
+ list_up = mfx->uiapplication;
+ while(list_up != NULL)
+ {
+ up = (uiapplication_x *)list_up->data;
+ g_list_foreach(applocale, __insert_uiapplication_locale_info, (gpointer)up);
+ list_up = list_up->next;
+ }
/*app icon locale info*/
- up_icn = mfx->uiapplication;
- while(up_icn != NULL)
+ list_up = mfx->uiapplication;
+ while(list_up != NULL)
{
+ up_icn = (uiapplication_x *)list_up->data;
g_list_foreach(appicon, __insert_uiapplication_icon_section_info, (gpointer)up_icn);
- up_icn = up_icn->next;
+ list_up = list_up->next;
}
/*app image info*/
- up_image = mfx->uiapplication;
- while(up_image != NULL)
+ list_up = mfx->uiapplication;
+ while(list_up != NULL)
{
+ up_image = (uiapplication_x *)list_up->data;
g_list_foreach(appimage, __insert_uiapplication_image_info, (gpointer)up_image);
- up_image = up_image->next;
+ list_up = list_up->next;
}
g_list_free(pkglocale);
g_list_free(appimage);
appimage = NULL;
-
/*Insert in the package_app_info DB*/
ret = __insert_uiapplication_info(mfx);
if (ret == -1)
return -1;
return 0;
+}
+
+static int __update_app_info_for_bg_disable(const char *appid, bool disable)
+{
+ char *query = NULL;
+ int ret = -1;
+
+ /*Update from package info*/
+ if (disable)
+ query = sqlite3_mprintf("update package_app_info set app_background_category = app_background_category & ~1 where app_id=%Q", appid);
+ else
+ query = sqlite3_mprintf("update package_app_info set app_background_category = app_background_category | 1 where app_id=%Q", appid);
+ ret = __exec_query(query);
+ sqlite3_free(query);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "__exec_query() failed.\n");
+ return PMINFO_R_OK;
}
static int __update_pkg_info_for_disable(const char *pkgid, bool disable)
return ret;
}
+static int __get_appid_list_cb(void *data, int ncols, char **coltxt, char **colname)
+{
+ if (ncols != 1) {
+ _LOGE("invalid parameter!");
+ return -1;
+ }
+ GList **tmp_list = (GList **)data;
+
+ if (strlen(*coltxt) == 0 || strcmp(*colname, "app_id") != 0) {
+ _LOGE("wrong return value, colname[%s], coltxt[%s]", *colname, *coltxt);
+ return -1;
+ }
+
+ *tmp_list = g_list_append(*tmp_list, strdup(*coltxt));
+ return 0;
+}
+
+static void appid_list_free(gpointer data)
+{
+ FREE_AND_NULL(data);
+}
+
static int __delete_manifest_info_from_db(manifest_x *mfx)
{
int ret = -1;
- uiapplication_x *up = mfx->uiapplication;
+ GList *list_up = NULL;
+ GList *tmp_list = NULL;
+ char *query = sqlite3_mprintf("select app_id from package_app_info where package=%Q", mfx->package);
/* Delete package info DB */
ret = __delete_manifest_info_from_pkgid(mfx->package);
- retvm_if(ret < 0, PMINFO_R_ERROR, "Package Info DB Delete Failed\n");
+ if (ret < 0) {
+ _LOGE("Package Info DB Delete Failed\n");
+ goto catch;
+ }
- while (up != NULL) {
- ret = __delete_manifest_info_from_appid(up->appid);
+ /* Search package_app_info DB and get app_id list related with given package */
+ ret = __exec_db_query(pkgmgr_parser_db, query, __get_appid_list_cb, &list_up);
+ if (ret < 0) {
+ _LOGE("failed to exec query");
+ goto catch;
+ }
+ tmp_list = list_up;
+ while (tmp_list != NULL) {
+ ret = __delete_manifest_info_from_appid((char *)tmp_list->data);
retvm_if(ret < 0, PMINFO_R_ERROR, "App Info DB Delete Failed\n");
- up = up->next;
+ tmp_list = tmp_list->next;
}
- return 0;
+catch:
+
+ if (query)
+ sqlite3_free(query);
+
+ g_list_free_full(list_up, (GDestroyNotify)appid_list_free);
+ return ret;
}
static int __delete_appsvc_db(const char *appid)
int (*appsvc_operation) (const char *);
if ((lib_handle = dlopen(LIBAPPSVC_PATH, RTLD_LAZY)) == NULL) {
- _LOGE("dlopen is failed LIBAIL_PATH[%s]\n", LIBAPPSVC_PATH);
+ _LOGE("dlopen is failed LIBAPPSVC_PATH[%s]\n", LIBAPPSVC_PATH);
return ret;
}
- if ((appsvc_operation =
- dlsym(lib_handle, "appsvc_unset_defapp")) == NULL || dlerror() != NULL) {
+ if ((appsvc_operation = dlsym(lib_handle, "appsvc_unset_defapp")) == NULL || dlerror() != NULL) {
_LOGE("can not find symbol \n");
goto END;
}
static int __delete_appsvc_info_from_db(manifest_x *mfx)
{
int ret = 0;
- uiapplication_x *uiapplication = mfx->uiapplication;
+ uiapplication_x *uiapplication = NULL;
+ GList *list_up = mfx->uiapplication;
- for(; uiapplication; uiapplication=uiapplication->next) {
+ for(; list_up; list_up=list_up->next) {
+ uiapplication = (uiapplication_x *)list_up->data;
ret = __delete_appsvc_db(uiapplication->appid);
if (ret <0)
_LOGE("can not remove_appsvc_db\n");
return 0;
}
+static int __delete_alias_appid_manifest_info_from_appid(const char *appid)
+{
+ int ret = PM_PARSER_R_OK;
+ char *query = NULL;
+
+ query = sqlite3_mprintf("delete from package_app_aliasid where app_id = %Q and type = %d",
+ appid, ALIAS_APPID_TYPE_APPDEFINED);
+ if(query == NULL) {
+ _LOGE("failed to mprintf query\n");
+ return PM_PARSER_R_ERROR;
+ }
+
+ ret = __exec_query(query);
+ tryvm_if(ret != SQLITE_OK,ret = PM_PARSER_R_ERROR,"Package alias appid delete failed!!");
+
+catch:
+ if(query) sqlite3_free(query);
+ return ret;
+}
static int __delete_manifest_info_from_appid(const char *appid)
{
ret = __delete_appinfo_from_db("package_app_data_control", appid);
retvm_if(ret < 0, PMINFO_R_ERROR, "Fail to get handle");
+ ret = __delete_alias_appid_manifest_info_from_appid(appid);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "Fail to get handle");
+
return 0;
}
if (ret == -1)
_LOGD("Package preload_condition update failed\n");
+ query = sqlite3_mprintf("PRAGMA user_version=%d", PKGMGR_PARSER_DB_VERSION);
+ ret = __exec_query(query);
+ sqlite3_free(query);
+ if (ret == -1)
+ _LOGD("Package user_version update failed\n");
+
return ret;
}
_LOGD("package app aliasId DB initialization failed\n");
return ret;
}
-#ifdef _APPFW_FEATURE_PROFILE_WEARABLE
- ret = __init_tables_for_wearable();
- if (ret == -1) {
- _LOGD("package pkg reserve info DB initialization failed\n");
- return ret;
- }
-#endif
return 0;
}
-int pkgmgr_parser_check_and_create_db()
+int zone_pkgmgr_parser_check_and_create_db(const char *zone)
{
int ret = -1;
/*Manifest DB*/
- ret = __pkgmgr_parser_create_db(&pkgmgr_parser_db, PKGMGR_PARSER_DB_FILE);
+ char db_path[PKG_STRING_LEN_MAX] = { '\0', };
+ char *rootpath = NULL;
+
+
+ if (zone == NULL || strcmp(zone, ZONE_HOST) == 0) {
+ snprintf(db_path, PKG_STRING_LEN_MAX, "%s", PKGMGR_PARSER_DB_FILE);
+ } else {
+ rootpath = __zone_get_root_path(zone);
+ if (rootpath == NULL) {
+ _LOGE("Failed to get rootpath");
+ return -1;
+ }
+
+ snprintf(db_path, PKG_STRING_LEN_MAX, "%s%s", rootpath, PKGMGR_PARSER_DB_FILE);
+ }
+
+ _LOGD("db path(%s)", db_path);
+ ret = __pkgmgr_parser_create_db(&pkgmgr_parser_db, db_path);
+
if (ret) {
_LOGD("Manifest DB creation Failed\n");
return -1;
}
/*Cert DB*/
- ret = __pkgmgr_parser_create_db(&pkgmgr_cert_db, PKGMGR_CERT_DB_FILE);
+ memset(db_path, '\0', PKG_STRING_LEN_MAX);
+
+ if (zone == NULL || strcmp(zone, ZONE_HOST) == 0) {
+ snprintf(db_path, PKG_STRING_LEN_MAX, "%s", PKGMGR_CERT_DB_FILE);
+ } else {
+ _LOGD("rootpath : %s", rootpath);
+ snprintf(db_path, PKG_STRING_LEN_MAX, "%s%s", rootpath, PKGMGR_CERT_DB_FILE);
+ }
+
+ _LOGD("db path(%s)", db_path);
+ ret = __pkgmgr_parser_create_db(&pkgmgr_cert_db, db_path);
+
if (ret) {
_LOGD("Cert DB creation Failed\n");
return -1;
return 0;
}
+int pkgmgr_parser_check_and_create_db()
+{
+ return zone_pkgmgr_parser_check_and_create_db(NULL);
+}
+
void pkgmgr_parser_close_db()
{
sqlite3_close(pkgmgr_parser_db);
ret = pkgmgr_parser_initialize_db();
if (ret == -1)
goto err;
+
+ // pkgmgr parser DB transaction
/*Begin transaction*/
ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
_LOGD("Failed to begin transaction[%d]\n", ret);
- ret = -1;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
_LOGD("Transaction Begin\n");
_LOGD("Insert into DB failed. Rollback now\n");
ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
if (ret != SQLITE_OK)
- _LOGD("ROLLBACK is fail after insert_disabled_pkg_info_in_db\n");
+ _LOGD("ROLLBACK is fail after insert_pkg_info_in_db\n");
- ret = -1;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
/*Commit transaction*/
if (ret != SQLITE_OK)
_LOGE("Failed to commit transaction. Rollback now\n");
- ret = -1;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
_LOGD("Transaction Commit and End\n");
if (ret == -1)
goto err;
+ // pkgmgr parser DB transaction
/*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;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
_LOGD("Transaction Begin\n");
_LOGD("Delete from DB failed. Rollback now\n");
ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
if (ret != SQLITE_OK)
- _LOGD("Failed to commit transaction. Rollback now\n");
+ _LOGE("Failed to rollback transaction.\n");
+
+ ret = PM_PARSER_R_ERROR;
goto err;
}
ret = __insert_manifest_info_in_db(mfx);
_LOGD("Insert into DB failed. Rollback now\n");
ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
if (ret != SQLITE_OK)
- _LOGD("Failed to commit transaction. Rollback now\n");
+ _LOGE("Failed to rollback transaction\n");
+
+ ret = PM_PARSER_R_ERROR;
goto err;
}
if (ret != SQLITE_OK)
_LOGD("Failed to commit transaction. Rollback now\n");
- ret = -1;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
_LOGD("Transaction Commit and End\n");
_LOGD("Failed to open DB\n");
return ret;
}
+ // pkgmgr parser DB transaction
/*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;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
_LOGD("Transaction Begin\n");
_LOGD("Delete from DB failed. Rollback now\n");
ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
if (ret != SQLITE_OK)
- _LOGE("Failed to commit transaction, Rollback now\n");
+ _LOGE("Failed to rollback transaction \n");
+ ret = PM_PARSER_R_ERROR;
goto err;
}
+
/*Commit transaction*/
ret = sqlite3_exec(pkgmgr_parser_db, "COMMIT", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
if (ret != SQLITE_OK)
_LOGE("Failed to commit transaction, Rollback now\n");
- ret = -1;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
_LOGD("Failed to begin transaction\n");
- ret = -1;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
_LOGD("Transaction Begin\n");
_LOGD("__update_preload_condition_in_db failed. Rollback now\n");
ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
if (ret != SQLITE_OK)
- _LOGE("Failed to commit transaction, Rollback now\n");
+ _LOGE("Failed to ROLLBACK for update preload condition.");
+ ret = PM_PARSER_R_ERROR;
goto err;
}
/*Commit transaction*/
_LOGD("Failed to commit transaction, Rollback now\n");
ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
if (ret != SQLITE_OK)
- _LOGE("Failed to commit transaction, Rollback now\n");
+ _LOGE("Failed to ROLLBACK for COMMIT.");
- ret = -1;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
_LOGD("Transaction Commit and End\n");
ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
_LOGE("Failed to begin transaction\n");
- ret = -1;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
if (ret != SQLITE_OK)
_LOGE("Failed to begin transaction\n");
+ ret = PM_PARSER_R_ERROR;
goto err;
}
+ // pkgmgr parser DB transaction
/*Commit transaction*/
ret = sqlite3_exec(pkgmgr_parser_db, "COMMIT", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
if (ret != SQLITE_OK)
_LOGE("Failed to commit transaction, Rollback now\n");
- ret = -1;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
ret = pkgmgr_parser_check_and_create_db();
retvm_if(ret < 0, PMINFO_R_ERROR, "Failed to open DB\n");
+ // pkgmgr parser DB transaction
/*Begin transaction*/
ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
_LOGE("Failed to begin transaction\n");
- ret = -1;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
if (ret != SQLITE_OK)
_LOGE("Failed to commit transaction, Rollback now\n");
- ret = -1;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
return ret;
}
-API int pkgmgr_parser_update_enabled_pkg_info_in_db(const char *pkgid)
+int zone_pkgmgr_parser_update_enabled_pkg_info_in_db(const char *pkgid, const char *zone)
{
retvm_if(pkgid == NULL, PMINFO_R_ERROR, "pkgid is NULL.");
_LOGD("pkgmgr_parser_update_enabled_pkg_info_in_db(%s)\n", pkgid);
/*open db*/
- ret = pkgmgr_parser_check_and_create_db();
+ ret = zone_pkgmgr_parser_check_and_create_db(zone);
retvm_if(ret < 0, PMINFO_R_ERROR, "pkgmgr_parser_check_and_create_db(%s) failed.\n", pkgid);
+ // pkgmgr changeable DB transaction
/*Begin transaction*/
ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
_LOGE("sqlite3_exec(BEGIN EXCLUSIVE) failed.\n");
- ret = -1;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
if (ret != SQLITE_OK)
_LOGE("sqlite3_exec(ROLLBACK) failed.\n");
+
+ ret = PM_PARSER_R_ERROR;
goto err;
}
if (ret != SQLITE_OK)
_LOGE("sqlite3_exec(ROLLBACK) failed.\n");
- ret = -1;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
return ret;
}
-API int pkgmgr_parser_update_disabled_pkg_info_in_db(const char *pkgid)
+API int pkgmgr_parser_update_enabled_pkg_info_in_db(const char *pkgid)
+{
+ return zone_pkgmgr_parser_update_enabled_pkg_info_in_db(pkgid, NULL);
+}
+
+int zone_pkgmgr_parser_update_app_disable_bg_operation_info_in_db(const char *appid, const char *zone, bool is_disable)
+{
+ retvm_if(appid == NULL, PMINFO_R_ERROR, "appid is NULL.");
+
+ int ret = -1;
+ _LOGD("zone_pkgmgr_parser_update_app_disable_bg_operation_info_in_db[%s]\n", appid);
+
+ /*open db*/
+ ret = zone_pkgmgr_parser_check_and_create_db(zone);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "pkgmgr_parser_check_and_create_db(%s) failed.\n", appid);
+
+ /*Begin transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("sqlite3_exec(BEGIN EXCLUSIVE) failed.\n");
+ ret = PM_PARSER_R_ERROR;
+ goto err;
+ }
+
+ /*update app info*/
+ ret = __update_app_info_for_bg_disable(appid, is_disable);
+ if (ret == -1) {
+ _LOGE("update_app_info_for_bg_disable[%s] failed.\n", appid);
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("sqlite3_exec(ROLLBACK) failed.\n");
+
+ ret = PM_PARSER_R_ERROR;
+ goto err;
+ }
+
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGD("sqlite3_exec(COMMIT) failed.\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("sqlite3_exec(ROLLBACK) failed.\n");
+
+ ret = PM_PARSER_R_ERROR;
+ goto err;
+ }
+
+err:
+ pkgmgr_parser_close_db();
+ return ret;
+}
+
+int zone_pkgmgr_parser_update_disabled_pkg_info_in_db(const char *pkgid, const char *zone)
{
retvm_if(pkgid == NULL, PMINFO_R_ERROR, "pkgid is NULL.");
_LOGD("pkgmgr_parser_update_disabled_pkg_info_in_db(%s)\n", pkgid);
/*open db*/
- ret = pkgmgr_parser_check_and_create_db();
+ ret = zone_pkgmgr_parser_check_and_create_db(zone);
retvm_if(ret < 0, PMINFO_R_ERROR, "pkgmgr_parser_check_and_create_db(%s) failed.\n", pkgid);
+ // pkgmgr changeable DB transaction
/*Begin transaction*/
ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
_LOGE("sqlite3_exec(BEGIN EXCLUSIVE) failed.\n");
- ret = -1;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
if (ret != SQLITE_OK)
_LOGE("sqlite3_exec(ROLLBACK) failed.\n");
+
+ ret = PM_PARSER_R_ERROR;
goto err;
}
if (ret != SQLITE_OK)
_LOGE("sqlite3_exec(ROLLBACK) failed.\n");
- ret = -1;
+ ret = PM_PARSER_R_ERROR;
goto err;
}
return ret;
}
+API int pkgmgr_parser_update_disabled_pkg_info_in_db(const char *pkgid)
+{
+ return zone_pkgmgr_parser_update_disabled_pkg_info_in_db(pkgid, NULL);
+}
+
int pkgmgr_parser_insert_app_aliasid_info_in_db(void)
{
FILE *ini_file = NULL;
_LOGD("Transaction Begin\n");
- /*delete all the previous entries from package_app_aliasid tables*/
- query = sqlite3_mprintf("delete from package_app_aliasid");
+ /*delete previous predefined entries from package_app_aliasid tables*/
+ query = sqlite3_mprintf("delete from package_app_aliasid where type = %d", ALIAS_APPID_TYPE_PREDEFINED);
ret = __exec_db_query(pkgmgr_db, query, NULL, NULL);
sqlite3_free(query);
tryvm_if(ret != SQLITE_OK,ret = PM_PARSER_R_ERROR,"sqlite exec failed to delete entries from package_app_aliasid!!");
__str_trim(app_id);
/* Insert the data into DB*/
- query = sqlite3_mprintf("insert into package_app_aliasid(app_id, alias_id) values(%Q ,%Q)",tizen_id,app_id);
+ query = sqlite3_mprintf("insert into package_app_aliasid(app_id, alias_id, type) values(%Q ,%Q, %d)",
+ app_id, tizen_id, ALIAS_APPID_TYPE_PREDEFINED);
ret = __exec_db_query(pkgmgr_db, query, NULL, NULL);
sqlite3_free(query);
tryvm_if(ret != SQLITE_OK,ret = PM_PARSER_R_ERROR, "sqlite exec failed to insert entries into package_app_aliasid table!!");
__str_trim(app_id);
/* Insert the data into DB*/
- query = sqlite3_mprintf("insert or replace into package_app_aliasid(app_id, alias_id) values(%Q ,%Q)",tizen_id,app_id);
+ query = sqlite3_mprintf("insert or replace into package_app_aliasid(app_id, alias_id, type) values(%Q ,%Q, %d)",
+ app_id,tizen_id,ALIAS_APPID_TYPE_PREDEFINED);
ret = __exec_db_query(pkgmgr_db, query, NULL, NULL);
sqlite3_free(query);
tryvm_if(ret != SQLITE_OK,ret = PM_PARSER_R_ERROR, "sqlite exec failed to insert entries into package_app_aliasid table!!");
}
+#ifdef _APPFW_FEATURE_EXPANSION_PKG_INSTALL
+int pkgmgr_parser_insert_tep_in_db(const char *pkgid, const char *tep_name)
+{
+ int ret = PM_PARSER_R_OK;
+ sqlite3 *pkgmgr_db = NULL;
+ char *query = NULL;
+
+ retvm_if(pkgid == NULL, PMINFO_R_ERROR, "pkgid is NULL.");
+ retvm_if(tep_name == NULL, PMINFO_R_ERROR, "tep path is NULL.");
+
+ /*Open the pkgmgr DB*/
+ ret = db_util_open_with_options(MANIFEST_DB, &pkgmgr_db, SQLITE_OPEN_READWRITE, NULL);
+ if(ret != SQLITE_OK){
+ _LOGE("connect db [%s] failed!\n", MANIFEST_DB);
+ return PM_PARSER_R_ERROR;
+ }
+
+ /*Begin Transaction*/
+ ret = sqlite3_exec(pkgmgr_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ tryvm_if(ret != SQLITE_OK, ret = PM_PARSER_R_ERROR, "Failed to begin transaction");
+
+ _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_name, pkgid);
+
+ ret = __exec_db_query(pkgmgr_db, query, NULL, NULL);
+ sqlite3_free(query);
+ tryvm_if(ret != SQLITE_OK, ret = PM_PARSER_R_ERROR, "sqlite exec failed to insert entries into package_info!!");
+
+ /* Updating TEP info in "package_app_info" table */
+ query = sqlite3_mprintf("UPDATE package_app_info "\
+ "SET app_tep_name = %Q "\
+ "WHERE package = %Q", tep_name, pkgid);
+
+ ret = __exec_db_query(pkgmgr_db, query, NULL, NULL);
+ sqlite3_free(query);
+ tryvm_if(ret != SQLITE_OK, ret = PM_PARSER_R_ERROR, "sqlite exec failed to insert entries into package_app_info!!");
+
+
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkgmgr_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to commit transaction, Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to Rollback\n");
+
+ ret = PM_PARSER_R_ERROR;
+ goto catch;
+ }
+ _LOGD("Transaction Commit and End\n");
+ ret = PM_PARSER_R_OK;
+
+catch:
+ sqlite3_close(pkgmgr_db);
+ return ret;
+}
+
+int pkgmgr_parser_update_tep_in_db(const char *pkgid, const char *tep_name)
+{
+ int ret = PM_PARSER_R_OK;
+ sqlite3 *pkgmgr_db = NULL;
+ char *query = NULL;
+
+ retvm_if(pkgid == NULL, PMINFO_R_ERROR, "pkgid is NULL.");
+ retvm_if(tep_name == NULL, PMINFO_R_ERROR, "tep name is NULL.");
+
+ /*Open the pkgmgr DB*/
+ ret = db_util_open_with_options(MANIFEST_DB, &pkgmgr_db, SQLITE_OPEN_READWRITE, NULL);
+ if(ret != SQLITE_OK){
+ _LOGE("connect db [%s] failed!\n", MANIFEST_DB);
+ return PM_PARSER_R_ERROR;
+ }
+
+ /*Begin Transaction*/
+ ret = sqlite3_exec(pkgmgr_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ tryvm_if(ret != SQLITE_OK, ret = PM_PARSER_R_ERROR, "Failed to begin transaction");
+
+ _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_name, pkgid);
+
+ ret = __exec_db_query(pkgmgr_db, query, NULL, NULL);
+ sqlite3_free(query);
+ tryvm_if(ret != SQLITE_OK, ret = PM_PARSER_R_ERROR, "sqlite exec failed to insert entries into package_info!!");
+
+
+ /* Updating TEP info in "package_app_info" table */
+ query = sqlite3_mprintf("UPDATE package_app_info "\
+ "SET app_tep_name = %Q "\
+ "WHERE package = %Q", tep_name, pkgid);
+
+ ret = __exec_db_query(pkgmgr_db, query, NULL, NULL);
+ sqlite3_free(query);
+ tryvm_if(ret != SQLITE_OK, ret = PM_PARSER_R_ERROR, "sqlite exec failed to insert entries into package_app_info!!");
+
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkgmgr_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to commit transaction, Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to Rollback\n");
+
+ ret = PM_PARSER_R_ERROR;
+ goto catch;
+ }
+ _LOGD("Transaction Commit and End\n");
+ ret = PM_PARSER_R_OK;
+
+catch:
+ sqlite3_close(pkgmgr_db);
+ return ret;
+}
+
+int pkgmgr_parser_delete_tep_in_db(const char *pkgid)
+{
+
+ int ret = PM_PARSER_R_OK;
+ sqlite3 *pkgmgr_db = NULL;
+ char *query = NULL;
+ int row_exist = 0;
+ sqlite3_stmt *stmt = NULL;
+
+ retvm_if(pkgid == NULL, PMINFO_R_ERROR, "pkgid is NULL.");
+
+ /*Open the pkgmgr DB*/
+ ret = db_util_open_with_options(MANIFEST_DB, &pkgmgr_db, SQLITE_OPEN_READWRITE, NULL);
+ if(ret != SQLITE_OK){
+ _LOGE("connect db [%s] failed!\n", MANIFEST_DB);
+ return PM_PARSER_R_ERROR;
+ }
+
+ /*Check for any existing entry having same pkgid*/
+ query = sqlite3_mprintf("select count(*) from package_info "\
+ "where pkgid=%Q", pkgid);
+ ret = sqlite3_prepare_v2(pkgmgr_db, query, strlen(query), &stmt, NULL);
+ tryvm_if(ret != PMINFO_R_OK, ret = PMINFO_R_ERROR, "sqlite3_prepare_v2 failed[%s]\n", query);
+
+ /*step query*/
+ ret = sqlite3_step(stmt);
+ if(ret == SQLITE_ROW) {
+ row_exist = sqlite3_column_int(stmt,0);
+ }
+ sqlite3_free(query);
+
+ if(row_exist){
+
+ /*Begin Transaction*/
+ ret = sqlite3_exec(pkgmgr_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ tryvm_if(ret != SQLITE_OK, ret = PM_PARSER_R_ERROR, "Failed to begin transaction");
+
+ _LOGD("Transaction Begin\n");
+
+ /* Deleting TEP info in "package_info" table */
+ query = sqlite3_mprintf("UPDATE package_info "\
+ "SET package_tep_name = %Q "\
+ "WHERE package = %Q", NULL, pkgid);
+
+ ret = __exec_db_query(pkgmgr_db, query, NULL, NULL);
+ sqlite3_free(query);
+
+ if (ret != SQLITE_OK) {
+ _LOGD("Delete from DB failed. Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to commit transaction, Rollback now\n");
+
+ ret = PM_PARSER_R_ERROR;
+ goto catch;
+ }
+
+ /* Deleting TEP info in "package_app_info" table */
+ query = sqlite3_mprintf("UPDATE package_app_info "\
+ "SET app_tep_name = %Q "\
+ "WHERE package = %Q", NULL, pkgid);
+
+ ret = __exec_db_query(pkgmgr_db, query, NULL, NULL);
+ sqlite3_free(query);
+
+ if (ret != SQLITE_OK) {
+ _LOGD("Delete from DB failed. Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to commit transaction, Rollback now\n");
+
+ ret = PM_PARSER_R_ERROR;
+ goto catch;
+ }
+
+
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkgmgr_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGE("Failed to commit transaction, Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to Rollback\n");
+
+ ret = PM_PARSER_R_ERROR;
+ goto catch;
+ }
+ _LOGD("Transaction Commit and End\n");
+ ret = PM_PARSER_R_OK;
+ }else{
+ _LOGE("PKGID does not exist in the table");
+ ret = PM_PARSER_R_ERROR;
+ }
+
+catch:
+ sqlite3_close(pkgmgr_db);
+ sqlite3_finalize(stmt);
+
+ return ret;
+}
+#endif
+
+#ifdef _APPFW_FEATURE_MOUNT_INSTALL
+int pkgmgr_parser_insert_mount_install_info_in_db(const char *pkgid, bool ismount, const char *tpk_name)
+{
+ int ret = PM_PARSER_R_OK;
+ char *query = NULL;
+ int is_mnt = 0;
+
+ retvm_if(pkgid == NULL, PMINFO_R_ERROR, "pkgid is NULL.");
+ retvm_if(tpk_name == NULL, PMINFO_R_ERROR, "tpk_name is NULL.");
+
+ ret = pkgmgr_parser_check_and_create_db();
+ retvm_if(ret == -1, PM_PARSER_R_ERROR, "Failed to open DB");
+
+ ret = pkgmgr_parser_initialize_db();
+ tryvm_if(ret == -1, ret = PM_PARSER_R_ERROR, "Failed to initialize DB");
+
+ // pkgmgr parser DB transaction
+ /*Begin transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
+ tryvm_if(ret != SQLITE_OK, ret = PM_PARSER_R_ERROR, "Failed to begin transaction[%d]\n", ret);
+
+ _LOGD("Transaction Begin\n");
+
+ if (ismount) {
+ is_mnt = 1;
+ }
+
+ /* Updating mount_install value in "package_app_info" table */
+ query = sqlite3_mprintf("UPDATE package_app_info "\
+ "SET app_mount_install = '%d', "\
+ "app_tpk_name = %Q "\
+ "WHERE package = %Q", is_mnt, tpk_name, pkgid);
+
+ ret = __exec_query(query);
+ _LOGD("Query: [%s]", query);
+ sqlite3_free(query);
+ tryvm_if(ret != SQLITE_OK, ret = PM_PARSER_R_ERROR, "sqlite exec failed to insert entries into package_app_info!!");
+
+
+ /*Commit transaction*/
+ ret = sqlite3_exec(pkgmgr_parser_db, "COMMIT", NULL, NULL, NULL);
+ if (ret != SQLITE_OK) {
+ _LOGD("Failed to commit transaction. Rollback now\n");
+ ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
+ if (ret != SQLITE_OK)
+ _LOGE("Failed to commit transaction. Rollback now\n");
+
+ ret = PM_PARSER_R_ERROR;
+ goto catch;
+ }
+ _LOGD("Transaction Commit and End\n");
+ ret = PM_PARSER_R_OK;
+
+catch:
+ pkgmgr_parser_close_db();
+ return ret;
+}
+
+
+
+#endif
+
extern "C" {
#endif
#include "pkgmgr_parser.h"
-#include "pkgmgr_parser_feature.h"
+#define PKGMGR_PARSER_DB_VERSION 1
#define PKGMGR_PARSER_DB_FILE "/opt/dbspace/.pkgmgr_parser.db"
#define PKGMGR_CERT_DB_FILE "/opt/dbspace/.pkgmgr_cert.db"
int pkgmgr_parser_update_disabled_pkg_info_in_db(const char *pkgid);
int pkgmgr_parser_insert_app_aliasid_info_in_db(void);
int pkgmgr_parser_update_app_aliasid_info_in_db(void);
+#ifdef _APPFW_FEATURE_EXPANSION_PKG_INSTALL
+int pkgmgr_parser_insert_tep_in_db(const char *pkgid, const char *tep_name);
+int pkgmgr_parser_update_tep_in_db(const char *pkgid, const char *tep_name);
+int pkgmgr_parser_delete_tep_in_db(const char *pkgid);
+#endif
+
+#ifdef _APPFW_FEATURE_MOUNT_INSTALL
+int pkgmgr_parser_insert_mount_install_info_in_db(const char *pkgid, bool ismount, const char *tpk_name);
+#endif
+int zone_pkgmgr_parser_update_disabled_pkg_info_in_db(const char *pkgid, const char *zone);
+int zone_pkgmgr_parser_update_enabled_pkg_info_in_db(const char *pkgid, const char *zone);
+int zone_pkgmgr_parser_update_app_disable_bg_operation_info_in_db(const char *appid, const char *zone, bool is_disable);
/** @} */
#ifdef __cplusplus
}
+++ /dev/null
-/*
- * pkgmgr-info
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#define _GNU_SOURCE
-#include <dlfcn.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <time.h>
-#include <libxml/parser.h>
-#include <libxml/xmlreader.h>
-#include <libxml/xmlschemas.h>
-#include <vconf.h>
-#include <glib.h>
-#include <db-util.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <dlfcn.h>
-
-#include "pkgmgr-info.h"
-#include "pkgmgr_parser.h"
-#include "pkgmgr_parser_internal.h"
-#include "pkgmgr_parser_db.h"
-#include "pkgmgr_parser_db_util.h"
-#include "pkgmgr_parser_plugin.h"
-
-#include "pkgmgrinfo_debug.h"
-#include "pkgmgr_parser_feature.h"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "PKGMGR_PARSER"
-
-#define MAX_QUERY_LEN 4096
-
-sqlite3 *pkgmgr_parser_db;
-sqlite3 *pkgmgr_cert_db;
-
-#define QUERY_CREATE_TABLE_DISABLED_PACKAGE_INFO "create table if not exists disabled_package_info " \
- "(package text primary key not null, " \
- "package_type text DEFAULT 'rpm', " \
- "package_version text, " \
- "install_location text, " \
- "package_size text, " \
- "package_removable text DEFAULT 'true', " \
- "package_preload text DEFAULT 'false', " \
- "package_readonly text DEFAULT 'false', " \
- "package_update text DEFAULT 'false', " \
- "package_appsetting text DEFAULT 'false', " \
- "package_nodisplay text DEFAULT 'false', " \
- "package_system text DEFAULT 'false', " \
- "author_name text, " \
- "author_email text, " \
- "author_href text," \
- "installed_time text," \
- "installed_storage text," \
- "storeclient_id text," \
- "mainapp_id text," \
- "package_url text," \
- "root_path text," \
- "csc_path text)"
-
-#define QUERY_CREATE_TABLE_DISABLED_PACKAGE_APP_INFO "create table if not exists disabled_package_app_info " \
- "(app_id text primary key not null, " \
- "app_component text, " \
- "app_exec text, " \
- "app_nodisplay text DEFAULT 'false', " \
- "app_type text, " \
- "app_onboot text DEFAULT 'false', " \
- "app_multiple text DEFAULT 'false', " \
- "app_autorestart text DEFAULT 'false', " \
- "app_taskmanage text DEFAULT 'false', " \
- "app_enabled text DEFAULT 'true', " \
- "app_hwacceleration text DEFAULT 'use-system-setting', " \
- "app_screenreader text DEFAULT 'use-system-setting', " \
- "app_mainapp text, " \
- "app_recentimage text, " \
- "app_launchcondition text, " \
- "app_indicatordisplay text DEFAULT 'true', " \
- "app_portraitimg text, " \
- "app_landscapeimg text, " \
- "app_guestmodevisibility text DEFAULT 'true', " \
- "app_permissiontype text DEFAULT 'normal', " \
- "app_preload text DEFAULT 'false', " \
- "app_submode text DEFAULT 'false', " \
- "app_submode_mainid text, " \
- "app_installed_storage text, " \
- "component_type text, " \
- "package text not null, " \
- "FOREIGN KEY(package) " \
- "REFERENCES package_info(package) " \
- "ON DELETE CASCADE)"
-
-#define QUERY_CREATE_TABLE_DISABLED_PACKAGE_LOCALIZED_INFO "create table if not exists disabled_package_localized_info " \
- "(package text not null, " \
- "package_locale text DEFAULT 'No Locale', " \
- "package_label text, " \
- "package_icon text, " \
- "package_description text, " \
- "package_license text, " \
- "package_author, " \
- "PRIMARY KEY(package, package_locale), " \
- "FOREIGN KEY(package) " \
- "REFERENCES package_info(package) " \
- "ON DELETE CASCADE)"
-
-#define QUERY_CREATE_TABLE_DISABLED_PACKAGE_APP_LOCALIZED_INFO "create table if not exists disabled_package_app_localized_info " \
- "(app_id text not null, " \
- "app_locale text DEFAULT 'No Locale', " \
- "app_label text, " \
- "app_icon text, " \
- "package text not null, " \
- "PRIMARY KEY(app_id,app_locale) " \
- "FOREIGN KEY(app_id) " \
- "REFERENCES package_app_info(app_id) " \
- "ON DELETE CASCADE)"
-
-#define QUERY_CREATE_TABLE_DISABLED_PACKAGE_APP_APP_CATEGORY "create table if not exists disabled_package_app_app_category " \
- "(app_id text not null, " \
- "category text not null, " \
- "package text not null, " \
- "PRIMARY KEY(app_id,category) " \
- "FOREIGN KEY(app_id) " \
- "REFERENCES package_app_info(app_id) " \
- "ON DELETE CASCADE)"
-
-
-#define QUERY_CREATE_TABLE_DISABLED_PACKAGE_APP_APP_METADATA "create table if not exists disabled_package_app_app_metadata " \
- "(app_id text not null, " \
- "md_key text not null, " \
- "md_value text not null, " \
- "package text not null, " \
- "PRIMARY KEY(app_id, md_key, md_value) " \
- "FOREIGN KEY(app_id) " \
- "REFERENCES package_app_info(app_id) " \
- "ON DELETE CASCADE)"
-
-int __init_tables_for_wearable(void)
-{
- int ret = 0;
-
- ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_DISABLED_PACKAGE_INFO);
- if (ret == -1) {
- _LOGD("package pkg reserve info DB initialization failed\n");
- return ret;
- }
-
- ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_DISABLED_PACKAGE_APP_INFO);
- if (ret == -1) {
- _LOGD("package pkg reserve info DB initialization failed\n");
- return ret;
- }
-
- ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_DISABLED_PACKAGE_LOCALIZED_INFO);
- if (ret == -1) {
- _LOGD("package pkg reserve info DB initialization failed\n");
- return ret;
- }
-
- ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_DISABLED_PACKAGE_APP_LOCALIZED_INFO);
- if (ret == -1) {
- _LOGD("package pkg reserve info DB initialization failed\n");
- return ret;
- }
-
- ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_DISABLED_PACKAGE_APP_APP_CATEGORY);
- if (ret == -1) {
- _LOGD("package pkg reserve info DB initialization failed\n");
- return ret;
- }
-
- ret = __initialize_db(pkgmgr_parser_db, QUERY_CREATE_TABLE_DISABLED_PACKAGE_APP_APP_METADATA);
-
- if (ret == -1) {
- _LOGD("package pkg reserve info DB initialization failed\n");
- return ret;
- }
-
- return ret;
-}
-
-static int __insert_disabled_ui_mainapp_info(manifest_x *mfx)
-{
- uiapplication_x *up = mfx->uiapplication;
- int ret = -1;
- char *query = NULL;
- while(up != NULL)
- {
- query = sqlite3_mprintf("update disabled_package_app_info set app_mainapp=%Q where app_id=%Q", up->mainapp, up->appid);
-
- ret = __exec_query(query);
- sqlite3_free(query);
- if (ret == -1) {
- _LOGD("Package UiApp Info DB Insert Failed\n");
- return -1;
- }
- if (strcasecmp(up->mainapp, "True") == 0) {
- FREE_AND_NULL(mfx->mainapp_id);
- mfx->mainapp_id = strdup(up->appid);
- }
-
- up = up->next;
- }
-
- if (mfx->mainapp_id == NULL){
- if (mfx->uiapplication && mfx->uiapplication->appid) {
- query = sqlite3_mprintf("update disabled_package_app_info set app_mainapp='true' where app_id=%Q", mfx->uiapplication->appid);
- } else {
- _LOGD("Not valid appid\n");
- return -1;
- }
-
- ret = __exec_query(query);
- sqlite3_free(query);
- if (ret == -1) {
- _LOGD("Package UiApp Info DB Insert Failed\n");
- return -1;
- }
-
- free((void *)mfx->uiapplication->mainapp);
- mfx->uiapplication->mainapp= strdup("true");
- mfx->mainapp_id = strdup(mfx->uiapplication->appid);
- }
-
- query = sqlite3_mprintf("update disabled_package_info set mainapp_id=%Q where package=%Q", mfx->mainapp_id, mfx->package);
- ret = __exec_query(query);
- sqlite3_free(query);
- if (ret == -1) {
- _LOGD("Package Info DB update Failed\n");
- return -1;
- }
-
- return 0;
-}
-
-static int __insert_disabled_uiapplication_info(manifest_x *mfx)
-{
- uiapplication_x *up = mfx->uiapplication;
- int ret = -1;
- char *query = NULL;
- while(up != NULL)
- {
- query = sqlite3_mprintf("insert into disabled_package_app_info(app_id, app_component, app_exec, app_ambient_support, 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_installed_storage, component_type, package) " \
- "values(%Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q)",\
- up->appid,
- "uiapp",
- up->exec,
- up->ambient_support,
- up->nodisplay,
- up->type,
- PKGMGR_PARSER_EMPTY_STR,
- up->multiple,
- PKGMGR_PARSER_EMPTY_STR,
- up->taskmanage,
- up->enabled,
- up->hwacceleration,
- up->screenreader,
- up->mainapp,
- __get_str(up->recentimage),
- up->launchcondition,
- up->indicatordisplay,
- __get_str(up->portraitimg),
- __get_str(up->landscapeimg),
- up->guestmode_visibility,
- up->permission_type,
- mfx->preload,
- up->submode,
- __get_str(up->submode_mainid),
- mfx->installed_storage,
- up->component_type,
- mfx->package);
-
- ret = __exec_query(query);
- sqlite3_free(query);
- if (ret == -1) {
- _LOGD("Package UiApp Info DB Insert Failed\n");
- return -1;
- }
- up = up->next;
- }
- return 0;
-}
-
-static void __insert_disabled_uiapplication_locale_info(gpointer data, gpointer userdata)
-{
- int ret = -1;
- char *label = NULL;
- char *icon = NULL;
- char *query = NULL;
-
- uiapplication_x *up = (uiapplication_x*)userdata;
- label_x *lbl = up->label;
- icon_x *icn = up->icon;
-
- __extract_data(data, lbl, NULL, icn, NULL, NULL, &label, NULL, &icon, NULL, NULL);
- if (!label && !icon)
- return;
- query = sqlite3_mprintf("insert into disabled_package_app_localized_info(app_id, app_locale, " \
- "app_label, app_icon, package) values " \
- "(%Q, %Q, %Q, %Q, %Q)", up->appid, (char*)data,
- label, icon, up->package);
- ret = __exec_query(query);
- sqlite3_free(query);
- if (ret == -1)
- _LOGD("Package UiApp Localized Info DB Insert failed\n");
-
- /*insert ui app locale info to pkg locale to get mainapp data */
- if (strcasecmp(up->mainapp, "true")==0) {
- char *update_query = NULL;
- update_query = sqlite3_mprintf("insert into disabled_package_localized_info(package, package_locale, " \
- "package_label, package_icon, package_description, package_license, package_author) values " \
- "(%Q, %Q, %Q, %Q, %Q, %Q, %Q)",
- up->package,
- (char*)data,
- label,
- icon,
- PKGMGR_PARSER_EMPTY_STR,
- PKGMGR_PARSER_EMPTY_STR,
- PKGMGR_PARSER_EMPTY_STR);
-
- ret = __exec_query_no_msg(update_query);
- sqlite3_free(update_query);
-
- if (icon != NULL) {
- update_query = sqlite3_mprintf("update package_localized_info set package_icon=%Q " \
- "where package=%Q and package_locale=%Q", icon, up->package, (char*)data);
- ret = __exec_query_no_msg(update_query);
- sqlite3_free(update_query);
- }
- }
-}
-
-static int __insert_disabled_uiapplication_appcategory_info(manifest_x *mfx)
-{
- uiapplication_x *up = mfx->uiapplication;
- category_x *ct = NULL;
- int ret = -1;
- char *query = NULL;
- while(up != NULL)
- {
- ct = up->category;
- while (ct != NULL)
- {
- query = sqlite3_mprintf("insert into disabled_package_app_app_category(app_id, category, package) " \
- "values(%Q, %Q, %Q)",\
- up->appid, ct->name, up->package);
- ret = __exec_query(query);
- sqlite3_free(query);
- if (ret == -1) {
- _LOGD("Package UiApp Category Info DB Insert Failed\n");
- return -1;
- }
- ct = ct->next;
- }
- up = up->next;
- }
- return 0;
-}
-
-static int __insert_disabled_uiapplication_appmetadata_info(manifest_x *mfx)
-{
- uiapplication_x *up = mfx->uiapplication;
- metadata_x *md = NULL;
- int ret = -1;
- char *query = NULL;
- while(up != NULL)
- {
- md = up->metadata;
- while (md != NULL)
- {
- if (md->key) {
- query = sqlite3_mprintf("insert into disabled_package_app_app_metadata(app_id, md_key, md_value, package) " \
- "values(%Q, %Q, %Q, %Q)",\
- up->appid, md->key, md->value, up->package);
- ret = __exec_query(query);
- sqlite3_free(query);
- if (ret == -1) {
- _LOGD("Package UiApp Metadata Info DB Insert Failed\n");
- return -1;
- }
- }
- md = md->next;
- }
- up = up->next;
- }
- return 0;
-}
-
-static void __insert_disabled_pkglocale_info(gpointer data, gpointer userdata)
-{
- int ret = -1;
- char *label = NULL;
- char *icon = NULL;
- char *description = NULL;
- char *license = NULL;
- char *author = NULL;
- char *query = NULL;
-
- manifest_x *mfx = (manifest_x *)userdata;
- label_x *lbl = mfx->label;
- license_x *lcn = mfx->license;
- icon_x *icn = mfx->icon;
- description_x *dcn = mfx->description;
- author_x *ath = mfx->author;
-
- __extract_data(data, lbl, lcn, icn, dcn, ath, &label, &license, &icon, &description, &author);
- if (!label && !description && !icon && !license && !author)
- return;
-
- query = sqlite3_mprintf("insert into disabled_package_localized_info(package, package_locale, " \
- "package_label, package_icon, package_description, package_license, package_author) values " \
- "(%Q, %Q, %Q, %Q, %Q, %Q, %Q)",
- mfx->package,
- (char*)data,
- label,
- icon,
- __get_str(description),
- __get_str(license),
- __get_str(author));
-
- ret = __exec_query(query);
- sqlite3_free(query);
- if (ret == -1)
- _LOGD("Package Localized Info DB Insert failed\n");
-}
-
-static int __insert_disabled_pkg_info_in_db(manifest_x *mfx)
-{
- label_x *lbl = mfx->label;
- license_x *lcn = mfx->license;
- icon_x *icn = mfx->icon;
- description_x *dcn = mfx->description;
- author_x *ath = mfx->author;
- uiapplication_x *up = mfx->uiapplication;
-
- char *query = NULL;
- char root[MAX_QUERY_LEN] = { '\0' };
- int ret = -1;
- char *type = NULL;
- char *path = NULL;
- const char *auth_name = NULL;
- const char *auth_email = NULL;
- const char *auth_href = NULL;
-
- GList *pkglocale = NULL;
- GList *applocale = NULL;
-
- if (ath) {
- if (ath->text)
- auth_name = ath->text;
- if (ath->email)
- auth_email = ath->email;
- if (ath->href)
- auth_href = ath->href;
- }
-
- /*Insert in the package_info DB*/
- if (mfx->type)
- type = strdup(mfx->type);
- else
- type = strdup("rpm");
- /*Insert in the package_info DB*/
- if (mfx->root_path)
- path = strdup(mfx->root_path);
- else{
- if (type && strcmp(type,"rpm")==0)
- snprintf(root, MAX_QUERY_LEN - 1, "/usr/apps/%s", mfx->package);
- else
- snprintf(root, MAX_QUERY_LEN - 1, "/opt/usr/apps/%s", mfx->package);
-
- path = strdup(root);
- }
- query = sqlite3_mprintf("insert into disabled_package_info(package, package_type, package_version, 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) " \
- "values(%Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q, %Q)",\
- mfx->package,
- type,
- mfx->version,
- __get_str(mfx->installlocation),
- __get_str(mfx->package_size),
- mfx->removable,
- mfx->preload,
- mfx->readonly,
- mfx->update,
- mfx->appsetting,
- mfx->nodisplay_setting,
- mfx->system,
- __get_str(auth_name),
- __get_str(auth_email),
- __get_str(auth_href),
- mfx->installed_time,
- mfx->installed_storage,
- __get_str(mfx->storeclient_id),
- mfx->mainapp_id,
- __get_str(mfx->package_url),
- path,
- __get_str(mfx->csc_path));
-
- ret = __exec_query(query);
- sqlite3_free(query);
- if (ret == -1) {
- _LOGD("Package Info DB Insert Failed\n");
- if (type) {
- free(type);
- type = NULL;
- }
- if (path) {
- free(path);
- path = NULL;
- }
- return -1;
- }
-
- if (type) {
- free(type);
- type = NULL;
- }
- if (path) {
- free(path);
- path = NULL;
- }
-
- ret = __insert_disabled_ui_mainapp_info(mfx);
- if (ret == -1)
- return -1;
-
- /*Insert the package locale*/
- pkglocale = __create_locale_list(pkglocale, lbl, lcn, icn, dcn, ath);
- /*remove duplicated data in pkglocale*/
- __trimfunc(pkglocale);
-
- /*Insert the app locale info */
- while(up != NULL)
- {
- applocale = __create_locale_list(applocale, up->label, NULL, up->icon, NULL, NULL);
- up = up->next;
- }
-
- /*remove duplicated data in applocale*/
- __trimfunc(applocale);
-
- /*g_list_foreach(pkglocale, __printfunc, NULL);*/
- /*_LOGD("\n");*/
- /*g_list_foreach(applocale, __printfunc, NULL);*/
-
- g_list_foreach(pkglocale, __insert_disabled_pkglocale_info, (gpointer)mfx);
-
- /*native app locale info*/
- up = mfx->uiapplication;
- while(up != NULL)
- {
- g_list_foreach(applocale, __insert_disabled_uiapplication_locale_info, (gpointer)up);
- up = up->next;
- }
-
- g_list_free(pkglocale);
- pkglocale = NULL;
- g_list_free(applocale);
- applocale = NULL;
-
- /*Insert in the package_app_info DB*/
- ret = __insert_disabled_uiapplication_info(mfx);
- if (ret == -1)
- return -1;
-
- /*Insert in the package_app_app_category DB*/
- ret = __insert_disabled_uiapplication_appcategory_info(mfx);
- if (ret == -1)
- return -1;
-
- /*Insert in the package_app_app_metadata DB*/
- ret = __insert_disabled_uiapplication_appmetadata_info(mfx);
- if (ret == -1)
- return -1;
-
- return 0;
-}
-
-static int __delete_disabled_pkg_info_from_pkgid(const char *pkgid)
-{
- char *query = NULL;
- int ret = -1;
-
- /*Delete from Package Info DB*/
- query = sqlite3_mprintf("delete from disabled_package_info where package=%Q", pkgid);
- ret = __exec_query(query);
- tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "Package Info DB Delete Failed\n");
-
- /*Delete from Package Localized Info*/
- sqlite3_free(query);
- query = sqlite3_mprintf("delete from disabled_package_localized_info where package=%Q", pkgid);
- ret = __exec_query(query);
- tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "Package Localized Info DB Delete Failed\n");
-
- /*Delete from app Info*/
- sqlite3_free(query);
- query = sqlite3_mprintf("delete from disabled_package_app_info where package=%Q", pkgid);
- ret = __exec_query(query);
- tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "app Info DB Delete Failed\n");
-
- /*Delete from app Localized Info*/
- sqlite3_free(query);
- query = sqlite3_mprintf("delete from disabled_package_app_localized_info where package=%Q", pkgid);
- ret = __exec_query(query);
- tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "app Localized Info DB Delete Failed\n");
-
- /*Delete from app category Info*/
- sqlite3_free(query);
- query = sqlite3_mprintf("delete from disabled_package_app_app_category where package=%Q", pkgid);
- ret = __exec_query(query);
- tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "app category Info DB Delete Failed\n");
-
- /*Delete from app metadata Info*/
- sqlite3_free(query);
- query = sqlite3_mprintf("delete from disabled_package_app_app_metadata where package=%Q", pkgid);
- ret = __exec_query(query);
- tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "app metadata Info DB Delete Failed\n");
-
-catch:
- sqlite3_free(query);
- return 0;
-}
-
-API int pkgmgr_parser_insert_disabled_pkg_info_in_db(manifest_x *mfx)
-{
- if (mfx == NULL) {
- _LOGD("manifest pointer is NULL\n");
- return -1;
- }
- int ret = 0;
- ret = pkgmgr_parser_check_and_create_db();
- if (ret == -1) {
- _LOGD("Failed to open DB\n");
- return ret;
- }
- ret = pkgmgr_parser_initialize_db();
- 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[%d]\n", ret);
- ret = -1;
- goto err;
- }
- _LOGD("Transaction Begin\n");
- ret = __insert_disabled_pkg_info_in_db(mfx);
- if (ret == -1) {
- _LOGE("Insert into DB failed. Rollback now\n");
- ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
- if (ret != SQLITE_OK)
- _LOGE("ROLLBACK is fail after insert_disabled_pkg_info_in_db\n");
-
- ret = -1;
- 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 commit transaction. Rollback now\n");
-
- ret = -1;
- goto err;
- }
- _LOGD("Transaction Commit and End\n");
-err:
- pkgmgr_parser_close_db();
- return ret;
-}
-
-API int pkgmgr_parser_delete_disabled_pkgid_info_from_db(const char *pkgid)
-{
- retvm_if(pkgid == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
-
- int ret = 0;
-
- /*open db*/
- ret = pkgmgr_parser_check_and_create_db();
- retvm_if(ret < 0, PMINFO_R_ERROR, "Failed to open DB\n");
-
- /*Begin transaction*/
- ret = sqlite3_exec(pkgmgr_parser_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
- if (ret != SQLITE_OK) {
- _LOGE("Failed to begin transaction\n");
- ret = -1;
- goto err;
- }
-
- _LOGD("Start to Delete pkgid[%s] info from db\n", pkgid);
-
- /*delete pkg info*/
- ret = __delete_disabled_pkg_info_from_pkgid(pkgid);
- if (ret == -1) {
- _LOGD("Delete from DB failed. Rollback now\n");
- ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
- if (ret != SQLITE_OK)
- _LOGE("Failed to begin transaction\n");
- goto err;
- }
-
- /*Commit transaction*/
- ret = sqlite3_exec(pkgmgr_parser_db, "COMMIT", NULL, NULL, NULL);
- if (ret != SQLITE_OK) {
- _LOGD("Failed to commit transaction, Rollback now\n");
- ret = sqlite3_exec(pkgmgr_parser_db, "ROLLBACK", NULL, NULL, NULL);
- if (ret != SQLITE_OK)
- _LOGE("Failed to commit transaction, Rollback now\n");
-
- ret = -1;
- goto err;
- }
-
-err:
- pkgmgr_parser_close_db();
- return ret;
-}
-
-API int pkgmgr_parser_insert_disabled_pkg(const char *pkgid, char *const tagv[])
-{
- retvm_if(pkgid == NULL, PM_PARSER_R_ERROR, "argument supplied is NULL");
-
- char *manifest = NULL;
- manifest_x *mfx = NULL;
- int ret = -1;
-
- _LOGD("parsing manifest for installation: %s\n", pkgid);
-
- manifest = pkgmgr_parser_get_manifest_file(pkgid);
- if (manifest == NULL) {
- _LOGE("can not get the manifest.xml\n");
- return -1;
- }
-
- xmlInitParser();
- mfx = pkgmgr_parser_process_manifest_xml(manifest);
- retvm_if(mfx == NULL, PM_PARSER_R_ERROR, "argument supplied is NULL");
-
- _LOGD("Parsing Finished\n");
-
- __add_preload_info(mfx, manifest);
-
- _LOGD("Added preload infomation\n");
-
- FREE_AND_NULL(manifest);
-
- ret = pkgmgr_parser_insert_disabled_pkg_info_in_db(mfx);
- retvm_if(ret == PM_PARSER_R_ERROR, PM_PARSER_R_ERROR, "DB Insert failed");
-
- _LOGD("DB Insert Success\n");
-
- pkgmgr_parser_free_manifest_xml(mfx);
- _LOGD("Free Done\n");
- xmlCleanupParser();
-
- return PM_PARSER_R_OK;
-}
-
-API int pkgmgr_parser_delete_disabled_pkg(const char *pkgid, char *const tagv[])
-{
- retvm_if(pkgid == NULL, PM_PARSER_R_ERROR, "argument supplied is NULL");
-
- int ret = -1;
-
- _LOGD("Start uninstall for pkgid : delete pkgid[%s]\n", pkgid);
-
- /* delete pkgmgr db */
- ret = pkgmgr_parser_delete_disabled_pkgid_info_from_db(pkgid);
- if (ret == -1)
- _LOGD("DB pkgid info Delete failed\n");
- else
- _LOGD("DB pkgid info Delete Success\n");
-
- _LOGD("Finish : uninstall for pkgid\n");
-
- return PM_PARSER_R_OK;
-}
+++ /dev/null
-/*
- * pkgmgr-info
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-#ifndef __PKGMGR_PARSER_FEATURE_H__
-#define __PKGMGR_PARSER_FEATURE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int __init_tables_for_wearable(void);
-int pkgmgr_parser_insert_disabled_pkg(const char *pkgid, char *const tagv[]);
-int pkgmgr_parser_delete_disabled_pkg(const char *pkgid, char *const tagv[]);
-int pkgmgr_parser_insert_disabled_pkg_info_in_db(manifest_x *mfx);
-int pkgmgr_parser_delete_disabled_pkgid_info_from_db(const char *pkgid);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* __PKGPMGR_PARSER_FEATURE_H__ */
void pkgmgr_parser_close_db();
void __add_preload_info(manifest_x * mfx, const char *manifest);
-void __extract_data(gpointer data, label_x *lbl, license_x *lcn, icon_x *icn, description_x *dcn, author_x *ath,
+void __extract_data(gpointer data, GList *lbl, GList *lcn, GList *icn, GList *dcn, GList *ath,
char **label, char **license, char **icon, char **description, char **author);
-GList *__create_locale_list(GList *locale, label_x *lbl, license_x *lcn, icon_x *icn, description_x *dcn, author_x *ath);
+GList *__create_locale_list(GList *locale, GList *lbl, GList *lcn, GList *icn, GList *dcn, GList *ath);
int __exec_query_no_msg(char *query);
void __trimfunc(GList* trim_list);
const char *__get_str(const char *str);
int __initialize_db(sqlite3 *db_handle, char *db_query);
int __exec_query(char *query);
int __evaluate_query(sqlite3 *db_handle, char *query);
+char *__zone_get_root_path(const char *zone);
#endif /* __PKGMGR_PARSER_INTERNAL_H__ */
#include "pkgmgr_parser_plugin.h"
#include "pkgmgr-info.h"
#include "pkgmgrinfo_debug.h"
+#include "pkgmgr_parser_internal.h"
#ifdef LOG_TAG
#undef LOG_TAG
const xmlChar *value;
name = xmlTextReaderConstName(reader);
if (name == NULL) {
- _LOGE("TEST TEST TES\n");
- name = BAD_CAST "--";
+ _LOGE("name is NULL.");
}
value = xmlTextReaderConstValue(reader);
name = xmlTextReaderConstName(reader);
if (name == NULL) {
- _LOGE("TEST TEST TES\n");
- name = BAD_CAST "--";
+ _LOGE("name is NULL.");
}
xmlDocPtr docPtr = xmlTextReaderCurrentDoc(reader);
int tag_exist = 0;
char buffer[1024] = { 0, };
category_x *category = NULL;
+ GList *ct = NULL;
GList *category_list = NULL;
__category_t *category_detail = NULL;
return;
}
- uiapplication_x *up = plugin_info->mfx->uiapplication;
- while(up != NULL)
+ uiapplication_x *up = NULL;
+ GList *list_up = plugin_info->mfx->uiapplication;
+ while(list_up != NULL)
{
- category = up->category;
- while (category != NULL)
+ up = (uiapplication_x *)list_up->data;
+ ct = up->category;
+ while (ct != NULL)
{
+ category = (category_x*)ct->data;
//get glist of category key and value combination
memset(buffer, 0x00, 1024);
snprintf(buffer, 1024, "%s/", plugin_info->name);
- if ((category->name) && (strncmp(category->name, plugin_info->name, strlen(plugin_info->name)) == 0)) {
+ if ((category) && (category->name) && (strncmp(category->name, plugin_info->name, strlen(plugin_info->name)) == 0)) {
category_detail = (__category_t*) calloc(1, sizeof(__category_t));
if (category_detail == NULL) {
_LOGD("Memory allocation failed\n");
category_list = g_list_append(category_list, (gpointer)category_detail);
tag_exist = 1;
}
- category = category->next;
+ ct = ct->next;
}
//send glist to parser when tags for metadata plugin parser exist.
__category_parser_clear_dir_list(category_list);
category_list = NULL;
tag_exist = 0;
- up = up->next;
+ list_up = list_up->next;
}
END:
if (category_list)
static void __process_metadata_parser(pkgmgr_parser_plugin_info_x *plugin_info)
{
int tag_exist = 0;
- char buffer[1024] = { 0, };
- metadata_x *md = NULL;
+// char buffer[1024] = { 0, }; Not in use anywhere
+ metadata_x *metadata = NULL;
+ GList *md = NULL;
GList *md_list = NULL;
__metadata_t *md_detail = NULL;
return;
}
- uiapplication_x *up = plugin_info->mfx->uiapplication;
- while(up != NULL)
+ uiapplication_x *up = NULL;
+ GList *list_up = plugin_info->mfx->uiapplication;
+
+ while(list_up != NULL)
{
+ up = (uiapplication_x *)list_up->data;
md = up->metadata;
while (md != NULL)
{
+ metadata = (metadata_x *)md->data;
//get glist of metadata key and value combination
- memset(buffer, 0x00, 1024);
- snprintf(buffer, 1024, "%s/", plugin_info->name);
- if ((md->key && md->value) && (strncmp(md->key, plugin_info->name, strlen(plugin_info->name)) == 0)) {
+// memset(buffer, 0x00, 1024);
+// snprintf(buffer, 1024, "%s/", plugin_info->name);
+ if ((metadata && metadata->key && metadata->value) && (strncmp(metadata->key, plugin_info->name, strlen(plugin_info->name)) == 0)) {
md_detail = (__metadata_t*) calloc(1, sizeof(__metadata_t));
if (md_detail == NULL) {
_LOGD("Memory allocation failed\n");
goto END;
}
- md_detail->key = (char*) calloc(1, sizeof(char)*(strlen(md->key)+2));
+ md_detail->key = (char*) calloc(1, sizeof(char)*(strlen(metadata->key)+2));
if (md_detail->key == NULL) {
_LOGD("Memory allocation failed\n");
FREE_AND_NULL(md_detail);
goto END;
}
- snprintf(md_detail->key, (strlen(md->key)+1), "%s", md->key);
+ snprintf(md_detail->key, (strlen(metadata->key)+1), "%s", metadata->key);
- md_detail->value = (char*) calloc(1, sizeof(char)*(strlen(md->value)+2));
+ md_detail->value = (char*) calloc(1, sizeof(char)*(strlen(metadata->value)+2));
if (md_detail->value == NULL) {
_LOGD("Memory allocation failed\n");
FREE_AND_NULL(md_detail->key);
FREE_AND_NULL(md_detail);
goto END;
}
- snprintf(md_detail->value, (strlen(md->value)+1), "%s", md->value);
+ snprintf(md_detail->value, (strlen(metadata->value)+1), "%s", metadata->value);
md_list = g_list_append(md_list, (gpointer)md_detail);
tag_exist = 1;
__metadata_parser_clear_dir_list(md_list);
md_list = NULL;
tag_exist = 0;
- up = up->next;
+ list_up = list_up->next;
}
END:
if(md_list)
__metadata_parser_clear_dir_list(md_list);
+ metadata = NULL;
return;
}
int ret = 0;
plugin_info->lib_handle = dlopen(plugin_info->path, RTLD_LAZY);
- retm_if(plugin_info->lib_handle == NULL, "dlopen is failed lib_path");
+ if (plugin_info->lib_handle == NULL) return;
ret = __parser_send_tag(plugin_info->lib_handle, plugin_info->action, PLUGIN_PRE_PROCESS, plugin_info->pkgid);
_LOGS("PLUGIN_PRE_PROCESS : [%s] result=[%d]\n", plugin_info->name, ret);
}
-int _pkgmgr_parser_plugin_open_db()
+int _zone_pkgmgr_parser_plugin_open_db(const char *zone)
{
char *error_message = NULL;
int ret;
FILE * fp = NULL;
+ char db_path[PKG_STRING_LEN_MAX] = {'\0',};
- fp = fopen(PKGMGR_PARSER_DB_FILE, "r");
+ if (zone == NULL || strlen(zone) == 0 || strcmp(zone, ZONE_HOST) == 0) {
+ snprintf(db_path, PKG_STRING_LEN_MAX, "%s", PKGMGR_PARSER_DB_FILE);
+ } else {
+ char *rootpath = NULL;
+ rootpath = __zone_get_root_path(zone);
+ if (rootpath == NULL) {
+ _LOGE("Failed to get rootpath");
+ return -1;
+ }
+
+ snprintf(db_path, PKG_STRING_LEN_MAX, "%s%s", rootpath, PKGMGR_PARSER_DB_FILE);
+ }
+ _LOGD("db path(%s)", db_path);
+
+ fp = fopen(db_path, "r");
if (fp != NULL) {
fclose(fp);
- ret = db_util_open(PKGMGR_PARSER_DB_FILE, &pkgmgr_parser_db, DB_UTIL_REGISTER_HOOK_METHOD);
+ ret = db_util_open(db_path, &pkgmgr_parser_db, DB_UTIL_REGISTER_HOOK_METHOD);
if (ret != SQLITE_OK) {
_LOGE("package info DB initialization failed\n");
return -1;
return 0;
}
- ret = db_util_open(PKGMGR_PARSER_DB_FILE, &pkgmgr_parser_db, DB_UTIL_REGISTER_HOOK_METHOD);
+ ret = db_util_open(db_path, &pkgmgr_parser_db, DB_UTIL_REGISTER_HOOK_METHOD);
if (ret != SQLITE_OK) {
_LOGE("package info DB initialization failed\n");
return -1;
return 0;
}
+int _pkgmgr_parser_plugin_open_db()
+{
+ return _zone_pkgmgr_parser_plugin_open_db(NULL);
+}
void _pkgmgr_parser_plugin_close_db()
{
sqlite3_close(pkgmgr_parser_db);
}
-void _pkgmgr_parser_plugin_process_plugin(manifest_x *mfx, const char *filename, ACTION_TYPE action)
+void _zone_pkgmgr_parser_plugin_process_plugin(manifest_x *mfx, const char *filename, ACTION_TYPE action, const char *zone)
{
int ret = 0;
memset(plugin_info, '\0', sizeof(pkgmgr_parser_plugin_info_x));
/*initialize pkgmgr_paser db*/
- ret = _pkgmgr_parser_plugin_open_db();
+ ret = _zone_pkgmgr_parser_plugin_open_db(zone);
if (ret < 0)
_LOGE("_pkgmgr_parser_plugin_open_db failed\n");
__clean_plugin_info(plugin_info);
}
+void _pkgmgr_parser_plugin_process_plugin(manifest_x *mfx, const char *filename, ACTION_TYPE action)
+{
+ _zone_pkgmgr_parser_plugin_process_plugin(mfx, filename, action, NULL);
+}
+
void _pkgmgr_parser_plugin_uninstall_plugin(const char *plugin_type, const char *pkgid, const char *appid)
{
int ret = 0;
void _pkgmgr_parser_plugin_process_plugin(manifest_x *mfx, const char *filename, ACTION_TYPE action);
void _pkgmgr_parser_plugin_uninstall_plugin(const char *plugin_type, const char *pkgid, const char *appid);
+int _zone_pkgmgr_parser_plugin_open_db(const char *zone);
+void _zone_pkgmgr_parser_plugin_process_plugin(manifest_x *mfx, const char *filename,
+ ACTION_TYPE action, const char *zone);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
# path : directory path for plugin library
flag="0x00000001":type="tag":name="shortcut-list":path="/usr/etc/package-manager/parserlib/libshortcut-list.so"
-flag="0x00000002":type="tag":name="widget":path="/usr/etc/package-manager/parserlib/libwidget.so"
-flag="0x00000004":type="tag":name="account":path="/usr/etc/package-manager/parserlib/libaccount.so"
-flag="0x00000008":type="tag":name="notifications":path="/usr/etc/package-manager/parserlib/libnotifications.so"
-flag="0x00000010":type="tag":name="privileges":path="/usr/etc/package-manager/parserlib/libprivileges.so"
-flag="0x00000020":type="tag":name="ime":path="/usr/etc/package-manager/parserlib/libime.so"
-flag="0x00000040":type="category":name="http://tizen.org/category/downloadable_font":path="/usr/etc/package-manager/parserlib/category/libdownloadable_font.so"
-flag="0x00000080":type="metadata":name="http://developer.samsung.com/tizen/metadata/sticker":path="/usr/etc/package-manager/parserlib/metadata/libsticker.so"
-flag="0x00000100":type="metadata":name="http://developer.samsung.com/tizen/metadata/ttsengine":path="/usr/etc/package-manager/parserlib/metadata/libttsengine.so"
-flag="0x00000200":type="metadata":name="http://developer.samsung.com/tizen/metadata/downloadable_filters":path="/usr/etc/package-manager/parserlib/metadata/libdownloadable_filters.so"
-flag="0x00000400":type="metadata":name="http://developer.samsung.com/tizen/metadata/dictionary":path="/usr/etc/package-manager/parserlib/metadata/libdictionary.so"
-flag="0x00000800":type="category":name="http://tizen.org/category/antivirus":path="/usr/etc/package-manager/parserlib/category/libantivirus.so"
-flag="0x00001000":type="metadata":name="http://developer.samsung.com/tizen/metadata/profile":path="/usr/etc/package-manager/parserlib/metadata/libtheme.so"
-flag="0x00002000":type="category":name="http://tizen.org/category/tts":path="/usr/etc/package-manager/parserlib/category/libsamsung_tts.so"
-flag="0x00004000":type="tag":name="livebox":path="/usr/etc/package-manager/parserlib/liblivebox.so"
-flag="0x00010000":type="tag":name="watch-application":path="/usr/etc/package-manager/parserlib/libwatch-application.so"
+flag="0x00000002":type="tag":name="account":path="/usr/etc/package-manager/parserlib/libaccount.so"
+flag="0x00000004":type="tag":name="notifications":path="/usr/etc/package-manager/parserlib/libnotifications.so"
+flag="0x00000008":type="tag":name="privileges":path="/usr/etc/package-manager/parserlib/libprivileges.so"
+flag="0x00000010":type="tag":name="ime":path="/usr/etc/package-manager/parserlib/libime.so"
+flag="0x00000020":type="category":name="http://tizen.org/category/downloadable_font":path="/usr/etc/package-manager/parserlib/category/libdownloadable_font.so"
+flag="0x00000040":type="metadata":name="http://developer.samsung.com/tizen/metadata/sticker":path="/usr/etc/package-manager/parserlib/metadata/libsticker.so"
+flag="0x00000080":type="metadata":name="http://developer.samsung.com/tizen/metadata/ttsengine":path="/usr/etc/package-manager/parserlib/metadata/libttsengine.so"
+flag="0x00000100":type="metadata":name="http://developer.samsung.com/tizen/metadata/downloadable_filters":path="/usr/etc/package-manager/parserlib/metadata/libdownloadable_filters.so"
+flag="0x00000200":type="metadata":name="http://developer.samsung.com/tizen/metadata/dictionary":path="/usr/etc/package-manager/parserlib/metadata/libdictionary.so"
+flag="0x00000400":type="category":name="http://tizen.org/category/antivirus":path="/usr/etc/package-manager/parserlib/category/libantivirus.so"
+flag="0x00000800":type="metadata":name="http://developer.samsung.com/tizen/metadata/profile":path="/usr/etc/package-manager/parserlib/metadata/libtheme.so"
+flag="0x00001000":type="category":name="http://tizen.org/category/tts":path="/usr/etc/package-manager/parserlib/category/libsamsung_tts.so"
+flag="0x00002000":type="tag":name="livebox":path="/usr/etc/package-manager/parserlib/liblivebox.so"
+flag="0x00004000":type="tag":name="watch-application":path="/usr/etc/package-manager/parserlib/libwatch-application.so"
+flag="0x00008000":type="tag":name="widget-application":path="/usr/etc/package-manager/parserlib/libwidget-application.so"
--- /dev/null
+/*
+ * pkgmgr-info
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
+ * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <db-util.h>
+#include <glib.h>
+#include <dlfcn.h>
+#include <libxml/parser.h>
+#include <libxml/xmlreader.h>
+#include <libxml/xmlschemas.h>
+#include <bundle.h>
+#include <bundle_internal.h>
+#include "pkgmgrinfo_debug.h"
+#include "pkgmgrinfo_type.h"
+#include "pkgmgr_parser.h"
+#include "pkgmgr_parser_resource.h"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "PKGMGR_PARSER"
+
+#define XMLCHAR(s) (const xmlChar *)s
+#define ASCII(s) (char *)s
+
+#define FREE_AND_NULL(ptr) do { \
+ if (ptr) { \
+ free((void *)ptr); \
+ ptr = NULL; \
+ } \
+ } while (0)
+
+
+#define RSC_XML_QUALIFIER "res"
+#define RSC_GROUP_NAME_SEPERATOR '-'
+#define RSC_GROUP "group"
+#define RSC_GROUP_ATTR_FOLDER "folder"
+#define RSC_GROUP_ATTR_TYPE "type"
+#define RSC_NODE "node"
+#define RSC_MANIFEST_SCHEMA_FILE "/usr/etc/package-manager/preload/res.xsd"
+
+static int __next_child_element(xmlTextReaderPtr reader, int depth)
+{
+ int ret = xmlTextReaderRead(reader);
+ int cur = xmlTextReaderDepth(reader);
+ while (ret == 1) {
+ switch (xmlTextReaderNodeType(reader)) {
+ case XML_READER_TYPE_ELEMENT:
+ if (cur == depth + 1)
+ return 1;
+ break;
+ case XML_READER_TYPE_TEXT:
+ /*text is handled by each function separately*/
+ if (cur == depth + 1)
+ return 0;
+ break;
+ case XML_READER_TYPE_END_ELEMENT:
+ if (cur == depth)
+ return 0;
+ break;
+ default:
+ if (cur <= depth)
+ return 0;
+ break;
+ }
+ ret = xmlTextReaderRead(reader);
+ cur = xmlTextReaderDepth(reader);
+ }
+ return ret;
+}
+
+static void _free_node_list(gpointer data)
+{
+ resource_node_t *tmp_node = (resource_node_t *)data;
+
+ if (tmp_node == NULL) {
+ _LOGE("node list's element is NULL");
+ return;
+ }
+
+ FREE_AND_NULL(tmp_node->folder);
+ if (tmp_node->attr != NULL) {
+ bundle_free(tmp_node->attr);
+ tmp_node->attr = NULL;
+ }
+}
+
+static void _free_group_list(gpointer data)
+{
+ resource_group_t *tmp_group = (resource_group_t *)data;
+
+ if (tmp_group == NULL) {
+ _LOGE("group list's element is NULL");
+ return;
+ }
+
+ FREE_AND_NULL(tmp_group->folder);
+ FREE_AND_NULL(tmp_group->type);
+
+ g_list_free_full(tmp_group->node_list, (GDestroyNotify)_free_node_list);
+}
+
+static void __save_resource_attribute_into_bundle(xmlTextReaderPtr reader, char *attribute, bundle **b)
+{
+ xmlChar *attr_val = xmlTextReaderGetAttribute(reader, XMLCHAR(attribute));
+
+ if (attr_val)
+ bundle_add_str(*b, attribute, (char *)attr_val);
+}
+
+static void __save_resource_attribute(xmlTextReaderPtr reader, char *attribute, char **xml_attribute, char *default_value)
+{
+ xmlChar *attrib_val = xmlTextReaderGetAttribute(reader, XMLCHAR(attribute));
+
+ if (attrib_val)
+ *xml_attribute = strdup(ASCII(attrib_val));
+ else {
+ if (default_value != NULL)
+ *xml_attribute = strdup(default_value);
+ }
+}
+
+
+static void __psp_process_node(xmlTextReaderPtr reader, resource_node_t **res_node)
+{
+ char *node_folder = NULL;
+
+ __save_resource_attribute(reader, "folder", &node_folder, NULL);
+ bundle *b = NULL;
+ (*res_node)->folder = node_folder;
+
+ /*retrieve node's attribute and put it into bundle*/
+ b = bundle_create();
+
+ __save_resource_attribute_into_bundle(reader, RSC_NODE_ATTR_SCREEN_DPI, &b);
+ __save_resource_attribute_into_bundle(reader, RSC_NODE_ATTR_SCREEN_DPI_RANGE, &b);
+ __save_resource_attribute_into_bundle(reader, RSC_NODE_ATTR_SCREEN_WIDTH_RANGE, &b);
+ __save_resource_attribute_into_bundle(reader, RSC_NODE_ATTR_SCREEN_LARGE, &b);
+ __save_resource_attribute_into_bundle(reader, RSC_NODE_ATTR_SCREEN_BPP, &b);
+ __save_resource_attribute_into_bundle(reader, RSC_NODE_ATTR_PLATFORM_VER, &b);
+ __save_resource_attribute_into_bundle(reader, RSC_NODE_ATTR_LANGUAGE, &b);
+
+ (*res_node)->attr = b;
+}
+
+static int __psp_process_group(xmlTextReaderPtr reader, resource_group_t **res_group, char *group_type)
+{
+ int depth = -1;
+ int ret = -1;
+ resource_group_t *tmp_group = NULL;
+ resource_node_t *res_node = NULL;
+ const xmlChar *node;
+ char *folder = NULL;
+
+ if (reader == NULL || *res_group == NULL || group_type == NULL) {
+ _LOGE("invalid parameter");
+ return PMINFO_R_EINVAL;
+ }
+
+ tmp_group = *res_group;
+ /*handle group's own attribute*/
+ __save_resource_attribute(reader, RSC_GROUP_ATTR_FOLDER, &folder, NULL);
+ tmp_group->folder = folder;
+ tmp_group->type = group_type;
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = __next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ _LOGE("xmlTextReaderConstName value is NULL");
+ return PMINFO_R_ERROR;
+ }
+
+ res_node = NULL;
+ if (!strcmp(ASCII(node), RSC_NODE)) {
+ res_node = malloc(sizeof(resource_node_t));
+ if (res_node == NULL) {
+ _LOGE("malloc failed");
+ return -1;
+ }
+ tmp_group->node_list = g_list_append(tmp_group->node_list, res_node);
+ __psp_process_node(reader, &res_node);
+ } else {
+ _LOGE("unidentified node has found[%s]", ASCII(node));
+ return PMINFO_R_ERROR;
+ }
+ }
+ return ret;
+}
+
+static int __is_group(char *node, char **type)
+{
+ char *tmp = NULL;
+
+ if (node == NULL) {
+ _LOGE("node is null");
+ return PMINFO_R_EINVAL;
+ }
+
+ tmp = strchr(node, RSC_GROUP_NAME_SEPERATOR);
+ tmp = tmp + 1; /*remove dash seperator*/
+ if (!strcmp(tmp, PKGMGR_RSC_GROUP_TYPE_IMAGE))
+ *type = strdup(tmp);
+ else if (!strcmp(tmp, PKGMGR_RSC_GROUP_TYPE_LAYOUT))
+ *type = strdup(tmp);
+ else if (!strcmp(tmp, PKGMGR_RSC_GROUP_TYPE_SOUND))
+ *type = strdup(tmp);
+ else if (!strcmp(tmp, PKGMGR_RSC_GROUP_TYPE_BIN))
+ *type = strdup(tmp);
+ else
+ return PMINFO_R_ERROR;
+
+ if (*type == NULL) {
+ _LOGE("strdup failed with node[%s]", node);
+ return PMINFO_R_ERROR;
+ }
+
+ return PMINFO_R_OK;
+}
+
+static int __start_resource_process(xmlTextReaderPtr reader, GList **list)
+{
+ GList *tmp_list = NULL;
+ const xmlChar *node;
+ char *group_type = NULL;
+ int ret = -1;
+ int depth = -1;
+ resource_group_t *res_group = NULL;
+
+ if (reader == NULL) {
+ _LOGE("reader is null");
+ return PMINFO_R_EINVAL;
+ }
+
+ depth = xmlTextReaderDepth(reader);
+ while ((ret = __next_child_element(reader, depth))) {
+ node = xmlTextReaderConstName(reader);
+ if (!node) {
+ _LOGE("xmlTextReaderConstName value is null");
+ return -1;
+ }
+
+ group_type = NULL;
+ ret = __is_group(ASCII(node), &group_type);
+ if (ret) {
+ _LOGE("unidentified node[%s] has found with error[%d]", ASCII(node), ret);
+ goto err;
+ }
+ res_group = NULL;
+ res_group = malloc(sizeof(resource_group_t));
+ if (res_group == NULL) {
+ _LOGE("malloc failed");
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ memset(res_group, '\0', sizeof(resource_group_t));
+ tmp_list = g_list_append(tmp_list, res_group);
+ ret = __psp_process_group(reader, &res_group, group_type);
+ if (ret != 0) {
+ _LOGE("resource group processing failed");
+ ret = PMINFO_R_ERROR;
+ goto err;
+ }
+ }
+
+ *list = g_list_first(tmp_list);
+ return ret;
+
+err:
+ FREE_AND_NULL(group_type);
+ FREE_AND_NULL(res_group);
+ g_list_free_full(tmp_list, _free_group_list);
+
+ return ret;
+}
+
+static int __process_resource_manifest(xmlTextReaderPtr reader, resource_data_t *data)
+{
+ const xmlChar *node;
+ int ret = PMINFO_R_ERROR;
+
+ if (reader == NULL)
+ return PMINFO_R_ERROR;
+
+ ret = __next_child_element(reader, -1);
+ if (ret) {
+ node = xmlTextReaderConstName(reader);
+ retvm_if(!node, PMINFO_R_ERROR, "xmlTextReaderConstName value is NULL\n");
+
+ if (!strcmp(ASCII(node), RSC_XML_QUALIFIER)) {
+ ret = __start_resource_process(reader, &data->group_list);
+ if (data->group_list == NULL)
+ _LOGE("__process_resource_manifest about to end but group list is null[%d]", ret);
+ } else {
+ _LOGE("no manifest element[res] has found");
+ return PMINFO_R_ERROR;
+ }
+ }
+ return ret;
+}
+
+static resource_data_t *_pkgmgr_resource_parser_process_manifest_xml(const char *manifest)
+{
+ xmlTextReaderPtr reader;
+ resource_data_t *rsc_data = NULL;
+
+ reader = xmlReaderForFile(manifest, NULL, 0);
+ if (reader) {
+ rsc_data = malloc(sizeof(resource_data_t));
+ if (rsc_data == NULL) {
+ _LOGE("memory allocation failed");
+ return NULL;
+ }
+
+ memset(rsc_data, '\0', sizeof(resource_data_t));
+ if (__process_resource_manifest(reader, rsc_data) < 0) {
+ _LOGE("parsing failed with given manifest[%s]", manifest);
+ if (pkgmgr_resource_parser_close(rsc_data) != 0)
+ _LOGE("closing failed");
+ FREE_AND_NULL(rsc_data);
+ } else
+ _LOGE("parsing succeed");
+
+ xmlFreeTextReader(reader);
+ } else {
+ _LOGE("creating xmlreader failed");
+ FREE_AND_NULL(rsc_data);
+ }
+ return rsc_data;
+}
+
+API int pkgmgr_resource_parser_open(const char *fname, resource_data_t **data)
+{
+ resource_data_t *rsc_data = NULL;
+ int ret = PMINFO_R_ERROR;
+
+ if (fname == NULL || access(fname, R_OK) != 0) {
+ _LOGE("filename is null or cannot access file");
+ return PMINFO_R_EINVAL;
+ }
+ xmlInitParser();
+ rsc_data = _pkgmgr_resource_parser_process_manifest_xml(fname);
+ if (rsc_data == NULL) {
+ _LOGE("parsing failed");
+ goto catch;
+ }
+
+ rsc_data->package = NULL;
+
+ *data = rsc_data;
+ ret = PMINFO_R_OK;
+catch:
+ xmlCleanupParser();
+ return ret;
+}
+
+API int pkgmgr_resource_parser_close(resource_data_t *data)
+{
+ if (data == NULL) {
+ _LOGE("parameter is NULL");
+ return PMINFO_R_EINVAL;
+ }
+
+ FREE_AND_NULL(data->package);
+ g_list_free_full(data->group_list, (GDestroyNotify)_free_group_list);
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgr_resource_parser_check_xml_validation(const char *xmlfile)
+{
+ if (xmlfile == NULL) {
+ _LOGE("manifest file is NULL\n");
+ return PM_PARSER_R_EINVAL;
+ }
+ int ret = PM_PARSER_R_OK;
+ xmlSchemaParserCtxtPtr ctx = NULL;
+ xmlSchemaValidCtxtPtr vctx = NULL;
+ xmlSchemaPtr xschema = NULL;
+ ctx = xmlSchemaNewParserCtxt(RSC_MANIFEST_SCHEMA_FILE);
+ if (ctx == NULL) {
+ _LOGE("xmlSchemaNewParserCtxt() Failed\n");
+ return PM_PARSER_R_ERROR;
+ }
+ xschema = xmlSchemaParse(ctx);
+ if (xschema == NULL) {
+ _LOGE("xmlSchemaParse() Failed\n");
+ ret = PM_PARSER_R_ERROR;
+ goto cleanup;
+ }
+ vctx = xmlSchemaNewValidCtxt(xschema);
+ if (vctx == NULL) {
+ _LOGE("xmlSchemaNewValidCtxt() Failed\n");
+ return PM_PARSER_R_ERROR;
+ }
+ xmlSchemaSetValidErrors(vctx, (xmlSchemaValidityErrorFunc) fprintf, (xmlSchemaValidityWarningFunc) fprintf, stderr);
+ ret = xmlSchemaValidateFile(vctx, xmlfile, 0);
+ if (ret == -1) {
+ _LOGE("xmlSchemaValidateFile() failed\n");
+ ret = PM_PARSER_R_ERROR;
+ goto cleanup;
+ } else if (ret == 0) {
+ _LOGE("Manifest is Valid\n");
+ ret = PM_PARSER_R_OK;
+ goto cleanup;
+ } else {
+ _LOGE("Manifest Validation Failed with error code %d\n", ret);
+ ret = PM_PARSER_R_ERROR;
+ goto cleanup;
+ }
+
+cleanup:
+ if(vctx != NULL)
+ xmlSchemaFreeValidCtxt(vctx);
+
+ if(ctx != NULL)
+ xmlSchemaFreeParserCtxt(ctx);
+
+ if(xschema != NULL)
+ xmlSchemaFree(xschema);
+
+ return ret;
+}
--- /dev/null
+#ifndef __PKGMGR_PARSER_RESOURCE_H_
+#define __PKGMGR_PARSER_RESOURCE_H_
+
+#include <bundle.h>
+#include <glib.h>
+#include "pkgmgr_parser.h"
+
+#define PKGMGR_RSC_GROUP_TYPE_IMAGE "image"
+#define PKGMGR_RSC_GROUP_TYPE_LAYOUT "layout"
+#define PKGMGR_RSC_GROUP_TYPE_SOUND "sound"
+#define PKGMGR_RSC_GROUP_TYPE_BIN "bin"
+
+#define RSC_NODE_ATTR_SCREEN_DPI "screen-dpi"
+#define RSC_NODE_ATTR_SCREEN_DPI_RANGE "screen-dpi-range"
+#define RSC_NODE_ATTR_SCREEN_WIDTH_RANGE "screen-width-range"
+#define RSC_NODE_ATTR_SCREEN_LARGE "screen-large"
+#define RSC_NODE_ATTR_SCREEN_BPP "screen-bpp"
+#define RSC_NODE_ATTR_PLATFORM_VER "platform-version"
+#define RSC_NODE_ATTR_LANGUAGE "language"
+
+enum {
+ NODE_ATTR_MIN = 0,
+ NODE_ATTR_SCREEN_DPI,
+ NODE_ATTR_SCREEN_DPI_RANGE,
+ NODE_ATTR_SCREEN_WIDTH_RANGE,
+ NODE_ATTR_SCREEN_LARGE,
+ NODE_ATTR_SCREEN_BPP,
+ NODE_ATTR_PLATFORM_VER,
+ NODE_ATTR_LANGUAGE,
+ NODE_ATTR_MAX,
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ char *folder;
+ bundle *attr;
+} resource_node_t;
+
+typedef struct {
+ char *folder;
+ char *type;
+ GList *node_list;
+} resource_group_t;
+
+typedef struct {
+ char *package;
+ GList *group_list;
+} resource_data_t;
+
+/**
+ * @fn int *pkgmgr_resource_parser_open(const char *fname, resource_data_t **data)
+ * @brief This API initialize parses res.xml which identified by fname and package and put it into data.
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] fname pointer to xml filename
+ * @param[out]data pointer of pointer to resource_data type structure.
+ * @return 0 on succeed and -1 on failure, -2 on invalid parameter
+ */
+API int pkgmgr_resource_parser_open(const char *fname, resource_data_t **data);
+
+/**
+ * @fn int pkgmgr_resource_parser_close(resource_data_t data)
+ * @brief This API frees given data and its own variables
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] data structure of resource_data_t
+ * @return 0 on succeed and -1 on failure, -2 on invalid parameter
+ */
+API int pkgmgr_resource_parser_close(resource_data_t *data);
+
+/**
+ * @fn int pkgmgr_resource_parser_check_xml_validation(const char *xmlfile)
+ * @brief This API will validates given resource manifest file
+ *
+ * @par This API is for package-manager installer backends.
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] manifest manifest filepath to be validated
+ * @return 0 on succeed and -1 on failure, -2 on invalid parameter
+ */
+API int pkgmgr_resource_parser_check_xml_validation(const char *xmlfile);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+ targetNamespace="http://tizen.org/ns/rm" xmlns:packages="http://tizen.org/ns/rm">
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace"/>
+ <xs:element name="res">
+ <xs:complexType>
+ <xs:all>
+ <xs:element name="group-image" type="packages:GroupContainer" maxOccurs="1" minOccurs="0"/>
+ <xs:element name="group-layout" type="packages:GroupContainer" maxOccurs="1" minOccurs="0"/>
+ <xs:element name="group-sound" type="packages:GroupContainer" maxOccurs="1" minOccurs="0"/>
+ <xs:element name="group-bin" type="packages:GroupContainer" maxOccurs="1" minOccurs="0"/>
+ </xs:all>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="GroupContainer">
+ <xs:sequence>
+ <xs:element name="node" maxOccurs="unbounded" minOccurs="0">
+ <xs:complexType>
+ <xs:attribute name="folder" type="xs:string" use="required"/>
+ <xs:attribute name="screen-dpi" type="xs:integer"/>
+ <xs:attribute name="screen-dpi-range" type="xs:string"/>
+ <xs:attribute name="screen-width-range" type="xs:string"/>
+ <xs:attribute name="screen-large" type="xs:boolean"/>
+ <xs:attribute name="screen-bpp" type="xs:integer"/>
+ <xs:attribute name="platform-version" type="xs:string"/>
+ <xs:attribute name="language" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="folder" type="xs:string" use="required"/>
+ </xs:complexType>
+</xs:schema>
\ No newline at end of file
Name: pkgmgr-info
Description: Simple string key/val dictionary library
Version: @VERSION@
+Requires: @PC_REQUIRED@
Libs: -L${libdir} -lpkgmgr-info
Cflags: -I${includedir}
#define FILTER_QUERY_COUNT_APP "select DISTINCT package_app_info.app_id, package_app_info.app_component, package_app_info.app_installed_storage " \
"from package_app_info LEFT OUTER JOIN package_app_localized_info " \
"ON package_app_info.app_id=package_app_localized_info.app_id " \
- "and package_app_localized_info.app_locale='%s' " \
+ "and package_app_localized_info.app_locale=%Q " \
"LEFT OUTER JOIN package_app_app_svc " \
"ON package_app_info.app_id=package_app_app_svc.app_id " \
"LEFT OUTER JOIN package_app_app_category " \
#define FILTER_QUERY_LIST_APP "select DISTINCT package_app_info.*, package_app_localized_info.app_locale, package_app_localized_info.app_label, package_app_localized_info.app_icon " \
"from package_app_info LEFT OUTER JOIN package_app_localized_info " \
"ON package_app_info.app_id=package_app_localized_info.app_id " \
- "and package_app_localized_info.app_locale IN ('%s', '%s') " \
+ "and package_app_localized_info.app_locale IN (%Q, %Q) " \
"LEFT OUTER JOIN package_app_app_svc " \
"ON package_app_info.app_id=package_app_app_svc.app_id " \
"LEFT OUTER JOIN package_app_app_category " \
char **subapp;
} pkgmgrinfo_appcontrol_x;
-static char* __get_aliasid_from_db(sqlite3 *appinfo_db, const char *appid)
+static char* __get_appid_from_aliasid(sqlite3 *appinfo_db, const char *aliasid)
{
int ret = PMINFO_R_OK;
- char *alias_id = NULL;
+ char *app_id = NULL;
char *query = NULL;
sqlite3_stmt *stmt = NULL;
- query = sqlite3_mprintf("select alias_id from package_app_aliasid where app_id=%Q", appid);
+ query = sqlite3_mprintf("select app_id from package_app_aliasid where alias_id=%Q", aliasid);
tryvm_if(query == NULL, ret = PMINFO_R_ERROR,"Malloc failed!!");
/*Prepare query*/
ret = sqlite3_prepare_v2(appinfo_db, query, strlen(query), &stmt, NULL);
tryvm_if(ret != PMINFO_R_OK, ret = PMINFO_R_ERROR, "sqlite3_prepare_v2 failed[%s]\n", query);
- alias_id = (char*)malloc(MAX_PACKAGE_STR_SIZE);
- tryvm_if(alias_id == NULL, ret = PMINFO_R_ERROR,"Malloc failed!!");
- memset(alias_id,'\0',MAX_PACKAGE_STR_SIZE);
+ app_id = (char*)malloc(MAX_PACKAGE_STR_SIZE);
+ tryvm_if(app_id == NULL, ret = PMINFO_R_ERROR,"Malloc failed!!");
+ memset(app_id,'\0',MAX_PACKAGE_STR_SIZE);
/*Step query*/
ret = sqlite3_step(stmt);
if(ret == SQLITE_ROW){
/*Get the alias id*/
- snprintf(alias_id, MAX_PACKAGE_STR_SIZE, "%s", (const char *)sqlite3_column_text(stmt, 0));
- _LOGD("alias id [%s] id found for [%s] in DB",alias_id,appid);
+ snprintf(app_id, MAX_PACKAGE_STR_SIZE, "%s", (const char *)sqlite3_column_text(stmt, 0));
+ _LOGD("alias id [%s] id found for [%s] in DB",app_id,aliasid);
}
catch:
sqlite3_finalize(stmt);
/*If alias id is not found then set the appid as alias id*/
- if ( alias_id == NULL || strlen(alias_id) == 0 ) {
- FREE_AND_NULL(alias_id);
- alias_id = strdup(appid);
+ if ( app_id == NULL || strlen(app_id) == 0 ) {
+ FREE_AND_NULL(app_id);
+ app_id = strdup(aliasid);
}
- return alias_id;
+ return app_id;
}
-static void __get_appinfo_from_db(char *colname, char *coltxt, uiapplication_x *uiapp)
+static void __parse_appcontrol(GList **list_ac, char *appcontrol_str)
{
- if (colname == NULL || uiapp == NULL)
+ char *dup = NULL;
+ char *token = NULL;
+ char *ptr = NULL;
+ int flag = 1;
+ appcontrol_x *ac = NULL;
+
+ if (appcontrol_str == NULL || appcontrol_str[0] == '\0')
+ return;
+
+ dup = strdup(appcontrol_str);
+ if (!dup) {
+ _LOGE("memory alloc failed");
return;
+ }
+
+ do {
+ ac = calloc(1, sizeof(appcontrol_x));
+ if (!ac) {
+ _LOGE("memory alloc failed");
+ break;
+ }
+
+ if (flag) {
+ token = strtok_r(dup, "|", &ptr);
+ flag = 0;
+ } else
+ token = strtok_r(NULL, "|", &ptr);
+ if (token && strcmp(token, "NULL"))
+ ac->operation = strdup(token);
+ else
+ ac->operation = NULL;
+
+ token = strtok_r(NULL, "|", &ptr);
+ if (token && strcmp(token, "NULL"))
+ ac->uri = strdup(token);
+ else
+ ac->uri = NULL;
+
+ token = strtok_r(NULL, "|", &ptr);
+ if (token && strcmp(token, "NULL"))
+ ac->mime = strdup(token);
+ else
+ ac->mime = NULL;
+
+ if (ac->operation || ac->uri || ac->mime)
+ *list_ac = g_list_append(*list_ac, ac);
+ else
+ free(ac);
+
+ token = strtok_r(NULL, ";", &ptr);
+ } while (ptr && strlen(ptr));
+
+ free(dup);
+}
+
+static GList *__get_background_category(char *value)
+{
+ GList *category_list = NULL;
+ int convert_value = 0;
+ if (!value || strlen(value) == 0)
+ return NULL;
+
+ convert_value = atoi(value);
+ if (convert_value < 0)
+ return NULL;
+
+
+ if (convert_value & APP_BG_CATEGORY_USER_DISABLE_TRUE_VAL)
+ category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_USER_DISABLE_TRUE_STR));
+ else
+ category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_USER_DISABLE_FALSE_STR));
+
+ if (convert_value & APP_BG_CATEGORY_MEDIA_VAL)
+ category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_MEDIA_STR));
+
+ if (convert_value & APP_BG_CATEGORY_DOWNLOAD_VAL)
+ category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_DOWNLOAD_STR));
+
+ if (convert_value & APP_BG_CATEGORY_BGNETWORK_VAL)
+ category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_BGNETWORK_STR));
+
+ if (convert_value & APP_BG_CATEGORY_LOCATION_VAL)
+ category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_LOCATION_STR));
+
+ if (convert_value & APP_BG_CATEGORY_SENSOR_VAL)
+ category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_SENSOR_STR));
+
+ if (convert_value & APP_BG_CATEGORY_IOTCOMM_VAL)
+ category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_IOTCOMM_STR));
+
+ if (convert_value & APP_BG_CATEGORY_SYSTEM_VAL)
+ category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_SYSTEM));
+
+ return category_list;
+
+}
+
+static void __get_appinfo_from_db(char *colname, char *coltxt, uiapplication_x *uiapp)
+{
+ GList *tmp = NULL;
+ label_x* label = NULL;
+ icon_x* icon = NULL;
+ image_x* image = NULL;
+ category_x* category = NULL;
+ permission_x* permission = NULL;
+ metadata_x *metadata = NULL;
+
+ if((tmp = g_list_last(uiapp->label))) {
+ label = (label_x*)tmp->data;
+ if (label == NULL) {
+ _LOGE("label is NULL.");
+ return;
+ }
+ }
+
+ if((tmp = g_list_last(uiapp->icon))) {
+ icon = (icon_x*)tmp->data;
+ if (icon == NULL) {
+ _LOGE("icon is NULL.");
+ return;
+ }
+ }
+
+ if((tmp = g_list_last(uiapp->image))) {
+ image = (image_x*)tmp->data;
+ if (image == NULL) {
+ _LOGE("image is NULL.");
+ return;
+ }
+ }
+
+ if((tmp = g_list_last(uiapp->category))) {
+ category = (category_x*)tmp->data;
+ if (category == NULL) {
+ _LOGE("category is NULL.");
+ return;
+ }
+ }
+
+ if((tmp = g_list_last(uiapp->permission))) {
+ permission = (permission_x*)tmp->data;
+ if (permission == NULL) {
+ _LOGE("permission is NULL.");
+ return;
+ }
+ }
+
+ if((tmp = g_list_last(uiapp->metadata))){
+ metadata = (metadata_x*)tmp->data;
+ if (metadata == NULL) {
+ _LOGE("metadata is NULL.");
+ return;
+ }
+ }
if (strcmp(colname, "app_id") == 0) {
if (uiapp->appid)
return;
-
- if (coltxt)
- uiapp->appid = strdup(coltxt);
+ uiapp->appid = strdup(coltxt);
} else if (strcmp(colname, "app_component") == 0) {
- if (coltxt)
- uiapp->app_component = strdup(coltxt);
- else
- uiapp->app_component = NULL;
+ uiapp->app_component = strdup(coltxt);
+
} else if (strcmp(colname, "app_exec") == 0) {
- if (coltxt)
uiapp->exec = strdup(coltxt);
- else
- uiapp->exec = NULL;
- } else if (strcmp(colname, "app_ambient_support") == 0) {
- if (coltxt)
- uiapp->ambient_support = strdup(coltxt);
- else
- uiapp->ambient_support = NULL;
+
} else if (strcmp(colname, "app_nodisplay") == 0) {
- if (coltxt)
- uiapp->nodisplay = strdup(coltxt);
- else
- uiapp->nodisplay = NULL;
+ uiapp->nodisplay = strdup(coltxt);
+
} else if (strcmp(colname, "app_type") == 0 ) {
- if (coltxt)
- uiapp->type = strdup(coltxt);
- else
- uiapp->type = NULL;
+ uiapp->type = strdup(coltxt);
+
} else if (strcmp(colname, "app_onboot") == 0 ) {
- if (coltxt)
- uiapp->onboot= strdup(coltxt);
- else
- uiapp->onboot = NULL;
+ uiapp->onboot= strdup(coltxt);
+
} else if (strcmp(colname, "app_multiple") == 0 ) {
- if (coltxt)
- uiapp->multiple = strdup(coltxt);
- else
- uiapp->multiple = NULL;
+ uiapp->multiple = strdup(coltxt);
+
} else if (strcmp(colname, "app_autorestart") == 0 ) {
- if (coltxt)
- uiapp->autorestart= strdup(coltxt);
- else
- uiapp->autorestart = NULL;
+ uiapp->autorestart= strdup(coltxt);
+
} else if (strcmp(colname, "app_taskmanage") == 0 ) {
- if (coltxt)
- uiapp->taskmanage = strdup(coltxt);
- else
- uiapp->taskmanage = NULL;
+ uiapp->taskmanage = strdup(coltxt);
+
} else if (strcmp(colname, "app_enabled") == 0 ) {
- if (coltxt)
- uiapp->enabled= strdup(coltxt);
- else
- uiapp->enabled = NULL;
+ uiapp->enabled= strdup(coltxt);
+
} else if (strcmp(colname, "app_hwacceleration") == 0 ) {
- if (coltxt)
- uiapp->hwacceleration = strdup(coltxt);
- else
- uiapp->hwacceleration = NULL;
+ uiapp->hwacceleration = strdup(coltxt);
+
} else if (strcmp(colname, "app_screenreader") == 0 ) {
- if (coltxt)
- uiapp->screenreader = strdup(coltxt);
- else
- uiapp->screenreader = NULL;
+ uiapp->screenreader = strdup(coltxt);
+
} else if (strcmp(colname, "app_mainapp") == 0 ) {
- if (coltxt)
- uiapp->mainapp = strdup(coltxt);
- else
- uiapp->mainapp = NULL;
+ uiapp->mainapp = strdup(coltxt);
+
} else if (strcmp(colname, "app_recentimage") == 0 ) {
- if (coltxt)
- uiapp->recentimage = strdup(coltxt);
- else
- uiapp->recentimage = NULL;
+ uiapp->recentimage = strdup(coltxt);
+
} else if (strcmp(colname, "app_launchcondition") == 0 ) {
- if (coltxt)
- uiapp->launchcondition = strdup(coltxt);
- else
- uiapp->launchcondition = NULL;
+ uiapp->launchcondition = strdup(coltxt);
+
} else if (strcmp(colname, "app_indicatordisplay") == 0){
- if (coltxt)
- uiapp->indicatordisplay = strdup(coltxt);
- else
- uiapp->indicatordisplay = NULL;
+ uiapp->indicatordisplay = strdup(coltxt);
+
} else if (strcmp(colname, "app_portraitimg") == 0){
- if (coltxt)
- uiapp->portraitimg = strdup(coltxt);
- else
- uiapp->portraitimg = NULL;
+ uiapp->portraitimg = strdup(coltxt);
+
} else if (strcmp(colname, "app_landscapeimg") == 0){
- if (coltxt)
- uiapp->landscapeimg = strdup(coltxt);
- else
- uiapp->landscapeimg = NULL;
+ uiapp->landscapeimg = strdup(coltxt);
+
} else if (strcmp(colname, "app_effectimage_type") == 0){
- if (coltxt)
- uiapp->effectimage_type = strdup(coltxt);
- else
- uiapp->effectimage_type = NULL;
+ uiapp->effectimage_type = strdup(coltxt);
+
} else if (strcmp(colname, "app_guestmodevisibility") == 0){
- if (coltxt)
- uiapp->guestmode_visibility = strdup(coltxt);
- else
- uiapp->guestmode_visibility = NULL;
+ uiapp->guestmode_visibility = strdup(coltxt);
+
} else if (strcmp(colname, "app_permissiontype") == 0 ) {
- if (coltxt)
- uiapp->permission_type = strdup(coltxt);
- else
- uiapp->permission_type = NULL;
+ uiapp->permission_type = strdup(coltxt);
+
} else if (strcmp(colname, "app_preload") == 0 ) {
- if (coltxt)
- uiapp->preload = strdup(coltxt);
- else
- uiapp->preload = NULL;
+ uiapp->preload = strdup(coltxt);
+
} else if (strcmp(colname, "app_submode") == 0 ) {
- if (coltxt)
- uiapp->submode = strdup(coltxt);
- else
- uiapp->submode = NULL;
+ uiapp->submode = strdup(coltxt);
+
} else if (strcmp(colname, "app_submode_mainid") == 0 ) {
- if (coltxt)
- uiapp->submode_mainid = strdup(coltxt);
- else
- uiapp->submode_mainid = NULL;
+ uiapp->submode_mainid = strdup(coltxt);
+
} else if (strcmp(colname, "app_installed_storage") == 0 ) {
- if (coltxt)
- uiapp->installed_storage = strdup(coltxt);
- else
- uiapp->installed_storage = NULL;
+ uiapp->installed_storage = strdup(coltxt);
+
} else if (strcmp(colname, "app_process_pool") == 0 ) {
- if (coltxt)
- uiapp->process_pool = strdup(coltxt);
- else
- uiapp->process_pool = NULL;
+ uiapp->process_pool = strdup(coltxt);
+
} else if (strcmp(colname, "app_multi_instance") == 0 ) {
- if (coltxt)
- uiapp->multi_instance = strdup(coltxt);
- else
- uiapp->multi_instance = NULL;
+ uiapp->multi_instance = strdup(coltxt);
+
} else if (strcmp(colname, "app_multi_instance_mainid") == 0 ) {
- if (coltxt)
- uiapp->multi_instance_mainid = strdup(coltxt);
- else
- uiapp->multi_instance_mainid = NULL;
+ uiapp->multi_instance_mainid = strdup(coltxt);
+
} else if (strcmp(colname, "app_multi_window") == 0 ) {
- if (coltxt)
- uiapp->multi_window = strdup(coltxt);
- else
- uiapp->multi_window = NULL;
+ uiapp->multi_window = strdup(coltxt);
+
} else if (strcmp(colname, "app_support_disable") == 0 ) {
- if (coltxt)
- uiapp->support_disable= strdup(coltxt);
- else
- uiapp->support_disable = NULL;
+ uiapp->support_disable= strdup(coltxt);
+
} else if (strcmp(colname, "app_ui_gadget") == 0 ) {
- if (coltxt)
- uiapp->ui_gadget = strdup(coltxt);
- else
- uiapp->ui_gadget = NULL;
+ uiapp->ui_gadget = strdup(coltxt);
+
} else if (strcmp(colname, "app_removable") == 0 ) {
- if (coltxt)
- uiapp->removable = strdup(coltxt);
- else
- uiapp->removable = NULL;
+ uiapp->removable = strdup(coltxt);
+
+ } else if (strcmp(colname, "app_companion_type") == 0 ) {
+ uiapp->companion_type = strdup(coltxt);
+
} else if (strcmp(colname, "app_support_mode") == 0 ) {
- if (coltxt)
- uiapp->support_mode = strdup(coltxt);
- else
- uiapp->support_mode = NULL;
+ uiapp->support_mode = strdup(coltxt);
+
} else if (strcmp(colname, "app_support_feature") == 0 ) {
- if (coltxt)
- uiapp->support_feature = strdup(coltxt);
- else
- uiapp->support_feature = NULL;
+ uiapp->support_feature = strdup(coltxt);
+
+ } else if (strcmp(colname, "app_support_category") == 0 ) {
+ uiapp->support_category = strdup(coltxt);
+
} else if (strcmp(colname, "component_type") == 0 ) {
- if (coltxt)
- uiapp->component_type = strdup(coltxt);
- else
- uiapp->component_type = NULL;
+ uiapp->component_type = strdup(coltxt);
+
} else if (strcmp(colname, "package") == 0 ) {
- if (coltxt)
- uiapp->package = strdup(coltxt);
- else
- uiapp->package = NULL;
+ FREE_AND_NULL(uiapp->package);
+ uiapp->package = strdup(coltxt);
+
} else if (strcmp(colname, "app_package_type") == 0 ) {
- if (coltxt)
- uiapp->package_type = strdup(coltxt);
- else
- uiapp->package_type = NULL;
+ uiapp->package_type = strdup(coltxt);
+
} else if (strcmp(colname, "app_package_system") == 0 ) {
- if (coltxt)
- uiapp->package_system = strdup(coltxt);
- else
- uiapp->package_system = NULL;
+ uiapp->package_system = strdup(coltxt);
+
} else if (strcmp(colname, "app_package_installed_time") == 0 ) {
- if (coltxt)
- uiapp->package_installed_time = strdup(coltxt);
- else
- uiapp->package_installed_time = NULL;
+ uiapp->package_installed_time = strdup(coltxt);
+
+ } else if (strcmp(colname, "app_launch_mode") == 0 ) {
+ uiapp->launch_mode= strdup(coltxt);
+
+ } else if (strcmp(colname, "app_alias_appid") == 0 ) {
+ uiapp->alias_appid = strdup(coltxt);
+
+ } else if (strcmp(colname, "app_effective_appid") == 0 ) {
+ uiapp->effective_appid = strdup(coltxt);
+ } else if (strcmp(colname, "app_background_category") == 0) {
+ uiapp->background_category = __get_background_category(coltxt);
+
+ } else if (strcmp(colname, "app_api_version") == 0 ) {
+ uiapp->api_version = strdup(coltxt);
/*end of package_app_info table*/
} else if (strcmp(colname, "app_locale") == 0 ) {
- if (coltxt) {
- uiapp->icon->lang = strdup(coltxt);
- uiapp->label->lang = strdup(coltxt);
- }
- else {
- uiapp->icon->lang = NULL;
- uiapp->label->lang = NULL;
- }
+ if (icon)
+ icon->lang = strdup(coltxt);
+ if (label)
+ label->lang = strdup(coltxt);
+
} else if (strcmp(colname, "app_label") == 0 ) {
- if (coltxt)
- uiapp->label->text = strdup(coltxt);
- else
- uiapp->label->text = NULL;
+ if (label)
+ label->text = strdup(coltxt);
+
} else if (strcmp(colname, "app_icon") == 0) {
- if (coltxt)
- uiapp->icon->text = strdup(coltxt);
- else
- uiapp->icon->text = NULL;
+ if (icon)
+ icon->text = strdup(coltxt);
/*end of package_app_localized_info table*/
} else if (strcmp(colname, "category") == 0 ) {
- if (coltxt)
- uiapp->category->name = strdup(coltxt);
- else
- uiapp->category->name = NULL;
+ if (category)
+ category->name = strdup(coltxt);
/*end of package_app_category_info table*/
} else if (strcmp(colname, "md_key") == 0 ) {
- if (coltxt)
- uiapp->metadata->key = strdup(coltxt);
- else
- uiapp->metadata->key = NULL;
+ if (metadata)
+ metadata->key = strdup(coltxt);
+
} else if (strcmp(colname, "md_value") == 0 ) {
- if (coltxt)
- uiapp->metadata->value = strdup(coltxt);
- else
- uiapp->metadata->value = NULL;
+ if (metadata)
+ metadata->value = strdup(coltxt);
/*end of package_app_metadata_info table*/
} else if (strcmp(colname, "pm_type") == 0 ) {
- if (coltxt)
- uiapp->permission->type= strdup(coltxt);
- else
- uiapp->permission->type = NULL;
+ if (permission)
+ permission->type= strdup(coltxt);
+
} else if (strcmp(colname, "pm_value") == 0 ) {
- if (coltxt)
- uiapp->permission->value = strdup(coltxt);
- else
- uiapp->permission->value = NULL;
+ if (permission)
+ permission->value = strdup(coltxt);
/*end of package_app_permission_info table*/
} else if (strcmp(colname, "app_image") == 0) {
- if (coltxt)
- uiapp->image->text= strdup(coltxt);
- else
- uiapp->image->text = NULL;
+ if (image)
+ image->text= strdup(coltxt);
+
} else if (strcmp(colname, "app_image_section") == 0) {
- if (coltxt)
- uiapp->image->section= strdup(coltxt);
- else
- uiapp->image->section = NULL;
+ if (image)
+ image->section= strdup(coltxt);
/*end of package_app_image_info table*/
+
+ } else if (strcmp(colname, "app_control") == 0 ) {
+ __parse_appcontrol(&uiapp->appcontrol, coltxt);
+
+#ifdef _APPFW_FEATURE_EXPANSION_PKG_INSTALL
+ } else if (strcmp(colname, "app_tep_name") == 0 ) {
+ uiapp->tep_name = strdup(coltxt);
+#endif
+
+#ifdef _APPFW_FEATURE_MOUNT_INSTALL
+ } else if (strcmp(colname, "app_mount_install") == 0 ) {
+ uiapp->ismount= atoi(coltxt);
+
+ } else if (strcmp(colname, "app_tpk_name") == 0 ) {
+ uiapp->tpk_name = strdup(coltxt);
+#endif
}
}
int ncols = 0;
char *colname = NULL;
char *coltxt = NULL;
+ label_x* label = NULL;
-// uiapplication_x *ptr1 = NULL;
-
-// LISTHEAD(info->manifest_info->uiapplication, ptr1);
+ GList *list_up = info->manifest_info->uiapplication;
+ uiapplication_x *up = (uiapplication_x *)g_list_last(list_up)->data;
ncols = sqlite3_column_count(stmt);
for(i = 0; i < ncols; i++)
{
colname = (char *)sqlite3_column_name(stmt, i);
- if (colname && strcmp(colname, "app_label") == 0 ){
+ if (strcmp(colname, "app_label") == 0 ){
coltxt = (char *)sqlite3_column_text(stmt, i);
- FREE_AND_STRDUP(coltxt, info->manifest_info->uiapplication->label->text);
+ label = (label_x*)up->label->data;
+ FREE_AND_STRDUP(coltxt,label->text);
}
}
}
permission_x *permission = NULL;
image_x *image = NULL;
- icon = calloc(1, sizeof(icon_x));
- retvm_if(icon == NULL, PMINFO_R_ERROR, "out of memory");
- LISTADD(info->uiapp_info->icon, icon);
- label = calloc(1, sizeof(label_x));
- retvm_if(label == NULL, PMINFO_R_ERROR, "out of memory");
- LISTADD(info->uiapp_info->label, label);
- category = calloc(1, sizeof(category_x));
- retvm_if(category == NULL, PMINFO_R_ERROR, "out of memory");
- LISTADD(info->uiapp_info->category, category);
- metadata = calloc(1, sizeof(metadata_x));
- retvm_if(metadata == NULL, PMINFO_R_ERROR, "out of memory");
- LISTADD(info->uiapp_info->metadata, metadata);
- permission = calloc(1, sizeof(permission_x));
- retvm_if(permission == NULL, PMINFO_R_ERROR, "out of memory");
- LISTADD(info->uiapp_info->permission, permission);
- image = calloc(1, sizeof(image_x));
- retvm_if(image == NULL, PMINFO_R_ERROR, "out of memory");
- LISTADD(info->uiapp_info->image, image);
-
for(i = 0; i < ncols; i++)
{
+ if(!coltxt[i] || !colname[i])
+ continue;
+
+ if((strcmp(colname[i], "app_locale") == 0 || strcmp(colname[i], "app_icon") == 0 ) && icon == NULL) {
+ icon = calloc(1, sizeof(icon_x));
+ retvm_if(icon == NULL, PMINFO_R_ERROR, "Out of memory: icon");
+ info->uiapp_info->icon = g_list_append(info->uiapp_info->icon, icon);
+ }
+
+ if((strcmp(colname[i], "app_locale") == 0 || strcmp(colname[i], "app_label") == 0 ) && label == NULL) {
+ label = calloc(1, sizeof(label_x));
+ retvm_if(label == NULL, PMINFO_R_ERROR, "Out of memory: label");
+ info->uiapp_info->label = g_list_append(info->uiapp_info->label, label);
+ }
+
+ if((strcmp(colname[i], "category") == 0) && category == NULL) {
+ category = calloc(1, sizeof(category_x));
+ retvm_if(category == NULL, PMINFO_R_ERROR, "Out of memory: category");
+ info->uiapp_info->category = g_list_append(info->uiapp_info->category, category);
+ }
+
+ if((strcmp(colname[i], "md_key") == 0 || strcmp(colname[i], "md_value") == 0 ) && metadata == NULL) {
+ metadata = calloc(1, sizeof(metadata_x));
+ retvm_if(metadata == NULL, PMINFO_R_ERROR, "Out of memory: metadata");
+ info->uiapp_info->metadata = g_list_append(info->uiapp_info->metadata, metadata);
+ }
+
+ if((strcmp(colname[i], "pm_type") == 0 || strcmp(colname[i], "pm_value") == 0 ) && permission == NULL) {
+ permission = calloc(1, sizeof(permission_x));
+ retvm_if(permission == NULL, PMINFO_R_ERROR, "Out of memory: permission");
+ info->uiapp_info->permission = g_list_append(info->uiapp_info->permission, permission);
+ }
+
+ if((strcmp(colname[i], "app_image") == 0 || strcmp(colname[i], "app_image_section") == 0 ) && image == NULL) {
+ image = calloc(1, sizeof(image_x));
+ retvm_if(image == NULL, PMINFO_R_ERROR, "Out of memory: image");
+ info->uiapp_info->image = g_list_append(info->uiapp_info->image, image);
+ }
+
+ //_LOGE("field value :: %s = %s \n", colname[i], coltxt[i]);
__get_appinfo_from_db(colname[i], coltxt[i], info->uiapp_info);
}
return 0;
label_x *label = NULL;
uiapp = calloc(1, sizeof(uiapplication_x));
- retvm_if(uiapp == NULL, PMINFO_R_ERROR, "out of memory");
- LISTADD(info->manifest_info->uiapplication, uiapp);
- icon = calloc(1, sizeof(icon_x));
- retvm_if(icon == NULL, PMINFO_R_ERROR, "out of memory");
- LISTADD(info->manifest_info->uiapplication->icon, icon);
- label = calloc(1, sizeof(label_x));
- retvm_if(label == NULL, PMINFO_R_ERROR, "out of memory");
- LISTADD(info->manifest_info->uiapplication->label, label);
+ if (!uiapp) {
+ _LOGE("malloc failed");
+ goto err;
+ }
for(i = 0; i < ncols; i++)
{
- __get_appinfo_from_db(colname[i], coltxt[i], info->manifest_info->uiapplication);
+ if(!coltxt[i] || !colname[i])
+ continue;
+
+ if((strcmp(colname[i], "app_locale") == 0 || strcmp(colname[i], "app_icon") == 0 ) && icon == NULL) {
+ icon = calloc(1, sizeof(icon_x));
+ if(!icon) {
+ _LOGE("Not enough memory !!!");
+ goto err;
+ }
+ uiapp->icon = g_list_append(uiapp->icon, icon);
+ }
+
+ if((strcmp(colname[i], "app_locale") == 0 || strcmp(colname[i], "app_label") == 0 ) && label == NULL) {
+ label = calloc(1, sizeof(label_x));
+ if(!label) {
+ _LOGE("Not enough memory !!!");
+ goto err;
+ }
+ uiapp->label = g_list_append(uiapp->label, label);
+ }
+
+ __get_appinfo_from_db(colname[i], coltxt[i], uiapp);
}
+
+ info->manifest_info->uiapplication = g_list_append(info->manifest_info->uiapplication, uiapp);
+
return 0;
+
+err:
+ //for exceptional cases
+ FREE_AND_NULL(uiapp);
+ FREE_AND_NULL(icon);
+ FREE_AND_NULL(label);
+ return -1;
}
static void __get_appinfo_for_list(sqlite3_stmt *stmt, pkgmgr_pkginfo_x *udata)
int ncols = 0;
char *colname = NULL;
char *coltxt = NULL;
+ icon_x* icon = NULL;
+ label_x *label = NULL;
uiapplication_x *uiapp = NULL;
uiapp = calloc(1, sizeof(uiapplication_x));
- retvm_if(uiapp == NULL, PMINFO_R_ERROR, "out of memory");
- uiapp->icon= calloc(1, sizeof(icon_x));
- uiapp->label= calloc(1, sizeof(label_x));
-
- LISTADD(udata->manifest_info->uiapplication, uiapp);
+ if (!uiapp) {
+ _LOGE("malloc failed");
+ goto err;
+ }
ncols = sqlite3_column_count(stmt);
colname = (char *)sqlite3_column_name(stmt, i);
coltxt = (char *)sqlite3_column_text(stmt, i);
+ if(!coltxt || !colname)
+ continue;
+
+ if((strcmp(colname, "app_locale") == 0 || strcmp(colname, "app_icon") == 0 ) && icon == NULL) {
+ icon = calloc(1, sizeof(icon_x));
+ if(!icon) {
+ _LOGE("Not enough memory !!!");
+ goto err;
+ }
+ uiapp->icon = g_list_append(uiapp->icon, icon);
+ }
+
+ if((strcmp(colname, "app_locale") == 0 || strcmp(colname, "app_label") == 0 ) && label == NULL) {
+ label = calloc(1, sizeof(label_x));
+ if(!label) {
+ _LOGE("Not enough memory !!!");
+ goto err;
+ }
+ uiapp->label = g_list_append(uiapp->label, label);
+ }
+
// _LOGE("field value :: %s = %s \n", colname, coltxt);
- __get_appinfo_from_db(colname, coltxt, udata->manifest_info->uiapplication);
+ __get_appinfo_from_db(colname, coltxt, uiapp);
}
+
+ udata->manifest_info->uiapplication = g_list_append(udata->manifest_info->uiapplication, uiapp);
+ return;
+
+err:
+ //for exceptional cases
+ FREE_AND_NULL(uiapp);
+ FREE_AND_NULL(icon);
+ FREE_AND_NULL(label);
}
static int __check_app_locale_from_app_localized_info_by_exact(sqlite3 *db, const char *appid, const char *locale)
}
if (node->value) {
snprintf(value, MAX_QUERY_LEN, " AND package_app_app_metadata.md_value='%s')", node->value);
- strcat(key, value);
+ strncat(key, value, MAX_QUERY_LEN - strlen(key) - 1);
} else {
- strcat(key, ")");
+ strncat(key, ")", MAX_QUERY_LEN - strlen(key) - 1);
}
*condition = strdup(key);
return;
return PMINFO_R_ERROR;
}
- fgets(buf, MAX_PACKAGE_STR_SIZE, fp);
+ if(fgets(buf, MAX_PACKAGE_STR_SIZE, fp) == NULL){
+ _LOGE("fgets fail\n");
+ fclose(fp);
+ return PMINFO_R_ERROR;
+ }
+
if (buf[0] == '\0') {
_LOGE("[%s] use db info\n", (char *)info->uiapp_info->appid);
fclose(fp);
return PMINFO_R_ERROR;
}
- FREE_AND_STRDUP(buf, info->uiapp_info->satui_label);
- *label = info->uiapp_info->satui_label;
+ if(info->uiapp_info->satui_label)
+ free((void *)info->uiapp_info->satui_label);
+ info->uiapp_info->satui_label = strdup(buf);
+
+ *label = (char*)info->uiapp_info->satui_label;
fclose(fp);
return PMINFO_R_OK;
pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
pkgmgr_pkginfo_x *allinfo = NULL;
pkgmgr_appinfo_x *appinfo = NULL;
- icon_x *ptr1 = NULL;
- label_x *ptr2 = NULL;
- category_x *ptr3 = NULL;
- metadata_x *ptr4 = NULL;
- permission_x *ptr5 = NULL;
- image_x *ptr6 = NULL;
sqlite3 *appinfo_db = NULL;
/*check installed storage*/
tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
/*open db */
- ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ ret = _pminfo_db_open(MANIFEST_DB, &appinfo_db);
tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
snprintf(query, MAX_QUERY_LEN, "select DISTINCT * " \
ret = __exec_db_query(appinfo_db, query, __uiapp_list_cb, (void *)info);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info list retrieval failed");
- uiapplication_x *tmp = NULL;
- SAFE_LISTHEAD(info->manifest_info->uiapplication, tmp);
+ uiapplication_x *up = NULL;
+ GList *list_up = info->manifest_info->uiapplication;
/*Populate localized info for default locales and call callback*/
/*If the callback func return < 0 we break and no more call back is called*/
- while(tmp != NULL)
+ while(list_up != NULL)
{
- if (locale)
- appinfo->locale = strdup(locale);
- appinfo->uiapp_info = tmp;
+ up = (uiapplication_x *)list_up->data;
+ appinfo->locale = strdup(locale);
+ appinfo->uiapp_info = up;
if (strcmp(appinfo->uiapp_info->type,"c++app") == 0){
FREE_AND_NULL(locale);
locale = __get_app_locale_by_fallback(appinfo_db, appinfo->uiapp_info->appid);
+ tryvm_if(locale == NULL, ret = PMINFO_R_EINVAL, "__get_app_locale_by_fallback NULL");
}
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, locale);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select * from package_app_localized_info where app_id=%Q and app_locale=%Q", appinfo->uiapp_info->appid, locale);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, DEFAULT_LOCALE);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select * from package_app_localized_info where app_id=%Q and app_locale=%Q", appinfo->uiapp_info->appid, DEFAULT_LOCALE);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
/*store setting notification icon section*/
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from package_app_icon_section_info where app_id='%s'", appinfo->uiapp_info->appid);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select * from package_app_icon_section_info where app_id=%Q", appinfo->uiapp_info->appid);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
/*store app preview image info*/
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select app_image_section, app_image from package_app_image_info where app_id='%s'", appinfo->uiapp_info->appid);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select app_image_section, app_image from package_app_image_info where app_id=%Q", appinfo->uiapp_info->appid);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
/*Populate app category*/
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from package_app_app_category where app_id='%s'", appinfo->uiapp_info->appid);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select * from package_app_app_category where app_id=%Q", appinfo->uiapp_info->appid);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Category Info DB Information retrieval failed");
/*Populate app metadata*/
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from package_app_app_metadata where app_id='%s'", appinfo->uiapp_info->appid);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select * from package_app_app_metadata where app_id=%Q", appinfo->uiapp_info->appid);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Metadata Info DB Information retrieval failed");
- SAFE_LISTHEAD(appinfo->uiapp_info->icon, ptr1);
- SAFE_LISTHEAD(appinfo->uiapp_info->label, ptr2);
- SAFE_LISTHEAD(appinfo->uiapp_info->category, ptr3);
- SAFE_LISTHEAD(appinfo->uiapp_info->metadata, ptr4);
- SAFE_LISTHEAD(appinfo->uiapp_info->permission, ptr5);
- SAFE_LISTHEAD(appinfo->uiapp_info->image, ptr6);
+ /*Populate app control*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select app_control from package_app_app_control where app_id=%Q", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Conrtol Info DB Information retrieval failed");
ret = app_func((void *)appinfo, user_data);
if (ret < 0){
FREE_AND_NULL(appinfo->locale);
+ _LOGE("callback is stopped.");
break;
}
FREE_AND_NULL(appinfo->locale);
- tmp = tmp->next;
+ list_up = list_up->next;
}
ret = PMINFO_R_OK;
catch:
+ if (appinfo)
+ FREE_AND_NULL(appinfo->locale);
+ FREE_AND_NULL(locale);
+ FREE_AND_NULL(appinfo);
+ __cleanup_pkginfo(allinfo);
+ sqlite3_close(appinfo_db);
+ return ret;
+}
+
+API int pkgmgrinfo_appinfo_get_disabled_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
+ pkgmgrinfo_app_list_cb app_func, void *user_data)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
+ retvm_if(app_func == NULL, PMINFO_R_EINVAL, "callback pointer is NULL");
+ retvm_if((component != PMINFO_UI_APP) && (component != PMINFO_SVC_APP) && (component != PMINFO_ALL_APP), PMINFO_R_EINVAL, "Invalid App Component Type");
+ retvm_if(component == PMINFO_SVC_APP, PMINFO_R_OK, "PMINFO_SVC_APP is done" );
+
+ char *locale = NULL;
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = {'\0'};
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ pkgmgr_pkginfo_x *allinfo = NULL;
+ pkgmgr_appinfo_x *appinfo = NULL;
+ sqlite3 *appinfo_db = NULL;
+
+ /*check installed storage*/
+ ret = __pkginfo_check_installed_storage(info);
+ retvm_if(ret < 0, PMINFO_R_EINVAL, "[%s] is installed external, but is not in mmc", info->manifest_info->package);
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_EINVAL, "manifest locale is NULL");
+
+ /*calloc allinfo*/
+ allinfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(allinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
+
+ /*calloc manifest_info*/
+ allinfo->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(allinfo->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+
+ /*calloc appinfo*/
+ appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
+
+ /*open db */
+ ret = _pminfo_db_open(MANIFEST_DB, &appinfo_db);
+ tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select DISTINCT * from package_app_info " \
+ "where package_app_info.package=%Q and package_app_info.app_component=%Q and package_app_info.app_disable='true'",
+ info->manifest_info->package,"uiapp");
+
+ /*Populate ui app info */
+ ret = __exec_db_query(appinfo_db, query, __uiapp_list_cb, (void *)info);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info list retrieval failed");
+
+ uiapplication_x *up = NULL;
+ GList *list_up = info->manifest_info->uiapplication;
+
+ /*Populate localized info for default locales and call callback*/
+ /*If the callback func return < 0 we break and no more call back is called*/
+ while(list_up != NULL)
+ {
+ up = (uiapplication_x *)list_up->data;
+ appinfo->locale = strdup(locale);
+ appinfo->uiapp_info = up;
+ if (strcmp(appinfo->uiapp_info->type,"c++app") == 0){
+ FREE_AND_NULL(locale);
+ locale = __get_app_locale_by_fallback(appinfo_db, appinfo->uiapp_info->appid);
+ tryvm_if(locale == NULL, ret = PMINFO_R_EINVAL, "locale is NULL");
+ }
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select * from package_app_localized_info where app_id=%Q and app_locale=%Q", appinfo->uiapp_info->appid, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ memset(query, '\0', MAX_QUERY_LEN);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select * from package_app_localized_info where app_id=%Q and app_locale=%Q", appinfo->uiapp_info->appid, DEFAULT_LOCALE);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ /*store setting notification icon section*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select * from package_app_icon_section_info where app_id=%Q", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
+
+ /*store app preview image info*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select app_image_section, app_image from package_app_image_info where app_id=%Q", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
+
+ /*Populate app category*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select * from package_app_app_category where app_id=%Q", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Category Info DB Information retrieval failed");
+
+ /*Populate app metadata*/
+ memset(query, '\0', MAX_QUERY_LEN);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select * from package_app_app_metadata where app_id=%Q", appinfo->uiapp_info->appid);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Metadata Info DB Information retrieval failed");
+
+ ret = app_func((void *)appinfo, user_data);
+ if (ret < 0){
+ FREE_AND_NULL(appinfo->locale);
+ _LOGE("callback is stopped.");
+ break;
+ }
+
+ FREE_AND_NULL(appinfo->locale);
+ list_up = list_up->next;
+ }
+
+ ret = PMINFO_R_OK;
+
+catch:
+ if (appinfo)
+ FREE_AND_NULL(appinfo->locale);
FREE_AND_NULL(locale);
FREE_AND_NULL(appinfo);
__cleanup_pkginfo(allinfo);
char *query = NULL;
pkgmgr_pkginfo_x *info = NULL;
pkgmgr_appinfo_x *appinfo = NULL;
- uiapplication_x *ptr1 = NULL;
+ GList *list_up = NULL;
sqlite3 *appinfo_db = NULL;
sqlite3_stmt *stmt = NULL;
/*open db*/
- ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ ret = _pminfo_db_open(MANIFEST_DB, &appinfo_db);
retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
/*calloc pkginfo*/
}
}
- /*head up*/
- SAFE_LISTHEAD(info->manifest_info->uiapplication, ptr1);
-
/*UI Apps*/
- for(ptr1 = info->manifest_info->uiapplication; ptr1; ptr1 = ptr1->next)
+ for(list_up = info->manifest_info->uiapplication; list_up; list_up = list_up->next)
{
- appinfo->uiapp_info = ptr1;
+ appinfo->uiapp_info = (uiapplication_x *)list_up->data;
ret = app_func((void *)appinfo, user_data);
if (ret < 0) {
+ _LOGE("callback is stopped.");
break;
}
}
pkgmgr_pkginfo_x *info = NULL;
pkgmgr_appinfo_x *appinfo = NULL;
- uiapplication_x *ptr1 = NULL;
+ GList *list_up = NULL;
sqlite3 *appinfo_db = NULL;
sqlite3_stmt *stmt = NULL;
tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
/*open db*/
- ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
- tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "db_util_open[%s] failed!", MANIFEST_DB);
+ ret = _pminfo_db_open(MANIFEST_DB, &appinfo_db);
+ tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "_pminfo_db_open[%s] failed!", MANIFEST_DB);
- /*Start constructing query*/
locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "__convert_system_locale_to_manifest_locale fail !!");
+
query = sqlite3_mprintf("select * from package_app_info LEFT OUTER JOIN package_app_localized_info "\
"ON package_app_info.app_id=package_app_localized_info.app_id "\
+ "LEFT OUTER JOIN package_app_app_control "\
+ "ON package_app_info.app_id=package_app_app_control.app_id "\
"where package_app_info.app_disable='false' and package_app_localized_info.app_locale IN (%Q, %Q)", DEFAULT_LOCALE, locale);
/*prepare query*/
}
}
- /*head up*/
- SAFE_LISTHEAD(info->manifest_info->uiapplication, ptr1);
-
/*UI Apps*/
- for(ptr1 = info->manifest_info->uiapplication; ptr1; ptr1 = ptr1->next)
+ for(list_up = info->manifest_info->uiapplication; list_up; list_up = list_up->next)
{
- if (locale && appinfo->locale == NULL)
- appinfo->locale = strdup(locale);
- appinfo->uiapp_info = ptr1;
+ appinfo->locale = strdup(locale);
+ appinfo->uiapp_info = (uiapplication_x *)list_up->data;
ret = __appinfo_check_installed_storage(appinfo);
- if(ret < 0)
+ if(ret < 0) {
+ FREE_AND_NULL(appinfo->locale);
continue;
+ }
ret = app_func((void *)appinfo, user_data);
- if (ret < 0)
+ if (ret < 0) {
+ FREE_AND_NULL(appinfo->locale);
+ _LOGE("callback is stopped.");
break;
+ }
FREE_AND_NULL(appinfo->locale);
}
ret = PMINFO_R_OK;
char *locale = NULL;
pkgmgr_pkginfo_x *info = NULL;
pkgmgr_appinfo_x *appinfo = NULL;
- uiapplication_x *ptr1 = NULL;
+ GList *list_up = NULL;
sqlite3 *appinfo_db = NULL;
sqlite3_stmt *stmt = NULL;
tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
/*open db*/
- ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ ret = _pminfo_db_open(MANIFEST_DB, &appinfo_db);
tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
/*calloc pkginfo*/
}
}
- /*head up*/
- SAFE_LISTHEAD(info->manifest_info->uiapplication, ptr1);
-
/*UI Apps*/
- for(ptr1 = info->manifest_info->uiapplication; ptr1; ptr1 = ptr1->next)
+ for(list_up = info->manifest_info->uiapplication; list_up; list_up = list_up->next)
{
appinfo->locale = strdup(locale);
- appinfo->uiapp_info = ptr1;
+ appinfo->uiapp_info = (uiapplication_x *)list_up->data;
ret = __appinfo_check_installed_storage(appinfo);
if(ret < 0) {
ret = app_func((void *)appinfo, user_data);
if(ret < 0) {
FREE_AND_NULL(appinfo->locale);
+ _LOGE("callback is stopped.");
break;
}
char *locale = NULL;
pkgmgr_pkginfo_x *info = NULL;
pkgmgr_appinfo_x *appinfo = NULL;
- uiapplication_x *ptr1 = NULL;
+ GList *list_up = NULL;
sqlite3 *appinfo_db = NULL;
sqlite3_stmt *stmt = NULL;
tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
/*open db*/
- ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ ret = _pminfo_db_open(MANIFEST_DB, &appinfo_db);
tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
/*calloc pkginfo*/
}
}
- /*head up*/
- SAFE_LISTHEAD(info->manifest_info->uiapplication, ptr1);
-
/*UI Apps*/
- for(ptr1 = info->manifest_info->uiapplication; ptr1; ptr1 = ptr1->next)
+ for(list_up = info->manifest_info->uiapplication; list_up; list_up = list_up->next)
{
appinfo->locale = strdup(locale);
- appinfo->uiapp_info = ptr1;
+ appinfo->uiapp_info = (uiapplication_x *)list_up->data;
ret = app_func((void *)appinfo, user_data);
if(ret < 0) {
FREE_AND_NULL(appinfo->locale);
+ _LOGE("callback is stopped.");
break;
}
char *locale = NULL;
int ret = -1;
int exist = 0;
- label_x *tmp1 = NULL;
- icon_x *tmp2 = NULL;
- category_x *tmp3 = NULL;
- metadata_x *tmp4 = NULL;
- permission_x *tmp5 = NULL;
- image_x *tmp6 = NULL;
char *query = NULL;
sqlite3 *appinfo_db = NULL;
- char *alias_id = NULL;
+ char *app_id = NULL;
/*open db*/
- ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ ret = _pminfo_db_open(MANIFEST_DB, &appinfo_db);
retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
- /*Get the alias id*/
- alias_id = __get_aliasid_from_db(appinfo_db,appid);
+ /*check the real app id*/
+ app_id = __get_appid_from_aliasid(appinfo_db,appid);
/*check alias_id exist on db*/
- query = sqlite3_mprintf("select exists(select * from package_app_info where app_id=%Q and app_disable='false')", alias_id);
+ query = sqlite3_mprintf("select exists(select * from package_app_info where app_id=%Q and app_disable='false')", app_id);
ret = __exec_db_query(appinfo_db, query, _pkgmgrinfo_validate_cb, (void *)&exist);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "sqlite3_exec fail");
- tryvm_if(exist == 0, ret = PMINFO_R_ERROR, "Appid[%s] not found in DB", alias_id);
+ tryvm_if(exist == 0, ret = PMINFO_R_ERROR, "Appid[%s] not found in DB", app_id);
/*get system locale*/
locale = __convert_system_locale_to_manifest_locale();
appinfo->locale = strdup(locale);
/*populate app_info from DB*/
- query = sqlite3_mprintf("select * from package_app_info where app_id=%Q and app_disable='false' ", alias_id);
+ query = sqlite3_mprintf("select * from package_app_info where app_id=%Q and app_disable='false' ", app_id);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
- query = sqlite3_mprintf("select * from package_app_localized_info where app_id=%Q and app_locale=%Q", alias_id, locale);
+ query = sqlite3_mprintf("select * from package_app_localized_info where app_id=%Q and app_locale=%Q", app_id, locale);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
/*Also store the values corresponding to default locales*/
- query = sqlite3_mprintf("select * from package_app_localized_info where app_id=%Q and app_locale=%Q", alias_id, DEFAULT_LOCALE);
+ query = sqlite3_mprintf("select * from package_app_localized_info where app_id=%Q and app_locale=%Q", app_id, DEFAULT_LOCALE);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
/*Populate app category*/
- query = sqlite3_mprintf("select * from package_app_app_category where app_id=%Q", alias_id);
+ query = sqlite3_mprintf("select * from package_app_app_category where app_id=%Q", app_id);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Category Info DB Information retrieval failed");
/*Populate app metadata*/
- query = sqlite3_mprintf("select * from package_app_app_metadata where app_id=%Q", alias_id);
+ query = sqlite3_mprintf("select * from package_app_app_metadata where app_id=%Q", app_id);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Metadata Info DB Information retrieval failed");
/*Populate app permission*/
- query = sqlite3_mprintf("select * from package_app_app_permission where app_id=%Q", alias_id);
+ query = sqlite3_mprintf("select * from package_app_app_permission where app_id=%Q", app_id);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App permission Info DB Information retrieval failed");
/*store setting notification icon section*/
- query = sqlite3_mprintf("select * from package_app_icon_section_info where app_id=%Q", alias_id);
+ query = sqlite3_mprintf("select * from package_app_icon_section_info where app_id=%Q", app_id);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
/*store app preview image info*/
- query = sqlite3_mprintf("select app_image_section, app_image from package_app_image_info where app_id=%Q", alias_id);
+ query = sqlite3_mprintf("select app_image_section, app_image from package_app_image_info where app_id=%Q", app_id);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
- SAFE_LISTHEAD(appinfo->uiapp_info->label, tmp1);
- SAFE_LISTHEAD(appinfo->uiapp_info->icon, tmp2);
- SAFE_LISTHEAD(appinfo->uiapp_info->category, tmp3);
- SAFE_LISTHEAD(appinfo->uiapp_info->metadata, tmp4);
- SAFE_LISTHEAD(appinfo->uiapp_info->permission, tmp5);
- SAFE_LISTHEAD(appinfo->uiapp_info->image, tmp6);
-
ret = PMINFO_R_OK;
catch:
sqlite3_close(appinfo_db);
FREE_AND_NULL(locale);
- FREE_AND_NULL(alias_id);
+ FREE_AND_NULL(app_id);
return ret;
}
char *locale = NULL;
int ret = -1;
int exist = 0;
- label_x *tmp1 = NULL;
- icon_x *tmp2 = NULL;
- category_x *tmp3 = NULL;
- metadata_x *tmp4 = NULL;
- permission_x *tmp5 = NULL;
- image_x *tmp6 = NULL;
char *query = NULL;
sqlite3 *appinfo_db = NULL;
- char *alias_id = NULL;
+ char *app_id = NULL;
/*open db*/
- ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ ret = _pminfo_db_open(MANIFEST_DB, &appinfo_db);
retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
- /*Get the alias id*/
- alias_id = __get_aliasid_from_db(appinfo_db,appid);
+ /*check the real app id*/
+ app_id = __get_appid_from_aliasid(appinfo_db,appid);
/*check alias_id exist on db*/
- query = sqlite3_mprintf("select exists(select * from package_app_info where app_id=%Q and app_disable='false')", alias_id);
+ query = sqlite3_mprintf("select exists(select * from package_app_info where app_id=%Q and app_disable='false')", app_id);
ret = __exec_db_query(appinfo_db, query, _pkgmgrinfo_validate_cb, (void *)&exist);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "sqlite3_exec fail");
if (exist == 0) {
- _LOGS("Appid[%s] not found in DB", alias_id);
+ _LOGS("Appid[%s] not found in DB", app_id);
ret = PMINFO_R_ERROR;
goto catch;
}
appinfo->locale = strdup(locale);
/*populate app_info from DB*/
- query = sqlite3_mprintf("select * from package_app_info where app_id=%Q and app_disable='false' ", alias_id);
+ query = sqlite3_mprintf("select * from package_app_info where app_id=%Q and app_disable='false' ", app_id);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
- query = sqlite3_mprintf("select * from package_app_localized_info where app_id=%Q and app_locale=%Q", alias_id, locale);
+ query = sqlite3_mprintf("select * from package_app_localized_info where app_id=%Q and app_locale=%Q", app_id, locale);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
- /*Also store the values corresponding to default locales*/
- query = sqlite3_mprintf("select * from package_app_localized_info where app_id=%Q and app_locale=%Q", alias_id, DEFAULT_LOCALE);
+ /* Also store the values corresponding to default locales */
+ query = sqlite3_mprintf("select * from package_app_localized_info where app_id=%Q and app_locale=%Q", app_id, DEFAULT_LOCALE);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
/*Populate app category*/
- query = sqlite3_mprintf("select * from package_app_app_category where app_id=%Q", alias_id);
+ query = sqlite3_mprintf("select * from package_app_app_category where app_id=%Q", app_id);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Category Info DB Information retrieval failed");
/*Populate app metadata*/
- query = sqlite3_mprintf("select * from package_app_app_metadata where app_id=%Q", alias_id);
+ query = sqlite3_mprintf("select * from package_app_app_metadata where app_id=%Q", app_id);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Metadata Info DB Information retrieval failed");
/*Populate app permission*/
- query = sqlite3_mprintf("select * from package_app_app_permission where app_id=%Q", alias_id);
+ query = sqlite3_mprintf("select * from package_app_app_permission where app_id=%Q", app_id);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App permission Info DB Information retrieval failed");
/*store setting notification icon section*/
- query = sqlite3_mprintf("select * from package_app_icon_section_info where app_id=%Q", alias_id);
+ query = sqlite3_mprintf("select * from package_app_icon_section_info where app_id=%Q", app_id);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
/*store app preview image info*/
- query = sqlite3_mprintf("select app_image_section, app_image from package_app_image_info where app_id=%Q", alias_id);
+ query = sqlite3_mprintf("select app_image_section, app_image from package_app_image_info where app_id=%Q", app_id);
ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
ret = __appinfo_check_installed_storage(appinfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "[%s] is installed external, but is not in mmc", appinfo->uiapp_info->package);
- SAFE_LISTHEAD(appinfo->uiapp_info->label, tmp1);
- SAFE_LISTHEAD(appinfo->uiapp_info->icon, tmp2);
- SAFE_LISTHEAD(appinfo->uiapp_info->category, tmp3);
- SAFE_LISTHEAD(appinfo->uiapp_info->metadata, tmp4);
- SAFE_LISTHEAD(appinfo->uiapp_info->permission, tmp5);
- SAFE_LISTHEAD(appinfo->uiapp_info->image, tmp6);
+ /*Populate app control*/
+ query = sqlite3_mprintf("select app_control from package_app_app_control where app_id=%Q", app_id);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Conrtol Info DB Information retrieval failed");
ret = PMINFO_R_OK;
sqlite3_close(appinfo_db);
FREE_AND_NULL(locale);
- FREE_AND_NULL(alias_id);
+ FREE_AND_NULL(app_id);
return ret;
}
+API int pkgmgrinfo_appinfo_get_disabled_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
+{
+ retvm_if(appid == NULL, PMINFO_R_EINVAL, "appid is NULL");
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+
+ pkgmgr_appinfo_x *appinfo = NULL;
+ char *locale = NULL;
+ int ret = -1;
+ int exist = 0;
+ char *query = NULL;
+ sqlite3 *appinfo_db = NULL;
+ char *app_id = NULL;
+
+ /*open db*/
+ ret = _pminfo_db_open(MANIFEST_DB, &appinfo_db);
+ retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*check the real app id*/
+ app_id = __get_appid_from_aliasid(appinfo_db,appid);
+
+ /*check alias_id exist on db*/
+ query = sqlite3_mprintf("select exists(select * from package_app_info" \
+ "where package_app_info.app_id=%Q and package_app_info.app_disable='true')", app_id);
+ ret = __exec_db_query(appinfo_db, query, _pkgmgrinfo_validate_cb, (void *)&exist);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "sqlite3_exec fail");
+ if (exist == 0) {
+ _LOGS("Appid[%s] not found in DB", app_id);
+ ret = PMINFO_R_ERROR;
+ goto catch;
+ }
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ /*calloc appinfo*/
+ appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+ tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
+
+ /*calloc app_component*/
+ appinfo->uiapp_info = (uiapplication_x *)calloc(1, sizeof(uiapplication_x));
+ tryvm_if(appinfo->uiapp_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for uiapp info");
+
+ appinfo->locale = strdup(locale);
+
+ /*populate app_info from DB*/
+ query = sqlite3_mprintf("select * from package_app_info" \
+ "where package_app_info.app_id=%Q and package_app__info.app_disable='true' ", app_id);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ query = sqlite3_mprintf("select * from package_app_localized_info where app_id=%Q and app_locale=%Q", app_id, locale);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
+
+ /*Also store the values corresponding to default locales*/
+ query = sqlite3_mprintf("select * from package_app_localized_info where app_id=%Q and app_locale=%Q", app_id, DEFAULT_LOCALE);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
+
+ /*Populate app category*/
+ query = sqlite3_mprintf("select * from package_app_app_category where app_id=%Q", app_id);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Category Info DB Information retrieval failed");
+
+ /*Populate app metadata*/
+ query = sqlite3_mprintf("select * from package_app_app_metadata where app_id=%Q", app_id);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Metadata Info DB Information retrieval failed");
+
+ /*Populate app permission*/
+ query = sqlite3_mprintf("select * from package_app_app_permission where app_id=%Q", app_id);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App permission Info DB Information retrieval failed");
+
+ /*store setting notification icon section*/
+ query = sqlite3_mprintf("select * from package_app_icon_section_info where app_id=%Q", app_id);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App icon section Info DB Information retrieval failed");
+
+ /*store app preview image info*/
+ query = sqlite3_mprintf("select app_image_section, app_image from package_app_image_info where app_id=%Q", app_id);
+ ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App image Info DB Information retrieval failed");
+
+ ret = __appinfo_check_installed_storage(appinfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "[%s] is installed external, but is not in mmc", appinfo->uiapp_info->package);
+
+ ret = PMINFO_R_OK;
+
+catch:
+ if (ret == PMINFO_R_OK)
+ *handle = (void*)appinfo;
+ else {
+ *handle = NULL;
+ __cleanup_appinfo(appinfo);
+ }
+
+ sqlite3_close(appinfo_db);
+ FREE_AND_NULL(locale);
+ FREE_AND_NULL(app_id);
+ return ret;
+}
API int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h handle, char **appid)
{
}
-API int pkgmgrinfo_appinfo_get_ambient_support(pkgmgrinfo_appinfo_h handle, bool *ambient_support)
-{
- retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
- retvm_if(ambient_support == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
- pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
- char *val = NULL;
- bool is_support = false;
-
- val = (char *)info->uiapp_info->ambient_support;
- if (val) {
- if (strcasecmp(val, "true") == 0)
- is_support = true;
- }
-
- *ambient_support = is_support;
-
- return PMINFO_R_OK;
-}
-
API int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h handle, char **icon)
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
char *locale = NULL;
icon_x *ptr = NULL;
- icon_x *start = NULL;
+ GList *start = NULL;
*icon = NULL;
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
start = info->uiapp_info->icon;
- for(ptr = start; ptr != NULL; ptr = ptr->next)
+ for(; start != NULL; start = start->next)
{
- if (ptr->lang) {
- if (strcmp(ptr->lang, locale) == 0) {
- if (ptr->text) {
+ ptr = (icon_x*)start->data;
+ if (ptr && ptr->lang) {
+ if (strcmp(ptr->lang, locale) == 0) {
+ if (ptr->text) {
*icon = (char *)ptr->text;
if (strcasecmp(*icon, PKGMGR_PARSER_EMPTY_STR) == 0) {
locale = DEFAULT_LOCALE;
continue;
} else
break;
- } else {
- locale = DEFAULT_LOCALE;
- continue;
- }
- } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
- *icon = (char *)ptr->text;
- break;
- }
- }
+ } else {
+ locale = DEFAULT_LOCALE;
+ continue;
+ }
+ } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
+ *icon = (char *)ptr->text;
+ break;
+ }
+ }
}
+
return PMINFO_R_OK;
}
int ret = 0;
char *locale = NULL;
label_x *ptr = NULL;
- label_x *start = NULL;
+ GList *start = NULL;
*label = NULL;
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
start = info->uiapp_info->label;
- for(ptr = start; ptr != NULL; ptr = ptr->next)
+ for(; start != NULL; start = start->next)
{
- if (ptr->lang) {
- if (strcmp(ptr->lang, locale) == 0) {
- if (ptr->text) {
- *label = (char *)ptr->text;
- if (strcasecmp(*label, PKGMGR_PARSER_EMPTY_STR) == 0) {
- locale = DEFAULT_LOCALE;
- continue;
- } else
- break;
- } else {
- locale = DEFAULT_LOCALE;
- continue;
- }
- } else if (strncasecmp(ptr->lang, locale, 2) == 0) {
- *label = (char *)ptr->text;
- if (ptr->text) {
- if (strcasecmp(*label, PKGMGR_PARSER_EMPTY_STR) == 0) {
+ ptr = (label_x*)start->data;
+ if(ptr != NULL){
+ if (ptr->lang) {
+ if (strcmp(ptr->lang, locale) == 0) {
+ if (ptr->text) {
+ *label = (char *)ptr->text;
+ if (strcasecmp(*label, PKGMGR_PARSER_EMPTY_STR) == 0) {
locale = DEFAULT_LOCALE;
continue;
- } else
+ } else
break;
- } else {
- locale = DEFAULT_LOCALE;
- continue;
+ } else {
+ locale = DEFAULT_LOCALE;
+ continue;
+ }
+ } else if (strncasecmp(ptr->lang, locale, 2) == 0) {
+ *label = (char *)ptr->text;
+ if (ptr->text) {
+ if (strcasecmp(*label, PKGMGR_PARSER_EMPTY_STR) == 0) {
+ locale = DEFAULT_LOCALE;
+ continue;
+ } else
+ break;
+ } else {
+ locale = DEFAULT_LOCALE;
+ continue;
+ }
+ } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
+ *label = (char *)ptr->text;
+ break;
}
- } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
- *label = (char *)ptr->text;
- break;
}
}
}
return PMINFO_R_OK;
}
-
-API int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component)
-{
- retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
- retvm_if(component == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-
- *component = PMINFO_UI_APP;
-
- return PMINFO_R_OK;
-}
-
API int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h handle, char **app_type)
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
return PMINFO_R_OK;
}
-API int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h handle,
- int *operation_count, char ***operation)
-{
- retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
- retvm_if(operation == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
- retvm_if(operation_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
- pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
- *operation_count = data->operation_count;
- *operation = data->operation;
- return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h handle,
- int *uri_count, char ***uri)
-{
- retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
- retvm_if(uri == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
- retvm_if(uri_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
- pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
- *uri_count = data->uri_count;
- *uri = data->uri;
- return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h handle,
- int *mime_count, char ***mime)
-{
- retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
- retvm_if(mime == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
- retvm_if(mime_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
- pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
- *mime_count = data->mime_count;
- *mime = data->mime;
- return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h handle,
- int *subapp_count, char ***subapp)
-{
- retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
- retvm_if(subapp == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
- retvm_if(subapp_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
- pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
- *subapp_count = data->subapp_count;
- *subapp = data->subapp;
- return PMINFO_R_OK;
-}
-
API int pkgmgrinfo_appinfo_get_setting_icon(pkgmgrinfo_appinfo_h handle, char **icon)
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
char *val = NULL;
icon_x *ptr = NULL;
- icon_x *start = NULL;
+ GList *start = NULL;
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
start = info->uiapp_info->icon;
- for(ptr = start; ptr != NULL; ptr = ptr->next)
+ for(; start != NULL; start = start->next)
{
- if (ptr->section) {
+ ptr = (icon_x*)start->data;
+ if (ptr && ptr->section) {
val = (char *)ptr->section;
if (strcmp(val, "setting") == 0){
*icon = (char *)ptr->text;
char *val = NULL;
icon_x *ptr = NULL;
- icon_x *start = NULL;
+ GList *start = NULL;
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
start = info->uiapp_info->icon;
- for(ptr = start; ptr != NULL; ptr = ptr->next)
+ for(; start != NULL; start = start->next)
{
- if (ptr->section) {
+ ptr = (icon_x*)start->data;
+ if (ptr && ptr->section) {
val = (char *)ptr->section;
if (strcmp(val, "small") == 0){
*icon = (char *)ptr->text;
char *val = NULL;
icon_x *ptr = NULL;
- icon_x *start = NULL;
+ GList *start = NULL;
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
start = info->uiapp_info->icon;
- for(ptr = start; ptr != NULL; ptr = ptr->next)
+ for(; start!= NULL; start = start->next)
{
- if (ptr->section) {
+ ptr = (icon_x*)start->data;
+ if (ptr && ptr->section) {
val = (char *)ptr->section;
if (strcmp(val, "notification") == 0){
char *val = NULL;
image_x *ptr = NULL;
- image_x *start = NULL;
+ GList *start = NULL;
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
start = info->uiapp_info->image;
- for(ptr = start; ptr != NULL; ptr = ptr->next)
+ for(; start != NULL; start = start->next)
{
- if (ptr->section) {
+ ptr = (image_x*)start->data;
+ if (ptr && ptr->section) {
val = (char *)ptr->section;
if (strcmp(val, "preview") == 0)
sqlite3_stmt *stmt = NULL;
sqlite3 *pkgmgr_parser_db = NULL;
- char *alias_id = NULL;
+ char *app_id = NULL;
- ret = db_util_open(MANIFEST_DB, &pkgmgr_parser_db, 0);
+ ret = _pminfo_db_open(MANIFEST_DB, &pkgmgr_parser_db);
if (ret != SQLITE_OK) {
_LOGE("DB open fail\n");
return -1;
}
- /*Get the alias id*/
- alias_id = __get_aliasid_from_db(pkgmgr_parser_db,appid);
-
- query = sqlite3_mprintf("select app_label from package_app_localized_info where app_id=%Q and app_locale=%Q", alias_id, locale);
+ /*check the real app id*/
+ app_id = __get_appid_from_aliasid(pkgmgr_parser_db,appid);
+ query = sqlite3_mprintf("select app_label from package_app_localized_info where app_id=%Q and app_locale=%Q", app_id, locale);
ret = sqlite3_prepare_v2(pkgmgr_parser_db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK) {
_LOGE("prepare_v2 fail\n");
sqlite3_close(pkgmgr_parser_db);
sqlite3_free(query);
- FREE_AND_NULL(alias_id);
+ FREE_AND_NULL(app_id);
return -1;
}
break;
_LOGE("success find localed_label[%s]\n", val);
- FREE_AND_NULL(localed_label);
+
localed_label = strdup(val);
if (localed_label == NULL)
break;
+ if (*label != NULL)
+ free(*label);
+
*label = localed_label;
/*find default label when exact matching failed*/
if (localed_label == NULL) {
sqlite3_free(query);
- query = sqlite3_mprintf("select app_label from package_app_localized_info where app_id=%Q and app_locale=%Q", alias_id, DEFAULT_LOCALE);
+ query = sqlite3_mprintf("select app_label from package_app_localized_info where app_id=%Q and app_locale=%Q", app_id, DEFAULT_LOCALE);
ret = sqlite3_prepare_v2(pkgmgr_parser_db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK) {
_LOGE("prepare_v2 fail\n");
sqlite3_close(pkgmgr_parser_db);
sqlite3_free(query);
- FREE_AND_NULL(alias_id);
+ FREE_AND_NULL(app_id);
return -1;
}
if (val == NULL)
break;
_LOGE("success find default localed_label[%s]\n", val);
- FREE_AND_NULL(localed_label);
localed_label = strdup(val);
if (localed_label == NULL)
break;
+
+ if (*label != NULL)
+ free(*label);
+
*label = localed_label;
}
ret = 0;
}
- FREE_AND_NULL(alias_id);
+ FREE_AND_NULL(app_id);
sqlite3_finalize(stmt);
sqlite3_close(pkgmgr_parser_db);
sqlite3_free(query);
retvm_if(metadata_key == NULL, PMINFO_R_EINVAL, "metadata_key is NULL");
retvm_if(metadata_value == NULL, PMINFO_R_EINVAL, "metadata_value is NULL");
- metadata_x *ptr = NULL;
+ GList *list_md = NULL;
+ metadata_x *metadata = NULL;
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
- ptr = info->uiapp_info->metadata;
+ list_md = info->uiapp_info->metadata;
- for (; ptr; ptr = ptr->next) {
- if (ptr->key) {
- if (strcasecmp(ptr->key, metadata_key) == 0)
+ for (; list_md; list_md = list_md->next) {
+ metadata = (metadata_x *)list_md->data;
+ if (metadata && metadata->key) {
+ if (strcasecmp(metadata->key, metadata_key) == 0)
{
- *metadata_value = (char*)ptr->value;
+ *metadata_value = (char*)metadata->value;
return PMINFO_R_OK;
}
}
sqlite3_stmt *stmt = NULL;
/*open db*/
- ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ ret = _pminfo_db_open(MANIFEST_DB, &appinfo_db);
retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
/*Start constructing query*/
return ret;
}
+API int pkgmgrinfo_appinfo_foreach_background_category(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_background_category_list_cb category_func, void *user_data)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(category_func == NULL, PMINFO_R_EINVAL, "callback function is NULL");
+
+ GList *category_list = NULL;
+ char *tmp_category_name = NULL;
+ int ret = -1;
+
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ if (info->uiapp_info && info->uiapp_info->background_category)
+ category_list = info->uiapp_info->background_category;
+ else
+ return PMINFO_R_OK;
+
+ for (; category_list; category_list = category_list->next) {
+ tmp_category_name = (char *)category_list->data;
+ if (tmp_category_name == NULL)
+ continue;
+
+ ret = category_func(tmp_category_name, user_data);
+ if (ret < 0)
+ break;
+ }
+
+ return PMINFO_R_OK;
+}
+
API int pkgmgrinfo_appinfo_get_datacontrol_appid(const char *providerid, char **appid)
{
retvm_if(providerid == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
sqlite3_stmt *stmt = NULL;
/*open db*/
- ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ ret = _pminfo_db_open(MANIFEST_DB, &appinfo_db);
retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
/*Start constructing query*/
return PMINFO_R_OK;
}
+API int pkgmgrinfo_appinfo_get_support_category(pkgmgrinfo_appinfo_h handle, int *support_category)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(support_category == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ if (info->uiapp_info->support_feature)
+ *support_category = atoi(info->uiapp_info->support_category);
+ else
+ *support_category = 0;
+
+ return PMINFO_R_OK;
+}
+
API int pkgmgrinfo_appinfo_get_uginfo(const char *ug_name, pkgmgrinfo_appinfo_h *handle)
{
retvm_if(ug_name == NULL, PMINFO_R_EINVAL, "ug_name is NULL");
sqlite3 *appinfo_db = NULL;
/*open db*/
- ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ ret = _pminfo_db_open(MANIFEST_DB, &appinfo_db);
retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
/*calloc appinfo*/
return ret;
}
-/*Get the alias id for an appid from pkgmgr DB*/
-API int pkgmgrinfo_appinfo_get_aliasid(const char *appid, char **alias_id)
+/*Get the app id for an aliasid from pkgmgr DB*/
+API int pkgmgrinfo_appinfo_get_appid_from_aliasid(const char *alias_id, char **appid)
{
-
sqlite3 *appinfo_db = NULL;
int ret = PMINFO_R_OK;
retvm_if(alias_id == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
/*open db */
- ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
+ ret = _pminfo_db_open(MANIFEST_DB, &appinfo_db);
tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
- *alias_id = __get_aliasid_from_db(appinfo_db,appid);
+ *appid = __get_appid_from_aliasid(appinfo_db,alias_id);
catch:
sqlite3_close(appinfo_db);
return ret;
}
+API int pkgmgrinfo_appinfo_get_alias_appid(pkgmgrinfo_appinfo_h handle, char **alias_appid)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(alias_appid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ *alias_appid = (char *)info->uiapp_info->alias_appid;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_effective_appid(pkgmgrinfo_appinfo_h handle, char **effective_appid)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+ retvm_if(effective_appid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ *effective_appid = (char *)info->uiapp_info->effective_appid;
+
+ return PMINFO_R_OK;
+}
+
API int pkgmgrinfo_appinfo_get_installed_time(pkgmgrinfo_appinfo_h handle, int *installed_time)
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
return PMINFO_R_OK;
}
+API int pkgmgrinfo_appinfo_get_installed_storage_location(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_installed_storage *storage)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ if (info->uiapp_info && info->uiapp_info->installed_storage){
+ if (strcmp(info->uiapp_info->installed_storage,"installed_internal") == 0)
+ *storage = PMINFO_INTERNAL_STORAGE;
+ else if (strcmp(info->uiapp_info->installed_storage,"installed_external") == 0)
+ *storage = PMINFO_EXTERNAL_STORAGE;
+ else
+ return PMINFO_R_ERROR;
+ }else
+ return PMINFO_R_ERROR;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_launch_mode(pkgmgrinfo_appinfo_h handle, char **mode)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ if (info->uiapp_info->launch_mode)
+ *mode = (char *)(info->uiapp_info->launch_mode);
+ else
+ return PMINFO_R_ERROR;
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_get_appcontrol(const char *appid, char **appcontrol)
+{
+ retvm_if(appid == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL.");
+ retvm_if(appcontrol == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL.");
+
+ int ret = PMINFO_R_OK;
+ char *query = NULL;
+ sqlite3 *appinfo_db = NULL;
+ sqlite3_stmt *stmt = NULL;
+
+ /*open db*/
+ ret = _pminfo_db_open(MANIFEST_DB, &appinfo_db);
+ retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*Start constructing query*/
+ query = sqlite3_mprintf("select * from package_app_app_control where app_id=%Q", appid);
+
+ /*prepare query*/
+ ret = sqlite3_prepare_v2(appinfo_db, query, strlen(query), &stmt, NULL);
+ tryvm_if(ret != PMINFO_R_OK, ret = PMINFO_R_ERROR, "sqlite3_prepare_v2 failed[%s].", query);
+
+ /*step query*/
+ ret = sqlite3_step(stmt);
+ tryvm_if((ret != SQLITE_ROW) || (ret == SQLITE_DONE), ret = PMINFO_R_ERROR, "No records found.");
+
+ *appcontrol = strdup((char *)sqlite3_column_text(stmt, 1));
+
+ ret = PMINFO_R_OK;
+
+catch:
+ sqlite3_free(query);
+ sqlite3_finalize(stmt);
+ sqlite3_close(appinfo_db);
+ return ret;
+}
+
+API int pkgmgrinfo_appinfo_get_api_version(pkgmgrinfo_appinfo_h handle, char **api_version)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(api_version == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ if (info->uiapp_info->api_version) {
+ *api_version = (char *)(info->uiapp_info->api_version);
+ } else {
+ FREE_AND_STRDUP(PKGMGR_PARSER_EMPTY_STR, info->uiapp_info->api_version);
+ *api_version = (char *)(info->uiapp_info->api_version);
+ }
+
+ return PMINFO_R_OK;
+}
+
+#ifdef _APPFW_FEATURE_EXPANSION_PKG_INSTALL
+API int pkgmgrinfo_appinfo_get_tep_name(pkgmgrinfo_appinfo_h handle, char **tep_name)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(tep_name == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ if (info->uiapp_info && info->uiapp_info->tep_name)
+ *tep_name = (char *)(info->uiapp_info->tep_name);
+ else
+ return PMINFO_R_ERROR;
+
+ return PMINFO_R_OK;
+}
+#endif
+
+#ifdef _APPFW_FEATURE_MOUNT_INSTALL
+API int pkgmgrinfo_appinfo_get_tpk_name(pkgmgrinfo_appinfo_h handle, char **tpk_name)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(tpk_name == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ if (info->uiapp_info && info->uiapp_info->tpk_name)
+ *tpk_name = (char *)(info->uiapp_info->tpk_name);
+ else
+ return PMINFO_R_ERROR;
+
+ return PMINFO_R_OK;
+}
+#endif
+
API int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
pkgmgrinfo_app_permission_list_cb permission_func, void *user_data)
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
retvm_if(permission_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
int ret = -1;
- permission_x *ptr = NULL;
+ permission_x *permission = NULL;
+ GList *ptr = NULL;
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
ptr = info->uiapp_info->permission;
for (; ptr; ptr = ptr->next) {
- if (ptr->value) {
- ret = permission_func(ptr->value, user_data);
+ permission = (permission_x*)ptr->data;
+ if ((permission) && (permission->value)) {
+ ret = permission_func(permission->value, user_data);
if (ret < 0)
break;
}
retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
retvm_if(category_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
int ret = -1;
- category_x *ptr = NULL;
+ category_x *category = NULL;
+ GList *ptr = NULL;
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
ptr = info->uiapp_info->category;
for (; ptr; ptr = ptr->next) {
- if (ptr->name) {
- ret = category_func(ptr->name, user_data);
+ category = (category_x*)ptr->data;
+ if ((category) && (category->name)) {
+ ret = category_func(category->name, user_data);
if (ret < 0)
break;
}
retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
retvm_if(metadata_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
int ret = -1;
- metadata_x *ptr = NULL;
+ metadata_x * metadata = NULL;
+ GList *list_md = NULL;
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
- ptr = info->uiapp_info->metadata;
+ list_md = info->uiapp_info->metadata;
- for (; ptr; ptr = ptr->next) {
- if (ptr->key) {
- ret = metadata_func(ptr->key, ptr->value, user_data);
+ for (; list_md; list_md = list_md->next) {
+ metadata = (metadata_x *)list_md->data;
+ if (metadata && metadata->key) {
+ ret = metadata_func(metadata->key, metadata->value, user_data);
if (ret < 0)
break;
}
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
retvm_if(appcontrol_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
- int i = 0;
int ret = -1;
- int oc = 0;
- int mc = 0;
- int uc = 0;
- int sc = 0;
- char *pkgid = NULL;
- char *manifest = NULL;
- char **operation = NULL;
- char **uri = NULL;
- char **mime = NULL;
- char **subapp = NULL;
- appsvc_x *appsvc = NULL;
- manifest_x *mfx = NULL;
- operation_x *op = NULL;
- uri_x *ui = NULL;
- mime_x *mi = NULL;
- subapp_x *sa = NULL;
- pkgmgrinfo_app_component component;
- pkgmgrinfo_appcontrol_x *ptr = NULL;
- ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid);
- if (ret < 0) {
- _LOGE("Failed to get package name\n");
- return PMINFO_R_ERROR;
- }
- ret = pkgmgrinfo_appinfo_get_component(handle, &component);
- if (ret < 0) {
- _LOGE("Failed to get app component name\n");
- return PMINFO_R_ERROR;
- }
- manifest = pkgmgr_parser_get_manifest_file(pkgid);
- if (manifest == NULL) {
- _LOGE("Failed to fetch package manifest file\n");
- return PMINFO_R_ERROR;
- }
- mfx = pkgmgr_parser_process_manifest_xml(manifest);
- if (mfx == NULL) {
- _LOGE("Failed to parse package manifest file\n");
- FREE_AND_NULL(manifest);
- return PMINFO_R_ERROR;
- }
- FREE_AND_NULL(manifest);
- ptr = calloc(1, sizeof(pkgmgrinfo_appcontrol_x));
- if (ptr == NULL) {
- _LOGE("Out of Memory!!!\n");
- pkgmgr_parser_free_manifest_xml(mfx);
- return PMINFO_R_ERROR;
- }
- /*Get Operation, Uri, Mime*/
- if (mfx->uiapplication) {
- if (mfx->uiapplication->appsvc) {
- appsvc = mfx->uiapplication->appsvc;
- }
- }
-
- for (; appsvc; appsvc = appsvc->next) {
- op = appsvc->operation;
- for (; op; op = op->next)
- oc = oc + 1;
- op = appsvc->operation;
-
- ui = appsvc->uri;
- for (; ui; ui = ui->next)
- uc = uc + 1;
- ui = appsvc->uri;
-
- mi = appsvc->mime;
- for (; mi; mi = mi->next)
- mc = mc + 1;
- mi = appsvc->mime;
-
- sa = appsvc->subapp;
- for (; sa; sa = sa->next)
- sc = sc + 1;
- sa = appsvc->subapp;
-
- operation = (char **)calloc(oc, sizeof(char *));
- if (operation == NULL) {
- _LOGE("out of memory");
- break;
- }
-
- for (i = 0; i < oc; i++) {
- operation[i] = strndup(op->name, PKG_STRING_LEN_MAX - 1);
- op = op->next;
- }
-
- uri = (char **)calloc(uc, sizeof(char *));
- if (uri == NULL) {
- _LOGE("out of memory");
- for (i = 0; i < oc; i++) {
- FREE_AND_NULL(operation[i]);
- }
- FREE_AND_NULL(operation);
- break;
- }
-
- for (i = 0; i < uc; i++) {
- uri[i] = strndup(ui->name, PKG_STRING_LEN_MAX - 1);
- ui = ui->next;
- }
-
- mime = (char **)calloc(mc, sizeof(char *));
- if (mime == NULL) {
- _LOGE("out of memory");
- for (i = 0; i < uc; i++) {
- FREE_AND_NULL(uri[i]);
- }
- FREE_AND_NULL(uri);
- for (i = 0; i < oc; i++) {
- FREE_AND_NULL(operation[i]);
- }
- FREE_AND_NULL(operation);
- break;
- }
-
- for (i = 0; i < mc; i++) {
- mime[i] = strndup(mi->name, PKG_STRING_LEN_MAX - 1);
- mi = mi->next;
- }
-
- subapp = (char **)calloc(sc, sizeof(char *));
- if (subapp == NULL) {
- _LOGE("out of memory");
- for (i = 0; i < mc; i++) {
- FREE_AND_NULL(mime[i]);
- }
- FREE_AND_NULL(mime);
- for (i = 0; i < uc; i++) {
- FREE_AND_NULL(uri[i]);
- }
- FREE_AND_NULL(uri);
- for (i = 0; i < oc; i++) {
- FREE_AND_NULL(operation[i]);
- }
- FREE_AND_NULL(operation);
- break;
- }
-
- for (i = 0; i < sc; i++) {
- subapp[i] = strndup(sa->name, PKG_STRING_LEN_MAX - 1);
- sa = sa->next;
- }
+ appcontrol_x *appcontrol = NULL;
+ GList *list_ac = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
- /*populate appcontrol handle*/
- ptr->operation_count = oc;
- ptr->uri_count = uc;
- ptr->mime_count = mc;
- ptr->subapp_count = sc;
- ptr->operation = operation;
- ptr->uri = uri;
- ptr->mime = mime;
- ptr->subapp = subapp;
+ list_ac = info->uiapp_info->appcontrol;
- ret = appcontrol_func((void *)ptr, user_data);
- for (i = 0; i < oc; i++) {
- FREE_AND_NULL(operation[i]);
- }
- FREE_AND_NULL(operation);
- for (i = 0; i < uc; i++) {
- FREE_AND_NULL(uri[i]);
- }
- FREE_AND_NULL(uri);
- for (i = 0; i < mc; i++) {
- FREE_AND_NULL(mime[i]);
+ for (; list_ac; list_ac = list_ac->next) {
+ appcontrol = (appcontrol_x *)list_ac->data;
+ if (appcontrol && appcontrol->operation) {
+ ret = appcontrol_func(appcontrol->operation,
+ appcontrol->uri, appcontrol->mime, user_data);
}
- FREE_AND_NULL(mime);
- for (i = 0; i < sc; i++) {
- FREE_AND_NULL(subapp[i]);
- }
- FREE_AND_NULL(subapp);
if (ret < 0)
break;
- uc = 0;
- mc = 0;
- oc = 0;
- sc = 0;
}
- pkgmgr_parser_free_manifest_xml(mfx);
- FREE_AND_NULL(ptr);
+
return PMINFO_R_OK;
}
retvm_if(category == NULL, PMINFO_R_EINVAL, "category is NULL");
retvm_if(exist == NULL, PMINFO_R_EINVAL, "exist is NULL");
- category_x *ptr = NULL;
+ category_x *ct = NULL;
+ GList *ptr = NULL;
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
*exist = 0;
ptr = info->uiapp_info->category;
for (; ptr; ptr = ptr->next) {
- if (ptr->name) {
- if (strcasecmp(ptr->name, category) == 0)
+ ct = (category_x*)ptr->data;
+ if ((ct) && (ct->name)) {
+ if (strcasecmp(ct->name, category) == 0)
{
*exist = 1;
break;
return PMINFO_R_OK;
}
+API int pkgmgrinfo_appinfo_is_companion_type(pkgmgrinfo_appinfo_h handle, bool *companion_type)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(companion_type == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ char *val = NULL;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ val = (char *)info->uiapp_info->companion_type;
+ if (val) {
+ if (strcasecmp(val, "true") == 0)
+ *companion_type = 1;
+ else if (strcasecmp(val, "false") == 0)
+ *companion_type = 0;
+ else
+ *companion_type = 0;
+ }
+ return PMINFO_R_OK;
+}
+
+#ifdef _APPFW_FEATURE_MOUNT_INSTALL
+API int pkgmgrinfo_appinfo_is_mount_install(pkgmgrinfo_appinfo_h handle, bool *ismount)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(ismount == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ int val;
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+ val = (int)info->uiapp_info->ismount;
+ if (val == 0) {
+ *ismount = false;
+ }else if(val == 1){
+ *ismount = true;
+ }else{
+ _LOGE("Error mount install value : [%d]", val);
+ return PMINFO_R_ERROR;
+ }
+
+ return PMINFO_R_OK;
+}
+#endif
+
API int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
/*If API is called multiple times for same property, we should override the previous values.
Last value set will be used for filtering.*/
link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
- if (link)
+ if (link) {
+ _pminfo_destroy_node((gpointer)link->data);
filter->list = g_slist_delete_link(filter->list, link);
+ }
filter->list = g_slist_append(filter->list, (gpointer)node);
return PMINFO_R_OK;
_LOGE("Out of Memory!!!\n");
return PMINFO_R_ERROR;
}
- if (value)
- val = strndup("('true','True')", 15);
- else
- val = strndup("('false','False')", 17);
+ if (prop == E_PMINFO_APPINFO_PROP_APP_BG_USER_DISABLE) {
+ val = strndup(((value)?"1":"0"), PKG_STRING_LEN_MAX - 1);
+ } else {
+ if (value)
+ val = strndup("('true','True')", 15);
+ else
+ val = strndup("('false','False')", 17);
+ }
if (val == NULL) {
_LOGE("Out of Memory\n");
FREE_AND_NULL(node);
/*If API is called multiple times for same property, we should override the previous values.
Last value set will be used for filtering.*/
link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
- if (link)
+ if (link) {
+ _pminfo_destroy_node((gpointer)link->data);
filter->list = g_slist_delete_link(filter->list, link);
+ }
filter->list = g_slist_append(filter->list, (gpointer)node);
return PMINFO_R_OK;
}
+API int pkgmgrinfo_appinfo_filter_add_bg_category(pkgmgrinfo_appinfo_filter_h handle, int category_filter)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
+ retvm_if(category_filter < APP_BG_CATEGORY_MEDIA_VAL, PMINFO_R_EINVAL, "Category filter input parameter is not valid\n");
+
+ int prop = E_PMINFO_APPINFO_PROP_APP_BG_CATEGORY;
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)calloc(1, sizeof(pkgmgrinfo_node_x));
+ GSList *link = NULL;
+ char buf[PKG_STRING_LEN_MAX] = {'\0'};
+
+ if (node == NULL) {
+ _LOGE("Out of Memory!!!\n");
+ return PMINFO_R_ERROR;
+ }
+
+ snprintf(buf, PKG_STRING_LEN_MAX - 1, "%d", category_filter);
+ node->prop = prop;
+ node->value = strndup(buf, PKG_STRING_LEN_MAX - 1);
+ link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
+ if (link) {
+ _pminfo_destroy_node((gpointer)link->data);
+ filter->list = g_slist_delete_link(filter->list, link);
+ }
+ filter->list = g_slist_append(filter->list, (gpointer)node);
+
+ return PMINFO_R_OK;
+}
+
API int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
const char *property, const char *value)
{
}
node->prop = prop;
switch (prop) {
- case E_PMINFO_APPINFO_PROP_APP_COMPONENT:
- val = strndup("uiapp", PKG_STRING_LEN_MAX - 1);
- node->value = val;
+ case E_PMINFO_APPINFO_PROP_APP_COMPONENT_TYPE:
+ node->value = strdup(value);
link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
- if (link)
+ if (link) {
+ _pminfo_destroy_node((gpointer)link->data);
filter->list = g_slist_delete_link(filter->list, link);
+ }
filter->list = g_slist_append(filter->list, (gpointer)node);
break;
case E_PMINFO_APPINFO_PROP_APP_CATEGORY:
ptr = (pkgmgrinfo_node_x *)link->data;
strncpy(prev, ptr->value, PKG_STRING_LEN_MAX - 1);
_LOGS("Previous value is %s\n", prev);
+ _pminfo_destroy_node((gpointer)link->data);
filter->list = g_slist_delete_link(filter->list, link);
snprintf(temp, PKG_STRING_LEN_MAX - 1, "%s , '%s'", prev, value);
strncpy(val, temp, PKG_STRING_LEN_MAX - 1);
default:
node->value = strndup(value, PKG_STRING_LEN_MAX - 1);
link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
- if (link)
+ if (link) {
+ _pminfo_destroy_node((gpointer)link->data);
filter->list = g_slist_delete_link(filter->list, link);
+ }
filter->list = g_slist_append(filter->list, (gpointer)node);
break;
}
char query[MAX_QUERY_LEN] = {'\0'};
char where[MAX_QUERY_LEN] = {'\0'};
- uiapplication_x *ptr1 = NULL;
pkgmgr_pkginfo_x *info = NULL;
pkgmgr_appinfo_x *appinfo = NULL;
pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ GList *list_up = NULL;
sqlite3 *pkginfo_db = NULL;
sqlite3_stmt *stmt = NULL;
/*open db*/
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
- retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "db_util_open[%s] failed!", MANIFEST_DB);
+ ret = _pminfo_db_open(MANIFEST_DB, &pkginfo_db);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "_pminfo_db_open[%s] failed!", MANIFEST_DB);
/*calloc*/
info = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
/*Start constructing query*/
locale = __convert_system_locale_to_manifest_locale();
- snprintf(query, MAX_QUERY_LEN - 1, FILTER_QUERY_COUNT_APP, locale);
+ sqlite3_snprintf(MAX_QUERY_LEN - 1, query, FILTER_QUERY_COUNT_APP, locale);
/*Get where clause*/
for (list = filter->list; list; list = g_slist_next(list)) {
}
}
- /*head up*/
- SAFE_LISTHEAD(info->manifest_info->uiapplication, ptr1);
+ list_up = info->manifest_info->uiapplication;
/*If the callback func return < 0 we break and no more call back is called*/
- while(ptr1 != NULL)
+ while(list_up != NULL)
{
- appinfo->uiapp_info = ptr1;
+ appinfo->uiapp_info = (uiapplication_x *)list_up->data;
ret = __appinfo_check_installed_storage(appinfo);
if(ret < 0) {
- ptr1 = ptr1->next;
+ list_up = list_up->next;
continue;
}
- ptr1 = ptr1->next;
+ list_up = list_up->next;
filter_count++;
}
pkgmgr_pkginfo_x *info = NULL;
pkgmgr_appinfo_x *appinfo = NULL;
pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
- uiapplication_x *ptr1 = NULL;
+ GList *list_up = NULL;
sqlite3 *pkginfo_db = NULL;
sqlite3_stmt *stmt = NULL;
GSList *list;
/*open db*/
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ ret = _pminfo_db_open(MANIFEST_DB, &pkginfo_db);
retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
/*calloc*/
/*Start constructing query*/
locale = __convert_system_locale_to_manifest_locale();
- tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "locale is NULL\n");
- snprintf(query, MAX_QUERY_LEN - 1, FILTER_QUERY_LIST_APP, DEFAULT_LOCALE, locale);
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "fail to __convert_system_locale_to_manifest_locale\n");
+
+ sqlite3_snprintf(MAX_QUERY_LEN - 1, query, FILTER_QUERY_LIST_APP, DEFAULT_LOCALE, locale);
/*Get where clause*/
for (list = filter->list; list; list = g_slist_next(list)) {
}
}
- /*head up*/
- SAFE_LISTHEAD(info->manifest_info->uiapplication, ptr1);
+ list_up = info->manifest_info->uiapplication;
/*If the callback func return < 0 we break and no more call back is called*/
- while(ptr1 != NULL)
+ while(list_up != NULL)
{
appinfo->locale = strdup(locale);
- appinfo->uiapp_info = ptr1;
+ appinfo->uiapp_info = (uiapplication_x *)list_up->data;
ret = __appinfo_check_installed_storage(appinfo);
if(ret < 0) {
FREE_AND_NULL(appinfo->locale);
- ptr1 = ptr1->next;
+ list_up = list_up->next;
continue;
}
ret = app_cb((void *)appinfo, user_data);
if (ret < 0){
FREE_AND_NULL(appinfo->locale);
+ _LOGE("callback is stopped.");
break;
}
FREE_AND_NULL(appinfo->locale);
- ptr1 = ptr1->next;
+ list_up = list_up->next;
}
ret = PMINFO_R_OK;
int ret = 0;
pkgmgr_pkginfo_x *info = NULL;
pkgmgr_appinfo_x *appinfo = NULL;
- uiapplication_x *ptr1 = NULL;
+ GList *list_up = NULL;
pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
sqlite3 *pkginfo_db = NULL;
sqlite3_stmt *stmt = NULL;
/*open db*/
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ ret = _pminfo_db_open(MANIFEST_DB, &pkginfo_db);
retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
/*calloc*/
/*Start constructing query*/
memset(where, '\0', MAX_QUERY_LEN);
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN - 1, METADATA_FILTER_QUERY_SELECT_CLAUSE);
+ sqlite3_snprintf(MAX_QUERY_LEN - 1, query, METADATA_FILTER_QUERY_SELECT_CLAUSE);
/*Get where clause*/
for (list = filter->list; list; list = g_slist_next(list)) {
where[sizeof(where) - 1] = '\0';
}
}
-
_LOGE("where = %s (%d)\n", where, strlen(where));
if (strlen(where) > 0) {
}
}
- /*head up*/
- SAFE_LISTHEAD(info->manifest_info->uiapplication, ptr1);
+ list_up = info->manifest_info->uiapplication;
/*UI Apps*/
- while (ptr1 != NULL) {
+ while (list_up != NULL) {
appinfo->locale = strdup(locale);
- appinfo->uiapp_info = ptr1;
+ appinfo->uiapp_info = (uiapplication_x *)list_up->data;
ret = __appinfo_check_installed_storage(appinfo);
if(ret < 0) {
FREE_AND_NULL(appinfo->locale);
- ptr1 = ptr1->next;
+ list_up = list_up->next;
continue;
}
ret = app_cb((void *)appinfo, user_data);
if (ret < 0) {
FREE_AND_NULL(appinfo->locale);
+ _LOGE("callback is stopped.");
break;
}
FREE_AND_NULL(appinfo->locale);
- ptr1 = ptr1->next;
+ list_up = list_up->next;
}
ret = PMINFO_R_OK;
#include "pkgmgrinfo_private.h"
#include <openssl/md5.h>
-#define HASH_LEN MD5_DIGEST_LENGTH * 2
static void __ps_free_category(category_x *category)
FREE_AND_NULL(category);
}
-static void __ps_free_privilege(privilege_x *privilege)
-{
- if (privilege == NULL)
- return;
- FREE_AND_NULL(privilege->text);
- FREE_AND_NULL(privilege);
-}
-
-static void __ps_free_privileges(privileges_x *privileges)
-{
- if (privileges == NULL)
- return;
- /*Free Privilege*/
- if (privileges->privilege) {
- privilege_x *privilege = privileges->privilege;
- privilege_x *tmp = NULL;
- while(privilege != NULL) {
- tmp = privilege->next;
- __ps_free_privilege(privilege);
- privilege = tmp;
- }
- }
- FREE_AND_NULL(privileges);
-}
static void __ps_free_metadata(metadata_x *metadata)
{
if (operation == NULL)
return;
FREE_AND_NULL(operation->text);
+ FREE_AND_NULL(operation->name);
FREE_AND_NULL(operation);
}
if (uri == NULL)
return;
FREE_AND_NULL(uri->text);
+ FREE_AND_NULL(uri->name);
FREE_AND_NULL(uri);
}
if (mime == NULL)
return;
FREE_AND_NULL(mime->text);
+ FREE_AND_NULL(mime->name);
FREE_AND_NULL(mime);
}
if (subapp == NULL)
return;
FREE_AND_NULL(subapp->text);
+ FREE_AND_NULL(subapp->name);
FREE_AND_NULL(subapp);
}
FREE_AND_NULL(datacontrol);
}
+static void __ps_free_appcontrol(appcontrol_x *appcontrol)
+{
+ if (appcontrol == NULL)
+ return;
+ FREE_AND_NULL(appcontrol->operation);
+ FREE_AND_NULL(appcontrol->uri);
+ FREE_AND_NULL(appcontrol->mime);
+ FREE_AND_NULL(appcontrol);
+}
+
static void __ps_free_launchconditions(launchconditions_x *launchconditions)
{
if (launchconditions == NULL)
return;
FREE_AND_NULL(launchconditions->text);
+ GList *cond_list = NULL;
/*Free Condition*/
if (launchconditions->condition) {
- condition_x *condition = launchconditions->condition;
- condition_x *tmp = NULL;
- while(condition != NULL) {
- tmp = condition->next;
+ cond_list = launchconditions->condition;
+ condition_x *condition = NULL;
+ while(cond_list != NULL) {
+ condition = (condition_x*)cond_list->data;
__ps_free_condition(condition);
- condition = tmp;
+ cond_list = cond_list->next;
}
+ g_list_free(launchconditions->condition);
}
FREE_AND_NULL(launchconditions);
}
if (appsvc == NULL)
return;
FREE_AND_NULL(appsvc->text);
+
/*Free Operation*/
if (appsvc->operation) {
- operation_x *operation = appsvc->operation;
- operation_x *tmp = NULL;
- while(operation != NULL) {
- tmp = operation->next;
+ GList *list_op = appsvc->operation;
+ operation_x *operation = NULL;
+
+ while(list_op!= NULL) {
+ operation = (operation_x *)list_op->data;
__ps_free_operation(operation);
- operation = tmp;
+ list_op = list_op->next;
}
+ g_list_free(appsvc->operation);
+ list_op = NULL;
+ operation = NULL;
}
+
/*Free Uri*/
if (appsvc->uri) {
- uri_x *uri = appsvc->uri;
- uri_x *tmp = NULL;
- while(uri != NULL) {
- tmp = uri->next;
+ GList *list_uri = appsvc->uri;
+ uri_x *uri = NULL;
+ while(list_uri != NULL) {
+ uri = (uri_x *)list_uri->data;
__ps_free_uri(uri);
- uri = tmp;
+ list_uri = list_uri->next;
}
+ g_list_free(appsvc->uri);
+ list_uri = NULL;
+ uri = NULL;
}
+
/*Free Mime*/
if (appsvc->mime) {
- mime_x *mime = appsvc->mime;
- mime_x *tmp = NULL;
- while(mime != NULL) {
- tmp = mime->next;
+ GList *list_mime = appsvc->mime;
+ mime_x *mime = NULL;
+ while(list_mime != NULL) {
+ mime = (mime_x *)list_mime->data;
__ps_free_mime(mime);
- mime = tmp;
+ list_mime = list_mime->next;
}
+ g_list_free(appsvc->mime);
+ list_mime = NULL;
+ mime = NULL;
}
+
/*Free subapp*/
if (appsvc->subapp) {
- subapp_x *subapp = appsvc->subapp;
- subapp_x *tmp = NULL;
- while(subapp != NULL) {
- tmp = subapp->next;
+ GList *list_subapp = appsvc->subapp;
+ subapp_x *subapp = NULL;
+ while(list_subapp != NULL) {
+ subapp = (subapp_x *)list_subapp->data;
__ps_free_subapp(subapp);
- subapp = tmp;
+ list_subapp = list_subapp->next;
}
+ g_list_free(appsvc->subapp);
+ list_subapp = NULL;
+ subapp = NULL;
}
+
FREE_AND_NULL(appsvc);
}
if (define == NULL)
return;
FREE_AND_NULL(define->path);
+ GList *tmp = NULL;
/*Free Request*/
if (define->request) {
- request_x *request = define->request;
- request_x *tmp = NULL;
- while(request != NULL) {
- tmp = request->next;
+ tmp = define->request;
+ request_x *request = NULL;
+ while(tmp != NULL) {
+ request = (request_x*)tmp->data;
__ps_free_request(request);
- request = tmp;
+ tmp = tmp->next;
}
+ g_list_free(define->request);
}
/*Free Allowed*/
if (define->allowed) {
- allowed_x *allowed = define->allowed;
- allowed_x *tmp = NULL;
- while(allowed != NULL) {
- tmp = allowed->next;
+ tmp = define->allowed;
+ allowed_x *allowed = NULL;
+ while(tmp != NULL) {
+ allowed = (allowed_x*)tmp->data;
__ps_free_allowed(allowed);
- allowed = tmp;
+ tmp = tmp->next;
}
+ g_list_free(define->allowed);
}
FREE_AND_NULL(define);
}
if (datashare == NULL)
return;
/*Free Define*/
+ GList *tmp = NULL;
if (datashare->define) {
- define_x *define = datashare->define;
- define_x *tmp = NULL;
- while(define != NULL) {
- tmp = define->next;
+ tmp = datashare->define;
+ define_x *define = NULL;
+ while(tmp != NULL) {
+ define = (define_x*)tmp->data;
__ps_free_define(define);
- define = tmp;
+ tmp = tmp->next;
}
+ g_list_free(datashare->define);
}
/*Free Request*/
if (datashare->request) {
- request_x *request = datashare->request;
- request_x *tmp = NULL;
- while(request != NULL) {
- tmp = request->next;
+ tmp = datashare->request;
+ request_x *request = NULL;
+ while(tmp != NULL) {
+ request = (request_x*)tmp->data;
__ps_free_request(request);
- request = tmp;
+ tmp = tmp->next;
}
+ g_list_free(datashare->request);
}
FREE_AND_NULL(datashare);
}
FREE_AND_NULL(license);
}
-static void __ps_free_uiapplication(uiapplication_x *uiapplication)
+void _pkgmgrinfo_basic_free_uiapplication_x(uiapplication_x *uiapplication)
{
if (uiapplication == NULL)
return;
+ GList *tmp = NULL;
FREE_AND_NULL(uiapplication->exec);
- FREE_AND_NULL(uiapplication->ambient_support);
FREE_AND_NULL(uiapplication->appid);
FREE_AND_NULL(uiapplication->nodisplay);
FREE_AND_NULL(uiapplication->multiple);
FREE_AND_NULL(uiapplication->support_disable);
FREE_AND_NULL(uiapplication->ui_gadget);
FREE_AND_NULL(uiapplication->removable);
+ FREE_AND_NULL(uiapplication->companion_type);
FREE_AND_NULL(uiapplication->support_mode);
FREE_AND_NULL(uiapplication->support_feature);
+ FREE_AND_NULL(uiapplication->support_category);
FREE_AND_NULL(uiapplication->satui_label);
FREE_AND_NULL(uiapplication->package_type);
FREE_AND_NULL(uiapplication->package_system);
FREE_AND_NULL(uiapplication->package_installed_time);
+ FREE_AND_NULL(uiapplication->launch_mode);
+ FREE_AND_NULL(uiapplication->alias_appid);
+ FREE_AND_NULL(uiapplication->effective_appid);
+ FREE_AND_NULL(uiapplication->api_version);
+#ifdef _APPFW_FEATURE_EXPANSION_PKG_INSTALL
+ FREE_AND_NULL(uiapplication->tep_name);
+#endif
+#ifdef _APPFW_FEATURE_MOUNT_INSTALL
+ FREE_AND_NULL(uiapplication->tpk_name);
+#endif
/*Free Label*/
if (uiapplication->label) {
- label_x *label = uiapplication->label;
- label_x *tmp = NULL;
- while(label != NULL) {
- tmp = label->next;
+ tmp = uiapplication->label;
+ while(tmp != NULL){
+ label_x *label = (label_x*)tmp->data;
__ps_free_label(label);
- label = tmp;
+ tmp = tmp->next;
}
+ g_list_free(uiapplication->label);
}
/*Free Icon*/
if (uiapplication->icon) {
- icon_x *icon = uiapplication->icon;
- icon_x *tmp = NULL;
- while(icon != NULL) {
- tmp = icon->next;
+ tmp = uiapplication->icon;
+ while(tmp != NULL){
+ icon_x* icon = (icon_x*)tmp->data;
__ps_free_icon(icon);
- icon = tmp;
+ tmp = tmp->next;
}
+ g_list_free(uiapplication->icon);
}
/*Free image*/
if (uiapplication->image) {
- image_x *image = uiapplication->image;
- image_x *tmp = NULL;
- while(image != NULL) {
- tmp = image->next;
+ tmp = uiapplication->image;
+ while(tmp != NULL){
+ image_x *image = (image_x*)tmp->data;
__ps_free_image(image);
- image = tmp;
+ tmp = tmp->next;
}
+ g_list_free(uiapplication->image);
}
/*Free LaunchConditions*/
if (uiapplication->launchconditions) {
- launchconditions_x *launchconditions = uiapplication->launchconditions;
- launchconditions_x *tmp = NULL;
- while(launchconditions != NULL) {
- tmp = launchconditions->next;
+ tmp = uiapplication->launchconditions;
+ while(tmp != NULL) {
+ launchconditions_x *launchconditions = (launchconditions_x*)tmp->data;
__ps_free_launchconditions(launchconditions);
- launchconditions = tmp;
+ tmp = tmp->next;
}
+ g_list_free(uiapplication->launchconditions);
}
/*Free Notification*/
if (uiapplication->notification) {
- notification_x *notification = uiapplication->notification;
- notification_x *tmp = NULL;
- while(notification != NULL) {
- tmp = notification->next;
+ tmp = uiapplication->notification;
+ notification_x *notification = NULL;
+ while(tmp != NULL) {
+ notification = (notification_x*)tmp->data;
__ps_free_notification(notification);
- notification = tmp;
+ tmp = tmp->next;
}
+ g_list_free(uiapplication->notification);
}
/*Free DataShare*/
if (uiapplication->datashare) {
- datashare_x *datashare = uiapplication->datashare;
- datashare_x *tmp = NULL;
- while(datashare != NULL) {
- tmp = datashare->next;
+ tmp = uiapplication->datashare;
+ datashare_x *datashare = NULL;
+ while(tmp != NULL) {
+ datashare = (datashare_x*)tmp->data;
__ps_free_datashare(datashare);
- datashare = tmp;
+ tmp = tmp->next;
}
+ g_list_free(uiapplication->datashare);
}
+
/*Free AppSvc*/
if (uiapplication->appsvc) {
- appsvc_x *appsvc = uiapplication->appsvc;
- appsvc_x *tmp = NULL;
- while(appsvc != NULL) {
- tmp = appsvc->next;
+ GList *list_asvc = uiapplication->appsvc;
+ appsvc_x *appsvc = NULL;
+ while(list_asvc != NULL) {
+ appsvc = (appsvc_x *)list_asvc->data;
__ps_free_appsvc(appsvc);
- appsvc = tmp;
+ list_asvc = list_asvc->next;
}
+ g_list_free(uiapplication->appsvc);
+ list_asvc = NULL;
+ appsvc = NULL;
}
+
/*Free Category*/
if (uiapplication->category) {
- category_x *category = uiapplication->category;
- category_x *tmp = NULL;
- while(category != NULL) {
- tmp = category->next;
+ tmp = uiapplication->category;
+ category_x *category = NULL;
+ while(tmp != NULL) {
+ category = (category_x*)tmp->data;
__ps_free_category(category);
- category = tmp;
+ tmp = tmp->next;
}
+ g_list_free(uiapplication->category);
}
/*Free Metadata*/
if (uiapplication->metadata) {
- metadata_x *metadata = uiapplication->metadata;
- metadata_x *tmp = NULL;
- while(metadata != NULL) {
- tmp = metadata->next;
+ GList *list_md = uiapplication->metadata;
+ metadata_x *metadata = NULL;
+ while(list_md != NULL) {
+ metadata = (metadata_x *)list_md->data;
__ps_free_metadata(metadata);
- metadata = tmp;
+ list_md = list_md->next;
}
+ g_list_free(uiapplication->metadata);
+ list_md = NULL;
+ metadata = NULL;
}
+
/*Free permission*/
if (uiapplication->permission) {
- permission_x *permission = uiapplication->permission;
- permission_x *tmp = NULL;
- while(permission != NULL) {
- tmp = permission->next;
+ tmp = uiapplication->permission;
+ permission_x *permission = NULL;
+ while(tmp != NULL) {
+ permission = (permission_x*)tmp->data;
__ps_free_permission(permission);
- permission = tmp;
+ tmp = tmp->next;
}
+ g_list_free(uiapplication->permission);
}
/*Free datacontrol*/
if (uiapplication->datacontrol) {
- datacontrol_x *datacontrol = uiapplication->datacontrol;
- datacontrol_x *tmp = NULL;
- while(datacontrol != NULL) {
- tmp = datacontrol->next;
+ tmp = uiapplication->datacontrol;
+ while(tmp != NULL) {
+ datacontrol_x *datacontrol = (datacontrol_x*)tmp->data;
__ps_free_datacontrol(datacontrol);
- datacontrol = tmp;
+ tmp = tmp->next;
}
+ g_list_free(uiapplication->datacontrol);
+ }
+
+ /*Free app background category*/
+ if (uiapplication->background_category) {
+ tmp = uiapplication->background_category;
+ char *category_tmp = NULL;
+ while (tmp != NULL) {
+ category_tmp = (char *)tmp->data;
+ if (category_tmp != NULL) {
+ free(category_tmp);
+ category_tmp = NULL;
+ }
+ tmp = g_list_next(tmp);
+ }
+ g_list_free(uiapplication->background_category);
+ }
+
+ /*Free app control*/
+ if (uiapplication->appcontrol) {
+ tmp = uiapplication->appcontrol;
+ while (tmp != NULL) {
+ appcontrol_x *appcontrol = (appcontrol_x *)tmp->data;
+ __ps_free_appcontrol(appcontrol);
+ tmp = tmp->next;
+ }
+ g_list_free(uiapplication->appcontrol);
}
/* _PRODUCT_LAUNCHING_ENHANCED_ START */
{
if (mfx == NULL)
return;
+ GList *tmp = NULL;
FREE_AND_NULL(mfx->ns);
FREE_AND_NULL(mfx->package);
FREE_AND_NULL(mfx->version);
+ FREE_AND_NULL(mfx->api_version);
FREE_AND_NULL(mfx->installlocation);
FREE_AND_NULL(mfx->preload);
FREE_AND_NULL(mfx->readonly);
FREE_AND_NULL(mfx->removable);
FREE_AND_NULL(mfx->update);
FREE_AND_NULL(mfx->system);
- FREE_AND_NULL(mfx->hash);
+ FREE_AND_NULL(mfx->backend_installer);
+ FREE_AND_NULL(mfx->custom_smack_label);
FREE_AND_NULL(mfx->type);
FREE_AND_NULL(mfx->package_size);
FREE_AND_NULL(mfx->package_total_size);
FREE_AND_NULL(mfx->mother_package);
FREE_AND_NULL(mfx->support_mode);
FREE_AND_NULL(mfx->groupid);
- FREE_AND_NULL(mfx->support_reset);
- FREE_AND_NULL(mfx->use_reset);
+#ifdef _APPFW_FEATURE_EXPANSION_PKG_INSTALL
+ FREE_AND_NULL(mfx->tep_name);
+#endif
/*Free Icon*/
if (mfx->icon) {
- icon_x *icon = mfx->icon;
- icon_x *tmp = NULL;
- while(icon != NULL) {
- tmp = icon->next;
+ tmp = mfx->icon;
+ while(tmp != NULL){
+ icon_x *icon = (icon_x*)tmp->data;
__ps_free_icon(icon);
- icon = tmp;
+ tmp = tmp->next;
}
+ g_list_free(mfx->icon);
}
/*Free Label*/
if (mfx->label) {
- label_x *label = mfx->label;
- label_x *tmp = NULL;
- while(label != NULL) {
- tmp = label->next;
+ tmp = mfx->label;
+ while(tmp != NULL){
+ label_x *label = (label_x*)tmp->data;
__ps_free_label(label);
- label = tmp;
+ tmp = tmp->next;
}
+ g_list_free(mfx->label);
}
/*Free Author*/
if (mfx->author) {
- author_x *author = mfx->author;
- author_x *tmp = NULL;
- while(author != NULL) {
- tmp = author->next;
+ tmp = mfx->author;
+ while(tmp != NULL){
+ author_x *author = (author_x*)tmp->data;
__ps_free_author(author);
- author = tmp;
+ tmp = tmp->next;
}
+ g_list_free(mfx->author);
}
/*Free Description*/
if (mfx->description) {
- description_x *description = mfx->description;
- description_x *tmp = NULL;
- while(description != NULL) {
- tmp = description->next;
+ tmp = mfx->description;
+ while(tmp != NULL){
+ description_x *description = (description_x*)tmp->data;
__ps_free_description(description);
- description = tmp;
+ tmp = tmp->next;
}
+ g_list_free(mfx->description);
}
/*Free License*/
if (mfx->license) {
- license_x *license = mfx->license;
- license_x *tmp = NULL;
- while(license != NULL) {
- tmp = license->next;
+ tmp = mfx->license;
+ while(tmp != NULL){
+ license_x *license = (license_x*)tmp->data;
__ps_free_license(license);
- license = tmp;
+ tmp = tmp->next;
}
+ g_list_free(mfx->license);
}
/*Free Privileges*/
if (mfx->privileges) {
- privileges_x *privileges = mfx->privileges;
- privileges_x *tmp = NULL;
- while(privileges != NULL) {
- tmp = privileges->next;
- __ps_free_privileges(privileges);
- privileges = tmp;
+ tmp = mfx->privileges;
+ while(tmp != NULL){
+ char* priv = (char*) tmp->data;
+ if(priv){
+ FREE_AND_NULL(priv);
+ }
+ tmp = tmp->next;
}
+ g_list_free(mfx->privileges);
}
+
/*Free UiApplication*/
if (mfx->uiapplication) {
- uiapplication_x *uiapplication = mfx->uiapplication;
- uiapplication_x *tmp = NULL;
- while(uiapplication != NULL) {
- tmp = uiapplication->next;
- __ps_free_uiapplication(uiapplication);
- uiapplication = tmp;
+ uiapplication_x *uiapplication = NULL;
+ GList *list_up = mfx->uiapplication;
+
+ while(list_up != NULL) {
+ uiapplication = (uiapplication_x *)list_up->data;
+ _pkgmgrinfo_basic_free_uiapplication_x(uiapplication);
+ list_up = list_up->next;
}
+ g_list_free(mfx->uiapplication);
+ list_up = NULL;
+ uiapplication = NULL;
}
+
/*Free Daemon*/
if (mfx->daemon) {
- daemon_x *daemon = mfx->daemon;
- daemon_x *tmp = NULL;
- while(daemon != NULL) {
- tmp = daemon->next;
+ tmp = mfx->daemon;
+ while(tmp != NULL){
+ daemon_x *daemon = (daemon_x*)tmp->data;
__ps_free_daemon(daemon);
- daemon = tmp;
+ tmp = tmp->next;
}
+ g_list_free(mfx->daemon);
}
/*Free Theme*/
if (mfx->theme) {
- theme_x *theme = mfx->theme;
- theme_x *tmp = NULL;
- while(theme != NULL) {
- tmp = theme->next;
+ tmp = mfx->theme;
+ while(tmp != NULL){
+ theme_x* theme = (theme_x*)tmp->data;
__ps_free_theme(theme);
- theme = tmp;
+ tmp = tmp->next;
}
+ g_list_free(mfx->theme);
}
/*Free Font*/
if (mfx->font) {
- font_x *font = mfx->font;
- font_x *tmp = NULL;
- while(font != NULL) {
- tmp = font->next;
+ tmp = mfx->font;
+ while(tmp != NULL){
+ font_x *font = (font_x*)tmp->data;
__ps_free_font(font);
- font = tmp;
+ tmp = tmp->next;
}
+ g_list_free(mfx->font);
}
/*Free Ime*/
if (mfx->ime) {
- ime_x *ime = mfx->ime;
- ime_x *tmp = NULL;
- while(ime != NULL) {
- tmp = ime->next;
+ tmp = mfx->ime;
+ while(tmp != NULL){
+ ime_x *ime = (ime_x*)tmp->data;
__ps_free_ime(ime);
- ime = tmp;
+ tmp = tmp->next;
}
+ g_list_free(mfx->ime);
}
/*Free Compatibility*/
if (mfx->compatibility) {
- compatibility_x *compatibility = mfx->compatibility;
- compatibility_x *tmp = NULL;
- while(compatibility != NULL) {
- tmp = compatibility->next;
- __ps_free_compatibility(compatibility);
- compatibility = tmp;
+ tmp = mfx->compatibility;
+ while(tmp != NULL){
+ compatibility_x *comp = (compatibility_x*)tmp->data;
+ __ps_free_compatibility(comp);
+ tmp = tmp->next;
}
+ g_list_free(mfx->compatibility);
}
/*Free DeviceProfile*/
if (mfx->deviceprofile) {
- deviceprofile_x *deviceprofile = mfx->deviceprofile;
- deviceprofile_x *tmp = NULL;
- while(deviceprofile != NULL) {
- tmp = deviceprofile->next;
- __ps_free_deviceprofile(deviceprofile);
- deviceprofile = tmp;
+ tmp = mfx->deviceprofile;
+ while(tmp != NULL){
+ deviceprofile_x* profile = (deviceprofile_x*)tmp->data;
+ __ps_free_deviceprofile(profile);
+ tmp = tmp->next;
}
+ g_list_free(mfx->deviceprofile);
}
FREE_AND_NULL(mfx);
return;
}
-API char* pkgmgrinfo_basic_generate_hash_for_file( const char *file)
-{
-
- unsigned char c[MD5_DIGEST_LENGTH] = {0};
- char *hash = NULL;
- char temp[3]={0};
- int index = 0;
- MD5_CTX mdContext;
- int bytes;
- unsigned char data[1024];
-
- FILE *inFile = fopen (file, "rb");
-
- if (inFile == NULL) {
- _LOGD("@Error while opening the file: %s",strerror(errno));
- return NULL;
- }
-
- MD5_Init (&mdContext);
-
- while ((bytes = fread (data, 1, 1024, inFile)) != 0)
- MD5_Update (&mdContext, data, bytes);
-
- MD5_Final (c,&mdContext);
-
- hash = (char*)malloc(HASH_LEN + 1);
- if(hash == NULL){
- _LOGE("Malloc failed!!");
- goto catch;
- }
- memset(hash,'\0',HASH_LEN + 1);
-
- for(index = 0; index < MD5_DIGEST_LENGTH; index++) {
- sprintf(temp,"%02x",c[index]);
- strncat(hash,temp,strlen(temp));
-
- }
-
-catch:
- if(inFile)
- fclose (inFile);
-
- return hash;
-}
int i = 0;
for(i = 0; i < ncols; i++)
{
- if (colname[i] == NULL)
- continue;
-
if (strcmp(colname[i], "package") == 0) {
- if (coltxt[i] && info->pkgid == NULL) {
+ if (coltxt[i] && info->pkgid == NULL)
info->pkgid = strdup(coltxt[i]);
- } else {
- if (info->pkgid)
- free(info->pkgid);
-
- info->pkgid = NULL;
- }
+ else
+ FREE_AND_NULL(info->pkgid);
} else if (strcmp(colname[i], "author_signer_cert") == 0) {
if (coltxt[i])
(info->cert_id)[PMINFO_AUTHOR_SIGNER_CERT] = atoi(coltxt[i]);
else
(info->cert_id)[PMINFO_DISTRIBUTOR2_ROOT_CERT] = 0;
} else if (strcmp(colname[i], "cert_info") == 0 ){
- if (coltxt[i] && info->cert_value == NULL) {
+ if (coltxt[i] && info->cert_value == NULL)
info->cert_value = strdup(coltxt[i]);
- } else {
- if (info->cert_value)
- free(info->cert_value);
-
- info->cert_value = NULL;
- }
+ else
+ FREE_AND_NULL(info->cert_value);
} else
continue;
}
unique_id[c++] = (certinfo->cert_id)[i];
else
continue;
- snprintf(query, MAX_QUERY_LEN, "select * from package_cert_index_info where cert_id=%d ", (certinfo->cert_id)[i]);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select * from package_cert_index_info where cert_id=%d ", (certinfo->cert_id)[i]);
ret = __exec_certindexinfo_query(query, (void *)indexinfo);
if (ret == -1) {
_LOGE("Cert Info DB Information retrieval failed\n");
memset(query, '\0', MAX_QUERY_LEN);
if (indexinfo->cert_ref_count > 1) {
/*decrease ref count*/
- snprintf(query, MAX_QUERY_LEN, "update package_cert_index_info set cert_ref_count=%d where cert_id=%d ",
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "update package_cert_index_info set cert_ref_count=%d where cert_id=%d ",
indexinfo->cert_ref_count - 1, (certinfo->cert_id)[i]);
} else {
/*delete this certificate as ref count is 1 and it will become 0*/
- snprintf(query, MAX_QUERY_LEN, "delete from package_cert_index_info where cert_id=%d ", (certinfo->cert_id)[i]);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "delete from package_cert_index_info where cert_id=%d ", (certinfo->cert_id)[i]);
}
if (SQLITE_OK !=
sqlite3_exec(cert_db, query, NULL, NULL, &error_message)) {
int i = 0;
/*Open db.*/
- ret = db_util_open_with_options(CERT_DB, &cert_db, SQLITE_OPEN_READONLY, NULL);
+ ret = _pminfo_db_open_with_options(CERT_DB, &cert_db, SQLITE_OPEN_READONLY);
if (ret != SQLITE_OK) {
_LOGE("connect db [%s] failed!\n", CERT_DB);
return PMINFO_R_ERROR;
certinfo = (pkgmgr_certinfo_x *)handle;
/*populate certinfo from DB*/
- snprintf(query, MAX_QUERY_LEN, "select * from package_cert_info where package='%s' ", pkgid);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select * from package_cert_info where package=%Q ", pkgid);
ret = __exec_certinfo_query(query, (void *)certinfo);
if (ret == -1) {
_LOGE("Package Cert Info DB Information retrieval failed\n");
for (i = 0; i < MAX_CERT_TYPE; i++) {
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select cert_info from package_cert_index_info where cert_id=%d ", (certinfo->cert_id)[i]);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select cert_info from package_cert_index_info where cert_id=%d ", (certinfo->cert_id)[i]);
ret = __exec_certinfo_query(query, (void *)certinfo);
if (ret == -1) {
_LOGE("Cert Info DB Information retrieval failed\n");
}
if (j < i)
continue;
- snprintf(query, MAX_QUERY_LEN, "select * from package_cert_index_info " \
- "where cert_info='%s'",(info->cert_info)[i]);
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select * from package_cert_index_info " \
+ "where cert_info=%Q",(info->cert_info)[i]);
ret = __exec_certindexinfo_query(query, (void *)indexinfo);
if (ret == -1) {
_LOGE("Cert Info DB Information retrieval failed\n");
if (indexinfo->cert_id == 0) {
/*New certificate. Get newid*/
memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select MAX(cert_id) from package_cert_index_info ");
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "select MAX(cert_id) from package_cert_index_info ");
if (SQLITE_OK !=
sqlite3_exec(cert_db, query, __maxid_cb, (void *)&newid, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
len+= strlen((info->cert_info)[i]);
}
vquery = (char *)calloc(1, len);
- if (vquery == NULL) {
- _LOGE("out of memory");
+ if (!vquery) {
+ _LOGE("malloc failed");
ret = PMINFO_R_ERROR;
goto err;
}
/*insert*/
- snprintf(vquery, len,
+ sqlite3_snprintf(len, vquery,
"insert into package_cert_info(package, author_root_cert, author_im_cert, author_signer_cert, dist_root_cert, " \
"dist_im_cert, dist_signer_cert, dist2_root_cert, dist2_im_cert, dist2_signer_cert) " \
- "values('%s', %d, %d, %d, %d, %d, %d, %d, %d, %d)",\
+ "values(%Q, %d, %d, %d, %d, %d, %d, %d, %d, %d)",\
info->pkgid,(info->cert_id)[PMINFO_SET_AUTHOR_ROOT_CERT],(info->cert_id)[PMINFO_SET_AUTHOR_INTERMEDIATE_CERT],
(info->cert_id)[PMINFO_SET_AUTHOR_SIGNER_CERT], (info->cert_id)[PMINFO_SET_DISTRIBUTOR_ROOT_CERT],
(info->cert_id)[PMINFO_SET_DISTRIBUTOR_INTERMEDIATE_CERT], (info->cert_id)[PMINFO_SET_DISTRIBUTOR_SIGNER_CERT],
if ((info->cert_info)[i]) {
memset(vquery, '\0', len);
if ((info->is_new)[i]) {
- snprintf(vquery, len, "insert into package_cert_index_info(cert_info, cert_id, cert_ref_count) " \
- "values('%s', '%d', '%d') ", (info->cert_info)[i], (info->cert_id)[i], 1);
+ sqlite3_snprintf(len, vquery, "insert into package_cert_index_info(cert_info, cert_id, cert_ref_count) " \
+ "values(%Q, '%d', '%d') ", (info->cert_info)[i], (info->cert_id)[i], 1);
unique_id[c++] = (info->cert_id)[i];
} else {
/*Update*/
unique_id[c++] = (info->cert_id)[i];
else
continue;
- snprintf(vquery, len, "update package_cert_index_info set cert_ref_count=%d " \
+ sqlite3_snprintf(len, vquery, "update package_cert_index_info set cert_ref_count=%d " \
"where cert_id=%d", (info->ref_count)[i] + 1, (info->cert_id)[i]);
}
if (SQLITE_OK !=
retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
int ret = -1;
/*Open db.*/
- ret = db_util_open_with_options(CERT_DB, &cert_db, SQLITE_OPEN_READWRITE, NULL);
+ ret = _pminfo_db_open_with_options(CERT_DB, &cert_db, SQLITE_OPEN_READWRITE);
if (ret != SQLITE_OK) {
_LOGE("connect db [%s] failed!\n", CERT_DB);
ret = PMINFO_R_ERROR;
return ret;
}
+API int pkgmgrinfo_client_listen_status_with_zone(pkgmgrinfo_client *pc, pkgmgrinfo_handler_zone event_cb, void *data)
+{
+ int ret = 0;
+ char *errmsg = NULL;
+ void *handle = NULL;
+ int (*__pkgmgr_client_listen_status_with_zone)(pkgmgrinfo_client *pc, pkgmgrinfo_handler_zone event_cb, void *data) = NULL;
+
+ handle = dlopen("libpkgmgr-client.so.0", RTLD_LAZY | RTLD_GLOBAL);
+ retvm_if(!handle, PMINFO_R_ERROR, "dlopen() failed. [%s]", dlerror());
+
+ __pkgmgr_client_listen_status_with_zone = dlsym(handle, "pkgmgr_client_listen_status_with_zone");
+ errmsg = dlerror();
+ tryvm_if((errmsg != NULL) || (__pkgmgr_client_listen_status_with_zone == NULL), ret = PMINFO_R_ERROR, "dlsym() failed. [%s]", errmsg);
+
+ ret = __pkgmgr_client_listen_status_with_zone(pc, event_cb, data);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgr_client_new failed.");
+
+catch:
+// dlclose(handle);
+ return ret;
+}
+
API int pkgmgrinfo_client_free(pkgmgrinfo_client *pc)
{
int ret = 0;
#include <db-util.h>
#include <dlfcn.h>
#include <dirent.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <vasum.h>
#include "pkgmgrinfo_private.h"
#include "pkgmgrinfo_debug.h"
#include "pkgmgr-info.h"
#endif
#define LOG_TAG "PKGMGR_DB"
-static int __ail_set_installed_storage(const char *pkgid, INSTALL_LOCATION location)
+#define OPT_USR_APPS __pkgmgrinfo_get_apps_path()
+
+#define _DEFAULT_MANIFEST_DB "/opt/dbspace/.pkgmgr_parser.db"
+#define _DEFAULT_CERT_DB "/opt/dbspace/.pkgmgr_cert.db"
+#define _DEFAULT_DATACONTROL_DB "/opt/usr/dbspace/.app-package.db"
+#define _DEFAULT_SD_PATH "/opt/storage/sdcard/app2sd/"
+#define _DEFAULT_OPT_USR_APPS "/opt/usr/apps"
+
+static char *_manifest_db = NULL;
+static char *_cert_db = NULL;
+static char *_data_control_db = NULL;
+static char *_sd_path = NULL;
+static char *_apps_path = NULL;
+static char *_cur_zone = NULL;
+
+static const char *__pkgmgrinfo_get_apps_path();
+
+const char *__pkgmgrinfo_get_default_manifest_db()
{
- retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "pkgid is NULL\n");
- int ret = -1;
- int exist = 0;
- sqlite3 *ail_db = NULL;
- char *AIL_DB_PATH = "/opt/dbspace/.app_info.db";
- char *query = NULL;
+ if (_manifest_db == NULL)
+ return _DEFAULT_MANIFEST_DB;
- ret = db_util_open(AIL_DB_PATH, &ail_db, 0);
- retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", AIL_DB_PATH);
+ return _manifest_db;
+}
- /*Begin transaction*/
- ret = sqlite3_exec(ail_db, "BEGIN EXCLUSIVE", NULL, NULL, NULL);
- tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Failed to begin transaction\n");
- _LOGD("Transaction Begin\n");
+const char *__pkgmgrinfo_get_default_cert_db()
+{
+ if (_cert_db == NULL)
+ return _DEFAULT_CERT_DB;
- /*validate pkgid*/
- query = sqlite3_mprintf("select exists(select * from app_info where x_slp_pkgid=%Q)", pkgid);
- ret = __exec_db_query(ail_db, query, _pkgmgrinfo_validate_cb, (void *)&exist);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "sqlite3_exec[%s] fail", pkgid);
- if (exist == 0) {
- _LOGS("pkgid[%s] not found in DB", pkgid);
- ret = PMINFO_R_ERROR;
- goto catch;
- }
- sqlite3_free(query);
+ return _cert_db;
+}
- query = sqlite3_mprintf("update app_info set x_slp_installedstorage=%Q where x_slp_pkgid=%Q", location?"installed_external":"installed_internal", pkgid);
+const char *__pkgmgrinfo_get_default_data_control_db()
+{
+ if (_data_control_db == NULL)
+ return _DEFAULT_DATACONTROL_DB;
- ret = sqlite3_exec(ail_db, query, NULL, NULL, NULL);
- tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Don't execute query = %s\n", query);
+ return _data_control_db;
+}
- /*Commit transaction*/
- ret = sqlite3_exec(ail_db, "COMMIT", NULL, NULL, NULL);
- if (ret != SQLITE_OK) {
- _LOGE("Failed to commit transaction. Rollback now\n");
- ret = sqlite3_exec(ail_db, "ROLLBACK", NULL, NULL, NULL);
- tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Don't execute query = %s\n", query);
+const char *__pkgmgrinfo_get_default_sd_path()
+{
+ if (_sd_path == NULL)
+ return _DEFAULT_SD_PATH;
+
+ return _sd_path;
+}
+
+static const char *__pkgmgrinfo_get_apps_path()
+{
+ if (_apps_path == NULL)
+ return _DEFAULT_OPT_USR_APPS;
+
+ return _apps_path;
+}
+
+API int pkgmgrinfo_pkginfo_set_zone(const char *zone, char *old_zone, int len)
+{
+ retvm_if(vsm_is_virtualized() != 0, PMINFO_R_EINVAL, "Not host side\n");
+ char db_path[PKG_STRING_LEN_MAX] = { '\0', };
+
+ if (old_zone != NULL && _cur_zone != NULL) {
+ old_zone[len - 1] = '\0';
+ strncpy(old_zone, _cur_zone, len - 1);
+ } else if(old_zone != NULL && _cur_zone == NULL)
+ old_zone[0] = '\0';
+
+ if (_cur_zone)
+ free(_cur_zone);
+
+ if (zone == NULL || zone[0] == '\0') {
+ if (_manifest_db != NULL)
+ free(_manifest_db);
+ _manifest_db = NULL;
+
+ if (_cert_db != NULL)
+ free(_cert_db);
+ _cert_db = NULL;
+
+ if (_data_control_db != NULL)
+ free(_data_control_db);
+ _data_control_db = NULL;
+
+ if (_sd_path != NULL)
+ free(_sd_path);
+ _sd_path = NULL;
+
+ if (_apps_path != NULL)
+ free(_apps_path);
+ _apps_path = NULL;
+ _cur_zone = NULL;
+ return PMINFO_R_OK;
}
- _LOGD("Transaction Commit and End\n");
- ret = PMINFO_R_OK;
-catch:
- sqlite3_close(ail_db);
- sqlite3_free(query);
- return ret;
+ _cur_zone = strdup(zone);
+ snprintf(db_path, PKG_STRING_LEN_MAX, "/var/lib/lxc/%s/rootfs%s",
+ zone, _DEFAULT_MANIFEST_DB);
+
+ if (_manifest_db != NULL)
+ free(_manifest_db);
+ _manifest_db = strdup(db_path);
+
+ snprintf(db_path, PKG_STRING_LEN_MAX, "/var/lib/lxc/%s/rootfs%s",
+ zone, _DEFAULT_CERT_DB);
+
+ if (_cert_db != NULL)
+ free(_cert_db);
+ _cert_db = strdup(db_path);
+
+ snprintf(db_path, PKG_STRING_LEN_MAX, "/var/lib/lxc/%s/rootfs%s",
+ zone, _DEFAULT_DATACONTROL_DB);
+
+ if (_data_control_db != NULL)
+ free(_data_control_db);
+ _data_control_db = strdup(db_path);
+
+ snprintf(db_path, PKG_STRING_LEN_MAX, "/var/lib/lxc/%s/rootfs%s",
+ zone, _DEFAULT_SD_PATH);
+
+ if (_sd_path != NULL)
+ free(_sd_path);
+ _sd_path = strdup(db_path);
+
+ snprintf(db_path, PKG_STRING_LEN_MAX, "/var/lib/lxc/%s/rootfs%s",
+ zone, _DEFAULT_OPT_USR_APPS);
+
+ if (_apps_path != NULL)
+ free(_apps_path);
+ _apps_path = strdup(db_path);
+
+ return PMINFO_R_OK;
}
API int pkgmgrinfo_pkginfo_set_state_enabled(const char *pkgid, bool enabled)
sqlite3 *pkginfo_db = NULL;
char *query = NULL;
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ ret = _pminfo_db_open_with_options(MANIFEST_DB, &pkginfo_db, SQLITE_OPEN_READWRITE);
retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
/*Begin transaction*/
sqlite3 *pkginfo_db = NULL;
char *query = NULL;
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ ret = _pminfo_db_open_with_options(MANIFEST_DB, &pkginfo_db, SQLITE_OPEN_READWRITE);
retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
/*Begin transaction*/
ret = sqlite3_exec(pkginfo_db, query, NULL, NULL, NULL);
tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "Don't execute query = %s\n", query);
- // Setting AIL DB
- ret = __ail_set_installed_storage(pkgid, location);
- tryvm_if(ret != PMINFO_R_OK, ret = PMINFO_R_ERROR, "Setting AIL DB failed.");
-
/*Commit transaction*/
ret = sqlite3_exec(pkginfo_db, "COMMIT", NULL, NULL, NULL);
if (ret != SQLITE_OK) {
sqlite3 *pkginfo_db = NULL;
char *query = NULL;
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ ret = _pminfo_db_open_with_options(MANIFEST_DB, &pkginfo_db, SQLITE_OPEN_READWRITE);
retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
/*Begin transaction*/
char *query = NULL;
/*open db*/
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ ret = _pminfo_db_open_with_options(MANIFEST_DB, &pkginfo_db, SQLITE_OPEN_READWRITE);
retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
/*Begin transaction*/
+++ /dev/null
-/*
- * pkgmgrinfo-feature
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Junsuk Oh <junsuk77.oh@samsung.com>,
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "pkgmgrinfo_private.h"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "PKGMGR_INFO"
-
-typedef int (*pkgmgr_handler)(int req_id, const char *pkg_type,
- const char *pkgid, const char *key,
- const char *val, const void *pmsg, void *data);
-
-typedef void pkgmgr_client;
-typedef void pkgmgr_info;
-
-typedef enum {
- PM_REQUEST_CSC = 0,
- PM_REQUEST_MOVE = 1,
- PM_REQUEST_GET_SIZE = 2,
- PM_REQUEST_KILL_APP = 3,
- PM_REQUEST_CHECK_APP = 4,
- PM_REQUEST_MAX
-}pkgmgr_request_service_type;
-
-typedef enum {
- PM_GET_TOTAL_SIZE= 0,
- PM_GET_DATA_SIZE = 1,
- PM_GET_ALL_PKGS = 2,
- PM_GET_SIZE_INFO = 3,
- PM_GET_TOTAL_AND_DATA = 4,
- PM_GET_SIZE_FILE = 5,
- PM_GET_MAX
-}pkgmgr_getsize_type;
-
-typedef enum {
- PC_REQUEST = 0,
- PC_LISTENING,
- PC_BROADCAST,
-}client_type;
-
-static int __pkg_list_cb(void *data, int ncols, char **coltxt, char **colname)
-{
- pkgmgr_pkginfo_x *udata = (pkgmgr_pkginfo_x *)data;
- int i = 0;
- pkgmgr_pkginfo_x *info = NULL;
- info = calloc(1, sizeof(pkgmgr_pkginfo_x));
- retvm_if(info == NULL, PMINFO_R_ERROR, "our of memory");
- info->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
- if (info->manifest_info == NULL) {
- _LOGE("out of memory");
- free(info);
- return PMINFO_R_ERROR;
- }
-
- LISTADD(udata, info);
- for(i = 0; i < ncols; i++)
- {
- if (strcmp(colname[i], "package") == 0) {
- if (coltxt[i])
- info->manifest_info->package = strdup(coltxt[i]);
- else
- info->manifest_info->package = NULL;
- } else
- continue;
- }
-
- return 0;
-}
-
-API int pkgmgrinfo_pkginfo_get_disabled_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle)
-{
- retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "pkgid is NULL\n");
- retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
- pkgmgr_pkginfo_x *pkginfo = NULL;
- int ret = PMINFO_R_OK;
- char *query = NULL;
- char *locale = NULL;
- label_x *tmp1 = NULL;
- icon_x *tmp2 = NULL;
- description_x *tmp3 = NULL;
- author_x *tmp4 = NULL;
- privilege_x *tmp5 = NULL;
- sqlite3 *pkginfo_db = NULL;
-
- /*validate pkgid*/
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
- retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
-
- /*get system locale*/
- locale = __convert_system_locale_to_manifest_locale();
- tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
-
- pkginfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
- tryvm_if(pkginfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for pkginfo");
-
- pkginfo->locale = strdup(locale);
-
- pkginfo->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
- tryvm_if(pkginfo->manifest_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for manifest info");
-
- pkginfo->manifest_info->package = strdup(pkgid);
- pkginfo->manifest_info->privileges = (privileges_x *)calloc(1, sizeof(privileges_x));
- tryvm_if(pkginfo->manifest_info->privileges == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for privileges info");
-
- /*populate manifest_info from DB*/
- query= sqlite3_mprintf("select * from disabled_package_info where package=%Q", pkgid);
- ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
- sqlite3_free(query);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
-
- query= sqlite3_mprintf("select * from disabled_package_localized_info where package=%Q and package_locale=%Q", pkgid, locale);
- ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
- sqlite3_free(query);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
-
- /*Also store the values corresponding to default locales*/
- query= sqlite3_mprintf("select * from disabled_package_localized_info where package=%Q and package_locale=%Q", pkgid, DEFAULT_LOCALE);
- ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
- sqlite3_free(query);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
-
- SAFE_LISTHEAD(pkginfo->manifest_info->label, tmp1);
- SAFE_LISTHEAD(pkginfo->manifest_info->icon, tmp2);
- SAFE_LISTHEAD(pkginfo->manifest_info->description, tmp3);
- SAFE_LISTHEAD(pkginfo->manifest_info->author, tmp4);
- SAFE_LISTHEAD(pkginfo->manifest_info->privileges->privilege, tmp5);
-
-catch:
- if (ret == PMINFO_R_OK)
- *handle = (void*)pkginfo;
- else {
- *handle = NULL;
- __cleanup_pkginfo(pkginfo);
- }
- sqlite3_close(pkginfo_db);
-
- if (locale) {
- free(locale);
- locale = NULL;
- }
- return ret;
-}
-
-API int pkgmgrinfo_pkginfo_get_disabled_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data)
-{
- retvm_if(pkg_list_cb == NULL, PMINFO_R_EINVAL, "callback function is NULL\n");
- int ret = PMINFO_R_OK;
- char query[MAX_QUERY_LEN] = {'\0'};
- char *locale = NULL;
- pkgmgr_pkginfo_x *pkginfo = NULL;
- label_x *tmp1 = NULL;
- icon_x *tmp2 = NULL;
- description_x *tmp3 = NULL;
- author_x *tmp4 = NULL;
- sqlite3 *pkginfo_db = NULL;
- pkgmgr_pkginfo_x *tmphead = NULL;
- pkgmgr_pkginfo_x *node = NULL;
- pkgmgr_pkginfo_x *temp_node = NULL;
-
- /*open db*/
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
- retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
-
- /*get system locale*/
- locale = __convert_system_locale_to_manifest_locale();
- tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
-
- tmphead = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
- if(tmphead == NULL){
- _LOGE("@calloc failed!!");
- FREE_AND_NULL(locale);
- return PMINFO_R_ERROR;
- }
-
- snprintf(query, MAX_QUERY_LEN, "select * from disabled_package_info");
- ret = __exec_db_query(pkginfo_db, query, __pkg_list_cb, (void *)tmphead);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
-
- LISTHEAD(tmphead, node);
-
- for(node = node->next; node ; node = node->next) {
- pkginfo = node;
- pkginfo->locale = strdup(locale);
- pkginfo->manifest_info->privileges = (privileges_x *)calloc(1, sizeof(privileges_x));
- tryvm_if(pkginfo->manifest_info->privileges == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for privileges info\n");
-
- /*populate manifest_info from DB*/
- snprintf(query, MAX_QUERY_LEN, "select * from disabled_package_info where package='%s' ", pkginfo->manifest_info->package);
- ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
-
- memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from disabled_package_localized_info where" \
- " package='%s' and package_locale='%s'", pkginfo->manifest_info->package, locale);
- ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
-
- /*Also store the values corresponding to default locales*/
- memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from disabled_package_localized_info where" \
- " package='%s' and package_locale='%s'", pkginfo->manifest_info->package, DEFAULT_LOCALE);
- ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
-
- SAFE_LISTHEAD(pkginfo->manifest_info->label, tmp1);
- SAFE_LISTHEAD(pkginfo->manifest_info->icon, tmp2);
- SAFE_LISTHEAD(pkginfo->manifest_info->description, tmp3);
- SAFE_LISTHEAD(pkginfo->manifest_info->author, tmp4);
- }
-
- LISTHEAD(tmphead, node);
-
- for(node = node->next; node ; node = node->next) {
- pkginfo = node;
-
- ret = pkg_list_cb( (void *)pkginfo, user_data);
- if(ret < 0)
- break;
- }
-
- ret = PMINFO_R_OK;
-
-catch:
- sqlite3_close(pkginfo_db);
- if (locale) {
- free(locale);
- locale = NULL;
- }
- if (tmphead) {
- LISTHEAD(tmphead, node);
- temp_node = node->next;
- node = temp_node;
- while (node) {
- temp_node = node->next;
- __cleanup_pkginfo(node);
- node = temp_node;
- }
- __cleanup_pkginfo(tmphead);
- }
- return ret;
-}
-
-API int pkgmgrinfo_appinfo_get_disabled_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
-{
- retvm_if(appid == NULL, PMINFO_R_EINVAL, "appid is NULL");
- retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-
- pkgmgr_appinfo_x *appinfo = NULL;
- char *locale = NULL;
- int ret = -1;
- int exist = 0;
- label_x *tmp1 = NULL;
- icon_x *tmp2 = NULL;
- category_x *tmp3 = NULL;
- metadata_x *tmp4 = NULL;
-
- char *query = NULL;
- sqlite3 *appinfo_db = NULL;
-
- /*open db*/
- ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
- retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
-
- /*check appid exist on db*/
- query = sqlite3_mprintf("select exists(select * from disabled_package_app_info where app_id=%Q)", appid);
- ret = __exec_db_query(appinfo_db, query, _pkgmgrinfo_validate_cb, (void *)&exist);
- sqlite3_free(query);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "sqlite3_exec fail");
- tryvm_if(exist == 0, ret = PMINFO_R_ERROR, "Appid[%s] not found in DB", appid);
-
- /*get system locale*/
- locale = __convert_system_locale_to_manifest_locale();
- tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
-
- /*calloc appinfo*/
- appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
- tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
-
- /*calloc app_component*/
- appinfo->uiapp_info = (uiapplication_x *)calloc(1, sizeof(uiapplication_x));
- tryvm_if(appinfo->uiapp_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for uiapp info");
-
- appinfo->locale = strdup(locale);
-
- /*populate app_info from DB*/
- query = sqlite3_mprintf("select * from disabled_package_app_info where app_id=%Q ", appid);
- ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
- sqlite3_free(query);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
-
- query = sqlite3_mprintf("select * from disabled_package_app_localized_info where app_id=%Q and app_locale=%Q", appid, locale);
- ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
- sqlite3_free(query);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
-
- /*Also store the values corresponding to default locales*/
- query = sqlite3_mprintf("select * from disabled_package_app_localized_info where app_id=%Q and app_locale=%Q", appid, DEFAULT_LOCALE);
- ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
- sqlite3_free(query);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
-
- /*Populate app category*/
- query = sqlite3_mprintf("select * from disabled_package_app_app_category where app_id=%Q", appid);
- ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
- sqlite3_free(query);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Category Info DB Information retrieval failed");
-
- /*Populate app metadata*/
- query = sqlite3_mprintf("select * from disabled_package_app_app_metadata where app_id=%Q", appid);
- ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
- sqlite3_free(query);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Metadata Info DB Information retrieval failed");
-
- SAFE_LISTHEAD(appinfo->uiapp_info->label, tmp1);
- SAFE_LISTHEAD(appinfo->uiapp_info->icon, tmp2);
- SAFE_LISTHEAD(appinfo->uiapp_info->category, tmp3);
- SAFE_LISTHEAD(appinfo->uiapp_info->metadata, tmp4);
-
- ret = PMINFO_R_OK;
-
-catch:
- if (ret == PMINFO_R_OK)
- *handle = (void*)appinfo;
- else {
- *handle = NULL;
- __cleanup_appinfo(appinfo);
- }
-
- sqlite3_close(appinfo_db);
- if (locale) {
- free(locale);
- locale = NULL;
- }
- return ret;
-}
-
-API int pkgmgrinfo_appinfo_get_disabled_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
- pkgmgrinfo_app_list_cb app_func, void *user_data)
-{
- retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
- retvm_if(app_func == NULL, PMINFO_R_EINVAL, "callback pointer is NULL");
- retvm_if((component != PMINFO_UI_APP) && (component != PMINFO_SVC_APP) && (component != PMINFO_ALL_APP), PMINFO_R_EINVAL, "Invalid App Component Type");
-
- char *locale = NULL;
- int ret = -1;
- char query[MAX_QUERY_LEN] = {'\0'};
- pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
- pkgmgr_pkginfo_x *allinfo = NULL;
- pkgmgr_appinfo_x *appinfo = NULL;
- icon_x *ptr1 = NULL;
- label_x *ptr2 = NULL;
- category_x *ptr3 = NULL;
- metadata_x *ptr4 = NULL;
- permission_x *ptr5 = NULL;
- image_x *ptr6 = NULL;
- sqlite3 *appinfo_db = NULL;
-
- /*check installed storage*/
- ret = __pkginfo_check_installed_storage(info);
- retvm_if(ret < 0, PMINFO_R_EINVAL, "[%s] is installed external, but is not in mmc", info->manifest_info->package);
-
- /*get system locale*/
- locale = __convert_system_locale_to_manifest_locale();
- tryvm_if(locale == NULL, ret = PMINFO_R_EINVAL, "manifest locale is NULL");
-
- /*calloc allinfo*/
- allinfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
- tryvm_if(allinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
-
- /*calloc manifest_info*/
- allinfo->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
- tryvm_if(allinfo->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
-
- /*calloc appinfo*/
- appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
- tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo");
-
- /*open db */
- ret = db_util_open(MANIFEST_DB, &appinfo_db, 0);
- tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
-
- snprintf(query, MAX_QUERY_LEN, "select DISTINCT * from disabled_package_app_info where package='%s'", info->manifest_info->package);
-
- /*Populate ui app info */
- ret = __exec_db_query(appinfo_db, query, __uiapp_list_cb, (void *)info);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info list retrieval failed");
-
- uiapplication_x *tmp = NULL;
- SAFE_LISTHEAD(info->manifest_info->uiapplication, tmp);
-
- /*Populate localized info for default locales and call callback*/
- /*If the callback func return < 0 we break and no more call back is called*/
- while(tmp != NULL)
- {
- if (locale)
- appinfo->locale = strdup(locale);
- appinfo->uiapp_info = tmp;
- if (strcmp(appinfo->uiapp_info->type,"c++app") == 0){
- if (locale) {
- free(locale);
- }
- locale = __get_app_locale_by_fallback(appinfo_db, appinfo->uiapp_info->appid);
- }
-
- memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from disabled_package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, locale);
- ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
-
- memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from disabled_package_app_localized_info where app_id='%s' and app_locale='%s'", appinfo->uiapp_info->appid, DEFAULT_LOCALE);
- ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Localized Info DB Information retrieval failed");
-
- /*Populate app category*/
- memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from disabled_package_app_app_category where app_id=='%s'", appinfo->uiapp_info->appid);
- ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Category Info DB Information retrieval failed");
-
- /*Populate app metadata*/
- memset(query, '\0', MAX_QUERY_LEN);
- snprintf(query, MAX_QUERY_LEN, "select * from disabled_package_app_app_metadata where app_id='%s'", appinfo->uiapp_info->appid);
- ret = __exec_db_query(appinfo_db, query, __appinfo_cb, (void *)appinfo);
- tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Metadata Info DB Information retrieval failed");
-
- SAFE_LISTHEAD(appinfo->uiapp_info->icon, ptr1);
- SAFE_LISTHEAD(appinfo->uiapp_info->label, ptr2);
- SAFE_LISTHEAD(appinfo->uiapp_info->category, ptr3);
- SAFE_LISTHEAD(appinfo->uiapp_info->metadata, ptr4);
- SAFE_LISTHEAD(appinfo->uiapp_info->permission, ptr5);
- SAFE_LISTHEAD(appinfo->uiapp_info->image, ptr6);
-
- ret = app_func((void *)appinfo, user_data);
- if (ret < 0)
- break;
- tmp = tmp->next;
- }
-
- ret = PMINFO_R_OK;
-catch:
- if (locale) {
- free(locale);
- locale = NULL;
- }
- if (appinfo) {
- free(appinfo);
- appinfo = NULL;
- }
- __cleanup_pkginfo(allinfo);
-
- sqlite3_close(appinfo_db);
- return ret;
-}
int cert_id;
} pkgmgr_cert_x;
+extern int strverscmp (const char *, const char *);
+
static void __destroy_each_node(gpointer data, gpointer user_data)
{
ret_if(data == NULL);
static void __get_pkginfo_from_db(char *colname, char *coltxt, manifest_x *manifest_info)
{
- if (colname == NULL || manifest_info == NULL)
- return;
+ GList *tmp = NULL;
+ label_x* lbl = NULL;
+ author_x* author = NULL;
+ description_x* description = NULL;
+ icon_x* icon = NULL;
+
+ if((tmp = g_list_last(manifest_info->label))) {
+ lbl = (label_x*) tmp->data;
+ if (lbl == NULL) {
+ _LOGE("lbl is NULL.");
+ return;
+ }
+ }
+
+ if((tmp = g_list_last(manifest_info->author))) {
+ author = (author_x*)tmp->data;
+ if (author == NULL) {
+ _LOGE("author is NULL.");
+ return;
+ }
+ }
+
+ if((tmp = g_list_last(manifest_info->description))) {
+ description = (description_x*)tmp->data;
+ if (description == NULL) {
+ _LOGE("description is NULL.");
+ return;
+ }
+ }
+
+ if((tmp = g_list_last(manifest_info->icon))) {
+ icon = (icon_x*)tmp->data;
+ if (icon == NULL) {
+ _LOGE("icon is NULL.");
+ return;
+ }
+ }
if (strcmp(colname, "package") == 0) {
if (manifest_info->package)
return;
+ manifest_info->package = strdup(coltxt);
- if (coltxt)
- manifest_info->package = strdup(coltxt);
} else if (strcmp(colname, "package_type") == 0) {
- if (coltxt)
- manifest_info->type = strdup(coltxt);
- else
- manifest_info->type = NULL;
+ manifest_info->type = strdup(coltxt);
+
} else if (strcmp(colname, "package_version") == 0) {
- if (coltxt)
- manifest_info->version = strdup(coltxt);
- else
- manifest_info->version = NULL;
+ manifest_info->version = strdup(coltxt);
+
+ } else if (strcmp(colname, "package_api_version") == 0) {
+ manifest_info->api_version = strdup(coltxt);
+
} else if (strcmp(colname, "install_location") == 0) {
- if (coltxt)
- manifest_info->installlocation = strdup(coltxt);
- else
- manifest_info->installlocation = NULL;
+ manifest_info->installlocation = strdup(coltxt);
+
} else if (strcmp(colname, "package_size") == 0) {
- if (coltxt)
- manifest_info->package_size = strdup(coltxt);
- else
- manifest_info->package_size = NULL;
+ manifest_info->package_size = strdup(coltxt);
+
} else if (strcmp(colname, "package_removable") == 0 ){
- if (coltxt)
- manifest_info->removable = strdup(coltxt);
- else
- manifest_info->removable = NULL;
+ manifest_info->removable = strdup(coltxt);
+
} else if (strcmp(colname, "package_preload") == 0 ){
- if (coltxt)
- manifest_info->preload = strdup(coltxt);
- else
- manifest_info->preload = NULL;
+ manifest_info->preload = strdup(coltxt);
+
} else if (strcmp(colname, "package_readonly") == 0 ){
- if (coltxt)
- manifest_info->readonly = strdup(coltxt);
- else
- manifest_info->readonly = NULL;
+ manifest_info->readonly = strdup(coltxt);
+
} else if (strcmp(colname, "package_update") == 0 ){
- if (coltxt)
- manifest_info->update= strdup(coltxt);
- else
- manifest_info->update = NULL;
+ manifest_info->update= strdup(coltxt);
+
} else if (strcmp(colname, "package_system") == 0 ){
- if (coltxt)
- manifest_info->system= strdup(coltxt);
- else
- manifest_info->system = NULL;
+ manifest_info->system= strdup(coltxt);
+
} else if (strcmp(colname, "package_appsetting") == 0 ){
- if (coltxt)
- manifest_info->appsetting = strdup(coltxt);
- else
- manifest_info->appsetting = NULL;
+ manifest_info->appsetting = strdup(coltxt);
+
} else if (strcmp(colname, "installed_time") == 0 ){
- if (coltxt)
- manifest_info->installed_time = strdup(coltxt);
- else
- manifest_info->installed_time = NULL;
+ manifest_info->installed_time = strdup(coltxt);
+
} else if (strcmp(colname, "installed_storage") == 0 ){
- if (coltxt)
- manifest_info->installed_storage = strdup(coltxt);
- else
- manifest_info->installed_storage = NULL;
+ manifest_info->installed_storage = strdup(coltxt);
+
} else if (strcmp(colname, "mainapp_id") == 0 ){
- if (coltxt)
- manifest_info->mainapp_id = strdup(coltxt);
- else
- manifest_info->mainapp_id = NULL;
+ manifest_info->mainapp_id = strdup(coltxt);
+
} else if (strcmp(colname, "storeclient_id") == 0 ){
- if (coltxt)
- manifest_info->storeclient_id = strdup(coltxt);
- else
- manifest_info->storeclient_id = NULL;
+ manifest_info->storeclient_id = strdup(coltxt);
+
} else if (strcmp(colname, "package_url") == 0 ){
- if (coltxt)
- manifest_info->package_url = strdup(coltxt);
- else
- manifest_info->package_url = NULL;
+ manifest_info->package_url = strdup(coltxt);
+
} else if (strcmp(colname, "root_path") == 0 ){
- if (coltxt)
- manifest_info->root_path = strdup(coltxt);
- else
- manifest_info->root_path = NULL;
+ manifest_info->root_path = strdup(coltxt);
+
} else if (strcmp(colname, "csc_path") == 0 ){
- if (coltxt)
- manifest_info->csc_path = strdup(coltxt);
- else
- manifest_info->csc_path = NULL;
+ manifest_info->csc_path = strdup(coltxt);
+
} else if (strcmp(colname, "package_support_disable") == 0 ){
- if (coltxt)
- manifest_info->support_disable = strdup(coltxt);
- else
- manifest_info->support_disable = NULL;
+ manifest_info->support_disable = strdup(coltxt);
+
} else if (strcmp(colname, "package_mother_package") == 0 ){
- if (coltxt)
- manifest_info->mother_package = strdup(coltxt);
- else
- manifest_info->mother_package = NULL;
+ manifest_info->mother_package = strdup(coltxt);
+
} else if (strcmp(colname, "package_support_mode") == 0 ){
- if (coltxt)
- manifest_info->support_mode = strdup(coltxt);
- else
- manifest_info->support_mode = NULL;
- } else if (strcmp(colname, "package_reserve1") == 0 ){
- if (coltxt)
- manifest_info->support_reset = strdup(coltxt);
- else
- manifest_info->support_reset = NULL;
- } else if (strcmp(colname, "package_reserve2") == 0 ){
- if (coltxt)
- manifest_info->use_reset = strdup(coltxt);
- else
- manifest_info->use_reset = NULL;
- } else if (strcmp(colname, "package_hash") == 0 ){
- if (coltxt)
- manifest_info->hash = strdup(coltxt);
- else
- manifest_info->hash = NULL;
- } else if (strcmp(colname, "package_reserve3") == 0 ){
- if (coltxt)
- manifest_info->groupid = strdup(coltxt);
- else
- manifest_info->groupid = NULL;
+ manifest_info->support_mode = strdup(coltxt);
+
+ } else if (strcmp(colname, "package_backend_installer") == 0 ){
+ manifest_info->backend_installer = strdup(coltxt);
+ } else if (strcmp(colname, "package_custom_smack_label") == 0 ){
+ manifest_info->custom_smack_label = strdup(coltxt);
+
+ } else if (strcmp(colname, "package_reserve3") == 0 ){
+ manifest_info->groupid = strdup(coltxt);
/*end package_info table*/
} else if (strcmp(colname, "author_email") == 0 ){
- if (coltxt)
- manifest_info->author->email = strdup(coltxt);
- else
- manifest_info->author->email = NULL;
+ if (author)
+ author->email = strdup(coltxt);
+
} else if (strcmp(colname, "author_href") == 0 ){
- if (coltxt)
- manifest_info->author->href = strdup(coltxt);
- else
- manifest_info->author->href = NULL;
+ if (author)
+ author->href = strdup(coltxt);
+
} else if (strcmp(colname, "package_label") == 0 ){
- if (coltxt)
- manifest_info->label->text = strdup(coltxt);
- else
- manifest_info->label->text = NULL;
+ if (lbl)
+ lbl->text = strdup(coltxt);
+
} else if (strcmp(colname, "package_icon") == 0 ){
- if (coltxt)
- manifest_info->icon->text = strdup(coltxt);
- else
- manifest_info->icon->text = NULL;
+ if (icon)
+ icon->text = strdup(coltxt);
+
} else if (strcmp(colname, "package_description") == 0 ){
- if (coltxt)
- manifest_info->description->text = strdup(coltxt);
- else
- manifest_info->description->text = NULL;
+ if (description)
+ description->text = strdup(coltxt);
+
} else if (strcmp(colname, "package_author") == 0 ){
- if (coltxt)
- manifest_info->author->text = strdup(coltxt);
- else
- manifest_info->author->text = NULL;
+ if (author)
+ author->text = strdup(coltxt);
+
} else if (strcmp(colname, "package_locale") == 0 ){
- if (coltxt) {
- manifest_info->author->lang = strdup(coltxt);
- manifest_info->icon->lang = strdup(coltxt);
- manifest_info->label->lang = strdup(coltxt);
- manifest_info->description->lang = strdup(coltxt);
- }
- else {
- manifest_info->author->lang = NULL;
- manifest_info->icon->lang = NULL;
- manifest_info->label->lang = NULL;
- manifest_info->description->lang = NULL;
- }
- /*end package_localized_info table*/
+ if (author)
+ author->lang = strdup(coltxt);
+ if (icon)
+ icon->lang = strdup(coltxt);
+ if (lbl)
+ lbl->lang = strdup(coltxt);
+ if (description)
+ description->lang = strdup(coltxt);
+ /*end package_localized_info table*/
} else if (strcmp(colname, "privilege") == 0 ){
- if (coltxt)
- manifest_info->privileges->privilege->text = strdup(coltxt);
- else
- manifest_info->privileges->privilege->text = NULL;
+ manifest_info->privileges = g_list_append(manifest_info->privileges,strdup(coltxt));
+
+#ifdef _APPFW_FEATURE_EXPANSION_PKG_INSTALL
+ } else if (strcmp(colname, "package_tep_name") == 0 ) {
+ manifest_info->tep_name = strdup(coltxt);
+#endif
}
/*end package_privilege_info table*/
}
-static void __get_pkginfo_for_list(sqlite3_stmt *stmt, pkgmgr_pkginfo_x *udata)
+static void __get_pkginfo_for_list(sqlite3_stmt *stmt, GList **udata)
{
int i = 0;
int ncols = 0;
char *colname = NULL;
char *coltxt = NULL;
pkgmgr_pkginfo_x *info = NULL;
+ icon_x* icon = NULL;
+ label_x *label = NULL;
+ author_x* author = NULL;
+ description_x *description = NULL;
info = calloc(1, sizeof(pkgmgr_pkginfo_x));
- if (info == NULL) {
- _LOGE("out of memory");
- return;
+ if (!info) {
+ _LOGE("malloc failed");
+ goto catch;
}
info->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
- if (info->manifest_info == NULL) {
- _LOGE("out of memory");
- free(info);
- return;
- }
-
- info->manifest_info->icon= (icon_x *)calloc(1, sizeof(icon_x));
- if (info->manifest_info->icon == NULL) {
- _LOGE("out of memory");
- free(info->manifest_info);
- free(info);
- return;
- }
-
- info->manifest_info->label= (label_x *)calloc(1, sizeof(label_x));
- if (info->manifest_info->label == NULL) {
- _LOGE("out of memory");
- free(info->manifest_info->icon);
- free(info->manifest_info);
- free(info);
- return;
- }
-
- info->manifest_info->author= (author_x *)calloc(1, sizeof(author_x));
- if (info->manifest_info->author == NULL) {
- _LOGE("out of memory");
- free(info->manifest_info->label);
- free(info->manifest_info->icon);
- free(info->manifest_info);
- free(info);
- return;
- }
-
- info->manifest_info->description= (description_x *)calloc(1, sizeof(description_x));
- if (info->manifest_info->description == NULL) {
- _LOGE("out of memory");
- free(info->manifest_info->author);
- free(info->manifest_info->label);
- free(info->manifest_info->icon);
- free(info->manifest_info);
- free(info);
- return;
+ if (!info->manifest_info) {
+ _LOGE("malloc failed");
+ goto catch;
}
ncols = sqlite3_column_count(stmt);
-
- LISTADD(udata, info);
+ *udata = g_list_append(*udata, info);
for(i = 0; i < ncols; i++)
{
colname = (char *)sqlite3_column_name(stmt, i);
coltxt = (char *)sqlite3_column_text(stmt, i);
+ if(!coltxt || !colname)
+ continue;
+
+ if((strcmp(colname, "package_label") == 0 || strcmp(colname, "package_locale") == 0 ) && label == NULL) {
+ label = calloc(1, sizeof(label_x));
+ trym_if(label == NULL, "Out of memory: label");
+ info->manifest_info->label = g_list_append(info->manifest_info->label, label);
+ }
+
+ if((strcmp(colname, "package_icon") == 0 || strcmp(colname, "package_locale") == 0 ) && icon == NULL) {
+ icon = calloc(1, sizeof(icon_x));
+ trym_if(icon == NULL, "Out of memory: icon");
+ info->manifest_info->icon = g_list_append(info->manifest_info->icon, icon);
+ }
+
+ if((strcmp(colname, "package_description") == 0 || strcmp(colname, "package_locale") == 0 ) && description == NULL) {
+ description = calloc(1, sizeof(description_x));
+ trym_if(description == NULL, "Out of memory: description");
+ info->manifest_info->description = g_list_append(info->manifest_info->description, description);
+ }
+
+ if((strcmp(colname, "package_author") == 0 || strcmp(colname, "author_email") == 0 || strcmp(colname, "author_href") == 0
+ || strcmp(colname, "package_locale") == 0 ) && author == NULL) {
+ author = calloc(1, sizeof(author_x));
+ trym_if(author == NULL, "Out of memory: author");
+ info->manifest_info->author = g_list_append(info->manifest_info->author, author);
+ }
+
// _LOGE("field value :: %s = %s \n", colname, coltxt);
__get_pkginfo_from_db(colname, coltxt, info->manifest_info);
}
+
+ return;
+
+catch:
+ //for exceptional cases
+ if (info)
+ FREE_AND_NULL(info->manifest_info);
+ FREE_AND_NULL(info);
+ FREE_AND_NULL(icon);
+ FREE_AND_NULL(label);
+ FREE_AND_NULL(author);
+ FREE_AND_NULL(description);
+ return;
}
-static void __update_localed_label_for_list(sqlite3_stmt *stmt, pkgmgr_pkginfo_x *list_pkginfo)
+static void __update_localed_label_for_list(sqlite3_stmt *stmt, pkgmgr_pkginfo_x *pkginfo)
{
int i = 0;
int ncols = 0;
char *colname = NULL;
char *coltxt = NULL;
- pkgmgr_pkginfo_x *node = NULL;
- pkgmgr_pkginfo_x *pkginfo = NULL;
-
- LISTHEAD(list_pkginfo, node);
- pkginfo = node->next;
+ label_x *label = NULL;
ncols = sqlite3_column_count(stmt);
for(i = 0; i < ncols; i++)
{
colname = (char *)sqlite3_column_name(stmt, i);
- if (colname && strcmp(colname, "package_label") == 0 ){
+ if (strcmp(colname, "package_label") == 0 ){
coltxt = (char *)sqlite3_column_text(stmt, i);
- FREE_AND_STRDUP(coltxt, pkginfo->manifest_info->label->text);
+ label = (label_x*)pkginfo->manifest_info->label->data;
+ FREE_AND_STRDUP(coltxt, label->text);
}
}
}
icon_x *icon = NULL;
label_x *label = NULL;
description_x *description = NULL;
- privilege_x *privilege = NULL;
-
- author = calloc(1, sizeof(author_x));
- retvm_if(author == NULL, PMINFO_R_ERROR, "out of memory");
- LISTADD(info->manifest_info->author, author);
- icon = calloc(1, sizeof(icon_x));
- retvm_if(icon == NULL, PMINFO_R_ERROR, "out of memory");
- LISTADD(info->manifest_info->icon, icon);
- label = calloc(1, sizeof(label_x));
- retvm_if(label == NULL, PMINFO_R_ERROR, "out of memory");
- LISTADD(info->manifest_info->label, label);
- description = calloc(1, sizeof(description_x));
- retvm_if(description == NULL, PMINFO_R_ERROR, "out of memory");
- LISTADD(info->manifest_info->description, description);
- privilege = calloc(1, sizeof(privilege_x));
- retvm_if(privilege == NULL, PMINFO_R_ERROR, "out of memory");
- LISTADD(info->manifest_info->privileges->privilege, privilege);
for(i = 0; i < ncols; i++)
{
+ if(!coltxt[i] || !colname[i])
+ continue;
+
+ if((strcmp(colname[i], "package_label") == 0 || strcmp(colname[i], "package_locale") == 0 ) && label == NULL) {
+ label = calloc(1, sizeof(label_x));
+ retvm_if(label == NULL, PMINFO_R_ERROR, "Out of memory: label");
+ info->manifest_info->label = g_list_append(info->manifest_info->label, label);
+ }
+
+ if((strcmp(colname[i], "package_icon") == 0 || strcmp(colname[i], "package_locale") == 0 ) && icon == NULL) {
+ icon = calloc(1, sizeof(icon_x));
+ retvm_if(icon == NULL, PMINFO_R_ERROR, "Out of memory: icon");
+ info->manifest_info->icon = g_list_append(info->manifest_info->icon, icon);
+ }
+
+ if((strcmp(colname[i], "package_description") == 0 || strcmp(colname[i], "package_locale") == 0 ) && description == NULL) {
+ description = calloc(1, sizeof(description_x));
+ retvm_if(description == NULL, PMINFO_R_ERROR, "Out of memory: description");
+ info->manifest_info->description = g_list_append(info->manifest_info->description, description);
+ }
+
+ if((strcmp(colname[i], "package_author") == 0 || strcmp(colname[i], "author_email") == 0 || strcmp(colname[i], "author_href") == 0
+ || strcmp(colname[i], "package_locale") == 0) && author == NULL) {
+ author = calloc(1, sizeof(author_x));
+ retvm_if(author == NULL, PMINFO_R_ERROR, "Out of memory: author");
+ info->manifest_info->author = g_list_append(info->manifest_info->author, author);
+ }
+
+ //_LOGE("field value :: %s = %s \n", colname[i], coltxt[i]);
__get_pkginfo_from_db(colname[i], coltxt[i], info->manifest_info);
}
+
return 0;
}
else
info->cert_id = 0;
} else if (strcmp(colname[i], "package") == 0) {
- if (coltxt[i] && info->pkgid == NULL) {
+ FREE_AND_NULL(info->pkgid);
+ if (coltxt[i])
info->pkgid= strdup(coltxt[i]);
- } else {
- if (info->pkgid)
- free(info->pkgid);
-
- info->pkgid = NULL;
- }
} else
continue;
}
sqlite3 *pkginfo_db = NULL;
sqlite3_stmt *stmt = NULL;
- pkgmgr_pkginfo_x *node = NULL;
pkgmgr_pkginfo_x *pkginfo = NULL;
- pkgmgr_pkginfo_x *list_pkginfo = NULL;
+ GList *list_pkginfo = NULL;
+ GList *node = NULL;
/*open db*/
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
- retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "db_util_open[%s] failed!", MANIFEST_DB);
+ ret = _pminfo_db_open(MANIFEST_DB, &pkginfo_db);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "_pminfo_db_open[%s] failed!", MANIFEST_DB);
- /*Start constructing query*/
locale = __convert_system_locale_to_manifest_locale();
- retvm_if(locale == NULL, PMINFO_R_ERROR, "locale is NULL");
+ retvm_if(locale == NULL, PMINFO_R_ERROR, "convert system locale to manifest locale fail");
+
query = sqlite3_mprintf("select * from package_info LEFT OUTER JOIN package_localized_info " \
"ON package_info.package=package_localized_info.package "\
"where package_info.package_disable='false' and package_localized_info.package_locale IN (%Q, %Q)", DEFAULT_LOCALE, locale);
ret = sqlite3_prepare_v2(pkginfo_db, query, strlen(query), &stmt, NULL);
tryvm_if(ret != PMINFO_R_OK, ret = PMINFO_R_ERROR, "sqlite3_prepare_v2 failed[%s]\n", query);
- /*calloc pkginfo_x*/
- list_pkginfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
- tryvm_if(list_pkginfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
+ /*step query*/
+ while(1) {
+ ret = sqlite3_step(stmt);
+ if(ret == SQLITE_ROW) {
+
+ memset(pkgid, 0, MAX_QUERY_LEN);
+ strncpy(pkgid, (const char *)sqlite3_column_text(stmt, 0), MAX_QUERY_LEN - 1);
+
+ if (strlen(pre_pkgid) != 0) {
+ if (strcmp(pre_pkgid, pkgid) == 0) {
+ node = g_list_last(list_pkginfo);
+ if (node)
+ __update_localed_label_for_list(stmt, (pkgmgr_pkginfo_x *)node->data);
+
+ memset(pre_pkgid, 0, MAX_QUERY_LEN);
+ strncpy(pre_pkgid, (const char *)sqlite3_column_text(stmt, 0), MAX_QUERY_LEN - 1);
+
+ continue;
+ } else {
+ memset(pre_pkgid, 0, MAX_QUERY_LEN);
+ strncpy(pre_pkgid, (const char *)sqlite3_column_text(stmt, 0), MAX_QUERY_LEN - 1);
+ }
+ } else {
+ strncpy(pre_pkgid, (const char *)sqlite3_column_text(stmt, 0), MAX_QUERY_LEN - 1);
+ }
+ __get_pkginfo_for_list(stmt, &list_pkginfo);
+ } else {
+ break;
+ }
+ }
+
+ for(node = list_pkginfo; node; node = node->next) {
+ pkginfo = (pkgmgr_pkginfo_x *)node->data;
+ pkginfo->locale = strdup(locale);
+
+ ret = __pkginfo_check_installed_storage(pkginfo);
+ if(ret < 0)
+ continue;
+
+ ret = pkg_list_cb( (void *)pkginfo, user_data);
+ if(ret < 0) {
+ _LOGE("callback is stopped.");
+ break;
+ }
+ }
+
+ ret = PMINFO_R_OK;
+
+catch:
+ sqlite3_free(query);
+ sqlite3_finalize(stmt);
+ sqlite3_close(pkginfo_db);
+ FREE_AND_NULL(locale);
+
+ __cleanup_list_pkginfo(&list_pkginfo);
+ node = NULL;
+
+ return ret;
+}
+
+API int pkgmgrinfo_pkginfo_get_disabled_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data)
+{
+ retvm_if(pkg_list_cb == NULL, PMINFO_R_EINVAL, "callback function is NULL\n");
+
+ int ret = PMINFO_R_OK;
+ char *locale = NULL;
+ char *query = NULL;
+
+ char pkgid[MAX_QUERY_LEN] = {0,};
+ char pre_pkgid[MAX_QUERY_LEN] = {0,};
+
+ sqlite3 *pkginfo_db = NULL;
+ sqlite3_stmt *stmt = NULL;
+
+ pkgmgr_pkginfo_x *pkginfo = NULL;
+ GList *node = NULL;
+ GList *list_pkginfo = NULL;
+
+ /*open db*/
+ ret = _pminfo_db_open(MANIFEST_DB, &pkginfo_db);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "_pminfo_db_open[%s] failed!", MANIFEST_DB);
+
+ locale = __convert_system_locale_to_manifest_locale();
+ retvm_if(locale == NULL, PMINFO_R_ERROR, "convert system locale to manifest locale fail");
+
+ /*Start constructing query*/
+ query = sqlite3_mprintf("select * from package_info LEFT OUTER JOIN package_localized_info " \
+ "ON package_info.package=package_localized_info.package " \
+ "where package_info.package_disable='true' and package_localized_info.package_locale IN (%Q, %Q)", DEFAULT_LOCALE, locale);
+
+ /*prepare query*/
+ ret = sqlite3_prepare_v2(pkginfo_db, query, strlen(query), &stmt, NULL);
+ tryvm_if(ret != PMINFO_R_OK, ret = PMINFO_R_ERROR, "sqlite3_prepare_v2 failed[%s]\n", query);
/*step query*/
while(1) {
if (strlen(pre_pkgid) != 0) {
if (strcmp(pre_pkgid, pkgid) == 0) {
- __update_localed_label_for_list(stmt, list_pkginfo);
+ node = g_list_last(list_pkginfo);
+ if (node)
+ __update_localed_label_for_list(stmt, (pkgmgr_pkginfo_x *)node->data);
memset(pre_pkgid, 0, MAX_QUERY_LEN);
strncpy(pre_pkgid, (const char *)sqlite3_column_text(stmt, 0), MAX_QUERY_LEN - 1);
strncpy(pre_pkgid, (const char *)sqlite3_column_text(stmt, 0), MAX_QUERY_LEN - 1);
}
- __get_pkginfo_for_list(stmt, list_pkginfo);
+ __get_pkginfo_for_list(stmt, &list_pkginfo);
} else {
break;
}
}
- LISTHEAD(list_pkginfo, node);
-
- for(node = node->next; node ; node = node->next) {
- pkginfo = node;
+ for(node = list_pkginfo; node ; node = node->next) {
+ pkginfo = (pkgmgr_pkginfo_x *)node->data;
pkginfo->locale = strdup(locale);
ret = __pkginfo_check_installed_storage(pkginfo);
continue;
ret = pkg_list_cb( (void *)pkginfo, user_data);
- if(ret < 0)
+ if(ret < 0) {
+ _LOGE("callback is stopped.");
break;
+ }
}
+ ret = PMINFO_R_OK;
+
catch:
sqlite3_free(query);
sqlite3_finalize(stmt);
sqlite3_close(pkginfo_db);
FREE_AND_NULL(locale);
- __cleanup_list_pkginfo(list_pkginfo, node);
+ __cleanup_list_pkginfo(&list_pkginfo);
+ node = NULL;
return ret;
}
sqlite3 *pkginfo_db = NULL;
sqlite3_stmt *stmt = NULL;
- pkgmgr_pkginfo_x *node = NULL;
+ GList *node = NULL;
pkgmgr_pkginfo_x *pkginfo = NULL;
- pkgmgr_pkginfo_x *list_pkginfo = NULL;
+ GList *list_pkginfo = NULL;
/*open db*/
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
- retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "db_util_open[%s] failed!", MANIFEST_DB);
+ ret = _pminfo_db_open(MANIFEST_DB, &pkginfo_db);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "_pminfo_db_open[%s] failed!", MANIFEST_DB);
- /*Start constructing query*/
locale = __convert_system_locale_to_manifest_locale();
- retvm_if(locale == NULL, PMINFO_R_ERROR, "locale is NULL");
+ retvm_if(locale == NULL, PMINFO_R_ERROR, "convert system locale to manifest locale fail");
+
query = sqlite3_mprintf("select * from package_info LEFT OUTER JOIN package_localized_info " \
"ON package_info.package=package_localized_info.package "\
"where installed_storage='installed_external' and package_info.package_disable='false' and package_localized_info.package_locale IN (%Q, %Q)", DEFAULT_LOCALE, locale);
ret = sqlite3_prepare_v2(pkginfo_db, query, strlen(query), &stmt, NULL);
tryvm_if(ret != PMINFO_R_OK, ret = PMINFO_R_ERROR, "sqlite3_prepare_v2 failed[%s]\n", query);
- /*calloc pkginfo_x*/
- list_pkginfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
- tryvm_if(list_pkginfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
-
/*step query*/
while(1) {
ret = sqlite3_step(stmt);
if (strlen(pre_pkgid) != 0) {
if (strcmp(pre_pkgid, pkgid) == 0) {
- __update_localed_label_for_list(stmt, list_pkginfo);
+ node = g_list_last(list_pkginfo);
+ if (node)
+ __update_localed_label_for_list(stmt, (pkgmgr_pkginfo_x *)node->data);
memset(pre_pkgid, 0, MAX_QUERY_LEN);
strncpy(pre_pkgid, (const char *)sqlite3_column_text(stmt, 0), MAX_QUERY_LEN - 1);
strncpy(pre_pkgid, (const char *)sqlite3_column_text(stmt, 0), MAX_QUERY_LEN - 1);
}
- __get_pkginfo_for_list(stmt, list_pkginfo);
+ __get_pkginfo_for_list(stmt, &list_pkginfo);
} else {
break;
}
}
- LISTHEAD(list_pkginfo, node);
-
- for(node = node->next; node ; node = node->next) {
- pkginfo = node;
+ for(node = list_pkginfo; node ; node = node->next) {
+ pkginfo = (pkgmgr_pkginfo_x *)node->data;
pkginfo->locale = strdup(locale);
ret = __pkginfo_check_installed_storage(pkginfo);
continue;
ret = pkg_list_cb( (void *)pkginfo, user_data);
- if(ret < 0)
+ if(ret < 0) {
+ _LOGE("callback is stopped.");
break;
+ }
}
+ ret = PMINFO_R_OK;
catch:
sqlite3_free(query);
sqlite3_close(pkginfo_db);
FREE_AND_NULL(locale);
- __cleanup_list_pkginfo(list_pkginfo, node);
+ __cleanup_list_pkginfo(&list_pkginfo);
+ node = NULL;
return ret;
}
sqlite3 *pkginfo_db = NULL;
sqlite3_stmt *stmt = NULL;
- pkgmgr_pkginfo_x *node = NULL;
+ GList *node = NULL;
pkgmgr_pkginfo_x *pkginfo = NULL;
- pkgmgr_pkginfo_x *list_pkginfo = NULL;
+ GList *list_pkginfo = NULL;
/*open db*/
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
- retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "db_util_open[%s] failed!", MANIFEST_DB);
+ ret = _pminfo_db_open(MANIFEST_DB, &pkginfo_db);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "_pminfo_db_open[%s] failed!", MANIFEST_DB);
- /*Start constructing query*/
locale = __convert_system_locale_to_manifest_locale();
- retvm_if(locale == NULL, PMINFO_R_ERROR, "locale is NULL");
+ retvm_if(locale == NULL, PMINFO_R_ERROR, "convert system locale to manifest locale fail");
+
query = sqlite3_mprintf("select * from package_info LEFT OUTER JOIN package_localized_info " \
"ON package_info.package=package_localized_info.package "\
"where installed_storage='installed_external' and package_info.package_disable='false' and package_localized_info.package_locale IN (%Q, %Q)", DEFAULT_LOCALE, locale);
ret = sqlite3_prepare_v2(pkginfo_db, query, strlen(query), &stmt, NULL);
tryvm_if(ret != PMINFO_R_OK, ret = PMINFO_R_ERROR, "sqlite3_prepare_v2 failed[%s]\n", query);
- /*calloc pkginfo_x*/
- list_pkginfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
- tryvm_if(list_pkginfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
-
/*step query*/
while(1) {
ret = sqlite3_step(stmt);
if (strlen(pre_pkgid) != 0) {
if (strcmp(pre_pkgid, pkgid) == 0) {
- __update_localed_label_for_list(stmt, list_pkginfo);
+ node = g_list_last(list_pkginfo);
+ if (node)
+ __update_localed_label_for_list(stmt, (pkgmgr_pkginfo_x *)node->data);
memset(pre_pkgid, 0, MAX_QUERY_LEN);
strncpy(pre_pkgid, (const char *)sqlite3_column_text(stmt, 0), MAX_QUERY_LEN - 1);
strncpy(pre_pkgid, (const char *)sqlite3_column_text(stmt, 0), MAX_QUERY_LEN - 1);
}
- __get_pkginfo_for_list(stmt, list_pkginfo);
+ __get_pkginfo_for_list(stmt, &list_pkginfo);
} else {
break;
}
}
- LISTHEAD(list_pkginfo, node);
-
- for(node = node->next; node ; node = node->next) {
- pkginfo = node;
+ for(node = list_pkginfo; node ; node = node->next) {
+ pkginfo = (pkgmgr_pkginfo_x *)node->data;
pkginfo->locale = strdup(locale);
ret = pkg_list_cb( (void *)pkginfo, user_data);
- if(ret < 0)
+ if(ret < 0) {
+ _LOGE("callback is stopped.");
break;
+ }
}
+ ret = PMINFO_R_OK;
catch:
sqlite3_free(query);
sqlite3_close(pkginfo_db);
FREE_AND_NULL(locale);
- __cleanup_list_pkginfo(list_pkginfo, node);
+ __cleanup_list_pkginfo(&list_pkginfo);
+ node = NULL;
return ret;
}
char *query = NULL;
char *locale = NULL;
int exist = 0;
- label_x *tmp1 = NULL;
- icon_x *tmp2 = NULL;
- description_x *tmp3 = NULL;
- author_x *tmp4 = NULL;
- privilege_x *tmp5 = NULL;
sqlite3 *pkginfo_db = NULL;
/*validate pkgid*/
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ ret = _pminfo_db_open(MANIFEST_DB, &pkginfo_db);
retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
/*check pkgid exist on db*/
tryvm_if(pkginfo->manifest_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for manifest info");
pkginfo->manifest_info->package = strdup(pkgid);
- pkginfo->manifest_info->privileges = (privileges_x *)calloc(1, sizeof(privileges_x));
- tryvm_if(pkginfo->manifest_info->privileges == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for privileges info");
/*populate manifest_info from DB*/
query= sqlite3_mprintf("select * from package_info where package=%Q and package_disable='false'", pkgid);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
- SAFE_LISTHEAD(pkginfo->manifest_info->label, tmp1);
- SAFE_LISTHEAD(pkginfo->manifest_info->icon, tmp2);
- SAFE_LISTHEAD(pkginfo->manifest_info->description, tmp3);
- SAFE_LISTHEAD(pkginfo->manifest_info->author, tmp4);
- SAFE_LISTHEAD(pkginfo->manifest_info->privileges->privilege, tmp5);
catch:
if (ret == PMINFO_R_OK)
char *query = NULL;
char *locale = NULL;
int exist = 0;
- label_x *tmp1 = NULL;
- icon_x *tmp2 = NULL;
- description_x *tmp3 = NULL;
- author_x *tmp4 = NULL;
- privilege_x *tmp5 = NULL;
sqlite3 *pkginfo_db = NULL;
/*validate pkgid*/
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ ret = _pminfo_db_open(MANIFEST_DB, &pkginfo_db);
retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
/*check pkgid exist on db*/
tryvm_if(pkginfo->manifest_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for manifest info");
pkginfo->manifest_info->package = strdup(pkgid);
- pkginfo->manifest_info->privileges = (privileges_x *)calloc(1, sizeof(privileges_x));
- tryvm_if(pkginfo->manifest_info->privileges == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for privileges info");
/*populate manifest_info from DB*/
query= sqlite3_mprintf("select * from package_info where package=%Q and package_disable='false'", pkgid);
sqlite3_free(query);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
- SAFE_LISTHEAD(pkginfo->manifest_info->label, tmp1);
- SAFE_LISTHEAD(pkginfo->manifest_info->icon, tmp2);
- SAFE_LISTHEAD(pkginfo->manifest_info->description, tmp3);
- SAFE_LISTHEAD(pkginfo->manifest_info->author, tmp4);
- SAFE_LISTHEAD(pkginfo->manifest_info->privileges->privilege, tmp5);
ret = __pkginfo_check_installed_storage(pkginfo);
tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "[%s] is installed external, but is not in mmc", pkgid);
return ret;
}
+API int pkgmgrinfo_pkginfo_get_disabled_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle)
+{
+ retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "pkgid is NULL\n");
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_pkginfo_x *pkginfo = NULL;
+ int ret = PMINFO_R_OK;
+ char *query = NULL;
+ char *locale = NULL;
+ int exist = 0;
+ sqlite3 *pkginfo_db = NULL;
+
+ /*validate pkgid*/
+ ret = _pminfo_db_open(MANIFEST_DB, &pkginfo_db);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
+
+ /*check pkgid exist on db*/
+ query= sqlite3_mprintf("select exists(select * from package_info where package=%Q and package_disable='true')", pkgid);
+ ret = __exec_db_query(pkginfo_db, query, _pkgmgrinfo_validate_cb, (void *)&exist);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "sqlite3_exec[%s] fail", pkgid);
+ if (exist == 0) {
+ _LOGS("pkgid[%s] not found in DB", pkgid);
+ ret = PMINFO_R_ERROR;
+ goto catch;
+ }
+
+ /*get system locale*/
+ locale = __convert_system_locale_to_manifest_locale();
+ tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL");
+
+ pkginfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
+ tryvm_if(pkginfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for pkginfo");
+
+ pkginfo->locale = strdup(locale);
+
+ pkginfo->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+ tryvm_if(pkginfo->manifest_info == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for manifest info");
+
+ pkginfo->manifest_info->package = strdup(pkgid);
+
+ /*populate manifest_info from DB*/
+ query= sqlite3_mprintf("select * from package_info where package=%Q and package_disable='true'", pkgid);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ /*populate privilege_info from DB*/
+ query= sqlite3_mprintf("select * from package_privilege_info where package=%Q ", pkgid);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Privilege Info DB Information retrieval failed");
+
+ query= sqlite3_mprintf("select * from package_localized_info where package=%Q and package_locale=%Q", pkgid, locale);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+ /*Also store the values corresponding to default locales*/
+ query= sqlite3_mprintf("select * from package_localized_info where package=%Q and package_locale=%Q", pkgid, DEFAULT_LOCALE);
+ ret = __exec_db_query(pkginfo_db, query, __pkginfo_cb, (void *)pkginfo);
+ sqlite3_free(query);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "Package Info DB Information retrieval failed");
+
+
+ ret = __pkginfo_check_installed_storage(pkginfo);
+ tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "[%s] is installed external, but is not in mmc", pkgid);
+
+catch:
+ if (ret == PMINFO_R_OK)
+ *handle = (void*)pkginfo;
+ else {
+ *handle = NULL;
+ __cleanup_pkginfo(pkginfo);
+ }
+ sqlite3_close(pkginfo_db);
+
+ FREE_AND_NULL(locale);
+ return ret;
+}
API int pkgmgrinfo_pkginfo_get_pkgname(pkgmgrinfo_pkginfo_h handle, char **pkg_name)
{
return PMINFO_R_OK;
}
+API int pkgmgrinfo_pkginfo_get_api_version(pkgmgrinfo_pkginfo_h handle, char **api_version)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(api_version == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ *api_version = (char *)info->manifest_info->api_version;
+ return PMINFO_R_OK;
+}
+
+#ifdef _APPFW_FEATURE_EXPANSION_PKG_INSTALL
+API int pkgmgrinfo_pkginfo_get_tep_name(pkgmgrinfo_pkginfo_h handle, char **tep_name)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
+ retvm_if(tep_name == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+ if (info->manifest_info && info->manifest_info->tep_name)
+ *tep_name = (char *)(info->manifest_info->tep_name);
+ else
+ return PMINFO_R_ERROR;
+
+ return PMINFO_R_OK;
+}
+#endif
+
+API int pkgmgrinfo_pkginfo_check_api_version(pkgmgrinfo_pkginfo_h handle, const char *api_version, int *result)
+{
+ retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+ retvm_if(api_version == NULL, PMINFO_R_EINVAL, "api_version is NULL\n");
+ retvm_if(result == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+ int ret;
+ char *pkg_api_version = NULL;
+
+ ret = pkgmgrinfo_pkginfo_get_api_version(handle, &pkg_api_version);
+ if (ret != PMINFO_R_OK) {
+ _LOGE("pkgmgrinfo_pkginfo_get_api_version is failed\n");
+ return PMINFO_R_ERROR;
+ }
+
+ if (pkg_api_version == NULL) {
+ _LOGE("pkg_api_version is null\n");
+ return PMINFO_R_ERROR;
+ }
+
+ ret = strverscmp(pkg_api_version, api_version);
+
+ *result = ret;
+
+ return PMINFO_R_OK;
+}
+
API int pkgmgrinfo_pkginfo_get_install_location(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_install_location *location)
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
- int ret = PMINFO_R_OK;
char *locale = NULL;
icon_x *ptr = NULL;
+ GList *start = NULL;
*icon = NULL;
pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
locale = info->locale;
retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
- for(ptr = info->manifest_info->icon; ptr != NULL; ptr = ptr->next)
+ for(start = info->manifest_info->icon; start != NULL; start = start->next)
{
- if (ptr->lang) {
+ ptr = (icon_x*)start->data;
+ if (ptr && ptr->lang) {
if (strcmp(ptr->lang, locale) == 0) {
if (ptr->text) {
*icon = (char *)ptr->text;
}
}
- return ret;
+ retvm_if(*icon == NULL, PMINFO_R_ERROR, "Failed to find icon");
+
+ return PMINFO_R_OK;
}
API int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label)
int ret = PMINFO_R_OK;
char *locale = NULL;
label_x *ptr = NULL;
+ GList *lbl_list = NULL;
*label = NULL;
pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
locale = info->locale;
retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
- for(ptr = info->manifest_info->label; ptr != NULL; ptr = ptr->next)
+ for(lbl_list = info->manifest_info->label; lbl_list != NULL; lbl_list = lbl_list->next)
{
+ ptr = (label_x*)lbl_list->data;
if (ptr->lang) {
if (strcmp(ptr->lang, locale) == 0) {
if (ptr->text) {
retvm_if(description == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
char *locale = NULL;
description_x *ptr = NULL;
+ GList *desc_list = NULL;
*description = NULL;
pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
locale = info->locale;
retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
- for(ptr = info->manifest_info->description; ptr != NULL; ptr = ptr->next)
+ for(desc_list = info->manifest_info->description; desc_list != NULL; desc_list = desc_list->next)
{
- if (ptr->lang) {
- if (strcmp(ptr->lang, locale) == 0) {
- *description = (char *)ptr->text;
- if (strcasecmp(*description, PKGMGR_PARSER_EMPTY_STR) == 0) {
- locale = DEFAULT_LOCALE;
- continue;
- } else
+ ptr = (description_x*)desc_list->data;
+ if(ptr){
+ if (ptr->lang) {
+ if (strcmp(ptr->lang, locale) == 0) {
+ *description = (char *)ptr->text;
+ if (strcasecmp(*description, PKGMGR_PARSER_EMPTY_STR) == 0) {
+ locale = DEFAULT_LOCALE;
+ continue;
+ } else
+ break;
+ } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
+ *description = (char *)ptr->text;
break;
- } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
- *description = (char *)ptr->text;
- break;
+ }
}
}
}
char *locale = NULL;
author_x *ptr = NULL;
*author_name = NULL;
+ GList *ath_list = NULL;
pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
locale = info->locale;
retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
- for(ptr = info->manifest_info->author; ptr != NULL; ptr = ptr->next)
+ for(ath_list = info->manifest_info->author; ath_list != NULL; ath_list = ath_list->next)
{
+ ptr = (author_x*)ath_list->data;
if (ptr->lang) {
if (strcmp(ptr->lang, locale) == 0) {
*author_name = (char *)ptr->text;
retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
retvm_if(author_email == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
- *author_email = (char *)info->manifest_info->author->email;
+ author_x* author = (author_x*)info->manifest_info->author->data;
+ *author_email = (char *)author->email;
return PMINFO_R_OK;
}
retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
retvm_if(author_href == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
- *author_href = (char *)info->manifest_info->author->href;
+ author_x* author = (author_x*)info->manifest_info->author->data;
+ *author_href = (char *)author->href;
return PMINFO_R_OK;
}
return PMINFO_R_OK;
}
-API int pkgmgrinfo_pkginfo_get_hash(pkgmgrinfo_pkginfo_h handle, char **hash)
+API int pkgmgrinfo_pkginfo_get_groupid(pkgmgrinfo_pkginfo_h handle, char **groupid)
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
- retvm_if(hash == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+ retvm_if(groupid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
- if (info->manifest_info->hash)
- *hash = (char *)info->manifest_info->hash;
+ if (info->manifest_info->groupid)
+ *groupid = (char *)info->manifest_info->groupid;
else
- *hash = NULL;
+ return PMINFO_R_ERROR;
return PMINFO_R_OK;
-
}
-API int pkgmgrinfo_pkginfo_get_groupid(pkgmgrinfo_pkginfo_h handle, char **groupid)
+API int pkgmgrinfo_pkginfo_get_backend_installer(pkgmgrinfo_pkginfo_h handle, char **backend_installer)
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
- retvm_if(groupid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
-
+ retvm_if(backend_installer == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
- if (info->manifest_info->groupid)
- *groupid = (char *)info->manifest_info->groupid;
+ if (info->manifest_info->backend_installer)
+ *backend_installer = (char *)info->manifest_info->backend_installer;
else
return PMINFO_R_ERROR;
return PMINFO_R_OK;
}
-API int pkgmgrinfo_pkginfo_get_support_reset(pkgmgrinfo_pkginfo_h handle, char **support_reset)
+API int pkgmgrinfo_pkginfo_get_custom_smack_label(pkgmgrinfo_pkginfo_h handle, char **smack_label)
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
- retvm_if(support_reset == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
-
+ retvm_if(smack_label == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
- if (info->manifest_info->support_reset)
- *support_reset = (char *)info->manifest_info->support_reset;
- else
- return PMINFO_R_ERROR;
-
+ *smack_label = (char *)info->manifest_info->custom_smack_label;
return PMINFO_R_OK;
}
retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
retvm_if(privilege_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
int ret = -1;
- privilege_x *ptr = NULL;
+ GList *list = NULL;
+ char *ptr = NULL;
pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
- ptr = info->manifest_info->privileges->privilege;
- for (; ptr; ptr = ptr->next) {
- if (ptr->text){
- ret = privilege_func(ptr->text, user_data);
+ list = info->manifest_info->privileges;
+ for (; list; list = list->next) {
+ ptr = (char*)list->data;
+ if (ptr){
+ ret = privilege_func(ptr, user_data);
if (ret < 0)
break;
}
info = (pkgmgr_cert_x *)calloc(1, sizeof(pkgmgr_cert_x));
retvm_if(info == NULL, PMINFO_R_ERROR, "Out of Memory!!!");
- ret = db_util_open_with_options(CERT_DB, &pkgmgr_cert_db, SQLITE_OPEN_READONLY, NULL);
+ ret = _pminfo_db_open_with_options(CERT_DB, &pkgmgr_cert_db, SQLITE_OPEN_READONLY);
if (ret != SQLITE_OK) {
_LOGE("connect db [%s] failed!\n", CERT_DB);
ret = PMINFO_R_ERROR;
info = (pkgmgr_cert_x *)calloc(1, sizeof(pkgmgr_cert_x));
retvm_if(info == NULL, PMINFO_R_ERROR, "Out of Memory!!!");
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
+ ret = _pminfo_db_open(MANIFEST_DB, &pkginfo_db);
tryvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
- query = sqlite3_mprintf("select exists(select * from package_app_info where app_id=%Q and app_disable='false')", lhs_app_id);
+ query = sqlite3_mprintf("select exists(select * from package_app_info where app_id=%Q)", lhs_app_id);
if (SQLITE_OK !=
sqlite3_exec(pkginfo_db, query, _pkgmgrinfo_validate_cb, (void *)&exist, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
lpkgid = NULL;
} else {
sqlite3_free(query);
- query = sqlite3_mprintf("select package from package_app_info where app_id=%Q and app_disable='false'", lhs_app_id);
+ query = sqlite3_mprintf("select package from package_app_info where app_id=%Q", lhs_app_id);
if (SQLITE_OK !=
sqlite3_exec(pkginfo_db, query, __cert_cb, (void *)info, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
}
sqlite3_free(query);
- query = sqlite3_mprintf("select exists(select * from package_app_info where app_id=%Q and app_disable='false')", rhs_app_id);
+ query = sqlite3_mprintf("select exists(select * from package_app_info where app_id=%Q)", rhs_app_id);
if (SQLITE_OK !=
sqlite3_exec(pkginfo_db, query, _pkgmgrinfo_validate_cb, (void *)&exist, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
rpkgid = NULL;
} else {
sqlite3_free(query);
- query = sqlite3_mprintf("select package from package_app_info where app_id=%Q and app_disable='false'", rhs_app_id);
+ query = sqlite3_mprintf("select package from package_app_info where app_id=%Q", rhs_app_id);
if (SQLITE_OK !=
sqlite3_exec(pkginfo_db, query, __cert_cb, (void *)info, &error_message)) {
_LOGE("Don't execute query = %s error message = %s\n", query,
/*If API is called multiple times for same property, we should override the previous values.
Last value set will be used for filtering.*/
link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
- if (link)
+ if (link) {
+ _pminfo_destroy_node((gpointer)link->data);
filter->list = g_slist_delete_link(filter->list, link);
+ }
filter->list = g_slist_append(filter->list, (gpointer)node);
return PMINFO_R_OK;
/*If API is called multiple times for same property, we should override the previous values.
Last value set will be used for filtering.*/
link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
- if (link)
+ if (link) {
+ _pminfo_destroy_node((gpointer)link->data);
filter->list = g_slist_delete_link(filter->list, link);
+ }
filter->list = g_slist_append(filter->list, (gpointer)node);
return PMINFO_R_OK;
/*If API is called multiple times for same property, we should override the previous values.
Last value set will be used for filtering.*/
link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
- if (link)
+ if (link) {
+ _pminfo_destroy_node((gpointer)link->data);
filter->list = g_slist_delete_link(filter->list, link);
+ }
filter->list = g_slist_append(filter->list, (gpointer)node);
return PMINFO_R_OK;
char where[MAX_QUERY_LEN] = {'\0'};
GSList *list;
- pkgmgr_pkginfo_x *node = NULL;
pkgmgr_pkginfo_x *pkginfo = NULL;
- pkgmgr_pkginfo_x *list_pkginfo = NULL;
pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ GList *node = NULL;
+ GList *list_pkginfo = NULL;
+
sqlite3 *pkginfo_db = NULL;
sqlite3_stmt *stmt = NULL;
/*open db*/
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
- retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "db_util_open[%s] failed!", MANIFEST_DB);
+ ret = _pminfo_db_open(MANIFEST_DB, &pkginfo_db);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "_pminfo_db_open[%s] failed!", MANIFEST_DB);
/*Start constructing query*/
locale = __convert_system_locale_to_manifest_locale();
- snprintf(query, MAX_QUERY_LEN - 1, FILTER_QUERY_LIST_PACKAGE, DEFAULT_LOCALE, locale);
+ sqlite3_snprintf(MAX_QUERY_LEN - 1, query, FILTER_QUERY_LIST_PACKAGE, DEFAULT_LOCALE, locale);
/*Get where clause*/
for (list = filter->list; list; list = g_slist_next(list)) {
}
_LOGE("query = %s\n", query);
- list_pkginfo = calloc(1, sizeof(pkgmgr_pkginfo_x));
- tryvm_if(list_pkginfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
-
ret = sqlite3_prepare_v2(pkginfo_db, query, strlen(query), &stmt, NULL);
tryvm_if(ret != PMINFO_R_OK, ret = PMINFO_R_ERROR, "sqlite3_prepare_v2 failed[%s]\n", query);
if (strlen(pre_pkgid) != 0) {
if (strcmp(pre_pkgid, pkgid) == 0) {
- __update_localed_label_for_list(stmt, list_pkginfo);
+ node = g_list_last(list_pkginfo);
+ if (node)
+ __update_localed_label_for_list(stmt, (pkgmgr_pkginfo_x *)node->data);
memset(pre_pkgid, 0, MAX_QUERY_LEN);
strncpy(pre_pkgid, (const char *)sqlite3_column_text(stmt, 0), MAX_QUERY_LEN - 1);
strncpy(pre_pkgid, (const char *)sqlite3_column_text(stmt, 0), MAX_QUERY_LEN - 1);
}
- __get_pkginfo_for_list(stmt, list_pkginfo);
+ __get_pkginfo_for_list(stmt, &list_pkginfo);
} else {
break;
}
}
- LISTHEAD(list_pkginfo, node);
-
- for(node = node->next ; node ; node = node->next) {
- pkginfo = node;
+ for(node = list_pkginfo; node ; node = node->next) {
+ pkginfo = (pkgmgr_pkginfo_x *)node->data;
ret = __pkginfo_check_installed_storage(pkginfo);
if(ret < 0)
continue;
sqlite3_finalize(stmt);
sqlite3_close(pkginfo_db);
- __cleanup_list_pkginfo(list_pkginfo, node);
+ __cleanup_list_pkginfo(&list_pkginfo);
+ node = NULL;
return ret;
}
char pkgid[MAX_QUERY_LEN] = {0,};
char pre_pkgid[MAX_QUERY_LEN] = {0,};
- pkgmgr_pkginfo_x *node = NULL;
pkgmgr_pkginfo_x *pkginfo = NULL;
- pkgmgr_pkginfo_x *list_pkginfo = NULL;
pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
+ GList *node = NULL;
+ GList *list_pkginfo = NULL;
+
sqlite3 *pkginfo_db = NULL;
sqlite3_stmt *stmt = NULL;
/*open db*/
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
- retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "db_util_open[%s] failed!", MANIFEST_DB);
+ ret = _pminfo_db_open(MANIFEST_DB, &pkginfo_db);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "_pminfo_db_open[%s] failed!", MANIFEST_DB);
/*Start constructing query*/
locale = __convert_system_locale_to_manifest_locale();
- retvm_if(locale == NULL, PMINFO_R_ERROR, "locale is NULL");
- snprintf(query, MAX_QUERY_LEN - 1, FILTER_QUERY_LIST_PACKAGE, DEFAULT_LOCALE, locale);
+ retvm_if(locale == NULL, PMINFO_R_ERROR, "convert system locale to manifest locale fail");
+
+ sqlite3_snprintf(MAX_QUERY_LEN - 1, query, FILTER_QUERY_LIST_PACKAGE, DEFAULT_LOCALE, locale);
/*Get where clause*/
for (list = filter->list; list; list = g_slist_next(list)) {
}
_LOGE("query = %s\n", query);
- list_pkginfo = calloc(1, sizeof(pkgmgr_pkginfo_x));
- tryvm_if(list_pkginfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
-
ret = sqlite3_prepare_v2(pkginfo_db, query, strlen(query), &stmt, NULL);
tryvm_if(ret != PMINFO_R_OK, ret = PMINFO_R_ERROR, "sqlite3_prepare_v2 failed[%s]\n", query);
if (strlen(pre_pkgid) != 0) {
if (strcmp(pre_pkgid, pkgid) == 0) {
- __update_localed_label_for_list(stmt, list_pkginfo);
+ node = g_list_last(list_pkginfo);
+ if (node)
+ __update_localed_label_for_list(stmt, (pkgmgr_pkginfo_x *)node->data);
memset(pre_pkgid, 0, MAX_QUERY_LEN);
strncpy(pre_pkgid, (const char *)sqlite3_column_text(stmt, 0), MAX_QUERY_LEN - 1);
strncpy(pre_pkgid, (const char *)sqlite3_column_text(stmt, 0), MAX_QUERY_LEN - 1);
}
- __get_pkginfo_for_list(stmt, list_pkginfo);
+ __get_pkginfo_for_list(stmt, &list_pkginfo);
} else {
break;
}
}
- LISTHEAD(list_pkginfo, node);
-
- for(node = node->next ; node ; node = node->next) {
- pkginfo = node;
+ for(node = list_pkginfo ; node ; node = node->next) {
+ pkginfo = (pkgmgr_pkginfo_x *)node->data;
pkginfo->locale = strdup(locale);
ret = __pkginfo_check_installed_storage(pkginfo);
continue;
ret = pkg_cb( (void *)pkginfo, user_data);
- if(ret < 0)
+ if(ret < 0) {
+ _LOGE("callback is stopped.");
break;
+ }
}
ret = PMINFO_R_OK;
FREE_AND_NULL(locale);
sqlite3_finalize(stmt);
sqlite3_close(pkginfo_db);
- __cleanup_list_pkginfo(list_pkginfo, node);
+
+ __cleanup_list_pkginfo(&list_pkginfo);
+ node = NULL;
return ret;
}
sqlite3 *pkginfo_db = NULL;
sqlite3_stmt *stmt = NULL;
- pkgmgr_pkginfo_x *node = NULL;
pkgmgr_pkginfo_x *pkginfo = NULL;
- pkgmgr_pkginfo_x *list_pkginfo = NULL;
+
+ GList *node = NULL;
+ GList *list_pkginfo = NULL;
/*open db*/
- ret = db_util_open(MANIFEST_DB, &pkginfo_db, 0);
- retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "db_util_open[%s] failed!", MANIFEST_DB);
+ ret = _pminfo_db_open(MANIFEST_DB, &pkginfo_db);
+ retvm_if(ret != SQLITE_OK, PMINFO_R_ERROR, "_pminfo_db_open[%s] failed!", MANIFEST_DB);
/*Start constructing query*/
query = sqlite3_mprintf("select package_info.* from package_info LEFT OUTER JOIN package_privilege_info " \
ret = sqlite3_prepare_v2(pkginfo_db, query, strlen(query), &stmt, NULL);
tryvm_if(ret != PMINFO_R_OK, ret = PMINFO_R_ERROR, "sqlite3_prepare_v2 failed[%s]\n", query);
- /*calloc pkginfo_x*/
- list_pkginfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x));
- tryvm_if(list_pkginfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!\n");
-
/*step query*/
while(1) {
ret = sqlite3_step(stmt);
if(ret == SQLITE_ROW) {
- __get_pkginfo_for_list(stmt, list_pkginfo);
+ __get_pkginfo_for_list(stmt, &list_pkginfo);
} else {
break;
}
}
- LISTHEAD(list_pkginfo, node);
-
- for(node = node->next; node ; node = node->next) {
- pkginfo = node;
+ for(node = list_pkginfo; node ; node = node->next) {
+ pkginfo = (pkgmgr_pkginfo_x *)node->data;
ret = pkg_list_cb( (void *)pkginfo, user_data);
- if(ret < 0)
+ if(ret < 0) {
+ _LOGE("callback is stopped.");
break;
+ }
}
ret = PMINFO_R_OK;
sqlite3_free(query);
sqlite3_finalize(stmt);
sqlite3_close(pkginfo_db);
+ __cleanup_list_pkginfo(&list_pkginfo);
+ node = NULL;
+
+ return ret;
+}
+
+API int pkgmgrinfo_updateinfo_register(const char* updateinfo)
+{
+ retvm_if(updateinfo == NULL, PMINFO_R_EINVAL, "updateinfo is NULL");
+
+
+#if 0
+ int ret = 0;
+ ret = vconf_set_str(VCONFKEY_PKGMGR_UPDATE_INFO, updateinfo);
+ retvm_if(ret < 0, PMINFO_R_ERROR, "vconf_set_str(%s) fail", updateinfo);
+#endif
+
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_updateinfo_check_update(const char* pkgid)
+{
+ retvm_if(pkgid == NULL, PMINFO_R_ERROR, "pkgid is NULL");
+
+ int ret = -1;
+#if 0
+ char *vconf_str = NULL;
+ char pkgid_is[PKG_STRING_LEN_MAX] = {0,};
+
+ vconf_str = vconf_get_str(VCONFKEY_PKGMGR_UPDATE_INFO);
+ if (vconf_str == NULL) {
+ return PMINFO_R_ERROR;
+ }
+
+ strncat(pkgid_is, pkgid, strlen(pkgid));
+ strncat(pkgid_is, ":", strlen(":"));
- __cleanup_list_pkginfo(list_pkginfo, node);
+ if (strstr(vconf_str, pkgid_is)) {
+ _LOGS("pkgid[%s] has update version", pkgid);
+ ret = PMINFO_R_OK;
+ } else {
+ ret = PMINFO_R_ERROR;
+ }
+
+ FREE_AND_NULL(vconf_str);
+#endif
+ return ret;
+}
+
+API int pkgmgrinfo_updateinfo_remove(const char* pkgid)
+{
+ retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "pkgid is NULL");
+
+ int ret = 0;
+#if 0
+ int len = 0;
+ char *vconf_str = NULL;
+ char pkgid_is[PKG_STRING_LEN_MAX] = {0,};
+ char new_info[PKG_STRING_LEN_MAX] = {0,};
+
+ const char* head = NULL;
+ const char* tail = NULL;
+
+ vconf_str = vconf_get_str(VCONFKEY_PKGMGR_UPDATE_INFO);
+ if (vconf_str == NULL) {
+ return PMINFO_R_ERROR;
+ }
+
+ strncat(pkgid_is, ":", strlen(":"));
+ strncat(pkgid_is, pkgid, strlen(pkgid));
+ strncat(pkgid_is, ":", strlen(":"));
+ tryvm_if(strstr(vconf_str, pkgid_is) == NULL, ret = PMINFO_R_ERROR, "pkgid is already removed");
+
+ memset(pkgid_is, 0, PKG_STRING_LEN_MAX);
+ strncat(pkgid_is, pkgid, strlen(pkgid));
+ strncat(pkgid_is, ":", strlen(":"));
+
+ head = strstr(vconf_str, pkgid_is);
+ if (head != NULL) {
+ len = strlen(vconf_str) - strlen(head);
+ strncat(new_info, vconf_str, len);
+ }
+
+ tail = head + strlen(pkgid) + 1;
+ if (tail != NULL) {
+ strncat(new_info, tail, strlen(tail));
+ }
+
+ ret = vconf_set_str(VCONFKEY_PKGMGR_UPDATE_INFO, new_info);
+ tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "vconf_set_str fail");
+#endif
+
+ ret = PMINFO_R_OK;
+//catch:
+ //FREE_AND_NULL(vconf_str);
return ret;
}
#include "pkgmgrinfo_private.h"
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "PKGMGR_INFO"
+
struct _pkginfo_str_map_t {
pkgmgrinfo_pkginfo_filter_prop_str prop;
const char *property;
{E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING, PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING},
{E_PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE, PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE},
{E_PMINFO_PKGINFO_PROP_PACKAGE_DISABLE, PMINFO_PKGINFO_PROP_PACKAGE_DISABLE},
- {E_PMINFO_PKGINFO_PROP_PACKAGE_USE_RESET, PMINFO_PKGINFO_PROP_PACKAGE_USE_RESET}
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_SYSTEM, PMINFO_PKGINFO_PROP_PACKAGE_SYSTEM}
};
struct _appinfo_str_map_t {
static struct _appinfo_str_map_t appinfo_str_prop_map[] = {
{E_PMINFO_APPINFO_PROP_APP_ID, PMINFO_APPINFO_PROP_APP_ID},
- {E_PMINFO_APPINFO_PROP_APP_COMPONENT, PMINFO_APPINFO_PROP_APP_COMPONENT},
{E_PMINFO_APPINFO_PROP_APP_COMPONENT_TYPE, PMINFO_APPINFO_PROP_APP_COMPONENT_TYPE},
{E_PMINFO_APPINFO_PROP_APP_EXEC, PMINFO_APPINFO_PROP_APP_EXEC},
- {E_PMINFO_APPINFO_PROP_APP_AMBIENT_SUPPORT, PMINFO_APPINFO_PROP_APP_AMBIENT_SUPPORT},
{E_PMINFO_APPINFO_PROP_APP_ICON, PMINFO_APPINFO_PROP_APP_ICON},
{E_PMINFO_APPINFO_PROP_APP_TYPE, PMINFO_APPINFO_PROP_APP_TYPE},
{E_PMINFO_APPINFO_PROP_APP_OPERATION, PMINFO_APPINFO_PROP_APP_OPERATION},
{E_PMINFO_APPINFO_PROP_APP_MIME, PMINFO_APPINFO_PROP_APP_MIME},
{E_PMINFO_APPINFO_PROP_APP_CATEGORY, PMINFO_APPINFO_PROP_APP_CATEGORY},
{E_PMINFO_APPINFO_PROP_APP_HWACCELERATION, PMINFO_APPINFO_PROP_APP_HWACCELERATION},
- {E_PMINFO_APPINFO_PROP_APP_SCREENREADER, PMINFO_APPINFO_PROP_APP_SCREENREADER}
+ {E_PMINFO_APPINFO_PROP_APP_SCREENREADER, PMINFO_APPINFO_PROP_APP_SCREENREADER},
+ {E_PMINFO_APPINFO_PROP_APP_BG_CATEGORY, PMINFO_APPINFO_PROP_APP_BG_CATEGORY},
};
struct _appinfo_int_map_t {
{E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION, PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION},
{E_PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE, PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE},
{E_PMINFO_APPINFO_PROP_APP_DISABLE, PMINFO_APPINFO_PROP_APP_DISABLE},
- {E_PMINFO_APPINFO_PROP_APP_REMOVABLE, PMINFO_APPINFO_PROP_APP_REMOVABLE}
+ {E_PMINFO_APPINFO_PROP_APP_REMOVABLE, PMINFO_APPINFO_PROP_APP_REMOVABLE},
+ {E_PMINFO_APPINFO_PROP_APP_BG_USER_DISABLE, PMINFO_APPINFO_PROP_APP_BG_USER_DISABLE}
};
inline int _pkgmgrinfo_validate_cb(void *data, int ncols, char **coltxt, char **colname)
return prop;
}
+static int __db_busy_handler(void *pData, int count)
+{
+ _LOGD("count=[%d]", count);
+
+ // waiting time : 10sec = 500 * 20ms
+ if (count < 500) {
+ _LOGE("__db_busy_handler(count=%d) is called. pid=[%d]", count, getpid());
+ usleep(20*1000);
+ return 1;
+ } else {
+ _LOGE("__db_busy_handler(count=%d) is failed. pid=[%d]", count, getpid());
+ return 0;
+ }
+}
+
+int _pminfo_db_open(const char *dbfile, sqlite3 **database)
+{
+ int ret = 0;
+ retvm_if(dbfile == NULL, PMINFO_R_ERROR, "dbfile is NULL");
+ retvm_if(database == NULL, PMINFO_R_ERROR, "database is NULL");
+
+ ret = sqlite3_open_v2(dbfile, database, SQLITE_OPEN_READONLY, NULL);
+ tryvm_if(ret != SQLITE_OK, , "sqlite3_open(%s) failed. [ret = %d]", dbfile, ret);
+
+ ret = sqlite3_busy_handler(*database, __db_busy_handler, NULL);
+ tryvm_if(ret != SQLITE_OK, , "sqlite3_busy_handler(%s) failed. [ret = %d]", dbfile, ret);
+
+catch:
+ if (ret != SQLITE_OK) {
+ if (*database) {
+ _LOGE("error: sqlite3_close(%s) is done.", dbfile);
+ sqlite3_close(*database);
+ }
+ }
+
+ return ret;
+}
+
+int _pminfo_db_open_with_options(const char *dbfile, sqlite3 **database, int flags)
+{
+ int ret = 0;
+ retvm_if(dbfile == NULL, PMINFO_R_ERROR, "dbfile is NULL");
+ retvm_if(database == NULL, PMINFO_R_ERROR, "database is NULL");
+
+ ret = sqlite3_open_v2(dbfile, database, flags, NULL);
+ tryvm_if(ret != SQLITE_OK, , "sqlite3_open_v2(%s) failed. [ret = %d]", dbfile, ret);
+
+ ret = sqlite3_busy_handler(*database, __db_busy_handler, NULL);
+ tryvm_if(ret != SQLITE_OK, , "sqlite3_busy_handler(%s) failed. [ret = %d]", dbfile, ret);
+
+catch:
+ if (ret != SQLITE_OK) {
+ if (*database) {
+ _LOGE("error: sqlite3_close(%s) is done.", dbfile);
+ sqlite3_close(*database);
+ }
+ }
+
+ return ret;
+}
+
int __exec_db_query(sqlite3 *db, char *query, sqlite_query_callback callback, void *data)
{
char *error_message = NULL;
return 0;
}
-void __cleanup_list_pkginfo(pkgmgr_pkginfo_x *list_pkginfo, pkgmgr_pkginfo_x *node)
+void __cleanup_list_pkginfo(GList **list_pkginfo)
{
- pkgmgr_pkginfo_x *temp_node = NULL;
-
- if (list_pkginfo != NULL) {
- LISTHEAD(list_pkginfo, node);
- temp_node = node->next;
- node = temp_node;
- while (node) {
- temp_node = node->next;
- __cleanup_pkginfo(node);
- node = temp_node;
+ GList *node = NULL;
+ if (*list_pkginfo != NULL) {
+ for(node = *list_pkginfo; node; node = node->next){
+ __cleanup_pkginfo((pkgmgr_pkginfo_x *)node->data);
}
- __cleanup_pkginfo(list_pkginfo);
+ g_list_free(*list_pkginfo);
+ *list_pkginfo = NULL;
}
}
return;
FREE_AND_NULL(data->locale);
-
- manifest_x *mfx = calloc(1, sizeof(manifest_x));
- if (mfx == NULL) {
- _LOGE("out of memory");
- return;
- }
-
- mfx->uiapplication = data->uiapp_info;
- _pkgmgrinfo_basic_free_manifest_x(mfx);
+ _pkgmgrinfo_basic_free_uiapplication_x(data->uiapp_info);
FREE_AND_NULL(data);
return;
}
return strdup(DEFAULT_LOCALE);
}
- char *locale = malloc(6);
+ unsigned int size = 6 * sizeof(char);
+ char *locale = malloc(size);
if (!locale) {
_LOGE("Malloc Failed\n");
FREE_AND_NULL(syslocale);
return strdup(DEFAULT_LOCALE);
}
- sprintf(locale, "%c%c-%c%c", syslocale[0], syslocale[1], tolower(syslocale[3]), tolower(syslocale[4]));
+ snprintf(locale, size, "%c%c-%c%c", syslocale[0], syslocale[1], tolower(syslocale[3]), tolower(syslocale[4]));
FREE_AND_NULL(syslocale);
return locale;
char temp[PKG_STRING_LEN_MAX] = {'\0'};
switch (node->prop) {
case E_PMINFO_PKGINFO_PROP_PACKAGE_ID:
- snprintf(buf, MAX_QUERY_LEN, "package_info.package='%s'", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.package=%Q", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_TYPE:
- snprintf(buf, MAX_QUERY_LEN, "package_info.package_type='%s'", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.package_type=%Q", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_VERSION:
- snprintf(buf, MAX_QUERY_LEN, "package_info.package_version='%s'", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.package_version=%Q", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION:
- snprintf(buf, MAX_QUERY_LEN, "package_info.install_location='%s'", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.install_location=%Q", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE:
- snprintf(buf, MAX_QUERY_LEN, "package_info.installed_storage='%s'", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.installed_storage=%Q", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME:
- snprintf(buf, MAX_QUERY_LEN, "package_info.author_name='%s'", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.author_name=%Q", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF:
- snprintf(buf, MAX_QUERY_LEN, "package_info.author_href='%s'", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.author_href=%Q", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_STORECLIENT_ID:
- snprintf(buf, MAX_QUERY_LEN, "package_info.storeclient_id='%s'", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.storeclient_id=%Q", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL:
- snprintf(buf, MAX_QUERY_LEN, "package_info.author_email='%s'", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.author_email=%Q", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_SIZE:
- snprintf(buf, MAX_QUERY_LEN, "package_info.package_size='%s'", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.package_size=%Q", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE:
- snprintf(buf, MAX_QUERY_LEN, "package_info.package_removable IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.package_removable IN %s", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD:
- snprintf(buf, MAX_QUERY_LEN, "package_info.package_preload IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.package_preload IN %s", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_READONLY:
- snprintf(buf, MAX_QUERY_LEN, "package_info.package_readonly IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.package_readonly IN %s", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_UPDATE:
- snprintf(buf, MAX_QUERY_LEN, "package_info.package_update IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.package_update IN %s", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING:
- snprintf(buf, MAX_QUERY_LEN, "package_info.package_appsetting IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.package_appsetting IN %s", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING:
- snprintf(buf, MAX_QUERY_LEN, "package_info.package_nodisplay IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.package_nodisplay IN %s", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE:
- snprintf(buf, MAX_QUERY_LEN, "package_info.package_support_disable IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.package_support_disable IN %s", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_DISABLE:
- snprintf(buf, MAX_QUERY_LEN, "package_info.package_disable IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.package_disable IN %s", node->value);
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_MODE:
- snprintf(buf, MAX_QUERY_LEN, "package_info.package_support_mode & %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.package_support_mode & %s", node->value);
break;
- case E_PMINFO_PKGINFO_PROP_PACKAGE_USE_RESET:
- snprintf(buf, MAX_QUERY_LEN, "package_info.package_reserve2 IN %s", node->value);
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_SYSTEM:
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_info.package_system IN %s", node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_ID:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_id='%s'", node->value);
- break;
- case E_PMINFO_APPINFO_PROP_APP_COMPONENT:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_component='%s'", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_id=%Q", node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_COMPONENT_TYPE:
sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.component_type=%Q", node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_EXEC:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_exec='%s'", node->value);
- break;
- case E_PMINFO_APPINFO_PROP_APP_AMBIENT_SUPPORT:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_ambient_support='%s'", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_exec=%Q", node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_ICON:
- snprintf(buf, MAX_QUERY_LEN, "package_app_localized_info.app_icon='%s'", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_localized_info.app_icon=%Q", node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_TYPE:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_type='%s'", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_type=%Q", node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_OPERATION:
snprintf(temp, PKG_STRING_LEN_MAX, "(%s)", node->value);
- snprintf(buf, MAX_QUERY_LEN, "package_app_app_svc.operation IN %s", temp);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_app_svc.operation IN %s", temp);
break;
case E_PMINFO_APPINFO_PROP_APP_URI:
snprintf(temp, PKG_STRING_LEN_MAX, "(%s)", node->value);
- snprintf(buf, MAX_QUERY_LEN, "package_app_app_svc.uri_scheme IN %s", temp);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_app_svc.uri_scheme IN %s", temp);
break;
case E_PMINFO_APPINFO_PROP_APP_MIME:
snprintf(temp, PKG_STRING_LEN_MAX, "(%s)", node->value);
- snprintf(buf, MAX_QUERY_LEN, "package_app_app_svc.mime_type IN %s", temp);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_app_svc.mime_type IN %s", temp);
break;
case E_PMINFO_APPINFO_PROP_APP_CATEGORY:
snprintf(temp, PKG_STRING_LEN_MAX, "(%s)", node->value);
- snprintf(buf, MAX_QUERY_LEN, "package_app_app_category.category IN %s", temp);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_app_category.category IN %s", temp);
break;
case E_PMINFO_APPINFO_PROP_APP_NODISPLAY:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_nodisplay IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_nodisplay IN %s", node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_MULTIPLE:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_multiple IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_multiple IN %s", node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_ONBOOT:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_onboot IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_onboot IN %s", node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_AUTORESTART:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_autorestart IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_autorestart IN %s", node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_TASKMANAGE:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_taskmanage IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_taskmanage IN %s", node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_HWACCELERATION:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_hwacceleration='%s'", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_hwacceleration=%Q", node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_SCREENREADER:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_screenreader='%s'", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_screenreader=%Q", node->value);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_BG_USER_DISABLE:
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_background_category & 1 = %q", node->value);
+ break;
+ case E_PMINFO_APPINFO_PROP_APP_BG_CATEGORY:
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_background_category & %q = %q", node->value, node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_launchcondition IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_launchcondition IN %s", node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_support_disable IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_support_disable IN %s", node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_DISABLE:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_disable IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_disable IN %s", node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_REMOVABLE:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_removable IN %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_removable IN %s", node->value);
break;
case E_PMINFO_APPINFO_PROP_APP_SUPPORT_MODE:
- snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_support_mode & %s", node->value);
+ sqlite3_snprintf(MAX_QUERY_LEN, buf, "package_app_info.app_support_mode & %s", node->value);
break;
default:
_LOGE("Invalid Property Type\n");
return PMINFO_R_OK;
}
+void _pminfo_destroy_node(gpointer data)
+{
+ ret_if(data == NULL);
+ pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)data;
+ FREE_AND_NULL(node->value);
+ FREE_AND_NULL(node->key);
+ FREE_AND_NULL(node);
+}
--- /dev/null
+#include "pkgmgrinfo_private.h"
+#include "pkgmgr_parser_resource.h"
+
+API int pkgmgrinfo_resource_open(const char *filepath, resource_data_t **data)
+{
+ return pkgmgr_resource_parser_open(filepath, data);
+}
+
+API int pkgmgrinfo_resource_close(resource_data_t *data)
+{
+ return pkgmgr_resource_parser_close(data);
+}
+