From a95fc29ec65e438a29b1484ad3a85ccb6fddf1e6 Mon Sep 17 00:00:00 2001 From: Alex Agranovich Date: Tue, 2 Mar 2021 11:31:11 +0200 Subject: [PATCH] Fix TextToSpeech system connection error handling This CL fixes client listener notification upon engine binding error. In addition fixes logs verbosity for errors caused by calls on dead client. Bug: 183085464 Test: atest CtsSpeechTestCases Change-Id: Ic67e97befd87f841430a53993ae5c79d81a0f6ba --- core/java/android/speech/tts/TextToSpeech.java | 5 ++--- .../texttospeech/TextToSpeechManagerPerUserService.java | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java index 78e5eabb69a8b..7e8622a0e6946 100644 --- a/core/java/android/speech/tts/TextToSpeech.java +++ b/core/java/android/speech/tts/TextToSpeech.java @@ -2427,9 +2427,8 @@ public class TextToSpeech { @Override public void onError(String errorInfo) { Log.w(TAG, "System TTS connection error: " + errorInfo); - // The connection was not established successfully - handle as - // disconnection: clear the state and notify the user. - onServiceDisconnected(/* componentName= */ null); + // There is an error connecting to the engine - notify the listener. + dispatchOnInit(ERROR); } }); diff --git a/services/texttospeech/java/com/android/server/texttospeech/TextToSpeechManagerPerUserService.java b/services/texttospeech/java/com/android/server/texttospeech/TextToSpeechManagerPerUserService.java index f80590420d098..55cbc7261e648 100644 --- a/services/texttospeech/java/com/android/server/texttospeech/TextToSpeechManagerPerUserService.java +++ b/services/texttospeech/java/com/android/server/texttospeech/TextToSpeechManagerPerUserService.java @@ -174,7 +174,7 @@ final class TextToSpeechManagerPerUserService extends try { callbackRunnable.runOrThrow(); } catch (RemoteException ex) { - Slog.w(TAG, "Failed running callback method", ex); + Slog.i(TAG, "Failed running callback method: " + ex); } }