AU: disable GPIOs in production; some structural changes

Since we are not making use of the GPIO funcionality in UE for the
moment, it's been advised that it should be disabled. This CL does just
that, plus a few small changes:

* Adds a "no-op" GPIO implementation, which simply returns a constant
  value every time it's being asked whether test-mode was signaled (in
  this case, we set it to return false).

* The GPIO handler is embedded in SystemState. This makes sense from
  both the conceptual and usability standpoint.  The SystemState object
  can be parametrized to initialize either a real or a no-op GPIO
  handler.

BUG=chromium-os:32263
TEST=passes unit tests; does not engage GPIO protocol on x86-alex

Change-Id: I8121647baa7611041073dcf305beddab57c0e49c
Reviewed-on: https://gerrit.chromium.org/gerrit/40633
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
diff --git a/system_state.h b/system_state.h
index a04c434..772205c 100644
--- a/system_state.h
+++ b/system_state.h
@@ -10,6 +10,7 @@
 #include <policy/libpolicy.h>
 
 #include <update_engine/connection_manager.h>
+#include <update_engine/gpio_handler.h>
 #include <update_engine/payload_state.h>
 #include <update_engine/prefs.h>
 
@@ -46,6 +47,9 @@
 
   // Gets the interface for the payload state object.
   virtual PayloadStateInterface* payload_state() = 0;
+
+  // Returns a pointer to the GPIO handler.
+  virtual GpioHandler* gpio_handler() const = 0;
 };
 
 // A real implementation of the SystemStateInterface which is
@@ -83,9 +87,14 @@
     return &payload_state_;
   }
 
+  // Returns a pointer to the GPIO handler.
+  virtual inline GpioHandler* gpio_handler() const {
+    return gpio_handler_.get();
+  }
+
   // Initializs this concrete object. Other methods should be invoked only
   // if the object has been initialized successfully.
-  bool Initialize();
+  bool Initialize(bool enable_gpio);
 
 private:
   // The latest device policy object from the policy provider.
@@ -104,6 +113,13 @@
   // All state pertaining to payload state such as
   // response, URL, backoff states.
   PayloadState payload_state_;
+
+  // Pointer to a GPIO handler and other needed modules (note that the order of
+  // declaration significant for destruction, as the latter depends on the
+  // former).
+  scoped_ptr<UdevInterface> udev_iface_;
+  scoped_ptr<FileDescriptor> file_descriptor_;
+  scoped_ptr<GpioHandler> gpio_handler_;
 };
 
 }  // namespace chromeos_update_engine