Add LOCAL_PROVIDES_USES_LIBRARY and use it in module dexpreopt config.

The new variable stores the name of the <uses-library>, if for some
reason it is different than the name of the module for that library
(normally they are the same, but sometimes differ). If the variable is
undefined or defined to an empty string, the name of the <uses-library>
is considered to be the same as the name of its module. It is recorded
in a module's dexpreopt.config file as "ProvidesUsesLibrary" field.

Bug: 132357300
Test: lunch aosp_cf_x86_phone-userdebug && m
Change-Id: Iac1be0fac79a944e4c26867cc58e274b76709da8
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 5f16363..5effac7 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -243,6 +243,7 @@
 # lite(default),micro,nano,stream,full,nanopb-c,nanopb-c-enable_malloc,nanopb-c-16bit,nanopb-c-enable_malloc-16bit,nanopb-c-32bit,nanopb-c-enable_malloc-32bit
 LOCAL_PROTOC_OPTIMIZE_TYPE:=
 LOCAL_PROTO_JAVA_OUTPUT_PARAMS:=
+LOCAL_PROVIDES_USES_LIBRARY:=
 LOCAL_R8_FLAG_FILES:=
 LOCAL_RECORDED_MODULE_TYPE:=
 LOCAL_RENDERSCRIPT_CC:=
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index cdd96f6..b74e047 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -253,6 +253,7 @@
   $(call add_json_str,  ProfileClassListing,            $(if $(my_process_profile),$(LOCAL_DEX_PREOPT_PROFILE)))
   $(call add_json_bool, ProfileIsTextListing,           $(my_profile_is_text_listing))
   $(call add_json_bool, EnforceUsesLibraries,           $(LOCAL_ENFORCE_USES_LIBRARIES))
+  $(call add_json_str,  ProvidesUsesLibrary,            $(firstword $(LOCAL_PROVIDES_USES_LIBRARY) $(LOCAL_MODULE)))
   $(call add_json_map,  ClassLoaderContexts)
   $(call add_json_class_loader_context, any, $(my_dexpreopt_libs))
   $(call add_json_class_loader_context,  28, $(my_dexpreopt_libs_compat_28))