Merge "Enforce hidden apis usage in product(make)"

This commit is contained in:
Treehugger Robot
2019-11-11 02:05:16 +00:00
committed by Gerrit Code Review
3 changed files with 14 additions and 5 deletions

View File

@@ -16,16 +16,20 @@
ifdef BOARD_SYSTEMSDK_VERSIONS ifdef BOARD_SYSTEMSDK_VERSIONS
# Apps and jars in vendor or odm partition are forced to build against System SDK. # 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))) 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 # Note: no need to check LOCAL_MODULE_PATH* since LOCAL_[VENDOR|ODM|OEM]_MODULE is already
# set correctly before this is included. # 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 endif
ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS))) ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS)))
ifndef LOCAL_SDK_VERSION ifndef LOCAL_SDK_VERSION
ifeq ($(_is_vendor_app),true) ifeq ($(_cannot_use_platform_apis),true)
ifeq (,$(filter %__auto_generated_rro_vendor,$(LOCAL_MODULE))) ifeq (,$(findstring __auto_generated_rro_,$(LOCAL_MODULE)))
# Runtime resource overlays are exempted from building against System SDK. # Runtime resource overlays are exempted from building against System SDK.
# TODO(b/35859726): remove this exception # TODO(b/35859726): remove this exception
LOCAL_SDK_VERSION := system_current LOCAL_SDK_VERSION := system_current
@@ -39,7 +43,7 @@ endif
# The range of support versions becomes narrower when BOARD_SYSTEMSDK_VERSIONS # The range of support versions becomes narrower when BOARD_SYSTEMSDK_VERSIONS
# is set, which is a subset of PLATFORM_SYSTEMSDK_VERSIONS. # is set, which is a subset of PLATFORM_SYSTEMSDK_VERSIONS.
ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION))) 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 # apps bundled in system partition can use all system sdk versions provided by the platform
_supported_systemsdk_versions := $(PLATFORM_SYSTEMSDK_VERSIONS) _supported_systemsdk_versions := $(PLATFORM_SYSTEMSDK_VERSIONS)
else ifdef BOARD_SYSTEMSDK_VERSIONS else ifdef BOARD_SYSTEMSDK_VERSIONS

View File

@@ -376,6 +376,9 @@ _product_single_value_vars += PRODUCT_VIRTUAL_AB_OTA
# If set, device retrofits virtual A/B. # If set, device retrofits virtual A/B.
_product_single_value_vars += PRODUCT_VIRTUAL_AB_OTA_RETROFIT _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 .KATI_READONLY := _product_single_value_vars _product_list_vars
_product_var_list :=$= $(_product_single_value_vars) $(_product_list_vars) _product_var_list :=$= $(_product_single_value_vars) $(_product_list_vars)

View File

@@ -197,6 +197,8 @@ $(foreach namespace,$(SOONG_CONFIG_NAMESPACES),\
$(call end_json_map)) $(call end_json_map))
$(call end_json_map) $(call end_json_map)
$(call add_json_bool, EnforceProductPartitionInterface, $(PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE))
$(call json_end) $(call json_end)
$(file >$(SOONG_VARIABLES).tmp,$(json_contents)) $(file >$(SOONG_VARIABLES).tmp,$(json_contents))