Fix some issues with LOCAL_USES_LIBRARIES
Properly check the value of PRIVATE_ENFORCE_USES_LIBRARIES instead of
only checking that the variable is non-empty.
Change the logic to use product libraries instead of the common ones.
This is required so that dex2oat can find the oat files when stripping
is enabled.
Bug: 70934104
Bug: 67345922
Test: manual
Change-Id: Iee71c2b26f3c0e136a8971ab913725b2b6e100b8
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 45ec6ee..5495f62 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -175,7 +175,7 @@
stored_class_loader_context_arg="" && \
uses_library_names="$(PRIVATE_USES_LIBRARY_NAMES)" && \
optional_uses_library_names="$(PRIVATE_OPTIONAL_USES_LIBRARY_NAMES)" && \
-$(if $(PRIVATE_ENFORCE_USES_LIBRARIES), \
+$(if $(filter true,$(PRIVATE_ENFORCE_USES_LIBRARIES)), \
source build/make/core/verify_uses_libraries.sh "$(1)" && \
source build/make/core/construct_context.sh "$(PRIVATE_CONDITIONAL_USES_LIBRARIES_HOST)" "$(PRIVATE_CONDITIONAL_USES_LIBRARIES_TARGET)" && \
,) \
diff --git a/core/setup_one_odex.mk b/core/setup_one_odex.mk
index 51df43e..5cc6085 100644
--- a/core/setup_one_odex.mk
+++ b/core/setup_one_odex.mk
@@ -70,7 +70,7 @@
# Calculate system build dependencies based on the filtered libraries.
my_intermediate_libs := $(foreach lib_name, $(my_lib_names) $(my_filtered_optional_uses_libraries), \
- $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib_name),,COMMON)/javalib.jar)
+ $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib_name),,)/javalib.jar)
my_dex_preopt_system_dependencies := $(my_intermediate_libs)
my_dex_preopt_class_loader_context := $(call normalize-path-list,$(my_intermediate_libs))
@@ -82,7 +82,7 @@
my_lib_names := $(patsubst org.apache.http.legacy.boot,org.apache.http.legacy,$(my_lib_names))
my_optional_lib_names := $(patsubst org.apache.http.legacy.boot,org.apache.http.legacy,$(my_optional_lib_names))
ifeq (,$(filter org.apache.http.legacy,$(my_lib_names) $(my_optional_lib_names)))
- my_conditional_uses_libraries_host := $(call intermediates-dir-for,JAVA_LIBRARIES,org.apache.http.legacy.boot,,COMMON)/javalib.jar
+ my_conditional_uses_libraries_host := $(call intermediates-dir-for,JAVA_LIBRARIES,org.apache.http.legacy.boot,,)/javalib.jar
my_conditional_uses_libraries_target := /system/framework/org.apache.http.legacy.boot.jar
endif
endif