Merge "Handle emergency call back mode correctly" into ics-mr1

This commit is contained in:
Irfan Sheriff
2011-12-08 12:21:20 -08:00
committed by Android (Google) Code Review
2 changed files with 23 additions and 10 deletions

View File

@@ -840,7 +840,7 @@ public class WifiService extends IWifiManager.Stub {
* of WifiLock & device idle status unless wifi enabled status is toggled * of WifiLock & device idle status unless wifi enabled status is toggled
*/ */
mWifiStateMachine.setDriverStart(true); mWifiStateMachine.setDriverStart(true, mEmergencyCallbackMode);
mWifiStateMachine.reconnectCommand(); mWifiStateMachine.reconnectCommand();
} }
@@ -854,7 +854,7 @@ public class WifiService extends IWifiManager.Stub {
* TODO: if a stop is issued, wifi is brought up only by startWifi * TODO: if a stop is issued, wifi is brought up only by startWifi
* unless wifi enabled status is toggled * unless wifi enabled status is toggled
*/ */
mWifiStateMachine.setDriverStart(false); mWifiStateMachine.setDriverStart(false, mEmergencyCallbackMode);
} }
@@ -1074,11 +1074,11 @@ public class WifiService extends IWifiManager.Stub {
mWifiStateMachine.setWifiEnabled(true); mWifiStateMachine.setWifiEnabled(true);
mWifiStateMachine.setScanOnlyMode( mWifiStateMachine.setScanOnlyMode(
strongestLockMode == WifiManager.WIFI_MODE_SCAN_ONLY); strongestLockMode == WifiManager.WIFI_MODE_SCAN_ONLY);
mWifiStateMachine.setDriverStart(true); mWifiStateMachine.setDriverStart(true, mEmergencyCallbackMode);
mWifiStateMachine.setHighPerfModeEnabled(strongestLockMode mWifiStateMachine.setHighPerfModeEnabled(strongestLockMode
== WifiManager.WIFI_MODE_FULL_HIGH_PERF); == WifiManager.WIFI_MODE_FULL_HIGH_PERF);
} else { } else {
mWifiStateMachine.setDriverStart(false); mWifiStateMachine.setDriverStart(false, mEmergencyCallbackMode);
} }
} else { } else {
mWifiStateMachine.setWifiEnabled(false); mWifiStateMachine.setWifiEnabled(false);

View File

@@ -368,6 +368,10 @@ public class WifiStateMachine extends StateMachine {
private static final int SUCCESS = 1; private static final int SUCCESS = 1;
private static final int FAILURE = -1; private static final int FAILURE = -1;
/* Phone in emergency call back mode */
private static final int IN_ECM_STATE = 1;
private static final int NOT_IN_ECM_STATE = 0;
/** /**
* The maximum number of times we will retry a connection to an access point * The maximum number of times we will retry a connection to an access point
* for which we have failed in acquiring an IP address from DHCP. A value of * for which we have failed in acquiring an IP address from DHCP. A value of
@@ -778,11 +782,11 @@ public class WifiStateMachine extends StateMachine {
/** /**
* TODO: doc * TODO: doc
*/ */
public void setDriverStart(boolean enable) { public void setDriverStart(boolean enable, boolean ecm) {
if (enable) { if (enable) {
sendMessage(CMD_START_DRIVER); sendMessage(CMD_START_DRIVER);
} else { } else {
sendMessage(CMD_STOP_DRIVER); sendMessage(obtainMessage(CMD_STOP_DRIVER, ecm ? IN_ECM_STATE : NOT_IN_ECM_STATE, 0));
} }
} }
@@ -2576,16 +2580,25 @@ public class WifiStateMachine extends StateMachine {
WifiNative.setBluetoothCoexistenceScanModeCommand(mBluetoothConnectionActive); WifiNative.setBluetoothCoexistenceScanModeCommand(mBluetoothConnectionActive);
break; break;
case CMD_STOP_DRIVER: case CMD_STOP_DRIVER:
/* Already doing a delayed stop */ int mode = message.arg1;
if (mInDelayedStop) {
/* Already doing a delayed stop && not in ecm state */
if (mInDelayedStop && mode != IN_ECM_STATE) {
if (DBG) log("Already in delayed stop"); if (DBG) log("Already in delayed stop");
break; break;
} }
mInDelayedStop = true; mInDelayedStop = true;
mDelayedStopCounter++; mDelayedStopCounter++;
if (DBG) log("Delayed stop message " + mDelayedStopCounter); if (DBG) log("Delayed stop message " + mDelayedStopCounter);
sendMessageDelayed(obtainMessage(CMD_DELAYED_STOP_DRIVER, mDelayedStopCounter,
0), DELAYED_DRIVER_STOP_MS); if (mode == IN_ECM_STATE) {
/* send a shut down immediately */
sendMessage(obtainMessage(CMD_DELAYED_STOP_DRIVER, mDelayedStopCounter, 0));
} else {
/* send regular delayed shut down */
sendMessageDelayed(obtainMessage(CMD_DELAYED_STOP_DRIVER,
mDelayedStopCounter, 0), DELAYED_DRIVER_STOP_MS);
}
break; break;
case CMD_START_DRIVER: case CMD_START_DRIVER:
if (mInDelayedStop) { if (mInDelayedStop) {