Fix proto flags in java

Compute the common proto flags and pass them to the protoc invocation
when generating java files.

Test: m checkbuild
Change-Id: I0d4c23ad001d01eab03b404545383f009214106d
diff --git a/java/proto.go b/java/proto.go
index 1077fd6..eeb5124 100644
--- a/java/proto.go
+++ b/java/proto.go
@@ -15,6 +15,8 @@
 package java
 
 import (
+	"strings"
+
 	"github.com/google/blueprint"
 	"github.com/google/blueprint/proptools"
 
@@ -39,7 +41,7 @@
 )
 
 func genProto(ctx android.ModuleContext, outputSrcJar android.WritablePath,
-	protoFiles android.Paths, protoFlags string, protoOut, protoOutFlags string) {
+	protoFiles android.Paths, protoFlags []string, protoOut, protoOutFlags string) {
 
 	ctx.Build(pctx, android.BuildParams{
 		Rule:        proto,
@@ -50,7 +52,7 @@
 			"outDir":        android.ProtoDir(ctx).String(),
 			"protoOut":      protoOut,
 			"protoOutFlags": protoOutFlags,
-			"protoFlags":    protoFlags,
+			"protoFlags":    strings.Join(protoFlags, " "),
 		},
 	})
 }
@@ -93,5 +95,8 @@
 		ctx.PropertyErrorf("proto.type", "unknown proto type %q",
 			proptools.String(p.Proto.Type))
 	}
+
+	flags.protoFlags = android.ProtoFlags(ctx, p)
+
 	return flags
 }