Loading android/config.go +4 −0 Original line number Diff line number Diff line Loading @@ -1426,6 +1426,10 @@ func (c *config) IsVndkDeprecated() bool { return !Bool(c.productVariables.KeepVndk) } func (c *config) VendorApiLevel() string { return String(c.productVariables.VendorApiLevel) } func (c *deviceConfig) Arches() []Arch { var arches []Arch for _, target := range c.config.Targets[Android] { Loading android/variable.go +2 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,8 @@ type ProductVariables struct { DeviceMaxPageSizeSupported *string `json:",omitempty"` DevicePageSizeAgnostic *bool `json:",omitempty"` VendorApiLevel *string `json:",omitempty"` RecoverySnapshotVersion *string `json:",omitempty"` DeviceSecondaryArch *string `json:",omitempty"` Loading cc/cc_test.go +3 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ func TestMain(m *testing.M) { var prepareForCcTest = android.GroupFixturePreparers( PrepareForTestWithCcIncludeVndk, android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { variables.VendorApiLevel = StringPtr("202404") variables.DeviceVndkVersion = StringPtr("current") variables.Platform_vndk_version = StringPtr("29") }), Loading Loading @@ -2131,11 +2132,13 @@ func TestEnforceProductVndkVersion(t *testing.T) { ensureStringContains(t, vendor_cflags, "-D__ANDROID_VNDK__") ensureStringContains(t, vendor_cflags, "-D__ANDROID_VENDOR__") ensureStringNotContains(t, vendor_cflags, "-D__ANDROID_PRODUCT__") ensureStringContains(t, vendor_cflags, "-D__ANDROID_VENDOR_API__=202404") product_cflags := product_static.Rule("cc").Args["cFlags"] ensureStringContains(t, product_cflags, "-D__ANDROID_VNDK__") ensureStringContains(t, product_cflags, "-D__ANDROID_PRODUCT__") ensureStringNotContains(t, product_cflags, "-D__ANDROID_VENDOR__") ensureStringNotContains(t, product_cflags, "-D__ANDROID_VENDOR_API__=202404") } func TestEnforceProductVndkVersionErrors(t *testing.T) { Loading cc/compiler.go +9 −0 Original line number Diff line number Diff line Loading @@ -406,6 +406,15 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_VNDK__") if ctx.inVendor() { flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_VENDOR__") vendorApiLevel := ctx.Config().VendorApiLevel() if vendorApiLevel == "" { // TODO(b/314036847): This is a fallback for UDC targets. // This must be a build failure when UDC is no longer built // from this source tree. vendorApiLevel = ctx.Config().PlatformSdkVersion().String() } flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_VENDOR_API__="+vendorApiLevel) } else if ctx.inProduct() { flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_PRODUCT__") } Loading rust/bindgen.go +9 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,15 @@ func (b *bindgenDecorator) GenerateSource(ctx ModuleContext, deps PathDeps) andr cflags = append(cflags, "-D__ANDROID_VNDK__") if ctx.RustModule().InVendor() { cflags = append(cflags, "-D__ANDROID_VENDOR__") vendorApiLevel := ctx.Config().VendorApiLevel() if vendorApiLevel == "" { // TODO(b/314036847): This is a fallback for UDC targets. // This must be a build failure when UDC is no longer built // from this source tree. vendorApiLevel = ctx.Config().PlatformSdkVersion().String() } cflags = append(cflags, "-D__ANDROID_VENDOR_API__="+vendorApiLevel) } else if ctx.RustModule().InProduct() { cflags = append(cflags, "-D__ANDROID_PRODUCT__") } Loading Loading
android/config.go +4 −0 Original line number Diff line number Diff line Loading @@ -1426,6 +1426,10 @@ func (c *config) IsVndkDeprecated() bool { return !Bool(c.productVariables.KeepVndk) } func (c *config) VendorApiLevel() string { return String(c.productVariables.VendorApiLevel) } func (c *deviceConfig) Arches() []Arch { var arches []Arch for _, target := range c.config.Targets[Android] { Loading
android/variable.go +2 −0 Original line number Diff line number Diff line Loading @@ -226,6 +226,8 @@ type ProductVariables struct { DeviceMaxPageSizeSupported *string `json:",omitempty"` DevicePageSizeAgnostic *bool `json:",omitempty"` VendorApiLevel *string `json:",omitempty"` RecoverySnapshotVersion *string `json:",omitempty"` DeviceSecondaryArch *string `json:",omitempty"` Loading
cc/cc_test.go +3 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ func TestMain(m *testing.M) { var prepareForCcTest = android.GroupFixturePreparers( PrepareForTestWithCcIncludeVndk, android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { variables.VendorApiLevel = StringPtr("202404") variables.DeviceVndkVersion = StringPtr("current") variables.Platform_vndk_version = StringPtr("29") }), Loading Loading @@ -2131,11 +2132,13 @@ func TestEnforceProductVndkVersion(t *testing.T) { ensureStringContains(t, vendor_cflags, "-D__ANDROID_VNDK__") ensureStringContains(t, vendor_cflags, "-D__ANDROID_VENDOR__") ensureStringNotContains(t, vendor_cflags, "-D__ANDROID_PRODUCT__") ensureStringContains(t, vendor_cflags, "-D__ANDROID_VENDOR_API__=202404") product_cflags := product_static.Rule("cc").Args["cFlags"] ensureStringContains(t, product_cflags, "-D__ANDROID_VNDK__") ensureStringContains(t, product_cflags, "-D__ANDROID_PRODUCT__") ensureStringNotContains(t, product_cflags, "-D__ANDROID_VENDOR__") ensureStringNotContains(t, product_cflags, "-D__ANDROID_VENDOR_API__=202404") } func TestEnforceProductVndkVersionErrors(t *testing.T) { Loading
cc/compiler.go +9 −0 Original line number Diff line number Diff line Loading @@ -406,6 +406,15 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_VNDK__") if ctx.inVendor() { flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_VENDOR__") vendorApiLevel := ctx.Config().VendorApiLevel() if vendorApiLevel == "" { // TODO(b/314036847): This is a fallback for UDC targets. // This must be a build failure when UDC is no longer built // from this source tree. vendorApiLevel = ctx.Config().PlatformSdkVersion().String() } flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_VENDOR_API__="+vendorApiLevel) } else if ctx.inProduct() { flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_PRODUCT__") } Loading
rust/bindgen.go +9 −0 Original line number Diff line number Diff line Loading @@ -174,6 +174,15 @@ func (b *bindgenDecorator) GenerateSource(ctx ModuleContext, deps PathDeps) andr cflags = append(cflags, "-D__ANDROID_VNDK__") if ctx.RustModule().InVendor() { cflags = append(cflags, "-D__ANDROID_VENDOR__") vendorApiLevel := ctx.Config().VendorApiLevel() if vendorApiLevel == "" { // TODO(b/314036847): This is a fallback for UDC targets. // This must be a build failure when UDC is no longer built // from this source tree. vendorApiLevel = ctx.Config().PlatformSdkVersion().String() } cflags = append(cflags, "-D__ANDROID_VENDOR_API__="+vendorApiLevel) } else if ctx.RustModule().InProduct() { cflags = append(cflags, "-D__ANDROID_PRODUCT__") } Loading