public class WifiServiceImpl
extends IWifiManager.Stub
Constructor and Description |
---|
WifiServiceImpl(Context context) |
Modifier and Type | Method and Description |
---|---|
void |
acquireMulticastLock(IBinder binder,
String tag) |
boolean |
acquireWifiLock(IBinder binder,
int lockMode,
String tag,
WorkSource ws) |
int |
addOrUpdateNetwork(WifiConfiguration config)
|
int |
addPasspointManagementObject(String mo)
Add a Hotspot 2.0 release 2 Management Object
|
void |
addToBlacklist(String bssid)
|
WifiConfiguration |
buildWifiConfig(String uriString,
String mimeType,
byte[] data)
see
WifiManager#buildWifiConfig() |
void |
checkAndStartWifi()
Check if Wi-Fi needs to be enabled and start
if needed
This function is used only at boot time
|
static String |
checkPasspointValidity(WifiConfiguration config) |
static String |
checkValidity(WifiConfiguration config) |
void |
clearBlacklist()
|
void |
deauthenticateNetwork(long holdoff,
boolean ess)
Deauthenticate and set the re-authentication hold off time for the current network
|
void |
disableEphemeralNetwork(String SSID)
Disable an ephemeral network, i.e. network that is created thru a WiFi Scorer
|
boolean |
disableNetwork(int netId)
|
void |
disconnect()
|
protected void |
dump(FileDescriptor fd,
PrintWriter pw,
String[] args) |
void |
enableAggressiveHandover(int enabled) |
boolean |
enableNetwork(int netId,
boolean disableOthers)
|
void |
enableTdls(String remoteAddress,
boolean enable) |
void |
enableTdlsWithMacAddress(String remoteMacAddress,
boolean enable) |
void |
enableVerboseLogging(int verbose) |
void |
enableWifiConnectivityManager(boolean enabled)
Enable/disable WifiConnectivityManager at runtime
|
void |
factoryReset() |
int |
getAggressiveHandover() |
int |
getAllowScansWithTraffic() |
String |
getConfigFile()
Get the IP and proxy configuration file
|
List<WifiConfiguration> |
getConfiguredNetworks()
|
WifiInfo |
getConnectionInfo()
|
WifiConnectionStatistics |
getConnectionStatistics() |
String |
getCountryCode()
Get the country code
|
Network |
getCurrentNetwork() |
DhcpInfo |
getDhcpInfo()
Deprecated.
|
boolean |
getEnableAutoJoinWhenAssociated() |
int |
getFrequencyBand()
Get the operational frequency band
|
WifiConfiguration |
getMatchingWifiConfig(ScanResult scanResult)
Returns a WifiConfiguration matching this ScanResult
|
List<WifiConfiguration> |
getPrivilegedConfiguredNetworks()
|
List<ScanResult> |
getScanResults(String callingPackage)
Return the results of the most recent access point scan, in the form of
a list of
ScanResult objects. |
int |
getSupportedFeatures()
|
int |
getVerboseLoggingLevel() |
WifiConfiguration |
getWifiApConfiguration()
|
int |
getWifiApEnabledState()
|
int |
getWifiEnabledState()
|
Messenger |
getWifiServiceMessenger()
Get a reference to handler.
|
String |
getWpsNfcConfigurationToken(int netId) |
void |
handleUserSwitch(int userId) |
void |
hideCertFromUnaffiliatedUsers(String alias) |
void |
initializeMulticastFiltering() |
boolean |
isDualBandSupported() |
boolean |
isMulticastEnabled() |
boolean |
isScanAlwaysAvailable() |
static boolean |
isValid(WifiConfiguration config) |
static boolean |
isValidPasspoint(WifiConfiguration config) |
String[] |
listClientCertsForCurrentUser() |
int |
matchProviderWithCurrentNetwork(String fqdn)
Match the currently associated network against the SP matching the given FQDN
|
int |
modifyPasspointManagementObject(String fqdn,
List<PasspointManagementObjectDefinition> mos)
Modify a Hotspot 2.0 release 2 Management Object
|
boolean |
pingSupplicant()
|
void |
queryPasspointIcon(long bssid,
String fileName)
Query for a Hotspot 2.0 release 2 OSU icon
|
void |
reassociate()
|
void |
reconnect()
|
void |
releaseMulticastLock() |
boolean |
releaseWifiLock(IBinder binder) |
boolean |
removeNetwork(int netId)
|
WifiActivityEnergyInfo |
reportActivityInfo()
|
void |
requestActivityInfo(ResultReceiver result) |
boolean |
saveConfiguration()
Tell the supplicant to persist the current list of configured networks.
|
void |
setAllowScansWithTraffic(int enabled) |
void |
setCountryCode(String countryCode,
boolean persist)
Set the country code
|
boolean |
setEnableAutoJoinWhenAssociated(boolean enabled) |
void |
setFrequencyBand(int band,
boolean persist)
Set the operational frequency band
|
void |
setWifiApConfiguration(WifiConfiguration wifiConfig)
|
void |
setWifiApEnabled(WifiConfiguration wifiConfig,
boolean enabled)
|
boolean |
setWifiEnabled(boolean enable)
|
void |
startScan(ScanSettings settings,
WorkSource workSource)
see
WifiManager.startScan()
and android.net.wifi.WifiManager#startCustomizedScan |
static String |
toHexString(String s) |
void |
updateWifiLockWorkSource(IBinder binder,
WorkSource ws) |
static void |
verifyCert(X509Certificate caCert) |
public WifiServiceImpl(Context context)
public void checkAndStartWifi()
public void handleUserSwitch(int userId)
public boolean pingSupplicant()
true
if the operation succeeds, false
otherwisepublic void startScan(ScanSettings settings, WorkSource workSource)
WifiManager.startScan()
and android.net.wifi.WifiManager#startCustomizedScan
settings
- If null, use default parameter, i.e. full scan.workSource
- If null, all blame is given to the calling uid.public String getWpsNfcConfigurationToken(int netId)
public boolean setWifiEnabled(boolean enable)
enable
- true
to enable, false
to disable.true
if the enable/disable operation was
started or is already in the queue.public int getWifiEnabledState()
public void setWifiApEnabled(WifiConfiguration wifiConfig, boolean enabled)
wifiConfig
- SSID, security and channel details as
part of WifiConfigurationenabled
- true to enable and false to disablepublic int getWifiApEnabledState()
public WifiConfiguration getWifiApConfiguration()
public WifiConfiguration buildWifiConfig(String uriString, String mimeType, byte[] data)
WifiManager#buildWifiConfig()
public void setWifiApConfiguration(WifiConfiguration wifiConfig)
wifiConfig
- WifiConfiguration details for soft access pointpublic boolean isScanAlwaysAvailable()
enable
- true
to enable, false
to disable.true
if the enable/disable operation was
started or is already in the queue.public void disconnect()
public void reconnect()
public void reassociate()
public int getSupportedFeatures()
public void requestActivityInfo(ResultReceiver result)
public WifiActivityEnergyInfo reportActivityInfo()
public List<WifiConfiguration> getConfiguredNetworks()
public List<WifiConfiguration> getPrivilegedConfiguredNetworks()
public WifiConfiguration getMatchingWifiConfig(ScanResult scanResult)
scanResult
- scanResult that represents the BSSIDWifiConfiguration
that matches this BSSID or nullpublic int addOrUpdateNetwork(WifiConfiguration config)
-1
if it failspublic static void verifyCert(X509Certificate caCert) throws GeneralSecurityException, IOException
GeneralSecurityException
IOException
public boolean removeNetwork(int netId)
netId
- the integer that identifies the network configuration
to the supplicanttrue
if the operation succeededpublic boolean enableNetwork(int netId, boolean disableOthers)
netId
- the integer that identifies the network configuration
to the supplicantdisableOthers
- if true, disable all other networks.true
if the operation succeededpublic boolean disableNetwork(int netId)
netId
- the integer that identifies the network configuration
to the supplicanttrue
if the operation succeededpublic WifiInfo getConnectionInfo()
WifiInfo
.public List<ScanResult> getScanResults(String callingPackage)
ScanResult
objects.public int addPasspointManagementObject(String mo)
mo
- The MO in XML formpublic int modifyPasspointManagementObject(String fqdn, List<PasspointManagementObjectDefinition> mos)
fqdn
- The FQDN of the service providermos
- A List of MO definitions to be updatedpublic void queryPasspointIcon(long bssid, String fileName)
bssid
- The BSSID of the APfileName
- Icon file namepublic int matchProviderWithCurrentNetwork(String fqdn)
fqdn
- FQDN of the SPpublic void deauthenticateNetwork(long holdoff, boolean ess)
holdoff
- hold off time in millisecondsess
- set if the hold off pertains to an ESS rather than a BSSpublic boolean saveConfiguration()
true
if the operation succeeded
TODO: deprecate thispublic void setCountryCode(String countryCode, boolean persist)
countryCode
- ISO 3166 country code.persist
- true
if the setting should be remembered.
The persist behavior exists so that wifi can fall back to the last
persisted country code on a restart, when the locale information is
not available from telephony.public String getCountryCode()
public void setFrequencyBand(int band, boolean persist)
band
- One of
WifiManager.WIFI_FREQUENCY_BAND_AUTO
,
WifiManager.WIFI_FREQUENCY_BAND_5GHZ
,
WifiManager.WIFI_FREQUENCY_BAND_2GHZ
,persist
- true
if the setting should be remembered.public int getFrequencyBand()
public boolean isDualBandSupported()
public DhcpInfo getDhcpInfo()
public void addToBlacklist(String bssid)
public void clearBlacklist()
public void enableTdls(String remoteAddress, boolean enable)
public void enableTdlsWithMacAddress(String remoteMacAddress, boolean enable)
public Messenger getWifiServiceMessenger()
public void disableEphemeralNetwork(String SSID)
public String getConfigFile()
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args)
public boolean acquireWifiLock(IBinder binder, int lockMode, String tag, WorkSource ws)
public void updateWifiLockWorkSource(IBinder binder, WorkSource ws)
public boolean releaseWifiLock(IBinder binder)
public void initializeMulticastFiltering()
public void releaseMulticastLock()
public boolean isMulticastEnabled()
public void enableVerboseLogging(int verbose)
public int getVerboseLoggingLevel()
public void enableAggressiveHandover(int enabled)
public int getAggressiveHandover()
public void setAllowScansWithTraffic(int enabled)
public int getAllowScansWithTraffic()
public boolean setEnableAutoJoinWhenAssociated(boolean enabled)
public boolean getEnableAutoJoinWhenAssociated()
public WifiConnectionStatistics getConnectionStatistics()
public void factoryReset()
public static boolean isValid(WifiConfiguration config)
public static boolean isValidPasspoint(WifiConfiguration config)
public static String checkValidity(WifiConfiguration config)
public static String checkPasspointValidity(WifiConfiguration config)
public Network getCurrentNetwork()
public void hideCertFromUnaffiliatedUsers(String alias)
public String[] listClientCertsForCurrentUser()
public void enableWifiConnectivityManager(boolean enabled)
enabled
- true-enable; false-disable