Do not alter presigned prebuilt apks for SDK > 29.
Bug: 185811447
Test: Manual
Change-Id: I5ea143331e1bd1885dde4e46b086f4ce811f4981
diff --git a/core/definitions.mk b/core/definitions.mk
index 7f2cc42..c5fe76b 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2380,6 +2380,15 @@
fi
endef
+# Verifies ZIP alignment of a package.
+#
+define check-package-alignment
+$(hide) if ! $(ZIPALIGN) -c -p 4 $@ >/dev/null ; then \
+ $(call echo-error,$@,Improper package alignment); \
+ exit 1; \
+ fi
+endef
+
# Compress a package using the standard gzip algorithm.
define compress-package
$(hide) \
@@ -2448,6 +2457,15 @@
fi
endef
+# Verifies shared JNI libraries and dex files in an apk are uncompressed.
+#
+define check-jni-dex-compression
+ if (zipinfo $@ 'lib/*.so' '*.dex' 2>/dev/null | grep -v ' stor ' >/dev/null) ; then \
+ $(call echo-error,$@,Contains compressed JNI libraries and/or dex files); \
+ exit 1; \
+ fi
+endef
+
# Remove unwanted shared JNI libraries embedded in an apk.
#
define remove-unwanted-prebuilt-embedded-jni-libs