Merge "DO NOT MERGE: Delete com.android.cronet from base_system." into rvc-dev
diff --git a/target/board/BoardConfigGsiCommon.mk b/target/board/BoardConfigGsiCommon.mk
index 61aa67c..c89e203 100644
--- a/target/board/BoardConfigGsiCommon.mk
+++ b/target/board/BoardConfigGsiCommon.mk
@@ -33,6 +33,13 @@
 #   updating the last seen rollback index in the tamper-evident storage.
 BOARD_AVB_ROLLBACK_INDEX := 0
 
+# Enable chain partition for system.
+# GSI need to sign on system.img instead of vbmeta.
+BOARD_AVB_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
+BOARD_AVB_SYSTEM_ALGORITHM := SHA256_RSA2048
+BOARD_AVB_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
+BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION := 1
+
 # GSI specific System Properties
 ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
 TARGET_SYSTEM_EXT_PROP := build/make/target/board/gsi_system_ext.prop
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index c09731c..b32d94f 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -211,7 +211,6 @@
     mtpd \
     ndc \
     netd \
-    NativeAdbDataLoaderService \
     NetworkStackNext \
     org.apache.http.legacy \
     otacerts \
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: