|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vodafone360.people.service.agent.NetworkAgent
public class NetworkAgent
The network Agent monitors the connectivity status of the device and makes decisions about the communication strategy. The Agent has the following states {connected | disconnected}, with changes reported to various listeners in the service.
Nested Class Summary | |
---|---|
static class |
NetworkAgent.AgentDisconnectReason
Reasons for Service Agent changing state to disconnected |
static class |
NetworkAgent.AgentState
|
private class |
NetworkAgent.SettingsContentObserver
Listens for changes made to People client's status. |
static class |
NetworkAgent.StatesOfService
|
Field Summary | |
---|---|
private static NetworkAgent.AgentState |
mAgentState
|
private boolean |
mBackgroundData
|
private BroadcastReceiver |
mBackgroundDataBroadcastReceiver
Receive notification from ConnectivityManager.ACTION_BACKGROUND_DATA_SETTING_CHANGED |
private IConnectionManagerInterface |
mConnectionMgrIf
|
private ConnectivityManager |
mConnectivityManager
|
private ContentResolver |
mContentResolver
|
private Context |
mContext
|
private boolean |
mDataRoaming
|
private NetworkAgent.SettingsContentObserver |
mDataRoamingSettingObserver
|
private java.lang.Long |
mDisableRoamingNotificationUntil
|
private NetworkAgent.AgentDisconnectReason |
mDisconnectReason
|
private boolean |
mInternetConnected
|
private BroadcastReceiver |
mInternetConnectivityReceiver
Receive notification from ConnectivityManager.CONNECTIVITY_ACTION |
private boolean |
mIsInBackground
|
private boolean |
mIsRoaming
|
private boolean |
mNetworkWorking
|
private BroadcastReceiver |
mServiceStateRoamingReceiver
Receive notification from android.intent.action.SERVICE_STATE |
private boolean |
mWifiActive
|
private IWorkerThreadControl |
mWorkerThreadControl
|
static int |
ROAMING_DIALOG_GLOBAL_OFF
Roaming notification is off |
static int |
ROAMING_DIALOG_GLOBAL_ON
Roaming notification is on |
private static int |
TYPE_WIFI
|
Constructor Summary | |
---|---|
NetworkAgent(Context context,
IWorkerThreadControl workerThreadControl,
IConnectionManagerInterface connMgrIf)
The constructor. |
Method Summary | |
---|---|
private void |
checkActiveNetworkState()
|
static NetworkAgent.AgentState |
getAgentState()
|
private PersistSettings.InternetAvail |
getInternetAvailSetting()
|
NetworkAgentState |
getNetworkAgentState()
|
boolean |
getRoamingDeviceSetting()
Get current device roaming setting. |
int |
getRoamingNotificationType()
|
void |
notifyDataSettingChanged(PersistSettings.InternetAvail val)
Notify interested parties of changes in Internet setting. |
private void |
onConnected()
|
private void |
onConnectionStateChanged()
Contains the main logic that determines the agent state for network access |
void |
onCreate()
Create NetworkAgent and start observers of device connectivity state. |
private void |
onDataSettingChanged(java.lang.String settingName)
Received when user modifies one of the system settings |
void |
onDestroy()
Destroy NetworkAgent and un-register observers. |
private void |
onDisconnected()
|
private void |
processRoaming(PersistSettings.InternetAvail val)
Displaying notification to the user about roaming |
static void |
setAgentState(NetworkAgent.AgentState newState)
Forces the AgentState to a specific value. |
void |
setNetworkAgentState(NetworkAgentState state)
|
private void |
setNewState(NetworkAgent.AgentState newState)
|
void |
setShowRoamingNotificationAgain(boolean showAgain)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ROAMING_DIALOG_GLOBAL_ON
public static final int ROAMING_DIALOG_GLOBAL_OFF
private static final int TYPE_WIFI
private static NetworkAgent.AgentState mAgentState
private ConnectivityManager mConnectivityManager
private ContentResolver mContentResolver
private NetworkAgent.AgentDisconnectReason mDisconnectReason
private NetworkAgent.SettingsContentObserver mDataRoamingSettingObserver
private boolean mInternetConnected
private boolean mDataRoaming
private boolean mBackgroundData
private boolean mIsRoaming
private boolean mIsInBackground
private boolean mWifiActive
private boolean mNetworkWorking
private java.lang.Long mDisableRoamingNotificationUntil
private IWorkerThreadControl mWorkerThreadControl
private IConnectionManagerInterface mConnectionMgrIf
private Context mContext
private final BroadcastReceiver mBackgroundDataBroadcastReceiver
private final BroadcastReceiver mInternetConnectivityReceiver
private final BroadcastReceiver mServiceStateRoamingReceiver
Constructor Detail |
---|
public NetworkAgent(Context context, IWorkerThreadControl workerThreadControl, IConnectionManagerInterface connMgrIf)
context
- Android context.workerThreadControl
- Handle to kick the worker thread.connMgrIf
- Handler to signal the connection manager.
java.security.InvalidParameterException
- Context is NULL.
java.security.InvalidParameterException
- IWorkerThreadControl is NULL.
java.security.InvalidParameterException
- IConnectionManagerInterface is NULL.Method Detail |
---|
public void onCreate()
java.security.InvalidParameterException
- DataRoamingSettingObserver is NULL.
java.security.InvalidParameterException
- Context is NULL.
java.security.InvalidParameterException
- ConnectivityManager is NULL.public void onDestroy()
java.security.InvalidParameterException
- Context is NULL.
java.security.InvalidParameterException
- DataRoamingSettingObserver is NULL.public void notifyDataSettingChanged(PersistSettings.InternetAvail val)
val
- updated InternetAvail value.private void processRoaming(PersistSettings.InternetAvail val)
InternetAvail
- value.private PersistSettings.InternetAvail getInternetAvailSetting()
public int getRoamingNotificationType()
public boolean getRoamingDeviceSetting()
public void setShowRoamingNotificationAgain(boolean showAgain)
private void onDataSettingChanged(java.lang.String settingName)
private void onConnectionStateChanged()
public static NetworkAgent.AgentState getAgentState()
private void setNewState(NetworkAgent.AgentState newState)
private void onConnected()
private void onDisconnected()
private void checkActiveNetworkState()
public void setNetworkAgentState(NetworkAgentState state)
public NetworkAgentState getNetworkAgentState()
public static void setAgentState(NetworkAgent.AgentState newState)
newState
- the state to set Note: to be used only for test purposes
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaDoc