From 962dfdcdaca8255fec5f7197044b7a7c3749a1bf Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Thu, 14 Apr 2016 15:58:05 -0700 Subject: [PATCH] Skip verifying the partition with no changed blocks. For incremental BBOTAs, commit [1] changed to verify only the touched blocks to reduce the update time. This CL fixes the bug when there's no changed block between the two builds. [1]: commit d522bdc9edbf64d15a59c6924853b2e2c8c39e90 Bug: 27813356 Bug: 28195498 Change-Id: Ia752d3cf034c544517458ed15df509d4596e21fa (cherry picked from commit f9efe284a4f8f1e40ea634c5e86f3d5e9935d8c8) --- tools/releasetools/common.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index f68596b7b..92af54708 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -1472,8 +1472,12 @@ class BlockDifference(object): def WriteVerifyScript(self, script, touched_blocks_only=False): partition = self.partition + + # full OTA if not self.src: script.Print("Image %s will be patched unconditionally." % (partition,)) + + # incremental OTA else: if touched_blocks_only and self.version >= 3: ranges = self.touched_src_ranges @@ -1481,6 +1485,11 @@ class BlockDifference(object): else: ranges = self.src.care_map.subtract(self.src.clobbered_blocks) expected_sha1 = self.src.TotalSha1() + + # No blocks to be checked, skipping. + if not ranges: + return + ranges_str = ranges.to_string_raw() if self.version >= 4: script.AppendExtra(('if (range_sha1("%s", "%s") == "%s" || '