Allow overriding TARGET_PRODUCT in fingerprint

We're using build properties to differentiate between different flavors
at build time while still having aligned properties in the build output.

The build fingerprint needs separate handling because it gets set very
early during build configuration and build property overrides cannot
apply yet.

Issue: FP4-INT#19
Change-Id: I5b2f957fc760d036fbe038d8d05708ade56d7223
(cherry picked from commit be1767181faf50802312c359193cda38bca51dd2)
diff --git a/core/sysprop.mk b/core/sysprop.mk
index a6c8539..74cee09 100644
--- a/core/sysprop.mk
+++ b/core/sysprop.mk
@@ -172,7 +172,12 @@
   else
     BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
   endif
-  BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
+  ifeq (,$(strip $(TARGET_PRODUCT_OVERRIDE)))
+    TARGET_PRODUCT_OVERRIDE := $(TARGET_PRODUCT)
+  else
+    $(warning Overriding TARGET_PRODUCT in BUILD_FINGERPRINT to $(TARGET_PRODUCT_OVERRIDE))
+  endif
+  BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT_OVERRIDE)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
 endif
 # unset it for safety.
 BF_BUILD_NUMBER :=