Pass shared library updatability attributes as strings

Migrate from ints to Strings so we can pass codenames. Otherwise we
can't use these attributes representing a release in progress until that
release is finalized. I.e. if release T is in progress, we don't get the
correct behaviour if we use "T" in those attributes

Bug: 191978330

Test: m nothing
Change-Id: I35389da0a01549ba2f820f5e5b78f6ea88c2aea1
This commit is contained in:
Pedro Loureiro
2021-12-22 15:28:05 +00:00
parent 104ecf6708
commit b638c62620
2 changed files with 17 additions and 11 deletions

View File

@@ -21,7 +21,6 @@ import (
"reflect"
"regexp"
"sort"
"strconv"
"strings"
"sync"
@@ -2551,8 +2550,14 @@ func formattedOptionalSdkLevelAttribute(ctx android.ModuleContext, attrName stri
ctx.PropertyErrorf(strings.ReplaceAll(attrName, "-", "_"), err.Error())
return ""
}
intStr := strconv.Itoa(apiLevel.FinalOrPreviewInt())
return formattedOptionalAttribute(attrName, &intStr)
if apiLevel.IsCurrent() {
// passing "current" would always mean a future release, never the current (or the current in
// progress) which means some conditions would never be triggered.
ctx.PropertyErrorf(strings.ReplaceAll(attrName, "-", "_"),
`"current" is not an allowed value for this attribute`)
return ""
}
return formattedOptionalAttribute(attrName, value)
}
// formats an attribute for the xml permissions file if the value is not null