com.vodafone360.people.engine.upgrade
Class UpgradeEngine

java.lang.Object
  extended by com.vodafone360.people.engine.BaseEngine
      extended by com.vodafone360.people.engine.upgrade.UpgradeEngine

public class UpgradeEngine
extends BaseEngine

Checks Settings.UPGRADE_CHECK_URL for information on a software upgrade . Triggers a dialog in the UI when a newer application version is available Throttles UI events


Nested Class Summary
private  class UpgradeEngine.UpgradeEngineNetworkThread
          Thread for running an upgrade check without blocking the WorkerThread.
 
Nested classes/interfaces inherited from class com.vodafone360.people.engine.BaseEngine
BaseEngine.IEngineEventCallback
 
Field Summary
private  boolean mActivated
           
private  long mCheckFrequencyMillis
           
private  Context mContext
           
private  boolean mForceOnce
           
private  long mNextRunTime
           
private  UpgradeEngine.UpgradeEngineNetworkThread mUpgradeEngineNetworkThread
           
private  UpgradeStatus mUpgradeStatus
           
 
Fields inherited from class com.vodafone360.people.engine.BaseEngine
mActiveUiRequest, mCurrentTimeout, mEngineId, mEventCallback
 
Constructor Summary
UpgradeEngine(Context context, BaseEngine.IEngineEventCallback eventCallback)
          Constructor.
 
Method Summary
 void checkForUpdates()
          Add request to check for application update.
 long getNextRunTime()
          Return the mNextRunTime value if the feature is enabled.
 void onCreate()
          This will be called immediately after creation.
 void onDestroy()
          This will be called just before the engine is shutdown.
protected  void onRequestComplete()
          This function must be implemented in the derived engine implementation.
protected  void onTimeoutEvent()
          The derived engine implementation must call the processTimeout() function (normally from within the run() implementation), otherwise this will not be called.
protected  void processCommsResponse(ResponseQueue.Response resp)
          The derived engine implementation must call the processCommsInQueue() function (normally from within the run() implementation), otherwise this will not be called.
protected  void processUiRequest(ServiceUiRequest requestId, java.lang.Object data)
          The derived engine implementation must call the processUiQueue() function (normally from within the run() implementation), otherwise this will not be called.
 void run()
          Trigger the UpgradeEngineNetworkThread if the feature is enabled.
 void setNewUpdateFrequency()
          Sets a new value for the frequency with which to check for application updates.
private  void setNextRuntime()
           
 
Methods inherited from class com.vodafone360.people.engine.BaseEngine
addUiRequestToQueue, clearTimeout, completeUiRequest, completeUiRequest, deactivateEngine, emptyUiRequestQueue, engineId, genericHandleResponseType, getCurrentTimeout, isCommsResponseOutstanding, isDeactivated, isUiRequestOutstanding, onCommsInMessage, onReset, processCommsInQueue, processTimeout, processUiQueue, setReqId, setTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mContext

private Context mContext

mUpgradeStatus

private UpgradeStatus mUpgradeStatus

mCheckFrequencyMillis

private long mCheckFrequencyMillis

mNextRunTime

private long mNextRunTime

mForceOnce

private boolean mForceOnce

mActivated

private boolean mActivated

mUpgradeEngineNetworkThread

private UpgradeEngine.UpgradeEngineNetworkThread mUpgradeEngineNetworkThread
Constructor Detail

UpgradeEngine

public UpgradeEngine(Context context,
                     BaseEngine.IEngineEventCallback eventCallback)
Constructor.

Parameters:
context - - the context to use
eventCallback - - the engine event client to use
Method Detail

getNextRunTime

public long getNextRunTime()
Return the mNextRunTime value if the feature is enabled.

Specified by:
getNextRunTime in class BaseEngine
Returns:
the mNextRunTime value if the feature is enabled.

run

public void run()
Trigger the UpgradeEngineNetworkThread if the feature is enabled.

Specified by:
run in class BaseEngine

setNextRuntime

private void setNextRuntime()

processUiRequest

protected void processUiRequest(ServiceUiRequest requestId,
                                java.lang.Object data)
Description copied from class: BaseEngine
The derived engine implementation must call the processUiQueue() function (normally from within the run() implementation), otherwise this will not be called. This function is called for each UI request that arrives on the queue. It should start processing the request. If this function takes longer than 1 second to complete, it should be broken up. Once a request is finished the processUiRequest function must be called.

Specified by:
processUiRequest in class BaseEngine
Parameters:
requestId - The UI request ID
data - Request data (object type is request specific)

onCreate

public void onCreate()
Description copied from class: BaseEngine
This will be called immediately after creation.

Specified by:
onCreate in class BaseEngine

onDestroy

public void onDestroy()
Description copied from class: BaseEngine
This will be called just before the engine is shutdown.

Specified by:
onDestroy in class BaseEngine

onRequestComplete

protected void onRequestComplete()
Description copied from class: BaseEngine
This function must be implemented in the derived engine implementation. It can do any post-request complete cleanup.

Specified by:
onRequestComplete in class BaseEngine

onTimeoutEvent

protected void onTimeoutEvent()
Description copied from class: BaseEngine
The derived engine implementation must call the processTimeout() function (normally from within the run() implementation), otherwise this will not be called. This function will be called when a timeout occurs (started by setTimeout and cancelled by clearTimeout). If this function takes longer than 1 second to complete it should be broken up.

Specified by:
onTimeoutEvent in class BaseEngine

processCommsResponse

protected void processCommsResponse(ResponseQueue.Response resp)
Description copied from class: BaseEngine
The derived engine implementation must call the processCommsInQueue() function (normally from within the run() implementation), otherwise this will not be called. This function is called for each Comms response that arrives on the in queue.

Specified by:
processCommsResponse in class BaseEngine
Parameters:
resp - The comms response

setNewUpdateFrequency

public void setNewUpdateFrequency()
Sets a new value for the frequency with which to check for application updates.


checkForUpdates

public void checkForUpdates()
Add request to check for application update.



JavaDoc