public class WifiConfigStore extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ID_STRING_KEY_CONFIG_KEY |
static String |
ID_STRING_KEY_CREATOR_UID |
static String |
ID_STRING_KEY_FQDN |
static String |
ID_STRING_VAR_NAME |
static int |
STORED_VALUE_FOR_REQUIRE_PMF |
static String |
SUPPLICANT_CONFIG_FILE |
static String |
SUPPLICANT_CONFIG_FILE_BACKUP |
static String |
TAG |
Modifier and Type | Method and Description |
---|---|
boolean |
addOrUpdateNetwork(WifiConfiguration config,
WifiConfiguration existingConfig)
Add or update a network configuration to wpa_supplicant.
|
void |
blackListBssid(String bssid)
Add a BSSID to the blacklist.
|
void |
clearBssidBlacklist()
Clear BSSID blacklist in wpa_supplicant.
|
boolean |
disableAllNetworks(Collection<WifiConfiguration> configs)
Disables all the networks in the provided list in wpa_supplicant.
|
void |
enableHS20(boolean enable)
Enable/Disable HS20 parameter in wpa_supplicant.
|
boolean |
isBssidBlacklisted(String bssid)
Checks if the provided bssid is blacklisted or not.
|
int |
loadNetworks(Map<String,WifiConfiguration> configs,
SparseArray<Map<String,String>> networkExtras)
Load all the configured networks from wpa_supplicant.
|
protected void |
log(String s) |
protected void |
logd(String s) |
protected void |
loge(String s) |
protected void |
loge(String s,
boolean stack) |
protected void |
logi(String s) |
void |
readNetworkVariables(WifiConfiguration config)
Read the variables from the supplicant daemon that are needed to
fill in the WifiConfiguration object.
|
Map<String,String> |
readNetworkVariablesFromReader(BufferedReader reader,
String key)
Read network variables from a given reader.
|
Map<String,String> |
readNetworkVariablesFromSupplicantFile(String key)
Read network variables from wpa_supplicant.conf.
|
boolean |
removeNetwork(WifiConfiguration config)
Remove the specified network and save config
|
void |
resetSimNetworks(Collection<WifiConfiguration> configs)
Resets all sim networks from the provided network list.
|
boolean |
saveConfig()
Save the current configuration to wpa_supplicant.conf.
|
boolean |
saveNetworkMetadata(WifiConfiguration config)
Update the network metadata info stored in wpa_supplicant network extra field.
|
boolean |
selectNetwork(WifiConfiguration config,
Collection<WifiConfiguration> configs)
Select a network in wpa_supplicant.
|
boolean |
setNetworkBSSID(WifiConfiguration config,
String bssid)
Set BSSID for a network in wpa_supplicant from network selection.
|
boolean |
setNetworkPriority(WifiConfiguration config,
int priority)
Set priority for a network in wpa_supplicant.
|
boolean |
setNetworkSSID(WifiConfiguration config,
String ssid)
Set SSID for a network in wpa_supplicant.
|
WpsResult |
startWpsPbc(WpsInfo config,
Collection<WifiConfiguration> configs)
Start WPS push button configuration
|
WpsResult |
startWpsWithPinFromAccessPoint(WpsInfo config,
Collection<WifiConfiguration> configs)
Start WPS pin method configuration with pin obtained
from the access point
|
WpsResult |
startWpsWithPinFromDevice(WpsInfo config,
Collection<WifiConfiguration> configs)
Start WPS pin method configuration with obtained
from the device
|
public static final String TAG
public static final String ID_STRING_VAR_NAME
public static final String ID_STRING_KEY_FQDN
public static final String ID_STRING_KEY_CREATOR_UID
public static final String ID_STRING_KEY_CONFIG_KEY
public static final String SUPPLICANT_CONFIG_FILE
public static final String SUPPLICANT_CONFIG_FILE_BACKUP
public static final int STORED_VALUE_FOR_REQUIRE_PMF
public void readNetworkVariables(WifiConfiguration config)
config
- the WifiConfiguration
object to be filled in.public int loadNetworks(Map<String,WifiConfiguration> configs, SparseArray<Map<String,String>> networkExtras)
configs
- Map of configuration key to configuration objects corresponding to all
the networks.networkExtras
- Map of extra configuration parameters stored in wpa_supplicant.confpublic boolean saveNetworkMetadata(WifiConfiguration config)
config
- Config corresponding to the network.public boolean addOrUpdateNetwork(WifiConfiguration config, WifiConfiguration existingConfig)
config
- Config corresponding to the network.existingConfig
- Existing config corresponding to the network saved in our database.public boolean removeNetwork(WifiConfiguration config)
config
- Config corresponding to the network.true
if it succeeds, false
otherwisepublic boolean selectNetwork(WifiConfiguration config, Collection<WifiConfiguration> configs)
config
- Config corresponding to the network.public boolean setNetworkPriority(WifiConfiguration config, int priority)
config
- Config corresponding to the network.public boolean setNetworkSSID(WifiConfiguration config, String ssid)
config
- Config corresponding to the network.public boolean setNetworkBSSID(WifiConfiguration config, String bssid)
config
- Config corresponding to the network.bssid
- BSSID to be set.public void enableHS20(boolean enable)
enable
- Enable/Disable the parameter.public boolean disableAllNetworks(Collection<WifiConfiguration> configs)
configs
- Collection of configs which needs to be enabled.public boolean saveConfig()
public Map<String,String> readNetworkVariablesFromSupplicantFile(String key)
key
- The parameter to be parsed.public Map<String,String> readNetworkVariablesFromReader(BufferedReader reader, String key) throws IOException
reader
- The reader to read the network variables from.key
- The parameter to be parsed.IOException
public void resetSimNetworks(Collection<WifiConfiguration> configs)
configs
- List of all the networks.public void clearBssidBlacklist()
public void blackListBssid(String bssid)
bssid
- bssid to be added.public boolean isBssidBlacklisted(String bssid)
bssid
- bssid to be checked.public WpsResult startWpsWithPinFromAccessPoint(WpsInfo config, Collection<WifiConfiguration> configs)
config
- WPS configurationpublic WpsResult startWpsWithPinFromDevice(WpsInfo config, Collection<WifiConfiguration> configs)
public WpsResult startWpsPbc(WpsInfo config, Collection<WifiConfiguration> configs)
config
- WPS configurationprotected void logd(String s)
protected void logi(String s)
protected void loge(String s)
protected void loge(String s, boolean stack)
protected void log(String s)