From df0b83966161d767714909dff032648c0d83d4c8 Mon Sep 17 00:00:00 2001 From: Yu Liu Date: Wed, 12 Feb 2025 18:27:03 +0000 Subject: Convert CheckMinSdkVersion to use providers. Next step is to convert it to use ModuleProxy once IsDepInSameApex is converted to use providers. Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: I20cb052666fa95eb964e63e3302ac892d3324183 --- java/app.go | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'java/app.go') diff --git a/java/app.go b/java/app.go index a634f9c32..89d688d62 100644 --- a/java/app.go +++ b/java/app.go @@ -1281,7 +1281,7 @@ func (a *AndroidApp) buildAppDependencyInfo(ctx android.ModuleContext) { // Skip dependencies that are only available to APEXes; they are developed with updatability // in mind and don't need manual approval. - if to.(android.ApexModule).NotAvailableForPlatform() { + if android.OtherModuleProviderOrDefault(ctx, to, android.CommonModuleInfoKey).NotAvailableForPlatform { return true } @@ -1291,18 +1291,9 @@ func (a *AndroidApp) buildAppDependencyInfo(ctx android.ModuleContext) { depsInfo[depName] = info } else { toMinSdkVersion := "(no version)" - if m, ok := to.(interface { - MinSdkVersion(ctx android.EarlyModuleContext) android.ApiLevel - }); ok { - if v := m.MinSdkVersion(ctx); !v.IsNone() { - toMinSdkVersion = v.String() - } - } else if m, ok := to.(interface{ MinSdkVersion() string }); ok { - // TODO(b/175678607) eliminate the use of MinSdkVersion returning - // string - if v := m.MinSdkVersion(); v != "" { - toMinSdkVersion = v - } + if info, ok := android.OtherModuleProvider(ctx, to, android.CommonModuleInfoKey); ok && + !info.MinSdkVersion.IsPlatform && info.MinSdkVersion.ApiLevel != nil { + toMinSdkVersion = info.MinSdkVersion.ApiLevel.String() } depsInfo[depName] = android.ApexModuleDepInfo{ To: depName, -- cgit v1.2.3-59-g8ed1b