From 3d71a082ed89a32511ddd10483718b10304f147d Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Fri, 23 Feb 2018 18:12:59 +0900 Subject: [PATCH] Don't allow linking to a java module with broader API surface It has been allowed that a java module built with Android SDK or System SDK to link against other java module built with broader API surface. For example, an app that is building with SDK (LOCAL_SDK_VERSION := current or ) can link libs like telephony-common or bouncycastle which are built without SDK but in fact exposing private APIs. From now on, this is no longer allowed because it prevents the app from being unbundled. In general, a Java module A cannot be linked to Java module B if B is built with broader API surface than A. Bug: 69899800 Test: m -j checkbuild on walleye, sailfish, and crosshatch Test: m -j ANDROID_BUILDSPEC=vendor/google/build/app_build_spec.mk Test: ./vendor/google/build/build_test.bash --dist Change-Id: Ibfdb1a6777f4e0606927d834d56f808639eb91f0 --- core/java_common.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/java_common.mk b/core/java_common.mk index 3a5c5c63c..c97653b7e 100644 --- a/core/java_common.mk +++ b/core/java_common.mk @@ -457,11 +457,11 @@ ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR := \ ifndef LOCAL_IS_HOST_MODULE ifeq ($(LOCAL_SDK_VERSION),system_current) my_link_type := java:system -my_warn_types := java:platform +my_warn_types := my_allowed_types := java:sdk java:system java:core else ifneq (,$(call has-system-sdk-version,$(LOCAL_SDK_VERSION))) my_link_type := java:system -my_warn_types := java:platform +my_warn_types := my_allowed_types := java:sdk java:system java:core else ifeq ($(LOCAL_SDK_VERSION),core_current) my_link_type := java:core @@ -469,7 +469,7 @@ my_warn_types := my_allowed_types := java:core else ifneq ($(LOCAL_SDK_VERSION),) my_link_type := java:sdk -my_warn_types := java:system java:platform +my_warn_types := my_allowed_types := java:sdk java:core else my_link_type := java:platform