diff options
Diffstat (limited to 'cmds/system_server/library')
-rw-r--r-- | cmds/system_server/library/system_init.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/cmds/system_server/library/system_init.cpp b/cmds/system_server/library/system_init.cpp index a29ba73..b615764 100644 --- a/cmds/system_server/library/system_init.cpp +++ b/cmds/system_server/library/system_init.cpp @@ -37,7 +37,7 @@ namespace android { * This class is used to kill this process when the runtime dies. */ class GrimReaper : public IBinder::DeathRecipient { -public: +public: GrimReaper() { } virtual void binderDied(const wp<IBinder>& who) @@ -54,15 +54,15 @@ public: extern "C" status_t system_init() { LOGI("Entered system_init()"); - + sp<ProcessState> proc(ProcessState::self()); - + sp<IServiceManager> sm = defaultServiceManager(); LOGI("ServiceManager: %p\n", sm.get()); - + sp<GrimReaper> grim = new GrimReaper(); sm->asBinder()->linkToDeath(grim, grim.get(), 0); - + char propBuf[PROPERTY_VALUE_MAX]; property_get("system_init.startsurfaceflinger", propBuf, "1"); if (strcmp(propBuf, "1") == 0) { @@ -97,12 +97,23 @@ extern "C" status_t system_init() // the beginning of their processes's main(), before calling // the init function. LOGI("System server: starting Android runtime.\n"); - AndroidRuntime* runtime = AndroidRuntime::getRuntime(); LOGI("System server: starting Android services.\n"); - runtime->callStatic("com/android/server/SystemServer", "init2"); - + JNIEnv* env = runtime->getJNIEnv(); + if (env == NULL) { + return UNKNOWN_ERROR; + } + jclass clazz = env->FindClass("com/android/server/SystemServer"); + if (clazz == NULL) { + return UNKNOWN_ERROR; + } + jmethodID methodId = env->GetStaticMethodID(clazz, "init2", "()V"); + if (methodId == NULL) { + return UNKNOWN_ERROR; + } + env->CallStaticVoidMethod(clazz, methodId); + // If running in our own process, just go into the thread // pool. Otherwise, call the initialization finished // func to let this process continue its initilization. @@ -114,4 +125,3 @@ extern "C" status_t system_init() } return NO_ERROR; } - |