Move odex related files to product-specific dir.

For target Java libraries, now the LOCAL_BUILT_MODULE includes both javalib.jar
and the .odex file, if dexpreopt is enabled.
These 2 files are moved to a product-specific dir in this change.
For target Java Libraries, $(intermediates) now points to the product-specific dir.
There is still a javalib.jar in the $(intermediates.COMMON) dir, which is used as dependency.
Nothing is changed for host Java libraries.

Change-Id: I2546dbb940c74537864ca002d1acb49bb731fbbc
diff --git a/core/definitions.mk b/core/definitions.mk
index 26ed215..6f7d2a3 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -381,7 +381,7 @@
     $(if $(_idfName),, \
         $(error $(LOCAL_PATH): Name not defined in call to intermediates-dir-for)) \
     $(eval _idfPrefix := $(if $(strip $(3)),HOST,TARGET)) \
-    $(if $(filter $(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \
+    $(if $(filter $(_idfPrefix)-$(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \
         $(eval _idfIntBase := $($(_idfPrefix)_OUT_COMMON_INTERMEDIATES)) \
       , \
         $(eval _idfIntBase := $($(_idfPrefix)_OUT_INTERMEDIATES)) \