am 24943bf1: Failing Text-To-Speech CTS tests fix.

* commit '24943bf19d3d000f9f5840513526b48523b62c71':
  Failing Text-To-Speech CTS tests fix.
This commit is contained in:
Przemyslaw Szczepaniak
2013-03-13 17:37:42 +00:00
committed by Android Git Automerger

View File

@@ -810,9 +810,15 @@ public abstract class TextToSpeechService extends Service {
return TextToSpeech.ERROR;
}
// In test env, ParcelFileDescriptor instance may be EXACTLY the same
// one that is used by client. And it will be closed by a client, thus
// preventing us from writing anything to it.
final ParcelFileDescriptor sameFileDescriptor = ParcelFileDescriptor.adoptFd(
fileDescriptor.detachFd());
SpeechItem item = new SynthesisToFileOutputStreamSpeechItem(caller,
Binder.getCallingUid(), Binder.getCallingPid(), params, text,
new ParcelFileDescriptor.AutoCloseOutputStream(fileDescriptor));
new ParcelFileDescriptor.AutoCloseOutputStream(sameFileDescriptor));
return mSynthHandler.enqueueSpeechItem(TextToSpeech.QUEUE_ADD, item);
}