Add a new TTS Interrupt mode
[platform/core/uifw/tts.git] / server / ttsd_server.c
index 2734b0b..24365e5 100644 (file)
@@ -851,6 +851,19 @@ int ttsd_server_play(int uid, const char* credential)
                }
        }
 
+       /* check the current playback focus */
+       if (TTSD_MODE_INTERRUPT != ttsd_get_mode()) {
+               bool is_current_interrupt = false;
+               if (0 != ttsd_player_check_current_playback_focus(&is_current_interrupt)) {
+                       SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to check the current playback focus");
+               } else {
+                       if (true == is_current_interrupt) {
+                               SLOG(LOG_WARN, tts_tag(), "[Server WARNING] Current playback focus is set on Interrupt mode. Cannot play default, screen reader, and noti modes.");
+                               return TTSD_ERROR_AUDIO_POLICY_BLOCKED;
+                       }
+               }
+       }
+
        int current_uid = ttsd_data_get_current_playing();
        SLOG(LOG_INFO, tts_tag(), "[Server] playing uid (%d)", current_uid);