Collect aconfig files from *_libs in java_api_library

Aconfig files can be provided to java_api_library in two ways:
1. By specifying the aconfig_declarations module names in the
   aconfig_declarations property

2. By specifying the java_aconfig_library (or its static rdeps) module
   names in the libs/static_libs property

1. was behaving as expected for java_api_library, but 2. was not
behaving as expected and java_api_library is erroneously not collecting
the aconfig files from the libs/static_libs dependencies. This change
fixes such broken behavior.

Test: CI
Bug: 379807097
Change-Id: I1d6d1fa4eae32b4f28e68c88e4e67b2ff7ae7805
diff --git a/java/java.go b/java/java.go
index 64ef782..260d336 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2311,14 +2311,17 @@
 		case libTag:
 			if provider, ok := android.OtherModuleProvider(ctx, dep, JavaInfoProvider); ok {
 				classPaths = append(classPaths, provider.HeaderJars...)
+				al.aconfigProtoFiles = append(al.aconfigProtoFiles, provider.AconfigIntermediateCacheOutputPaths...)
 			}
 		case bootClasspathTag:
 			if provider, ok := android.OtherModuleProvider(ctx, dep, JavaInfoProvider); ok {
 				bootclassPaths = append(bootclassPaths, provider.HeaderJars...)
+				al.aconfigProtoFiles = append(al.aconfigProtoFiles, provider.AconfigIntermediateCacheOutputPaths...)
 			}
 		case staticLibTag:
 			if provider, ok := android.OtherModuleProvider(ctx, dep, JavaInfoProvider); ok {
 				staticLibs = append(staticLibs, provider.HeaderJars...)
+				al.aconfigProtoFiles = append(al.aconfigProtoFiles, provider.AconfigIntermediateCacheOutputPaths...)
 			}
 		case systemModulesTag:
 			if sm, ok := android.OtherModuleProvider(ctx, dep, SystemModulesProvider); ok {