Merge "apkcerts: Add information about the compressed state of the APK." into oc-mr1-dev
am: fd6cbbe609
Change-Id: Ia7e22ad69d1149f80107db12de53136b4b15bc8d
diff --git a/core/Makefile b/core/Makefile
index 5a1e7aa..1dc09e9 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -419,8 +419,10 @@
# -----------------------------------------------------------------
# Cert-to-package mapping. Used by the post-build signing tools.
# Use a macro to add newline to each echo command
-define _apkcerts_echo_with_newline
-$(hide) echo $(1)
+define _apkcerts_write_line
+$(hide) echo -n 'name="$(1).apk" certificate="$2" private_key="$3"' >> $5
+$(if $(4), $(hide) echo -n ' compressed="$4"' >> $5)
+$(hide) echo '' >> $5
endef
@@ -440,12 +442,8 @@
@rm -f $@
$(foreach p,$(PACKAGES),\
$(if $(PACKAGES.$(p).EXTERNAL_KEY),\
- $(call _apkcerts_echo_with_newline,\
- 'name="$(p).apk" certificate="EXTERNAL" \
- private_key=""' >> $@),\
- $(call _apkcerts_echo_with_newline,\
- 'name="$(p).apk" certificate="$(PACKAGES.$(p).CERTIFICATE)" \
- private_key="$(PACKAGES.$(p).PRIVATE_KEY)"' >> $@)))
+ $(call _apkcerts_write_line,$(p),"EXTERNAL","",$(PACKAGES.$(p).COMPRESSED),$@),\
+ $(call _apkcerts_write_line,$(p),$(PACKAGES.$(p).CERTIFICATE),$(PACKAGES.$(p).PRIVATE_KEY),$(PACKAGES.$(p).COMPRESSED),$@)))
# In case value of PACKAGES is empty.
$(hide) touch $@
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 39b58ea..f7243dc 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -222,6 +222,7 @@
endif
ifdef LOCAL_COMPRESSED_MODULE
+PACKAGES.$(LOCAL_PACKAGE_NAME).COMPRESSED := gz
LOCAL_BUILT_MODULE_STEM := package.apk.gz
LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE).apk.gz
else # !LOCAL_COMPRESSED_MODULE
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index edda97e..48593a5 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -120,6 +120,7 @@
ifndef LOCAL_INSTALLED_MODULE_STEM
ifdef LOCAL_COMPRESSED_MODULE
+PACKAGES.$(LOCAL_MODULE).COMPRESSED := gz
LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE).apk.gz
else
LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE).apk