Revert "Revert "Build System: Solve dependency problem for test""

This reverts commit 6fe7f194b9ba0375aeee6f0d93f74f95a820084b.

Reason for revert: Fixed all build break.

Change-Id: I0a4842df1225399752515a4cd7a7c14173a5bf7b
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 9043710..3be4635 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -768,10 +768,17 @@
 
 ifdef LOCAL_COMPATIBILITY_SUITE
 
+ifndef ENABLE_DEFAULT_TEST_LOCATION
 $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
   $(eval my_compat_dist_$(suite) := $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
     $(foreach s,$(my_split_suffixes),\
       $(intermediates)/package_$(s).apk:$(dir)/$(LOCAL_MODULE)_$(s).apk))))
+else
+$(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
+  $(eval my_compat_dist_$(suite) := $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
+    $(foreach s,$(my_split_suffixes),\
+      $(call compat-copy-pair,$(intermediates)/package_$(s).apk,$(dir)/$(LOCAL_MODULE)_$(s).apk)))))
+endif
 
 $(call create-suite-dependencies)