Java resources in core-tests are auto-merged to the apks now.

Finally we can remove the build hack.
Bug: 6892294
Change-Id: I424093f6f603c4b63fe5a7fcd957ca5dcd348930
diff --git a/tests/core/ctscore.mk b/tests/core/ctscore.mk
index 049a58e..027d7c1 100644
--- a/tests/core/ctscore.mk
+++ b/tests/core/ctscore.mk
@@ -12,60 +12,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# First we build an apk without the core-tests resource
-cts_ORIGINAL_PACKAGE_NAME := $(LOCAL_PACKAGE_NAME)
-
-LOCAL_PACKAGE_NAME := $(LOCAL_PACKAGE_NAME).no-core-tests-res
-# Make sure this apk won't get installed
-LOCAL_UNINSTALLABLE_MODULE := true
-
 LOCAL_JAVA_LIBRARIES := android.test.runner bouncycastle
 LOCAL_PROGUARD_ENABLED := disabled
 LOCAL_DEX_PREOPT := false
 
-include $(BUILD_PACKAGE)
-# Vars set by $(BUILD_PACKAGE) and needed by the below module definition.
-cts_no-core-tests-res_BUILT_MODULE := $(LOCAL_BUILT_MODULE)
-cts_no-core-tests-res_private_key := $(private_key)
-cts_no-core-tests-res_certificate := $(certificate)
-
-##################################
-# Now the rules to build the apk with core-tests resource
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := $(cts_ORIGINAL_PACKAGE_NAME)
-LOCAL_MODULE_CLASS := APPS
 # don't include these packages in any target
 LOCAL_MODULE_TAGS := optional
-# and when built explicitly put them in the data partition
+# and when installed explicitly put them in the data partition
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
-LOCAL_BUILT_MODULE_STEM := package.apk
 
-include $(BUILD_SYSTEM)/base_rules.mk
-
-CORETESTS_INTERMEDIATES := $(call intermediates-dir-for,JAVA_LIBRARIES,core-tests,,COMMON)
-
-$(LOCAL_BUILT_MODULE): PRIVATE_INTERMEDIATES_COMMON := $(intermediates.COMMON)
-$(LOCAL_BUILT_MODULE): PRIVATE_CORETESTS_INTERMEDIATES_COMMON := $(CORETESTS_INTERMEDIATES)
-$(LOCAL_BUILT_MODULE): PRIVATE_PRIVATE_KEY := $(cts_no-core-tests-res_private_key)
-$(LOCAL_BUILT_MODULE): PRIVATE_CERTIFICATE := $(cts_no-core-tests-res_certificate)
-$(LOCAL_BUILT_MODULE): $(cts_no-core-tests-res_BUILT_MODULE) $(CORETESTS_INTERMEDIATES)/javalib.jar
-	@echo "Add resources to package ($@)"
-	$(hide) mkdir -p $(dir $@) $(PRIVATE_INTERMEDIATES_COMMON)
-	$(hide) rm -rf $(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses
-	# javalib.jar should only contain .dex files, but the harmony tests also include
-	# some .class files, so get rid of them
-	$(hide) unzip -qo $(PRIVATE_CORETESTS_INTERMEDIATES_COMMON)/javalib.jar \
-		-d $(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses
-	$(hide) find $(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses -type f -name "*.class" -delete
-	$(hide) rm -f $(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses/classes.dex
-	$(hide) cp $< $@
-	$(hide) jar uf $@ -C $(PRIVATE_INTERMEDIATES_COMMON)/ctsclasses .
-	$(sign-package)
-	$(align-package)
-
-# some global vars set in $(BUILD_PACKAGE), not sure if we really need here
-PACKAGES.$(cts_ORIGINAL_PACKAGE_NAME).PRIVATE_KEY := $(cts_no-core-tests-res_private_key)
-PACKAGES.$(cts_ORIGINAL_PACKAGE_NAME).CERTIFICATE := $(cts_no-core-tests-res_certificate)
-PACKAGES := $(PACKAGES) $(cts_ORIGINAL_PACKAGE_NAME)
+include $(BUILD_PACKAGE)
diff --git a/tests/core/libcore/com/Android.mk b/tests/core/libcore/com/Android.mk
index 91a5da0..02dc3de 100644
--- a/tests/core/libcore/com/Android.mk
+++ b/tests/core/libcore/com/Android.mk
@@ -19,7 +19,6 @@
 endif
 
 include $(CLEAR_VARS)
-LOCAL_SRC_FILES := ../src/Dummy.java
 LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.com
 LOCAL_STATIC_JAVA_LIBRARIES := core-tests
 include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/dalvik/Android.mk b/tests/core/libcore/dalvik/Android.mk
index 45f6e7e..7b77a75 100644
--- a/tests/core/libcore/dalvik/Android.mk
+++ b/tests/core/libcore/dalvik/Android.mk
@@ -19,7 +19,6 @@
 endif
 
 include $(CLEAR_VARS)
-LOCAL_SRC_FILES := ../src/Dummy.java
 LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.dalvik
 LOCAL_STATIC_JAVA_LIBRARIES := core-tests
 include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/libcore/Android.mk b/tests/core/libcore/libcore/Android.mk
index 97e32bc..382b386 100644
--- a/tests/core/libcore/libcore/Android.mk
+++ b/tests/core/libcore/libcore/Android.mk
@@ -19,7 +19,6 @@
 endif
 
 include $(CLEAR_VARS)
-LOCAL_SRC_FILES := ../src/Dummy.java
 LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.libcore
 LOCAL_STATIC_JAVA_LIBRARIES := core-tests
 include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/org/Android.mk b/tests/core/libcore/org/Android.mk
index 8fad8de..d7a96b3 100644
--- a/tests/core/libcore/org/Android.mk
+++ b/tests/core/libcore/org/Android.mk
@@ -19,7 +19,6 @@
 endif
 
 include $(CLEAR_VARS)
-LOCAL_SRC_FILES := ../src/Dummy.java
 LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.org
 LOCAL_STATIC_JAVA_LIBRARIES := core-tests
 include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/src/Dummy.java b/tests/core/libcore/src/Dummy.java
deleted file mode 100644
index 64b67de..0000000
--- a/tests/core/libcore/src/Dummy.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * We really just want the core-tests classes from the static java
- * library, but the build system currently needs at least one input
- * file, not just because its a sanity check, but because the static
- * class files and resources are included in the output of the local
- * java compilation.
- */
-public final class Dummy {}
diff --git a/tests/core/libcore/sun/Android.mk b/tests/core/libcore/sun/Android.mk
index 5fc0c48..44d3d70 100644
--- a/tests/core/libcore/sun/Android.mk
+++ b/tests/core/libcore/sun/Android.mk
@@ -19,7 +19,6 @@
 endif
 
 include $(CLEAR_VARS)
-LOCAL_SRC_FILES := ../src/Dummy.java
 LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.sun
 LOCAL_STATIC_JAVA_LIBRARIES := core-tests
 include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/tests/Android.mk b/tests/core/libcore/tests/Android.mk
index bcb6628..bfd235f 100644
--- a/tests/core/libcore/tests/Android.mk
+++ b/tests/core/libcore/tests/Android.mk
@@ -19,7 +19,6 @@
 endif
 
 include $(CLEAR_VARS)
-LOCAL_SRC_FILES := ../src/Dummy.java
 LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.tests
 LOCAL_STATIC_JAVA_LIBRARIES := core-tests
 include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/runner/Android.mk b/tests/core/runner/Android.mk
index 7658b7a..fb548fc 100644
--- a/tests/core/runner/Android.mk
+++ b/tests/core/runner/Android.mk
@@ -27,4 +27,6 @@
 
 LOCAL_PACKAGE_NAME := android.core.tests.runner
 
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
+
 include $(BUILD_CTSCORE_PACKAGE)