apmanager: claim interfaces from shill

apmanager requires sole ownership of a device before it can successfully
start a hostapd on that device.

The support for reclaiming interfaces from shill when an instance of
shill is started/restarted is not in yet. It requires support for registering
DBusNameOwnerChanged callback to the dbus_object_proxy_ which is not possible
in the current generated proxy code.

BUG=chromium:435704
TEST=unittests and manual test using apmanager on stumpy router

Change-Id: I7f737d0bf55f31c1e4ed2a7e5ffe04943ea056db
Reviewed-on: https://chromium-review.googlesource.com/232752
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
diff --git a/device.h b/device.h
index dadf8b1..4c42c88 100644
--- a/device.h
+++ b/device.h
@@ -17,6 +17,8 @@
 
 namespace apmanager {
 
+class Manager;
+
 // Abstraction for WiFi Device (PHY). Each device can have one or more
 // interfaces defined on it.
 class Device : public base::RefCounted<Device>,
@@ -51,7 +53,7 @@
     uint16_t vht_capability_mask;
   };
 
-  explicit Device(const std::string& device_name);
+  Device(Manager* manager, const std::string& device_name);
   virtual ~Device();
 
   // Register Device DBus object.
@@ -100,6 +102,8 @@
   // band the given |channel| is in, false otherwise.
   bool GetBandCapability(uint16_t channel, BandCapability* capability);
 
+  Manager* manager_;
+
   // List of WiFi interfaces live on this device (PHY).
   std::vector<WiFiInterface> interface_list_;