From 09627c8a55cc3e18b538fc3f47e5b58bf6b8454d Mon Sep 17 00:00:00 2001
From: Lingfeng Yang <lfy@google.com>
Date: Mon, 6 May 2019 16:07:21 -0700
Subject: [PATCH] Fix build on older APIs, take 2

There can be periods in the platform version, so it's not safe to use.
Just run PLATFORM_SDK_VERSION instead.

Bug: 131089111

Change-Id: I72c0af3407f88753cf69b2ba2565b221345d3f3a
---
 Android.mk                 | 1 -
 system/gralloc/gralloc.cpp | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/Android.mk b/Android.mk
index ce7c599..6cf4651 100644
--- a/Android.mk
+++ b/Android.mk
@@ -73,7 +73,6 @@ ifeq (true,$(BUILD_EMULATOR_OPENGL)) # Guest build
 GOLDFISH_OPENGL_SHOULD_BUILD := true
 
 EMUGL_COMMON_CFLAGS += -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
-EMUGL_COMMON_CFLAGS += -DPLATFORM_VERSION=$(PLATFORM_VERSION)
 
 ifeq (O, $(PLATFORM_VERSION_CODENAME))
 EMUGL_COMMON_CFLAGS += -DGOLDFISH_HIDL_GRALLOC
diff --git a/system/gralloc/gralloc.cpp b/system/gralloc/gralloc.cpp
index fa30e50..d76ac0b 100644
--- a/system/gralloc/gralloc.cpp
+++ b/system/gralloc/gralloc.cpp
@@ -1542,10 +1542,10 @@ struct private_module_t HAL_MODULE_INFO_SYM = {
         lock: gralloc_lock,
         unlock: gralloc_unlock,
         perform: NULL,
-#if PLATFORM_VERSION > 9 // In Q, we want to specify these, but SDK version is not 29 yet.
+#if PLATFORM_SDK_VERSION >= 28 // In Q, we want to specify these, but SDK version is not 29 yet. do not merge this to P
         validateBufferSize: NULL,
         getTransportSize: NULL,
-#endif // PLATFORM_VERSION > 9
+#endif // PLATFORM_VERSION > 28
 #if PLATFORM_SDK_VERSION >= 18
         lock_ycbcr: gralloc_lock_ycbcr,
 #endif // PLATFORM_SDK_VERSION >= 18
-- 
GitLab