Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c9384d5 authored by Jesse Zhao's avatar Jesse Zhao Committed by Android (Google) Code Review
Browse files

Merge "verify system and vendor image together before patching." into lmp-mr1-dev

parents cb73599b 75bcea02
Loading
Loading
Loading
Loading
+10 −5
Original line number Original line Diff line number Diff line
@@ -1048,9 +1048,16 @@ class BlockDifference:
  def WriteScript(self, script, output_zip, progress=None):
  def WriteScript(self, script, output_zip, progress=None):
    if not self.src:
    if not self.src:
      # write the output unconditionally
      # write the output unconditionally
      script.Print("Patching %s image unconditionally..." % (self.partition,))
    else:
      script.Print("Patching %s image after verification." % (self.partition,))

    if progress: script.ShowProgress(progress, 0)
    if progress: script.ShowProgress(progress, 0)
    self._WriteUpdate(script, output_zip)
    self._WriteUpdate(script, output_zip)


  def WriteVerifyScript(self, script):
    if not self.src:
      script.Print("Image %s will be patched unconditionally." % (self.partition,))
    else:
    else:
      if self.check_first_block:
      if self.check_first_block:
        self._CheckFirstBlock(script)
        self._CheckFirstBlock(script)
@@ -1058,9 +1065,7 @@ class BlockDifference:
      script.AppendExtra('if range_sha1("%s", "%s") == "%s" then' %
      script.AppendExtra('if range_sha1("%s", "%s") == "%s" then' %
                         (self.device, self.src.care_map.to_string_raw(),
                         (self.device, self.src.care_map.to_string_raw(),
                          self.src.TotalSha1()))
                          self.src.TotalSha1()))
      script.Print("Patching %s image..." % (self.partition,))
      script.Print("Verified %s image..." % (self.partition,))
      if progress: script.ShowProgress(progress, 0)
      self._WriteUpdate(script, output_zip)
      script.AppendExtra(('else\n'
      script.AppendExtra(('else\n'
                          '  (range_sha1("%s", "%s") == "%s") ||\n'
                          '  (range_sha1("%s", "%s") == "%s") ||\n'
                          '  abort("%s partition has unexpected contents");\n'
                          '  abort("%s partition has unexpected contents");\n'
+6 −0
Original line number Original line Diff line number Diff line
@@ -558,6 +558,7 @@ else if get_stage("%(bcb_dev)s") == "3/3" then


  system_items = ItemSet("system", "META/filesystem_config.txt")
  system_items = ItemSet("system", "META/filesystem_config.txt")
  script.ShowProgress(system_progress, 0)
  script.ShowProgress(system_progress, 0)

  if block_based:
  if block_based:
    # Full OTA is done as an "incremental" against an empty source
    # Full OTA is done as an "incremental" against an empty source
    # image.  This has the effect of writing new data from the package
    # image.  This has the effect of writing new data from the package
@@ -845,6 +846,11 @@ reboot_now("%(bcb_dev)s", "");
else
else
""" % bcb_dev)
""" % bcb_dev)


  # Verify the existing partitions.
  system_diff.WriteVerifyScript(script)
  if vendor_diff:
    vendor_diff.WriteVerifyScript(script)

  script.Comment("---- start making changes here ----")
  script.Comment("---- start making changes here ----")


  device_specific.IncrementalOTA_InstallBegin()
  device_specific.IncrementalOTA_InstallBegin()