display: Fix display config version overwrite

Check the availability of the latest version of display config
first, then check older versions if unavailable

Change-Id: I7c4b3bf5295ece9cec323502e8d1365ecef68795
CRs-Fixed: 2338610
diff --git a/common.mk b/common.mk
index 82d247f..bb6494a 100644
--- a/common.mk
+++ b/common.mk
@@ -1,20 +1,31 @@
 #Common headers
 display_top := $(call my-dir)
-display_config_version := $(shell \
-    if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.1" ];\
-    then echo DISPLAY_CONFIG_1_1; fi)
-display_config_version := $(shell \
-    if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.2" ];\
-    then echo DISPLAY_CONFIG_1_2; fi)
-display_config_version := $(shell \
-    if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.3" ];\
-    then echo DISPLAY_CONFIG_1_3; fi)
-display_config_version := $(shell \
-    if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.4" ];\
-    then echo DISPLAY_CONFIG_1_4; fi)
+
+#Get the highest display config version available
 display_config_version := $(shell \
     if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.5" ];\
     then echo DISPLAY_CONFIG_1_5; fi)
+ifeq ($(display_config_version),)
+display_config_version := $(shell \
+    if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.4" ];\
+    then echo DISPLAY_CONFIG_1_4; fi)
+endif
+ifeq ($(display_config_version),)
+display_config_version := $(shell \
+    if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.3" ];\
+    then echo DISPLAY_CONFIG_1_3; fi)
+endif
+ifeq ($(display_config_version),)
+display_config_version := $(shell \
+    if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.2" ];\
+    then echo DISPLAY_CONFIG_1_2; fi)
+endif
+ifeq ($(display_config_version),)
+display_config_version := $(shell \
+    if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.1" ];\
+    then echo DISPLAY_CONFIG_1_1; fi)
+endif
+
 #Common C flags
 common_flags := -Wno-missing-field-initializers
 common_flags += -Wconversion -Wall -Werror -std=c++14