From b82ae853cb45702a5f7666c7934b770aa18acd74 Mon Sep 17 00:00:00 2001 From: "junsuk77.oh" Date: Wed, 3 Jul 2013 10:41:07 +0900 Subject: [PATCH] implement app screen reader Change-Id: I9362cb04c6296105266d94e65d7c56b83a2c409a Signed-off-by: junsuk77.oh --- include/pkgmgr-info-internal.h | 1 + include/pkgmgr-info.h | 47 ++++++++++++++++++++++++++++++++++++++++++ packaging/pkgmgr-info.spec | 2 +- parser/manifest.xsd.in | 8 +++++++ parser/pkgmgr_parser.c | 11 ++++++++++ parser/pkgmgr_parser.h | 1 + parser/pkgmgr_parser_db.c | 7 ++++--- src/pkgmgr-info-internal.c | 3 ++- src/pkgmgr-info.c | 41 ++++++++++++++++++++++++++++++++++++ 9 files changed, 116 insertions(+), 5 deletions(-) diff --git a/include/pkgmgr-info-internal.h b/include/pkgmgr-info-internal.h index 4bf38fb..8982f25 100755 --- a/include/pkgmgr-info-internal.h +++ b/include/pkgmgr-info-internal.h @@ -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; diff --git a/include/pkgmgr-info.h b/include/pkgmgr-info.h index 908545f..ddc9454 100755 --- a/include/pkgmgr-info.h +++ b/include/pkgmgr-info.h @@ -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, /** + + + + + + + @@ -137,6 +144,7 @@ + diff --git a/parser/pkgmgr_parser.c b/parser/pkgmgr_parser.c index 27d1830..dfe2205 100755 --- a/parser/pkgmgr_parser.c +++ b/parser/pkgmgr_parser.c @@ -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"))) { diff --git a/parser/pkgmgr_parser.h b/parser/pkgmgr_parser.h index 35ddd82..e9c4d55 100755 --- a/parser/pkgmgr_parser.h +++ b/parser/pkgmgr_parser.h @@ -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; diff --git a/parser/pkgmgr_parser_db.c b/parser/pkgmgr_parser_db.c index 85cd545..01f1ce8 100755 --- a/parser/pkgmgr_parser_db.c +++ b/parser/pkgmgr_parser_db.c @@ -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); diff --git a/src/pkgmgr-info-internal.c b/src/pkgmgr-info-internal.c index 512fe27..70b6589 100755 --- a/src/pkgmgr-info-internal.c +++ b/src/pkgmgr-info-internal.c @@ -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 { diff --git a/src/pkgmgr-info.c b/src/pkgmgr-info.c index aa7fecc..b0568ee 100755 --- a/src/pkgmgr-info.c +++ b/src/pkgmgr-info.c @@ -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"); -- 2.7.4