shill: Disconnect before activation correctly

Allow cellular capabilities to correctly disconnect before activation by
only responding to the final disconnect notification.  Previously, shill
attempted to activate the modem upon receiving the first notification
after a disconnect operation, which is usually just a notification that
a disconnect is in progress.  Seeing that the modem hadn't actually
disconnected, shill would report the activation as failed.

The meat of this change is that CellularCapabilityCDMA stores away the
activation callback when it finds it is connected during an activation
attempt.  When the cellular device cleans up its disconnect process, it
calls down to the capability, giving us the opportunity to respond by
triggering our activation.

TEST=Unit tests, activations making use of this logic proceed correctly.
BUG=chromium-os:36301

Change-Id: I0169328403a805a06309a41b31e00b66657b9f5b
Reviewed-on: https://gerrit.chromium.org/gerrit/39028
Tested-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Ready: Christopher Wiley <wiley@chromium.org>
diff --git a/cellular.h b/cellular.h
index f66559b..cfe7b59 100644
--- a/cellular.h
+++ b/cellular.h
@@ -125,12 +125,8 @@
   // failure, leaves it unchanged otherwise.
   void Connect(Error *error);
 
-  // Asynchronously disconnects the modem from the network. Populates |error|
-  // on failure, leaves it unchanged otherwise.  Calls |callback| on completion
-  // of the disconnect with the error indicated success or failure.
-  virtual void DisconnectWithCallback(const ResultCallback &callback,
-                                      Error *error);
-  // Similar to above but without the callback.
+  // Asynchronously disconnects the modem from the network and populates
+  // |error| on failure, leaves it unchanged otherwise.
   virtual void Disconnect(Error *error);
 
   // Asynchronously activates the modem. Returns an error on failure.
@@ -299,7 +295,7 @@
       void(Cellular::*set)(const std::string &value, Error *error));
 
   void OnConnectReply(const Error &error);
-  void OnDisconnectReply(const ResultCallback &callback, const Error &error);
+  void OnDisconnectReply(const Error &error);
 
   // DBUS accessors to read/modify the allow roaming property
   bool GetAllowRoaming(Error */*error*/) { return allow_roaming_; }