|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectandroid.content.Context
android.content.ContextWrapper
android.app.Service
org.android.activityminer.app.service.BackgroundService
public class BackgroundService
The service for asynchronous background tasks.
Field Summary | |
---|---|
private IBackgroundService.Stub |
binder
the service binder |
private ObservableWorkerThreadWithProgressNotification |
currentTask
Reference to an active feature extraction thread |
private Queue<ObservableWorkerThreadWithProgressNotification> |
queue
The queue for batch processing. |
private ServiceState |
state
The service state |
private TrainingDataDeletionThread |
trainingDataDeletionThread
The training data deletion thread. |
private PowerManager.WakeLock |
wakeLock
The wake lock. |
Fields inherited from class android.app.Service |
---|
START_CONTINUATION_MASK, START_FLAG_REDELIVERY, START_FLAG_RETRY, START_NOT_STICKY, START_REDELIVER_INTENT, START_STICKY, START_STICKY_COMPATIBILITY |
Fields inherited from interface android.content.ComponentCallbacks2 |
---|
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN |
Constructor Summary | |
---|---|
BackgroundService()
Constructor |
Method Summary | |
---|---|
protected boolean |
batchCreateAndExportTrainingDataDatabase(DBManager dbManager,
Configuration baseConfig,
long[] windowSizes,
long[] sampleRates,
double[] gfCutOffs)
Method to start batch training data creation in the background for any combination of the given window sizes and sample rates |
boolean |
compareAndSetState(ServiceState expect,
ServiceState update)
Atomically sets the service state to the given updated value if the current value equals the expected value. |
protected boolean |
createModel(DBManager dbManager,
Configuration config,
String modelName)
Method to start model creation in the background |
protected boolean |
dBRawDataUpdate(DBManager dbManager,
Configuration config)
Method to start DB related updates of raw time series (relevant for older DB versions only!). |
protected boolean |
evaluate(DBManager dbManager,
Configuration config,
ParcelableFeatureTypeSets featureSetsToTest,
boolean bestResultsOnly)
Method to start a features set evaluation in the background |
protected boolean |
exportDatabase(String fileName)
Method to export database in the background |
protected boolean |
exportModelFile(String modelName)
Method to export a model file in the background |
protected boolean |
exportRawData(DBManager dbManager,
Configuration config,
String fileName)
Method to export the raw recorded data to a file in the background |
private boolean |
exportTrainingData(DBManager dbManager,
Configuration config,
String fileName)
Method to export training data to file in the background |
protected boolean |
extractFeatures(DBManager dbManager,
Configuration config,
long[] sequenceIds)
Method to start feature extraction in the background |
private ObservableWorkerThreadWithProgressNotification |
getCurrentTask()
Getter for the current task |
protected Class<? extends Activity> |
getNotificationTargetClass(ServiceState serviceState)
Does determine the notification result target class by the current service state |
private ServiceState |
getState()
Getter for the state |
protected boolean |
importDatabase(String fileName)
Method to export database in the background |
IBinder |
onBind(Intent intent)
|
void |
onCreate()
|
void |
onDestroy()
|
void |
onEvent(ObservableEventSource<? extends TaskFinishedEvent> eventSource,
TaskFinishedEvent observedEvent)
|
boolean |
runNextBatchJob()
|
protected boolean |
searchForBestFeatureSubset(DBManager dbManager,
Configuration config,
ParcelableFeatureTypeSets featureSets,
int size)
Method to start a search for the best feature subset of a given size. |
private void |
setCurrentTask(ObservableWorkerThreadWithProgressNotification thread)
Setter for the current task |
private void |
setState(ServiceState state)
Setter for the state |
protected boolean |
updateLinearAccelerationsInDatabase(DBManager dbManager,
Configuration config)
Method to start an update of linear acceleration values in the raw data samples for the case that the own linear acceleration implementation is used. |
Methods inherited from class android.app.Service |
---|
dump, getApplication, onConfigurationChanged, onLowMemory, onRebind, onStart, onStartCommand, onTaskRemoved, onTrimMemory, onUnbind, startForeground, stopForeground, stopSelf, stopSelf, stopSelfResult |
Methods inherited from class android.content.Context |
---|
getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private ObservableWorkerThreadWithProgressNotification currentTask
private final Queue<ObservableWorkerThreadWithProgressNotification> queue
private final IBackgroundService.Stub binder
private ServiceState state
private PowerManager.WakeLock wakeLock
private TrainingDataDeletionThread trainingDataDeletionThread
Constructor Detail |
---|
public BackgroundService()
Method Detail |
---|
public final void onCreate()
onCreate
in class Service
public void onDestroy()
onDestroy
in class Service
private final void setCurrentTask(ObservableWorkerThreadWithProgressNotification thread)
thread
- the current task to setprivate final ObservableWorkerThreadWithProgressNotification getCurrentTask()
private final void setState(ServiceState state)
state
- the state to setprivate final ServiceState getState()
public final boolean compareAndSetState(ServiceState expect, ServiceState update)
expect
- the expected valueupdate
- the update value
public final IBinder onBind(Intent intent)
onBind
in class Service
protected final boolean extractFeatures(DBManager dbManager, Configuration config, long[] sequenceIds)
dbManager
- the database manager to useconfig
- the configuration to usesequenceIds
- a list with the identifiers of the continuous recording sequences
to extract features from
protected boolean batchCreateAndExportTrainingDataDatabase(DBManager dbManager, Configuration baseConfig, long[] windowSizes, long[] sampleRates, double[] gfCutOffs)
dbManager
- the database manager to usebaseConfig
- the base configurationwindowSizes
- the window sizessampleRates
- the sample ratesgfCutOffs
- cut-off frequencies for the own gravitation filter
public boolean runNextBatchJob()
protected final boolean evaluate(DBManager dbManager, Configuration config, ParcelableFeatureTypeSets featureSetsToTest, boolean bestResultsOnly)
dbManager
- the database manager to useconfig
- the configuration to usefeatureSetsToTest
- the set with the feature sets to testbestResultsOnly
- flag to limit the result list to the best results (ranked by
overall prediction accuracy)
protected final boolean searchForBestFeatureSubset(DBManager dbManager, Configuration config, ParcelableFeatureTypeSets featureSets, int size)
dbManager
- the database manager to useconfig
- the configuration to usefeatureSets
- the set with the feature set to search insize
- the subset size
protected final boolean createModel(DBManager dbManager, Configuration config, String modelName)
dbManager
- the database manager to useconfig
- the configuration to usemodelName
- the model name
private final boolean exportTrainingData(DBManager dbManager, Configuration config, String fileName)
dbManager
- the database manager to useconfig
- the current configurationfileName
- the destination file name
protected boolean exportRawData(DBManager dbManager, Configuration config, String fileName)
dbManager
- the database manager to useconfig
- the current configurationfileName
- the destination file name
protected boolean updateLinearAccelerationsInDatabase(DBManager dbManager, Configuration config)
dbManager
- the database manager to useconfig
- the current configuration
protected boolean dBRawDataUpdate(DBManager dbManager, Configuration config)
dbManager
- the database manager to useconfig
- the current configuration
protected boolean importDatabase(String fileName)
fileName
- the destination file name
protected boolean exportDatabase(String fileName)
fileName
- the destination file name
protected boolean exportModelFile(String modelName)
modelName
- the model name
public final void onEvent(ObservableEventSource<? extends TaskFinishedEvent> eventSource, TaskFinishedEvent observedEvent)
onEvent
in interface EventObserver<TaskFinishedEvent>
protected Class<? extends Activity> getNotificationTargetClass(ServiceState serviceState)
serviceState
- the service state
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |