MockableTextToSpeechService.IDelegate delegate =
MockableTextToSpeechService.getMocker();
ArrayList<String> availableLangs = delegate.getAvailableVoices();
ArrayList<String> unavailableLangs = delegate.getUnavailableVoices();
final Intent returnVal = new Intent();
// Returns early.
if (availableLangs == null) {
setResult(TextToSpeech.Engine.CHECK_VOICE_DATA_FAIL, returnVal);
finish();
return;
}
returnVal.putStringArrayListExtra(TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES,
availableLangs);
if (unavailableLangs != null && unavailableLangs.size() > 0) {
returnVal.putStringArrayListExtra(TextToSpeech.Engine.EXTRA_UNAVAILABLE_VOICES,
unavailableLangs);
}
setResult(TextToSpeech.Engine.CHECK_VOICE_DATA_PASS, returnVal);
finish();