Create two sentinel api levels

InvalidApiLevel:
This will be used for error handling if a user provided api level is
not recognized

PrivateApiLevel:
This will be used to differentiate the api level of sdk_version:"" from
sdk_version:"current" or sdk_version:"<active_codename>" (all used to be
FutureApiLevel previously). This was not necessary previously since the
type of min_sdk_version was SdkSpec(kind+level). Since it had access to
kind, it could check that it was not SdkSpecPrivate

Test: m nothing
Change-Id: I628b443c34bf2ec258d947dfec09f38b126bc6bb
This commit is contained in:
Spandan Das
2023-03-02 23:36:39 +00:00
parent 895bc9463b
commit 7ee04614cd
4 changed files with 47 additions and 5 deletions

View File

@@ -52,6 +52,15 @@ var StringDefault = proptools.StringDefault
// FutureApiLevelInt is a placeholder constant for unreleased API levels.
const FutureApiLevelInt = 10000
// PrivateApiLevel represents the api level of SdkSpecPrivate (sdk_version: "")
// This api_level exists to differentiate user-provided "" from "current" sdk_version
// The differentiation is necessary to enable different validation rules for these two possible values.
var PrivateApiLevel = ApiLevel{
value: "current", // The value is current since aidl expects `current` as the default (TestAidlFlagsWithMinSdkVersion)
number: FutureApiLevelInt + 1, // This is used to differentiate it from FutureApiLevel
isPreview: true,
}
// FutureApiLevel represents unreleased API levels.
var FutureApiLevel = ApiLevel{
value: "current",