Merge "Mark prebuilt API stubs as java:sdk rather than java:platform"
am: 363f835c03

Change-Id: Ibebf507f6514a8d0c1be7323cef33e751881c6dc
diff --git a/Android.mk b/Android.mk
index 7cd8edb..4a8c42c 100644
--- a/Android.mk
+++ b/Android.mk
@@ -27,6 +27,7 @@
 LOCAL_BUILT_MODULE_STEM := sdk_v$(1)$(COMMON_JAVA_PACKAGE_SUFFIX)
 LOCAL_MIN_SDK_VERSION := $(if $(call math_is_number,$(strip $(1))),$(1),$(PLATFORM_JACK_MIN_SDK_VERSION))
 LOCAL_UNINSTALLABLE_MODULE := true
+LOCAL_SDK_VERSION := current
 include $(BUILD_PREBUILT)
 
 ifneq (,$(wildcard $(LOCAL_PATH)/$(1)/uiautomator.jar))
diff --git a/current/Android.mk b/current/Android.mk
index 24f9f7c..cfe71d1 100644
--- a/current/Android.mk
+++ b/current/Android.mk
@@ -22,19 +22,35 @@
 # For apps (unbundled) build, replace the typical
 # make target artifacts with prebuilts.
 ifneq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
-include $(CLEAR_VARS)
-
 # Set up prebuilts for the core Support Library artifacts.
-LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES += \
+support_jars := \
   $(patsubst $(LOCAL_PATH)/%,%,\
     $(shell find $(LOCAL_PATH)/support -name "*.jar"))
 
 # Set up prebuilts for Multidex library artifacts.
-LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES += \
+multidex_jars := \
   $(patsubst $(LOCAL_PATH)/%,%,\
     $(shell find $(LOCAL_PATH)/multidex -name "*.jar"))
 
-include $(BUILD_MULTI_PREBUILT)
+prebuilts := $(foreach jar,$(support_jars) $(multidex_jars),\
+    $(basename $(notdir $(jar))):$(jar))
+
+define define-prebuilt
+    $(eval tw := $(subst :, ,$(strip $(1)))) \
+    $(eval include $(CLEAR_VARS)) \
+    $(eval LOCAL_MODULE := $(word 1,$(tw))) \
+    $(eval LOCAL_MODULE_TAGS := optional) \
+    $(eval LOCAL_MODULE_CLASS := JAVA_LIBRARIES) \
+    $(eval LOCAL_SRC_FILES := $(word 2,$(tw))) \
+    $(eval LOCAL_UNINSTALLABLE_MODULE := true) \
+    $(eval LOCAL_SDK_VERSION := current) \
+    $(eval include $(BUILD_PREBUILT))
+endef
+
+$(foreach p,$(prebuilts),\
+    $(call define-prebuilt,$(p)))
+
+prebuilts :=
 
 # Generates the v4, v13, and appcompat libraries with static dependencies.
 include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/org.apache.http.legacy/Android.mk b/org.apache.http.legacy/Android.mk
index ca4660e..3574917 100644
--- a/org.apache.http.legacy/Android.mk
+++ b/org.apache.http.legacy/Android.mk
@@ -23,6 +23,8 @@
 LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
 LOCAL_BUILT_MODULE_STEM := javalib.jar
 LOCAL_UNINSTALLABLE_MODULE := true
+# 21 as specified at /external/apache-http/Android.mk
+LOCAL_SDK_VERSION := 21
 
 include $(BUILD_PREBUILT)
 endif
diff --git a/renderscript/Android.mk b/renderscript/Android.mk
index 9d48082..2528e43 100644
--- a/renderscript/Android.mk
+++ b/renderscript/Android.mk
@@ -60,6 +60,8 @@
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE_SUFFIX := .jar
 LOCAL_UNINSTALLABLE_MODULE := true
+# 23 as specified at frameworks/rs/support/Android.mk
+LOCAL_SDK_VERSION := 23
 
 include $(BUILD_PREBUILT)