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/main.cc b/main.cc
index 833afb2..c956278 100644
--- a/main.cc
+++ b/main.cc
@@ -21,7 +21,6 @@
 #include "update_engine/dbus_constants.h"
 #include "update_engine/dbus_interface.h"
 #include "update_engine/dbus_service.h"
-#include "update_engine/gpio_handler.h"
 #include "update_engine/subprocess.h"
 #include "update_engine/terminator.h"
 #include "update_engine/update_attempter.h"
@@ -168,7 +167,9 @@
   GMainLoop* loop = g_main_loop_new(g_main_context_default(), FALSE);
 
   chromeos_update_engine::RealSystemState real_system_state;
-  LOG_IF(ERROR, !real_system_state.Initialize())
+  // TODO(garnold) s/false/true/ once we decide to activate actual GPIO-based
+  // protocol for testing of MP-signed images (chromium-os:25400).
+  LOG_IF(ERROR, !real_system_state.Initialize(false))
       << "Failed to initialize system state.";
 
   // Sets static members for the certificate checker.
@@ -178,20 +179,10 @@
   chromeos_update_engine::CertificateChecker::set_openssl_wrapper(
       &openssl_wrapper);
 
-  // Initialize a GPIO handler. Defer GPIO discovery to ensure the udev has
-  // ample time to export the devices. Also require that test mode is physically
-  // queries at most once and the result cached, for a more consistent update
-  // behavior.
-  chromeos_update_engine::StandardUdevInterface udev_iface;
-  chromeos_update_engine::EintrSafeFileDescriptor file_descriptor;
-  chromeos_update_engine::StandardGpioHandler
-      gpio_handler(&udev_iface, &file_descriptor, true, true);
-
   // Create the update attempter:
   chromeos_update_engine::ConcreteDbusGlib dbus;
   chromeos_update_engine::UpdateAttempter update_attempter(&real_system_state,
-                                                           &dbus,
-                                                           &gpio_handler);
+                                                           &dbus);
 
   // Create the dbus service object:
   dbus_g_object_type_install_info(UPDATE_ENGINE_TYPE_SERVICE,
@@ -204,7 +195,6 @@
 
   // Schedule periodic update checks.
   chromeos_update_engine::UpdateCheckScheduler scheduler(&update_attempter,
-                                                         &gpio_handler,
                                                          &real_system_state);
   scheduler.Run();