From cc5d3cb56bf2d2a8ba8a9a8ae9841cab1fac47b2 Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Wed, 5 Jul 2017 08:00:41 +0900 Subject: [PATCH] Check vconf value at init time The _elm_atspi_bridge_init is moved to elm_run from elm_init because of security issue. The at-spi-bus-launcher is launched by D-Bus activation. The "org.a11y.Bus" which is used for the D-Bus activation would be used after the elm_run is called. The at-spi-bus-launcher launches screen-reader AT client. The screen-reader AT client requests that screen-reader WM module works. Before this point, the user input is not consumed by screen-reader WM module. So it is possible to control the first appliction (home-screen) by user input. [Vconf Dependency] The enlightenment already has dependency on vconf as below. So this patch set does NOT need more library loading time which could cause the late launching time issue. sh-3.2# cat /proc/313/maps | grep vconf b5f2e000-b5f32000 r-xp 00000000 b3:1a 6053 /usr/lib/libvconf.so.0.3.1 b5f32000-b5f41000 ---p 00004000 b3:1a 6053 /usr/lib/libvconf.so.0.3.1 b5f41000-b5f42000 rw-p 00003000 b3:1a 6053 /usr/lib/libvconf.so.0.3.1 Change-Id: I0278a67e018d666325a93fb37e7eb66c95647e64 --- configure.ac | 2 +- packaging/e-mod-tizen-screen-reader.spec | 1 + src/e_mod_main.c | 54 ++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 3f91ec6..c38c72e 100644 --- a/configure.ac +++ b/configure.ac @@ -62,7 +62,7 @@ dnl ======================================================================== # checks for pkg-config dnl ======================================================================== -PKG_CHECK_MODULES(ENLIGHTENMENT, [enlightenment, dlog]) +PKG_CHECK_MODULES(ENLIGHTENMENT, [enlightenment, dlog, vconf]) AC_SUBST(ENLIGHTENMENT_CFLAGS) AC_SUBST(ENLIGHTENMENT_LIBS) diff --git a/packaging/e-mod-tizen-screen-reader.spec b/packaging/e-mod-tizen-screen-reader.spec index b76c8cd..feb9ede 100644 --- a/packaging/e-mod-tizen-screen-reader.spec +++ b/packaging/e-mod-tizen-screen-reader.spec @@ -8,6 +8,7 @@ Source0: %{name}-%{version}.tar.gz License: BSD-2-Clause BuildRequires: pkgconfig(enlightenment) BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(vconf) %description This package is a screen-reader module for Tizen enlightenment. diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 133fb2d..ccaa2ac 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -3,6 +3,7 @@ #include "e_mod_main.h" #include #include +#include #define E_A11Y_SERVICE_BUS_NAME "org.enlightenment.wm-screen-reader" #define E_A11Y_SERVICE_NAVI_IFC_NAME "org.tizen.GestureNavigation" @@ -389,6 +390,53 @@ void _e_mod_log_shutdown(void) } } +void screen_reader_cb(keynode_t *node, void *user_data) +{ + int is_sr_enabled; + + is_sr_enabled = vconf_keynode_get_bool(node); + DEBUG("vconf_keynode_get_bool(node): %d", is_sr_enabled); + + if (is_sr_enabled < 0) + { + ERROR("Could not read VCONFKEY_SETAPPL_ACCESSIBILITY_TTS key value.\n"); + return; + } + + DEBUG("screen reader: %d", is_sr_enabled); + if (is_sr_enabled) + _e_mod_submodules_init(); + else + _e_mod_submodules_shutdown(); +} + +Eina_Bool _e_mod_atspi_vconf_init(void) +{ + int ret; + int is_sr_enabled; + + ret = vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &is_sr_enabled); + if (ret != 0) + { + ERROR("Could not read VCONFKEY_SETAPPL_ACCESSIBILITY_TTS key value.\n"); + return EINA_FALSE; + } + + ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, screen_reader_cb, NULL); + if(ret != 0) + { + ERROR("Could not add information level callback\n"); + return EINA_FALSE; + } + + if (is_sr_enabled) + _e_mod_submodules_init(); + else + _e_mod_submodules_shutdown(); + + return EINA_TRUE; +} + EAPI void * e_modapi_init(E_Module *m) { @@ -396,6 +444,12 @@ e_modapi_init(E_Module *m) if (_e_mod_atspi_dbus_init()) goto fail; + if (!_e_mod_atspi_vconf_init()) + { + _e_mod_atspi_dbus_shutdown(); + goto fail; + } + return m; fail: ERROR("Dbus initialization failed."); -- 2.7.4