Merge "Adds multi_install_skip_symbol_files field (default false) to apex."
diff --git a/apex/androidmk.go b/apex/androidmk.go
index 2091274..a7a0107 100644
--- a/apex/androidmk.go
+++ b/apex/androidmk.go
@@ -103,6 +103,11 @@
 		return moduleNames
 	}
 
+	// Avoid creating duplicate build rules for multi-installed APEXes.
+	if proptools.BoolDefault(a.properties.Multi_install_skip_symbol_files, false) {
+		return moduleNames
+	}
+
 	var postInstallCommands []string
 	for _, fi := range a.filesInfo {
 		if a.linkToSystemLib && fi.transitiveDep && fi.availableToPlatform() {
diff --git a/apex/apex.go b/apex/apex.go
index 20660d3..8eb261f 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -135,6 +135,16 @@
 	// Default: true.
 	Installable *bool
 
+	// Whether this is multi-installed APEX should skip installing symbol files.
+	// Multi-installed APEXes share the same apex_name and are installed at the same time.
+	// Default is false.
+	//
+	// Should be set to true for all multi-installed APEXes except the singular
+	// default version within the multi-installed group.
+	// Only the default version can install symbol files in $(PRODUCT_OUT}/apex,
+	// or else conflicting build rules may be created.
+	Multi_install_skip_symbol_files *bool
+
 	// Whether this APEX can be compressed or not. Setting this property to false means this
 	// APEX will never be compressed. When set to true, APEX will be compressed if other
 	// conditions, e.g, target device needs to support APEX compression, are also fulfilled.