Update java_api_library in testing modules

The full api surface java_api_library modules are currently defined as
java_library modules instead of java_api_library modules. This change
corrects this and modifies the DepsInfo of java_api_library so that it
can be compatible in tests.

Test: go ./java
Change-Id: I540b5a930f506ce5f7663ab6e07c6df49af15cf9
diff --git a/java/java.go b/java/java.go
index 97d5514..c97f427 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1612,7 +1612,7 @@
 }
 
 type JavaApiLibraryDepsInfo struct {
-	StubsJar    android.Path
+	JavaInfo
 	StubsSrcJar android.Path
 }
 
@@ -1821,7 +1821,7 @@
 			staticLibs = append(staticLibs, provider.HeaderJars...)
 		case depApiSrcsTag:
 			provider := ctx.OtherModuleProvider(dep, JavaApiLibraryDepsProvider).(JavaApiLibraryDepsInfo)
-			classPaths = append(classPaths, provider.StubsJar)
+			classPaths = append(classPaths, provider.HeaderJars...)
 			depApiSrcsStubsSrcJar = provider.StubsSrcJar
 		}
 	})
@@ -1900,7 +1900,9 @@
 	})
 
 	ctx.SetProvider(JavaApiLibraryDepsProvider, JavaApiLibraryDepsInfo{
-		StubsJar:    al.stubsJar,
+		JavaInfo: JavaInfo{
+			HeaderJars: android.PathsIfNonNil(al.stubsJar),
+		},
 		StubsSrcJar: al.stubsSrcJar,
 	})
 }
diff --git a/java/testing.go b/java/testing.go
index 8a0db9c..0764d26 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -368,14 +368,6 @@
 		"core.current.stubs",
 		"legacy.core.platform.api.stubs",
 		"stable.core.platform.api.stubs",
-		"android_stubs_current.from-text",
-		"android_system_stubs_current.from-text",
-		"android_test_stubs_current.from-text",
-		"android_module_lib_stubs_current.from-text",
-		"android_system_server_stubs_current.from-text",
-		"core.current.stubs.from-text",
-		"legacy.core.platform.api.stubs.from-text",
-		"stable.core.platform.api.stubs.from-text",
 
 		"kotlin-stdlib",
 		"kotlin-stdlib-jdk7",
@@ -396,6 +388,27 @@
 		`, extra)
 	}
 
+	extraApiLibraryModules := map[string]string{
+		"android_stubs_current.from-text":               "api/current.txt",
+		"android_system_stubs_current.from-text":        "api/system-current.txt",
+		"android_test_stubs_current.from-text":          "api/test-current.txt",
+		"android_module_lib_stubs_current.from-text":    "api/module-lib-current.txt",
+		"android_system_server_stubs_current.from-text": "api/system-server-current.txt",
+		"core.current.stubs.from-text":                  "api/current.txt",
+		"legacy.core.platform.api.stubs.from-text":      "api/current.txt",
+		"stable.core.platform.api.stubs.from-text":      "api/current.txt",
+		"core-lambda-stubs.from-text":                   "api/current.txt",
+	}
+
+	for libName, apiFile := range extraApiLibraryModules {
+		bp += fmt.Sprintf(`
+            java_api_library {
+                name: "%s",
+                api_files: ["%s"],
+            }
+        `, libName, apiFile)
+	}
+
 	bp += `
 		java_library {
 			name: "framework",