summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-08-08 23:07:10 +0000
committerGerrit Code Review <gerrit@cyanogenmod.org>2013-08-08 23:07:10 +0000
commitd544f659c3430ff16123a5f2fb82bb9018eead69 (patch)
tree91886bf05af2e547718faf3c4d11f5bd4444ea1d /core
parent68a1c87c3030121aa5a5e4d3eb73dbec05dca779 (diff)
parenta7ff85259da302167539ab39bc008f2e92864018 (diff)
downloadframeworks_base-d544f659c3430ff16123a5f2fb82bb9018eead69.zip
frameworks_base-d544f659c3430ff16123a5f2fb82bb9018eead69.tar.gz
frameworks_base-d544f659c3430ff16123a5f2fb82bb9018eead69.tar.bz2
Merge "android_os_SELinux : Use empty array to instead of NULL to avoid the DevicePolicyManagerService cannot start when the SELinux is disabled." into cm-10.1
Diffstat (limited to 'core')
-rw-r--r--core/jni/android_os_SELinux.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/core/jni/android_os_SELinux.cpp b/core/jni/android_os_SELinux.cpp
index e813c38..ef3d531 100644
--- a/core/jni/android_os_SELinux.cpp
+++ b/core/jni/android_os_SELinux.cpp
@@ -335,19 +335,20 @@ namespace android {
* Exceptions: None
*/
static jobjectArray getBooleanNames(JNIEnv *env, JNIEnv clazz) {
-#ifdef HAVE_SELINUX
- if (isSELinuxDisabled)
- return NULL;
+ jclass stringClass = env->FindClass("java/lang/String");
+ jobjectArray stringArray = env->NewObjectArray(0, stringClass, NULL);
+#ifdef HAVE_SELINUX
char **list;
int i, len, ret;
- jclass stringClass;
- jobjectArray stringArray = NULL;
+
+ if (isSELinuxDisabled)
+ return stringArray;
if (security_get_boolean_names(&list, &len) == -1)
- return NULL;
+ return stringArray;
- stringClass = env->FindClass("java/lang/String");
+ env->DeleteLocalRef(stringArray);
stringArray = env->NewObjectArray(len, stringClass, env->NewStringUTF(""));
for (i = 0; i < len; i++) {
jstring obj;
@@ -357,11 +358,8 @@ namespace android {
free(list[i]);
}
free(list);
-
- return stringArray;
-#else
- return NULL;
#endif
+ return stringArray;
}
/*