Implement LOCAL_COMPRESSED_MODULE.

- Prebuilts with LOCAL_MODULE_CLASS == APPS and BUILD_PACKAGE that
  define LOCAL_COMPRESSED_MODULE := true will be installed compressed
  in the system partition.
- The compression algorithm is simple gzip for now.

In addition :
- Compressed modules are not dex-preopted.
- JNI shared libraries are always embedded inside compressed modules,
  they are never installed as separate files on the FS.

Test: Manual
Bug: 63802184

Change-Id: Id12b1ff0b1d68791ec1178783f7e78910e122a33
diff --git a/core/definitions.mk b/core/definitions.mk
index 330d360..95e9a02 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2723,6 +2723,15 @@
   fi
 endef
 
+# Compress a package using the standard gzip algorithm.
+define compress-package
+$(hide) \
+  mv $@ $@.uncompressed; \
+  $(MINIGZIP) -c $@.uncompressed > $@.compressed; \
+  rm -f $@.uncompressed; \
+  mv $@.compressed $@;
+endef
+
 # Remove dynamic timestamps from packages
 #
 define remove-timestamps-from-package