forked from upstream-mirrors/OpenTracks
Fixing TTS initialization.
This commit is contained in:
@@ -44,7 +44,8 @@ public class SignalStrengthTask extends PhoneStateListener
|
|||||||
public SignalStrengthTask(Context c) {
|
public SignalStrengthTask(Context c) {
|
||||||
context = c;
|
context = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
manager =
|
manager =
|
||||||
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
@@ -176,6 +177,7 @@ public class SignalStrengthTask extends PhoneStateListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
if (manager != null) {
|
if (manager != null) {
|
||||||
manager.listen(this, PhoneStateListener.LISTEN_NONE);
|
manager.listen(this, PhoneStateListener.LISTEN_NONE);
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ public class StatusAnnouncerTask implements PeriodicTask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
|
Log.i(MyTracksConstants.TAG, "Starting TTS");
|
||||||
if (tts == null) {
|
if (tts == null) {
|
||||||
// We can't have this class also be the listener, otherwise it's unsafe to
|
// We can't have this class also be the listener, otherwise it's unsafe to
|
||||||
// reference it in Cupcake (even if we don't instantiate it).
|
// reference it in Cupcake (even if we don't instantiate it).
|
||||||
@@ -243,6 +244,8 @@ public class StatusAnnouncerTask implements PeriodicTask {
|
|||||||
tts.shutdown();
|
tts.shutdown();
|
||||||
tts = null;
|
tts = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.i(MyTracksConstants.TAG, "TTS shut down");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -49,7 +49,8 @@ public class TaskExecuterManager {
|
|||||||
*/
|
*/
|
||||||
public void setFrequency(int frequency, TrackRecordingService service) {
|
public void setFrequency(int frequency, TrackRecordingService service) {
|
||||||
this.frequency = frequency;
|
this.frequency = frequency;
|
||||||
Log.i(MyTracksConstants.TAG, "Frequency set to: " + frequency);
|
Log.i(MyTracksConstants.TAG, "Frequency set to " + frequency
|
||||||
|
+ " for task " + task.getClass().getSimpleName());
|
||||||
|
|
||||||
if (frequency == -1) {
|
if (frequency == -1) {
|
||||||
if (executer != null) {
|
if (executer != null) {
|
||||||
|
|||||||
@@ -679,6 +679,9 @@ public class TrackRecordingService extends Service implements LocationListener {
|
|||||||
if (announcer == null) {
|
if (announcer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Either use TaskExecuterManager everywhere, or get rid of it
|
||||||
|
announcer.start();
|
||||||
announcementExecuter = new PeriodicTaskExecuter(announcer,
|
announcementExecuter = new PeriodicTaskExecuter(announcer,
|
||||||
TrackRecordingService.this);
|
TrackRecordingService.this);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user