Avoid path conflicts for the notice files
Path conflicts could happen when following conditions are met.
1) a java library named "foo" is not installable.
2) a java library named "bar" is installable, and its stem is set to
"foo".
Then the notice file for 1) becomes foo.jar.txt following its
LOCAL_MODULE, while the notice file for 2) becomes foo.jar.txt following
its stem. Since the file for 1) is a synthetic one, the actual name
isn't important. Avoid the conflict by appending a suffix
(_non_installable, but could be anything) to the file name for 1).
There still is a chance for the conflict; if the stem for "bar" is set
to "foo_non_installable". But practically, the chances are very low.
Bug: 139391334
Bug: 143700028
Test: m
Change-Id: Id50b30774bbf65cc180baf963a95ea56fe6eb74f
diff --git a/core/notice_files.mk b/core/notice_files.mk
index 680a0b1..9df1c11 100644
--- a/core/notice_files.mk
+++ b/core/notice_files.mk
@@ -71,8 +71,11 @@
# javalib.jar is the default name for the build module (and isn't meaningful)
# If that's what we have, substitute the module name instead. These files
# aren't included on the device, so this name is synthetic anyway.
+ # Extra path "static" is added to try to avoid name conflict between the notice file of
+ # this 'uninstallable' Java module and the notice file for another 'installable' Java module
+ # whose stem is the same as this module's name.
ifneq ($(filter javalib.jar,$(module_leaf)),)
- module_leaf := $(LOCAL_MODULE).jar
+ module_leaf := static/$(LOCAL_MODULE).jar
endif
module_installed_filename := \
$(patsubst $(PRODUCT_OUT)/%,%,$($(my_prefix)OUT_JAVA_LIBRARIES))/$(module_leaf)