Fix issue #2048267: Run zipalign on all prebuilts
diff --git a/core/definitions.mk b/core/definitions.mk
index 1c2f05b..e4d2ecb 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1469,6 +1469,12 @@
$(hide) cp -fp $< $@
endef
+# The same as copy-file-to-target, but use the zipalign tool to do so.
+define copy-file-to-target-with-zipalign
+@mkdir -p $(dir $@)
+$(hide) $(ZIPALIGN) -f 4 $< $@
+endef
+
# The same as copy-file-to-target, but strip out "# comment"-style
# comments (for config files and such).
define copy-file-to-target-strip-comments
@@ -1496,6 +1502,12 @@
$(copy-file-to-target)
endef
+# Copy a prebuilt file to a target location, using zipalign on it.
+define transform-prebuilt-to-target-with-zipalign
+@echo "$(if $(PRIVATE_IS_HOST_MODULE),host,target) Prebuilt APK: $(PRIVATE_MODULE) ($@)"
+$(copy-file-to-target-with-zipalign)
+endef
+
# Copy a prebuilt file to a target location, stripping "# comment" comments.
define transform-prebuilt-to-target-strip-comments
@echo "$(if $(PRIVATE_IS_HOST_MODULE),host,target) Prebuilt: $(PRIVATE_MODULE) ($@)"