Revert "Create EffectiveVersion* functions for ApiLevel"

Revert submission 2457063

Reason for revert: Broken udc-dev

Reverted changes: /q/submissionid:2457063

Change-Id: Ib0f6930ff292d25fee2640901b158ac4bb7b879b
This commit is contained in:
Spandan Das
2023-03-21 01:36:46 +00:00
parent 7f88a03f88
commit 51dc6859ac
2 changed files with 34 additions and 54 deletions

View File

@@ -187,7 +187,14 @@ func (s SdkSpec) EffectiveVersion(ctx EarlyModuleContext) (ApiLevel, error) {
if ctx.DeviceSpecific() || ctx.SocSpecific() {
s = s.ForVendorPartition(ctx)
}
return s.ApiLevel.EffectiveVersion(ctx)
if !s.ApiLevel.IsPreview() {
return s.ApiLevel, nil
}
ret := ctx.Config().DefaultAppTargetSdk(ctx)
if ret.IsPreview() {
return FutureApiLevel, nil
}
return ret, nil
}
// EffectiveVersionString converts an SdkSpec into the concrete version string that the module
@@ -201,7 +208,32 @@ func (s SdkSpec) EffectiveVersionString(ctx EarlyModuleContext) (string, error)
if ctx.DeviceSpecific() || ctx.SocSpecific() {
s = s.ForVendorPartition(ctx)
}
return s.ApiLevel.EffectiveVersionString(ctx)
if !s.ApiLevel.IsPreview() {
return s.ApiLevel.String(), nil
}
// Determine the default sdk
ret := ctx.Config().DefaultAppTargetSdk(ctx)
if !ret.IsPreview() {
// If the default sdk has been finalized, return that
return ret.String(), nil
}
// There can be more than one active in-development sdks
// If an app is targeting an active sdk, but not the default one, return the requested active sdk.
// e.g.
// SETUP
// In-development: UpsideDownCake, VanillaIceCream
// Default: VanillaIceCream
// Android.bp
// min_sdk_version: `UpsideDownCake`
// RETURN
// UpsideDownCake and not VanillaIceCream
for _, preview := range ctx.Config().PreviewApiLevels() {
if s.ApiLevel.String() == preview.String() {
return preview.String(), nil
}
}
// Otherwise return the default one
return ret.String(), nil
}
var (