Display the watermark on AOSP images

Bug 25638876

Change-Id: If6d84c6e0778e0e45af27b74c92c861001669409
Reviewed-on: https://swiftshader-review.googlesource.com/4252
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Greg Hartman <ghartman@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Android.mk b/src/Android.mk
index be29698..a5f7778 100644
--- a/src/Android.mk
+++ b/src/Android.mk
@@ -82,7 +82,11 @@
 	OpenGL/common/Object.cpp \
 	OpenGL/common/MatrixStack.cpp \
 
-COMMON_CFLAGS := -DLOG_TAG=\"swiftshader\" -Wno-unused-parameter -DDISPLAY_LOGO=0 -Wno-implicit-exception-spec-mismatch -Wno-overloaded-virtual -fno-operator-names -msse2 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -std=c++11
+COMMON_CFLAGS := -DLOG_TAG=\"swiftshader\" -Wno-unused-parameter -Wno-implicit-exception-spec-mismatch -Wno-overloaded-virtual -fno-operator-names -msse2 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -std=c++11
+
+ifneq ($(filter gce_x86 gce calypso, $(TARGET_DEVICE)),)
+COMMON_CFLAGS += -DDISPLAY_LOGO=0
+endif
 
 include $(CLEAR_VARS)
 LOCAL_CLANG := true
diff --git a/src/Main/FrameBuffer.cpp b/src/Main/FrameBuffer.cpp
index 59543ac..2492d26 100644
--- a/src/Main/FrameBuffer.cpp
+++ b/src/Main/FrameBuffer.cpp
@@ -23,8 +23,12 @@
 #include <string.h>
 #include <time.h>
 
+#ifdef __ANDROID__
+#include <cutils/properties.h>
+#endif
+
 #ifndef DISPLAY_LOGO
-#define DISPLAY_LOGO (NDEBUG & 1)
+#define DISPLAY_LOGO ((NDEBUG | __ANDROID__) & 1)
 #endif
 
 #define ASYNCHRONOUS_BLIT 0   // FIXME: Currently leads to rare race conditions
@@ -227,29 +231,13 @@
 		const int sBytes = Surface::bytes(state.sourceFormat);
 		const int sStride = topLeftOrigin ? (sBytes * width2) : -(sBytes * width2);
 
-	//	char compareApp[32] = SCRAMBLE31(validationApp, APPNAME_SCRAMBLE);
-	//	bool validApp = strcmp(compareApp, registeredApp) == 0;
-		bool validKey = ValidateSerialNumber(validationKey, CHECKSUM_KEY, SERIAL_PREFIX);
-
-		// Date of the end of the logo-free license
-		const int endYear = 2099;
-		const int endMonth = 12;
-		const int endDay = 31;
-
-		const int endDate = (endYear << 16) + (endMonth << 8) + endDay;
-
-		time_t rawtime = time(0);
-		tm *timeinfo = localtime(&rawtime);
-		int year = timeinfo->tm_year + 1900;
-		int month = timeinfo->tm_mon + 1;
-		int day = timeinfo->tm_mday;
-
-		int date = (year << 16) + (month << 8) + day;
-
-		if(date > endDate)
-		{
-			validKey = false;
-		}
+		#ifdef __ANDROID__
+			char ro_product_model[PROPERTY_VALUE_MAX] = "";
+    		property_get("ro.product.model", ro_product_model, nullptr);
+			bool validKey = strstr(ro_product_model, "Android") != nullptr;
+		#else
+			bool validKey = ValidateSerialNumber(validationKey, CHECKSUM_KEY, SERIAL_PREFIX);
+		#endif
 
 		Function<Void, Pointer<Byte>, Pointer<Byte> > function;
 		{