diff options
author | 2023-01-05 01:03:47 +0000 | |
---|---|---|
committer | 2023-03-21 17:37:57 +0000 | |
commit | dd7057c715c4371fe7fc26df5ac32e6cde276898 (patch) | |
tree | 0e016dc7bc7ad8c96350d3237a62560f14158028 /android/sdk_version.go | |
parent | 15da5887fef115ccde434d42ae5ddebe3cd36fbc (diff) |
Create EffectiveVersion* functions for ApiLevel
This relands aosp/2457062. The original CL was submitted as part of a
stack that broke tm and udc. Those branches still contain soong modules
with min_sdk_version of type (kind+level).
Bug: 208456999
Test: m nothing on tm and udc (via go/abtd)
Change-Id: I10e8bea59cd5914d36b2c9539ee1556e55b82e53
Diffstat (limited to 'android/sdk_version.go')
-rw-r--r-- | android/sdk_version.go | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/android/sdk_version.go b/android/sdk_version.go index 8925bbaee..ab6e4f796 100644 --- a/android/sdk_version.go +++ b/android/sdk_version.go @@ -221,14 +221,7 @@ func (s SdkSpec) EffectiveVersion(ctx EarlyModuleContext) (ApiLevel, error) { if ctx.DeviceSpecific() || ctx.SocSpecific() { s = s.ForVendorPartition(ctx) } - if !s.ApiLevel.IsPreview() { - return s.ApiLevel, nil - } - ret := ctx.Config().DefaultAppTargetSdk(ctx) - if ret.IsPreview() { - return FutureApiLevel, nil - } - return ret, nil + return s.ApiLevel.EffectiveVersion(ctx) } // EffectiveVersionString converts an SdkSpec into the concrete version string that the module @@ -242,32 +235,7 @@ func (s SdkSpec) EffectiveVersionString(ctx EarlyModuleContext) (string, error) if ctx.DeviceSpecific() || ctx.SocSpecific() { s = s.ForVendorPartition(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 + return s.ApiLevel.EffectiveVersionString(ctx) } var ( |