Loading core/base_rules.mk +9 −1 Original line number Original line Diff line number Diff line Loading @@ -121,9 +121,17 @@ non_system_module := $(filter true, \ $(LOCAL_PROPRIETARY_MODULE)) $(LOCAL_PROPRIETARY_MODULE)) include $(BUILD_SYSTEM)/local_vndk.mk include $(BUILD_SYSTEM)/local_vndk.mk include $(BUILD_SYSTEM)/local_systemsdk.mk # local_current_sdk needs to run before local_systemsdk because the former may override # LOCAL_SDK_VERSION which is used by the latter. include $(BUILD_SYSTEM)/local_current_sdk.mk include $(BUILD_SYSTEM)/local_current_sdk.mk # Check if the use of System SDK is correct. Note that, for Soong modules, the system sdk version # check is done in Soong. No need to do it twice. ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK)) include $(BUILD_SYSTEM)/local_systemsdk.mk endif # Ninja has an implicit dependency on the command being run, and kati will # Ninja has an implicit dependency on the command being run, and kati will # regenerate the ninja manifest if any read makefile changes, so there is no # regenerate the ninja manifest if any read makefile changes, so there is no # need to have dependencies on makefiles. # need to have dependencies on makefiles. Loading core/local_current_sdk.mk +14 −3 Original line number Original line Diff line number Diff line Loading @@ -14,13 +14,24 @@ # limitations under the License. # limitations under the License. # # ifdef BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES ifdef BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES ifneq (current,$(BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES)) _override_to := $(BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES) # b/314011075: apks and jars in the vendor or odm partitions cannot use # system SDK 35 and beyond. In order not to suddenly break those vendor # modules using current or system_current as their LOCAL_SDK_VERSION, # override it to 34, which is the maximum API level allowed for them. ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS))) _override_to := 34 endif ifneq (current,$(_override_to)) ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE))) ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE))) ifeq (current,$(LOCAL_SDK_VERSION)) ifeq (current,$(LOCAL_SDK_VERSION)) LOCAL_SDK_VERSION := $(BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES) LOCAL_SDK_VERSION := $(_override_to) else ifeq (system_current,$(LOCAL_SDK_VERSION)) else ifeq (system_current,$(LOCAL_SDK_VERSION)) LOCAL_SDK_VERSION := system_$(BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES) LOCAL_SDK_VERSION := system_$(_override_to) endif endif endif endif endif endif _override_to := endif endif core/local_systemsdk.mk +26 −0 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,9 @@ ifdef BOARD_SYSTEMSDK_VERSIONS # Runtime resource overlays are exempted from building against System SDK. # Runtime resource overlays are exempted from building against System SDK. # TODO(b/155027019): remove this, after no product/vendor apps rely on this behavior. # TODO(b/155027019): remove this, after no product/vendor apps rely on this behavior. LOCAL_SDK_VERSION := system_current LOCAL_SDK_VERSION := system_current # We have run below again since LOCAL_SDK_VERSION is newly set and the "_current" # may have to be updated include $(BUILD_SYSTEM)/local_current_sdk.mk endif endif endif endif endif endif Loading @@ -54,7 +57,30 @@ ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION))) # If not, vendor apks are treated equally to system apps # If not, vendor apks are treated equally to system apps _supported_systemsdk_versions := $(PLATFORM_SYSTEMSDK_VERSIONS) _supported_systemsdk_versions := $(PLATFORM_SYSTEMSDK_VERSIONS) endif endif # b/314011075: apks and jars in the vendor or odm partitions cannot use system SDK 35 and beyond. # This is to discourage the use of Java APIs in the partitions, which hasn't been supported since # the beginning of the project Treble back in Android 10. Ultimately, we'd like to completely # disallow any Java API in the partitions, but it shall be done progressively. ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE))) # 28 is the API level when BOARD_SYSTEMSDK_VERSIONS was introduced. So, it's the oldset API # we allow. _supported_systemsdk_versions := $(call int_range_list, 28, 34) endif # Extract version number from LOCAL_SDK_VERSION (ex: system_34 -> 34) _system_sdk_version := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION)) _system_sdk_version := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION)) # However, the extraction may fail if it doesn't have any number (i.e. current, core_current, # system_current, or similar) Then use the latest platform SDK version number or the actual # codename. ifeq (,$(_system_sdk_version) ifeq (REL,$(PLATFORM_VERSION_CODENAME)) _system_sdk_version := $(PLATFORM_SDK_VERSION) else _system_sdk_version := $(PLATFORM_VERSION_CODENAME) endif endif ifneq ($(_system_sdk_version),$(filter $(_system_sdk_version),$(_supported_systemsdk_versions))) ifneq ($(_system_sdk_version),$(filter $(_system_sdk_version),$(_supported_systemsdk_versions))) $(call pretty-error,Incompatible LOCAL_SDK_VERSION '$(LOCAL_SDK_VERSION)'. \ $(call pretty-error,Incompatible LOCAL_SDK_VERSION '$(LOCAL_SDK_VERSION)'. \ System SDK version '$(_system_sdk_version)' is not supported. Supported versions are: $(_supported_systemsdk_versions)) System SDK version '$(_system_sdk_version)' is not supported. Supported versions are: $(_supported_systemsdk_versions)) Loading Loading
core/base_rules.mk +9 −1 Original line number Original line Diff line number Diff line Loading @@ -121,9 +121,17 @@ non_system_module := $(filter true, \ $(LOCAL_PROPRIETARY_MODULE)) $(LOCAL_PROPRIETARY_MODULE)) include $(BUILD_SYSTEM)/local_vndk.mk include $(BUILD_SYSTEM)/local_vndk.mk include $(BUILD_SYSTEM)/local_systemsdk.mk # local_current_sdk needs to run before local_systemsdk because the former may override # LOCAL_SDK_VERSION which is used by the latter. include $(BUILD_SYSTEM)/local_current_sdk.mk include $(BUILD_SYSTEM)/local_current_sdk.mk # Check if the use of System SDK is correct. Note that, for Soong modules, the system sdk version # check is done in Soong. No need to do it twice. ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK)) include $(BUILD_SYSTEM)/local_systemsdk.mk endif # Ninja has an implicit dependency on the command being run, and kati will # Ninja has an implicit dependency on the command being run, and kati will # regenerate the ninja manifest if any read makefile changes, so there is no # regenerate the ninja manifest if any read makefile changes, so there is no # need to have dependencies on makefiles. # need to have dependencies on makefiles. Loading
core/local_current_sdk.mk +14 −3 Original line number Original line Diff line number Diff line Loading @@ -14,13 +14,24 @@ # limitations under the License. # limitations under the License. # # ifdef BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES ifdef BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES ifneq (current,$(BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES)) _override_to := $(BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES) # b/314011075: apks and jars in the vendor or odm partitions cannot use # system SDK 35 and beyond. In order not to suddenly break those vendor # modules using current or system_current as their LOCAL_SDK_VERSION, # override it to 34, which is the maximum API level allowed for them. ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS))) _override_to := 34 endif ifneq (current,$(_override_to)) ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE))) ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE))) ifeq (current,$(LOCAL_SDK_VERSION)) ifeq (current,$(LOCAL_SDK_VERSION)) LOCAL_SDK_VERSION := $(BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES) LOCAL_SDK_VERSION := $(_override_to) else ifeq (system_current,$(LOCAL_SDK_VERSION)) else ifeq (system_current,$(LOCAL_SDK_VERSION)) LOCAL_SDK_VERSION := system_$(BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES) LOCAL_SDK_VERSION := system_$(_override_to) endif endif endif endif endif endif _override_to := endif endif
core/local_systemsdk.mk +26 −0 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,9 @@ ifdef BOARD_SYSTEMSDK_VERSIONS # Runtime resource overlays are exempted from building against System SDK. # Runtime resource overlays are exempted from building against System SDK. # TODO(b/155027019): remove this, after no product/vendor apps rely on this behavior. # TODO(b/155027019): remove this, after no product/vendor apps rely on this behavior. LOCAL_SDK_VERSION := system_current LOCAL_SDK_VERSION := system_current # We have run below again since LOCAL_SDK_VERSION is newly set and the "_current" # may have to be updated include $(BUILD_SYSTEM)/local_current_sdk.mk endif endif endif endif endif endif Loading @@ -54,7 +57,30 @@ ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION))) # If not, vendor apks are treated equally to system apps # If not, vendor apks are treated equally to system apps _supported_systemsdk_versions := $(PLATFORM_SYSTEMSDK_VERSIONS) _supported_systemsdk_versions := $(PLATFORM_SYSTEMSDK_VERSIONS) endif endif # b/314011075: apks and jars in the vendor or odm partitions cannot use system SDK 35 and beyond. # This is to discourage the use of Java APIs in the partitions, which hasn't been supported since # the beginning of the project Treble back in Android 10. Ultimately, we'd like to completely # disallow any Java API in the partitions, but it shall be done progressively. ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_PROPRIETARY_MODULE))) # 28 is the API level when BOARD_SYSTEMSDK_VERSIONS was introduced. So, it's the oldset API # we allow. _supported_systemsdk_versions := $(call int_range_list, 28, 34) endif # Extract version number from LOCAL_SDK_VERSION (ex: system_34 -> 34) _system_sdk_version := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION)) _system_sdk_version := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION)) # However, the extraction may fail if it doesn't have any number (i.e. current, core_current, # system_current, or similar) Then use the latest platform SDK version number or the actual # codename. ifeq (,$(_system_sdk_version) ifeq (REL,$(PLATFORM_VERSION_CODENAME)) _system_sdk_version := $(PLATFORM_SDK_VERSION) else _system_sdk_version := $(PLATFORM_VERSION_CODENAME) endif endif ifneq ($(_system_sdk_version),$(filter $(_system_sdk_version),$(_supported_systemsdk_versions))) ifneq ($(_system_sdk_version),$(filter $(_system_sdk_version),$(_supported_systemsdk_versions))) $(call pretty-error,Incompatible LOCAL_SDK_VERSION '$(LOCAL_SDK_VERSION)'. \ $(call pretty-error,Incompatible LOCAL_SDK_VERSION '$(LOCAL_SDK_VERSION)'. \ System SDK version '$(_system_sdk_version)' is not supported. Supported versions are: $(_supported_systemsdk_versions)) System SDK version '$(_system_sdk_version)' is not supported. Supported versions are: $(_supported_systemsdk_versions)) Loading