OSDN Git Service

Error correction: Use block_image_recover in block OTAs
authorSami Tolvanen <samitolvanen@google.com>
Thu, 25 Jun 2015 10:48:29 +0000 (11:48 +0100)
committerSami Tolvanen <samitolvanen@google.com>
Thu, 29 Oct 2015 11:39:31 +0000 (11:39 +0000)
If block_image_verify fails, attempt to recover using FEC before giving up.

Bug: 21893453
Change-Id: Ibc1fe5d28b2a8099d2b5094277b572ec08229c3a

tools/releasetools/common.py

index cad654a..0063d63 100644 (file)
@@ -1284,7 +1284,20 @@ class BlockDifference(object):
     else:
       ranges = self.src.care_map.subtract(self.src.clobbered_blocks)
       ranges_str = ranges.to_string_raw()
-      if self.version >= 3:
+      if self.version >= 4:
+        script.AppendExtra(('if (range_sha1("%s", "%s") == "%s" || '
+                            'block_image_verify("%s", '
+                            'package_extract_file("%s.transfer.list"), '
+                            '"%s.new.dat", "%s.patch.dat") || '
+                            '(block_image_recover("%s", "%s") && '
+                            'block_image_verify("%s", '
+                            'package_extract_file("%s.transfer.list"), '
+                            '"%s.new.dat", "%s.patch.dat"))) then') % (
+                            self.device, ranges_str, self.src.TotalSha1(),
+                            self.device, partition, partition, partition,
+                            self.device, ranges_str,
+                            self.device, partition, partition, partition))
+      elif self.version == 3:
         script.AppendExtra(('if (range_sha1("%s", "%s") == "%s" || '
                             'block_image_verify("%s", '
                             'package_extract_file("%s.transfer.list"), '