Don't add dependencies on uses-library modules in unbundled builds

Unbundled builds may not have definitions of shared libraries, and
they are not dexpreopted so the dependencies are not used anyways.

Test: manual
Change-Id: I89ad92f3b073422734f824ac3a8a3b9baf995ccb
diff --git a/java/app.go b/java/app.go
index cf9354f..78e0501 100644
--- a/java/app.go
+++ b/java/app.go
@@ -938,16 +938,18 @@
 }
 
 func (u *usesLibrary) deps(ctx android.BottomUpMutatorContext, noFrameworkLibs bool) {
-	ctx.AddVariationDependencies(nil, usesLibTag, u.usesLibraryProperties.Uses_libs...)
-	ctx.AddVariationDependencies(nil, usesLibTag, u.presentOptionalUsesLibs(ctx)...)
-	if !noFrameworkLibs {
-		// dexpreopt/dexpreopt.go needs the paths to the dex jars of these libraries in case construct_context.sh needs
-		// to pass them to dex2oat.  Add them as a dependency so we can determine the path to the dex jar of each
-		// library to dexpreopt.
-		ctx.AddVariationDependencies(nil, usesLibTag,
-			"org.apache.http.legacy",
-			"android.hidl.base-V1.0-java",
-			"android.hidl.manager-V1.0-java")
+	if !ctx.Config().UnbundledBuild() {
+		ctx.AddVariationDependencies(nil, usesLibTag, u.usesLibraryProperties.Uses_libs...)
+		ctx.AddVariationDependencies(nil, usesLibTag, u.presentOptionalUsesLibs(ctx)...)
+		if !noFrameworkLibs {
+			// dexpreopt/dexpreopt.go needs the paths to the dex jars of these libraries in case construct_context.sh needs
+			// to pass them to dex2oat.  Add them as a dependency so we can determine the path to the dex jar of each
+			// library to dexpreopt.
+			ctx.AddVariationDependencies(nil, usesLibTag,
+				"org.apache.http.legacy",
+				"android.hidl.base-V1.0-java",
+				"android.hidl.manager-V1.0-java")
+		}
 	}
 }