Bug 1158047 - [AutoMounter] Resolve the problem of stucking in UMS_CONFIGURING state. r=dhylands
authorAlphan Chen <alchen@mozilla.com>
Mon, 04 May 2015 14:46:16 +0800
changeset 242523 f16a1e24dbcdf79e088e426191c02ec8fd56ea79
parent 242447 00711330027dbabc88f5214f89e3b6f62d2f78eb
child 242524 0dd78fdc970c1500bf4c18bdfbd30ab2c1c59a75
push id28699
push userryanvm@gmail.com
push dateWed, 06 May 2015 20:01:37 +0000
treeherdermozilla-central@b2a742938d64 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdhylands
bugs1158047
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1158047 - [AutoMounter] Resolve the problem of stucking in UMS_CONFIGURING state. r=dhylands
dom/system/gonk/AutoMounter.cpp
--- a/dom/system/gonk/AutoMounter.cpp
+++ b/dom/system/gonk/AutoMounter.cpp
@@ -840,36 +840,36 @@ AutoMounter::UpdateState()
 
       // if ums/rndis is not available and mtp is disable,
       // restore the usb function as PERSIST_SYS_USB_CONFIG.
       SetUsbFunction(USB_FUNC_DEFAULT);
       SetState(STATE_IDLE);
       break;
 
     case STATE_UMS_CONFIGURING:
+      if (mtpEnabled) {
+        // MTP was enabled. Start reconfiguring.
+        SetState(STATE_MTP_CONFIGURING);
+        SetUsbFunction(USB_FUNC_MTP);
+        break;
+      }
+      if (rndisConfigured) {
+        SetState(STATE_RNDIS_CONFIGURED);
+        break;
+      }
       // While configuring, the USB configuration state will change from
       // CONFIGURED -> CONNECTED -> DISCONNECTED -> CONNECTED -> CONFIGURED
       // so we don't check for cable unplugged here. However, having said
       // that, we'll often sit in this state while the cable is unplugged,
       // since we might not get any events until the cable gets plugged back
       // in. This is why we need to check for mtpEnabled once we get the
       // configured event.
       if (umsConfigured) {
-        if (mtpEnabled) {
-          // MTP was enabled. Start reconfiguring.
-          SetState(STATE_MTP_CONFIGURING);
-          SetUsbFunction(USB_FUNC_MTP);
-          break;
-        }
         SetState(STATE_UMS_CONFIGURED);
       }
-      if (rndisConfigured) {
-        SetState(STATE_RNDIS_CONFIGURED);
-        break;
-      }
       break;
 
     case STATE_UMS_CONFIGURED:
       if (usbCablePluggedIn) {
         if (mtpEnabled) {
           // MTP was enabled. Start reconfiguring.
           SetState(STATE_MTP_CONFIGURING);
           SetUsbFunction(USB_FUNC_MTP);
@@ -1114,16 +1114,17 @@ AutoMounter::UpdateState()
 }
 
 /***************************************************************************/
 
 void AutoMounter::GetStatus(bool& umsAvail, bool& umsConfigured, bool& umsEnabled,
                             bool& mtpAvail, bool& mtpConfigured, bool& mtpEnabled,
                             bool& rndisConfigured)
 {
+  umsAvail = false;
   umsConfigured = false;
   umsEnabled = false;
   mtpAvail = false;
   mtpConfigured = false;
   mtpEnabled = false;
   rndisConfigured = false;
 
   if (access(ICS_SYS_USB_FUNCTIONS, F_OK) != 0) {