Merge "Include LICENSE files, when available, in notices."
diff --git a/core/tasks/general-tests.mk b/core/tasks/general-tests.mk
index 7bcc915..53ebddc 100644
--- a/core/tasks/general-tests.mk
+++ b/core/tasks/general-tests.mk
@@ -14,10 +14,12 @@
 
 .PHONY: general-tests
 
+# TODO(b/149249068): Remove vts-tradefed.jar after all VTS tests are converted
 general_tests_tools := \
     $(HOST_OUT_JAVA_LIBRARIES)/cts-tradefed.jar \
     $(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util.jar \
     $(HOST_OUT_JAVA_LIBRARIES)/vts-core-tradefed.jar \
+    $(HOST_OUT_JAVA_LIBRARIES)/vts-tradefed.jar
 
 intermediates_dir := $(call intermediates-dir-for,PACKAGING,general-tests)
 general_tests_zip := $(PRODUCT_OUT)/general-tests.zip
diff --git a/tools/releasetools/sparse_img.py b/tools/releasetools/sparse_img.py
index 6a91cf4..524c0f2 100644
--- a/tools/releasetools/sparse_img.py
+++ b/tools/releasetools/sparse_img.py
@@ -250,13 +250,17 @@
     with open(fn) as f:
       for line in f:
         fn, ranges_text = line.rstrip().split(None, 1)
-        ranges = rangelib.RangeSet.parse(ranges_text)
+        raw_ranges = rangelib.RangeSet.parse(ranges_text)
 
         # Note: e2fsdroid records holes in the extent tree as "0" blocks.
         # This causes confusion because clobbered_blocks always includes
         # the superblock (physical block #0). Since the 0 blocks here do
         # not represent actual physical blocks, remove them from the set.
-        ranges = ranges.subtract(rangelib.RangeSet("0"))
+        ranges = raw_ranges.subtract(rangelib.RangeSet("0"))
+        # b/150334561 we need to perserve the monotonic property of the raw
+        # range. Otherwise, the validation script will read the blocks with
+        # wrong order when pulling files from the image.
+        ranges.monotonic = raw_ranges.monotonic
         ranges.extra['text_str'] = ranges_text
 
         if allow_shared_blocks: