Reverse merge order of resources and implementation

Merge the resources first in case one of the static libraries
merge into the implementation jars contains a duplicate resource.
Also put the manifest into the resource jar so that the default
manifest doens't override the custom manifest.

Test: m checkbuild
Change-Id: I96d117c306bc9f1346720251d3993031992cef66
diff --git a/java/java.go b/java/java.go
index 6168b38..47dd957 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1253,9 +1253,9 @@
 	// merge implementation jar with resources if necessary
 	implementationAndResourcesJar := outputFile
 	if j.resourceJar != nil {
-		jars := android.Paths{implementationAndResourcesJar, j.resourceJar}
+		jars := android.Paths{j.resourceJar, implementationAndResourcesJar}
 		combinedJar := android.PathForModuleOut(ctx, "withres", jarName)
-		TransformJarsToJar(ctx, combinedJar, "for resources", jars, android.OptionalPath{},
+		TransformJarsToJar(ctx, combinedJar, "for resources", jars, manifest,
 			false, nil, nil)
 		implementationAndResourcesJar = combinedJar
 	}