Parse support-disable 35/46435/4
authorSangyoon Jang <s89.jang@samsung.com>
Thu, 20 Aug 2015 08:22:43 +0000 (17:22 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Mon, 24 Aug 2015 01:47:21 +0000 (10:47 +0900)
add filter prop for support-disable

Change-Id: I0967e466a85b613b03d7c7397a997be07ab2754f
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
include/pkgmgr-info.h
include/pkgmgrinfo_basic.h
include/pkgmgrinfo_private.h
parser/manifest.xsd.in
parser/pkgmgr_parser.c
parser/pkgmgr_parser_db.c
src/pkgmgrinfo_appinfo.c
src/pkgmgrinfo_basic.c
src/pkgmgrinfo_pkginfo.c
src/pkgmgrinfo_private.c

index c500956..063097c 100644 (file)
@@ -105,6 +105,8 @@ extern "C" {
 #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"
 
  /** Integer property for filtering based on package info*/
 #define        PMINFO_PKGINFO_PROP_PACKAGE_SIZE                "PMINFO_PKGINFO_PROP_PACKAGE_SIZE"
@@ -152,6 +154,8 @@ extern "C" {
 #define        PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION "PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION"
  /** Boolean property for filtering based on app info*/
 #define        PMINFO_APPINFO_PROP_APP_UI_GADGET       "PMINFO_APPINFO_PROP_APP_UI_GADGET"
+ /** Boolean property for filtering based on app info*/
+#define        PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE "PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE"
 
  /** will be updated*/
  /** string property for filtering based on pkg info*/
@@ -1402,6 +1406,43 @@ static int get_pkg_update(const char *pkgid)
  */
 int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update);
 
+/**
+ * @fn int pkgmgrinfo_pkginfo_is_support_disable(pkgmgrinfo_pkginfo_h handle, bool *support_disable)
+ * @brief      This API gets the package 'support_disable' value 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] 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
+ * @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_pkg_support_disable(const char *pkgid)
+{
+       int ret = 0;
+       bool support_disable;
+       pkgmgrinfo_pkginfo_h handle = NULL;
+       ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_pkginfo_is_support_disable(handle, &support_disable);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               return -1;
+       }
+       printf("pkg support_disable: %d\n", support_disable);
+       pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_is_support_disable(pkgmgrinfo_pkginfo_h handle, bool *support_disable);
 
 /**
  * @fn int pkgmgrinfo_pkginfo_is_global(uid_t uid, const char *pkgid)
@@ -3695,6 +3736,42 @@ static int get_app_ui_gadget(const char *appid)
 int pkgmgrinfo_appinfo_is_ui_gadget(pkgmgrinfo_appinfo_h handle, bool *ui_gadget);
 
 /**
+ * @fn int pkgmgrinfo_appinfo_is_support_disable(pkgmgrinfo_appinfo_h handle, bool *support_disable)
+ * @brief      This API gets the application 'support_disable' 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] 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
+ * @pre                pkgmgrinfo_appinfo_get_appinfo()
+ * @post       pkgmgrinfo_appinfo_destroy_appinfo()
+ * @code
+static int get_app_support_disable(const char *appid)
+{
+       int ret = 0;
+       bool support_disable;
+       pkgmgrinfo_appinfo_h handle = NULL;
+       ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_appinfo_is_support_disable(handle, &support_disable);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_appinfo_destroy_appinfo(handle);
+               return -1;
+       }
+       printf("app support_disable: %d\n", support_disable);
+       pkgmgrinfo_appinfo_destroy_appinfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_support_disable(pkgmgrinfo_appinfo_h handle, bool *support_disable);
+
+/**
  * @fn int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
  * @brief      This API destroys the application information handle freeing up all the resources
  *
index bae3085..8e2c24b 100644 (file)
@@ -311,6 +311,7 @@ typedef struct application_x {
        const char *submode_mainid;
        const char *launch_mode;
        const char *ui_gadget;
+       const char *support_disable;
        const char *component_type;
        const char *package;
        struct label_x *label;
@@ -357,6 +358,7 @@ typedef struct uiapplication_x {
        const char *submode_mainid;
        const char *launch_mode;
        const char *ui_gadget;
+       const char *support_disable;
        struct label_x *label;
        struct icon_x *icon;
        struct image_x *image;
@@ -449,6 +451,7 @@ typedef struct package_x {
        const char *csc_path;           /**< package csc path*/
        const char *nodisplay_setting;          /**< package no display setting menu*/
        const char *api_version;                /**< minimum version of API package using*/
+       const char *support_disable;            /**< package support disable flag*/
        struct icon_x *icon;            /**< package icon*/
        struct label_x *label;          /**< package label*/
        struct author_x *author;                /**< package author*/
index e661e42..e4048e4 100644 (file)
@@ -98,7 +98,8 @@ typedef enum _pkgmgrinfo_pkginfo_filter_prop_bool {
        E_PMINFO_PKGINFO_PROP_PACKAGE_UPDATE,
        E_PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING,
        E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING,
-       E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_BOOL = E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING
+       E_PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE,
+       E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_BOOL = E_PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE
 } pkgmgrinfo_pkginfo_filter_prop_bool;
 
 /*Integer properties for filtering based on package info*/
@@ -138,7 +139,8 @@ typedef enum _pkgmgrinfo_appinfo_filter_prop_bool {
        E_PMINFO_APPINFO_PROP_APP_TASKMANAGE,
        E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION,
        E_PMINFO_APPINFO_PROP_APP_UI_GADGET,
-       E_PMINFO_APPINFO_PROP_APP_MAX_BOOL = E_PMINFO_APPINFO_PROP_APP_UI_GADGET
+       E_PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE,
+       E_PMINFO_APPINFO_PROP_APP_MAX_BOOL = E_PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE
 } pkgmgrinfo_appinfo_filter_prop_bool;
 
 /*Integer properties for filtering based on app info*/
index 5efcdfa..21cecbd 100644 (file)
@@ -37,6 +37,7 @@
       <xs:attribute name="nodisplay-setting" type="xs:boolean"/>
       <xs:attribute name="url" type="xs:string"/>
       <xs:attribute name="api-version" type="xs:string"/>
+      <xs:attribute name="support-disable" type="xs:boolean"/>
     </xs:complexType>
   </xs:element>
 
index d1bf905..6b18a8a 100644 (file)
@@ -2380,6 +2380,7 @@ static int __process_manifest(xmlTextReaderPtr reader, manifest_x *mfx, uid_t ui
                        __save_xml_attribute(reader, "nodisplay-setting", &mfx->nodisplay_setting, "false");
                        __save_xml_attribute(reader, "url", &mfx->package_url, NULL);
                        __save_xml_attribute(reader, "api-version", &mfx->api_version, NULL);
+                       __save_xml_attribute(reader, "support-disable", &mfx->support_disable, "false");
 
                        __save_xml_installed_time(mfx);
                        __save_xml_root_path(mfx, uid);
index cb887d1..94b3aff 100644 (file)
@@ -87,7 +87,8 @@ sqlite3 *pkgmgr_cert_db;
                                                "mainapp_id text," \
                                                "package_url text," \
                                                "root_path text," \
-                                               "csc_path text )"
+                                               "csc_path text," \
+                                               "package_support_disable text DEFAULT 'false')"
 
 #define QUERY_CREATE_TABLE_PACKAGE_LOCALIZED_INFO "create table if not exists package_localized_info " \
                                                "(package text not null, " \
@@ -136,6 +137,7 @@ sqlite3 *pkgmgr_cert_db;
                                                "app_submode_mainid text, " \
                                                "app_launch_mode text NOT NULL DEFAULT 'caller', " \
                                                "app_ui_gadget text DEFAULT 'false', " \
+                                               "app_support_disable text DEFAULT 'false', " \
                                                "component_type text, " \
                                                "package text not null, " \
                                                "FOREIGN KEY(package) " \
@@ -832,8 +834,8 @@ static int __insert_uiapplication_info(manifest_x *mfx)
                         "insert into package_app_info(app_id, app_component, app_exec, app_nodisplay, app_type, app_onboot, " \
                        "app_multiple, app_autorestart, app_taskmanage, app_enabled, app_hwacceleration, app_screenreader, app_mainapp , app_recentimage, " \
                        "app_launchcondition, app_indicatordisplay, app_portraitimg, app_landscapeimg, app_guestmodevisibility, app_permissiontype, "\
-                       "app_preload, app_submode, app_submode_mainid, app_launch_mode, app_ui_gadget, component_type, package) " \
-                       "values('%s', '%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
+                       "app_preload, app_submode, app_submode_mainid, app_launch_mode, app_ui_gadget, app_support_disable, component_type, package) " \
+                       "values('%s', '%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
                         up->appid,
                         "uiapp",
                         up->exec,
@@ -859,6 +861,7 @@ static int __insert_uiapplication_info(manifest_x *mfx)
                         __get_str(up->submode_mainid),
                         up->launch_mode,
                         up->ui_gadget,
+                        mfx->support_disable,
                         up->component_type,
                         mfx->package);
 
@@ -1552,8 +1555,8 @@ static int __insert_manifest_info_in_db(manifest_x *mfx, uid_t uid)
        snprintf(query, MAX_QUERY_LEN,
                 "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) " \
-               "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
+               "author_name, author_email, author_href, installed_time, installed_storage, storeclient_id, mainapp_id, package_url, root_path, csc_path, package_support_disable) " \
+               "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\
                 mfx->package,
                 mfx->type,
                 mfx->version,
@@ -1576,7 +1579,8 @@ static int __insert_manifest_info_in_db(manifest_x *mfx, uid_t uid)
                 mfx->mainapp_id,
                 __get_str(mfx->package_url),
                 mfx->root_path,
-                __get_str(mfx->csc_path));
+                __get_str(mfx->csc_path),
+                mfx->support_disable);
 
        ret = __exec_query(query);
        if (ret == -1) {
index de7afaf..3b5b4f4 100644 (file)
@@ -564,6 +564,7 @@ static int _appinfo_get_application(sqlite3 *db, const char *appid,
                "app_landscapeimg, app_guestmodevisibility, "
                "app_permissiontype, app_preload, app_submode, "
                "app_submode_mainid, app_launch_mode, app_ui_gadget, "
+               "app_support_disable, "
                "component_type, package "
                "FROM package_app_info WHERE app_id=%Q";
        int ret;
@@ -627,6 +628,7 @@ static int _appinfo_get_application(sqlite3 *db, const char *appid,
        _save_column_str(stmt, idx++, &info->submode_mainid);
        _save_column_str(stmt, idx++, &info->launch_mode);
        _save_column_str(stmt, idx++, &info->ui_gadget);
+       _save_column_str(stmt, idx++, &info->support_disable);
        _save_column_str(stmt, idx++, &info->component_type);
        _save_column_str(stmt, idx++, &info->package);
 
@@ -1730,6 +1732,21 @@ API int pkgmgrinfo_appinfo_is_ui_gadget(pkgmgrinfo_appinfo_h handle,
        return PMINFO_R_OK;
 }
 
+API int pkgmgrinfo_appinfo_is_support_disable(pkgmgrinfo_appinfo_h handle,
+               bool *support_disable)
+{
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+       if (info == NULL || info->app_info == NULL || support_disable == NULL) {
+               _LOGE("invalid parameter");
+               return PMINFO_R_EINVAL;
+       }
+
+       *support_disable = _get_bool_value(info->app_info->support_disable);
+
+       return PMINFO_R_OK;
+}
+
 API int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
index 209d6aa..c72cad2 100644 (file)
@@ -743,6 +743,10 @@ static void __ps_free_uiapplication(uiapplication_x *uiapplication)
                free((void *)uiapplication->ui_gadget);
                uiapplication->ui_gadget = NULL;
        }
+       if (uiapplication->support_disable) {
+               free((void *)uiapplication->support_disable);
+               uiapplication->support_disable = NULL;
+       }
 
        free((void*)uiapplication);
        uiapplication = NULL;
@@ -1021,6 +1025,8 @@ API void pkgmgrinfo_basic_free_application(application_x *application)
                free((void *)application->component_type);
        if (application->package)
                free((void *)application->package);
+       if (application->support_disable)
+               free((void *)application->support_disable);
 
        /*Free Label*/
        if (application->label) {
@@ -1237,6 +1243,10 @@ API void pkgmgrinfo_basic_free_package(package_x *package)
                free((void *)package->api_version);
                package->api_version = NULL;
        }
+       if (package->support_disable) {
+               free((void *)package->support_disable);
+               package->support_disable = NULL;
+       }
 
        /*Free Icon*/
        if (package->icon) {
index 2ae6c63..cd0d0e7 100644 (file)
@@ -687,7 +687,8 @@ static int _pkginfo_get_package(sqlite3 *db, const char *pkgid,
                "package_readonly, package_update, package_appsetting, "
                "package_system, package_type, package_size, installed_time, "
                "installed_storage, storeclient_id, mainapp_id, package_url, "
-               "root_path, csc_path, package_nodisplay, package_api_version "
+               "root_path, csc_path, package_nodisplay, package_api_version, "
+               "package_support_disable "
                "FROM package_info WHERE package=%Q";
        int ret;
        char *query;
@@ -746,6 +747,7 @@ static int _pkginfo_get_package(sqlite3 *db, const char *pkgid,
        _save_column_str(stmt, idx++, &info->csc_path);
        _save_column_str(stmt, idx++, &info->nodisplay_setting);
        _save_column_str(stmt, idx++, &info->api_version);
+       _save_column_str(stmt, idx++, &info->support_disable);
 
        if (_pkginfo_get_author(db, info->package, &info->author)) {
                pkgmgrinfo_basic_free_package(info);
@@ -1673,6 +1675,28 @@ API int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update)
        return PMINFO_R_OK;
 }
 
+API int pkgmgrinfo_pkginfo_is_support_disable(pkgmgrinfo_pkginfo_h handle, bool *support_disable)
+{
+       char *val;
+       pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
+
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
+       retvm_if(support_disable == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
+
+       if (info->pkg_info == NULL || info->pkg_info->support_disable == NULL)
+               return PMINFO_R_ERROR;
+
+       val = (char *)info->pkg_info->support_disable;
+       if (strcasecmp(val, "true") == 0)
+               *support_disable = 1;
+       else if (strcasecmp(val, "false") == 0)
+               *support_disable = 0;
+       else
+               *support_disable = 1;
+
+       return PMINFO_R_OK;
+}
+
 API int pkgmgrinfo_pkginfo_is_for_all_users(pkgmgrinfo_pkginfo_h handle, bool *for_all_users)
 {
        char *val;
@@ -1695,7 +1719,6 @@ API int pkgmgrinfo_pkginfo_is_for_all_users(pkgmgrinfo_pkginfo_h handle, bool *f
        return PMINFO_R_OK;
 }
 
-
 API int pkgmgrinfo_pkginfo_destroy_pkginfo(pkgmgrinfo_pkginfo_h handle)
 {
        pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
index 5f70ed7..450e35a 100644 (file)
@@ -71,7 +71,8 @@ static struct _pkginfo_bool_map_t pkginfo_bool_prop_map[] = {
        {E_PMINFO_PKGINFO_PROP_PACKAGE_READONLY,        PMINFO_PKGINFO_PROP_PACKAGE_READONLY},
        {E_PMINFO_PKGINFO_PROP_PACKAGE_UPDATE,          PMINFO_PKGINFO_PROP_PACKAGE_UPDATE},
        {E_PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING,      PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING},
-       {E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING,       PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING}
+       {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}
 };
 
 struct _appinfo_str_map_t {
@@ -117,7 +118,8 @@ static struct _appinfo_bool_map_t appinfo_bool_prop_map[] = {
        {E_PMINFO_APPINFO_PROP_APP_AUTORESTART,         PMINFO_APPINFO_PROP_APP_AUTORESTART},
        {E_PMINFO_APPINFO_PROP_APP_TASKMANAGE,          PMINFO_APPINFO_PROP_APP_TASKMANAGE},
        {E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION,             PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION},
-       {E_PMINFO_APPINFO_PROP_APP_UI_GADGET,           PMINFO_APPINFO_PROP_APP_UI_GADGET}
+       {E_PMINFO_APPINFO_PROP_APP_UI_GADGET,           PMINFO_APPINFO_PROP_APP_UI_GADGET},
+       {E_PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE,             PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE}
 };
 
 inline pkgmgrinfo_pkginfo_filter_prop_str _pminfo_pkginfo_convert_to_prop_str(const char *property)
@@ -282,6 +284,9 @@ void __get_filter_condition(gpointer data, char **condition)
        case E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING:
                snprintf(buf, sizeof(buf), "package_info.package_nodisplay IN %s", node->value);
                break;
+       case E_PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE:
+               snprintf(buf, sizeof(buf), "package_info.package_support_disable IN %s", node->value);
+               break;
 
        case E_PMINFO_APPINFO_PROP_APP_ID:
                snprintf(buf, sizeof(buf), "package_app_info.app_id='%s'", node->value);
@@ -350,6 +355,9 @@ void __get_filter_condition(gpointer data, char **condition)
        case E_PMINFO_APPINFO_PROP_APP_METADATA_VALUE:
                snprintf(buf, sizeof(buf), "package_app_app_metadata.md_value='%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);
+               break;
        default:
                _LOGE("Invalid Property Type\n");
                *condition = NULL;