Ensure prebuilt executables are executable
Use 'chmod +x' to make sure that they're executable, even if the source
file is not.
Bug: 28097475
Change-Id: Id155f6b4ff188f5c909fd6237fd64183af264f79
(cherry picked from commit 08420cbc8ac7dabe1ceb6334ee83727e18a80d96)
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 9d45645..ee68427 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -341,12 +341,21 @@
ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
$(built_module) : $(my_prebuilt_src_file)
$(transform-prebuilt-to-target-strip-comments)
+ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES)
+ $(hide) chmod +x $@
+endif
else ifneq ($(LOCAL_ACP_UNAVAILABLE),true)
$(built_module) : $(my_prebuilt_src_file) | $(ACP)
$(transform-prebuilt-to-target)
+ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES)
+ $(hide) chmod +x $@
+endif
else
$(built_module) : $(my_prebuilt_src_file)
$(copy-file-to-target-with-cp)
+ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES)
+ $(hide) chmod +x $@
+endif
endif
endif # ! prebuilt_module_is_dex_javalib
endif # LOCAL_MODULE_CLASS != APPS