summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2015-09-16 20:45:17 +0900
committerSung-jae Park <nicesj.park@samsung.com>2015-09-16 20:45:17 +0900
commit6e64d2e5b9c25c71356b6a6d366c0a8213fd299f (patch)
tree19210c70ea8b9fa42d77b295b69ab2e7d3f64263
parentb512203b8003eae8c64daef31304d070200cfbe2 (diff)
downloadwidget-service-6e64d2e5b9c25c71356b6a6d366c0a8213fd299f.tar.gz
widget-service-6e64d2e5b9c25c71356b6a6d366c0a8213fd299f.tar.bz2
widget-service-6e64d2e5b9c25c71356b6a6d366c0a8213fd299f.zip
Change-Id: Idcf6f7cc3f06f2e1cf182165bb35ee6973c5e90f
-rw-r--r--include/widget_conf.h6
-rw-r--r--include/widget_service_internal.h25
-rw-r--r--src/widget_conf.c21
-rw-r--r--src/widget_service.c114
4 files changed, 166 insertions, 0 deletions
diff --git a/include/widget_conf.h b/include/widget_conf.h
index b639a0e..1cb09d4 100644
--- a/include/widget_conf.h
+++ b/include/widget_conf.h
@@ -407,6 +407,11 @@ extern const char * const widget_conf_launch_key_hw_acceleration(void);
/**
* @internal
*/
+extern const char * const widget_conf_launch_key_auto_align(void);
+
+/**
+ * @internal
+ */
extern const char * const widget_conf_empty_content(void);
/**
@@ -513,6 +518,7 @@ extern int widget_conf_parser(const char *conf_file, const widget_conf_parser_ta
#define WIDGET_CONF_BUNDLE_SLAVE_SECURED widget_conf_launch_key_secured()
#define WIDGET_CONF_BUNDLE_SLAVE_ABI widget_conf_launch_key_abi()
#define WIDGET_CONF_BUNDLE_SLAVE_HW_ACCELERATION widget_conf_launch_key_hw_acceleration()
+#define WIDGET_CONF_BUNDLE_SLAVE_AUTO_ALIGN widget_conf_launch_key_auto_align()
#define WIDGET_CONF_PACKET_TIME widget_conf_default_packet_time()
#define WIDGET_CONF_CONTENT_NO_CHANGE widget_conf_empty_content()
#define WIDGET_CONF_TITLE_NO_CHANGE widget_conf_empty_title()
diff --git a/include/widget_service_internal.h b/include/widget_service_internal.h
index a83248b..30ab9fa 100644
--- a/include/widget_service_internal.h
+++ b/include/widget_service_internal.h
@@ -376,6 +376,7 @@ extern char *widget_service_get_provider_name(const char *widgetid);
* @retval #WIDGET_ERROR_MEMORY Memory error
* @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
* @retval #WIDGET_ERROR_FAULT Unrecoverable error occurred
+ * @retval #WIDGET_ERROR_NOT_SUPPORTED Widget feature is not supported
*/
extern int widget_service_get_applist(const char *widgetid, void (*cb)(const char *widgetid, const char *appid, void *data), void *data);
@@ -515,6 +516,7 @@ extern char *widget_service_get_gbar_script_group(const char *widgetid);
* @retval #WIDGET_ERROR_IO_ERROR Failed to access DB
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument
* @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WIDGET_ERROR_NOT_SUPPORTED Widget feature is not supported
* @see widget_service_enumerate_cluster_list()
*/
extern int widget_service_enumerate_category_list(const char *cluster, int (*cb)(const char *cluster, const char *category, void *data), void *data);
@@ -531,6 +533,7 @@ extern int widget_service_enumerate_category_list(const char *cluster, int (*cb)
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument
* @retval #WIDGET_ERROR_IO_ERROR Failed to access DB
* @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WIDGET_ERROR_NOT_SUPPORTED Widget feature is not supported
* @retval count Count of category items
* @see widget_service_enumerate_category_list()
*/
@@ -552,6 +555,7 @@ extern int widget_service_enumerate_cluster_list(int (*cb)(const char *cluster,
* @retval #WIDGET_ERROR_NONE Succeed to initialize
* @retval #WIDGET_ERROR_IO_ERROR Failed to access a DB
* @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WIDGET_ERROR_NOT_SUPPORTED Widget feature is not supported
* @see widget_service_fini()
*/
extern int widget_service_init(void);
@@ -566,6 +570,7 @@ extern int widget_service_init(void);
* @retval #WIDGET_ERROR_NONE Succeed to finalize
* @retval #WIDGET_ERROR_IO_ERROR Failed to close the DB (access failed to DB)
* @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WIDGET_ERROR_NOT_SUPPORTED Widget feature is not supported
* @pre widget_service_init.
* @see widget_service_init()
*/
@@ -583,6 +588,7 @@ extern int widget_service_fini(void);
* @return count of instances
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WIDGET_ERROR_FAULT Unrecorvarable error occurred
+ * @retval #WIDGET_ERROR_NOT_SUPPORTED Widget feature is not supported
* @retval count Positive value including ZERO, Count of activated instances on viewers
*/
extern int widget_service_get_instance_count(const char *widgetid, const char *cluster, const char *category);
@@ -626,6 +632,7 @@ extern char *widget_service_get_widget_id_by_libexec(const char *libexec);
* @privilege %http://tizen.org/privilege/widget.viewer
* @return 0 on success, otherwise a negative error value
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid handle
+ * @retval #WIDGET_ERROR_NOT_SUPPORTED Widget feature is not supported
*/
extern char *widget_service_get_base_file_path(const char *widget_id);
@@ -661,6 +668,7 @@ extern char *widget_service_get_category(const char *widgetid);
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument
* @retval #WIDGET_ERROR_IO_ERROR Failed to access DB
* @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WIDGET_ERROR_NOT_SUPPORTED Widget feature is not supported
* @see #widget_service_get_widget_list_by_pkgid
*/
extern int widget_service_get_widget_list_by_category(const char *category, int (*cb)(const char *widgetid, void *data), void *data);
@@ -702,6 +710,7 @@ extern widget_list_h widget_service_create_widget_list(const char *widgetid, wid
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument
* @retval #WIDGET_ERROR_NOT_EXIST Reach to the end of result set. you can rewind the iterator call widget_service_pkglist_create() again with current handle
* @retval #WIDGET_ERROR_MEMORY Not enough memory
+ * @retval #WIDGET_ERROR_NOT_SUPPORTED Widget feature is not supported
* @post You must release the widgetid, pkgname manually.
* @see widget_service_pkglist_create()
* @see widget_service_pkglist_destroy()
@@ -717,6 +726,7 @@ extern int widget_service_get_item_from_widget_list(widget_list_h handle, char *
* @return 0 on success, otherwise a negative error value
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid handle
* @retval #WIDGET_ERROR_NONE Successfully destroyed
+ * @retval #WIDGET_ERROR_NOT_SUPPORTED Widget feature is not supported
* @pre Handle must be created by widget_service_pkglist_create().
* @post You have not to use the handle again after destroy it.
* @see widget_service_pkglist_create()
@@ -734,9 +744,24 @@ extern int widget_service_destroy_widget_list(widget_list_h handle);
* @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WIDGET_ERROR_IO_ERROR Input/Output error (failed to access database)
* @retval #WIDGET_ERROR_FAULT Unrecorvarable error occurred
+ * @retval #WIDGET_ERROR_NOT_SUPPORTED Widget feature is not supported
*/
extern int widget_service_get_widget_max_count(const char *widget_id);
+/**
+ * @brief Getting the auto_align option
+ * @since_tizen 2.4
+ * @param[in] widget_id widget application id
+ * @return state of auto_align mode. 1 if it is turned on or 0 if it is turned off. otherwise a negative error value
+ * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIDGET_ERROR_IO_ERROR Input/Output error (failed to access database)
+ * @retval #WIDGET_ERROR_FAULT Unrecorvarable error occurred
+ * @retval #WIDGET_ERROR_NOT_SUPPORTED Widget feature is not supported
+ */
+extern int widget_service_get_auto_align(const char *widget_id);
+
+extern int widget_service_get_hw_accelerated(const char *widget_id);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/widget_conf.c b/src/widget_conf.c
index 0a8b501..6442276 100644
--- a/src/widget_conf.c
+++ b/src/widget_conf.c
@@ -66,10 +66,19 @@ static const char *CONF_DEFAULT_PATH_INPUT = DEFAULT_INPUT_NODE;
static const char *CONF_DEFAULT_SCRIPT_TYPE = "edje";
static const char *CONF_DEFAULT_ABI = "c";
static const char *CONF_DEFAULT_GBAR_GROUP = "disclosure";
+
+/**
+ * @note
+ * conf parser will not try to get LAUNCH_KEYs from conf.ini
+ * There is no parser for these values.
+ * For the future works, just leave these at here.
+ */
static const char *CONF_DEFAULT_LAUNCH_BUNDLE_NAME = "name";
static const char *CONF_DEFAULT_LAUNCH_BUNDLE_SECURED = "secured";
static const char *CONF_DEFAULT_LAUNCH_BUNDLE_ABI = "abi";
static const char *CONF_DEFAULT_LAUNCH_BUNDLE_HW_ACCELERATION = "hw-acceleration";
+static const char *CONF_DEFAULT_LAUNCH_BUNDLE_AUTO_ALIGN = "auto-align";
+
static const char *CONF_DEFAULT_CONTENT = "default";
static const char *CONF_DEFAULT_TITLE = "";
static const char *CONF_DEFAULT_EMPTY_CONTENT = "";
@@ -157,6 +166,7 @@ struct widget_conf {
char *secured;
char *abi;
char *hw_acceleration;
+ char *auto_align;
} launch_key;
double default_packet_time;
@@ -1028,6 +1038,7 @@ EAPI void widget_conf_init(void)
s_conf.launch_key.secured = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_SECURED;
s_conf.launch_key.abi = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_ABI;
s_conf.launch_key.hw_acceleration = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_HW_ACCELERATION;
+ s_conf.launch_key.auto_align = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_AUTO_ALIGN;
s_conf.empty_content = (char *)CONF_DEFAULT_EMPTY_CONTENT;
s_conf.empty_title = (char *)CONF_DEFAULT_EMPTY_TITLE;
s_conf.default_content = (char *)CONF_DEFAULT_CONTENT;
@@ -1687,6 +1698,11 @@ EAPI void widget_conf_reset(void)
s_conf.launch_key.hw_acceleration = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_HW_ACCELERATION;
}
+ if (s_conf.launch_key.auto_align != CONF_DEFAULT_LAUNCH_BUNDLE_AUTO_ALIGN) {
+ free(s_conf.launch_key.auto_align);
+ s_conf.launch_key.auto_align = (char *)CONF_DEFAULT_LAUNCH_BUNDLE_AUTO_ALIGN;
+ }
+
if (s_conf.empty_content != CONF_DEFAULT_EMPTY_CONTENT) {
free(s_conf.empty_content);
s_conf.empty_content = (char *)CONF_DEFAULT_EMPTY_CONTENT;
@@ -2025,6 +2041,11 @@ EAPI const char * const widget_conf_launch_key_name(void)
return s_conf.launch_key.name;
}
+EAPI const char * const widget_conf_launch_key_auto_align(void)
+{
+ return s_conf.launch_key.auto_align;
+}
+
EAPI const char * const widget_conf_launch_key_secured(void)
{
return s_conf.launch_key.secured;
diff --git a/src/widget_service.c b/src/widget_service.c
index 7494945..0883a74 100644
--- a/src/widget_service.c
+++ b/src/widget_service.c
@@ -2817,6 +2817,120 @@ out:
return category;
}
+EAPI int widget_service_get_hw_accelerated(const char *widget_id)
+{
+ sqlite3_stmt *stmt;
+ sqlite3 *handle;
+ int ret = WIDGET_ERROR_FAULT;
+ const char *acceleration;
+
+ if (!is_widget_feature_enabled()) {
+ return WIDGET_ERROR_NOT_SUPPORTED;
+ }
+
+ if (!widget_id) {
+ return WIDGET_ERROR_INVALID_PARAMETER;
+ }
+
+ handle = open_db();
+ if (!handle) {
+ return WIDGET_ERROR_IO_ERROR;
+ }
+
+ ret = sqlite3_prepare_v2(handle, "SELECT hw_acceleration FROM provider WHERE pkgid = ?", -1, &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ ErrPrint("Error: %s, widget(%s), ret(%d)\n", sqlite3_errmsg(handle), widget_id, ret);
+ ret = WIDGET_ERROR_IO_ERROR;
+ goto out;
+ }
+
+ ret = sqlite3_bind_text(stmt, 1, widget_id, -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ ErrPrint("Error: %s, widget(%s), ret(%d)\n", sqlite3_errmsg(handle), widget_id, ret);
+ sqlite3_finalize(stmt);
+ goto out;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret != SQLITE_ROW) {
+ if (ret == SQLITE_DONE) {
+ ret = WIDGET_ERROR_NOT_EXIST;
+ } else {
+ ret = WIDGET_ERROR_IO_ERROR;
+ }
+ ErrPrint("Error: %s, widget(%s), ret(%d)\n", sqlite3_errmsg(handle), widget_id, ret);
+ sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
+ goto out;
+ }
+
+ acceleration = (char *)sqlite3_column_text(stmt, 0);
+ ret = (acceleration && !strcasecmp(acceleration, "use-gl"));
+
+ sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
+
+out:
+ close_db(handle);
+ return ret;
+}
+
+EAPI int widget_service_get_auto_align(const char *widget_id)
+{
+ sqlite3_stmt *stmt;
+ sqlite3 *handle;
+ int ret = WIDGET_ERROR_FAULT;
+
+ if (!is_widget_feature_enabled()) {
+ return WIDGET_ERROR_NOT_SUPPORTED;
+ }
+
+ if (!widget_id) {
+ return WIDGET_ERROR_INVALID_PARAMETER;
+ }
+
+ handle = open_db();
+ if (!handle) {
+ return WIDGET_ERROR_IO_ERROR;
+ }
+
+ ret = sqlite3_prepare_v2(handle, "SELECT auto_align FROM provider WHERE pkgid = ?", -1, &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ ErrPrint("Error: %s, widget(%s), ret(%d)\n", sqlite3_errmsg(handle), widget_id, ret);
+ ret = WIDGET_ERROR_IO_ERROR;
+ goto out;
+ }
+
+ ret = sqlite3_bind_text(stmt, 1, widget_id, -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ ErrPrint("Error: %s, widget(%s), ret(%d)\n", sqlite3_errmsg(handle), widget_id, ret);
+ sqlite3_finalize(stmt);
+ goto out;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret != SQLITE_ROW) {
+ if (ret == SQLITE_DONE) {
+ ret = WIDGET_ERROR_NOT_EXIST;
+ } else {
+ ret = WIDGET_ERROR_IO_ERROR;
+ }
+ ErrPrint("Error: %s, widget(%s), ret(%d)\n", sqlite3_errmsg(handle), widget_id, ret);
+ sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
+ goto out;
+ }
+
+ ret = sqlite3_column_int(stmt, 0);
+
+ sqlite3_reset(stmt);
+ sqlite3_finalize(stmt);
+
+out:
+ close_db(handle);
+ return ret;
+}
+
EAPI int widget_service_get_widget_max_count(const char *widget_id)
{
sqlite3_stmt *stmt;