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
This commit is contained in:
Alex Agranovich
2021-03-02 11:31:11 +02:00
parent 454771de8e
commit a95fc29ec6
2 changed files with 3 additions and 4 deletions

View File

@@ -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);
}
});

View File

@@ -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);
}
}