Merge "respect relative_install_path for binaries in APEXes"
diff --git a/android/module.go b/android/module.go
index c5252c8..9a69a26 100644
--- a/android/module.go
+++ b/android/module.go
@@ -383,6 +383,7 @@
 		&base.nameProperties,
 		&base.commonProperties,
 		&base.variableProperties)
+	base.generalProperties = m.GetProperties()
 	base.customizableProperties = m.GetProperties()
 }
 
diff --git a/android/path_properties.go b/android/path_properties.go
index 5d89709..1a12290 100644
--- a/android/path_properties.go
+++ b/android/path_properties.go
@@ -33,7 +33,7 @@
 		return
 	}
 
-	props := m.base().customizableProperties
+	props := m.base().generalProperties
 
 	for _, ps := range props {
 		pathProperties := pathPropertiesForPropertyStruct(ctx, ps)
diff --git a/android/path_properties_test.go b/android/path_properties_test.go
index 6471a3c..ecc2d21 100644
--- a/android/path_properties_test.go
+++ b/android/path_properties_test.go
@@ -25,7 +25,7 @@
 	ModuleBase
 	props struct {
 		Foo string   `android:"path"`
-		Bar []string `android:"path"`
+		Bar []string `android:"path,arch_variant"`
 		Baz *string  `android:"path"`
 		Qux string
 	}
@@ -36,7 +36,7 @@
 func pathDepsMutatorTestModuleFactory() Module {
 	module := &pathDepsMutatorTestModule{}
 	module.AddProperties(&module.props)
-	InitAndroidModule(module)
+	InitAndroidArchModule(module, DeviceSupported, MultilibBoth)
 	return module
 }
 
@@ -64,6 +64,23 @@
 			}`,
 			deps: []string{"a", "b", "c"},
 		},
+		{
+			name: "arch variant",
+			bp: `
+			test {
+				name: "foo",
+				arch: {
+					arm64: {
+						bar: [":a"],
+					},
+					arm: {
+						bar: [":b"],
+					},
+				},
+				bar: [":c"],
+			}`,
+			deps: []string{"c", "a"},
+		},
 	}
 
 	buildDir, err := ioutil.TempDir("", "soong_path_properties_test")
@@ -74,8 +91,8 @@
 
 	for _, test := range tests {
 		t.Run(test.name, func(t *testing.T) {
-			config := TestConfig(buildDir, nil)
-			ctx := NewTestContext()
+			config := TestArchConfig(buildDir, nil)
+			ctx := NewTestArchContext()
 
 			ctx.RegisterModuleType("test", ModuleFactoryAdaptor(pathDepsMutatorTestModuleFactory))
 			ctx.RegisterModuleType("filegroup", ModuleFactoryAdaptor(FileGroupFactory))
@@ -110,7 +127,7 @@
 			_, errs = ctx.PrepareBuildActions(config)
 			FailIfErrored(t, errs)
 
-			m := ctx.ModuleForTests("foo", "").Module().(*pathDepsMutatorTestModule)
+			m := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*pathDepsMutatorTestModule)
 
 			if g, w := m.sourceDeps, test.deps; !reflect.DeepEqual(g, w) {
 				t.Errorf("want deps %q, got %q", w, g)
diff --git a/android/sh_binary.go b/android/sh_binary.go
index 52c5a9a..8bb3517 100644
--- a/android/sh_binary.go
+++ b/android/sh_binary.go
@@ -17,6 +17,7 @@
 import (
 	"fmt"
 	"io"
+	"strings"
 )
 
 // sh_binary is for shell scripts (and batch files) that are installed as
@@ -28,6 +29,7 @@
 func init() {
 	RegisterModuleType("sh_binary", ShBinaryFactory)
 	RegisterModuleType("sh_binary_host", ShBinaryHostFactory)
+	RegisterModuleType("sh_test", ShTestFactory)
 }
 
 type shBinaryProperties struct {
@@ -48,6 +50,16 @@
 	Installable *bool
 }
 
+type TestProperties struct {
+	// list of compatibility suites (for example "cts", "vts") that the module should be
+	// installed into.
+	Test_suites []string `android:"arch_variant"`
+
+	// the name of the test configuration (for example "AndroidTest.xml") that should be
+	// installed with the module.
+	Test_config *string `android:"arch_variant"`
+}
+
 type ShBinary struct {
 	ModuleBase
 
@@ -57,6 +69,12 @@
 	outputFilePath OutputPath
 }
 
+type ShTest struct {
+	ShBinary
+
+	testProperties TestProperties
+}
+
 func (s *ShBinary) DepsMutator(ctx BottomUpMutatorContext) {
 	if s.properties.Src == nil {
 		ctx.PropertyErrorf("src", "missing prebuilt source file")
@@ -119,6 +137,16 @@
 	}
 }
 
+func (s *ShTest) AndroidMk() AndroidMkData {
+	data := s.ShBinary.AndroidMk()
+	data.Extra = append(data.Extra, func(w io.Writer, outputFile Path) {
+		fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=",
+			strings.Join(s.testProperties.Test_suites, " "))
+		fmt.Fprintln(w, "LOCAL_TEST_CONFIG :=", String(s.testProperties.Test_config))
+	})
+	return data
+}
+
 func InitShBinaryModule(s *ShBinary) {
 	s.AddProperties(&s.properties)
 }
@@ -140,3 +168,12 @@
 	InitAndroidArchModule(module, HostSupported, MultilibFirst)
 	return module
 }
+
+func ShTestFactory() Module {
+	module := &ShTest{}
+	InitShBinaryModule(&module.ShBinary)
+	module.AddProperties(&module.testProperties)
+
+	InitAndroidArchModule(module, HostAndDeviceSupported, MultilibFirst)
+	return module
+}
diff --git a/androidmk/cmd/androidmk/android.go b/androidmk/cmd/androidmk/android.go
index 1d66ab7..9276eb5 100644
--- a/androidmk/cmd/androidmk/android.go
+++ b/androidmk/cmd/androidmk/android.go
@@ -76,6 +76,8 @@
 
 	"LOCAL_ANNOTATION_PROCESSOR_CLASSES": skip, // Soong gets the processor classes from the plugin
 	"LOCAL_CTS_TEST_PACKAGE":             skip, // Obsolete
+	"LOCAL_JACK_ENABLED":                 skip, // Obselete
+	"LOCAL_JACK_FLAGS":                   skip, // Obselete
 }
 
 // adds a group of properties all having the same type
diff --git a/androidmk/cmd/androidmk/androidmk_test.go b/androidmk/cmd/androidmk/androidmk_test.go
index 2976a0c..e3499d2 100644
--- a/androidmk/cmd/androidmk/androidmk_test.go
+++ b/androidmk/cmd/androidmk/androidmk_test.go
@@ -1094,6 +1094,22 @@
 }
 `,
 	},
+	{
+		desc: "blah",
+		in: `
+include $(CLEAR_VARS)
+LOCAL_MODULE := foo
+LOCAL_JACK_ENABLED := incremental
+LOCAL_JACK_FLAGS := --multi-dex native
+include $(BUILD_PACKAGE)
+		`,
+		expected: `
+android_app {
+	name: "foo",
+
+}
+		`,
+	},
 }
 
 func TestEndToEnd(t *testing.T) {
diff --git a/cc/binary.go b/cc/binary.go
index 9952943..cae1739 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -437,7 +437,9 @@
 	// The original path becomes a symlink to the corresponding file in the
 	// runtime APEX.
 	if isBionic(ctx.baseModuleName()) && ctx.Arch().Native && ctx.apexName() == "" && !ctx.inRecovery() {
-		binary.installSymlinkToRuntimeApex(ctx, file)
+		if ctx.Device() {
+			binary.installSymlinkToRuntimeApex(ctx, file)
+		}
 		binary.baseInstaller.subDir = "bootstrap"
 	}
 	binary.baseInstaller.install(ctx, file)
diff --git a/cc/config/clang.go b/cc/config/clang.go
index 6a1c736..a57bbf8 100644
--- a/cc/config/clang.go
+++ b/cc/config/clang.go
@@ -174,6 +174,10 @@
 
 		// Disable this warning because we don't care about behavior with older compilers.
 		"-Wno-return-std-move-in-c++11",
+
+		// Disable -Wstring-plus-int until the instances detected by this new warning is
+		// fixed.
+		"-Wno-string-plus-int",
 	}, " "))
 
 	// Extra cflags for projects under external/ directory
diff --git a/cc/config/global.go b/cc/config/global.go
index 689b315..e3fab0c 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -120,8 +120,8 @@
 
 	// prebuilts/clang default settings.
 	ClangDefaultBase         = "prebuilts/clang/host"
-	ClangDefaultVersion      = "clang-r349610"
-	ClangDefaultShortVersion = "8.0.8"
+	ClangDefaultVersion      = "clang-r353983"
+	ClangDefaultShortVersion = "9.0.1"
 
 	// Directories with warnings from Android.bp files.
 	WarningAllowedProjects = []string{
diff --git a/cc/library.go b/cc/library.go
index 6404906..5df5112 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -920,7 +920,9 @@
 			// The original path becomes a symlink to the corresponding file in the
 			// runtime APEX.
 			if isBionic(ctx.baseModuleName()) && !library.buildStubs() && ctx.Arch().Native && !ctx.inRecovery() {
-				library.installSymlinkToRuntimeApex(ctx, file)
+				if ctx.Device() {
+					library.installSymlinkToRuntimeApex(ctx, file)
+				}
 				library.baseInstaller.subDir = "bootstrap"
 			}
 		}
diff --git a/cc/lto.go b/cc/lto.go
index 6302748..0d7a246 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -83,8 +83,7 @@
 	if lto.LTO() {
 		var ltoFlag string
 		if Bool(lto.Properties.Lto.Thin) {
-			ltoFlag = "-flto=thin"
-
+			ltoFlag = "-flto=thin -fsplit-lto-unit"
 		} else {
 			ltoFlag = "-flto"
 		}