diff --git a/java/aar.go b/java/aar.go index 8b5b85e34..13c536940 100644 --- a/java/aar.go +++ b/java/aar.go @@ -76,14 +76,11 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkVersion string) (flags [ hasVersionCode := false hasVersionName := false - hasProduct := false for _, f := range a.aaptProperties.Aaptflags { if strings.HasPrefix(f, "--version-code") { hasVersionCode = true } else if strings.HasPrefix(f, "--version-name") { hasVersionName = true - } else if strings.HasPrefix(f, "--product") { - hasProduct = true } } @@ -140,21 +137,6 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkVersion string) (flags [ linkFlags = append(linkFlags, "--min-sdk-version "+sdkVersion) linkFlags = append(linkFlags, "--target-sdk-version "+sdkVersion) - // Product characteristics - if !hasProduct && len(ctx.Config().ProductAAPTCharacteristics()) > 0 { - linkFlags = append(linkFlags, "--product", ctx.Config().ProductAAPTCharacteristics()) - } - - // Product AAPT config - for _, aaptConfig := range ctx.Config().ProductAAPTConfig() { - linkFlags = append(linkFlags, "-c", aaptConfig) - } - - // Product AAPT preferred config - if len(ctx.Config().ProductAAPTPreferredConfig()) > 0 { - linkFlags = append(linkFlags, "--preferred-density", ctx.Config().ProductAAPTPreferredConfig()) - } - // Version code if !hasVersionCode { linkFlags = append(linkFlags, "--version-code", ctx.Config().PlatformSdkVersion()) diff --git a/java/app.go b/java/app.go index 3e24ebc89..dd83a0a77 100644 --- a/java/app.go +++ b/java/app.go @@ -86,6 +86,28 @@ func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) { a.properties.Instrument = true } + hasProduct := false + for _, f := range a.aaptProperties.Aaptflags { + if strings.HasPrefix(f, "--product") { + hasProduct = true + } + } + + // Product characteristics + if !hasProduct && len(ctx.Config().ProductAAPTCharacteristics()) > 0 { + linkFlags = append(linkFlags, "--product", ctx.Config().ProductAAPTCharacteristics()) + } + + // Product AAPT config + for _, aaptConfig := range ctx.Config().ProductAAPTConfig() { + linkFlags = append(linkFlags, "-c", aaptConfig) + } + + // Product AAPT preferred config + if len(ctx.Config().ProductAAPTPreferredConfig()) > 0 { + linkFlags = append(linkFlags, "--preferred-density", ctx.Config().ProductAAPTPreferredConfig()) + } + // TODO: LOCAL_PACKAGE_OVERRIDES // $(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \