Merge "fix getmacaddress race condition (don't auto-merge)" into gingerbread

This commit is contained in:
Irfan Sheriff
2010-10-10 12:21:51 -07:00
committed by Android (Google) Code Review

View File

@@ -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) {
@@ -2009,18 +2005,6 @@ public class WifiStateTracker extends NetworkStateTracker {
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
*