Output Javadoc comments for public API

When generating stubs source for contributions to the public API keep
the Javadoc comments from the input source so that the stubs source can
be used as input to the metalava invocation that creates the stubs from
which the public Javadoc is generated.

This is needed to fix an issue with conscrypt's contributions to the
public API, i.e. SSLEngines and SSLSockets where the Javadoc comments
were not present in the generated Javadoc.

Test: Built offline-sdk-docs with and without the change and
      diffed them. The only difference was the timestamp.js
      file and they now included proper documentation for the
      SSLEngines/SSLSockets classes.
Bug: 169162018
Change-Id: I1b50cff3b91766ce261b2f8e798b77ebc6faac70
diff --git a/java/sdk_library.go b/java/sdk_library.go
index a7b92b3..0d29a37 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1203,6 +1203,7 @@
 		Sdk_version                      *string
 		System_modules                   *string
 		Libs                             []string
+		Output_javadoc_comments          *bool
 		Arg_files                        []string
 		Args                             *string
 		Java_version                     *string
@@ -1278,6 +1279,11 @@
 	}
 	droidstubsArgs = append(droidstubsArgs, android.JoinWithPrefix(disabledWarnings, "--hide "))
 
+	// Output Javadoc comments for public scope.
+	if apiScope == apiScopePublic {
+		props.Output_javadoc_comments = proptools.BoolPtr(true)
+	}
+
 	// Add in scope specific arguments.
 	droidstubsArgs = append(droidstubsArgs, scopeSpecificDroidstubsArgs...)
 	props.Arg_files = module.sdkLibraryProperties.Droiddoc_option_files