All of lore.kernel.org
 help / color / mirror / Atom feed
* Adding support for ro.build.selinux to Android.os.SELinux
@ 2012-07-10 23:49 William Roberts
  2012-07-11 12:46 ` Stephen Smalley
  0 siblings, 1 reply; 2+ messages in thread
From: William Roberts @ 2012-07-10 23:49 UTC (permalink / raw)
  To: selinux; +Cc: rpcraig

[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1589 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-11 12:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-10 23:49 Adding support for ro.build.selinux to Android.os.SELinux William Roberts
2012-07-11 12:46 ` Stephen Smalley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.