am 7efff5c4: Merge "fix getmacaddress race condition (don\'t auto-merge)" into gingerbread

Merge commit '7efff5c4c571d1a0111e31d73a87d27e1fae9de6' into gingerbread-plus-aosp

* commit '7efff5c4c571d1a0111e31d73a87d27e1fae9de6':
  fix getmacaddress race condition (don't auto-merge)
This commit is contained in:
Irfan Sheriff
2010-10-10 12:25:15 -07:00
committed by Android Git Automerger

View File

@@ -863,15 +863,7 @@ public class WifiStateTracker extends NetworkStateTracker {
mIsAnyNetworkDisabled.set(false); mIsAnyNetworkDisabled.set(false);
requestConnectionInfo(); requestConnectionInfo();
SupplicantState supplState = mWifiInfo.getSupplicantState(); 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=" + if (LOCAL_LOGD) Log.v(TAG, "Connection to supplicant established, state=" +
supplState); supplState);
// Wi-Fi supplicant connection state changed: // Wi-Fi supplicant connection state changed:
@@ -1290,6 +1282,10 @@ public class WifiStateTracker extends NetworkStateTracker {
*/ */
setNumAllowedChannels(); setNumAllowedChannels();
synchronized (this) { synchronized (this) {
String macaddr = WifiNative.getMacAddressCommand();
if (macaddr != null) {
mWifiInfo.setMacAddress(macaddr);
}
if (mRunState == RUN_STATE_STARTING) { if (mRunState == RUN_STATE_STARTING) {
mRunState = RUN_STATE_RUNNING; mRunState = RUN_STATE_RUNNING;
if (!mIsScanOnly) { if (!mIsScanOnly) {
@@ -2010,18 +2006,6 @@ public class WifiStateTracker extends NetworkStateTracker {
return WifiNative.getLinkSpeedCommand(); return WifiNative.getLinkSpeedCommand();
} }
/**
* 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 * Start driver
* *