summaryrefslogtreecommitdiffstats
path: root/wifi/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'wifi/java/android')
-rw-r--r--wifi/java/android/net/wifi/WifiConfigStore.java86
-rw-r--r--wifi/java/android/net/wifi/WifiNative.java326
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java114
-rw-r--r--wifi/java/android/net/wifi/p2p/WifiP2pService.java4
4 files changed, 343 insertions, 187 deletions
diff --git a/wifi/java/android/net/wifi/WifiConfigStore.java b/wifi/java/android/net/wifi/WifiConfigStore.java
index d345411..cba0fba 100644
--- a/wifi/java/android/net/wifi/WifiConfigStore.java
+++ b/wifi/java/android/net/wifi/WifiConfigStore.java
@@ -179,7 +179,7 @@ class WifiConfigStore {
boolean networkEnabledStateChanged = false;
for(WifiConfiguration config : sConfiguredNetworks.values()) {
if(config != null && config.status == Status.DISABLED) {
- if(WifiNative.enableNetworkCommand(config.networkId, false)) {
+ if(WifiNative.enableNetwork(config.networkId, false)) {
networkEnabledStateChanged = true;
config.status = Status.ENABLED;
} else {
@@ -189,7 +189,7 @@ class WifiConfigStore {
}
if (networkEnabledStateChanged) {
- WifiNative.saveConfigCommand();
+ WifiNative.saveConfig();
sendConfiguredNetworksChangedBroadcast();
}
}
@@ -249,7 +249,7 @@ class WifiConfigStore {
config.priority = ++sLastPriority;
addOrUpdateNetworkNative(config);
- WifiNative.saveConfigCommand();
+ WifiNative.saveConfig();
/* Enable the given network while disabling all other networks */
enableNetworkWithoutBroadcast(netId, true);
@@ -269,10 +269,10 @@ class WifiConfigStore {
int netId = result.getNetworkId();
/* enable a new network */
if (newNetwork && netId != INVALID_NETWORK_ID) {
- WifiNative.enableNetworkCommand(netId, false);
+ WifiNative.enableNetwork(netId, false);
sConfiguredNetworks.get(netId).status = Status.ENABLED;
}
- WifiNative.saveConfigCommand();
+ WifiNative.saveConfig();
sendConfiguredNetworksChangedBroadcast();
return result;
}
@@ -301,8 +301,8 @@ class WifiConfigStore {
* @param netId network to forget
*/
static void forgetNetwork(int netId) {
- if (WifiNative.removeNetworkCommand(netId)) {
- WifiNative.saveConfigCommand();
+ if (WifiNative.removeNetwork(netId)) {
+ WifiNative.saveConfig();
WifiConfiguration config = sConfiguredNetworks.get(netId);
if (config != null) {
sConfiguredNetworks.remove(netId);
@@ -338,7 +338,7 @@ class WifiConfigStore {
* @param netId network to be removed
*/
static boolean removeNetwork(int netId) {
- boolean ret = WifiNative.removeNetworkCommand(netId);
+ boolean ret = WifiNative.removeNetwork(netId);
if (ret) {
WifiConfiguration config = sConfiguredNetworks.get(netId);
if (config != null) {
@@ -365,7 +365,7 @@ class WifiConfigStore {
}
static boolean enableNetworkWithoutBroadcast(int netId, boolean disableOthers) {
- boolean ret = WifiNative.enableNetworkCommand(netId, disableOthers);
+ boolean ret = WifiNative.enableNetwork(netId, disableOthers);
WifiConfiguration config = sConfiguredNetworks.get(netId);
if (config != null) config.status = Status.ENABLED;
@@ -390,7 +390,7 @@ class WifiConfigStore {
* @param reason reason code network was disabled
*/
static boolean disableNetwork(int netId, int reason) {
- boolean ret = WifiNative.disableNetworkCommand(netId);
+ boolean ret = WifiNative.disableNetwork(netId);
WifiConfiguration config = sConfiguredNetworks.get(netId);
/* Only change the reason if the network was not previously disabled */
if (config != null && config.status != Status.DISABLED) {
@@ -405,7 +405,7 @@ class WifiConfigStore {
* Save the configured networks in supplicant to disk
*/
static boolean saveConfig() {
- return WifiNative.saveConfigCommand();
+ return WifiNative.saveConfig();
}
/**
@@ -414,7 +414,7 @@ class WifiConfigStore {
*/
static WpsResult startWpsWithPinFromAccessPoint(WpsInfo config) {
WpsResult result = new WpsResult();
- if (WifiNative.startWpsWithPinFromAccessPointCommand(config.BSSID, config.pin)) {
+ if (WifiNative.startWpsRegistrar(config.BSSID, config.pin)) {
/* WPS leaves all networks disabled */
markAllNetworksDisabled();
result.status = WpsResult.Status.SUCCESS;
@@ -432,7 +432,7 @@ class WifiConfigStore {
*/
static WpsResult startWpsWithPinFromDevice(WpsInfo config) {
WpsResult result = new WpsResult();
- result.pin = WifiNative.startWpsWithPinFromDeviceCommand(config.BSSID);
+ result.pin = WifiNative.startWpsPinDisplay(config.BSSID);
/* WPS leaves all networks disabled */
if (!TextUtils.isEmpty(result.pin)) {
markAllNetworksDisabled();
@@ -449,7 +449,7 @@ class WifiConfigStore {
*/
static WpsResult startWpsPbc(WpsInfo config) {
WpsResult result = new WpsResult();
- if (WifiNative.startWpsPbcCommand(config.BSSID)) {
+ if (WifiNative.startWpsPbc(config.BSSID)) {
/* WPS leaves all networks disabled */
markAllNetworksDisabled();
result.status = WpsResult.Status.SUCCESS;
@@ -558,7 +558,7 @@ class WifiConfigStore {
}
static void loadConfiguredNetworks() {
- String listStr = WifiNative.listNetworksCommand();
+ String listStr = WifiNative.listNetworks();
sLastPriority = 0;
sConfiguredNetworks.clear();
@@ -916,7 +916,7 @@ class WifiConfigStore {
netId = savedNetId;
} else {
newNetwork = true;
- netId = WifiNative.addNetworkCommand();
+ netId = WifiNative.addNetwork();
if (netId < 0) {
loge("Failed to add a network!");
return new NetworkUpdateResult(INVALID_NETWORK_ID);
@@ -929,7 +929,7 @@ class WifiConfigStore {
setVariables: {
if (config.SSID != null &&
- !WifiNative.setNetworkVariableCommand(
+ !WifiNative.setNetworkVariable(
netId,
WifiConfiguration.ssidVarName,
config.SSID)) {
@@ -938,7 +938,7 @@ class WifiConfigStore {
}
if (config.BSSID != null &&
- !WifiNative.setNetworkVariableCommand(
+ !WifiNative.setNetworkVariable(
netId,
WifiConfiguration.bssidVarName,
config.BSSID)) {
@@ -949,7 +949,7 @@ class WifiConfigStore {
String allowedKeyManagementString =
makeString(config.allowedKeyManagement, WifiConfiguration.KeyMgmt.strings);
if (config.allowedKeyManagement.cardinality() != 0 &&
- !WifiNative.setNetworkVariableCommand(
+ !WifiNative.setNetworkVariable(
netId,
WifiConfiguration.KeyMgmt.varName,
allowedKeyManagementString)) {
@@ -961,7 +961,7 @@ class WifiConfigStore {
String allowedProtocolsString =
makeString(config.allowedProtocols, WifiConfiguration.Protocol.strings);
if (config.allowedProtocols.cardinality() != 0 &&
- !WifiNative.setNetworkVariableCommand(
+ !WifiNative.setNetworkVariable(
netId,
WifiConfiguration.Protocol.varName,
allowedProtocolsString)) {
@@ -973,7 +973,7 @@ class WifiConfigStore {
String allowedAuthAlgorithmsString =
makeString(config.allowedAuthAlgorithms, WifiConfiguration.AuthAlgorithm.strings);
if (config.allowedAuthAlgorithms.cardinality() != 0 &&
- !WifiNative.setNetworkVariableCommand(
+ !WifiNative.setNetworkVariable(
netId,
WifiConfiguration.AuthAlgorithm.varName,
allowedAuthAlgorithmsString)) {
@@ -986,7 +986,7 @@ class WifiConfigStore {
makeString(config.allowedPairwiseCiphers,
WifiConfiguration.PairwiseCipher.strings);
if (config.allowedPairwiseCiphers.cardinality() != 0 &&
- !WifiNative.setNetworkVariableCommand(
+ !WifiNative.setNetworkVariable(
netId,
WifiConfiguration.PairwiseCipher.varName,
allowedPairwiseCiphersString)) {
@@ -998,7 +998,7 @@ class WifiConfigStore {
String allowedGroupCiphersString =
makeString(config.allowedGroupCiphers, WifiConfiguration.GroupCipher.strings);
if (config.allowedGroupCiphers.cardinality() != 0 &&
- !WifiNative.setNetworkVariableCommand(
+ !WifiNative.setNetworkVariable(
netId,
WifiConfiguration.GroupCipher.varName,
allowedGroupCiphersString)) {
@@ -1010,7 +1010,7 @@ class WifiConfigStore {
// Prevent client screw-up by passing in a WifiConfiguration we gave it
// by preventing "*" as a key.
if (config.preSharedKey != null && !config.preSharedKey.equals("*") &&
- !WifiNative.setNetworkVariableCommand(
+ !WifiNative.setNetworkVariable(
netId,
WifiConfiguration.pskVarName,
config.preSharedKey)) {
@@ -1024,7 +1024,7 @@ class WifiConfigStore {
// Prevent client screw-up by passing in a WifiConfiguration we gave it
// by preventing "*" as a key.
if (config.wepKeys[i] != null && !config.wepKeys[i].equals("*")) {
- if (!WifiNative.setNetworkVariableCommand(
+ if (!WifiNative.setNetworkVariable(
netId,
WifiConfiguration.wepKeyVarNames[i],
config.wepKeys[i])) {
@@ -1037,7 +1037,7 @@ class WifiConfigStore {
}
if (hasSetKey) {
- if (!WifiNative.setNetworkVariableCommand(
+ if (!WifiNative.setNetworkVariable(
netId,
WifiConfiguration.wepTxKeyIdxVarName,
Integer.toString(config.wepTxKeyIndex))) {
@@ -1046,7 +1046,7 @@ class WifiConfigStore {
}
}
- if (!WifiNative.setNetworkVariableCommand(
+ if (!WifiNative.setNetworkVariable(
netId,
WifiConfiguration.priorityVarName,
Integer.toString(config.priority))) {
@@ -1055,7 +1055,7 @@ class WifiConfigStore {
break setVariables;
}
- if (config.hiddenSSID && !WifiNative.setNetworkVariableCommand(
+ if (config.hiddenSSID && !WifiNative.setNetworkVariable(
netId,
WifiConfiguration.hiddenSSIDVarName,
Integer.toString(config.hiddenSSID ? 1 : 0))) {
@@ -1072,7 +1072,7 @@ class WifiConfigStore {
if (field != config.eap) {
value = (value.length() == 0) ? "NULL" : convertToQuotedString(value);
}
- if (!WifiNative.setNetworkVariableCommand(
+ if (!WifiNative.setNetworkVariable(
netId,
varName,
value)) {
@@ -1087,7 +1087,7 @@ class WifiConfigStore {
if (updateFailed) {
if (newNetwork) {
- WifiNative.removeNetworkCommand(netId);
+ WifiNative.removeNetwork(netId);
loge("Failed to set a network variable, removed network: " + netId);
}
return new NetworkUpdateResult(INVALID_NETWORK_ID);
@@ -1248,21 +1248,21 @@ class WifiConfigStore {
*/
String value;
- value = WifiNative.getNetworkVariableCommand(netId, WifiConfiguration.ssidVarName);
+ value = WifiNative.getNetworkVariable(netId, WifiConfiguration.ssidVarName);
if (!TextUtils.isEmpty(value)) {
config.SSID = value;
} else {
config.SSID = null;
}
- value = WifiNative.getNetworkVariableCommand(netId, WifiConfiguration.bssidVarName);
+ value = WifiNative.getNetworkVariable(netId, WifiConfiguration.bssidVarName);
if (!TextUtils.isEmpty(value)) {
config.BSSID = value;
} else {
config.BSSID = null;
}
- value = WifiNative.getNetworkVariableCommand(netId, WifiConfiguration.priorityVarName);
+ value = WifiNative.getNetworkVariable(netId, WifiConfiguration.priorityVarName);
config.priority = -1;
if (!TextUtils.isEmpty(value)) {
try {
@@ -1271,7 +1271,7 @@ class WifiConfigStore {
}
}
- value = WifiNative.getNetworkVariableCommand(netId, WifiConfiguration.hiddenSSIDVarName);
+ value = WifiNative.getNetworkVariable(netId, WifiConfiguration.hiddenSSIDVarName);
config.hiddenSSID = false;
if (!TextUtils.isEmpty(value)) {
try {
@@ -1280,7 +1280,7 @@ class WifiConfigStore {
}
}
- value = WifiNative.getNetworkVariableCommand(netId, WifiConfiguration.wepTxKeyIdxVarName);
+ value = WifiNative.getNetworkVariable(netId, WifiConfiguration.wepTxKeyIdxVarName);
config.wepTxKeyIndex = -1;
if (!TextUtils.isEmpty(value)) {
try {
@@ -1290,7 +1290,7 @@ class WifiConfigStore {
}
for (int i = 0; i < 4; i++) {
- value = WifiNative.getNetworkVariableCommand(netId,
+ value = WifiNative.getNetworkVariable(netId,
WifiConfiguration.wepKeyVarNames[i]);
if (!TextUtils.isEmpty(value)) {
config.wepKeys[i] = value;
@@ -1299,14 +1299,14 @@ class WifiConfigStore {
}
}
- value = WifiNative.getNetworkVariableCommand(netId, WifiConfiguration.pskVarName);
+ value = WifiNative.getNetworkVariable(netId, WifiConfiguration.pskVarName);
if (!TextUtils.isEmpty(value)) {
config.preSharedKey = value;
} else {
config.preSharedKey = null;
}
- value = WifiNative.getNetworkVariableCommand(config.networkId,
+ value = WifiNative.getNetworkVariable(config.networkId,
WifiConfiguration.Protocol.varName);
if (!TextUtils.isEmpty(value)) {
String vals[] = value.split(" ");
@@ -1319,7 +1319,7 @@ class WifiConfigStore {
}
}
- value = WifiNative.getNetworkVariableCommand(config.networkId,
+ value = WifiNative.getNetworkVariable(config.networkId,
WifiConfiguration.KeyMgmt.varName);
if (!TextUtils.isEmpty(value)) {
String vals[] = value.split(" ");
@@ -1332,7 +1332,7 @@ class WifiConfigStore {
}
}
- value = WifiNative.getNetworkVariableCommand(config.networkId,
+ value = WifiNative.getNetworkVariable(config.networkId,
WifiConfiguration.AuthAlgorithm.varName);
if (!TextUtils.isEmpty(value)) {
String vals[] = value.split(" ");
@@ -1345,7 +1345,7 @@ class WifiConfigStore {
}
}
- value = WifiNative.getNetworkVariableCommand(config.networkId,
+ value = WifiNative.getNetworkVariable(config.networkId,
WifiConfiguration.PairwiseCipher.varName);
if (!TextUtils.isEmpty(value)) {
String vals[] = value.split(" ");
@@ -1358,7 +1358,7 @@ class WifiConfigStore {
}
}
- value = WifiNative.getNetworkVariableCommand(config.networkId,
+ value = WifiNative.getNetworkVariable(config.networkId,
WifiConfiguration.GroupCipher.varName);
if (!TextUtils.isEmpty(value)) {
String vals[] = value.split(" ");
@@ -1373,7 +1373,7 @@ class WifiConfigStore {
for (WifiConfiguration.EnterpriseField field :
config.enterpriseFields) {
- value = WifiNative.getNetworkVariableCommand(netId,
+ value = WifiNative.getNetworkVariable(netId,
field.varName());
if (!TextUtils.isEmpty(value)) {
if (field != config.eap) value = removeDoubleQuotes(value);
diff --git a/wifi/java/android/net/wifi/WifiNative.java b/wifi/java/android/net/wifi/WifiNative.java
index 4c06558..b599054 100644
--- a/wifi/java/android/net/wifi/WifiNative.java
+++ b/wifi/java/android/net/wifi/WifiNative.java
@@ -28,20 +28,11 @@ import java.util.ArrayList;
import java.util.List;
/**
- * Native calls for sending requests to the supplicant daemon, and for
- * receiving asynchronous events. All methods of the form "xxxxCommand()"
- * must be single-threaded, to avoid requests and responses initiated
- * from multiple threads from being intermingled.
- * <p/>
- * Note that methods whose names are not of the form "xxxCommand()" do
- * not talk to the supplicant daemon.
- * Also, note that all WifiNative calls should happen in the
- * WifiStateTracker class except for waitForEvent() call which is
- * on a separate monitor channel for WifiMonitor
+ * Native calls for bring up/shut down of the supplicant daemon and for
+ * sending requests to the supplicant daemon
*
- * TODO: clean up the API and move the functionality from JNI to here. We should
- * be able to get everything done with doBooleanCommand, doIntCommand and
- * doStringCommand native commands
+ * waitForEvent() is called on the monitor thread for events. All other methods
+ * must be serialized from the framework.
*
* {@hide}
*/
@@ -51,8 +42,6 @@ public class WifiNative {
static final int BLUETOOTH_COEXISTENCE_MODE_DISABLED = 1;
static final int BLUETOOTH_COEXISTENCE_MODE_SENSE = 2;
- public native static String getErrorString(int errorCode);
-
public native static boolean loadDriver();
public native static boolean isDriverLoaded();
@@ -63,14 +52,6 @@ public class WifiNative {
public native static boolean startP2pSupplicant();
- /* Does a graceful shutdown of supplicant. Is a common stop function for both p2p and sta.
- *
- * Note that underneath we use a harsh-sounding "terminate" supplicant command
- * for a graceful stop and a mild-sounding "stop" interface
- * to kill the process
- */
- public native static boolean stopSupplicant();
-
/* Sends a kill signal to supplicant. To be used when we have lost connection
or when the supplicant is hung */
public native static boolean killSupplicant();
@@ -79,76 +60,216 @@ public class WifiNative {
public native static void closeSupplicantConnection();
- public native static boolean pingCommand();
+ /**
+ * Wait for the supplicant to send an event, returning the event string.
+ * @return the event string sent by the supplicant.
+ */
+ public native static String waitForEvent();
- public native static boolean scanCommand(boolean forceActive);
+ private native static boolean doBooleanCommand(String command);
- public native static boolean setScanModeCommand(boolean setActive);
+ private native static int doIntCommand(String command);
- public native static String listNetworksCommand();
+ private native static String doStringCommand(String command);
- public native static int addNetworkCommand();
+ public static boolean ping() {
+ String pong = doStringCommand("PING");
+ return (pong != null && pong.equals("PONG"));
+ }
- public native static boolean setNetworkVariableCommand(int netId, String name, String value);
+ public static boolean scan() {
+ return doBooleanCommand("SCAN");
+ }
- public native static String getNetworkVariableCommand(int netId, String name);
+ public static boolean setScanMode(boolean setActive) {
+ if (setActive) {
+ return doBooleanCommand("DRIVER SCAN-ACTIVE");
+ } else {
+ return doBooleanCommand("DRIVER SCAN-PASSIVE");
+ }
+ }
- public native static boolean removeNetworkCommand(int netId);
+ /* Does a graceful shutdown of supplicant. Is a common stop function for both p2p and sta.
+ *
+ * Note that underneath we use a harsh-sounding "terminate" supplicant command
+ * for a graceful stop and a mild-sounding "stop" interface
+ * to kill the process
+ */
+ public static boolean stopSupplicant() {
+ return doBooleanCommand("TERMINATE");
+ }
- public native static boolean enableNetworkCommand(int netId, boolean disableOthers);
+ public static String listNetworks() {
+ return doStringCommand("LIST_NETWORKS");
+ }
- public native static boolean disableNetworkCommand(int netId);
+ public static int addNetwork() {
+ return doIntCommand("ADD_NETWORK");
+ }
- public native static boolean reconnectCommand();
+ public static boolean setNetworkVariable(int netId, String name, String value) {
+ if (TextUtils.isEmpty(name) || TextUtils.isEmpty(value)) return false;
+ return doBooleanCommand("SET_NETWORK " + netId + " " + name + " " + value);
+ }
- public native static boolean reassociateCommand();
+ public static String getNetworkVariable(int netId, String name) {
+ if (TextUtils.isEmpty(name)) return null;
+ return doStringCommand("GET_NETWORK " + netId + " " + name);
+ }
- public native static boolean disconnectCommand();
+ public static boolean removeNetwork(int netId) {
+ return doBooleanCommand("REMOVE_NETWORK " + netId);
+ }
- public native static String statusCommand();
+ public static boolean enableNetwork(int netId, boolean disableOthers) {
+ if (disableOthers) {
+ return doBooleanCommand("SELECT_NETWORK " + netId);
+ } else {
+ return doBooleanCommand("ENABLE_NETWORK " + netId);
+ }
+ }
- public native static String getMacAddressCommand();
+ public static boolean disableNetwork(int netId) {
+ return doBooleanCommand("DISABLE_NETWORK " + netId);
+ }
- public native static String scanResultsCommand();
+ public static boolean reconnect() {
+ return doBooleanCommand("RECONNECT");
+ }
- public native static boolean startDriverCommand();
+ public static boolean reassociate() {
+ return doBooleanCommand("REASSOCIATE");
+ }
- public native static boolean stopDriverCommand();
+ public static boolean disconnect() {
+ return doBooleanCommand("DISCONNECT");
+ }
+
+ public static String status() {
+ return doStringCommand("STATUS");
+ }
+
+ public static String getMacAddress() {
+ //Macaddr = XX.XX.XX.XX.XX.XX
+ String ret = doStringCommand("DRIVER MACADDR");
+ if (!TextUtils.isEmpty(ret)) {
+ String[] tokens = ret.split(" = ");
+ if (tokens.length == 2) return tokens[1];
+ }
+ return null;
+ }
+
+ public static String scanResults() {
+ return doStringCommand("SCAN_RESULTS");
+ }
+
+ public static boolean startDriver() {
+ return doBooleanCommand("DRIVER START");
+ }
+
+ public static boolean stopDriver() {
+ return doBooleanCommand("DRIVER STOP");
+ }
/**
* Start filtering out Multicast V4 packets
* @return {@code true} if the operation succeeded, {@code false} otherwise
+ *
+ * Multicast filtering rules work as follows:
+ *
+ * The driver can filter multicast (v4 and/or v6) and broadcast packets when in
+ * a power optimized mode (typically when screen goes off).
+ *
+ * In order to prevent the driver from filtering the multicast/broadcast packets, we have to
+ * add a DRIVER RXFILTER-ADD rule followed by DRIVER RXFILTER-START to make the rule effective
+ *
+ * DRIVER RXFILTER-ADD Num
+ * where Num = 0 - Unicast, 1 - Broadcast, 2 - Mutil4 or 3 - Multi6
+ *
+ * and DRIVER RXFILTER-START
+ * In order to stop the usage of these rules, we do
+ *
+ * DRIVER RXFILTER-STOP
+ * DRIVER RXFILTER-REMOVE Num
+ * where Num is as described for RXFILTER-ADD
+ *
+ * The SETSUSPENDOPT driver command overrides the filtering rules
*/
- public native static boolean startFilteringMulticastV4Packets();
+ public static boolean startFilteringMulticastV4Packets() {
+ return doBooleanCommand("DRIVER RXFILTER-STOP")
+ && doBooleanCommand("DRIVER RXFILTER-REMOVE 2")
+ && doBooleanCommand("DRIVER RXFILTER-START");
+ }
/**
* Stop filtering out Multicast V4 packets.
* @return {@code true} if the operation succeeded, {@code false} otherwise
*/
- public native static boolean stopFilteringMulticastV4Packets();
+ public static boolean stopFilteringMulticastV4Packets() {
+ return doBooleanCommand("DRIVER RXFILTER-STOP")
+ && doBooleanCommand("DRIVER RXFILTER-ADD 2")
+ && doBooleanCommand("DRIVER RXFILTER-START");
+ }
/**
* Start filtering out Multicast V6 packets
* @return {@code true} if the operation succeeded, {@code false} otherwise
*/
- public native static boolean startFilteringMulticastV6Packets();
+ public static boolean startFilteringMulticastV6Packets() {
+ return doBooleanCommand("DRIVER RXFILTER-STOP")
+ && doBooleanCommand("DRIVER RXFILTER-REMOVE 3")
+ && doBooleanCommand("DRIVER RXFILTER-START");
+ }
/**
* Stop filtering out Multicast V6 packets.
* @return {@code true} if the operation succeeded, {@code false} otherwise
*/
- public native static boolean stopFilteringMulticastV6Packets();
+ public static boolean stopFilteringMulticastV6Packets() {
+ return doBooleanCommand("DRIVER RXFILTER-STOP")
+ && doBooleanCommand("DRIVER RXFILTER-ADD 3")
+ && doBooleanCommand("DRIVER RXFILTER-START");
+ }
- public native static boolean setPowerModeCommand(int mode);
+ public static int getPowerMode() {
+ String ret = doStringCommand("DRIVER GETPOWER");
+ if (!TextUtils.isEmpty(ret)) {
+ // reply comes back in the form "powermode = XX" where XX is the
+ // number we're interested in.
+ String[] tokens = ret.split(" = ");
+ try {
+ if (tokens.length == 2) return Integer.parseInt(tokens[1]);
+ } catch (NumberFormatException e) {
+ return -1;
+ }
+ }
+ return -1;
+ }
- public native static int getBandCommand();
+ public static boolean setPowerMode(int mode) {
+ return doBooleanCommand("DRIVER POWERMODE " + mode);
+ }
- public native static boolean setBandCommand(int band);
+ public static int getBand() {
+ String ret = doStringCommand("DRIVER GETBAND");
+ if (!TextUtils.isEmpty(ret)) {
+ //reply is "BAND X" where X is the band
+ String[] tokens = ret.split(" ");
+ try {
+ if (tokens.length == 2) return Integer.parseInt(tokens[1]);
+ } catch (NumberFormatException e) {
+ return -1;
+ }
+ }
+ return -1;
+ }
- public native static int getPowerModeCommand();
+ public static boolean setBand(int band) {
+ return doBooleanCommand("DRIVER SETBAND " + band);
+ }
- /**
+ /**
* Sets the bluetooth coexistence mode.
*
* @param mode One of {@link #BLUETOOTH_COEXISTENCE_MODE_DISABLED},
@@ -156,7 +277,9 @@ public class WifiNative {
* {@link #BLUETOOTH_COEXISTENCE_MODE_SENSE}.
* @return Whether the mode was successfully set.
*/
- public native static boolean setBluetoothCoexistenceModeCommand(int mode);
+ public static boolean setBluetoothCoexistenceMode(int mode) {
+ return doBooleanCommand("DRIVER BTCOEXMODE " + mode);
+ }
/**
* Enable or disable Bluetooth coexistence scan mode. When this mode is on,
@@ -166,43 +289,57 @@ public class WifiNative {
* @param isSet whether to enable or disable this mode
* @return {@code true} if the command succeeded, {@code false} otherwise.
*/
- public native static boolean setBluetoothCoexistenceScanModeCommand(boolean setCoexScanMode);
-
- public native static boolean saveConfigCommand();
-
- public native static boolean reloadConfigCommand();
-
- public native static boolean setScanResultHandlingCommand(int mode);
-
- public native static boolean addToBlacklistCommand(String bssid);
-
- public native static boolean clearBlacklistCommand();
-
- public native static boolean startWpsPbcCommand(String bssid);
-
- public native static boolean startWpsWithPinFromAccessPointCommand(String bssid, String apPin);
-
- public native static String startWpsWithPinFromDeviceCommand(String bssid);
+ public static boolean setBluetoothCoexistenceScanMode(boolean setCoexScanMode) {
+ if (setCoexScanMode) {
+ return doBooleanCommand("DRIVER BTCOEXSCAN-START");
+ } else {
+ return doBooleanCommand("DRIVER BTCOEXSCAN-STOP");
+ }
+ }
- public native static boolean setSuspendOptimizationsCommand(boolean enabled);
+ public static boolean saveConfig() {
+ // Make sure we never write out a value for AP_SCAN other than 1
+ return doBooleanCommand("AP_SCAN 1") && doBooleanCommand("SAVE_CONFIG");
+ }
- public native static boolean setCountryCodeCommand(String countryCode);
+ public static boolean setScanResultHandling(int mode) {
+ return doBooleanCommand("AP_SCAN " + mode);
+ }
- /**
- * Wait for the supplicant to send an event, returning the event string.
- * @return the event string sent by the supplicant.
- */
- public native static String waitForEvent();
+ public static boolean addToBlacklist(String bssid) {
+ if (TextUtils.isEmpty(bssid)) return false;
+ return doBooleanCommand("BLACKLIST " + bssid);
+ }
- public native static void enableBackgroundScanCommand(boolean enable);
+ public static boolean clearBlacklist() {
+ return doBooleanCommand("BLACKLIST clear");
+ }
- public native static void setScanIntervalCommand(int scanInterval);
+ public static boolean setSuspendOptimizations(boolean enabled) {
+ if (enabled) {
+ return doBooleanCommand("DRIVER SETSUSPENDOPT 0");
+ } else {
+ return doBooleanCommand("DRIVER SETSUSPENDOPT 1");
+ }
+ }
- private native static boolean doBooleanCommand(String command);
+ public static boolean setCountryCode(String countryCode) {
+ return doBooleanCommand("DRIVER COUNTRY " + countryCode);
+ }
- private native static int doIntCommand(String command);
+ public static void enableBackgroundScan(boolean enable) {
+ //Note: BGSCAN-START and BGSCAN-STOP are documented in core/res/res/values/config.xml
+ //and will need an update if the names are changed
+ if (enable) {
+ doBooleanCommand("DRIVER BGSCAN-START");
+ } else {
+ doBooleanCommand("DRIVER BGSCAN-STOP");
+ }
+ }
- private native static String doStringCommand(String command);
+ public static void setScanInterval(int scanInterval) {
+ doBooleanCommand("SCAN_INTERVAL " + scanInterval);
+ }
/** Example output:
* RSSI=-65
@@ -214,33 +351,46 @@ public class WifiNative {
return doStringCommand("SIGNAL_POLL");
}
- public static boolean wpsPbc() {
+ public static boolean startWpsPbc() {
return doBooleanCommand("WPS_PBC");
}
- public static boolean wpsPin(String pin) {
+ public static boolean startWpsPbc(String bssid) {
+ return doBooleanCommand("WPS_PBC " + bssid);
+ }
+
+ public static boolean startWpsPinKeypad(String pin) {
return doBooleanCommand("WPS_PIN any " + pin);
}
+ public static String startWpsPinDisplay(String bssid) {
+ return doStringCommand("WPS_PIN " + bssid);
+ }
+
+ /* Configures an access point connection */
+ public static boolean startWpsRegistrar(String bssid, String pin) {
+ return doBooleanCommand("WPS_REG " + bssid + " " + pin);
+ }
+
public static boolean setPersistentReconnect(boolean enabled) {
int value = (enabled == true) ? 1 : 0;
- return WifiNative.doBooleanCommand("SET persistent_reconnect " + value);
+ return doBooleanCommand("SET persistent_reconnect " + value);
}
public static boolean setDeviceName(String name) {
- return WifiNative.doBooleanCommand("SET device_name " + name);
+ return doBooleanCommand("SET device_name " + name);
}
public static boolean setDeviceType(String type) {
- return WifiNative.doBooleanCommand("SET device_type " + type);
+ return doBooleanCommand("SET device_type " + type);
}
public static boolean setConfigMethods(String cfg) {
- return WifiNative.doBooleanCommand("SET config_methods " + cfg);
+ return doBooleanCommand("SET config_methods " + cfg);
}
public static boolean setP2pSsidPostfix(String postfix) {
- return WifiNative.doBooleanCommand("SET p2p_ssid_postfix " + postfix);
+ return doBooleanCommand("SET p2p_ssid_postfix " + postfix);
}
public static boolean p2pFind() {
@@ -397,7 +547,7 @@ public class WifiNative {
}
public static String p2pGetDeviceAddress() {
- String status = statusCommand();
+ String status = status();
if (status == null) return "";
String[] tokens = status.split("\n");
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 71d7c01..25bd8f7 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -135,6 +135,8 @@ public class WifiStateMachine extends StateMachine {
private int mReconnectCount = 0;
private boolean mIsScanMode = false;
private boolean mScanResultIsPending = false;
+ /* Tracks if the current scan settings are active */
+ private boolean mSetScanActive = false;
private boolean mBluetoothConnectionActive = false;
@@ -1113,7 +1115,7 @@ public class WifiStateMachine extends StateMachine {
sb.append("mReconnectCount ").append(mReconnectCount).append(LS);
sb.append("mIsScanMode ").append(mIsScanMode).append(LS);
sb.append("Supplicant status").append(LS)
- .append(WifiNative.statusCommand()).append(LS).append(LS);
+ .append(WifiNative.status()).append(LS).append(LS);
sb.append(WifiConfigStore.dump());
return sb.toString();
@@ -1408,7 +1410,7 @@ public class WifiStateMachine extends StateMachine {
}
private String fetchSSID() {
- String status = WifiNative.statusCommand();
+ String status = WifiNative.status();
if (status == null) {
return null;
}
@@ -1481,15 +1483,15 @@ public class WifiStateMachine extends StateMachine {
}
private void setHighPerfModeEnabledNative(boolean enable) {
- if(!WifiNative.setSuspendOptimizationsCommand(!enable)) {
+ if(!WifiNative.setSuspendOptimizations(!enable)) {
loge("set suspend optimizations failed!");
}
if (enable) {
- if (!WifiNative.setPowerModeCommand(POWER_MODE_ACTIVE)) {
+ if (!WifiNative.setPowerMode(POWER_MODE_ACTIVE)) {
loge("set power mode active failed!");
}
} else {
- if (!WifiNative.setPowerModeCommand(POWER_MODE_AUTO)) {
+ if (!WifiNative.setPowerMode(POWER_MODE_AUTO)) {
loge("set power mode auto failed!");
}
}
@@ -1678,28 +1680,28 @@ public class WifiStateMachine extends StateMachine {
* coexistence would interrupt that connection.
*/
// Disable the coexistence mode
- WifiNative.setBluetoothCoexistenceModeCommand(
+ WifiNative.setBluetoothCoexistenceMode(
WifiNative.BLUETOOTH_COEXISTENCE_MODE_DISABLED);
}
- mPowerMode = WifiNative.getPowerModeCommand();
+ mPowerMode = WifiNative.getPowerMode();
if (mPowerMode < 0) {
// Handle the case where supplicant driver does not support
// getPowerModeCommand.
mPowerMode = WifiStateMachine.POWER_MODE_AUTO;
}
if (mPowerMode != WifiStateMachine.POWER_MODE_ACTIVE) {
- WifiNative.setPowerModeCommand(WifiStateMachine.POWER_MODE_ACTIVE);
+ WifiNative.setPowerMode(WifiStateMachine.POWER_MODE_ACTIVE);
}
}
void handlePostDhcpSetup() {
/* restore power mode */
- WifiNative.setPowerModeCommand(mPowerMode);
+ WifiNative.setPowerMode(mPowerMode);
// Set the coexistence mode back to its default value
- WifiNative.setBluetoothCoexistenceModeCommand(
+ WifiNative.setBluetoothCoexistenceMode(
WifiNative.BLUETOOTH_COEXISTENCE_MODE_SENSE);
}
@@ -1752,8 +1754,8 @@ public class WifiStateMachine extends StateMachine {
/* DHCP times out after about 30 seconds, we do a
* disconnect and an immediate reconnect to try again
*/
- WifiNative.disconnectCommand();
- WifiNative.reconnectCommand();
+ WifiNative.disconnect();
+ WifiNative.reconnect();
}
/* Current design is to not set the config on a running hostapd but instead
@@ -2212,7 +2214,7 @@ public class WifiStateMachine extends StateMachine {
mLastNetworkId = WifiConfiguration.INVALID_NETWORK_ID;
mLastSignalLevel = -1;
- mWifiInfo.setMacAddress(WifiNative.getMacAddressCommand());
+ mWifiInfo.setMacAddress(WifiNative.getMacAddress());
WifiConfigStore.initialize(mContext);
@@ -2271,7 +2273,7 @@ public class WifiStateMachine extends StateMachine {
long supplicantScanIntervalMs = Settings.Secure.getLong(mContext.getContentResolver(),
Settings.Secure.WIFI_SUPPLICANT_SCAN_INTERVAL_MS,
mDefaultSupplicantScanIntervalMs);
- WifiNative.setScanIntervalCommand((int)supplicantScanIntervalMs / 1000);
+ WifiNative.setScanInterval((int)supplicantScanIntervalMs / 1000);
}
@Override
public boolean processMessage(Message message) {
@@ -2296,12 +2298,12 @@ public class WifiStateMachine extends StateMachine {
break;
case WifiMonitor.SCAN_RESULTS_EVENT:
eventLoggingEnabled = false;
- setScanResults(WifiNative.scanResultsCommand());
+ setScanResults(WifiNative.scanResults());
sendScanResultsAvailableBroadcast();
mScanResultIsPending = false;
break;
case CMD_PING_SUPPLICANT:
- boolean ok = WifiNative.pingCommand();
+ boolean ok = WifiNative.ping();
mReplyChannel.replyToMessage(message, message.what, ok ? SUCCESS : FAILURE);
break;
case CMD_ADD_OR_UPDATE_NETWORK:
@@ -2329,10 +2331,10 @@ public class WifiStateMachine extends StateMachine {
mReplyChannel.replyToMessage(message, message.what, ok ? SUCCESS : FAILURE);
break;
case CMD_BLACKLIST_NETWORK:
- WifiNative.addToBlacklistCommand((String)message.obj);
+ WifiNative.addToBlacklist((String)message.obj);
break;
case CMD_CLEAR_BLACKLIST:
- WifiNative.clearBlacklistCommand();
+ WifiNative.clearBlacklist();
break;
case CMD_SAVE_CONFIG:
ok = WifiConfigStore.saveConfig();
@@ -2511,7 +2513,7 @@ public class WifiStateMachine extends StateMachine {
* When this mode is on, some of the low-level scan parameters used by the
* driver are changed to reduce interference with bluetooth
*/
- WifiNative.setBluetoothCoexistenceScanModeCommand(mBluetoothConnectionActive);
+ WifiNative.setBluetoothCoexistenceScanMode(mBluetoothConnectionActive);
/* set country code */
setCountryCode();
/* set frequency band of operation */
@@ -2530,12 +2532,12 @@ public class WifiStateMachine extends StateMachine {
}
if (mIsScanMode) {
- WifiNative.setScanResultHandlingCommand(SCAN_ONLY_MODE);
- WifiNative.disconnectCommand();
+ WifiNative.setScanResultHandling(SCAN_ONLY_MODE);
+ WifiNative.disconnect();
transitionTo(mScanModeState);
} else {
- WifiNative.setScanResultHandlingCommand(CONNECT_MODE);
- WifiNative.reconnectCommand();
+ WifiNative.setScanResultHandling(CONNECT_MODE);
+ WifiNative.reconnect();
transitionTo(mDisconnectedState);
}
}
@@ -2545,15 +2547,19 @@ public class WifiStateMachine extends StateMachine {
boolean eventLoggingEnabled = true;
switch(message.what) {
case CMD_SET_SCAN_TYPE:
- if (message.arg1 == SCAN_ACTIVE) {
- WifiNative.setScanModeCommand(true);
- } else {
- WifiNative.setScanModeCommand(false);
- }
+ mSetScanActive = (message.arg1 == SCAN_ACTIVE);
+ WifiNative.setScanMode(mSetScanActive);
break;
case CMD_START_SCAN:
eventLoggingEnabled = false;
- WifiNative.scanCommand(message.arg1 == SCAN_ACTIVE);
+ boolean forceActive = (message.arg1 == SCAN_ACTIVE);
+ if (forceActive && !mSetScanActive) {
+ WifiNative.setScanMode(forceActive);
+ }
+ WifiNative.scan();
+ if (forceActive && !mSetScanActive) {
+ WifiNative.setScanMode(mSetScanActive);
+ }
mScanResultIsPending = true;
break;
case CMD_SET_HIGH_PERF_MODE:
@@ -2562,14 +2568,14 @@ public class WifiStateMachine extends StateMachine {
case CMD_SET_COUNTRY_CODE:
String country = (String) message.obj;
if (DBG) log("set country code " + country);
- if (!WifiNative.setCountryCodeCommand(country.toUpperCase())) {
+ if (!WifiNative.setCountryCode(country.toUpperCase())) {
loge("Failed to set country code " + country);
}
break;
case CMD_SET_FREQUENCY_BAND:
int band = message.arg1;
if (DBG) log("set frequency band " + band);
- if (WifiNative.setBandCommand(band)) {
+ if (WifiNative.setBand(band)) {
mFrequencyBand.set(band);
//Fetch the latest scan results when frequency band is set
startScan(true);
@@ -2580,7 +2586,7 @@ public class WifiStateMachine extends StateMachine {
case CMD_BLUETOOTH_ADAPTER_STATE_CHANGE:
mBluetoothConnectionActive = (message.arg1 !=
BluetoothAdapter.STATE_DISCONNECTED);
- WifiNative.setBluetoothCoexistenceScanModeCommand(mBluetoothConnectionActive);
+ WifiNative.setBluetoothCoexistenceScanMode(mBluetoothConnectionActive);
break;
case CMD_STOP_DRIVER:
int mode = message.arg1;
@@ -2613,11 +2619,11 @@ public class WifiStateMachine extends StateMachine {
case CMD_DELAYED_STOP_DRIVER:
if (message.arg1 != mDelayedStopCounter) break;
if (getCurrentState() != mDisconnectedState) {
- WifiNative.disconnectCommand();
+ WifiNative.disconnect();
handleNetworkDisconnect();
}
mWakeLock.acquire();
- WifiNative.stopDriverCommand();
+ WifiNative.stopDriver();
transitionTo(mDriverStoppingState);
mWakeLock.release();
break;
@@ -2716,7 +2722,7 @@ public class WifiStateMachine extends StateMachine {
break;
case CMD_START_DRIVER:
mWakeLock.acquire();
- WifiNative.startDriverCommand();
+ WifiNative.startDriver();
mWakeLock.release();
transitionTo(mDriverStartingState);
break;
@@ -2743,8 +2749,8 @@ public class WifiStateMachine extends StateMachine {
/* Ignore */
return HANDLED;
} else {
- WifiNative.setScanResultHandlingCommand(message.arg1);
- WifiNative.reconnectCommand();
+ WifiNative.setScanResultHandling(message.arg1);
+ WifiNative.reconnect();
mIsScanMode = false;
transitionTo(mDisconnectedState);
}
@@ -2811,13 +2817,13 @@ public class WifiStateMachine extends StateMachine {
break;
/* Do a redundant disconnect without transition */
case CMD_DISCONNECT:
- WifiNative.disconnectCommand();
+ WifiNative.disconnect();
break;
case CMD_RECONNECT:
- WifiNative.reconnectCommand();
+ WifiNative.reconnect();
break;
case CMD_REASSOCIATE:
- WifiNative.reassociateCommand();
+ WifiNative.reassociate();
break;
case CMD_CONNECT_NETWORK:
int netId = message.arg1;
@@ -2839,7 +2845,7 @@ public class WifiStateMachine extends StateMachine {
/* The state tracker handles enabling networks upon completion/failure */
mSupplicantStateTracker.sendMessage(CMD_CONNECT_NETWORK);
- WifiNative.reconnectCommand();
+ WifiNative.reconnect();
/* Expect a disconnection from the old connection */
transitionTo(mDisconnectingState);
break;
@@ -2849,7 +2855,7 @@ public class WifiStateMachine extends StateMachine {
break;
case WifiMonitor.SCAN_RESULTS_EVENT:
/* Set the scan setting back to "connect" mode */
- WifiNative.setScanResultHandlingCommand(CONNECT_MODE);
+ WifiNative.setScanResultHandling(CONNECT_MODE);
/* Handle scan results */
return NOT_HANDLED;
case WifiMonitor.NETWORK_CONNECTION_EVENT:
@@ -2947,7 +2953,7 @@ public class WifiStateMachine extends StateMachine {
transitionTo(mDisconnectingState);
break;
case CMD_DISCONNECT:
- WifiNative.disconnectCommand();
+ WifiNative.disconnect();
transitionTo(mDisconnectingState);
break;
/* Ignore connection to same network */
@@ -3014,7 +3020,7 @@ public class WifiStateMachine extends StateMachine {
}
break;
case CMD_DISCONNECT:
- WifiNative.disconnectCommand();
+ WifiNative.disconnect();
transitionTo(mDisconnectingState);
break;
case CMD_SET_SCAN_MODE:
@@ -3030,7 +3036,7 @@ public class WifiStateMachine extends StateMachine {
* When scan results are received, the mode is switched
* back to CONNECT_MODE.
*/
- WifiNative.setScanResultHandlingCommand(SCAN_ONLY_MODE);
+ WifiNative.setScanResultHandling(SCAN_ONLY_MODE);
/* Have the parent state handle the rest */
return NOT_HANDLED;
/* Ignore connection to same network */
@@ -3098,7 +3104,7 @@ public class WifiStateMachine extends StateMachine {
* is in SCAN_ONLY_MODE. Restore CONNECT_MODE on exit
*/
if (mScanResultIsPending) {
- WifiNative.setScanResultHandlingCommand(CONNECT_MODE);
+ WifiNative.setScanResultHandling(CONNECT_MODE);
}
}
}
@@ -3179,7 +3185,7 @@ public class WifiStateMachine extends StateMachine {
* cleared
*/
if (!mScanResultIsPending) {
- WifiNative.enableBackgroundScanCommand(true);
+ WifiNative.enableBackgroundScan(true);
}
} else {
setScanAlarm(true);
@@ -3191,9 +3197,9 @@ public class WifiStateMachine extends StateMachine {
switch (message.what) {
case CMD_SET_SCAN_MODE:
if (message.arg1 == SCAN_ONLY_MODE) {
- WifiNative.setScanResultHandlingCommand(message.arg1);
+ WifiNative.setScanResultHandling(message.arg1);
//Supplicant disconnect to prevent further connects
- WifiNative.disconnectCommand();
+ WifiNative.disconnect();
mIsScanMode = true;
transitionTo(mScanModeState);
}
@@ -3201,10 +3207,10 @@ public class WifiStateMachine extends StateMachine {
case CMD_ENABLE_BACKGROUND_SCAN:
mEnableBackgroundScan = (message.arg1 == 1);
if (mEnableBackgroundScan) {
- WifiNative.enableBackgroundScanCommand(true);
+ WifiNative.enableBackgroundScan(true);
setScanAlarm(false);
} else {
- WifiNative.enableBackgroundScanCommand(false);
+ WifiNative.enableBackgroundScan(false);
setScanAlarm(true);
}
break;
@@ -3219,14 +3225,14 @@ public class WifiStateMachine extends StateMachine {
case CMD_START_SCAN:
/* Disable background scan temporarily during a regular scan */
if (mEnableBackgroundScan) {
- WifiNative.enableBackgroundScanCommand(false);
+ WifiNative.enableBackgroundScan(false);
}
/* Handled in parent state */
return NOT_HANDLED;
case WifiMonitor.SCAN_RESULTS_EVENT:
/* Re-enable background scan when a pending scan result is received */
if (mEnableBackgroundScan && mScanResultIsPending) {
- WifiNative.enableBackgroundScanCommand(true);
+ WifiNative.enableBackgroundScan(true);
}
/* Handled in parent state */
return NOT_HANDLED;
@@ -3241,7 +3247,7 @@ public class WifiStateMachine extends StateMachine {
public void exit() {
/* No need for a background scan upon exit from a disconnected state */
if (mEnableBackgroundScan) {
- WifiNative.enableBackgroundScanCommand(false);
+ WifiNative.enableBackgroundScan(false);
}
setScanAlarm(false);
}
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
index 84a4fe0..1ad6336 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
@@ -1180,9 +1180,9 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
break;
case PEER_CONNECTION_USER_ACCEPT:
if (mSavedPeerConfig.wps.setup == WpsInfo.PBC) {
- WifiNative.wpsPbc();
+ WifiNative.startWpsPbc();
} else {
- WifiNative.wpsPin(mSavedPeerConfig.wps.pin);
+ WifiNative.startWpsPinKeypad(mSavedPeerConfig.wps.pin);
}
mSavedPeerConfig = null;
transitionTo(mGroupCreatedState);