gooftool: write VPD values for RLZ ping

To have a better RLZ ping process, we'd like to write special flags to
VPD at the end of factory flow.
This will not be executed in RMA process (when --rma_mode argument is
added).

BUG=chromium:820783
TEST=make test

Change-Id: I99d382704d4471c98c963f625be1f3036cce05e6
Reviewed-on: https://chromium-review.googlesource.com/956908
Commit-Ready: Wei-Han Chen <stimim@chromium.org>
Tested-by: Wei-Han Chen <stimim@chromium.org>
Reviewed-by: Wei-Han Chen <stimim@chromium.org>
diff --git a/py/gooftool/commands.py b/py/gooftool/commands.py
index 44b21f4..fbeb4a2 100755
--- a/py/gooftool/commands.py
+++ b/py/gooftool/commands.py
@@ -219,6 +219,11 @@
          'Each item should be a sub-command of gooftool. '
          'e.g. "gooftool verify --skip_list verify_tpm clear_gbb_flags".')
 
+_rlz_embargo_end_date_offset_cmd_arg = CmdArg(
+    '--embargo_offset', type=int, default=7, choices=xrange(7, 15),
+    help='Change the offset of embargo end date, cannot less than 7 days or '
+         'more than 14 days.')
+
 
 @Command(
     'verify_ec_key',
@@ -665,6 +670,7 @@
          _station_ip_cmd_arg,
          _station_port_cmd_arg,
          _wipe_finish_token_cmd_arg,
+         _rlz_embargo_end_date_offset_cmd_arg,
          _waive_list_cmd_arg,
          _skip_list_cmd_arg)
 def Finalize(options):
@@ -681,6 +687,9 @@
   - Uploads system logs & reports
   - Wipes the testing kernel, rootfs, and stateful partition
   """
+  if not options.rma_mode:
+    # Write VPD values related to RLZ ping into VPD.
+    GetGooftool(options).WriteVPDForRLZPing(options.embargo_offset)
   Cr50SetBoardId(options)
   Verify(options)
   Cr50ResetState(options)