Merge "Add stoney ridge x86 variant" am: cd2e52870a am: 5473e3fbdf
am: c8351c6af8

Change-Id: I83644aba3f3657bf630b9330f6d30ab1ff3466e1
diff --git a/Android.bp b/Android.bp
index c0a1aeb..9ad1247 100644
--- a/Android.bp
+++ b/Android.bp
@@ -517,6 +517,7 @@
 kernel_headers {
     name: "device_kernel_headers",
     vendor: true,
+    recovery_available: true,
 }
 
 cc_genrule {
diff --git a/android/neverallow.go b/android/neverallow.go
index f63f461..1983f0e 100644
--- a/android/neverallow.go
+++ b/android/neverallow.go
@@ -51,6 +51,7 @@
 	rules := []*rule{}
 	rules = append(rules, createTrebleRules()...)
 	rules = append(rules, createLibcoreRules()...)
+	rules = append(rules, createMediaRules()...)
 	rules = append(rules, createJavaDeviceForHostRules()...)
 	return rules
 }
@@ -126,6 +127,14 @@
 	return rules
 }
 
+func createMediaRules() []*rule {
+	return []*rule{
+		neverallow().
+			with("libs", "updatable-media").
+			because("updatable-media includes private APIs. Use updatable_media_stubs instead."),
+	}
+}
+
 func createJavaDeviceForHostRules() []*rule {
 	javaDeviceForHostProjectsWhitelist := []string{
 		"external/robolectric-shadows",
diff --git a/android/neverallow_test.go b/android/neverallow_test.go
index d55ca57..5451620 100644
--- a/android/neverallow_test.go
+++ b/android/neverallow_test.go
@@ -149,6 +149,17 @@
 		expectedError: "Only core libraries projects can depend on core-libart",
 	},
 	{
+		name: "dependency on updatable-media",
+		fs: map[string][]byte{
+			"Blueprints": []byte(`
+				java_library {
+					name: "needs_updatable_media",
+					libs: ["updatable-media"],
+				}`),
+		},
+		expectedError: "updatable-media includes private APIs. Use updatable_media_stubs instead.",
+	},
+	{
 		name: "java_device_for_host",
 		fs: map[string][]byte{
 			"Blueprints": []byte(`
diff --git a/cc/config/clang.go b/cc/config/clang.go
index 4ec787f..bfa7873 100644
--- a/cc/config/clang.go
+++ b/cc/config/clang.go
@@ -97,9 +97,8 @@
 	pctx.StaticVariable("ClangExtraCflags", strings.Join([]string{
 		"-D__compiler_offsetof=__builtin_offsetof",
 
-		// Make implicit fallthrough an error in the future.
+		// -Wimplicit-fallthrough is not enabled by -Wall.
 		"-Wimplicit-fallthrough",
-		"-Wno-error=implicit-fallthrough",
 
 		// Help catch common 32/64-bit errors.
 		"-Werror=int-conversion",
@@ -164,11 +163,6 @@
 		"-Wno-tautological-unsigned-enum-zero-compare",
 		"-Wno-tautological-unsigned-zero-compare",
 
-		// http://b/72330874 Disable -Wenum-compare until the instances detected by this new
-		// warning are fixed.
-		"-Wno-enum-compare",
-		"-Wno-enum-compare-switch",
-
 		// Disable c++98-specific warning since Android is not concerned with C++98
 		// compatibility.
 		"-Wno-c++98-compat-extra-semi",
@@ -177,9 +171,11 @@
 		"-Wno-return-std-move-in-c++11",
 	}, " "))
 
-	// Extra cflags for projects under external/ directory
+	// Extra cflags for projects under external/ directory to disable warnings that are infeasible
+	// to fix in all the external projects and their upstream repos.
 	pctx.StaticVariable("ClangExtraExternalCflags", strings.Join([]string{
-		// TODO(yikong): Move -Wno flags here
+		"-Wno-enum-compare",
+		"-Wno-enum-compare-switch",
 
 		// http://b/72331524 Allow null pointer arithmetic until the instances detected by
 		// this new warning are fixed.
diff --git a/cmd/soong_ui/main.go b/cmd/soong_ui/main.go
index d6999c5..9f40e33 100644
--- a/cmd/soong_ui/main.go
+++ b/cmd/soong_ui/main.go
@@ -132,6 +132,11 @@
 		}
 	}
 
+	// Fix up the source tree due to a repo bug where it doesn't remove
+	// linkfiles that have been removed
+	fixBadDanglingLink(buildCtx, "hardware/qcom/sdm710/Android.bp")
+	fixBadDanglingLink(buildCtx, "hardware/qcom/sdm710/Android.mk")
+
 	f := build.NewSourceFinder(buildCtx, config)
 	defer f.Shutdown()
 	build.FindSources(buildCtx, config, f)
@@ -160,6 +165,20 @@
 	}
 }
 
+func fixBadDanglingLink(ctx build.Context, name string) {
+	_, err := os.Lstat(name)
+	if err != nil {
+		return
+	}
+	_, err = os.Stat(name)
+	if os.IsNotExist(err) {
+		err = os.Remove(name)
+		if err != nil {
+			ctx.Fatalf("Failed to remove dangling link %q: %v", name, err)
+		}
+	}
+}
+
 func dumpVar(ctx build.Context, config build.Config, args []string) {
 	flags := flag.NewFlagSet("dumpvar", flag.ExitOnError)
 	flags.Usage = func() {
diff --git a/java/config/config.go b/java/config/config.go
index 2762a4d..6495222 100644
--- a/java/config/config.go
+++ b/java/config/config.go
@@ -29,7 +29,7 @@
 
 	DefaultBootclasspathLibraries = []string{"core.platform.api.stubs", "core-lambda-stubs"}
 	DefaultSystemModules          = "core-platform-api-stubs-system-modules"
-	DefaultLibraries              = []string{"ext", "framework"}
+	DefaultLibraries              = []string{"ext", "framework", "updatable_media_stubs"}
 	DefaultLambdaStubsLibrary     = "core-lambda-stubs"
 	SdkLambdaStubsPath            = "prebuilts/sdk/tools/core-lambda-stubs.jar"
 
@@ -43,6 +43,7 @@
 		"android.car7",
 		"core-oj",
 		"core-libart",
+		"updatable-media",
 	}
 )
 
diff --git a/java/java_test.go b/java/java_test.go
index 952da11..3857ba8 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -906,7 +906,7 @@
 		checkPatchModuleFlag(t, ctx, "foo", "")
 		expected := "java.base=.:" + buildDir
 		checkPatchModuleFlag(t, ctx, "bar", expected)
-		expected = "java.base=" + strings.Join([]string{".", buildDir, moduleToPath("ext"), moduleToPath("framework")}, ":")
+		expected = "java.base=" + strings.Join([]string{".", buildDir, moduleToPath("ext"), moduleToPath("framework"), moduleToPath("updatable_media_stubs")}, ":")
 		checkPatchModuleFlag(t, ctx, "baz", expected)
 	})
 }
diff --git a/java/sdk_test.go b/java/sdk_test.go
index 6924e26..a11ea2f 100644
--- a/java/sdk_test.go
+++ b/java/sdk_test.go
@@ -39,14 +39,14 @@
 		name:          "default",
 		bootclasspath: []string{"core.platform.api.stubs", "core-lambda-stubs"},
 		system:        "core-platform-api-stubs-system-modules",
-		classpath:     []string{"ext", "framework"},
+		classpath:     []string{"ext", "framework", "updatable_media_stubs"},
 	},
 	{
 		name:          "blank sdk version",
 		properties:    `sdk_version: "",`,
 		bootclasspath: []string{"core.platform.api.stubs", "core-lambda-stubs"},
 		system:        "core-platform-api-stubs-system-modules",
-		classpath:     []string{"ext", "framework"},
+		classpath:     []string{"ext", "framework", "updatable_media_stubs"},
 	},
 	{
 
diff --git a/java/testing.go b/java/testing.go
index 6febfa1..713eca1 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -40,6 +40,7 @@
 		"core-lambda-stubs",
 		"framework",
 		"ext",
+		"updatable_media_stubs",
 		"android_stubs_current",
 		"android_system_stubs_current",
 		"android_test_stubs_current",