Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad99149a authored by satayev's avatar satayev
Browse files

Add MinSdkVersion(ctx) method to ModuleWithMinSdkVersionCheck interface.

Bug: 205923322
Test: presubmit
Change-Id: I469d655823e12a14bc0abaeb544a5dd2a6d3622f
parent 939cb7b0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -913,6 +913,7 @@ type WalkPayloadDepsFunc func(ctx ModuleContext, do PayloadDepsCallback)
// ModuleWithMinSdkVersionCheck represents a module that implements min_sdk_version checks
type ModuleWithMinSdkVersionCheck interface {
	Module
	MinSdkVersion(ctx EarlyModuleContext) SdkSpec
	CheckMinSdkVersion(ctx ModuleContext)
}

+11 −1
Original line number Diff line number Diff line
@@ -2346,6 +2346,8 @@ func overrideApexFactory() android.Module {
//
// TODO(jiyong): move these checks to a separate go file.

var _ android.ModuleWithMinSdkVersionCheck = (*apexBundle)(nil)

// Entures that min_sdk_version of the included modules are equal or less than the min_sdk_version
// of this apexBundle.
func (a *apexBundle) CheckMinSdkVersion(ctx android.ModuleContext) {
@@ -2357,7 +2359,15 @@ func (a *apexBundle) CheckMinSdkVersion(ctx android.ModuleContext) {
	android.CheckMinSdkVersion(ctx, minSdkVersion, a.WalkPayloadDeps)
}

func (a *apexBundle) minSdkVersion(ctx android.BaseModuleContext) android.ApiLevel {
func (a *apexBundle) MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
	return android.SdkSpec{
		Kind:     android.SdkNone,
		ApiLevel: a.minSdkVersion(ctx),
		Raw:      String(a.properties.Min_sdk_version),
	}
}

func (a *apexBundle) minSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel {
	ver := proptools.String(a.properties.Min_sdk_version)
	if ver == "" {
		return android.NoneApiLevel