shill: SharedDBusConnection: Split up ProxyConnection and AdaptorConnection

When acquire_name() is called on a DBusConnection object, the
connection filters some broadast messages that would otherwise
arrive.  As a result, shill cannot use the same connection for
both adaptors (the control interface) and proxies.  The
SharedDBusConnection object must therefore maintain separate
DBusConnection objects for proxy vs adaptor roles.  This still
offers the advantage of carefully and predictably managing the
object lifetimes of each DBus connection.

BUG=chrome-os-partner:35203,chromium:446837
TEST=Unit tests + manual:
  Run "tail -f /var/log/net.log | grep power_manager &"
  Then run "powerd_dbus_suspend"
  Wait a bit, then press the spacebar.
  Without this change, no messages would be output; with this change they do.

Change-Id: I9095988013a9783535aa61b5e15c3d24f56ffb2f
Reviewed-on: https://chromium-review.googlesource.com/239631
Reviewed-by: Samuel Tan <samueltan@chromium.org>
Tested-by: Samuel Tan <samueltan@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
diff --git a/shared_dbus_connection.cc b/shared_dbus_connection.cc
index 98ca73b..86c2d8c 100644
--- a/shared_dbus_connection.cc
+++ b/shared_dbus_connection.cc
@@ -23,12 +23,19 @@
   CHECK(dispatcher_.get()) << "Failed to create a dbus-dispatcher";
   DBus::default_dispatcher = dispatcher_.get();
   dispatcher_->attach(nullptr);
-  connection_.reset(new DBus::Connection(DBus::Connection::SystemBus()));
+  adaptor_connection_.reset(new DBus::Connection(
+      DBus::Connection::SystemBus()));
+  proxy_connection_.reset(new DBus::Connection(DBus::Connection::SystemBus()));
 }
 
-DBus::Connection *SharedDBusConnection::GetConnection() {
-  CHECK(connection_.get());
-  return connection_.get();
+DBus::Connection *SharedDBusConnection::GetAdaptorConnection() {
+  CHECK(adaptor_connection_.get());
+  return adaptor_connection_.get();
+}
+
+DBus::Connection *SharedDBusConnection::GetProxyConnection() {
+  CHECK(proxy_connection_.get());
+  return proxy_connection_.get();
 }
 
 }  // namespace shill