Introduce min_sdk_version to deps info.

Bug: 149622332
Test: m
Change-Id: Ie6568cb8a82d5cca9a3dc91b5a068abf4b0632dc
Merged-In: Ie6568cb8a82d5cca9a3dc91b5a068abf4b0632dc
Exempt-From-Owner-Approval: cp from aosp
(cherry picked from commit 480e25b74f9e7101ff3083bd4517f15ac0a6a1b9)
diff --git a/android/apex.go b/android/apex.go
index 07d59b2..ede0965 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -405,21 +405,29 @@
 	From []string
 	// Whether the dependency belongs to the final compiled APEX.
 	IsExternal bool
+	// min_sdk_version of the ApexModule
+	MinSdkVersion string
 }
 
 // A map of a dependency name to its ApexModuleDepInfo
 type DepNameToDepInfoMap map[string]ApexModuleDepInfo
 
 type ApexBundleDepsInfo struct {
-	flatListPath OutputPath
-	fullListPath OutputPath
+	minSdkVersion string
+	flatListPath  OutputPath
+	fullListPath  OutputPath
 }
 
 type ApexDepsInfoIntf interface {
+	MinSdkVersion() string
 	FlatListPath() Path
 	FullListPath() Path
 }
 
+func (d *ApexBundleDepsInfo) MinSdkVersion() string {
+	return d.minSdkVersion
+}
+
 func (d *ApexBundleDepsInfo) FlatListPath() Path {
 	return d.flatListPath
 }
@@ -433,14 +441,16 @@
 // Generate two module out files:
 // 1. FullList with transitive deps and their parents in the dep graph
 // 2. FlatList with a flat list of transitive deps
-func (d *ApexBundleDepsInfo) BuildDepsInfoLists(ctx ModuleContext, depInfos DepNameToDepInfoMap) {
+func (d *ApexBundleDepsInfo) BuildDepsInfoLists(ctx ModuleContext, minSdkVersion string, depInfos DepNameToDepInfoMap) {
+	d.minSdkVersion = minSdkVersion
+
 	var fullContent strings.Builder
 	var flatContent strings.Builder
 
-	fmt.Fprintf(&flatContent, "%s:\\n", ctx.ModuleName())
+	fmt.Fprintf(&flatContent, "%s(minSdkVersion:%s):\\n", ctx.ModuleName(), minSdkVersion)
 	for _, key := range FirstUniqueStrings(SortedStringKeys(depInfos)) {
 		info := depInfos[key]
-		toName := info.To
+		toName := fmt.Sprintf("%s(minSdkVersion:%s)", info.To, info.MinSdkVersion)
 		if info.IsExternal {
 			toName = toName + " (external)"
 		}