Merge "Color long running durations when using action table output"
diff --git a/android/override_module.go b/android/override_module.go
index 5a57c93..22fb7de 100644
--- a/android/override_module.go
+++ b/android/override_module.go
@@ -95,8 +95,6 @@
 
 // Base module struct for overridable module types
 type OverridableModuleBase struct {
-	ModuleBase
-
 	// List of OverrideModules that override this base module
 	overrides []OverrideModule
 	// Used to parallelize registerOverrideMutator executions. Note that only addOverride locks this
@@ -144,7 +142,7 @@
 	// Adds the base module to the overrides property, if exists, of the overriding module. See the
 	// comment on OverridableModuleBase.overridesProperty for details.
 	if b.overridesProperty != nil {
-		*b.overridesProperty = append(*b.overridesProperty, b.Name())
+		*b.overridesProperty = append(*b.overridesProperty, ctx.ModuleName())
 	}
 	for _, p := range b.overridableProperties {
 		for _, op := range o.getOverridingProperties() {
diff --git a/apex/apex.go b/apex/apex.go
index 84e5497..ac0363b 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -153,7 +153,7 @@
 
 	android.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
 		ctx.TopDown("apex_deps", apexDepsMutator)
-		ctx.BottomUp("apex", apexMutator)
+		ctx.BottomUp("apex", apexMutator).Parallel()
 	})
 }
 
diff --git a/cc/cc.go b/cc/cc.go
index 53ec899..1100bac 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -65,7 +65,7 @@
 		ctx.TopDown("tsan_deps", sanitizerDepsMutator(tsan))
 		ctx.BottomUp("tsan", sanitizerMutator(tsan)).Parallel()
 
-		ctx.TopDown("sanitize_runtime_deps", sanitizerRuntimeDepsMutator)
+		ctx.TopDown("sanitize_runtime_deps", sanitizerRuntimeDepsMutator).Parallel()
 		ctx.BottomUp("sanitize_runtime", sanitizerRuntimeMutator).Parallel()
 
 		ctx.BottomUp("coverage", coverageMutator).Parallel()
diff --git a/cc/gen.go b/cc/gen.go
index 1d30dab..c9f45ee 100644
--- a/cc/gen.go
+++ b/cc/gen.go
@@ -25,6 +25,7 @@
 
 func init() {
 	pctx.SourcePathVariable("lexCmd", "prebuilts/build-tools/${config.HostPrebuiltTag}/bin/flex")
+	pctx.SourcePathVariable("m4Cmd", "prebuilts/build-tools/${config.HostPrebuiltTag}/bin/m4")
 
 	pctx.HostBinToolVariable("aidlCmd", "aidl-cpp")
 	pctx.HostBinToolVariable("syspropCmd", "sysprop_cpp")
@@ -33,8 +34,8 @@
 var (
 	lex = pctx.AndroidStaticRule("lex",
 		blueprint.RuleParams{
-			Command:     "$lexCmd -o$out $in",
-			CommandDeps: []string{"$lexCmd"},
+			Command:     "M4=$m4Cmd $lexCmd -o$out $in",
+			CommandDeps: []string{"$lexCmd", "$m4Cmd"},
 		})
 
 	sysprop = pctx.AndroidStaticRule("sysprop",
diff --git a/cc/makevars.go b/cc/makevars.go
index a71f479..78a32c8 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -161,6 +161,8 @@
 
 	ctx.Strict("AIDL_CPP", "${aidlCmd}")
 
+	ctx.Strict("M4", "${m4Cmd}")
+
 	ctx.Strict("RS_GLOBAL_INCLUDES", "${config.RsGlobalIncludes}")
 
 	ctx.Strict("SOONG_STRIP_PATH", "${stripPath}")
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 0af0659..0eb9a74 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -468,6 +468,10 @@
 		// TODO(b/131771163): LTO and Fuzzer support is mutually incompatible.
 		_, flags.LdFlags = removeFromList("-flto", flags.LdFlags)
 		flags.LdFlags = append(flags.LdFlags, "-fno-lto")
+
+		// TODO(b/133876586): Experimental PM breaks sanitizer coverage.
+		_, flags.CFlags = removeFromList("-fexperimental-new-pass-manager", flags.CFlags)
+		flags.CFlags = append(flags.CFlags, "-fno-experimental-new-pass-manager")
 	}
 
 	if Bool(sanitize.Properties.Sanitize.Cfi) {
@@ -701,8 +705,8 @@
 			if !isSanitizableDependencyTag(mctx.OtherModuleDependencyTag(child)) {
 				return false
 			}
-			if d, ok := child.(*Module); ok && d.static() && d.sanitize != nil {
 
+			if d, ok := child.(*Module); ok && d.static() && d.sanitize != nil {
 				if enableMinimalRuntime(d.sanitize) {
 					// If a static dependency is built with the minimal runtime,
 					// make sure we include the ubsan minimal runtime.
@@ -713,8 +717,17 @@
 					// make sure we include the ubsan runtime.
 					c.sanitize.Properties.UbsanRuntimeDep = true
 				}
+
+				if c.sanitize.Properties.MinimalRuntimeDep &&
+					c.sanitize.Properties.UbsanRuntimeDep {
+					// both flags that this mutator might set are true, so don't bother recursing
+					return false
+				}
+
+				return true
+			} else {
+				return false
 			}
-			return true
 		})
 	}
 }
diff --git a/cmd/soong_ui/main.go b/cmd/soong_ui/main.go
index b909779..b63918f 100644
--- a/cmd/soong_ui/main.go
+++ b/cmd/soong_ui/main.go
@@ -337,7 +337,7 @@
 	}{{
 		name:              "all-modules",
 		description:       "Build action: build from the top of the source tree.",
-		action:            build.BUILD_MODULES_IN_A_DIRECTORY,
+		action:            build.BUILD_MODULES,
 		buildDependencies: true,
 	}, {
 		name:              "modules-in-a-dir-no-deps",
diff --git a/finder/finder_test.go b/finder/finder_test.go
index 29711fc..f6d0aa9 100644
--- a/finder/finder_test.go
+++ b/finder/finder_test.go
@@ -891,8 +891,8 @@
 			IncludeFiles: []string{"findme.txt"},
 		},
 	)
-	foundPaths := finder.FindNamedAt("/tmp", "findme.txt")
 	filesystem.Clock.Tick()
+	foundPaths := finder.FindNamedAt("/tmp", "findme.txt")
 	finder.Shutdown()
 	// check the response of the first finder
 	assertSameResponse(t, foundPaths, []string{"/tmp/a/findme.txt"})
@@ -1522,8 +1522,8 @@
 			IncludeFiles: []string{"hi.txt"},
 		},
 	)
-	foundPaths := finder.FindAll()
 	filesystem.Clock.Tick()
+	foundPaths := finder.FindAll()
 	finder.Shutdown()
 	// check results
 	assertSameResponse(t, foundPaths, []string{"/tmp/a/hi.txt"})
@@ -1583,8 +1583,8 @@
 			IncludeFiles: []string{"hi.txt"},
 		},
 	)
-	foundPaths := finder.FindAll()
 	filesystem.Clock.Tick()
+	foundPaths := finder.FindAll()
 	finder.Shutdown()
 	allPaths := []string{"/tmp/hi.txt", "/tmp/a/hi.txt", "/tmp/a/a/hi.txt", "/tmp/b/hi.txt"}
 	// check results
@@ -1629,8 +1629,8 @@
 			IncludeFiles: []string{"hi.txt"},
 		},
 	)
-	foundPaths := finder.FindAll()
 	filesystem.Clock.Tick()
+	foundPaths := finder.FindAll()
 	finder.Shutdown()
 	// check results
 	assertSameResponse(t, foundPaths, []string{"/tmp/hi.txt"})
@@ -1650,8 +1650,8 @@
 			IncludeFiles: []string{"hi.txt"},
 		},
 	)
-	foundPaths := finder.FindAll()
 	filesystem.Clock.Tick()
+	foundPaths := finder.FindAll()
 	finder.Shutdown()
 	// check results
 	assertSameResponse(t, foundPaths, []string{"/tmp/a/hi.txt"})
diff --git a/java/aapt2.go b/java/aapt2.go
index a815160..ad746f7 100644
--- a/java/aapt2.go
+++ b/java/aapt2.go
@@ -60,7 +60,9 @@
 	},
 	"outDir", "cFlags")
 
-func aapt2Compile(ctx android.ModuleContext, dir android.Path, paths android.Paths) android.WritablePaths {
+func aapt2Compile(ctx android.ModuleContext, dir android.Path, paths android.Paths,
+	flags []string) android.WritablePaths {
+
 	shards := shardPaths(paths, AAPT2_SHARD_SIZE)
 
 	ret := make(android.WritablePaths, 0, len(paths))
@@ -81,9 +83,7 @@
 			Outputs:     outPaths,
 			Args: map[string]string{
 				"outDir": android.PathForModuleOut(ctx, "aapt2", dir.String()).String(),
-				// Always set --pseudo-localize, it will be stripped out later for release
-				// builds that don't want it.
-				"cFlags": "--pseudo-localize",
+				"cFlags": strings.Join(flags, " "),
 			},
 		})
 	}
@@ -104,7 +104,9 @@
 		},
 	}, "cFlags", "resZipDir", "zipSyncFlags")
 
-func aapt2CompileZip(ctx android.ModuleContext, flata android.WritablePath, zip android.Path, zipPrefix string) {
+func aapt2CompileZip(ctx android.ModuleContext, flata android.WritablePath, zip android.Path, zipPrefix string,
+	flags []string) {
+
 	if zipPrefix != "" {
 		zipPrefix = "--zip-prefix " + zipPrefix
 	}
@@ -114,9 +116,7 @@
 		Input:       zip,
 		Output:      flata,
 		Args: map[string]string{
-			// Always set --pseudo-localize, it will be stripped out later for release
-			// builds that don't want it.
-			"cFlags":       "--pseudo-localize",
+			"cFlags":       strings.Join(flags, " "),
 			"resZipDir":    android.PathForModuleOut(ctx, "aapt2", "reszip", flata.Base()).String(),
 			"zipSyncFlags": zipPrefix,
 		},
diff --git a/java/aar.go b/java/aar.go
index 47f6e5f..460fbfa6 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -111,8 +111,9 @@
 	return a.transitiveManifestPaths
 }
 
-func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext sdkContext, manifestPath android.Path) (flags []string,
-	deps android.Paths, resDirs, overlayDirs []globbedResourceDir, rroDirs []rroDir, resZips android.Paths) {
+func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext sdkContext,
+	manifestPath android.Path) (compileFlags, linkFlags []string, linkDeps android.Paths,
+	resDirs, overlayDirs []globbedResourceDir, rroDirs []rroDir, resZips android.Paths) {
 
 	hasVersionCode := false
 	hasVersionName := false
@@ -124,8 +125,6 @@
 		}
 	}
 
-	var linkFlags []string
-
 	// Flags specified in Android.bp
 	linkFlags = append(linkFlags, a.aaptProperties.Aaptflags...)
 
@@ -136,8 +135,6 @@
 	resourceDirs := android.PathsWithOptionalDefaultForModuleSrc(ctx, a.aaptProperties.Resource_dirs, "res")
 	resourceZips := android.PathsForModuleSrc(ctx, a.aaptProperties.Resource_zips)
 
-	var linkDeps android.Paths
-
 	// Glob directories into lists of paths
 	for _, dir := range resourceDirs {
 		resDirs = append(resDirs, globbedResourceDir{
@@ -185,7 +182,13 @@
 		linkFlags = append(linkFlags, "--version-name ", versionName)
 	}
 
-	return linkFlags, linkDeps, resDirs, overlayDirs, rroDirs, resourceZips
+	linkFlags, compileFlags = android.FilterList(linkFlags, []string{"--legacy"})
+
+	// Always set --pseudo-localize, it will be stripped out later for release
+	// builds that don't want it.
+	compileFlags = append(compileFlags, "--pseudo-localize")
+
+	return compileFlags, linkFlags, linkDeps, resDirs, overlayDirs, rroDirs, resourceZips
 }
 
 func (a *aapt) deps(ctx android.BottomUpMutatorContext, sdkDep sdkDep) {
@@ -220,7 +223,7 @@
 		a.mergedManifestFile = manifestPath
 	}
 
-	linkFlags, linkDeps, resDirs, overlayDirs, rroDirs, resZips := a.aapt2Flags(ctx, sdkContext, manifestPath)
+	compileFlags, linkFlags, linkDeps, resDirs, overlayDirs, rroDirs, resZips := a.aapt2Flags(ctx, sdkContext, manifestPath)
 
 	rroDirs = append(rroDirs, staticRRODirs...)
 	linkFlags = append(linkFlags, libFlags...)
@@ -239,12 +242,12 @@
 
 	var compiledResDirs []android.Paths
 	for _, dir := range resDirs {
-		compiledResDirs = append(compiledResDirs, aapt2Compile(ctx, dir.dir, dir.files).Paths())
+		compiledResDirs = append(compiledResDirs, aapt2Compile(ctx, dir.dir, dir.files, compileFlags).Paths())
 	}
 
 	for i, zip := range resZips {
 		flata := android.PathForModuleOut(ctx, fmt.Sprintf("reszip.%d.flata", i))
-		aapt2CompileZip(ctx, flata, zip, "")
+		aapt2CompileZip(ctx, flata, zip, "", compileFlags)
 		compiledResDirs = append(compiledResDirs, android.Paths{flata})
 	}
 
@@ -273,7 +276,7 @@
 	}
 
 	for _, dir := range overlayDirs {
-		compiledOverlay = append(compiledOverlay, aapt2Compile(ctx, dir.dir, dir.files).Paths()...)
+		compiledOverlay = append(compiledOverlay, aapt2Compile(ctx, dir.dir, dir.files, compileFlags).Paths()...)
 	}
 
 	var splitPackages android.WritablePaths
@@ -513,10 +516,6 @@
 	return a.sdkVersion()
 }
 
-func (a *AARImport) noFrameworkLibs() bool {
-	return false
-}
-
 var _ AndroidLibraryDependency = (*AARImport)(nil)
 
 func (a *AARImport) ExportPackage() android.Path {
@@ -598,9 +597,12 @@
 		},
 	})
 
+	// Always set --pseudo-localize, it will be stripped out later for release
+	// builds that don't want it.
+	compileFlags := []string{"--pseudo-localize"}
 	compiledResDir := android.PathForModuleOut(ctx, "flat-res")
 	flata := compiledResDir.Join(ctx, "gen_res.flata")
-	aapt2CompileZip(ctx, flata, aar, "res")
+	aapt2CompileZip(ctx, flata, aar, "res", compileFlags)
 
 	a.exportPackage = android.PathForModuleOut(ctx, "package-res.apk")
 	srcJar := android.PathForModuleGen(ctx, "R.jar")
diff --git a/java/app_test.go b/java/app_test.go
index 27802cd..459f377 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -546,79 +546,6 @@
 	}
 }
 
-func TestJNIABI_no_framework_libs_true(t *testing.T) {
-	ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
-		cc_library {
-			name: "libjni",
-			system_shared_libs: [],
-			stl: "none",
-		}
-
-		android_test {
-			name: "test",
-			no_framework_libs: true,
-			jni_libs: ["libjni"],
-		}
-
-		android_test {
-			name: "test_first",
-			no_framework_libs: true,
-			compile_multilib: "first",
-			jni_libs: ["libjni"],
-		}
-
-		android_test {
-			name: "test_both",
-			no_framework_libs: true,
-			compile_multilib: "both",
-			jni_libs: ["libjni"],
-		}
-
-		android_test {
-			name: "test_32",
-			no_framework_libs: true,
-			compile_multilib: "32",
-			jni_libs: ["libjni"],
-		}
-
-		android_test {
-			name: "test_64",
-			no_framework_libs: true,
-			compile_multilib: "64",
-			jni_libs: ["libjni"],
-		}
-		`)
-
-	testCases := []struct {
-		name string
-		abis []string
-	}{
-		{"test", []string{"arm64-v8a"}},
-		{"test_first", []string{"arm64-v8a"}},
-		{"test_both", []string{"arm64-v8a", "armeabi-v7a"}},
-		{"test_32", []string{"armeabi-v7a"}},
-		{"test_64", []string{"arm64-v8a"}},
-	}
-
-	for _, test := range testCases {
-		t.Run(test.name, func(t *testing.T) {
-			app := ctx.ModuleForTests(test.name, "android_common")
-			jniLibZip := app.Output("jnilibs.zip")
-			var abis []string
-			args := strings.Fields(jniLibZip.Args["jarArgs"])
-			for i := 0; i < len(args); i++ {
-				if args[i] == "-P" {
-					abis = append(abis, filepath.Base(args[i+1]))
-					i++
-				}
-			}
-			if !reflect.DeepEqual(abis, test.abis) {
-				t.Errorf("want abis %v, got %v", test.abis, abis)
-			}
-		})
-	}
-}
-
 func TestJNIABI(t *testing.T) {
 	ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
 		cc_library {
@@ -692,89 +619,6 @@
 	}
 }
 
-func TestJNIPackaging_no_framework_libs_true(t *testing.T) {
-	ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
-		cc_library {
-			name: "libjni",
-			system_shared_libs: [],
-			stl: "none",
-		}
-
-		android_app {
-			name: "app",
-			jni_libs: ["libjni"],
-		}
-
-		android_app {
-			name: "app_noembed",
-			jni_libs: ["libjni"],
-			use_embedded_native_libs: false,
-		}
-
-		android_app {
-			name: "app_embed",
-			jni_libs: ["libjni"],
-			use_embedded_native_libs: true,
-		}
-
-		android_test {
-			name: "test",
-			no_framework_libs: true,
-			jni_libs: ["libjni"],
-		}
-
-		android_test {
-			name: "test_noembed",
-			no_framework_libs: true,
-			jni_libs: ["libjni"],
-			use_embedded_native_libs: false,
-		}
-
-		android_test_helper_app {
-			name: "test_helper",
-			no_framework_libs: true,
-			jni_libs: ["libjni"],
-		}
-
-		android_test_helper_app {
-			name: "test_helper_noembed",
-			no_framework_libs: true,
-			jni_libs: ["libjni"],
-			use_embedded_native_libs: false,
-		}
-		`)
-
-	testCases := []struct {
-		name       string
-		packaged   bool
-		compressed bool
-	}{
-		{"app", false, false},
-		{"app_noembed", false, false},
-		{"app_embed", true, false},
-		{"test", true, false},
-		{"test_noembed", true, true},
-		{"test_helper", true, false},
-		{"test_helper_noembed", true, true},
-	}
-
-	for _, test := range testCases {
-		t.Run(test.name, func(t *testing.T) {
-			app := ctx.ModuleForTests(test.name, "android_common")
-			jniLibZip := app.MaybeOutput("jnilibs.zip")
-			if g, w := (jniLibZip.Rule != nil), test.packaged; g != w {
-				t.Errorf("expected jni packaged %v, got %v", w, g)
-			}
-
-			if jniLibZip.Rule != nil {
-				if g, w := !strings.Contains(jniLibZip.Args["jarArgs"], "-L 0"), test.compressed; g != w {
-					t.Errorf("expected jni compressed %v, got %v", w, g)
-				}
-			}
-		})
-	}
-}
-
 func TestJNIPackaging(t *testing.T) {
 	ctx := testJava(t, cc.GatherRequiredDepsForTest(android.Android)+`
 		cc_library {
diff --git a/java/device_host_converter_test.go b/java/device_host_converter_test.go
index 146bf6f..9b9d0d8 100644
--- a/java/device_host_converter_test.go
+++ b/java/device_host_converter_test.go
@@ -126,7 +126,7 @@
 
 		java_library {
 			name: "device_module",
-			no_framework_libs: true,
+			sdk_version: "core_platform",
 			srcs: ["b.java"],
 			java_resources: ["java-res/b/b"],
 			static_libs: ["host_for_device_module"],
diff --git a/java/droiddoc.go b/java/droiddoc.go
index be1b281..734b411 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -171,9 +171,6 @@
 	// list of java libraries that will be in the classpath.
 	Libs []string `android:"arch_variant"`
 
-	// don't build against the framework libraries (ext, and framework for device targets)
-	No_framework_libs *bool
-
 	// the java library (in classpath) for documentation that provides java srcs and srcjars.
 	Srcs_lib *string
 
@@ -534,10 +531,6 @@
 	return j.sdkVersion()
 }
 
-func (j *Javadoc) noFrameworkLibs() bool {
-	return Bool(j.properties.No_framework_libs)
-}
-
 func (j *Javadoc) addDeps(ctx android.BottomUpMutatorContext) {
 	if ctx.Device() {
 		sdkDep := decodeSdkDep(ctx, sdkContext(j))
diff --git a/java/java.go b/java/java.go
index a2e9ab0..bf80ced 100644
--- a/java/java.go
+++ b/java/java.go
@@ -82,9 +82,6 @@
 	// list of files that should be excluded from java_resources and java_resource_dirs
 	Exclude_java_resources []string `android:"path,arch_variant"`
 
-	// don't build against the framework libraries (ext, and framework for device targets)
-	No_framework_libs *bool
-
 	// list of module-specific flags that will be used for javac compiles
 	Javacflags []string `android:"arch_variant"`
 
@@ -482,10 +479,6 @@
 	return j.sdkVersion()
 }
 
-func (j *Module) noFrameworkLibs() bool {
-	return Bool(j.properties.No_framework_libs)
-}
-
 func (j *Module) deps(ctx android.BottomUpMutatorContext) {
 	if ctx.Device() {
 		sdkDep := decodeSdkDep(ctx, sdkContext(j))
@@ -506,7 +499,7 @@
 			}
 		} else if j.deviceProperties.System_modules == nil {
 			ctx.PropertyErrorf("sdk_version",
-				`system_modules is required to be set when sdk_version is "none", did you mean no_framework_libs?`)
+				`system_modules is required to be set when sdk_version is "none", did you mean "core_platform"`)
 		} else if *j.deviceProperties.System_modules != "none" {
 			ctx.AddVariationDependencies(nil, systemModulesTag, *j.deviceProperties.System_modules)
 		}
diff --git a/java/sdk.go b/java/sdk.go
index 6ffe399..1682a10 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -44,9 +44,6 @@
 	minSdkVersion() string
 	// targetSdkVersion returns the target_sdk_version property of the current module, or sdkVersion() if it is not set.
 	targetSdkVersion() string
-
-	// Temporarily provide access to the no_frameworks_libs property (where present).
-	noFrameworkLibs() bool
 }
 
 func sdkVersionOrDefault(ctx android.BaseModuleContext, v string) string {
@@ -84,6 +81,7 @@
 
 func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep {
 	v := sdkContext.sdkVersion()
+
 	// For PDK builds, use the latest SDK version instead of "current"
 	if ctx.Config().IsPdkBuild() && (v == "" || v == "current") {
 		sdkVersions := ctx.Config().Get(sdkVersionsKey).([]int)
@@ -141,9 +139,6 @@
 			useFiles: true,
 			jars:     android.Paths{jarPath.Path(), lambdaStubsPath},
 			aidl:     android.OptionalPathForPath(aidlPath.Path()),
-
-			// Pass value straight through for now to match previous behavior.
-			noFrameworksLibs: sdkContext.noFrameworkLibs(),
 		}
 	}
 
@@ -154,9 +149,6 @@
 			systemModules:      m + "_system_modules",
 			frameworkResModule: r,
 			aidl:               android.OptionalPathForPath(aidl),
-
-			// Pass value straight through for now to match previous behavior.
-			noFrameworksLibs: sdkContext.noFrameworkLibs(),
 		}
 
 		if m == "core.current.stubs" {
@@ -192,9 +184,6 @@
 		return sdkDep{
 			useDefaultLibs:     true,
 			frameworkResModule: "framework-res",
-
-			// Pass value straight through for now to match previous behavior.
-			noFrameworksLibs: sdkContext.noFrameworkLibs(),
 		}
 	case "none":
 		return sdkDep{
diff --git a/java/sdk_test.go b/java/sdk_test.go
index 953c372..f82a4fb 100644
--- a/java/sdk_test.go
+++ b/java/sdk_test.go
@@ -47,14 +47,6 @@
 			aidl:          "-Iframework/aidl",
 		},
 		{
-			name:          "no_framework_libs:true",
-			properties:    `no_framework_libs:true`,
-			bootclasspath: config.DefaultBootclasspathLibraries,
-			system:        config.DefaultSystemModules,
-			classpath:     []string{},
-			aidl:          "",
-		},
-		{
 			name:          `sdk_version:"core_platform"`,
 			properties:    `sdk_version:"core_platform"`,
 			bootclasspath: config.DefaultBootclasspathLibraries,
diff --git a/java/system_modules.go b/java/system_modules.go
index f71f452..c616249 100644
--- a/java/system_modules.go
+++ b/java/system_modules.go
@@ -138,7 +138,7 @@
 			fmt.Fprintln(w, makevar, ":=$=", strings.Join(system.properties.Libs, " "))
 			fmt.Fprintln(w)
 
-			makevar = "SOONG_SYSTEM_MODULE_DEPS_" + name
+			makevar = "SOONG_SYSTEM_MODULES_DEPS_" + name
 			fmt.Fprintln(w, makevar, ":=$=", strings.Join(system.outputDeps.Strings(), " "))
 			fmt.Fprintln(w)
 
diff --git a/ui/build/config.go b/ui/build/config.go
index 6df9529..4a70f06 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -71,6 +71,9 @@
 	// Builds all of the modules and their dependencies of a list of specified directories. All specified
 	// directories are relative to the root directory of the source tree.
 	BUILD_MODULES_IN_DIRECTORIES
+
+	// Build a list of specified modules. If none was specified, simply build the whole source tree.
+	BUILD_MODULES
 )
 
 // checkTopDir validates that the current directory is at the root directory of the source tree.
@@ -290,6 +293,8 @@
 	var targets []string
 
 	switch action {
+	case BUILD_MODULES:
+		// No additional processing is required when building a list of specific modules or all modules.
 	case BUILD_MODULES_IN_A_DIRECTORY:
 		// If dir is the root source tree, all the modules are built of the source tree are built so
 		// no need to find the build file.
diff --git a/ui/build/config_test.go b/ui/build/config_test.go
index 1ef5456..856af11 100644
--- a/ui/build/config_test.go
+++ b/ui/build/config_test.go
@@ -763,6 +763,51 @@
 	}
 }
 
+func TestGetConfigArgsBuildModules(t *testing.T) {
+	tests := []buildActionTestCase{{
+		description:     "normal execution from the root source tree directory",
+		dirsInTrees:     []string{"0/1/2", "0/2", "0/3"},
+		buildFiles:      []string{"0/1/2/Android.mk", "0/2/Android.bp", "0/3/Android.mk"},
+		args:            []string{"-j", "fake_module", "fake_module2"},
+		curDir:          ".",
+		tidyOnly:        "",
+		expectedArgs:    []string{"-j", "fake_module", "fake_module2"},
+		expectedEnvVars: []envVar{},
+	}, {
+		description:     "normal execution in deep directory",
+		dirsInTrees:     []string{"0/1/2", "0/2", "0/3", "1/2/3/4/5/6/7/8/9/1/2/3/4/5/6"},
+		buildFiles:      []string{"0/1/2/Android.mk", "0/2/Android.bp", "1/2/3/4/5/6/7/8/9/1/2/3/4/5/6/Android.mk"},
+		args:            []string{"-j", "fake_module", "fake_module2", "-k"},
+		curDir:          "1/2/3/4/5/6/7/8/9",
+		tidyOnly:        "",
+		expectedArgs:    []string{"-j", "fake_module", "fake_module2", "-k"},
+		expectedEnvVars: []envVar{},
+	}, {
+		description:     "normal execution in deep directory, no targets",
+		dirsInTrees:     []string{"0/1/2", "0/2", "0/3", "1/2/3/4/5/6/7/8/9/1/2/3/4/5/6"},
+		buildFiles:      []string{"0/1/2/Android.mk", "0/2/Android.bp", "1/2/3/4/5/6/7/8/9/1/2/3/4/5/6/Android.mk"},
+		args:            []string{"-j", "-k"},
+		curDir:          "1/2/3/4/5/6/7/8/9",
+		tidyOnly:        "",
+		expectedArgs:    []string{"-j", "-k"},
+		expectedEnvVars: []envVar{},
+	}, {
+		description:     "normal execution in root source tree, no args",
+		dirsInTrees:     []string{"0/1/2", "0/2", "0/3"},
+		buildFiles:      []string{"0/1/2/Android.mk", "0/2/Android.bp"},
+		args:            []string{},
+		curDir:          "1/2/3/4/5/6/7/8/9",
+		tidyOnly:        "",
+		expectedArgs:    []string{},
+		expectedEnvVars: []envVar{},
+	}}
+	for _, tt := range tests {
+		t.Run("build action BUILD_MODULES with dependencies, "+tt.description, func(t *testing.T) {
+			testGetConfigArgs(t, tt, BUILD_MODULES, true)
+		})
+	}
+}
+
 // TODO: Remove this test case once mm shell build command has been deprecated.
 func TestGetConfigArgsBuildModulesInDirecotoryNoDeps(t *testing.T) {
 	tests := []buildActionTestCase{{
diff --git a/ui/build/paths/config.go b/ui/build/paths/config.go
index c9946e2..d521c7e 100644
--- a/ui/build/paths/config.go
+++ b/ui/build/paths/config.go
@@ -88,13 +88,14 @@
 	"getopt":   Allowed,
 	"git":      Allowed,
 	"grep":     Allowed,
+	"gzcat":    Allowed,
 	"gzip":     Allowed,
 	"hexdump":  Allowed,
 	"jar":      Allowed,
 	"java":     Allowed,
 	"javap":    Allowed,
 	"lsof":     Allowed,
-	"m4":       Allowed,
+	"m4":       Log,
 	"openssl":  Allowed,
 	"patch":    Allowed,
 	"pstree":   Allowed,
@@ -102,7 +103,6 @@
 	"realpath": Allowed,
 	"rsync":    Allowed,
 	"sh":       Allowed,
-	"tar":      Allowed,
 	"tr":       Allowed,
 	"unzip":    Allowed,
 	"zip":      Allowed,
@@ -164,6 +164,7 @@
 	"sort":      LinuxOnlyPrebuilt,
 	"stat":      LinuxOnlyPrebuilt,
 	"tail":      LinuxOnlyPrebuilt,
+	"tar":       LinuxOnlyPrebuilt,
 	"tee":       LinuxOnlyPrebuilt,
 	"timeout":   LinuxOnlyPrebuilt,
 	"touch":     LinuxOnlyPrebuilt,