summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorYuanQY <yuanqingyun@gmail.com>2013-07-24 13:03:02 +0800
committerYuanQY <yuanqingyun@gmail.com>2013-07-24 13:10:20 +0800
commita7ff85259da302167539ab39bc008f2e92864018 (patch)
treed5ce5ca97996d3f80eaac13c9b5c0b6c99aacaed /core
parent4ff298acd7539011e192b75cd7f09c6b63487811 (diff)
downloadframeworks_base-a7ff85259da302167539ab39bc008f2e92864018.zip
frameworks_base-a7ff85259da302167539ab39bc008f2e92864018.tar.gz
frameworks_base-a7ff85259da302167539ab39bc008f2e92864018.tar.bz2
android_os_SELinux : Use empty array to instead of NULL to avoid the DevicePolicyManagerService cannot start when the SELinux is disabled.
Error log 07-24 10:32:14.408 F/SystemServer( 1676): BOOT FAILURE making Device Policy Service ready 07-24 10:32:14.408 F/SystemServer( 1676): java.lang.NullPointerException 07-24 10:32:14.408 F/SystemServer( 1676): at com.android.server.zh(DevicePolicyManagerService.java:2628) 07-24 10:32:14.408 F/SystemServer( 1676): at com.android.server.DevicePolicyManagerService.systemReady(DevicePolicyManagerService.java:1251) 07-24 10:32:14.408 F/SystemServer( 1676): at com.android.server.ServerThread.run(SystemServer.java:941) Patch Set 2: Append the error log. Change-Id: I31be031c356ef8e293de0395feefb34ced628341
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;
}
/*