Revert "Refactor calculation LOCAL_CHECKED_MODULE"

This reverts commit ba99e69424b72ac95581da50c8eea131d398d790

Change-Id: I3c42dea56376d26a5bb77b4944ae17a6875aadbb
diff --git a/core/java.mk b/core/java.mk
index eb232b6..9086134 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -259,8 +259,7 @@
 # If the module includes java code (i.e., it's not framework-res), compile it.
 full_classes_jar :=
 built_dex :=
-# need_compile_java is set in base_rules.mk
-ifeq ($(need_compile_java),true)
+ifneq (,$(strip $(all_java_sources)$(full_static_java_libs))$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED)))
 
 # If LOCAL_BUILT_MODULE_STEM wasn't overridden by our caller,
 # full_classes_jar will be the same module as LOCAL_BUILT_MODULE.
@@ -302,6 +301,15 @@
         $(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES)
 	$(transform-java-to-classes.jar)
 
+# All of the rules after full_classes_compiled_jar are very unlikely
+# to fail except for bugs in their respective tools.  If you would
+# like to run these rules, add the "all" modifier goal to the make
+# command line.
+# This overwrites the value defined in base_rules.mk.  That's a little
+# dirty.  It's preferable to set LOCAL_CHECKED_MODULE, but this has to
+# be done after the inclusion of base_rules.mk.
+ALL_MODULES.$(LOCAL_MODULE).CHECKED := $(full_classes_compiled_jar)
+
 $(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g
 
 # Run jarjar if necessary, otherwise just copy the file.