org.android.activityminer.app.manager
Class ManagerActivity

Package class diagram package ManagerActivity
java.lang.Object
  extended by android.content.Context
      extended by android.content.ContextWrapper
          extended by android.view.ContextThemeWrapper
              extended by android.app.Activity
                  extended by org.android.activityminer.app.util.SharedPreferenceChangeAwareActivity
                      extended by org.android.activityminer.app.util.ServiceBasedActivity
                          extended by org.android.activityminer.app.manager.ManagerActivity
All Implemented Interfaces:
ComponentCallbacks, ComponentCallbacks2, KeyEvent.Callback, LayoutInflater.Factory, LayoutInflater.Factory2, View.OnCreateContextMenuListener, Window.Callback, GenericServiceConnectionHolder.ServiceConnectionEventReceiver<IBackgroundService>, SharedPreferenceChangeNotificationReceiver, SharedPreferenceChangeObserver

public class ManagerActivity
extends ServiceBasedActivity

The management activity.


Field Summary
private  Button btnBatchExportTrainingData
          The batch export training data button.
private  Button btnExportDB
          The export database button.
private  Button btnExportModel
          The export model button.
private  Button btnExportRawData
          The export raw data button.
private  Button btnExportTrainingData
          The export training data button.
private  Button btnImportDB
          The import database button.
private  AtomicBoolean dbImportIsWaitingForConnection
          Flag if db import is waiting for a connection
private  String importFileName
          file name for db import
private  AtomicBoolean modelExportIsWaitingForConnection
          Flag if model export is waiting for a connection
private  String modelName
          The name of the model to export
private  int secretCounter
          The secret counter.
 
Fields inherited from class android.app.Activity
DEFAULT_KEYS_DIALER, DEFAULT_KEYS_DISABLE, DEFAULT_KEYS_SEARCH_GLOBAL, DEFAULT_KEYS_SEARCH_LOCAL, DEFAULT_KEYS_SHORTCUT, FOCUSED_STATE_SET, RESULT_CANCELED, RESULT_FIRST_USER, RESULT_OK
 
Fields inherited from class android.content.Context
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, AUDIO_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAPTIONING_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, KEYGUARD_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_ROUTER_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, STORAGE_SERVICE, TELEPHONY_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, UI_MODE_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
 
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
ManagerActivity()
           
 
Method Summary
private  void doBatchExportTrainingData(Configuration configuration, long[] windowSizes, long[] sampleRates, double[] gfCutOffs)
          Training data creation and export in batch mode.
protected  void doExportDB(String destFileName)
          Database export
protected  void doExportModel(String modelFileName)
          Model xxport
protected  void doExportRawData(String fileName)
          Raw data export to the given file name
protected  void doExportTrainingData(String fileName)
          Training data export to the given file name
protected  void doImportDB(String srcFileName)
          Database import
 void onAboutToDisconnect(IBackgroundService service)
           
protected  void onActivityResult(int requestCode, int resultCode, Intent data)
           
private  void onBatchExportTrainingData()
          Handler for training data batch export.
 void onConfigurationChanged(Configuration newConfig)
           
 void onConnectionEstablished(IBackgroundService service)
           
 void onConnectionLost()
           
protected  void onCreate(Bundle savedInstanceState)
           
 boolean onCreateOptionsMenu(Menu menu)
           
protected  void onDestroy()
           
protected  void onExportDB()
          Database export handler
protected  void onExportModel()
          Model export handler
protected  void onExportRawData()
          Raw data export handler
private  void onExportTrainingData()
          Handler for training data export.
protected  void onImportDB()
          Database import handler
 boolean onOptionsItemSelected(MenuItem item)
           
 boolean onPrepareOptionsMenu(Menu menu)
           
protected  void onResume()
           
protected  void onServiceFinishedCurrentTask(TaskFinishedEvent event)
          Handler for finished service tasks
private  void prepare()
          Preparation
private  boolean testForCompatibility(String dbFileName)
          Method to test for data compatibility with device ( configured sample rate must fit )
private  void updateButtonStates()
          Does update the button states
private  boolean validateDBFile(String dbFileName)
          Method to test for a valid database file
 
Methods inherited from class org.android.activityminer.app.util.ServiceBasedActivity
getService, getServiceState, handleTaskFinishedEvent, isServiceAvailable, onBackgroundTaskProgress, onBindingFailed, onDefaultTaskFinishedEvent, onNewIntent, onPause, onServiceUnavailable, safeUnregisterReceiver, showServiceTaskFinishedResult, startBackgroundServiceProgressObservation, stopBackgroundServiceProgressObservation
 
Methods inherited from class org.android.activityminer.app.util.SharedPreferenceChangeAwareActivity
getConfiguration, isInterestedInLimitViolations, onBetaPreferenceChange, onBWCutOffPreferenceChanged, onBWFilterOrderPreferenceChanged, onClassSelectionChange, onCountDownTimeChange, onCrossValidationParameterKChange, onDefaultRecordingTimeChange, onEvaluationAccuracyThresholdChanged, onFeatureSelection, onGravitationCutOffPreferenceChanged, onKNNClassifierParameterKChange, onKNNClassifierParameterNormalizeChange, onLimitViolation, onLocationDataUsageFlagChange, onMaximumRecordingTimeChange, onMaximumSampleRateChange, onMinCutOffPreferenceChanged, onOverlapSizeChange, onOwnLinAccImplementationUsageFlagChange, onSampleRateChange, onSelectedAccFilterChanged, onSelectedClassifierChange, onWindowSizeChange
 
Methods inherited from class android.app.Activity
addContentView, closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, dump, findViewById, finish, finishActivity, finishActivityFromChild, finishAffinity, finishFromChild, getActionBar, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getCurrentFocus, getFragmentManager, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLoaderManager, getLocalClassName, getMenuInflater, getParent, getParentActivityIntent, getPreferences, getRequestedOrientation, getSystemService, getTaskId, getTitle, getTitleColor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, invalidateOptionsMenu, isChangingConfigurations, isChild, isDestroyed, isFinishing, isImmersive, isTaskRoot, managedQuery, moveTaskToBack, navigateUpTo, navigateUpToFromChild, onActionModeFinished, onActionModeStarted, onApplyThemeResource, onAttachedToWindow, onAttachFragment, onBackPressed, onChildTitleChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateDialog, onCreateNavigateUpTaskStack, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onCreateView, onDetachedFromWindow, onGenericMotionEvent, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onLowMemory, onMenuItemSelected, onMenuOpened, onNavigateUp, onNavigateUpFromChild, onOptionsMenuClosed, onPanelClosed, onPostCreate, onPostResume, onPrepareDialog, onPrepareDialog, onPrepareNavigateUpTaskStack, onPreparePanel, onProvideAssistData, onRestart, onRestoreInstanceState, onRetainNonConfigurationInstance, onSaveInstanceState, onSearchRequested, onStart, onStop, onTitleChanged, onTouchEvent, onTrackballEvent, onTrimMemory, onUserInteraction, onUserLeaveHint, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, openContextMenu, openOptionsMenu, overridePendingTransition, recreate, registerForContextMenu, removeDialog, reportFullyDrawn, requestWindowFeature, runOnUiThread, setContentView, setContentView, setContentView, setDefaultKeyMode, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setImmersive, setIntent, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setTitle, setTitle, setTitleColor, setVisible, setVolumeControlStream, shouldUpRecreateTask, showDialog, showDialog, startActionMode, startActivities, startActivities, startActivity, startActivity, startActivityForResult, startActivityForResult, startActivityFromChild, startActivityFromChild, startActivityFromFragment, startActivityFromFragment, startActivityIfNeeded, startActivityIfNeeded, startIntentSender, startIntentSender, startIntentSenderForResult, startIntentSenderForResult, startIntentSenderFromChild, startIntentSenderFromChild, startManagingCursor, startNextMatchingActivity, startNextMatchingActivity, startSearch, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterForContextMenu
 
Methods inherited from class android.view.ContextThemeWrapper
applyOverrideConfiguration, attachBaseContext, getResources, getTheme, setTheme
 
Methods inherited from class android.content.ContextWrapper
bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createConfigurationContext, createDisplayContext, createPackageContext, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getContentResolver, getDatabasePath, getDir, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getFilesDir, getFileStreamPath, getMainLooper, getObbDir, getObbDirs, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getSharedPreferences, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, setWallpaper, startInstrumentation, startService, stopService, unbindService, unregisterReceiver
 
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

btnExportTrainingData

private Button btnExportTrainingData
The export training data button.


btnBatchExportTrainingData

private Button btnBatchExportTrainingData
The batch export training data button.


btnExportRawData

private Button btnExportRawData
The export raw data button.


btnExportDB

private Button btnExportDB
The export database button.


btnImportDB

private Button btnImportDB
The import database button.


btnExportModel

private Button btnExportModel
The export model button.


dbImportIsWaitingForConnection

private final AtomicBoolean dbImportIsWaitingForConnection
Flag if db import is waiting for a connection


importFileName

private String importFileName
file name for db import


modelExportIsWaitingForConnection

private final AtomicBoolean modelExportIsWaitingForConnection
Flag if model export is waiting for a connection


modelName

private String modelName
The name of the model to export


secretCounter

private int secretCounter
The secret counter.

Constructor Detail

ManagerActivity

public ManagerActivity()
Method Detail

onCreate

protected final void onCreate(Bundle savedInstanceState)
Overrides:
onCreate in class ServiceBasedActivity

onDestroy

protected final void onDestroy()
Overrides:
onDestroy in class SharedPreferenceChangeAwareActivity

onConfigurationChanged

public final void onConfigurationChanged(Configuration newConfig)
Specified by:
onConfigurationChanged in interface ComponentCallbacks
Overrides:
onConfigurationChanged in class Activity

prepare

private final void prepare()
Preparation


onCreateOptionsMenu

public final boolean onCreateOptionsMenu(Menu menu)
Overrides:
onCreateOptionsMenu in class Activity

onPrepareOptionsMenu

public final boolean onPrepareOptionsMenu(Menu menu)
Overrides:
onPrepareOptionsMenu in class Activity

onOptionsItemSelected

public final boolean onOptionsItemSelected(MenuItem item)
Overrides:
onOptionsItemSelected in class Activity

updateButtonStates

private final void updateButtonStates()
Does update the button states


onImportDB

protected final void onImportDB()
Database import handler


onExportModel

protected final void onExportModel()
Model export handler


onActivityResult

protected final void onActivityResult(int requestCode,
                                      int resultCode,
                                      Intent data)
Overrides:
onActivityResult in class Activity

validateDBFile

private boolean validateDBFile(String dbFileName)
Method to test for a valid database file

Parameters:
dbFileName - the database file name
Returns:
true if it is a valid db file, false otherwise

testForCompatibility

private boolean testForCompatibility(String dbFileName)
Method to test for data compatibility with device ( configured sample rate must fit )

Parameters:
dbFileName - the database file name
Returns:
true if compatible, false otherwise

onBatchExportTrainingData

private final void onBatchExportTrainingData()
Handler for training data batch export.


onExportTrainingData

private final void onExportTrainingData()
Handler for training data export.


onExportRawData

protected final void onExportRawData()
Raw data export handler


onExportDB

protected final void onExportDB()
Database export handler


doExportTrainingData

protected final void doExportTrainingData(String fileName)
Training data export to the given file name

Parameters:
fileName - the file name

doBatchExportTrainingData

private final void doBatchExportTrainingData(Configuration configuration,
                                             long[] windowSizes,
                                             long[] sampleRates,
                                             double[] gfCutOffs)
Training data creation and export in batch mode.

Parameters:
configuration - the base configuration
windowSizes - the window sizes
sampleRates - the sample rates
gfCutOffs - cut-off frequencies for own gravitation filter (can be null)

doExportRawData

protected final void doExportRawData(String fileName)
Raw data export to the given file name

Parameters:
fileName - the file name

doExportDB

protected final void doExportDB(String destFileName)
Database export

Parameters:
destFileName - the destination file name

doImportDB

protected final void doImportDB(String srcFileName)
Database import

Parameters:
srcFileName - the source file

doExportModel

protected final void doExportModel(String modelFileName)
Model xxport

Parameters:
modelFileName - the model file

onResume

protected final void onResume()
Overrides:
onResume in class ServiceBasedActivity

onServiceFinishedCurrentTask

protected void onServiceFinishedCurrentTask(TaskFinishedEvent event)
Description copied from class: ServiceBasedActivity
Handler for finished service tasks

Specified by:
onServiceFinishedCurrentTask in class ServiceBasedActivity
Parameters:
event - the task finished event

onConnectionEstablished

public final void onConnectionEstablished(IBackgroundService service)
Specified by:
onConnectionEstablished in interface GenericServiceConnectionHolder.ServiceConnectionEventReceiver<IBackgroundService>
Overrides:
onConnectionEstablished in class ServiceBasedActivity

onAboutToDisconnect

public final void onAboutToDisconnect(IBackgroundService service)
Specified by:
onAboutToDisconnect in interface GenericServiceConnectionHolder.ServiceConnectionEventReceiver<IBackgroundService>
Overrides:
onAboutToDisconnect in class ServiceBasedActivity

onConnectionLost

public final void onConnectionLost()
Specified by:
onConnectionLost in interface GenericServiceConnectionHolder.ServiceConnectionEventReceiver<IBackgroundService>
Overrides:
onConnectionLost in class ServiceBasedActivity