This is caused by the Voice features being set to null. The fix in
Android Marshmallow is to make onGetFeaturesForLanguage return an
empty HashSet object. This does not work for eSpeak because:
1. eSpeak was overriding onGetVoices and initializing each Voice's
features to null;
2. the bug is still present on Lollipop.
Thus, the fix here is two-fold:
1. make onGetVoices use onGetFeaturesForLanguage;
2. make onGetFeaturesForLanguage return an empty HashSet, so that
eSpeak does not crash on Lollipop either.
The Android 5.0 Text-to-speech output settings dialog checks that
the languages from CheckVoiceData use the ISO3 language and
country codes. This change matches that expectation.
This changes the getLanguage helper to return the result from
getLanguage on all platform versions, disabling the deprecated
message on API 21 and above.
This creates a custom hamcrest matcher that maps the TextToSpeech
LANG_* constants to strings. This makes it easier to read the
text output when the tests fail.
The Android 4.x+ code has changed a lot since the initial import
of the eyes-free codebase. A lot of bug fixes and improvements
have been made to it.
The eyes-free codebase had two different code paths:
* one for ICS (4.0) or later, using the Java-based TTS APIs
provided by the Android platform;
* one for pre-ICS using an internal C++-based TTS API.
Thus, any bug fixes or improvements would have to be done to both
code bases if Android 2.x/3.x support is required. This is not
maintainable.
If pre-ICS support is to be re-added in the future, the plan will
be to:
* forward the C++-based APIs to the Java-based APIs via a
compatibility layer;
* use a compatibility layer (Android Support Library?) for using
the ICS settings API on pre-ICS.