summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAssam Boudjelthia <assam.boudjelthia@qt.io>2022-05-17 17:30:10 +0300
committerAssam Boudjelthia <assam.boudjelthia@qt.io>2022-05-18 11:09:58 +0300
commitdc74d01e8142ca8b4063a77007d3dff1239b4fe7 (patch)
treee9c1097405879513f3b6b7ebfefa5e0721217837
parentc8cf3f6897e08eca79ffb69a068171ca233bbdc0 (diff)
Android: change some warning messages to debug instead
Some of the warnings message thrown by Java code are not really warnings but rather debug messages, and thus they pollute the logs, this fixes that. Also, defines the commonly used log tag into common variable. Change-Id: I74f975dd0984f3ca73692c38ba898d417fd6e7bf Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--src/plugins/tts/android/jar/src/org/qtproject/qt/android/speech/QtTextToSpeech.java26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/plugins/tts/android/jar/src/org/qtproject/qt/android/speech/QtTextToSpeech.java b/src/plugins/tts/android/jar/src/org/qtproject/qt/android/speech/QtTextToSpeech.java
index 5faf808..60fa8e7 100644
--- a/src/plugins/tts/android/jar/src/org/qtproject/qt/android/speech/QtTextToSpeech.java
+++ b/src/plugins/tts/android/jar/src/org/qtproject/qt/android/speech/QtTextToSpeech.java
@@ -68,26 +68,29 @@ public class QtTextToSpeech
private float mRate = 1.0f;
private float mVolume = 1.0f;
+ private String TAG = "QtTextToSpeech";
// OnInitListener
private final OnInitListener mTtsChangeListener = new OnInitListener() {
@Override
public void onInit(int status) {
- Log.w("QtTextToSpeech", "tts initialized");
if (status == TextToSpeech.SUCCESS) {
mInitialized = true;
notifyReady(mId);
+ Log.d(TAG, "TTS initialized");
} else {
mInitialized = false;
notifyError(mId);
+ Log.w(TAG, "TTS initialization failed");
}
}
};
+ private String utteranceTAG = "UtteranceProgressListener";
// UtteranceProgressListener
private final UtteranceProgressListener mTtsUtteranceProgressListener = new UtteranceProgressListener() {
@Override
public void onDone(String utteranceId) {
- Log.w("UtteranceProgressListener", "onDone");
+ Log.d(utteranceTAG, "onDone");
if (utteranceId.equals("UtteranceId")) {
notifyReady(mId);
}
@@ -95,7 +98,7 @@ public class QtTextToSpeech
@Override
public void onError(String utteranceId) {
- Log.w("UtteranceProgressListener", "onError");
+ Log.w(utteranceTAG, "onError");
if (utteranceId.equals("UtteranceId")) {
notifyReady(mId);
}
@@ -103,7 +106,7 @@ public class QtTextToSpeech
@Override
public void onStart(String utteranceId) {
- Log.w("UtteranceProgressListener", "onStart");
+ Log.d(utteranceTAG, "onStart");
if (utteranceId.equals("UtteranceId")) {
notifySpeaking(mId);
}
@@ -140,8 +143,7 @@ public class QtTextToSpeech
public void say(String text)
{
- Log.w("QtTextToSpeech", text);
-
+ Log.d(TAG, "TTS say(): " + text);
int result = -1;
HashMap<String, String> map = new HashMap<String, String>();
@@ -149,12 +151,12 @@ public class QtTextToSpeech
map.put(TextToSpeech.Engine.KEY_PARAM_VOLUME, Float.toString(mVolume));
result = mTts.speak(text, TextToSpeech.QUEUE_FLUSH, map);
- Log.w("QtTextToSpeech", "RESULT: " + Integer.toString(result));
+ Log.d(TAG, "TTS say() result: " + Integer.toString(result));
}
public void stop()
{
- Log.w("QtTextToSpeech", "STOP");
+ Log.d(TAG, "Stopping TTS");
mTts.stop();
}
@@ -220,7 +222,7 @@ public class QtTextToSpeech
public List<Object> getAvailableVoices()
{
if (mInitialized && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
- //Log.d("QtTextToSpeech", "Voices: " + mTts.getVoices());
+ //Log.d(TAG, "Voices: " + mTts.getVoices());
return new ArrayList<Object>(mTts.getVoices());
}
return new ArrayList<Object>();
@@ -229,7 +231,7 @@ public class QtTextToSpeech
public List<Locale> getAvailableLocales()
{
if (mInitialized && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
- //Log.d("QtTextToSpeech", "Locales: " + mTts.getAvailableLanguages());
+ //Log.d(TAG, "Locales: " + mTts.getAvailableLanguages());
final Set<Locale> languages = mTts.getAvailableLanguages();
ArrayList<Locale> locales = new ArrayList<Locale>();
@@ -252,7 +254,7 @@ public class QtTextToSpeech
public Locale getLocale()
{
- //Log.d("QtTextToSpeech", "getLocale: " + mLocale);
+ //Log.d(TAG, "getLocale: " + mLocale);
final Locale language = mTts.getLanguage();
String languageCode = language.getLanguage();
String countryCode = language.getCountry();
@@ -282,7 +284,7 @@ public class QtTextToSpeech
if (voice.getName().equals(voiceName)) {
int result = mTts.setVoice(voice);
if (result == TextToSpeech.SUCCESS) {
- //Log.d("QtTextToSpeech", "setVoice: " + voice);
+ //Log.d(TAG, "setVoice: " + voice);
return true;
}
break;