Allow Gui File Selector filter to check among more extensions

For example now in Install menu we are seeing all files with .zip
extension, after this commit we can see also files with .ZIP extension.
Just add the extension between ";" separator.

Change-Id: I6ddd2a812a182570af3d76711b1e3e13740a466b
(cherry picked from commit 27020944c2472c28b12ceccf676d58c2709af890)
diff --git a/gui/fileselector.cpp b/gui/fileselector.cpp
index fe378c8..2778f96 100644
--- a/gui/fileselector.cpp
+++ b/gui/fileselector.cpp
@@ -20,7 +20,15 @@
 #include <sys/stat.h>
 #include <dirent.h>
 #include <algorithm>
-
+#ifdef __ANDROID_API_M__
+#include <vector>
+#ifdef __ANDROID_API_N__
+#include <android-base/strings.h>
+#else
+#include <base/strings.h>
+#endif
+#else
+#endif
 extern "C" {
 #include "../twcommon.h"
 }
@@ -279,11 +287,31 @@
 			if (mShowNavFolders || (data.fileName != "." && data.fileName != ".."))
 				mFolderList.push_back(data);
 		} else if (data.fileType == DT_REG || data.fileType == DT_LNK || data.fileType == DT_BLK) {
-			if (mExtn.empty() || (data.fileName.length() > mExtn.length() && data.fileName.substr(data.fileName.length() - mExtn.length()) == mExtn)) {
-				if (mExtn == ".ab" && twadbbu::Check_ADB_Backup_File(path))
+#ifdef __ANDROID_API_M__
+			std::vector<std::string> mExtnResults = android::base::Split(mExtn, ";");
+			for (const std::string& mExtnElement : mExtnResults)
+			{
+				std::string mExtnName = android::base::Trim(mExtnElement);
+				if (mExtnName.empty() || (data.fileName.length() > mExtnName.length() && data.fileName.substr(data.fileName.length() - mExtnName.length()) == mExtnName)) {
+					if (mExtnName == ".ab" && twadbbu::Check_ADB_Backup_File(path))
+						mFolderList.push_back(data);
+					else
+						mFileList.push_back(data);
+			}
+#else //On android 5.1 we can't use android::base::Trim and Split so just use the first extension written in the list
+			std::size_t seppos = mExtn.find_first_of(";");
+			std::string mExtnf;
+			if (seppos!=std::string::npos){
+				mExtnf = mExtn.substr(0, seppos);
+			} else {
+			mExtnf = mExtn;
+			}
+			if (mExtnf.empty() || (data.fileName.length() > mExtnf.length() && data.fileName.substr(data.fileName.length() - mExtnf.length()) == mExtnf)) {
+				if (mExtnf == ".ab" && twadbbu::Check_ADB_Backup_File(path))
 					mFolderList.push_back(data);
 				else
 					mFileList.push_back(data);
+#endif
 			}
 		}
 	}