Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Handle emergency call back mode correctly

Bug: 5726996
Change-Id: I5815dd402bd73c530b9ba6d545d8956064949aa2
  • Loading branch information...
commit 4494c906168f1b93eb9d130096036d06cfa1e291 1 parent 641a562
isheriff authored December 08, 2011
8  services/java/com/android/server/WifiService.java
@@ -840,7 +840,7 @@ public void startWifi() {
840 840
          * of WifiLock & device idle status unless wifi enabled status is toggled
841 841
          */
842 842
 
843  
-        mWifiStateMachine.setDriverStart(true);
  843
+        mWifiStateMachine.setDriverStart(true, mEmergencyCallbackMode);
844 844
         mWifiStateMachine.reconnectCommand();
845 845
     }
846 846
 
@@ -854,7 +854,7 @@ public void stopWifi() {
854 854
          * TODO: if a stop is issued, wifi is brought up only by startWifi
855 855
          * unless wifi enabled status is toggled
856 856
          */
857  
-        mWifiStateMachine.setDriverStart(false);
  857
+        mWifiStateMachine.setDriverStart(false, mEmergencyCallbackMode);
858 858
     }
859 859
 
860 860
 
@@ -1074,11 +1074,11 @@ private void updateWifiState() {
1074 1074
                 mWifiStateMachine.setWifiEnabled(true);
1075 1075
                 mWifiStateMachine.setScanOnlyMode(
1076 1076
                         strongestLockMode == WifiManager.WIFI_MODE_SCAN_ONLY);
1077  
-                mWifiStateMachine.setDriverStart(true);
  1077
+                mWifiStateMachine.setDriverStart(true, mEmergencyCallbackMode);
1078 1078
                 mWifiStateMachine.setHighPerfModeEnabled(strongestLockMode
1079 1079
                         == WifiManager.WIFI_MODE_FULL_HIGH_PERF);
1080 1080
             } else {
1081  
-                mWifiStateMachine.setDriverStart(false);
  1081
+                mWifiStateMachine.setDriverStart(false, mEmergencyCallbackMode);
1082 1082
             }
1083 1083
         } else {
1084 1084
             mWifiStateMachine.setWifiEnabled(false);
25  wifi/java/android/net/wifi/WifiStateMachine.java
@@ -368,6 +368,10 @@
368 368
     private static final int SUCCESS = 1;
369 369
     private static final int FAILURE = -1;
370 370
 
  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
+
371 375
     /**
372 376
      * The maximum number of times we will retry a connection to an access point
373 377
      * for which we have failed in acquiring an IP address from DHCP. A value of
@@ -778,11 +782,11 @@ public DhcpInfo syncGetDhcpInfo() {
778 782
     /**
779 783
      * TODO: doc
780 784
      */
781  
-    public void setDriverStart(boolean enable) {
  785
+    public void setDriverStart(boolean enable, boolean ecm) {
782 786
         if (enable) {
783 787
             sendMessage(CMD_START_DRIVER);
784 788
         } else {
785  
-            sendMessage(CMD_STOP_DRIVER);
  789
+            sendMessage(obtainMessage(CMD_STOP_DRIVER, ecm ? IN_ECM_STATE : NOT_IN_ECM_STATE, 0));
786 790
         }
787 791
     }
788 792
 
@@ -2576,16 +2580,25 @@ public boolean processMessage(Message message) {
2576 2580
                     WifiNative.setBluetoothCoexistenceScanModeCommand(mBluetoothConnectionActive);
2577 2581
                     break;
2578 2582
                 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) {
2581 2587
                         if (DBG) log("Already in delayed stop");
2582 2588
                         break;
2583 2589
                     }
2584 2590
                     mInDelayedStop = true;
2585 2591
                     mDelayedStopCounter++;
2586 2592
                     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
+                    }
2589 2602
                     break;
2590 2603
                 case CMD_START_DRIVER:
2591 2604
                     if (mInDelayedStop) {

0 notes on commit 4494c90

Please sign in to comment.
Something went wrong with that request. Please try again.