Revert "Update min_sdk_version from SdkSpec to ApiLevel"
Revert submission 2457063
Reason for revert: Broken udc-dev
Reverted changes: /q/submissionid:2457063
Change-Id: Id6349fc1318877044af713c914a0afd437d3d2d5
diff --git a/android/apex.go b/android/apex.go
index 87bff74..358818f 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -845,7 +845,7 @@
// ModuleWithMinSdkVersionCheck represents a module that implements min_sdk_version checks
type ModuleWithMinSdkVersionCheck interface {
Module
- MinSdkVersion(ctx EarlyModuleContext) ApiLevel
+ MinSdkVersion(ctx EarlyModuleContext) SdkSpec
CheckMinSdkVersion(ctx ModuleContext)
}
diff --git a/android/api_levels.go b/android/api_levels.go
index 0c0b2b4..e48a69e 100644
--- a/android/api_levels.go
+++ b/android/api_levels.go
@@ -185,14 +185,6 @@
return ret.String(), nil
}
-// Specified returns true if the module is targeting a recognzized api_level.
-// It returns false if either
-// 1. min_sdk_version is not an int or a recognized codename
-// 2. both min_sdk_version and sdk_version are empty. In this case, MinSdkVersion() defaults to SdkSpecPrivate.ApiLevel
-func (this ApiLevel) Specified() bool {
- return !this.IsInvalid() && !this.IsPrivate()
-}
-
// Returns -1 if the current API level is less than the argument, 0 if they
// are equal, and 1 if it is greater than the argument.
func (this ApiLevel) CompareTo(other ApiLevel) int {
@@ -297,16 +289,6 @@
return strconv.Itoa(num)
}
-// ApiLevelFrom converts the given string `raw` to an ApiLevel.
-// If `raw` is invalid (empty string, unrecognized codename etc.) it returns an invalid ApiLevel
-func ApiLevelFrom(ctx PathContext, raw string) ApiLevel {
- ret, err := ApiLevelFromUser(ctx, raw)
- if err != nil {
- return NewInvalidApiLevel(raw)
- }
- return ret
-}
-
// ApiLevelFromUser converts the given string `raw` to an ApiLevel, possibly returning an error.
//
// `raw` must be non-empty. Passing an empty string results in a panic.
diff --git a/android/sdk.go b/android/sdk.go
index 63e0bbe..8b23d63 100644
--- a/android/sdk.go
+++ b/android/sdk.go
@@ -25,7 +25,7 @@
// minApiLevelForSdkSnapshot provides access to the min_sdk_version for MinApiLevelForSdkSnapshot
type minApiLevelForSdkSnapshot interface {
- MinSdkVersion(ctx EarlyModuleContext) ApiLevel
+ MinSdkVersion(ctx EarlyModuleContext) SdkSpec
}
// MinApiLevelForSdkSnapshot returns the ApiLevel of the min_sdk_version of the supplied module.
@@ -34,7 +34,7 @@
func MinApiLevelForSdkSnapshot(ctx EarlyModuleContext, module Module) ApiLevel {
minApiLevel := NoneApiLevel
if m, ok := module.(minApiLevelForSdkSnapshot); ok {
- minApiLevel = m.MinSdkVersion(ctx)
+ minApiLevel = m.MinSdkVersion(ctx).ApiLevel
}
if minApiLevel == NoneApiLevel {
// The default min API level is 1.
diff --git a/android/sdk_version.go b/android/sdk_version.go
index 18b819a..f8ac44a 100644
--- a/android/sdk_version.go
+++ b/android/sdk_version.go
@@ -25,9 +25,9 @@
SdkVersion(ctx EarlyModuleContext) SdkSpec
// SystemModules returns the system_modules property of the current module, or an empty string if it is not set.
SystemModules() string
- // MinSdkVersion returns ApiLevel that corresponds to the min_sdk_version property of the current module,
+ // MinSdkVersion returns SdkSpec that corresponds to the min_sdk_version property of the current module,
// or from sdk_version if it is not set.
- MinSdkVersion(ctx EarlyModuleContext) ApiLevel
+ MinSdkVersion(ctx EarlyModuleContext) SdkSpec
// ReplaceMaxSdkVersionPlaceholder returns SdkSpec to replace the maxSdkVersion property of permission and
// uses-permission tags if it is set.
ReplaceMaxSdkVersionPlaceholder(ctx EarlyModuleContext) SdkSpec