Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catch and report TTS errors #5561

Merged
merged 2 commits into from
Oct 23, 2019
Merged

Conversation

stephankn
Copy link
Contributor

Purpose / Description

implement onError() to report a Toast with some hints to the user
in case the TTS engine returns an error.

From API 21 upwards we would also have the error code available
for further details on what happened.

Fixes

fixes #5468

Approach

report a Toast

How Has This Been Tested?

Tested on emulator

Checklist

  • You have not changed whitespace unnecessarily (it makes diffs hard to read)
  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • Your code follows the style of the project (e.g. never omit braces in if statements)
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code

implement onError() to report a Toast with some hints to the user
in case the TTS engine returns an error.

From API 21 upwards we would also have the error code available
for further details on what happened.
Copy link
Member

@timrae timrae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too bad that we don't get the error code. Theoretically it should be available on higher APIs, however when I inspected the Android source code, it seemed that the non-deprecated callback is never called. Maybe I'm just looking in the wrong place? :/

AnkiDroid/src/main/java/com/ichi2/anki/ReadText.java Outdated Show resolved Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/ReadText.java Outdated Show resolved Hide resolved
@stephankn
Copy link
Contributor Author

Too bad that we don't get the error code. Theoretically it should be available on higher APIs, however when I inspected the Android source code, it seemed that the non-deprecated callback is never called. Maybe I'm just looking in the wrong place? :/

I guess I ended up at the same location than you when checking the source code. This was the point when I told to myself "I don't understand the API deprecation concept of Android".
Probably we would have to override the calling code as well, depending on the API level?
I feel uncomfortable doing that change.

The error codes are probably not that important anyways. At this point you already know that the problem happened outside of the scope of Anki. If simply re-installing the TTS does not help, then Android TTS needs to be debugged. Maybe attaching the phone to a PC and reading the logs with ADB is the way to go then. But as said, this is beyond the scope of Anki, as TTS is globally broken.

In case TTS output fails display a Snackbar with an error
message and a help link pointing to the FAQ with recovery
instructions.
@stephankn stephankn requested a review from timrae October 22, 2019 20:48
@stephankn
Copy link
Contributor Author

please review again. Travis fail does not sound related to my change.

@mikehardy
Copy link
Member

agreed re: Travis - that's an area of current work for me, I'm manually shepherding CI status on this PR to both see what flakes on it and make sure it goes green

@mikehardy
Copy link
Member

Travis was suffering through a "Major Outage" on their Google Compute Engine services, which is where our builds are routed in their system, complicating matters. CI's green now

@stephankn stephankn requested a review from timrae October 23, 2019 12:10
@timrae timrae merged commit daa8b7f into ankidroid:master Oct 23, 2019
timrae added a commit that referenced this pull request Oct 27, 2019
* catch and report TTS errors

implement onError() to report a Toast with some hints to the user
in case the TTS engine returns an error.

From API 21 upwards we would also have the error code available
for further details on what happened.

* Display Snackbar for failing TTS

In case TTS output fails display a Snackbar with an error
message and a help link pointing to the FAQ with recovery
instructions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TTS output failed without error message (fix described inside)
3 participants