public class WifiStateMachine extends StateMachine implements WifiNative.WifiRssiEventHandler
Modifier and Type | Class and Description |
---|---|
static class |
WifiStateMachine.SimAuthRequestData |
StateMachine.LogRec
Modifier and Type | Field and Description |
---|---|
static int |
CMD_BOOT_COMPLETED |
static int |
CMD_DISABLE_P2P_REQ |
static int |
CMD_DISABLE_P2P_RSP |
static int |
CMD_ENABLE_P2P |
static int |
CONNECT_MODE |
static int |
DFS_RESTRICTED_SCAN_REQUEST |
static short |
NUM_LOG_RECS_NORMAL |
static short |
NUM_LOG_RECS_VERBOSE |
static short |
NUM_LOG_RECS_VERBOSE_LOW_MEMORY |
static int |
SCAN_ONLY_MODE |
static int |
SCAN_ONLY_WITH_WIFI_OFF_MODE |
static WorkSource |
WIFI_WORK_SOURCE
Work source to use to blame usage on the WiFi service
|
HANDLED, NOT_HANDLED
Constructor and Description |
---|
WifiStateMachine(Context context,
FrameworkFacade facade,
Looper looper,
UserManager userManager,
WifiInjector wifiInjector,
BackupManagerProxy backupManagerProxy,
WifiCountryCode countryCode) |
Modifier and Type | Method and Description |
---|---|
void |
addToBlacklist(String bssid)
Blacklist a BSSID.
|
void |
autoConnectToNetwork(int networkId,
String bssid)
Automatically connect to the network specified
|
void |
autoRoamSetBSSID(int netId,
String bssid) |
boolean |
autoRoamSetBSSID(WifiConfiguration config,
String bssid) |
void |
autoRoamToNetwork(int networkId,
ScanResult scanResult)
Automatically roam to the network specified
|
void |
clearANQPCache() |
void |
clearBlacklist()
Clear the blacklist list
|
void |
deauthenticateNetwork(AsyncChannel channel,
long holdoff,
boolean ess)
Deauthenticate and set the re-authentication hold off time for the current network
|
void |
disableEphemeralNetwork(String SSID) |
void |
disconnectCommand()
Disconnect from Access Point
|
void |
disconnectCommand(int uid,
int reason) |
void |
dump(FileDescriptor fd,
PrintWriter pw,
String[] args)
Dump the current state.
|
void |
dumpIpManager(FileDescriptor fd,
PrintWriter pw,
String[] args) |
void |
enableAllNetworks() |
void |
enableRssiPolling(boolean enabled) |
void |
enableTdls(String remoteMacAddress,
boolean enable)
Enable TDLS for a specific MAC address
|
void |
enableWifiConnectivityManager(boolean enabled)
Dynamically turn on/off WifiConnectivityManager
|
int |
getAllowScansWithTraffic() |
String |
getConfigFile()
Returns the wifi configuration file
|
Network |
getCurrentNetwork()
Get Network object of current wifi network
|
WifiConfiguration |
getCurrentWifiConfiguration()
Returns Wificonfiguration object correponding to the currently connected network, null if
not connected.
|
long |
getDisconnectedTimeMilli() |
boolean |
getEnableAutoJoinWhenAssociated() |
int |
getFrequencyBand()
Returns the operational frequency band
|
protected String |
getLogRecString(Message msg)
Return the additional string to be logged by LogRec, default
|
Messenger |
getMessenger()
******************************************************
Methods exposed for public use
******************************************************
|
protected int |
getOperationalModeForTest()
Allow tests to confirm the operational mode for WSM.
|
double |
getRxPacketRate() |
double |
getTxPacketRate() |
WifiInfo |
getWifiInfo() |
void |
handleUserSwitch(int userId) |
boolean |
isConnected() |
boolean |
isDisconnected() |
boolean |
isLinkDebouncing() |
boolean |
isSupplicantTransientState() |
protected void |
log(String s)
Log with debug
|
protected void |
logd(String s)
Log with debug attribute
|
protected void |
loge(String s)
Log with error attribute
|
int |
matchProviderWithCurrentNetwork(AsyncChannel channel,
String fqdn) |
void |
onRssiThresholdBreached(byte curRssi) |
void |
processRssiThreshold(byte curRssi,
int reason) |
void |
reassociateCommand()
Initiate a re-association to AP
|
void |
reconnectCommand()
Initiate a reconnection to AP
|
void |
reloadTlsNetworksAndReconnect()
Reload networks and then reconnect; helps load correct data for TLS networks
|
void |
removeAppConfigs(String packageName,
int uid)
Send a message indicating a package has been uninstalled.
|
void |
removeUserConfigs(int userId)
Send a message indicating a user has been removed.
|
void |
resetSimAuthNetworks(boolean simPresent)
reset cached SIM credential data
|
void |
sendBluetoothAdapterStateChange(int state)
Send a message indicating bluetooth adapter connection state changed
|
void |
setAllowScansWithTraffic(int enabled) |
void |
setDriverStart(boolean enable)
TODO: doc
|
boolean |
setEnableAutoJoinWhenAssociated(boolean enabled) |
void |
setFrequencyBand(int band,
boolean persist)
Set the operational frequency band
|
void |
setHighPerfModeEnabled(boolean enable)
Set high performance mode of operation.
|
void |
setHostApRunning(WifiConfiguration wifiConfig,
boolean enable)
TODO: doc
|
void |
setOperationalMode(int mode)
TODO: doc
|
void |
setSupplicantRunning(boolean enable)
TODO: doc
|
void |
setWifiApConfiguration(WifiConfiguration config) |
void |
startFilteringMulticastPackets()
Start filtering Multicast v4 packets
|
void |
startScan(int callingUid,
int scanCounter,
ScanSettings settings,
WorkSource workSource)
Initiate a wifi scan.
|
void |
stopFilteringMulticastPackets()
Stop filtering Multicast v4 packets
|
int |
syncAddOrUpdateNetwork(AsyncChannel channel,
WifiConfiguration config)
Add a network synchronously
|
int |
syncAddPasspointManagementObject(AsyncChannel channel,
String managementObject) |
boolean |
syncDisableNetwork(AsyncChannel channel,
int netId)
Disable a network
|
boolean |
syncEnableNetwork(AsyncChannel channel,
int netId,
boolean disableOthers)
Enable a network
|
List<WifiConfiguration> |
syncGetConfiguredNetworks(int uuid,
AsyncChannel channel)
Get configured networks synchronously
|
WifiConnectionStatistics |
syncGetConnectionStatistics(AsyncChannel channel)
Get connection statistics synchronously
|
DhcpResults |
syncGetDhcpResults() |
WifiLinkLayerStats |
syncGetLinkLayerStats(AsyncChannel channel)
Get link layers stats for adapter synchronously
|
WifiConfiguration |
syncGetMatchingWifiConfig(ScanResult scanResult,
AsyncChannel channel) |
List<WifiConfiguration> |
syncGetPrivilegedConfiguredNetwork(AsyncChannel channel) |
List<ScanResult> |
syncGetScanResultsList()
TODO: doc
|
int |
syncGetSupportedFeatures(AsyncChannel channel)
Get adaptors synchronously
|
WifiConfiguration |
syncGetWifiApConfiguration() |
int |
syncGetWifiApState()
TODO: doc
|
String |
syncGetWifiApStateByName()
TODO: doc
|
int |
syncGetWifiState()
TODO: doc
|
String |
syncGetWifiStateByName()
TODO: doc
|
String |
syncGetWpsNfcConfigurationToken(int netId)
Retrieves a WPS-NFC configuration token for the specified network
|
int |
syncModifyPasspointManagementObject(AsyncChannel channel,
String fqdn,
List<PasspointManagementObjectDefinition> managementObjectDefinitions) |
boolean |
syncPingSupplicant(AsyncChannel channel)
TODO: doc
|
boolean |
syncQueryPasspointIcon(AsyncChannel channel,
long bssid,
String fileName) |
boolean |
syncRemoveNetwork(AsyncChannel channel,
int networkId)
Delete a network
|
WifiInfo |
syncRequestConnectionInfo()
Get status information for the current connection, if any.
|
boolean |
syncSaveConfig(AsyncChannel channel)
Save configuration on supplicant
|
void |
updateBatteryWorkSource(WorkSource newSource) |
addLogRec, addState, addState, copyLogRecs, deferMessage, getCurrentMessage, getCurrentState, getHandler, getLogRec, getLogRecCount, getLogRecSize, getName, getWhatToString, haltedProcessMessage, hasDeferredMessages, hasMessages, isDbg, isQuit, logAndAddLogRec, loge, logi, logv, logw, obtainMessage, obtainMessage, obtainMessage, obtainMessage, obtainMessage, obtainMessage, onHalting, onPostHandleMessage, onPreHandleMessage, onQuitting, quit, quitNow, recordLogRec, removeDeferredMessages, removeMessages, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessageAtFrontOfQueue, sendMessageAtFrontOfQueue, sendMessageAtFrontOfQueue, sendMessageAtFrontOfQueue, sendMessageAtFrontOfQueue, sendMessageAtFrontOfQueue, sendMessageDelayed, sendMessageDelayed, sendMessageDelayed, sendMessageDelayed, sendMessageDelayed, sendMessageDelayed, setDbg, setInitialState, setLogOnlyTransitions, setLogRecSize, start, toString, transitionTo, transitionToHaltingState, unhandledMessage
public static final short NUM_LOG_RECS_NORMAL
public static final short NUM_LOG_RECS_VERBOSE_LOW_MEMORY
public static final short NUM_LOG_RECS_VERBOSE
public static final int DFS_RESTRICTED_SCAN_REQUEST
public static final int CMD_ENABLE_P2P
public static final int CMD_DISABLE_P2P_REQ
public static final int CMD_DISABLE_P2P_RSP
public static final int CMD_BOOT_COMPLETED
public static final int CONNECT_MODE
public static final int SCAN_ONLY_MODE
public static final int SCAN_ONLY_WITH_WIFI_OFF_MODE
public static final WorkSource WIFI_WORK_SOURCE
public WifiStateMachine(Context context, FrameworkFacade facade, Looper looper, UserManager userManager, WifiInjector wifiInjector, BackupManagerProxy backupManagerProxy, WifiCountryCode countryCode)
protected void loge(String s)
loge
in class StateMachine
s
- is string logprotected void logd(String s)
StateMachine
logd
in class StateMachine
s
- is string logprotected void log(String s)
StateMachine
log
in class StateMachine
s
- is string logpublic void onRssiThresholdBreached(byte curRssi)
onRssiThresholdBreached
in interface WifiNative.WifiRssiEventHandler
public void processRssiThreshold(byte curRssi, int reason)
public void autoRoamSetBSSID(int netId, String bssid)
public boolean autoRoamSetBSSID(WifiConfiguration config, String bssid)
public void clearANQPCache()
public void setAllowScansWithTraffic(int enabled)
public int getAllowScansWithTraffic()
public boolean setEnableAutoJoinWhenAssociated(boolean enabled)
public boolean getEnableAutoJoinWhenAssociated()
public Messenger getMessenger()
public boolean syncPingSupplicant(AsyncChannel channel)
public void startScan(int callingUid, int scanCounter, ScanSettings settings, WorkSource workSource)
callingUid
- The uid initiating the wifi scan. Blame will be given here unless
workSource is specified.workSource
- If not null, blame is given to workSource.settings
- Scan settings, see ScanSettings
.public long getDisconnectedTimeMilli()
public void setSupplicantRunning(boolean enable)
public void setHostApRunning(WifiConfiguration wifiConfig, boolean enable)
public void setWifiApConfiguration(WifiConfiguration config)
public WifiConfiguration syncGetWifiApConfiguration()
public int syncGetWifiState()
public String syncGetWifiStateByName()
public int syncGetWifiApState()
public String syncGetWifiApStateByName()
public boolean isConnected()
public boolean isDisconnected()
public boolean isSupplicantTransientState()
public boolean isLinkDebouncing()
public WifiInfo syncRequestConnectionInfo()
WifiInfo
object containing information about the current connectionpublic WifiInfo getWifiInfo()
public DhcpResults syncGetDhcpResults()
public void setDriverStart(boolean enable)
public void setOperationalMode(int mode)
protected int getOperationalModeForTest()
public List<ScanResult> syncGetScanResultsList()
public int syncAddPasspointManagementObject(AsyncChannel channel, String managementObject)
public int syncModifyPasspointManagementObject(AsyncChannel channel, String fqdn, List<PasspointManagementObjectDefinition> managementObjectDefinitions)
public boolean syncQueryPasspointIcon(AsyncChannel channel, long bssid, String fileName)
public int matchProviderWithCurrentNetwork(AsyncChannel channel, String fqdn)
public void deauthenticateNetwork(AsyncChannel channel, long holdoff, boolean ess)
holdoff
- hold off time in millisecondsess
- set if the hold off pertains to an ESS rather than a BSSpublic void disableEphemeralNetwork(String SSID)
public void disconnectCommand()
public void disconnectCommand(int uid, int reason)
public void reconnectCommand()
public void reassociateCommand()
public void reloadTlsNetworksAndReconnect()
public int syncAddOrUpdateNetwork(AsyncChannel channel, WifiConfiguration config)
public List<WifiConfiguration> syncGetConfiguredNetworks(int uuid, AsyncChannel channel)
channel
- public List<WifiConfiguration> syncGetPrivilegedConfiguredNetwork(AsyncChannel channel)
public WifiConfiguration syncGetMatchingWifiConfig(ScanResult scanResult, AsyncChannel channel)
public WifiConnectionStatistics syncGetConnectionStatistics(AsyncChannel channel)
channel
- public int syncGetSupportedFeatures(AsyncChannel channel)
public WifiLinkLayerStats syncGetLinkLayerStats(AsyncChannel channel)
public boolean syncRemoveNetwork(AsyncChannel channel, int networkId)
networkId
- id of the network to be removedpublic boolean syncEnableNetwork(AsyncChannel channel, int netId, boolean disableOthers)
netId
- network id of the networkdisableOthers
- true, if all other networks have to be disabledtrue
if the operation succeeds, false
otherwisepublic boolean syncDisableNetwork(AsyncChannel channel, int netId)
netId
- network id of the networktrue
if the operation succeeds, false
otherwisepublic String syncGetWpsNfcConfigurationToken(int netId)
public void addToBlacklist(String bssid)
bssid
- BSSID of the networkpublic void clearBlacklist()
public void enableRssiPolling(boolean enabled)
public void enableAllNetworks()
public void startFilteringMulticastPackets()
public void stopFilteringMulticastPackets()
public void setHighPerfModeEnabled(boolean enable)
enable
- true if enable, false otherwisepublic void resetSimAuthNetworks(boolean simPresent)
public Network getCurrentNetwork()
public void setFrequencyBand(int band, boolean persist)
band
- persist
- true
if the setting should be remembered.public void enableTdls(String remoteMacAddress, boolean enable)
public int getFrequencyBand()
public String getConfigFile()
public void sendBluetoothAdapterStateChange(int state)
public void removeAppConfigs(String packageName, int uid)
public void removeUserConfigs(int userId)
public boolean syncSaveConfig(AsyncChannel channel)
true
if the operation succeeds, false
otherwise
TODO: deprecate thispublic void updateBatteryWorkSource(WorkSource newSource)
public void dumpIpManager(FileDescriptor fd, PrintWriter pw, String[] args)
public void dump(FileDescriptor fd, PrintWriter pw, String[] args)
StateMachine
dump
in class StateMachine
public void handleUserSwitch(int userId)
protected String getLogRecString(Message msg)
getLogRecString
in class StateMachine
msg
- that was processedpublic double getTxPacketRate()
public double getRxPacketRate()
public WifiConfiguration getCurrentWifiConfiguration()
public void autoConnectToNetwork(int networkId, String bssid)
networkId
- ID of the network to connect tobssid
- BSSID of the networkpublic void autoRoamToNetwork(int networkId, ScanResult scanResult)
networkId
- ID of the network to roam toscanResult
- scan result which identifies the network to roam topublic void enableWifiConnectivityManager(boolean enabled)
enabled
- true-enable; false-disable