aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeongik Cha <jeongik@google.com>2019-11-11 09:06:12 -0800
committerandroid-build-merger <android-build-merger@google.com>2019-11-11 09:06:12 -0800
commitcd22a522764cc9829b3d472ba9172114a9f8b095 (patch)
treeb36507fcaaa5c40f984225a3563cc9448bd635cf
parent9a5a603b33afad730f4e80cea355f2a3ac408d6b (diff)
parentad736249242c2bfa8650496441ed949f94c6e309 (diff)
downloadbuild-cd22a522764cc9829b3d472ba9172114a9f8b095.tar.gz
Merge "Enforce hidden apis usage in product(make)"
am: ad73624924 Change-Id: Ibbeb72d7fb1f0bd19818ac87dad88e527dbc8b06
-rw-r--r--core/local_systemsdk.mk14
-rw-r--r--core/product.mk3
-rw-r--r--core/soong_config.mk2
3 files changed, 14 insertions, 5 deletions
diff --git a/core/local_systemsdk.mk b/core/local_systemsdk.mk
index 6c022f2daf..2b73f93209 100644
--- a/core/local_systemsdk.mk
+++ b/core/local_systemsdk.mk
@@ -16,16 +16,20 @@
ifdef BOARD_SYSTEMSDK_VERSIONS
# Apps and jars in vendor or odm partition are forced to build against System SDK.
- _is_vendor_app :=
+ _cannot_use_platform_apis :=
ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE)))
# Note: no need to check LOCAL_MODULE_PATH* since LOCAL_[VENDOR|ODM|OEM]_MODULE is already
# set correctly before this is included.
- _is_vendor_app := true
+ _cannot_use_platform_apis := true
+ else ifeq ($(LOCAL_PRODUCT_MODULE),true)
+ ifeq ($(PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE),true)
+ _cannot_use_platform_apis := true
+ endif
endif
ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS)))
ifndef LOCAL_SDK_VERSION
- ifeq ($(_is_vendor_app),true)
- ifeq (,$(filter %__auto_generated_rro_vendor,$(LOCAL_MODULE)))
+ ifeq ($(_cannot_use_platform_apis),true)
+ ifeq (,$(findstring __auto_generated_rro_,$(LOCAL_MODULE)))
# Runtime resource overlays are exempted from building against System SDK.
# TODO(b/35859726): remove this exception
LOCAL_SDK_VERSION := system_current
@@ -39,7 +43,7 @@ endif
# The range of support versions becomes narrower when BOARD_SYSTEMSDK_VERSIONS
# is set, which is a subset of PLATFORM_SYSTEMSDK_VERSIONS.
ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION)))
- ifneq ($(_is_vendor_app),true)
+ ifneq ($(_cannot_use_platform_apis),true)
# apps bundled in system partition can use all system sdk versions provided by the platform
_supported_systemsdk_versions := $(PLATFORM_SYSTEMSDK_VERSIONS)
else ifdef BOARD_SYSTEMSDK_VERSIONS
diff --git a/core/product.mk b/core/product.mk
index bc09c2bc97..102e6a5c19 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -376,6 +376,9 @@ _product_single_value_vars += PRODUCT_VIRTUAL_AB_OTA
# If set, device retrofits virtual A/B.
_product_single_value_vars += PRODUCT_VIRTUAL_AB_OTA_RETROFIT
+# If set, Java module in product partition cannot use hidden APIs.
+_product_single_value_vars += PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE
+
.KATI_READONLY := _product_single_value_vars _product_list_vars
_product_var_list :=$= $(_product_single_value_vars) $(_product_list_vars)
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 1138f08993..7ce59f1559 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -197,6 +197,8 @@ $(foreach namespace,$(SOONG_CONFIG_NAMESPACES),\
$(call end_json_map))
$(call end_json_map)
+$(call add_json_bool, EnforceProductPartitionInterface, $(PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE))
+
$(call json_end)
$(file >$(SOONG_VARIABLES).tmp,$(json_contents))