Merge "Don't emit make vars from disabled modules"
diff --git a/cc/prebuilt_test.go b/cc/prebuilt_test.go
index d94d59a..52416ac 100644
--- a/cc/prebuilt_test.go
+++ b/cc/prebuilt_test.go
@@ -274,6 +274,10 @@
 }
 
 func TestPrebuiltSymlinkedHostBinary(t *testing.T) {
+	if android.BuildOs != android.Linux {
+		t.Skipf("Skipping host prebuilt testing that is only supported on %s not %s", android.Linux, android.BuildOs)
+	}
+
 	ctx := testPrebuilt(t, `
 	cc_prebuilt_library_shared {
 		name: "libfoo",
diff --git a/cc/vendor_snapshot.go b/cc/vendor_snapshot.go
index 0219b84..2819f49 100644
--- a/cc/vendor_snapshot.go
+++ b/cc/vendor_snapshot.go
@@ -541,6 +541,11 @@
 	if !m.Enabled() || m.Properties.HideFromMake {
 		return false
 	}
+	// When android/prebuilt.go selects between source and prebuilt, it sets
+	// SkipInstall on the other one to avoid duplicate install rules in make.
+	if m.IsSkipInstall() {
+		return false
+	}
 	// skip proprietary modules, but include all VNDK (static)
 	if inVendorProprietaryPath && !m.IsVndk() {
 		return false
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index 304935e..4dbda49 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -568,8 +568,7 @@
 	}
 
 	for _, f := range global.PatternsOnSystemOther {
-		// See comment of SYSTEM_OTHER_ODEX_FILTER for details on the matching.
-		if makefileMatch("/"+f, dexLocation) || makefileMatch(filepath.Join(SystemPartition, f), dexLocation) {
+		if makefileMatch(filepath.Join(SystemPartition, f), dexLocation) {
 			return true
 		}
 	}
diff --git a/dexpreopt/dexpreopt_test.go b/dexpreopt/dexpreopt_test.go
index 727081c..ec31549 100644
--- a/dexpreopt/dexpreopt_test.go
+++ b/dexpreopt/dexpreopt_test.go
@@ -109,12 +109,13 @@
 				{module: productModule, expectedPartition: "product"},
 			},
 		},
+		// product/app/% only applies to product apps inside the system partition
 		{
 			patterns: []string{"app/%", "product/app/%"},
 			moduleTests: []moduleTest{
 				{module: systemModule, expectedPartition: "system_other/system"},
 				{module: systemProductModule, expectedPartition: "system_other/system/product"},
-				{module: productModule, expectedPartition: "system_other/product"},
+				{module: productModule, expectedPartition: "product"},
 			},
 		},
 	}
@@ -134,7 +135,7 @@
 			}
 
 			if rule.Installs().String() != wantInstalls.String() {
-				t.Errorf("\npatterns: %v\nwant installs:\n   %v\ngot:\n   %v", test.patterns, wantInstalls, rule.Installs())
+				t.Errorf("\nwant installs:\n   %v\ngot:\n   %v", wantInstalls, rule.Installs())
 			}
 		}
 	}