Check vconf value at init time 00/137200/1 accepted/tizen/unified/20170717.170152 submit/tizen/20170713.122748 submit/tizen/20170714.014828
authorShinwoo Kim <cinoo.kim@samsung.com>
Tue, 4 Jul 2017 23:00:41 +0000 (08:00 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Wed, 5 Jul 2017 01:22:24 +0000 (10:22 +0900)
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
packaging/e-mod-tizen-screen-reader.spec
src/e_mod_main.c

index 3f91ec6..c38c72e 100644 (file)
@@ -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)
index b76c8cd..feb9ede 100644 (file)
@@ -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.
index 133fb2d..ccaa2ac 100644 (file)
@@ -3,6 +3,7 @@
 #include "e_mod_main.h"
 #include <e_screen_reader_config.h>
 #include <e_screen_reader_private.h>
+#include <vconf.h>
 
 #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.");