faft: Simplify Alex/ZGB flow which needs a transition state to enter dev mode

Treats this special case in a new FAFT config: need_dev_transition.

BUG=chrome-os-partner:16231
TEST=None, new devices don't use this logic.

Change-Id: Iff9dbe644f09dd3fe5bf6c2e05d2a2c513db3e82
Reviewed-on: https://chromium-review.googlesource.com/271281
Trybot-Ready: Tom Tam <waihong@google.com>
Tested-by: Tom Tam <waihong@google.com>
Reviewed-by: Yusuf Mohsinally <mohsinally@chromium.org>
Commit-Queue: Tom Tam <waihong@google.com>
diff --git a/server/cros/faft/config/DEFAULTS.py b/server/cros/faft/config/DEFAULTS.py
index 6d478b3..f61ffe2 100644
--- a/server/cros/faft/config/DEFAULTS.py
+++ b/server/cros/faft/config/DEFAULTS.py
@@ -54,6 +54,9 @@
     # Delay between keypresses in firmware screen
     confirm_screen = 3
 
+    # Only True on Alex/ZGB which needs a transition state to enter dev mode.
+    need_dev_transition = False
+
     # Delay between passing firmware screen and text mode warning screen
     legacy_text_screen = 20
 
diff --git a/server/cros/faft/config/alex.py b/server/cros/faft/config/alex.py
index 3f4304c..90f700d 100644
--- a/server/cros/faft/config/alex.py
+++ b/server/cros/faft/config/alex.py
@@ -9,4 +9,5 @@
     """FAFT config values for Alex."""
     keyboard_dev = False
     gbb_version = 1.0
+    need_dev_transition = True
     has_eventlog = False
diff --git a/server/cros/faft/config/zgb.py b/server/cros/faft/config/zgb.py
index bbe7fff..78483ef 100644
--- a/server/cros/faft/config/zgb.py
+++ b/server/cros/faft/config/zgb.py
@@ -9,4 +9,5 @@
     """FAFT config values for ZGB."""
     keyboard_dev = False
     gbb_version = 1.0
+    need_dev_transition = True
     has_eventlog = False
diff --git a/server/cros/faft/firmware_test.py b/server/cros/faft/firmware_test.py
index 365021ab..31c98d3 100644
--- a/server/cros/faft/firmware_test.py
+++ b/server/cros/faft/firmware_test.py
@@ -702,12 +702,8 @@
         time.sleep(self.faft_config.firmware_screen)
         self.servo.ctrl_u()
 
-    def wait_fw_screen_and_trigger_recovery(self, need_dev_transition=False):
-        """Wait for firmware warning screen and trigger recovery boot.
-
-        @param need_dev_transition: True when needs dev mode transition, only
-                                    for Alex/ZGB.
-        """
+    def wait_fw_screen_and_trigger_recovery(self):
+        """Wait for firmware warning screen and trigger recovery boot."""
         time.sleep(self.faft_config.firmware_screen)
 
         # Pressing Enter for too long triggers a second key press.
@@ -716,7 +712,7 @@
 
         # For Alex/ZGB, there is a dev warning screen in text mode.
         # Skip it by pressing Ctrl-D.
-        if need_dev_transition:
+        if self.faft_config.need_dev_transition:
             time.sleep(self.faft_config.legacy_text_screen)
             self.servo.ctrl_d()
 
diff --git a/server/site_tests/firmware_DevTriggerRecovery/firmware_DevTriggerRecovery.py b/server/site_tests/firmware_DevTriggerRecovery/firmware_DevTriggerRecovery.py
index 38fc024..fb40539 100644
--- a/server/site_tests/firmware_DevTriggerRecovery/firmware_DevTriggerRecovery.py
+++ b/server/site_tests/firmware_DevTriggerRecovery/firmware_DevTriggerRecovery.py
@@ -20,15 +20,11 @@
     """
     version = 1
 
-    # True if Alex/ZGB which needs a transition state to enter dev mode.
-    need_dev_transition = False
-
     # The devsw off->on transition states are different based on platforms.
     # For Alex/ZGB, it is dev switch on but normal firmware boot.
     # For other platforms, it is dev switch on and developer firmware boot.
     def check_devsw_on_transition(self):
-        if self.faft_client.system.get_platform_name() in ('Alex', 'ZGB'):
-            self.need_dev_transition = True
+        if self.faft_client.need_dev_transition:
             return self.checkers.crossystem_checker({
                     'devsw_boot': '1',
                     'mainfw_act': 'A',
@@ -45,7 +41,7 @@
     # For Alex/ZGB, it is firmware B normal boot. Firmware A is still developer.
     # For other platforms, it is directly firmware A normal boot.
     def check_devsw_off_transition(self):
-        if self.need_dev_transition:
+        if self.faft_client.need_dev_transition:
             return self.checkers.crossystem_checker({
                     'devsw_boot': '0',
                     'mainfw_act': 'B',
@@ -87,7 +83,7 @@
                  'chromeos-firmwareupdate --mode todev && reboot')
         # Ignore the default reboot_action here because the
         # userspace_action (firmware updater) will reboot the system.
-        self.wait_fw_screen_and_trigger_recovery(self.need_dev_transition)
+        self.wait_fw_screen_and_trigger_recovery()
         self.wait_for_client()
 
         logging.info("Expected recovery boot and disable dev switch.")