MCPcopy Create free account
hub / github.com/M66B/FairEmail / ServiceTTS

Class ServiceTTS

app/src/main/java/eu/faircode/email/ServiceTTS.java:40–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38import java.util.Locale;
39
40public class ServiceTTS extends ServiceBase {
41 private Integer status = null;
42 private TextToSpeech instance = null;
43 private final List<Runnable> queue = new ArrayList<>();
44 private final Object lock = new Object();
45
46 static final String EXTRA_FLUSH = "flush";
47 static final String EXTRA_TEXT = "text";
48 static final String EXTRA_LANGUAGE = "language";
49 static final String EXTRA_UTTERANCE_ID = "utterance";
50 static final String EXTRA_MESSAGE = "message";
51 static final String EXTRA_GROUP = "group";
52
53 static final String ACTION_TTS_COMPLETED = BuildConfig.APPLICATION_ID + ".TTS";
54
55 static final int PI_TTS = 1;
56 static final int PI_FLUSH = 2;
57
58 @Override
59 public void onCreate() {
60 Log.i("Service TTS create");
61 super.onCreate();
62 try {
63 startForeground(NotificationHelper.NOTIFICATION_TTS, getNotification("tts:0"));
64 } catch (Throwable ex) {
65 if (Helper.isPlayStoreInstall())
66 Log.i(ex);
67 else
68 Log.e(ex);
69 }
70 }
71
72 @Override
73 public void onTimeout(int startId) {
74 String msg = "onTimeout" +
75 " class=" + this.getClass().getName() +
76 " ignoring=" + Helper.isIgnoringOptimizations(this);
77 Log.e(new Throwable(msg));
78 EntityLog.log(this, EntityLog.Type.Debug3, msg);
79 stopSelf();
80 }
81
82 @Override
83 public void onDestroy() {
84 Log.i("Service TTS destroy");
85 stopForeground(true);
86 super.onDestroy();
87 CoalMine.watch(this, this.getClass().getName() + "#onDestroy");
88 }
89
90 @Override
91 public int onStartCommand(Intent intent, int flags, int startId) {
92 EntityLog.log(this, "Service TTS intent=" + intent);
93 Log.logExtras(intent);
94
95 super.onStartCommand(intent, flags, startId);
96
97 if (intent == null)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected