Wasn't sure if we wanted to move away from going through a JNI binding since we now have access to ro.build.selinux.
This is some rough draft code, didn't know if we wanted to replace SELinux.isSELinuxEnabled() or augment another function for it.
Please advise.
Bill
diff --git a/core/java/android/os/SELinux.java b/core/java/android/os/SELinux.java
index 0ad24b7..59ae38b 100644
--- a/core/java/android/os/SELinux.java
+++ b/core/java/android/os/SELinux.java
@@ -109,4 +109,19 @@ public class SELinux {
* @return a boolean indicating whether the relabeling succeeded.
*/
public static final native boolean restorecon(String pathname);
+
+
+ /**
+ * Determines if the platform was built with SELinux Support.
+ * @return a boolean indicating whether or not the system was
+ * built with HAVE_SELINUX:=true.
+ */
+ public static final boolean isSystemSupported() {
+
+ Properties props = new Properties();
+ String selinuxStatus = props.getProperty("ro.build.selinux");
+
+ return selinuxStatus.equals("1") ? true : false;
+ }
+
}
Respectfully,
William C Roberts