@@ -368,6 +368,10 @@ public class WifiStateMachine extends StateMachine {
368368 private static final int SUCCESS = 1 ;
369369 private static final int FAILURE = -1 ;
370370
371+ /* Phone in emergency call back mode */
372+ private static final int IN_ECM_STATE = 1 ;
373+ private static final int NOT_IN_ECM_STATE = 0 ;
374+
371375 /**
372376 * The maximum number of times we will retry a connection to an access point
373377 * for which we have failed in acquiring an IP address from DHCP. A value of
@@ -778,11 +782,11 @@ public DhcpInfo syncGetDhcpInfo() {
778782 /**
779783 * TODO: doc
780784 */
781- public void setDriverStart (boolean enable ) {
785+ public void setDriverStart (boolean enable , boolean ecm ) {
782786 if (enable ) {
783787 sendMessage (CMD_START_DRIVER );
784788 } else {
785- sendMessage (CMD_STOP_DRIVER );
789+ sendMessage (obtainMessage ( CMD_STOP_DRIVER , ecm ? IN_ECM_STATE : NOT_IN_ECM_STATE , 0 ) );
786790 }
787791 }
788792
@@ -2576,16 +2580,25 @@ public boolean processMessage(Message message) {
25762580 WifiNative .setBluetoothCoexistenceScanModeCommand (mBluetoothConnectionActive );
25772581 break ;
25782582 case CMD_STOP_DRIVER :
2579- /* Already doing a delayed stop */
2580- if (mInDelayedStop ) {
2583+ int mode = message .arg1 ;
2584+
2585+ /* Already doing a delayed stop && not in ecm state */
2586+ if (mInDelayedStop && mode != IN_ECM_STATE ) {
25812587 if (DBG ) log ("Already in delayed stop" );
25822588 break ;
25832589 }
25842590 mInDelayedStop = true ;
25852591 mDelayedStopCounter ++;
25862592 if (DBG ) log ("Delayed stop message " + mDelayedStopCounter );
2587- sendMessageDelayed (obtainMessage (CMD_DELAYED_STOP_DRIVER , mDelayedStopCounter ,
2588- 0 ), DELAYED_DRIVER_STOP_MS );
2593+
2594+ if (mode == IN_ECM_STATE ) {
2595+ /* send a shut down immediately */
2596+ sendMessage (obtainMessage (CMD_DELAYED_STOP_DRIVER , mDelayedStopCounter , 0 ));
2597+ } else {
2598+ /* send regular delayed shut down */
2599+ sendMessageDelayed (obtainMessage (CMD_DELAYED_STOP_DRIVER ,
2600+ mDelayedStopCounter , 0 ), DELAYED_DRIVER_STOP_MS );
2601+ }
25892602 break ;
25902603 case CMD_START_DRIVER :
25912604 if (mInDelayedStop ) {
0 commit comments