diff options
author | Calin Juravle <calin@google.com> | 2014-10-28 19:28:42 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-10-28 19:28:42 +0000 |
commit | 5d4deb8246b13531a6b2b7611c650ba504e44dc6 (patch) | |
tree | abac3e09be346ebadd60eed19740edc8a27ba898 /core | |
parent | 87ce99ca7243e4556a6cfe9f42cc51531301e979 (diff) | |
parent | f7d24d244319599f62c22e29c3e6540d6cbadf49 (diff) | |
download | frameworks_base-5d4deb8246b13531a6b2b7611c650ba504e44dc6.zip frameworks_base-5d4deb8246b13531a6b2b7611c650ba504e44dc6.tar.gz frameworks_base-5d4deb8246b13531a6b2b7611c650ba504e44dc6.tar.bz2 |
am f7d24d24: Merge "PreInitializeNativeBridge only if its Available"
* commit 'f7d24d244319599f62c22e29c3e6540d6cbadf49':
PreInitializeNativeBridge only if its Available
Diffstat (limited to 'core')
-rw-r--r-- | core/jni/com_android_internal_os_Zygote.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp index d70b735..bb4394d 100644 --- a/core/jni/com_android_internal_os_Zygote.cpp +++ b/core/jni/com_android_internal_os_Zygote.cpp @@ -418,6 +418,10 @@ static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArra pid_t pid = fork(); if (pid == 0) { + if (!is_system_server && dataDir == NULL) { + ALOGE("Application private dir cannot be null"); + RuntimeAbort(env); + } // The child process. gMallocLeakZygoteChild = 1; @@ -431,13 +435,14 @@ static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArra DropCapabilitiesBoundingSet(env); - bool need_native_bridge = false; - if (instructionSet != NULL) { + bool use_native_bridge = !is_system_server && (instructionSet != NULL) + && android::NativeBridgeAvailable(); + if (use_native_bridge) { ScopedUtfChars isa_string(env, instructionSet); - need_native_bridge = android::NeedsNativeBridge(isa_string.c_str()); + use_native_bridge = android::NeedsNativeBridge(isa_string.c_str()); } - if (!MountEmulatedStorage(uid, mount_external, need_native_bridge)) { + if (!MountEmulatedStorage(uid, mount_external, use_native_bridge)) { ALOGW("Failed to mount emulated storage: %s", strerror(errno)); if (errno == ENOTCONN || errno == EROFS) { // When device is actively encrypting, we get ENOTCONN here @@ -466,15 +471,10 @@ static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArra SetRLimits(env, javaRlimits); - if (!is_system_server && need_native_bridge) { - // Set the environment for the apps running with native bridge. - ScopedUtfChars isa_string(env, instructionSet); // Known non-null because of need_native_... - if (dataDir == NULL) { - android::PreInitializeNativeBridge(NULL, isa_string.c_str()); - } else { - ScopedUtfChars data_dir(env, dataDir); - android::PreInitializeNativeBridge(data_dir.c_str(), isa_string.c_str()); - } + if (use_native_bridge) { + ScopedUtfChars isa_string(env, instructionSet); + ScopedUtfChars data_dir(env, dataDir); + android::PreInitializeNativeBridge(data_dir.c_str(), isa_string.c_str()); } int rc = setresgid(gid, gid, gid); |