implement app screen reader
authorjunsuk77.oh <junsuk77.oh@samsung.com>
Wed, 3 Jul 2013 01:41:07 +0000 (10:41 +0900)
committerjunsuk77.oh <junsuk77.oh@samsung.com>
Wed, 3 Jul 2013 01:41:07 +0000 (10:41 +0900)
Change-Id: I9362cb04c6296105266d94e65d7c56b83a2c409a
Signed-off-by: junsuk77.oh <junsuk77.oh@samsung.com>
include/pkgmgr-info-internal.h
include/pkgmgr-info.h
packaging/pkgmgr-info.spec
parser/manifest.xsd.in
parser/pkgmgr_parser.c
parser/pkgmgr_parser.h
parser/pkgmgr_parser_db.c
src/pkgmgr-info-internal.c
src/pkgmgr-info.c

index 4bf38fb..8982f25 100755 (executable)
@@ -78,6 +78,7 @@ typedef enum _pkgmgrinfo_appinfo_filter_prop_str {
        E_PMINFO_APPINFO_PROP_APP_MIME,
        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
 } pkgmgrinfo_appinfo_filter_prop_str;
 
index 908545f..ddc9454 100755 (executable)
@@ -143,6 +143,12 @@ typedef enum {
 }pkgmgrinfo_app_hwacceleration;
 
 typedef enum {
+       PMINFO_SCREENREADER_OFF = 0,            /**< Don't use screen reader*/
+       PMINFO_SCREENREADER_ON = 1,             /**< Use screen reader*/
+       PMINFO_SCREENREADER_USE_SYSTEM_SETTING = 2              /**< Follow system setting for screen reader */
+}pkgmgrinfo_app_screenreader;
+
+typedef enum {
        PMINFO_RECENTIMAGE_USE_ICON = 0,                /**<Use icon for recent image*/
        PMINFO_RECENTIMAGE_USE_CAPTURE = 1,             /**< Use capture for recent image*/
        PMINFO_RECENTIMAGE_USE_NOTHING = 2              /**< Don't use recent image */
@@ -409,6 +415,8 @@ typedef enum {
 #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"
+  /** String property for filtering based on app info*/
+#define        PMINFO_APPINFO_PROP_APP_SCREENREADER    "PMINFO_APPINFO_PROP_APP_SCREENREADER"
 
  /** Boolean property for filtering based on app info*/
 #define        PMINFO_APPINFO_PROP_APP_NODISPLAY               "PMINFO_APPINFO_PROP_APP_NODISPLAY"
@@ -3031,6 +3039,45 @@ static int get_app_hwacceleration(const char *appid)
 int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_hwacceleration *hwacceleration);
 
 /**
+ * @fn int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_screenreader *screenreader)
+ * @brief      This API gets the application 'screenreader' 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] screenreader            pointer to hold package accessibility 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_screenreader(const char *appid)
+{
+       int ret = 0;
+       pkgmgrinfo_app_screenreader screenreader = PMINFO_USE_SYSTEM_SETTING;
+       pkgmgrinfo_appinfo_h handle = NULL;
+       ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_appinfo_get_screenreader(handle, &screenreader);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_appinfo_destroy_appinfo(handle);
+               return -1;
+       }
+       printf("app screenreader: %d\n", screenreader);
+       pkgmgrinfo_appinfo_destroy_appinfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_screenreader *screenreader);
+
+/**
  * @fn int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h  handle, char **portrait_img, char **landscape_img)
  * @brief      This API gets the application's landscape & portrait effect images
  *
index f6ff9c8..b5cec0b 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       pkgmgr-info
 Summary:    Packager Manager infomation api for package
-Version:    0.0.126
+Version:    0.0.127
 Release:    1
 Group:      Application Framework/Package Management
 License:    Apache-2.0
index 0523d5d..0f77a7a 100755 (executable)
         <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: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"/>
index 27d1830..dfe2205 100755 (executable)
@@ -1440,6 +1440,10 @@ static void __ps_free_uiapplication(uiapplication_x *uiapplication)
                free((void *)uiapplication->hwacceleration);
                uiapplication->hwacceleration = NULL;
        }
+       if (uiapplication->screenreader) {
+               free((void *)uiapplication->screenreader);
+               uiapplication->screenreader = NULL;
+       }
        if (uiapplication->mainapp) {
                free((void *)uiapplication->mainapp);
                uiapplication->mainapp = NULL;
@@ -2772,6 +2776,13 @@ static int __ps_process_uiapplication(xmlTextReaderPtr reader, uiapplication_x *
        } else {
                uiapplication->hwacceleration = strdup("use-system-setting");
        }
+       if (xmlTextReaderGetAttribute(reader, XMLCHAR("screen-reader"))) {
+               uiapplication->screenreader = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("screen-reader")));
+               if (uiapplication->screenreader == NULL)
+                       uiapplication->screenreader = strdup("use-system-setting");
+       } else {
+               uiapplication->screenreader = strdup("use-system-setting");
+       }
        if (xmlTextReaderGetAttribute(reader, XMLCHAR("recentimage")))
                uiapplication->recentimage = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("recentimage")));
        if (xmlTextReaderGetAttribute(reader, XMLCHAR("mainapp"))) {
index 35ddd82..e9c4d55 100755 (executable)
@@ -364,6 +364,7 @@ typedef struct uiapplication_x {
        const char *categories;
        const char *extraid;
        const char *hwacceleration;
+       const char *screenreader;
        const char *mainapp;
        const char *package;
        const char *recentimage;
index 85cd545..01f1ce8 100755 (executable)
@@ -99,6 +99,7 @@ char *prev = NULL;
                                                "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, " \
@@ -797,12 +798,12 @@ static int __insert_uiapplication_info(manifest_x *mfx)
        {
                snprintf(query, MAX_QUERY_LEN,
                         "insert into package_app_info(app_id, app_component, app_exec, app_nodisplay, app_type, app_onboot, " \
-                       "app_multiple, app_autorestart, app_taskmanage, app_enabled, app_hwacceleration, app_mainapp , app_recentimage, " \
+                       "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, 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')",\
+                       "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')",\
                         up->appid, "uiapp", up->exec, up->nodisplay, up->type, "\0", up->multiple,
-                        "\0", up->taskmanage, up->enabled, up->hwacceleration,up->mainapp, up->recentimage,
+                        "\0", up->taskmanage, up->enabled, up->hwacceleration, up->screenreader, up->mainapp, up->recentimage,
                         up->launchcondition, up->indicatordisplay, up->portraitimg, up->landscapeimg, up->guestmode_visibility, up->permission_type,
                         mfx->preload, up->submode, up->submode_mainid, up->component_type, mfx->package);
                ret = __exec_query(query);
index 512fe27..70b6589 100755 (executable)
@@ -80,7 +80,8 @@ static struct _appinfo_str_map_t appinfo_str_prop_map[] = {
        {E_PMINFO_APPINFO_PROP_APP_URI,         PMINFO_APPINFO_PROP_APP_URI},
        {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_HWACCELERATION,      PMINFO_APPINFO_PROP_APP_HWACCELERATION},
+       {E_PMINFO_APPINFO_PROP_APP_SCREENREADER,        PMINFO_APPINFO_PROP_APP_SCREENREADER}
 };
 
 struct _appinfo_int_map_t {
index aa7fecc..b0568ee 100755 (executable)
@@ -368,6 +368,9 @@ static void __get_filter_condition(gpointer data, char **condition)
        case E_PMINFO_APPINFO_PROP_APP_HWACCELERATION:
                snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_hwacceleration='%s'", node->value);
                break;
+       case E_PMINFO_APPINFO_PROP_APP_SCREENREADER:
+               snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_screenreader='%s'", node->value);
+               break;
        case E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION:
                snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_launchcondition IN %s", node->value);
                break;
@@ -595,6 +598,11 @@ static int __uiapp_list_cb(void *data, int ncols, char **coltxt, char **colname)
                                info->manifest_info->uiapplication->hwacceleration = strdup(coltxt[i]);
                        else
                                info->manifest_info->uiapplication->hwacceleration = NULL;
+               } else if (strcmp(colname[i], "app_screenreader") == 0 ){
+                       if (coltxt[i])
+                               info->manifest_info->uiapplication->screenreader = strdup(coltxt[i]);
+                       else
+                               info->manifest_info->uiapplication->screenreader = NULL;
                } else if (strcmp(colname[i], "app_indicatordisplay") == 0 ){
                        if (coltxt[i])
                                info->manifest_info->uiapplication->indicatordisplay = strdup(coltxt[i]);
@@ -816,6 +824,11 @@ static int __allapp_list_cb(void *data, int ncols, char **coltxt, char **colname
                                                                info->manifest_info->uiapplication->hwacceleration = strdup(coltxt[i]);
                                                        else
                                                                info->manifest_info->uiapplication->hwacceleration = NULL;
+                                               } else if (strcmp(colname[i], "app_screenreader") == 0 ){
+                                                       if (coltxt[i])
+                                                               info->manifest_info->uiapplication->screenreader = strdup(coltxt[i]);
+                                                       else
+                                                               info->manifest_info->uiapplication->screenreader = NULL;
                                                } else if (strcmp(colname[i], "app_indicatordisplay") == 0 ){
                                                        if (coltxt[i])
                                                                info->manifest_info->uiapplication->indicatordisplay = strdup(coltxt[i]);
@@ -1274,6 +1287,11 @@ static int __mini_appinfo_cb(void *data, int ncols, char **coltxt, char **colnam
                                info->uiapp_info->hwacceleration = strdup(coltxt[i]);
                        else
                                info->uiapp_info->hwacceleration = NULL;
+               } else if (strcmp(colname[i], "app_screenreader") == 0 ) {
+                       if (coltxt[i])
+                               info->uiapp_info->screenreader = strdup(coltxt[i]);
+                       else
+                               info->uiapp_info->screenreader = NULL;
                } else if (strcmp(colname[i], "app_enabled") == 0 ) {
                        if (coltxt[i])
                                info->uiapp_info->enabled= strdup(coltxt[i]);
@@ -1434,6 +1452,11 @@ static int __appinfo_cb(void *data, int ncols, char **coltxt, char **colname)
                                        info->uiapp_info->hwacceleration = strdup(coltxt[i]);
                                else
                                        info->uiapp_info->hwacceleration = NULL;
+                       } else if (strcmp(colname[i], "app_screenreader") == 0 ) {
+                               if (coltxt[i])
+                                       info->uiapp_info->screenreader = strdup(coltxt[i]);
+                               else
+                                       info->uiapp_info->screenreader = NULL;
                        } else if (strcmp(colname[i], "app_enabled") == 0 ) {
                                if (coltxt[i])
                                        info->uiapp_info->enabled= strdup(coltxt[i]);
@@ -4893,6 +4916,24 @@ API int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h  handle, pkgm
        return PMINFO_R_OK;
 }
 
+API int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_screenreader *screenreader)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+       retvm_if(screenreader == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       char *val = NULL;
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+       val = (char *)info->uiapp_info->screenreader;
+       if (val) {
+               if (strcasecmp(val, "screenreader-off") == 0)
+                       *screenreader = PMINFO_SCREENREADER_OFF;
+               else if (strcasecmp(val, "screenreader-on") == 0)
+                       *screenreader = PMINFO_SCREENREADER_ON;
+               else
+                       *screenreader = PMINFO_SCREENREADER_USE_SYSTEM_SETTING;
+       }
+       return PMINFO_R_OK;
+}
+
 API int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h  handle, char **portrait_img, char **landscape_img)
 {
        retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");