summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2010-10-08 10:25:40 -0700
committerIrfan Sheriff <isheriff@google.com>2010-10-08 11:34:02 -0700
commit27827bab181b332387b6a043df430c7b1243c507 (patch)
tree261150287691bfe5c9714f2b8b158bd4b070456e /wifi
parentf8d2acdc57fd747278bb909c9e15b959e07d63b6 (diff)
downloadframeworks_base-27827bab181b332387b6a043df430c7b1243c507.zip
frameworks_base-27827bab181b332387b6a043df430c7b1243c507.tar.gz
frameworks_base-27827bab181b332387b6a043df430c7b1243c507.tar.bz2
fix getmacaddress race condition (don't auto-merge)
getMacAddress wont go through if the wifi state is not enabled by the time the connection from the supplicant comes through. we now fetch the mac address right after a driver start. Bug: 3072163 Change-Id: I55943e6d618fd7c3170bc579697bc61d70fc8b86
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/WifiStateTracker.java24
1 files changed, 4 insertions, 20 deletions
diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java
index 9d27bde..281077c 100644
--- a/wifi/java/android/net/wifi/WifiStateTracker.java
+++ b/wifi/java/android/net/wifi/WifiStateTracker.java
@@ -862,15 +862,7 @@ public class WifiStateTracker extends NetworkStateTracker {
mIsAnyNetworkDisabled.set(false);
requestConnectionInfo();
SupplicantState supplState = mWifiInfo.getSupplicantState();
- /**
- * The MAC address isn't going to change, so just request it
- * once here.
- */
- String macaddr = getMacAddress();
- if (macaddr != null) {
- mWifiInfo.setMacAddress(macaddr);
- }
if (LOCAL_LOGD) Log.v(TAG, "Connection to supplicant established, state=" +
supplState);
// Wi-Fi supplicant connection state changed:
@@ -1289,6 +1281,10 @@ public class WifiStateTracker extends NetworkStateTracker {
*/
setNumAllowedChannels();
synchronized (this) {
+ String macaddr = WifiNative.getMacAddressCommand();
+ if (macaddr != null) {
+ mWifiInfo.setMacAddress(macaddr);
+ }
if (mRunState == RUN_STATE_STARTING) {
mRunState = RUN_STATE_RUNNING;
if (!mIsScanOnly) {
@@ -2010,18 +2006,6 @@ public class WifiStateTracker extends NetworkStateTracker {
}
/**
- * Get MAC address of radio
- *
- * @return MAC address, null on failure
- */
- public synchronized String getMacAddress() {
- if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
- return null;
- }
- return WifiNative.getMacAddressCommand();
- }
-
- /**
* Start driver
*
* @return {@code true} if the operation succeeds, {@code false} otherwise