Make the app single process only, including the following fixes:

1) Simplify SharedPreferences management
2) Shut down signalManager/splitManager to avoid random crashes
3) Get rid of sharedPreferencesChanged from the service interface

All tests pass.
This commit is contained in:
Bartlomiej Niechwiej
2010-11-17 22:18:50 -08:00
parent 9cf51de3f7
commit 7a693a90f7
8 changed files with 58 additions and 219 deletions
@@ -15,10 +15,10 @@
*/
package com.google.android.apps.mytracks.services;
import android.util.Log;
import com.google.android.apps.mytracks.MyTracksConstants;
import android.util.Log;
/**
* This class will manage a period task executer.
*
@@ -26,13 +26,12 @@ import com.google.android.apps.mytracks.MyTracksConstants;
*/
public class TaskExecuterManager {
int frequency;
PeriodicTask task;
PeriodicTaskExecuter executer;
private int frequency;
private PeriodicTask task;
private PeriodicTaskExecuter executer;
public TaskExecuterManager(int frequency,
PeriodicTask task,
TrackRecordingService service) {
public TaskExecuterManager(int frequency, PeriodicTask task,
TrackRecordingService service) {
this.task = task;
setFrequency(frequency, service);
}
@@ -69,7 +68,7 @@ public class TaskExecuterManager {
}
/**
* Restore the task at the current frequency.
* Restores the task at the current frequency.
*/
public void restore() {
if (frequency > 0) {
@@ -77,4 +76,13 @@ public class TaskExecuterManager {
executer.scheduleTask(frequency * 60000);
}
}
/**
* Shuts down this executer.
*/
public void shutdown() {
if (executer != null) {
executer.shutdown();
}
}
}