Define __ANDROID_VENDOR__ and __ANDROID_PRODUCT__

__ANDROID_VNDK__ is defined for the modules that are able to use the
VNDK libraries. As both product and vendor variants define
__ANDROID_VNDK__, we don't know if a module is built for vendor or
product on build time.

__ANDROID_VENDOR__ and __ANDROID_PRODUCT__ macros can be used to
specify the image-variant-dependent codes.

Bug: 180646847
Test: m nothing
Change-Id: Id6c3e1e3d47deaf3684c0c02964718658cf2fec5
diff --git a/cc/compiler.go b/cc/compiler.go
index 2e71922..bcad1ad 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -357,6 +357,11 @@
 
 	if ctx.useVndk() {
 		flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_VNDK__")
+		if ctx.inVendor() {
+			flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_VENDOR__")
+		} else if ctx.inProduct() {
+			flags.Global.CommonFlags = append(flags.Global.CommonFlags, "-D__ANDROID_PRODUCT__")
+		}
 	}
 
 	if ctx.inRecovery() {