Merge "Export TARGET_JAVAC and HOST_JAVAC to make"
diff --git a/android/api_levels.go b/android/api_levels.go
index 370d553..2c4ae1a 100644
--- a/android/api_levels.go
+++ b/android/api_levels.go
@@ -67,6 +67,7 @@
 		"M":     23,
 		"N":     24,
 		"N-MR1": 25,
+		"O":     26,
 	}
 	for i, codename := range ctx.Config().(Config).PlatformVersionCombinedCodenames() {
 		apiLevelsMap[codename] = baseApiLevel + i
diff --git a/android/paths.go b/android/paths.go
index b5b4730..9c8e93a 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -283,6 +283,23 @@
 	return ret
 }
 
+// FirstUniqueElements returns all unique elements of a slice, keeping the first copy of each
+// modifies the slice contents in place, and returns a subslice of the original slice
+func FirstUniquePaths(list Paths) Paths {
+	k := 0
+outer:
+	for i := 0; i < len(list); i++ {
+		for j := 0; j < k; j++ {
+			if list[i] == list[j] {
+				continue outer
+			}
+		}
+		list[k] = list[i]
+		k++
+	}
+	return list[:k]
+}
+
 // WritablePaths is a slice of WritablePaths, used for multiple outputs.
 type WritablePaths []WritablePath
 
diff --git a/cc/cc.go b/cc/cc.go
index 4dafc63..b3ba798 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1138,6 +1138,13 @@
 
 	// Dedup exported flags from dependencies
 	depPaths.Flags = firstUniqueElements(depPaths.Flags)
+	depPaths.GeneratedHeaders = android.FirstUniquePaths(depPaths.GeneratedHeaders)
+	depPaths.ReexportedFlags = firstUniqueElements(depPaths.ReexportedFlags)
+	depPaths.ReexportedFlagsDeps = android.FirstUniquePaths(depPaths.ReexportedFlagsDeps)
+
+	if c.sabi != nil {
+		c.sabi.Properties.ReexportedIncludeFlags = firstUniqueElements(c.sabi.Properties.ReexportedIncludeFlags)
+	}
 
 	return depPaths
 }