Fix sparse image detection
Instead of relying on image build flags, check the actual file to
determine if input is sparse image.
Test: th
Change-Id: I6e58603535039eb3c4e799c61ed9f4783f1888dd
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 8d16ca0..7805599 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -2121,9 +2121,7 @@
if info_dict is None:
info_dict = LoadInfoDict(input_zip)
- is_sparse = info_dict.get("extfs_sparse_flag")
- if info_dict.get(which + "_disable_sparse"):
- is_sparse = False
+ is_sparse = IsSparseImage(os.path.join(tmpdir, "IMAGES", which + ".img"))
# When target uses 'BOARD_EXT4_SHARE_DUP_BLOCKS := true', images may contain
# shared blocks (i.e. some blocks will show up in multiple files' block