diff options
author | Jeff Brown <jeffbrown@google.com> | 2013-07-15 13:22:04 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2013-07-15 15:08:39 -0700 |
commit | ef691179799c11eceea0f118f79a32c47ca9ae96 (patch) | |
tree | 7461b46fcfaa60c0511bcf1cab267a8e72043596 /cmds/system_server/library/system_init.cpp | |
parent | 6c1c0b6cbecf0cd0486a9a781da5e6f9bd2c0eaa (diff) |
Remove dead code in system server initialization.
System server always forks from Zygote so we no longer need
the system_server executable which was probably broken anyhow.
This makes the initialization sequence slightly more intelligible.
Likewise, we don't need the GrimReaper anymore because init
will automatically take care of restarting the system when the
service manager dies.
Change-Id: I02c88d9392f7c8133d9cde9d0d978da89ed80452
Diffstat (limited to 'cmds/system_server/library/system_init.cpp')
-rw-r--r-- | cmds/system_server/library/system_init.cpp | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/cmds/system_server/library/system_init.cpp b/cmds/system_server/library/system_init.cpp deleted file mode 100644 index 699996a5c125..000000000000 --- a/cmds/system_server/library/system_init.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * System server main initialization. - * - * The system server is responsible for becoming the Binder - * context manager, supplying the root ServiceManager object - * through which other services can be found. - */ - -#define LOG_TAG "sysproc" - -#include <binder/IPCThreadState.h> -#include <binder/ProcessState.h> -#include <binder/IServiceManager.h> -#include <binder/TextOutput.h> -#include <utils/Log.h> - -#include <SurfaceFlinger.h> -#include <SensorService.h> - -#include <android_runtime/AndroidRuntime.h> - -#include <signal.h> -#include <stdlib.h> -#include <stdio.h> -#include <unistd.h> -#include <sys/time.h> -#include <cutils/properties.h> - -using namespace android; - -namespace android { -/** - * This class is used to kill this process when the runtime dies. - */ -class GrimReaper : public IBinder::DeathRecipient { -public: - GrimReaper() { } - - virtual void binderDied(const wp<IBinder>& who) - { - ALOGI("Grim Reaper killing system_server..."); - kill(getpid(), SIGKILL); - } -}; - -} // namespace android - - - -extern "C" status_t system_init() -{ - ALOGI("Entered system_init()"); - - sp<ProcessState> proc(ProcessState::self()); - - sp<IServiceManager> sm = defaultServiceManager(); - ALOGI("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.startsensorservice", propBuf, "1"); - if (strcmp(propBuf, "1") == 0) { - // Start the sensor service - SensorService::instantiate(); - } - - // And now start the Android runtime. We have to do this bit - // of nastiness because the Android runtime initialization requires - // some of the core system services to already be started. - // All other servers should just start the Android runtime at - // the beginning of their processes's main(), before calling - // the init function. - ALOGI("System server: starting Android runtime.\n"); - AndroidRuntime* runtime = AndroidRuntime::getRuntime(); - - ALOGI("System server: starting Android services.\n"); - 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; - } - - ALOGI("System server: entering thread pool."); - ProcessState::self()->startThreadPool(); - - // This is the main thread of the system server, and will never exit. - env->CallStaticVoidMethod(clazz, methodId); - - return NO_ERROR; -} |