+static gboolean
+_launch_screen_reader(A11yBusLauncher *bl)
+{
+ bundle *kb = NULL;
+ gboolean ret = FALSE;
+
+ kb = bundle_create();
+ if (kb == NULL)
+ return FALSE;
+
+ appsvc_set_operation(kb, APP_CONTROL_OPERATION_SCREEN_READ);
+
+ bl->pid = appsvc_usr_run_service(kb, 0, NULL, NULL, getuid());
+ if (bl->pid >= 0) {
+ ret = TRUE;
+ }
+
+ bundle_free(kb);
+ return ret;
+}
+
+static gboolean
+_terminate_screen_reader(A11yBusLauncher *bl)
+{
+ int ret;
+ if (bl->pid <= 0)
+ return FALSE;
+
+ LOGD("terminate process with pid %d", bl->pid);
+ if (!aul_terminate_pid(bl->pid))
+ {
+ bl->pid = 0;
+ return TRUE;
+ }
+
+ LOGD("Unable to terminate process using aul api. Sending SIGTERM signal");
+ ret = kill(bl->pid, SIGTERM);
+ if (!ret)
+ {
+ bl->pid = 0;
+ return TRUE;
+ }
+
+ LOGD("Unable to terminate process: %d with api or signal.", bl->pid);
+ return FALSE;
+}
+
+void screen_reader_cb(keynode_t *node, void *user_data)
+{
+ A11yBusLauncher *bl = user_data;
+ int ret;
+
+ ret = vconf_keynode_get_bool(node);
+ if (ret < 0)
+ return;
+
+ bl->screen_reader_needed = ret;
+
+ if (!bl->screen_reader_needed && (bl->pid > 0))
+ _terminate_screen_reader(bl);
+ else if (bl->screen_reader_needed && (bl->pid <= 0))
+ _launch_screen_reader(bl);
+}
+