stlport library is needed for versions of Android before M

Conditionally include it based on the Android version

Change-Id: I4b17e3c0f61a6fd2b0b1e48ed1efe16e0a446dfc
diff --git a/Android.mk b/Android.mk
index fd6d109..5786156 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,3 +1,16 @@
+# For Android L MR1 and lower, need to include libstlport
+# For M, this is not needed
+MAJOR_VERSION := $(shell echo $(PLATFORM_VERSION) | cut -f1 -d.)
+MINOR_VERSION := $(shell echo $(PLATFORM_VERSION) | cut -f2 -d.)
+
+ifeq ($(shell test $(MAJOR_VERSION) -le 4 && echo 1), 1)
+INCLUDE_STLPORT:=true
+else ifeq ($(shell test $(MAJOR_VERSION) -eq 5 -a $(MINOR_VERSION) -le 1 && echo 1), 1)
+INCLUDE_STLPORT:=true
+else
+INCLUDE_STLPORT:=false
+endif
+
 # Recursive call sub-folder Android.mk
 #
 ifeq ($(HOST_OS),linux)
diff --git a/parameter/Android.mk b/parameter/Android.mk
index 4ce29f1..869ab79 100644
--- a/parameter/Android.mk
+++ b/parameter/Android.mk
@@ -160,6 +160,11 @@
 LOCAL_REQUIRED_MODULES := libremote-processor
 
 LOCAL_CLANG := false
+
+ifeq ($(INCLUDE_STLPORT), true)
+include external/stlport/libstlport.mk
+endif
+
 include $(BUILD_SHARED_LIBRARY)
 
 ##############################
diff --git a/remote-process/Android.mk b/remote-process/Android.mk
index 53d3ae6..a29b834 100644
--- a/remote-process/Android.mk
+++ b/remote-process/Android.mk
@@ -67,6 +67,9 @@
 LOCAL_SHARED_LIBRARIES := $(common_shared_libraries)
 LOCAL_STATIC_LIBRARIES := $(common_static_libraries)
 
+ifeq ($(INCLUDE_STLPORT), true)
+include external/stlport/libstlport.mk
+endif
 
 include $(BUILD_EXECUTABLE)
 
diff --git a/remote-processor/Android.mk b/remote-processor/Android.mk
index b8050b1..61e1f22 100644
--- a/remote-processor/Android.mk
+++ b/remote-processor/Android.mk
@@ -67,6 +67,10 @@
 LOCAL_MODULE_OWNER := intel
 LOCAL_MODULE_TAGS := $(common_module_tags)
 
+ifeq ($(INCLUDE_STLPORT), true)
+include external/stlport/libstlport.mk
+endif
+
 include $(BUILD_SHARED_LIBRARY)
 
 ##############################
diff --git a/test/test-platform/Android.mk b/test/test-platform/Android.mk
index e46ad57..a96c8c3 100644
--- a/test/test-platform/Android.mk
+++ b/test/test-platform/Android.mk
@@ -63,6 +63,10 @@
 LOCAL_STATIC_LIBRARIES := libpfw_utility
 LOCAL_SHARED_LIBRARIES := $(common_shared_libraries)
 
+ifeq ($(INCLUDE_STLPORT), true)
+include external/stlport/libstlport.mk
+endif
+
 include $(BUILD_EXECUTABLE)
 
 ##############################
diff --git a/utility/Android.mk b/utility/Android.mk
index 09f3de7..25a99a7 100644
--- a/utility/Android.mk
+++ b/utility/Android.mk
@@ -60,6 +60,10 @@
 
 LOCAL_CFLAGS := $(common_cflags)
 
+ifeq ($(INCLUDE_STLPORT), true)
+include external/stlport/libstlport.mk
+endif
+
 include $(BUILD_STATIC_LIBRARY)
 
 ##############################
diff --git a/xmlserializer/Android.mk b/xmlserializer/Android.mk
index eedf48b..2df90fe 100644
--- a/xmlserializer/Android.mk
+++ b/xmlserializer/Android.mk
@@ -79,6 +79,10 @@
 
 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
 
+ifeq ($(INCLUDE_STLPORT), true)
+include external/stlport/libstlport.mk
+endif
+
 include $(BUILD_STATIC_LIBRARY)
 
 ##############################