Merge "Remove hashtree from builtin APEXes"
diff --git a/apex/apex.go b/apex/apex.go
index bb4b62e..806158a 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -984,6 +984,8 @@
 					}
 				} else if am.CanHaveApexVariants() && am.IsInstallableToApex() {
 					ctx.ModuleErrorf("unexpected tag %q for indirect dependency %q", depTag, depName)
+				} else if am.NoApex() && !android.InList(depName, whitelistNoApex[ctx.ModuleName()]) {
+					ctx.ModuleErrorf("tries to include no_apex module %s", depName)
 				}
 			}
 		}
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 387533c..0845b20 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -1851,6 +1851,36 @@
 		}
 	`)
 
+	testApexError(t, `tries to include no_apex module mylib2`, `
+		apex {
+			name: "commonapex",
+			key: "myapex.key",
+			native_shared_libs: ["mylib"],
+		}
+
+		apex_key {
+			name: "myapex.key",
+			public_key: "testkey.avbpubkey",
+			private_key: "testkey.pem",
+		}
+
+		cc_library {
+			name: "mylib",
+			srcs: ["mylib.cpp"],
+			static_libs: ["mylib2"],
+			system_shared_libs: [],
+			stl: "none",
+		}
+
+		cc_library {
+			name: "mylib2",
+			srcs: ["mylib.cpp"],
+			system_shared_libs: [],
+			stl: "none",
+			no_apex: true,
+		}
+	`)
+
 	ctx, _ := testApex(t, `
 		apex {
 			name: "myapex",
diff --git a/cc/stl.go b/cc/stl.go
index 5578299..458129c 100644
--- a/cc/stl.go
+++ b/cc/stl.go
@@ -207,8 +207,6 @@
 func (stl *stl) flags(ctx ModuleContext, flags Flags) Flags {
 	switch stl.Properties.SelectedStl {
 	case "libc++", "libc++_static":
-		flags.CFlags = append(flags.CFlags, "-D_USING_LIBCXX")
-
 		if ctx.Darwin() {
 			// libc++'s headers are annotated with availability macros that
 			// indicate which version of Mac OS was the first to ship with a
diff --git a/java/droiddoc.go b/java/droiddoc.go
index aaba285..8b15e0f 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -359,6 +359,8 @@
 	switch tag {
 	case "":
 		return android.Paths{j.stubsSrcJar}, nil
+	case ".docs.zip":
+		return android.Paths{j.docZip}, nil
 	default:
 		return nil, fmt.Errorf("unsupported module reference tag %q", tag)
 	}
diff --git a/ui/build/paths/config.go b/ui/build/paths/config.go
index a1d650a..738ef40 100644
--- a/ui/build/paths/config.go
+++ b/ui/build/paths/config.go
@@ -118,63 +118,19 @@
 	"ld.gold":    Forbidden,
 	"pkg-config": Forbidden,
 
-	// On Linux we'll use the toybox versions of these instead.
-	"basename": LinuxOnlyPrebuilt,
-	"cat":      LinuxOnlyPrebuilt,
-	"chmod":    LinuxOnlyPrebuilt,
-	"cmp":      LinuxOnlyPrebuilt,
-	"cp":       LinuxOnlyPrebuilt,
-	"comm":     LinuxOnlyPrebuilt,
-	"cut":      LinuxOnlyPrebuilt,
-	"date":     LinuxOnlyPrebuilt,
-	"dirname":  LinuxOnlyPrebuilt,
-	"du":       LinuxOnlyPrebuilt,
-	"echo":     LinuxOnlyPrebuilt,
-	"egrep":    LinuxOnlyPrebuilt,
-	"env":      LinuxOnlyPrebuilt,
-	"getconf":  LinuxOnlyPrebuilt,
-	"grep":     LinuxOnlyPrebuilt,
-	"head":     LinuxOnlyPrebuilt,
-	"hostname": LinuxOnlyPrebuilt,
-	"id":       LinuxOnlyPrebuilt,
-	"ln":       LinuxOnlyPrebuilt,
-	"ls":       LinuxOnlyPrebuilt,
-	"mkdir":    LinuxOnlyPrebuilt,
-	"mktemp":   LinuxOnlyPrebuilt,
-	"mv":       LinuxOnlyPrebuilt,
-	"od":       LinuxOnlyPrebuilt,
-	"paste":    LinuxOnlyPrebuilt,
-	"pgrep":    LinuxOnlyPrebuilt,
-	"pkill":    LinuxOnlyPrebuilt,
-	"ps":       LinuxOnlyPrebuilt,
-	"pwd":      LinuxOnlyPrebuilt,
-	"readlink": LinuxOnlyPrebuilt,
-	"rm":       LinuxOnlyPrebuilt,
-	"rmdir":    LinuxOnlyPrebuilt,
-	"sed":      LinuxOnlyPrebuilt,
-	"seq":      LinuxOnlyPrebuilt,
-	"setsid":   LinuxOnlyPrebuilt,
-	"sleep":    LinuxOnlyPrebuilt,
-	"sort":     LinuxOnlyPrebuilt,
-	"stat":     LinuxOnlyPrebuilt,
-	"tail":     LinuxOnlyPrebuilt,
-	"tar":      LinuxOnlyPrebuilt,
-	"tee":      LinuxOnlyPrebuilt,
-	"timeout":  LinuxOnlyPrebuilt,
-	"touch":    LinuxOnlyPrebuilt,
-	"true":     LinuxOnlyPrebuilt,
-	"uname":    LinuxOnlyPrebuilt,
-	"uniq":     LinuxOnlyPrebuilt,
-	"unix2dos": LinuxOnlyPrebuilt,
-	"wc":       LinuxOnlyPrebuilt,
-	"whoami":   LinuxOnlyPrebuilt,
-	"which":    LinuxOnlyPrebuilt,
-	"xargs":    LinuxOnlyPrebuilt,
-	"xxd":      LinuxOnlyPrebuilt,
+	// These are currently Linux-only toybox tools (but can be switched now).
+	"date": LinuxOnlyPrebuilt,
+	"stat": LinuxOnlyPrebuilt,
+
+	// These are toybox tools that only work on Linux.
+	"pgrep": LinuxOnlyPrebuilt,
+	"pkill": LinuxOnlyPrebuilt,
+	"ps":    LinuxOnlyPrebuilt,
 }
 
 func init() {
 	if runtime.GOOS == "darwin" {
+		// TODO: move Darwin off md5 and onto our md5sum prebuilt.
 		Configuration["md5"] = Allowed
 		Configuration["sw_vers"] = Allowed
 		Configuration["xcrun"] = Allowed