Add a checker of screen reader in tts_prepare() 09/245209/1
authorsooyeon.kim <sooyeon.kim@samsung.com>
Fri, 11 Sep 2020 08:08:31 +0000 (17:08 +0900)
committerSooyeon Kim <sooyeon.kim@samsung.com>
Mon, 5 Oct 2020 10:44:04 +0000 (10:44 +0000)
Change-Id: I81cec68c66ea2e2daf0b81cce69c583a5d305970
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
(cherry picked from commit 727a0aea05ec1a044278cfcc81aa3aac0f2e1e5d)

client/tts.c

index f8f1862..f90c470 100644 (file)
@@ -1183,6 +1183,22 @@ static Eina_Bool __send_hello(void *data)
                return EINA_FALSE;
        }
 
+       /* check screen reader */
+       int ret = -1;
+       if (TTS_MODE_SCREEN_READER == client->mode) {
+               ret = __tts_recheck_screen_reader();
+               if (0 != ret) {
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to get screen reader vconf(%d)", ret);
+               } else {
+                       if (false == g_screen_reader) {
+                               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Screen reader option is NOT available. Do not request to prepare");
+                               client->hello_timer = NULL;
+                               g_prepare_timer = NULL;
+                               return EINA_FALSE;
+                       }
+               }
+       }
+
        SLOG(LOG_ERROR, TAG_TTSC, "[INFO] tts_h(%p), tts_client(%p), uid(%d)", tts, client, client->uid);
 
        bool is_launched = __is_engine_launched(g_engine_appid);
@@ -1203,7 +1219,7 @@ static Eina_Bool __send_hello(void *data)
        }
 
        /* Send hello */
-       int ret = tts_dbus_request_hello(client->uid);
+       ret = tts_dbus_request_hello(client->uid);
        if (0 != ret)  {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request hello !!"); //LCOV_EXCL_LINE
        } else {
@@ -1258,6 +1274,21 @@ int tts_prepare(tts_h tts)
                return TTS_ERROR_INVALID_STATE;
        }
 
+       int ret = -1;
+       if (false == g_screen_reader && TTS_MODE_SCREEN_READER == client->mode) {
+               /* check screen reader option one more time */
+               ret = __tts_recheck_screen_reader();
+               if (0 != ret) {
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to get screen reader vconf(%d)", ret);
+                       return TTS_ERROR_INVALID_STATE;
+               } else {
+                       if (false == g_screen_reader) {
+                               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Screen reader option is NOT available.");
+                               return TTS_ERROR_INVALID_STATE;
+                       }
+               }
+       }
+
        SLOG(LOG_ERROR, TAG_TTSC, "[INFO] tts_h(%p), tts_client(%p), uid(%d)", tts, client, client->uid);
 
        if (NULL == client->hello_timer) {