diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-02-10 15:44:00 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-02-10 15:44:00 -0800 |
commit | d24b8183b93e781080b2c16c487e60d51c12da31 (patch) | |
tree | fbb89154858984eb8e41556da7e9433040d55cd4 /services/java/com/android/server/SystemServer.java | |
parent | f1e484acb594a726fb57ad0ae4cfe902c7f35858 (diff) | |
download | frameworks_base-d24b8183b93e781080b2c16c487e60d51c12da31.zip frameworks_base-d24b8183b93e781080b2c16c487e60d51c12da31.tar.gz frameworks_base-d24b8183b93e781080b2c16c487e60d51c12da31.tar.bz2 |
auto import from //branches/cupcake/...@130745
Diffstat (limited to 'services/java/com/android/server/SystemServer.java')
-rw-r--r-- | services/java/com/android/server/SystemServer.java | 82 |
1 files changed, 22 insertions, 60 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 7f7a52e..d624573 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -16,35 +16,36 @@ package com.android.server; +import com.android.server.am.ActivityManagerService; +import com.android.server.status.StatusBarService; + +import dalvik.system.PathClassLoader; +import dalvik.system.VMRuntime; + import android.app.ActivityManagerNative; +import android.content.ComponentName; import android.content.ContentResolver; import android.content.ContentService; import android.content.Context; +import android.content.Intent; import android.content.pm.IPackageManager; import android.database.ContentObserver; import android.database.Cursor; import android.media.AudioService; +import android.os.IBinder; import android.os.Looper; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.os.SystemProperties; -import android.os.IBinder; -import android.provider.Settings; import android.provider.Contacts.People; -import android.server.BluetoothDeviceService; +import android.provider.Settings; import android.server.BluetoothA2dpService; -import android.server.checkin.FallbackCheckinService; +import android.server.BluetoothDeviceService; import android.server.search.SearchManagerService; import android.util.EventLog; import android.util.Log; -import dalvik.system.TouchDex; -import dalvik.system.VMRuntime; - -import com.android.server.am.ActivityManagerService; -import com.android.server.status.StatusBarService; - import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; @@ -180,7 +181,7 @@ class ServerThread extends Thread { StatusBarService statusBar = null; InputMethodManagerService imm = null; - + if (factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) { try { Log.i(TAG, "Starting Status Bar Service."); @@ -205,7 +206,7 @@ class ServerThread extends Thread { } catch (Throwable e) { Log.e(TAG, "Failure starting Input Manager Service", e); } - + try { Log.i(TAG, "Starting Hardware Service."); ServiceManager.addService("hardware", new HardwareService(context)); @@ -272,9 +273,14 @@ class ServerThread extends Thread { } try { - Log.i(TAG, "Starting Checkin Service"); - addService(context, "checkin", "com.google.android.server.checkin.CheckinService", - FallbackCheckinService.class); + Log.i(TAG, "Starting Checkin Service."); + Intent intent = new Intent().setComponent(new ComponentName( + "com.google.android.server.checkin", + "com.google.android.server.checkin.CheckinService")); + if (context.startService(intent) == null) { + Log.w(TAG, "Using fallback Checkin Service."); + ServiceManager.addService("checkin", new FallbackCheckinService(context)); + } } catch (Throwable e) { Log.e(TAG, "Failure starting Checkin Service", e); } @@ -318,6 +324,7 @@ class ServerThread extends Thread { false, new AdbSettingsObserver()); // It is now time to start up the app processes... + boolean safeMode = wm.detectSafeMode(); if (statusBar != null) { statusBar.systemReady(); } @@ -342,51 +349,6 @@ class ServerThread extends Thread { Looper.loop(); Log.d(TAG, "System ServerThread is exiting!"); } - - private void addService(Context context, String name, String serviceClass, - Class<? extends IBinder> fallback) { - - final IBinder service = findService(context, serviceClass, fallback); - if (service != null) { - ServiceManager.addService(name, service); - } else { - Log.e(TAG, "Failure starting service '" + name + "' with class " + serviceClass); - } - } - - private IBinder findService(Context context, String serviceClass, - Class<? extends IBinder> fallback) { - - IBinder service = null; - try { - Class<?> klass = Class.forName(serviceClass); - Constructor<?> c = klass.getConstructor(Context.class); - service = (IBinder) c.newInstance(context); - } catch (ClassNotFoundException e) { - // Ignore - } catch (IllegalAccessException e) { - // Ignore - } catch (NoSuchMethodException e) { - // Ignore - } catch (InvocationTargetException e) { - // Ignore - } catch (InstantiationException e) { - // Ignore - } - - if (service == null && fallback != null) { - Log.w(TAG, "Could not find " + serviceClass + ", trying fallback"); - try { - service = fallback.newInstance(); - } catch (IllegalAccessException e) { - // Ignore - } catch (InstantiationException e) { - // Ignore - } - } - - return service; - } } class DemoThread extends Thread |