diff options
author | Kenny Root <kroot@google.com> | 2012-10-16 23:28:21 -0700 |
---|---|---|
committer | Kenny Root <kroot@google.com> | 2012-10-16 23:32:31 -0700 |
commit | c9a1aabc49d31370e3bf41f85b805499640230b1 (patch) | |
tree | f92e4d72caf27ece69a5a811f90b7b4f3a442be5 /core/jni | |
parent | 826343138dfd8666d2263dd82bfdbf657fc1881e (diff) | |
download | frameworks_base-c9a1aabc49d31370e3bf41f85b805499640230b1.zip frameworks_base-c9a1aabc49d31370e3bf41f85b805499640230b1.tar.gz frameworks_base-c9a1aabc49d31370e3bf41f85b805499640230b1.tar.bz2 |
Remove HAVE_SELINUX guards
Change-Id: I6c2161471f657aa1645695ffd56ff434b0c2b426
Diffstat (limited to 'core/jni')
-rw-r--r-- | core/jni/Android.mk | 7 | ||||
-rw-r--r-- | core/jni/android_os_SELinux.cpp | 57 |
2 files changed, 1 insertions, 63 deletions
diff --git a/core/jni/Android.mk b/core/jni/Android.mk index 6f3653d..9b89a8b 100644 --- a/core/jni/Android.mk +++ b/core/jni/Android.mk @@ -205,6 +205,7 @@ LOCAL_SHARED_LIBRARIES := \ libETC1 \ libhardware \ libhardware_legacy \ + libselinux \ libsonivox \ libcrypto \ libssl \ @@ -218,12 +219,6 @@ LOCAL_SHARED_LIBRARIES := \ libharfbuzz \ libz -ifeq ($(HAVE_SELINUX),true) -LOCAL_C_INCLUDES += external/libselinux/include -LOCAL_SHARED_LIBRARIES += libselinux -LOCAL_CFLAGS += -DHAVE_SELINUX -endif # HAVE_SELINUX - ifeq ($(USE_OPENGL_RENDERER),true) LOCAL_SHARED_LIBRARIES += libhwui endif diff --git a/core/jni/android_os_SELinux.cpp b/core/jni/android_os_SELinux.cpp index e813c38..b12fdfc 100644 --- a/core/jni/android_os_SELinux.cpp +++ b/core/jni/android_os_SELinux.cpp @@ -20,10 +20,8 @@ #include "JNIHelp.h" #include "jni.h" #include "android_runtime/AndroidRuntime.h" -#ifdef HAVE_SELINUX #include "selinux/selinux.h" #include "selinux/android.h" -#endif #include <errno.h> namespace android { @@ -56,11 +54,7 @@ namespace android { * Exceptions: none */ static jboolean isSELinuxEnforced(JNIEnv *env, jobject clazz) { -#ifdef HAVE_SELINUX return (security_getenforce() == 1) ? true : false; -#else - return false; -#endif } /* @@ -71,16 +65,12 @@ namespace android { * Exceptions: none */ static jboolean setSELinuxEnforce(JNIEnv *env, jobject clazz, jboolean value) { -#ifdef HAVE_SELINUX if (isSELinuxDisabled) return false; int enforce = (value) ? 1 : 0; return (security_setenforce(enforce) != -1) ? true : false; -#else - return false; -#endif } /* @@ -92,7 +82,6 @@ namespace android { * Exceptions: NullPointerException if fileDescriptor object is NULL */ static jstring getPeerCon(JNIEnv *env, jobject clazz, jobject fileDescriptor) { -#ifdef HAVE_SELINUX if (isSELinuxDisabled) return NULL; @@ -123,9 +112,6 @@ namespace android { freecon(context); return securityString; -#else - return NULL; -#endif } /* @@ -138,7 +124,6 @@ namespace android { * Exception: none */ static jboolean setFSCreateCon(JNIEnv *env, jobject clazz, jstring context) { -#ifdef HAVE_SELINUX if (isSELinuxDisabled) return false; @@ -163,9 +148,6 @@ namespace android { env->ReleaseStringUTFChars(context, constant_securityContext); return (ret == 0) ? true : false; -#else - return false; -#endif } /* @@ -178,7 +160,6 @@ namespace android { * Exception: NullPointerException is thrown if either path or context strign are NULL */ static jboolean setFileCon(JNIEnv *env, jobject clazz, jstring path, jstring con) { -#ifdef HAVE_SELINUX if (isSELinuxDisabled) return false; @@ -208,9 +189,6 @@ namespace android { env->ReleaseStringUTFChars(path, objectPath); env->ReleaseStringUTFChars(con, constant_con); return (ret == 0) ? true : false; -#else - return false; -#endif } /* @@ -224,7 +202,6 @@ namespace android { * Exceptions: NullPointerException if the path object is null */ static jstring getFileCon(JNIEnv *env, jobject clazz, jstring path) { -#ifdef HAVE_SELINUX if (isSELinuxDisabled) return NULL; @@ -252,9 +229,6 @@ namespace android { env->ReleaseStringUTFChars(path, objectPath); return securityString; -#else - return NULL; -#endif } /* @@ -266,7 +240,6 @@ namespace android { * Exceptions: none */ static jstring getCon(JNIEnv *env, jobject clazz) { -#ifdef HAVE_SELINUX if (isSELinuxDisabled) return NULL; @@ -285,9 +258,6 @@ namespace android { freecon(context); return securityString; -#else - return NULL; -#endif } /* @@ -300,7 +270,6 @@ namespace android { * Exceptions: none */ static jstring getPidCon(JNIEnv *env, jobject clazz, jint pid) { -#ifdef HAVE_SELINUX if (isSELinuxDisabled) return NULL; @@ -321,9 +290,6 @@ namespace android { freecon(context); return securityString; -#else - return NULL; -#endif } /* @@ -335,7 +301,6 @@ namespace android { * Exceptions: None */ static jobjectArray getBooleanNames(JNIEnv *env, JNIEnv clazz) { -#ifdef HAVE_SELINUX if (isSELinuxDisabled) return NULL; @@ -359,9 +324,6 @@ namespace android { free(list); return stringArray; -#else - return NULL; -#endif } /* @@ -373,7 +335,6 @@ namespace android { * Exceptions: None */ static jboolean getBooleanValue(JNIEnv *env, jobject clazz, jstring name) { -#ifdef HAVE_SELINUX if (isSELinuxDisabled) return false; @@ -386,9 +347,6 @@ namespace android { ret = security_get_boolean_active(boolean_name); env->ReleaseStringUTFChars(name, boolean_name); return (ret == 1) ? true : false; -#else - return false; -#endif } /* @@ -401,7 +359,6 @@ namespace android { * Exceptions: None */ static jboolean setBooleanValue(JNIEnv *env, jobject clazz, jstring name, jboolean value) { -#ifdef HAVE_SELINUX if (isSELinuxDisabled) return false; @@ -420,9 +377,6 @@ namespace android { return false; return true; -#else - return false; -#endif } /* @@ -436,7 +390,6 @@ namespace android { * Exceptions: None */ static jboolean checkSELinuxAccess(JNIEnv *env, jobject clazz, jstring scon, jstring tcon, jstring tclass, jstring perm) { -#ifdef HAVE_SELINUX if (isSELinuxDisabled) return true; @@ -468,10 +421,6 @@ namespace android { bail: return (accessGranted == 0) ? true : false; - -#else - return true; -#endif } /* @@ -482,7 +431,6 @@ namespace android { * Exceptions: none */ static jboolean native_restorecon(JNIEnv *env, jobject clazz, jstring pathname) { -#ifdef HAVE_SELINUX if (isSELinuxDisabled) return true; @@ -490,9 +438,6 @@ namespace android { int ret = selinux_android_restorecon(file); env->ReleaseStringUTFChars(pathname, file); return (ret == 0); -#else - return true; -#endif } /* @@ -526,14 +471,12 @@ namespace android { } int register_android_os_SELinux(JNIEnv *env) { -#ifdef HAVE_SELINUX union selinux_callback cb; cb.func_log = log_callback; selinux_set_callback(SELINUX_CB_LOG, cb); isSELinuxDisabled = (is_selinux_enabled() != 1) ? true : false; -#endif return AndroidRuntime::registerNativeMethods( env, "android/os/SELinux", method_table, NELEM(method_table)); |