1 // Copyright 2011 Google Inc. All Rights Reserved.
2 
3 package android.speech.tts;
4 
5 import android.speech.tts.TextToSpeechService.UtteranceProgressDispatcher;
6 
7 abstract class PlaybackQueueItem implements Runnable {
8     private final UtteranceProgressDispatcher mDispatcher;
9     private final Object mCallerIdentity;
10 
PlaybackQueueItem(TextToSpeechService.UtteranceProgressDispatcher dispatcher, Object callerIdentity)11     PlaybackQueueItem(TextToSpeechService.UtteranceProgressDispatcher dispatcher,
12             Object callerIdentity) {
13         mDispatcher = dispatcher;
14         mCallerIdentity = callerIdentity;
15     }
16 
getCallerIdentity()17     Object getCallerIdentity() {
18         return mCallerIdentity;
19     }
20 
getDispatcher()21     protected UtteranceProgressDispatcher getDispatcher() {
22         return mDispatcher;
23     }
24 
25     @Override
run()26     public abstract void run();
27 
28     /**
29      * Stop the playback.
30      *
31      * @param errorCode Cause of the stop. Can be either one of the error codes from
32      *         {@link android.speech.tts.TextToSpeech} or
33      *         {@link android.speech.tts.TextToSpeech#STOPPED}
34      *         if stopped on a client request.
35      */
stop(int errorCode)36     abstract void stop(int errorCode);
37 }
38