TestActivity

br.usp.ime.dspbenchmarking.activities
Class TestActivity

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 br.usp.ime.dspbenchmarking.activities.DspActivity
                      extended by br.usp.ime.dspbenchmarking.activities.TestActivity
All Implemented Interfaces:
android.content.ComponentCallbacks, android.view.KeyEvent.Callback, android.view.LayoutInflater.Factory, android.view.View.OnCreateContextMenuListener, android.view.Window.Callback
Direct Known Subclasses:
BenchmarkActivity, StressActivity

public abstract class TestActivity
extends DspActivity

Provides the GUI for running tests.


Field Summary
(package private)  int algorithm
           
protected  android.widget.TextView algorithmName
           
(package private)  int blockSize
           
protected  android.widget.TextView blockSizeView
           
(package private)  java.lang.String dateFormat
           
(package private)  java.lang.String dirName
           
protected  java.lang.String fileName
           
protected  java.lang.String filePrefix
           
(package private)  java.io.InputStream is
           
private  int lastAlg
           
protected  double LOG2
           
protected  int maxDspCycles
           
(package private)  boolean mExternalStorageAvailable
           
(package private)  android.content.BroadcastReceiver mExternalStorageReceiver
           
(package private)  boolean mExternalStorageWriteable
           
(package private)  java.io.OutputStream os
           
protected  android.widget.ProgressBar progressBar
           
(package private)  java.lang.String results
           
protected  android.widget.ToggleButton toggleTestsButton
           
protected  android.widget.ProgressBar workingBar
           
 
Fields inherited from class br.usp.ime.dspbenchmarking.activities.DspActivity
callbackPeriodView, cpuUsageBar, dspCallbackTimeView, dspCyclesView, dspCycleTimeBar, dspPeriodView, dt, elapsedTimeView, mHandler, readCyclesView, sampleReadTimeView, sampleWriteTimeView, swt, totalTime, totalTimeView
 
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, AUDIO_SERVICE, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, INPUT_METHOD_SERVICE, KEYGUARD_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MODE_APPEND, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NOTIFICATION_SERVICE, POWER_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, TELEPHONY_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
 
Constructor Summary
TestActivity()
           
 
Method Summary
private  java.lang.String getBuildInfo()
          Get formatted info about Android build.
protected  java.lang.String getDspThreadInfo(int algorithm)
          Generates a byte array with statistics from the DSP thread
protected  java.lang.String getFileName()
          Get a formatted name for the file with tests results.
protected  java.io.OutputStream getOutputStream()
          Create and return a file to write results.
protected  void initTests()
          Initialize tests.
protected  void launchTest()
          Start a test.
 void onBackPressed()
          Stop DSP thread, mark test as canceled and finish.
 void onCreate(android.os.Bundle savedInstanceState)
          Executes upon creation of activity, configures screen.
protected  void releaseDspThread()
          Libera uma thread DSP: - libera a entrada e a saída
private  void sendResults(java.lang.String title)
          Send results to email.
protected  void setupTests()
          Configura um teste: - abre um arquivo de áudio como stream de entrada.
protected abstract  void startControlThread()
           
 void toggleTests(android.view.View v)
           
protected  void turnOff(java.lang.String title)
          When the test finishes, send results back to previous activity and finish.
(package private)  void updateExternalStorageState()
          Verify if external storage is present and is writable.
protected  void updateScreenInfo()
           
 
Methods inherited from class android.app.Activity
addContentView, closeContextMenu, closeOptionsMenu, createPendingResult, dismissDialog, dispatchKeyEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, finalize, findViewById, finish, finishActivity, finishActivityFromChild, finishFromChild, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getCurrentFocus, getInstanceCount, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLocalClassName, getMenuInflater, getParent, getPreferences, getRequestedOrientation, getSystemService, getTaskId, getTitle, getTitleColor, getVolumeControlStream, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, getWindow, getWindowManager, hasWindowFocus, isChild, isFinishing, isTaskRoot, managedQuery, moveTaskToBack, onActivityResult, onApplyThemeResource, onAttachedToWindow, onChildTitleChanged, onConfigurationChanged, onContentChanged, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateDescription, onCreateDialog, onCreateOptionsMenu, onCreatePanelMenu, onCreatePanelView, onCreateThumbnail, onCreateView, onDestroy, onDetachedFromWindow, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyUp, onLowMemory, onMenuItemSelected, onMenuOpened, onNewIntent, onOptionsItemSelected, onOptionsMenuClosed, onPanelClosed, onPause, onPostCreate, onPostResume, onPrepareDialog, onPrepareOptionsMenu, onPreparePanel, onRestart, onRestoreInstanceState, onResume, onRetainNonConfigurationInstance, onSaveInstanceState, onSearchRequested, onStart, onStop, onTitleChanged, onTouchEvent, onTrackballEvent, onUserInteraction, onUserLeaveHint, onWindowAttributesChanged, onWindowFocusChanged, openContextMenu, openOptionsMenu, overridePendingTransition, registerForContextMenu, removeDialog, requestWindowFeature, runOnUiThread, setContentView, setContentView, setContentView, setDefaultKeyMode, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setIntent, setPersistent, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setResult, setSecondaryProgress, setTitle, setTitle, setTitleColor, setVisible, setVolumeControlStream, showDialog, startActivity, startActivityForResult, startActivityFromChild, startActivityIfNeeded, startIntentSender, startIntentSenderForResult, startIntentSenderFromChild, startManagingCursor, startNextMatchingActivity, startSearch, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterForContextMenu
 
Methods inherited from class android.view.ContextThemeWrapper
attachBaseContext, getTheme, setTheme
 
Methods inherited from class android.content.ContextWrapper
bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createPackageContext, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getContentResolver, getDatabasePath, getDir, getFilesDir, getFileStreamPath, getMainLooper, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getWallpaper, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, removeStickyBroadcast, revokeUriPermission, sendBroadcast, sendBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendStickyBroadcast, sendStickyOrderedBroadcast, setWallpaper, setWallpaper, startInstrumentation, startService, stopService, unbindService, unregisterReceiver
 
Methods inherited from class android.content.Context
getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

toggleTestsButton

protected android.widget.ToggleButton toggleTestsButton

workingBar

protected android.widget.ProgressBar workingBar

progressBar

protected android.widget.ProgressBar progressBar

algorithmName

protected android.widget.TextView algorithmName

blockSizeView

protected android.widget.TextView blockSizeView

blockSize

int blockSize

algorithm

int algorithm

maxDspCycles

protected int maxDspCycles

LOG2

protected double LOG2

results

java.lang.String results

is

java.io.InputStream is

os

java.io.OutputStream os

mExternalStorageReceiver

android.content.BroadcastReceiver mExternalStorageReceiver

mExternalStorageAvailable

boolean mExternalStorageAvailable

mExternalStorageWriteable

boolean mExternalStorageWriteable

dirName

final java.lang.String dirName
See Also:
Constant Field Values

fileName

protected java.lang.String fileName

filePrefix

protected java.lang.String filePrefix

dateFormat

final java.lang.String dateFormat
See Also:
Constant Field Values

lastAlg

private int lastAlg
Constructor Detail

TestActivity

public TestActivity()
Method Detail

onCreate

public void onCreate(android.os.Bundle savedInstanceState)
Executes upon creation of activity, configures screen.

Overrides:
onCreate in class DspActivity

turnOff

protected void turnOff(java.lang.String title)
When the test finishes, send results back to previous activity and finish.


onBackPressed

public void onBackPressed()
Stop DSP thread, mark test as canceled and finish.

Overrides:
onBackPressed in class android.app.Activity

toggleTests

public void toggleTests(android.view.View v)
Parameters:
v -

getOutputStream

protected java.io.OutputStream getOutputStream()
Create and return a file to write results.

Returns:

getBuildInfo

private java.lang.String getBuildInfo()
Get formatted info about Android build.

Returns:

launchTest

protected void launchTest()
Start a test.


updateExternalStorageState

void updateExternalStorageState()
                          throws java.io.IOException
Verify if external storage is present and is writable.

Throws:
java.io.IOException

getFileName

protected java.lang.String getFileName()
Get a formatted name for the file with tests results.

Returns:

sendResults

private void sendResults(java.lang.String title)
Send results to email.

Parameters:
title -

getDspThreadInfo

protected java.lang.String getDspThreadInfo(int algorithm)
Generates a byte array with statistics from the DSP thread

Returns:

updateScreenInfo

protected void updateScreenInfo()

initTests

protected void initTests()
Initialize tests.


startControlThread

protected abstract void startControlThread()

releaseDspThread

protected void releaseDspThread()
Libera uma thread DSP: - libera a entrada e a saída. - pára a thread.


setupTests

protected void setupTests()
Configura um teste: - abre um arquivo de áudio como stream de entrada.