Add LOCAL_SDK_VERSION := system_$(VER)

The system_$(VER) can be set in LOCAL_SDK_VERSION, and the apk will use
android_system.jar at build time.
If LOCAL_SDK_VERSION is not defined and this module is installed in
vendor.img, LOCAL_SDK_VERSION is set to system_current.

Bug: 67724799
Test: 1. build && run on taimen
2. LOCAL_SDK_VERSION:=system_27 in ims.apk && build ims.apk && check
the vsdk_v27_intermediates.

Change-Id: I5b11c78b8fcd4a2f2a5e3b141527cd34dbe80018
This commit is contained in:
Sundong Ahn 2017-10-16 19:20:34 +09:00
parent 26382840ae
commit ef212cbe8d
15 changed files with 83 additions and 15 deletions

View File

@ -56,10 +56,15 @@ ifneq ($(LOCAL_SDK_VERSION),)
else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current)
LOCAL_JAVA_LIBRARIES := android_test_stubs_current $(LOCAL_JAVA_LIBRARIES)
$(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, android_test_stubs_current)
else
ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION)))
LOCAL_JAVA_LIBRARIES := system_sdk_v$(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION)) $(LOCAL_JAVA_LIBRARIES)
$(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, system_sdk_v$(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION)))
else
LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES)
$(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, sdk_v$(LOCAL_SDK_VERSION))
endif
endif
else
LOCAL_JAVA_LIBRARIES := core-oj core-libart ext framework $(LOCAL_JAVA_LIBRARIES)
$(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, core-oj):$(call java-lib-files, core-libart)

View File

@ -86,6 +86,7 @@ $(call pretty-error,Only one of LOCAL_PROPRIETARY_MODULE[$(LOCAL_PROPRIETARY_MOD
endif
include $(BUILD_SYSTEM)/local_vndk.mk
include $(BUILD_SYSTEM)/local_vsdk.mk
my_module_tags := $(LOCAL_MODULE_TAGS)
ifeq ($(my_host_cross),true)

View File

@ -806,7 +806,7 @@ else
ifneq (,$(LOCAL_SDK_VERSION))
# Set target-api for LOCAL_SDK_VERSIONs other than current.
ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
renderscript_target_api := $(LOCAL_SDK_VERSION)
renderscript_target_api := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
endif
endif # LOCAL_SDK_VERSION is set
endif # LOCAL_RENDERSCRIPT_TARGET_API is set

View File

@ -880,6 +880,11 @@ TARGET_AVAILABLE_SDK_VERSIONS := $(call numerically_sort,\
$(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \
$(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar)))
TARGET_AVAILABLE_SDK_VERSIONS := $(addprefix system_,$(call numerically_sort,\
$(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android_system.jar,%, \
$(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android_system.jar)))) \
$(TARGET_AVAILABLE_SDK_VERSIONS)
# We don't have prebuilt test_current SDK yet.
TARGET_AVAILABLE_SDK_VERSIONS := test_current $(TARGET_AVAILABLE_SDK_VERSIONS)

View File

@ -3395,3 +3395,22 @@ $(foreach source,$(ENFORCE_RRO_SOURCES), \
$(eval ALL_MODULES.$(enforce_rro_source_module).REQUIRED += $(enforce_rro_module)) \
)
endef
###########################################################
## Find system_$(VER) in LOCAL_SDK_VERSION
##
## $(1): LOCAL_SDK_VERSION
###########################################################
define has-system-sdk-version
$(filter system_%,$(1))
endef
###########################################################
## Get numerical version in LOCAL_SDK_VERSION
##
## $(1): LOCAL_SDK_VERSION
###########################################################
define get-numeric-sdk-version
$(filter-out current,\
$(if $(call has-system-sdk-version,$(1)),$(patsubst system_%,%,$(1)),$(1)))
endef

View File

@ -19,7 +19,7 @@ $(built_dpi_apk): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
$(built_dpi_apk): PRIVATE_AAPT_INCLUDES := $(all_library_res_package_exports)
$(built_dpi_apk): PRIVATE_RESOURCE_LIST := $(all_res_assets)
ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
$(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION)
$(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
else
$(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK)
endif

View File

@ -71,10 +71,15 @@ ifneq ($(LOCAL_SDK_VERSION),)
else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current)
LOCAL_JAVA_LIBRARIES := android_test_stubs_current $(LOCAL_JAVA_LIBRARIES)
$(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, android_test_stubs_current)
else
ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION)))
LOCAL_JAVA_LIBRARIES := system_sdk_v$(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION)) $(LOCAL_JAVA_LIBRARIES)
$(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, system_sdk_v$(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION)))
else
LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES)
$(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, sdk_v$(LOCAL_SDK_VERSION))
endif
endif
else
LOCAL_JAVA_LIBRARIES := core-oj core-libart ext framework $(LOCAL_JAVA_LIBRARIES)
$(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, core-oj):$(call java-lib-files, core-libart)

View File

@ -186,8 +186,8 @@ $(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
endif # !LOCAL_IS_STATIC_JAVA_LIBRARY
ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
my_default_app_target_sdk := $(LOCAL_SDK_VERSION)
my_sdk_version := $(LOCAL_SDK_VERSION)
my_default_app_target_sdk := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
my_sdk_version := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
else
my_default_app_target_sdk := $(DEFAULT_APP_TARGET_SDK)
my_sdk_version := $(PLATFORM_SDK_VERSION)

View File

@ -135,7 +135,7 @@ else
ifneq (,$(LOCAL_SDK_VERSION))
# Set target-api for LOCAL_SDK_VERSIONs other than current.
ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
renderscript_target_api := $(LOCAL_SDK_VERSION)
renderscript_target_api := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
endif
endif # LOCAL_SDK_VERSION is set
endif # LOCAL_RENDERSCRIPT_TARGET_API is set
@ -820,8 +820,8 @@ $(LOCAL_MODULE)-findbugs : $(findbugs_html)
endif # full_classes_jar is defined
ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
my_default_app_target_sdk := $(LOCAL_SDK_VERSION)
my_sdk_version := $(LOCAL_SDK_VERSION)
my_default_app_target_sdk := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
my_sdk_version := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
else
my_default_app_target_sdk := $(DEFAULT_APP_TARGET_SDK)
my_sdk_version := $(PLATFORM_SDK_VERSION)

View File

@ -228,9 +228,13 @@ ifndef LOCAL_IS_HOST_MODULE
full_java_bootclasspath_libs := $(call java-lib-header-files,android_system_stubs_current)
else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current)
full_java_bootclasspath_libs := $(call java-lib-header-files,android_test_stubs_current)
else
ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION)))
full_java_bootclasspath_libs := $(call java-lib-header-files,system_sdk_v$(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION)))
else
full_java_bootclasspath_libs := $(call java-lib-header-files,sdk_v$(LOCAL_SDK_VERSION))
endif # current, system_current, or test_current
endif
endif # current, system_current, system_${VER} or test_current
endif # LOCAL_SDK_VERSION
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
@ -404,6 +408,10 @@ ifeq ($(LOCAL_SDK_VERSION),system_current)
my_link_type := java:system
my_warn_types := java:platform
my_allowed_types := java:sdk java:system
else ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION)))
my_link_type := java:system
my_warn_types := java:platform
my_allowed_types := java:sdk java:system
else ifneq ($(LOCAL_SDK_VERSION),)
my_link_type := java:sdk
my_warn_types := java:system java:platform

19
core/local_vsdk.mk Normal file
View File

@ -0,0 +1,19 @@
ifdef BOARD_VSDK_VERSION
# Set LOCAL_SDK_VERSION to system_current, If LOCAL_SDK_VERSION is not defined and LOCAL_VENDOR_MODULE is true
_is_vendor_app :=
ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_OEM_MODULE) $(LOCAL_PROPRIETARY_MODULE)))
_is_vendor_app := true
else
ifneq (,$(filter $(TARGET_OUT_VENDOR)%,$(LOCAL_MODULE_PATH) $(LOCAL_MODULE_PATH_32) $(LOCAL_MODULE_PATH_64)))
_is_vendor_app := true
endif
endif
ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS)))
ifndef LOCAL_SDK_VERSION
ifeq ($(_is_vendor_app),true)
LOCAL_SDK_VERSION := system_current
endif
endif
endif
endif

View File

@ -389,7 +389,7 @@ else
ifneq (,$(LOCAL_SDK_VERSION))
# Set target-api for LOCAL_SDK_VERSIONs other than current.
ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
renderscript_target_api := $(LOCAL_SDK_VERSION)
renderscript_target_api := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
endif
endif # LOCAL_SDK_VERSION is set
endif # LOCAL_RENDERSCRIPT_TARGET_API is set

View File

@ -540,6 +540,8 @@ $(common_classes_jar) $(common_classes_pre_proguard_jar) $(common_javalib_jar):
ifeq ($(LOCAL_SDK_VERSION),system_current)
my_link_type := java:system
else ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION)))
my_link_type := java:system
else ifneq ($(LOCAL_SDK_VERSION),)
my_link_type := java:sdk
else

View File

@ -79,6 +79,10 @@ ifeq ($(LOCAL_SDK_VERSION),system_current)
my_link_type := java:system
my_warn_types := java:platform
my_allowed_types := java:sdk java:system
else ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION)))
my_link_type := java:system
my_warn_types := java:platform
my_allowed_types := java:sdk java:system
else ifneq ($(LOCAL_SDK_VERSION),)
my_link_type := java:sdk
my_warn_types := java:system java:platform

View File

@ -160,7 +160,7 @@ else
ifneq (,$(LOCAL_SDK_VERSION))
# Set target-api for LOCAL_SDK_VERSIONs other than current.
ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
renderscript_target_api := $(LOCAL_SDK_VERSION)
renderscript_target_api := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
endif
endif # LOCAL_SDK_VERSION is set
endif # LOCAL_RENDERSCRIPT_TARGET_API is set