Improve SELinux support check

If the kernel does not use SELinux security then the ramdisk
contents will not have contexts set on the files, however we may
still have everything we need in recovery if the kernel supports
EXT4 security labels, so we try to check /cache/recovery if it
exists first.

Change-Id: I96a4ae16418e07b0a2e83cd56e19893898d0b394
diff --git a/twrp.cpp b/twrp.cpp
index 3e56af2..06532cb 100644
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -123,7 +123,17 @@
 		printf("SELinux contexts loaded from /file_contexts\n");
 	{ // Check to ensure SELinux can be supported by the kernel
 		char *contexts = NULL;
-		lgetfilecon("/sbin/teamwin", &contexts);
+
+		if (PartitionManager.Mount_By_Path("/cache", true) && TWFunc::Path_Exists("/cache/recovery")) {
+			lgetfilecon("/cache/recovery", &contexts);
+			if (!contexts) {
+				lsetfilecon("/cache/recovery", "test");
+				lgetfilecon("/cache/recovery", &contexts);
+			}
+		} else {
+			LOGINFO("Could not check /cache/recovery SELinux contexts, using /sbin/teamwin instead which may be inaccurate.\n");
+			lgetfilecon("/sbin/teamwin", &contexts);
+		}
 		if (!contexts) {
 			gui_print("Kernel does not have support for reading SELinux contexts.\n");
 		} else {