am 583fdf00: Merge "Handle emergency call back mode correctly" into ics-mr1
* commit '583fdf0068ac46fb384a5aa2b193faf743f8221c':
Handle emergency call back mode correctly
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index 16643ff..cb291ce 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -840,7 +840,7 @@
* of WifiLock & device idle status unless wifi enabled status is toggled
*/
- mWifiStateMachine.setDriverStart(true);
+ mWifiStateMachine.setDriverStart(true, mEmergencyCallbackMode);
mWifiStateMachine.reconnectCommand();
}
@@ -854,7 +854,7 @@
* TODO: if a stop is issued, wifi is brought up only by startWifi
* unless wifi enabled status is toggled
*/
- mWifiStateMachine.setDriverStart(false);
+ mWifiStateMachine.setDriverStart(false, mEmergencyCallbackMode);
}
@@ -1074,11 +1074,11 @@
mWifiStateMachine.setWifiEnabled(true);
mWifiStateMachine.setScanOnlyMode(
strongestLockMode == WifiManager.WIFI_MODE_SCAN_ONLY);
- mWifiStateMachine.setDriverStart(true);
+ mWifiStateMachine.setDriverStart(true, mEmergencyCallbackMode);
mWifiStateMachine.setHighPerfModeEnabled(strongestLockMode
== WifiManager.WIFI_MODE_FULL_HIGH_PERF);
} else {
- mWifiStateMachine.setDriverStart(false);
+ mWifiStateMachine.setDriverStart(false, mEmergencyCallbackMode);
}
} else {
mWifiStateMachine.setWifiEnabled(false);
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 8f807fe..82abe3a 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -368,6 +368,10 @@
private static final int SUCCESS = 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
* for which we have failed in acquiring an IP address from DHCP. A value of
@@ -778,11 +782,11 @@
/**
* TODO: doc
*/
- public void setDriverStart(boolean enable) {
+ public void setDriverStart(boolean enable, boolean ecm) {
if (enable) {
sendMessage(CMD_START_DRIVER);
} else {
- sendMessage(CMD_STOP_DRIVER);
+ sendMessage(obtainMessage(CMD_STOP_DRIVER, ecm ? IN_ECM_STATE : NOT_IN_ECM_STATE, 0));
}
}
@@ -2576,16 +2580,25 @@
WifiNative.setBluetoothCoexistenceScanModeCommand(mBluetoothConnectionActive);
break;
case CMD_STOP_DRIVER:
- /* Already doing a delayed stop */
- if (mInDelayedStop) {
+ int mode = message.arg1;
+
+ /* Already doing a delayed stop && not in ecm state */
+ if (mInDelayedStop && mode != IN_ECM_STATE) {
if (DBG) log("Already in delayed stop");
break;
}
mInDelayedStop = true;
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;
case CMD_START_DRIVER:
if (mInDelayedStop) {