| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.server; |
| 18 | |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 19 | import android.app.ActivityManagerNative; |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 20 | import android.app.ActivityThread; |
| Adam Lesinski | ef2ea1f | 2013-12-05 16:48:06 -0800 | [diff] [blame] | 21 | import android.app.IAlarmManager; |
| 22 | import android.app.INotificationManager; |
| Nick Pelly | f242b7b | 2009-10-08 00:12:45 +0200 | [diff] [blame] | 23 | import android.bluetooth.BluetoothAdapter; |
| Joe Onorato | f3c3c4f | 2010-10-21 11:09:02 -0400 | [diff] [blame] | 24 | import android.content.ComponentName; |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 25 | import android.content.ContentResolver; |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | import android.content.Context; |
| Joe Onorato | f3c3c4f | 2010-10-21 11:09:02 -0400 | [diff] [blame] | 27 | import android.content.Intent; |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 28 | import android.content.pm.IPackageManager; |
| Matthew Xie | 1dd01eb3 | 2013-04-26 12:37:54 -0700 | [diff] [blame] | 29 | import android.content.pm.PackageManager; |
| Joe Onorato | dc565f4 | 2010-10-04 15:27:22 -0400 | [diff] [blame] | 30 | import android.content.res.Configuration; |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 31 | import android.media.AudioService; |
| Jeff Sharkey | 48749fc | 2013-04-19 13:25:04 -0700 | [diff] [blame] | 32 | import android.os.Environment; |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 33 | import android.os.FactoryTest; |
| Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 34 | import android.os.Handler; |
| Amith Yamasani | 817ec49 | 2013-12-20 13:27:30 -0800 | [diff] [blame] | 35 | import android.os.IBinder; |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 36 | import android.os.IPowerManager; |
| Jeff Hamilton | 35eef70 | 2010-06-09 15:45:18 -0500 | [diff] [blame] | 37 | import android.os.Looper; |
| 38 | import android.os.RemoteException; |
| 39 | import android.os.ServiceManager; |
| Brad Fitzpatrick | c74a1b44 | 2010-09-10 16:03:29 -0700 | [diff] [blame] | 40 | import android.os.StrictMode; |
| Jeff Hamilton | 35eef70 | 2010-06-09 15:45:18 -0500 | [diff] [blame] | 41 | import android.os.SystemClock; |
| 42 | import android.os.SystemProperties; |
| Amith Yamasani | cd75706 | 2012-10-19 18:23:52 -0700 | [diff] [blame] | 43 | import android.os.UserHandle; |
| Dianne Hackborn | be87e2f | 2012-09-28 16:31:34 -0700 | [diff] [blame] | 44 | import android.service.dreams.DreamService; |
| Joe Onorato | dc565f4 | 2010-10-04 15:27:22 -0400 | [diff] [blame] | 45 | import android.util.DisplayMetrics; |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 46 | import android.util.EventLog; |
| Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 47 | import android.util.Log; |
| Joe Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 48 | import android.util.Slog; |
| Brad Fitzpatrick | 5fdc0c7 | 2010-10-12 13:12:18 -0700 | [diff] [blame] | 49 | import android.view.WindowManager; |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 50 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 51 | import com.android.internal.R; |
| Jeff Sharkey | c006f1a | 2011-05-19 17:12:49 -0700 | [diff] [blame] | 52 | import com.android.internal.os.BinderInternal; |
| 53 | import com.android.internal.os.SamplingProfilerIntegration; |
| Adam Lesinski | 6c6cd50 | 2014-03-17 12:54:03 -0700 | [diff] [blame] | 54 | import com.android.server.accessibility.AccessibilityManagerService; |
| Jeff Sharkey | 7a96c39 | 2012-11-15 14:01:46 -0800 | [diff] [blame] | 55 | import com.android.server.accounts.AccountManagerService; |
| Jeff Sharkey | c006f1a | 2011-05-19 17:12:49 -0700 | [diff] [blame] | 56 | import com.android.server.am.ActivityManagerService; |
| Jeff Brown | 9630704 | 2012-07-27 15:51:34 -0700 | [diff] [blame] | 57 | import com.android.server.am.BatteryStatsService; |
| Amith Yamasani | 30f8eb4 | 2013-11-06 14:54:50 -0800 | [diff] [blame] | 58 | import com.android.server.clipboard.ClipboardService; |
| Jeff Sharkey | 7a96c39 | 2012-11-15 14:01:46 -0800 | [diff] [blame] | 59 | import com.android.server.content.ContentService; |
| Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 60 | import com.android.server.display.DisplayManagerService; |
| Jeff Brown | cef440f | 2012-09-25 18:58:48 -0700 | [diff] [blame] | 61 | import com.android.server.dreams.DreamManagerService; |
| Jeff Brown | 6ec6f79 | 2012-04-17 16:52:41 -0700 | [diff] [blame] | 62 | import com.android.server.input.InputManagerService; |
| Adam Lesinski | ef2ea1f | 2013-12-05 16:48:06 -0800 | [diff] [blame] | 63 | import com.android.server.lights.LightsManager; |
| 64 | import com.android.server.lights.LightsService; |
| Jeff Brown | 69b0716 | 2013-11-07 00:30:16 -0800 | [diff] [blame] | 65 | import com.android.server.media.MediaRouterService; |
| RoboErik | 01fe661 | 2014-02-13 14:19:04 -0800 | [diff] [blame] | 66 | import com.android.server.media.MediaSessionService; |
| Jeff Sharkey | c006f1a | 2011-05-19 17:12:49 -0700 | [diff] [blame] | 67 | import com.android.server.net.NetworkPolicyManagerService; |
| Jeff Sharkey | 7527990 | 2011-05-24 18:39:45 -0700 | [diff] [blame] | 68 | import com.android.server.net.NetworkStatsService; |
| Adam Lesinski | ef2ea1f | 2013-12-05 16:48:06 -0800 | [diff] [blame] | 69 | import com.android.server.notification.NotificationManagerService; |
| Jeff Sharkey | 7a96c39 | 2012-11-15 14:01:46 -0800 | [diff] [blame] | 70 | import com.android.server.os.SchedulingPolicyService; |
| Jeff Brown | f69c812 | 2012-09-12 17:00:34 -0700 | [diff] [blame] | 71 | import com.android.server.pm.Installer; |
| Jeff Sharkey | c006f1a | 2011-05-19 17:12:49 -0700 | [diff] [blame] | 72 | import com.android.server.pm.PackageManagerService; |
| Amith Yamasani | 258848d | 2012-08-10 17:06:33 -0700 | [diff] [blame] | 73 | import com.android.server.pm.UserManagerService; |
| Jeff Brown | 4f8ecd8 | 2012-06-18 18:29:13 -0700 | [diff] [blame] | 74 | import com.android.server.power.PowerManagerService; |
| 75 | import com.android.server.power.ShutdownThread; |
| Jeff Sharkey | 7a96c39 | 2012-11-15 14:01:46 -0800 | [diff] [blame] | 76 | import com.android.server.search.SearchManagerService; |
| Adam Lesinski | ef2ea1f | 2013-12-05 16:48:06 -0800 | [diff] [blame] | 77 | import com.android.server.statusbar.StatusBarManagerService; |
| 78 | import com.android.server.storage.DeviceStorageMonitorService; |
| Adam Lesinski | ef2ea1f | 2013-12-05 16:48:06 -0800 | [diff] [blame] | 79 | import com.android.server.twilight.TwilightService; |
| Jeff Sharkey | c006f1a | 2011-05-19 17:12:49 -0700 | [diff] [blame] | 80 | import com.android.server.usb.UsbService; |
| Amith Yamasani | 30f8eb4 | 2013-11-06 14:54:50 -0800 | [diff] [blame] | 81 | import com.android.server.wallpaper.WallpaperManagerService; |
| Jeff Sharkey | c006f1a | 2011-05-19 17:12:49 -0700 | [diff] [blame] | 82 | import com.android.server.wm.WindowManagerService; |
| 83 | |
| 84 | import dalvik.system.VMRuntime; |
| 85 | import dalvik.system.Zygote; |
| 86 | |
| Dan Egnor | 4410ec8 | 2009-09-11 16:40:01 -0700 | [diff] [blame] | 87 | import java.io.File; |
| Bob Lee | e540833 | 2009-09-04 18:31:17 -0700 | [diff] [blame] | 88 | import java.util.Timer; |
| 89 | import java.util.TimerTask; |
| 90 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 91 | public final class SystemServer { |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 92 | private static final String TAG = "SystemServer"; |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 93 | |
| Ben Komalo | 553acf0 | 2011-09-19 14:25:28 -0700 | [diff] [blame] | 94 | private static final String ENCRYPTING_STATE = "trigger_restart_min_framework"; |
| Ben Komalo | 3573d40 | 2011-09-23 15:08:24 -0700 | [diff] [blame] | 95 | private static final String ENCRYPTED_STATE = "1"; |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 96 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 97 | private static final long SNAPSHOT_INTERVAL = 60 * 60 * 1000; // 1hr |
| 98 | |
| 99 | // The earliest supported time. We pick one day into 1970, to |
| 100 | // give any timezone code room without going into negative time. |
| 101 | private static final long EARLIEST_SUPPORTED_TIME = 86400 * 1000; |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 102 | |
| Amith Yamasani | 817ec49 | 2013-12-20 13:27:30 -0800 | [diff] [blame] | 103 | /* |
| 104 | * Implementation class names. TODO: Move them to a codegen class or load |
| 105 | * them from the build system somehow. |
| 106 | */ |
| 107 | private static final String BACKUP_MANAGER_SERVICE_CLASS = |
| Jeff Brown | b880d88 | 2014-02-10 19:47:07 -0800 | [diff] [blame] | 108 | "com.android.server.backup.BackupManagerService$Lifecycle"; |
| Amith Yamasani | 817ec49 | 2013-12-20 13:27:30 -0800 | [diff] [blame] | 109 | private static final String DEVICE_POLICY_MANAGER_SERVICE_CLASS = |
| Jeff Brown | b880d88 | 2014-02-10 19:47:07 -0800 | [diff] [blame] | 110 | "com.android.server.devicepolicy.DevicePolicyManagerService$Lifecycle"; |
| Amith Yamasani | 817ec49 | 2013-12-20 13:27:30 -0800 | [diff] [blame] | 111 | private static final String APPWIDGET_SERVICE_CLASS = |
| 112 | "com.android.server.appwidget.AppWidgetService"; |
| 113 | private static final String PRINT_MANAGER_SERVICE_CLASS = |
| 114 | "com.android.server.print.PrintManagerService"; |
| Adam Lesinski | 2cb6c60 | 2014-02-14 17:19:56 -0800 | [diff] [blame] | 115 | private static final String USB_SERVICE_CLASS = |
| 116 | "com.android.server.usb.UsbService$Lifecycle"; |
| Adam Lesinski | f542a33 | 2014-02-19 12:29:58 -0800 | [diff] [blame] | 117 | private static final String WIFI_SERVICE_CLASS = |
| 118 | "com.android.server.wifi.WifiService"; |
| 119 | private static final String WIFI_P2P_SERVICE_CLASS = |
| 120 | "com.android.server.wifi.p2p.WifiP2pService"; |
| Jinsuk Kim | 4f512fb | 2014-02-28 17:41:17 +0900 | [diff] [blame] | 121 | private static final String HDMI_CEC_SERVICE_CLASS = |
| 122 | "com.android.server.hdmi.HdmiCecService"; |
| Amith Yamasani | 817ec49 | 2013-12-20 13:27:30 -0800 | [diff] [blame] | 123 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 124 | private final int mFactoryTestMode; |
| 125 | private Timer mProfilerSnapshotTimer; |
| 126 | |
| 127 | private Context mSystemContext; |
| 128 | private SystemServiceManager mSystemServiceManager; |
| 129 | |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 130 | // TODO: remove all of these references by improving dependency resolution and boot phases |
| 131 | private Installer mInstaller; |
| 132 | private PowerManagerService mPowerManagerService; |
| 133 | private ActivityManagerService mActivityManagerService; |
| 134 | private DisplayManagerService mDisplayManagerService; |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 135 | private ContentResolver mContentResolver; |
| 136 | |
| 137 | /** |
| 138 | * Called to initialize native system services. |
| 139 | */ |
| 140 | private static native void nativeInit(); |
| 141 | |
| 142 | /** |
| 143 | * The main entry point from zygote. |
| 144 | */ |
| 145 | public static void main(String[] args) { |
| 146 | new SystemServer().run(); |
| 147 | } |
| 148 | |
| 149 | public SystemServer() { |
| 150 | mFactoryTestMode = FactoryTest.getMode(); |
| 151 | } |
| 152 | |
| 153 | private void run() { |
| 154 | // If a device's clock is before 1970 (before 0), a lot of |
| 155 | // APIs crash dealing with negative numbers, notably |
| 156 | // java.io.File#setLastModified, so instead we fake it and |
| 157 | // hope that time from cell towers or NTP fixes it shortly. |
| 158 | if (System.currentTimeMillis() < EARLIEST_SUPPORTED_TIME) { |
| 159 | Slog.w(TAG, "System clock is before 1970; setting to 1970."); |
| 160 | SystemClock.setCurrentTimeMillis(EARLIEST_SUPPORTED_TIME); |
| 161 | } |
| 162 | |
| 163 | // Here we go! |
| 164 | Slog.i(TAG, "Entered the Android system server!"); |
| 165 | EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_SYSTEM_RUN, SystemClock.uptimeMillis()); |
| 166 | |
| 167 | // In case the runtime switched since last boot (such as when |
| 168 | // the old runtime was removed in an OTA), set the system |
| 169 | // property so that it is in sync. We can't do this in |
| 170 | // libnativehelper's JniInvocation::Init code where we already |
| 171 | // had to fallback to a different runtime because it is |
| 172 | // running as root and we need to be the system user to set |
| 173 | // the property. http://b/11463182 |
| Brian Carlstrom | fdb98d4 | 2014-01-30 13:14:01 -0800 | [diff] [blame] | 174 | SystemProperties.set("persist.sys.dalvik.vm.lib.1", VMRuntime.getRuntime().vmLibrary()); |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 175 | |
| 176 | // Enable the sampling profiler. |
| 177 | if (SamplingProfilerIntegration.isEnabled()) { |
| 178 | SamplingProfilerIntegration.start(); |
| 179 | mProfilerSnapshotTimer = new Timer(); |
| 180 | mProfilerSnapshotTimer.schedule(new TimerTask() { |
| 181 | @Override |
| 182 | public void run() { |
| 183 | SamplingProfilerIntegration.writeSnapshot("system_server", null); |
| 184 | } |
| 185 | }, SNAPSHOT_INTERVAL, SNAPSHOT_INTERVAL); |
| 186 | } |
| 187 | |
| 188 | // Mmmmmm... more memory! |
| 189 | VMRuntime.getRuntime().clearGrowthLimit(); |
| 190 | |
| 191 | // The system server has to run all of the time, so it needs to be |
| 192 | // as efficient as possible with its memory usage. |
| 193 | VMRuntime.getRuntime().setTargetHeapUtilization(0.8f); |
| 194 | |
| 195 | // Within the system server, it is an error to access Environment paths without |
| 196 | // explicitly specifying a user. |
| 197 | Environment.setUserRequired(true); |
| 198 | |
| 199 | // Ensure binder calls into the system always run at foreground priority. |
| 200 | BinderInternal.disableBackgroundScheduling(true); |
| 201 | |
| 202 | // Prepare the main looper thread (this thread). |
| 203 | android.os.Process.setThreadPriority( |
| 204 | android.os.Process.THREAD_PRIORITY_FOREGROUND); |
| 205 | android.os.Process.setCanSelfBackground(false); |
| 206 | Looper.prepareMainLooper(); |
| 207 | |
| 208 | // Initialize native services. |
| 209 | System.loadLibrary("android_servers"); |
| 210 | nativeInit(); |
| 211 | |
| 212 | // Check whether we failed to shut down last time we tried. |
| 213 | // This call may not return. |
| 214 | performPendingShutdown(); |
| 215 | |
| 216 | // Initialize the system context. |
| 217 | createSystemContext(); |
| 218 | |
| 219 | // Create the system service manager. |
| 220 | mSystemServiceManager = new SystemServiceManager(mSystemContext); |
| Jeff Brown | b880d88 | 2014-02-10 19:47:07 -0800 | [diff] [blame] | 221 | LocalServices.addService(SystemServiceManager.class, mSystemServiceManager); |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 222 | |
| 223 | // Start services. |
| 224 | try { |
| 225 | startBootstrapServices(); |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 226 | startCoreServices(); |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 227 | startOtherServices(); |
| 228 | } catch (RuntimeException ex) { |
| 229 | Slog.e("System", "******************************************"); |
| 230 | Slog.e("System", "************ Failure starting system services", ex); |
| 231 | throw ex; |
| 232 | } |
| 233 | |
| 234 | // For debug builds, log event loop stalls to dropbox for analysis. |
| 235 | if (StrictMode.conditionallyEnableDebugLogging()) { |
| 236 | Slog.i(TAG, "Enabled StrictMode for system server main thread."); |
| 237 | } |
| 238 | |
| 239 | // Loop forever. |
| 240 | Looper.loop(); |
| 241 | throw new RuntimeException("Main thread loop unexpectedly exited"); |
| 242 | } |
| 243 | |
| 244 | private void reportWtf(String msg, Throwable e) { |
| Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 245 | Slog.w(TAG, "***********************************************"); |
| 246 | Log.wtf(TAG, "BOOT FAILURE " + msg, e); |
| 247 | } |
| 248 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 249 | private void performPendingShutdown() { |
| 250 | final String shutdownAction = SystemProperties.get( |
| 251 | ShutdownThread.SHUTDOWN_ACTION_PROPERTY, ""); |
| 252 | if (shutdownAction != null && shutdownAction.length() > 0) { |
| 253 | boolean reboot = (shutdownAction.charAt(0) == '1'); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 254 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 255 | final String reason; |
| 256 | if (shutdownAction.length() > 1) { |
| 257 | reason = shutdownAction.substring(1, shutdownAction.length()); |
| 258 | } else { |
| 259 | reason = null; |
| Kenny Root | f547d67 | 2010-09-22 10:36:48 -0700 | [diff] [blame] | 260 | } |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 261 | |
| 262 | ShutdownThread.rebootOrShutdown(reboot, reason); |
| Kenny Root | f547d67 | 2010-09-22 10:36:48 -0700 | [diff] [blame] | 263 | } |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 264 | } |
| Kenny Root | f547d67 | 2010-09-22 10:36:48 -0700 | [diff] [blame] | 265 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 266 | private void createSystemContext() { |
| 267 | ActivityThread activityThread = ActivityThread.systemMain(); |
| 268 | mSystemContext = activityThread.getSystemContext(); |
| 269 | mSystemContext.setTheme(android.R.style.Theme_Holo); |
| 270 | } |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 271 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 272 | private void startBootstrapServices() { |
| 273 | // Wait for installd to finish starting up so that it has a chance to |
| 274 | // create critical directories such as /data/user with the appropriate |
| 275 | // permissions. We need this to complete before we initialize other services. |
| 276 | mInstaller = mSystemServiceManager.startService(Installer.class); |
| 277 | |
| 278 | // Power manager needs to be started early because other services need it. |
| 279 | // TODO: The conversion to the new pattern is incomplete. We need to switch |
| 280 | // the power manager's dependencies over then we can use boot phases to arrange |
| 281 | // initialization order and remove the mPowerManagerService field. |
| 282 | mPowerManagerService = mSystemServiceManager.startService(PowerManagerService.class); |
| 283 | |
| 284 | // Activity manager runs the show. |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 285 | mActivityManagerService = mSystemServiceManager.startService( |
| 286 | ActivityManagerService.Lifecycle.class).getService(); |
| 287 | } |
| 288 | |
| 289 | private void startCoreServices() { |
| 290 | // Display manager is needed to provide display metrics before package manager |
| 291 | // starts up. |
| 292 | mDisplayManagerService = mSystemServiceManager.startService(DisplayManagerService.class); |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 293 | } |
| 294 | |
| 295 | private void startOtherServices() { |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 296 | final Context context = mSystemContext; |
| Kenny Root | 26ff662 | 2012-07-30 12:58:03 -0700 | [diff] [blame] | 297 | AccountManagerService accountManager = null; |
| 298 | ContentService contentService = null; |
| Adam Lesinski | ef2ea1f | 2013-12-05 16:48:06 -0800 | [diff] [blame] | 299 | LightsManager lights = null; |
| Mike Lockwood | 07a500f | 2009-08-12 09:56:44 -0400 | [diff] [blame] | 300 | BatteryService battery = null; |
| Jeff Brown | 7f6c231 | 2012-04-13 20:38:38 -0700 | [diff] [blame] | 301 | VibratorService vibrator = null; |
| Adam Lesinski | ef2ea1f | 2013-12-05 16:48:06 -0800 | [diff] [blame] | 302 | IAlarmManager alarm = null; |
| Jeff Sharkey | b049e212 | 2012-09-07 23:16:01 -0700 | [diff] [blame] | 303 | MountService mountService = null; |
| Jeff Sharkey | c006f1a | 2011-05-19 17:12:49 -0700 | [diff] [blame] | 304 | NetworkManagementService networkManagement = null; |
| Jeff Sharkey | 7527990 | 2011-05-24 18:39:45 -0700 | [diff] [blame] | 305 | NetworkStatsService networkStats = null; |
| Jeff Sharkey | a462079 | 2011-05-20 15:29:23 -0700 | [diff] [blame] | 306 | NetworkPolicyManagerService networkPolicy = null; |
| Mike Lockwood | 0f79b54 | 2009-08-14 14:18:49 -0400 | [diff] [blame] | 307 | ConnectivityService connectivity = null; |
| Irfan Sheriff | 7d024d3 | 2012-03-22 17:01:39 -0700 | [diff] [blame] | 308 | NsdService serviceDiscovery= null; |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 309 | IPackageManager pm = null; |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 310 | WindowManagerService wm = null; |
| fredc | 0f42037 | 2012-04-12 00:02:00 -0700 | [diff] [blame] | 311 | BluetoothManagerService bluetooth = null; |
| Dan Murphy | c9f4eaf | 2009-08-12 15:15:43 -0500 | [diff] [blame] | 312 | DockObserver dock = null; |
| Mike Lockwood | 770126a | 2010-12-09 22:30:37 -0800 | [diff] [blame] | 313 | UsbService usb = null; |
| Mike Lockwood | b01e8bf | 2011-08-29 20:11:07 -0400 | [diff] [blame] | 314 | SerialService serial = null; |
| Dianne Hackborn | 21f1bd1 | 2010-02-19 17:02:21 -0800 | [diff] [blame] | 315 | RecognitionManagerService recognition = null; |
| Amith Yamasani | 6734b9f6 | 2010-09-13 16:24:08 -0700 | [diff] [blame] | 316 | NetworkTimeUpdateService networkTimeUpdater = null; |
| John Grossman | c157673 | 2012-02-01 15:23:33 -0800 | [diff] [blame] | 317 | CommonTimeManagementService commonTimeMgmtService = null; |
| Jeff Brown | 6ec6f79 | 2012-04-17 16:52:41 -0700 | [diff] [blame] | 318 | InputManagerService inputManager = null; |
| Wink Saville | a12a7b3 | 2012-09-20 10:09:45 -0700 | [diff] [blame] | 319 | TelephonyRegistry telephonyRegistry = null; |
| Erik Gilling | 51e95df | 2013-06-26 11:06:51 -0700 | [diff] [blame] | 320 | ConsumerIrService consumerIr = null; |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 321 | |
| Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 322 | boolean onlyCore = false; |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 323 | boolean firstBoot = false; |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 324 | boolean disableStorage = SystemProperties.getBoolean("config.disable_storage", false); |
| 325 | boolean disableMedia = SystemProperties.getBoolean("config.disable_media", false); |
| 326 | boolean disableBluetooth = SystemProperties.getBoolean("config.disable_bluetooth", false); |
| 327 | boolean disableTelephony = SystemProperties.getBoolean("config.disable_telephony", false); |
| 328 | boolean disableLocation = SystemProperties.getBoolean("config.disable_location", false); |
| 329 | boolean disableSystemUI = SystemProperties.getBoolean("config.disable_systemui", false); |
| 330 | boolean disableNonCoreServices = SystemProperties.getBoolean("config.disable_noncore", false); |
| 331 | boolean disableNetwork = SystemProperties.getBoolean("config.disable_network", false); |
| 332 | |
| 333 | try { |
| Joe Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 334 | Slog.i(TAG, "Telephony Registry"); |
| Wink Saville | a12a7b3 | 2012-09-20 10:09:45 -0700 | [diff] [blame] | 335 | telephonyRegistry = new TelephonyRegistry(context); |
| 336 | ServiceManager.addService("telephony.registry", telephonyRegistry); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 337 | |
| Glenn Kasten | 07b0465 | 2012-04-23 15:00:43 -0700 | [diff] [blame] | 338 | Slog.i(TAG, "Scheduling Policy"); |
| Dianne Hackborn | 35f72be | 2013-09-16 10:57:39 -0700 | [diff] [blame] | 339 | ServiceManager.addService("scheduling_policy", new SchedulingPolicyService()); |
| Glenn Kasten | 07b0465 | 2012-04-23 15:00:43 -0700 | [diff] [blame] | 340 | |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 341 | AttributeCache.init(context); |
| 342 | |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 343 | // We need the default display before we can initialize the package manager. |
| 344 | mSystemServiceManager.startBootPhase(SystemService.PHASE_WAIT_FOR_DEFAULT_DISPLAY); |
| Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 345 | |
| Joe Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 346 | Slog.i(TAG, "Package Manager"); |
| Ben Komalo | 553acf0 | 2011-09-19 14:25:28 -0700 | [diff] [blame] | 347 | // Only run "core" apps if we're encrypting the device. |
| 348 | String cryptState = SystemProperties.get("vold.decrypt"); |
| Ben Komalo | 3573d40 | 2011-09-23 15:08:24 -0700 | [diff] [blame] | 349 | if (ENCRYPTING_STATE.equals(cryptState)) { |
| Ben Komalo | 553acf0 | 2011-09-19 14:25:28 -0700 | [diff] [blame] | 350 | Slog.w(TAG, "Detected encryption in progress - only parsing core apps"); |
| Ben Komalo | 3573d40 | 2011-09-23 15:08:24 -0700 | [diff] [blame] | 351 | onlyCore = true; |
| 352 | } else if (ENCRYPTED_STATE.equals(cryptState)) { |
| 353 | Slog.w(TAG, "Device encrypted - only parsing core apps"); |
| 354 | onlyCore = true; |
| Ben Komalo | 553acf0 | 2011-09-19 14:25:28 -0700 | [diff] [blame] | 355 | } |
| Ben Komalo | 3573d40 | 2011-09-23 15:08:24 -0700 | [diff] [blame] | 356 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 357 | pm = PackageManagerService.main(context, mInstaller, |
| 358 | mFactoryTestMode != FactoryTest.FACTORY_TEST_OFF, |
| Ben Komalo | 553acf0 | 2011-09-19 14:25:28 -0700 | [diff] [blame] | 359 | onlyCore); |
| Dianne Hackborn | 58f42a5 | 2011-10-10 13:46:34 -0700 | [diff] [blame] | 360 | try { |
| 361 | firstBoot = pm.isFirstBoot(); |
| 362 | } catch (RemoteException e) { |
| 363 | } |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 364 | |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 365 | mActivityManagerService.setSystemProcess(); |
| Svetoslav | b3038ec | 2013-02-13 14:39:30 -0800 | [diff] [blame] | 366 | |
| Nick Kralevich | 79619dd | 2013-03-04 13:05:32 -0800 | [diff] [blame] | 367 | Slog.i(TAG, "Entropy Mixer"); |
| 368 | ServiceManager.addService("entropy", new EntropyMixer(context)); |
| 369 | |
| Amith Yamasani | 258848d | 2012-08-10 17:06:33 -0700 | [diff] [blame] | 370 | Slog.i(TAG, "User Service"); |
| 371 | ServiceManager.addService(Context.USER_SERVICE, |
| Dianne Hackborn | 4428e17c | 2012-08-24 17:43:05 -0700 | [diff] [blame] | 372 | UserManagerService.getInstance()); |
| Amith Yamasani | 258848d | 2012-08-10 17:06:33 -0700 | [diff] [blame] | 373 | |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 374 | mContentResolver = context.getContentResolver(); |
| 375 | |
| Fred Quintana | e91ebe2 | 2009-09-29 20:44:30 -0700 | [diff] [blame] | 376 | // The AccountManager must come before the ContentService |
| Fred Quintana | 6030734 | 2009-03-24 22:48:12 -0700 | [diff] [blame] | 377 | try { |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 378 | // TODO: seems like this should be disable-able, but req'd by ContentService |
| Joe Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 379 | Slog.i(TAG, "Account Manager"); |
| Kenny Root | 26ff662 | 2012-07-30 12:58:03 -0700 | [diff] [blame] | 380 | accountManager = new AccountManagerService(context); |
| 381 | ServiceManager.addService(Context.ACCOUNT_SERVICE, accountManager); |
| Fred Quintana | 6030734 | 2009-03-24 22:48:12 -0700 | [diff] [blame] | 382 | } catch (Throwable e) { |
| Joe Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 383 | Slog.e(TAG, "Failure starting Account Manager", e); |
| Fred Quintana | 6030734 | 2009-03-24 22:48:12 -0700 | [diff] [blame] | 384 | } |
| 385 | |
| Joe Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 386 | Slog.i(TAG, "Content Manager"); |
| Kenny Root | 26ff662 | 2012-07-30 12:58:03 -0700 | [diff] [blame] | 387 | contentService = ContentService.main(context, |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 388 | mFactoryTestMode == FactoryTest.FACTORY_TEST_LOW_LEVEL); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 389 | |
| Joe Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 390 | Slog.i(TAG, "System Content Providers"); |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 391 | mActivityManagerService.installSystemProviders(); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 392 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 393 | mSystemServiceManager.startService(LightsService.class); |
| Adam Lesinski | ef2ea1f | 2013-12-05 16:48:06 -0800 | [diff] [blame] | 394 | lights = LocalServices.getService(LightsManager.class); |
| Mike Lockwood | 3a32213 | 2009-11-24 00:30:52 -0500 | [diff] [blame] | 395 | |
| Joe Onorato | de1b359 | 2010-10-25 20:36:47 -0700 | [diff] [blame] | 396 | Slog.i(TAG, "Battery Service"); |
| 397 | battery = new BatteryService(context, lights); |
| 398 | ServiceManager.addService("battery", battery); |
| 399 | |
| Joe Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 400 | Slog.i(TAG, "Vibrator Service"); |
| Jeff Brown | 7f6c231 | 2012-04-13 20:38:38 -0700 | [diff] [blame] | 401 | vibrator = new VibratorService(context); |
| 402 | ServiceManager.addService("vibrator", vibrator); |
| The Android Open Source Project | 1059253 | 2009-03-18 17:39:46 -0700 | [diff] [blame] | 403 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 404 | // TODO: use boot phase |
| 405 | // only initialize the power service after we have started the |
| 406 | // lights service, content providers and the battery service. |
| 407 | mPowerManagerService.init(lights, battery, |
| 408 | BatteryStatsService.getService(), |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 409 | mActivityManagerService.getAppOpsService()); |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 410 | |
| Erik Gilling | 51e95df | 2013-06-26 11:06:51 -0700 | [diff] [blame] | 411 | Slog.i(TAG, "Consumer IR Service"); |
| 412 | consumerIr = new ConsumerIrService(context); |
| 413 | ServiceManager.addService(Context.CONSUMER_IR_SERVICE, consumerIr); |
| 414 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 415 | mSystemServiceManager.startService(AlarmManagerService.class); |
| Adam Lesinski | ef2ea1f | 2013-12-05 16:48:06 -0800 | [diff] [blame] | 416 | alarm = IAlarmManager.Stub.asInterface( |
| 417 | ServiceManager.getService(Context.ALARM_SERVICE)); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 418 | |
| Joe Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 419 | Slog.i(TAG, "Init Watchdog"); |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 420 | final Watchdog watchdog = Watchdog.getInstance(); |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 421 | watchdog.init(context, mActivityManagerService); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 422 | |
| Jeff Brown | a9d131c | 2012-09-20 16:48:17 -0700 | [diff] [blame] | 423 | Slog.i(TAG, "Input Manager"); |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 424 | inputManager = new InputManagerService(context); |
| Jeff Brown | a9d131c | 2012-09-20 16:48:17 -0700 | [diff] [blame] | 425 | |
| Joe Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 426 | Slog.i(TAG, "Window Manager"); |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 427 | wm = WindowManagerService.main(context, inputManager, |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 428 | mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL, |
| Jeff Brown | 780c46f | 2012-06-24 12:15:38 -0700 | [diff] [blame] | 429 | !firstBoot, onlyCore); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 430 | ServiceManager.addService(Context.WINDOW_SERVICE, wm); |
| Jeff Brown | 6ec6f79 | 2012-04-17 16:52:41 -0700 | [diff] [blame] | 431 | ServiceManager.addService(Context.INPUT_SERVICE, inputManager); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 432 | |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 433 | mActivityManagerService.setWindowManager(wm); |
| Jeff Brown | a9d131c | 2012-09-20 16:48:17 -0700 | [diff] [blame] | 434 | |
| 435 | inputManager.setWindowManagerCallbacks(wm.getInputMonitor()); |
| 436 | inputManager.start(); |
| 437 | |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 438 | // TODO: Use service dependencies instead. |
| 439 | mDisplayManagerService.windowManagerAndInputReady(); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 440 | |
| 441 | // Skip Bluetooth if we have an emulator kernel |
| 442 | // TODO: Use a more reliable check to see if this product should |
| 443 | // support Bluetooth - see bug 988521 |
| 444 | if (SystemProperties.get("ro.kernel.qemu").equals("1")) { |
| David 'Digit' Turner | e2a5e86 | 2011-01-17 00:32:33 +0100 | [diff] [blame] | 445 | Slog.i(TAG, "No Bluetooh Service (emulator)"); |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 446 | } else if (mFactoryTestMode == FactoryTest.FACTORY_TEST_LOW_LEVEL) { |
| David 'Digit' Turner | e2a5e86 | 2011-01-17 00:32:33 +0100 | [diff] [blame] | 447 | Slog.i(TAG, "No Bluetooth Service (factory test)"); |
| Matthew Xie | 1dd01eb3 | 2013-04-26 12:37:54 -0700 | [diff] [blame] | 448 | } else if (!context.getPackageManager().hasSystemFeature |
| 449 | (PackageManager.FEATURE_BLUETOOTH)) { |
| 450 | Slog.i(TAG, "No Bluetooth Service (Bluetooth Hardware Not Present)"); |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 451 | } else if (disableBluetooth) { |
| 452 | Slog.i(TAG, "Bluetooth Service disabled by config"); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 453 | } else { |
| fredc | 0f42037 | 2012-04-12 00:02:00 -0700 | [diff] [blame] | 454 | Slog.i(TAG, "Bluetooth Manager Service"); |
| 455 | bluetooth = new BluetoothManagerService(context); |
| 456 | ServiceManager.addService(BluetoothAdapter.BLUETOOTH_MANAGER_SERVICE, bluetooth); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 457 | } |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 458 | } catch (RuntimeException e) { |
| Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 459 | Slog.e("System", "******************************************"); |
| 460 | Slog.e("System", "************ Failure starting core service", e); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 461 | } |
| 462 | |
| Joe Onorato | 089de88 | 2010-04-12 08:18:45 -0700 | [diff] [blame] | 463 | StatusBarManagerService statusBar = null; |
| Adam Lesinski | ef2ea1f | 2013-12-05 16:48:06 -0800 | [diff] [blame] | 464 | INotificationManager notification = null; |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 465 | InputMethodManagerService imm = null; |
| Dianne Hackborn | f21adf6 | 2009-08-13 10:20:21 -0700 | [diff] [blame] | 466 | WallpaperManagerService wallpaper = null; |
| Mike Lockwood | 46db504 | 2010-02-22 16:36:44 -0500 | [diff] [blame] | 467 | LocationManagerService location = null; |
| Bai Tao | a58a875 | 2010-07-13 15:32:16 +0800 | [diff] [blame] | 468 | CountryDetectorService countryDetector = null; |
| satok | 988323c | 2011-06-22 16:38:13 +0900 | [diff] [blame] | 469 | TextServicesManagerService tsms = null; |
| Amith Yamasani | 52c489c | 2012-03-28 11:42:42 -0700 | [diff] [blame] | 470 | LockSettingsService lockSettings = null; |
| Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 471 | AssetAtlasService atlas = null; |
| Jeff Brown | 69b0716 | 2013-11-07 00:30:16 -0800 | [diff] [blame] | 472 | MediaRouterService mediaRouter = null; |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 473 | |
| Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 474 | // Bring up services needed for UI. |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 475 | if (mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL) { |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 476 | //if (!disableNonCoreServices) { // TODO: View depends on these; mock them? |
| 477 | if (true) { |
| 478 | try { |
| 479 | Slog.i(TAG, "Input Method Service"); |
| 480 | imm = new InputMethodManagerService(context, wm); |
| 481 | ServiceManager.addService(Context.INPUT_METHOD_SERVICE, imm); |
| 482 | } catch (Throwable e) { |
| 483 | reportWtf("starting Input Manager Service", e); |
| 484 | } |
| Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 485 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 486 | try { |
| 487 | Slog.i(TAG, "Accessibility Manager"); |
| Adam Lesinski | 6c6cd50 | 2014-03-17 12:54:03 -0700 | [diff] [blame] | 488 | ServiceManager.addService(Context.ACCESSIBILITY_SERVICE, |
| 489 | new AccessibilityManagerService(context)); |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 490 | } catch (Throwable e) { |
| 491 | reportWtf("starting Accessibility Manager", e); |
| 492 | } |
| Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 493 | } |
| 494 | } |
| 495 | |
| 496 | try { |
| 497 | wm.displayReady(); |
| 498 | } catch (Throwable e) { |
| 499 | reportWtf("making display ready", e); |
| 500 | } |
| Dianne Hackborn | 8795b60 | 2011-08-25 13:30:53 -0700 | [diff] [blame] | 501 | |
| Dianne Hackborn | 295e3c2 | 2011-08-25 13:19:08 -0700 | [diff] [blame] | 502 | try { |
| Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 503 | pm.performBootDexOpt(); |
| 504 | } catch (Throwable e) { |
| 505 | reportWtf("performing boot dexopt", e); |
| 506 | } |
| 507 | |
| 508 | try { |
| 509 | ActivityManagerNative.getDefault().showBootMessage( |
| 510 | context.getResources().getText( |
| 511 | com.android.internal.R.string.android_upgrading_starting_apps), |
| Adam Lesinski | ef2ea1f | 2013-12-05 16:48:06 -0800 | [diff] [blame] | 512 | false); |
| Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 513 | } catch (RemoteException e) { |
| 514 | } |
| 515 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 516 | if (mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL) { |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 517 | if (!disableStorage && |
| 518 | !"0".equals(SystemProperties.get("system_init.startmountservice"))) { |
| Kenny Root | 51a573c | 2012-05-17 13:30:28 -0700 | [diff] [blame] | 519 | try { |
| 520 | /* |
| 521 | * NotificationManagerService is dependant on MountService, |
| 522 | * (for media / usb notifications) so we must start MountService first. |
| 523 | */ |
| 524 | Slog.i(TAG, "Mount Service"); |
| 525 | mountService = new MountService(context); |
| 526 | ServiceManager.addService("mount", mountService); |
| 527 | } catch (Throwable e) { |
| 528 | reportWtf("starting Mount Service", e); |
| 529 | } |
| 530 | } |
| 531 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 532 | if (!disableNonCoreServices) { |
| 533 | try { |
| 534 | Slog.i(TAG, "LockSettingsService"); |
| 535 | lockSettings = new LockSettingsService(context); |
| 536 | ServiceManager.addService("lock_settings", lockSettings); |
| 537 | } catch (Throwable e) { |
| 538 | reportWtf("starting LockSettingsService service", e); |
| 539 | } |
| 540 | |
| 541 | try { |
| Adam Lesinski | 3d9bcb9 | 2014-02-18 14:05:14 -0800 | [diff] [blame] | 542 | if (pm.hasSystemFeature(PackageManager.FEATURE_DEVICE_ADMIN)) { |
| Adam Lesinski | 2cb6c60 | 2014-02-14 17:19:56 -0800 | [diff] [blame] | 543 | mSystemServiceManager.startService(DEVICE_POLICY_MANAGER_SERVICE_CLASS); |
| Adam Lesinski | 898c13d | 2014-01-28 15:34:50 -0800 | [diff] [blame] | 544 | } |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 545 | } catch (Throwable e) { |
| 546 | reportWtf("starting DevicePolicyService", e); |
| 547 | } |
| Amith Yamasani | 52c489c | 2012-03-28 11:42:42 -0700 | [diff] [blame] | 548 | } |
| 549 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 550 | if (!disableSystemUI) { |
| 551 | try { |
| 552 | Slog.i(TAG, "Status Bar"); |
| 553 | statusBar = new StatusBarManagerService(context, wm); |
| 554 | ServiceManager.addService(Context.STATUS_BAR_SERVICE, statusBar); |
| 555 | } catch (Throwable e) { |
| 556 | reportWtf("starting StatusBarManagerService", e); |
| 557 | } |
| Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 558 | } |
| 559 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 560 | if (!disableNonCoreServices) { |
| 561 | try { |
| 562 | Slog.i(TAG, "Clipboard Service"); |
| 563 | ServiceManager.addService(Context.CLIPBOARD_SERVICE, |
| 564 | new ClipboardService(context)); |
| 565 | } catch (Throwable e) { |
| 566 | reportWtf("starting Clipboard Service", e); |
| 567 | } |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 568 | } |
| 569 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 570 | if (!disableNetwork) { |
| 571 | try { |
| 572 | Slog.i(TAG, "NetworkManagement Service"); |
| 573 | networkManagement = NetworkManagementService.create(context); |
| 574 | ServiceManager.addService(Context.NETWORKMANAGEMENT_SERVICE, networkManagement); |
| 575 | } catch (Throwable e) { |
| 576 | reportWtf("starting NetworkManagement Service", e); |
| 577 | } |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 578 | } |
| 579 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 580 | if (!disableNonCoreServices) { |
| 581 | try { |
| 582 | Slog.i(TAG, "Text Service Manager Service"); |
| 583 | tsms = new TextServicesManagerService(context); |
| 584 | ServiceManager.addService(Context.TEXT_SERVICES_MANAGER_SERVICE, tsms); |
| 585 | } catch (Throwable e) { |
| 586 | reportWtf("starting Text Service Manager Service", e); |
| 587 | } |
| San Mehat | d1df8ac | 2010-01-26 06:17:26 -0800 | [diff] [blame] | 588 | } |
| 589 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 590 | if (!disableNetwork) { |
| 591 | try { |
| 592 | Slog.i(TAG, "NetworkStats Service"); |
| 593 | networkStats = new NetworkStatsService(context, networkManagement, alarm); |
| 594 | ServiceManager.addService(Context.NETWORK_STATS_SERVICE, networkStats); |
| 595 | } catch (Throwable e) { |
| 596 | reportWtf("starting NetworkStats Service", e); |
| 597 | } |
| 598 | |
| 599 | try { |
| 600 | Slog.i(TAG, "NetworkPolicy Service"); |
| 601 | networkPolicy = new NetworkPolicyManagerService( |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 602 | context, mActivityManagerService, |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 603 | (IPowerManager)ServiceManager.getService(Context.POWER_SERVICE), |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 604 | networkStats, networkManagement); |
| 605 | ServiceManager.addService(Context.NETWORK_POLICY_SERVICE, networkPolicy); |
| 606 | } catch (Throwable e) { |
| 607 | reportWtf("starting NetworkPolicy Service", e); |
| 608 | } |
| 609 | |
| Vinit Deshpande | 3ffa1a8 | 2014-01-08 02:55:29 +0000 | [diff] [blame] | 610 | try { |
| Adam Lesinski | f542a33 | 2014-02-19 12:29:58 -0800 | [diff] [blame] | 611 | mSystemServiceManager.startService(WIFI_P2P_SERVICE_CLASS); |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 612 | } catch (Throwable e) { |
| 613 | reportWtf("starting Wi-Fi P2pService", e); |
| 614 | } |
| 615 | |
| Vinit Deshpande | 3ffa1a8 | 2014-01-08 02:55:29 +0000 | [diff] [blame] | 616 | try { |
| Adam Lesinski | f542a33 | 2014-02-19 12:29:58 -0800 | [diff] [blame] | 617 | mSystemServiceManager.startService(WIFI_SERVICE_CLASS); |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 618 | } catch (Throwable e) { |
| 619 | reportWtf("starting Wi-Fi Service", e); |
| 620 | } |
| 621 | |
| 622 | try { |
| 623 | Slog.i(TAG, "Connectivity Service"); |
| 624 | connectivity = new ConnectivityService( |
| 625 | context, networkManagement, networkStats, networkPolicy); |
| 626 | ServiceManager.addService(Context.CONNECTIVITY_SERVICE, connectivity); |
| 627 | networkStats.bindConnectivityManager(connectivity); |
| 628 | networkPolicy.bindConnectivityManager(connectivity); |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 629 | } catch (Throwable e) { |
| 630 | reportWtf("starting Connectivity Service", e); |
| 631 | } |
| 632 | |
| 633 | try { |
| 634 | Slog.i(TAG, "Network Service Discovery Service"); |
| 635 | serviceDiscovery = NsdService.create(context); |
| 636 | ServiceManager.addService( |
| 637 | Context.NSD_SERVICE, serviceDiscovery); |
| 638 | } catch (Throwable e) { |
| 639 | reportWtf("starting Service Discovery Service", e); |
| 640 | } |
| satok | 988323c | 2011-06-22 16:38:13 +0900 | [diff] [blame] | 641 | } |
| 642 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 643 | if (!disableNonCoreServices) { |
| 644 | try { |
| 645 | Slog.i(TAG, "UpdateLock Service"); |
| 646 | ServiceManager.addService(Context.UPDATE_LOCK_SERVICE, |
| 647 | new UpdateLockService(context)); |
| 648 | } catch (Throwable e) { |
| 649 | reportWtf("starting UpdateLockService", e); |
| 650 | } |
| Christopher Tate | 8662cab5 | 2012-02-23 14:59:36 -0800 | [diff] [blame] | 651 | } |
| 652 | |
| Kenny Root | 51a573c | 2012-05-17 13:30:28 -0700 | [diff] [blame] | 653 | /* |
| 654 | * MountService has a few dependencies: Notification Manager and |
| 655 | * AppWidget Provider. Make sure MountService is completely started |
| 656 | * first before continuing. |
| 657 | */ |
| Ken Sumrall | 025adc4 | 2013-06-05 22:08:12 -0700 | [diff] [blame] | 658 | if (mountService != null && !onlyCore) { |
| Kenny Root | 51a573c | 2012-05-17 13:30:28 -0700 | [diff] [blame] | 659 | mountService.waitForAsecScan(); |
| San Mehat | 1bf3f8b | 2010-02-03 14:43:09 -0800 | [diff] [blame] | 660 | } |
| 661 | |
| 662 | try { |
| Kenny Root | 26ff662 | 2012-07-30 12:58:03 -0700 | [diff] [blame] | 663 | if (accountManager != null) |
| 664 | accountManager.systemReady(); |
| 665 | } catch (Throwable e) { |
| 666 | reportWtf("making Account Manager Service ready", e); |
| 667 | } |
| 668 | |
| 669 | try { |
| 670 | if (contentService != null) |
| 671 | contentService.systemReady(); |
| 672 | } catch (Throwable e) { |
| 673 | reportWtf("making Content Service ready", e); |
| 674 | } |
| 675 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 676 | mSystemServiceManager.startService(NotificationManagerService.class); |
| Adam Lesinski | ef2ea1f | 2013-12-05 16:48:06 -0800 | [diff] [blame] | 677 | notification = INotificationManager.Stub.asInterface( |
| 678 | ServiceManager.getService(Context.NOTIFICATION_SERVICE)); |
| 679 | networkPolicy.bindNotificationManager(notification); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 680 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 681 | mSystemServiceManager.startService(DeviceStorageMonitorService.class); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 682 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 683 | if (!disableLocation) { |
| 684 | try { |
| 685 | Slog.i(TAG, "Location Manager"); |
| 686 | location = new LocationManagerService(context); |
| 687 | ServiceManager.addService(Context.LOCATION_SERVICE, location); |
| 688 | } catch (Throwable e) { |
| 689 | reportWtf("starting Location Manager", e); |
| 690 | } |
| 691 | |
| 692 | try { |
| 693 | Slog.i(TAG, "Country Detector"); |
| 694 | countryDetector = new CountryDetectorService(context); |
| 695 | ServiceManager.addService(Context.COUNTRY_DETECTOR, countryDetector); |
| 696 | } catch (Throwable e) { |
| 697 | reportWtf("starting Country Detector", e); |
| 698 | } |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 699 | } |
| 700 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 701 | if (!disableNonCoreServices) { |
| 702 | try { |
| 703 | Slog.i(TAG, "Search Service"); |
| 704 | ServiceManager.addService(Context.SEARCH_SERVICE, |
| 705 | new SearchManagerService(context)); |
| 706 | } catch (Throwable e) { |
| 707 | reportWtf("starting Search Service", e); |
| 708 | } |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 709 | } |
| 710 | |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 711 | try { |
| Joe Onorato | 8a9b220 | 2010-02-26 18:56:32 -0800 | [diff] [blame] | 712 | Slog.i(TAG, "DropBox Service"); |
| Dan Egnor | 9524027 | 2009-10-27 18:23:39 -0700 | [diff] [blame] | 713 | ServiceManager.addService(Context.DROPBOX_SERVICE, |
| Dan Egnor | f18a01c | 2009-11-12 11:32:50 -0800 | [diff] [blame] | 714 | new DropBoxManagerService(context, new File("/data/system/dropbox"))); |
| Dan Egnor | 4410ec8 | 2009-09-11 16:40:01 -0700 | [diff] [blame] | 715 | } catch (Throwable e) { |
| Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 716 | reportWtf("starting DropBoxManagerService", e); |
| Dan Egnor | 4410ec8 | 2009-09-11 16:40:01 -0700 | [diff] [blame] | 717 | } |
| 718 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 719 | if (!disableNonCoreServices && context.getResources().getBoolean( |
| 720 | R.bool.config_enableWallpaperService)) { |
| Mike Lockwood | c067c9c | 2011-10-31 12:50:12 -0400 | [diff] [blame] | 721 | try { |
| 722 | Slog.i(TAG, "Wallpaper Service"); |
| Mike Lockwood | ed8902d | 2013-11-15 11:01:47 -0800 | [diff] [blame] | 723 | wallpaper = new WallpaperManagerService(context); |
| 724 | ServiceManager.addService(Context.WALLPAPER_SERVICE, wallpaper); |
| Mike Lockwood | c067c9c | 2011-10-31 12:50:12 -0400 | [diff] [blame] | 725 | } catch (Throwable e) { |
| 726 | reportWtf("starting Wallpaper Service", e); |
| Mike Lockwood | 3a74bd3 | 2011-08-12 13:55:22 -0700 | [diff] [blame] | 727 | } |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 728 | } |
| 729 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 730 | if (!disableMedia && !"0".equals(SystemProperties.get("system_init.startaudioservice"))) { |
| Mike Lockwood | cba928c | 2011-08-17 15:58:52 -0700 | [diff] [blame] | 731 | try { |
| 732 | Slog.i(TAG, "Audio Service"); |
| 733 | ServiceManager.addService(Context.AUDIO_SERVICE, new AudioService(context)); |
| 734 | } catch (Throwable e) { |
| 735 | reportWtf("starting Audio Service", e); |
| 736 | } |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 737 | } |
| 738 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 739 | if (!disableNonCoreServices) { |
| 740 | try { |
| 741 | Slog.i(TAG, "Dock Observer"); |
| 742 | // Listen for dock station changes |
| 743 | dock = new DockObserver(context); |
| 744 | } catch (Throwable e) { |
| 745 | reportWtf("starting DockObserver", e); |
| 746 | } |
| Dan Murphy | c9f4eaf | 2009-08-12 15:15:43 -0500 | [diff] [blame] | 747 | } |
| 748 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 749 | if (!disableMedia) { |
| 750 | try { |
| 751 | Slog.i(TAG, "Wired Accessory Manager"); |
| 752 | // Listen for wired headset changes |
| 753 | inputManager.setWiredAccessoryCallbacks( |
| 754 | new WiredAccessoryManager(context, inputManager)); |
| 755 | } catch (Throwable e) { |
| 756 | reportWtf("starting WiredAccessoryManager", e); |
| 757 | } |
| Praveen Bharathi | 21e941b | 2010-10-06 15:23:14 -0500 | [diff] [blame] | 758 | } |
| 759 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 760 | if (!disableNonCoreServices) { |
| 761 | try { |
| Adam Lesinski | 2cb6c60 | 2014-02-14 17:19:56 -0800 | [diff] [blame] | 762 | if (pm.hasSystemFeature(PackageManager.FEATURE_USB_HOST) || |
| 763 | pm.hasSystemFeature(PackageManager.FEATURE_USB_ACCESSORY)) { |
| 764 | // Manage USB host and device support |
| 765 | mSystemServiceManager.startService(USB_SERVICE_CLASS); |
| 766 | } |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 767 | } catch (Throwable e) { |
| 768 | reportWtf("starting UsbService", e); |
| 769 | } |
| Mike Lockwood | 57c798a | 2010-06-23 17:36:36 -0400 | [diff] [blame] | 770 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 771 | try { |
| 772 | Slog.i(TAG, "Serial Service"); |
| 773 | // Serial port support |
| 774 | serial = new SerialService(context); |
| 775 | ServiceManager.addService(Context.SERIAL_SERVICE, serial); |
| 776 | } catch (Throwable e) { |
| 777 | Slog.e(TAG, "Failure starting SerialService", e); |
| 778 | } |
| Mike Lockwood | b01e8bf | 2011-08-29 20:11:07 -0400 | [diff] [blame] | 779 | } |
| 780 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 781 | mSystemServiceManager.startService(TwilightService.class); |
| Jeff Brown | 2416e09 | 2012-08-21 22:12:20 -0700 | [diff] [blame] | 782 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 783 | mSystemServiceManager.startService(UiModeManagerService.class); |
| Dianne Hackborn | 7299c41 | 2010-03-04 18:41:49 -0800 | [diff] [blame] | 784 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 785 | if (!disableNonCoreServices) { |
| 786 | try { |
| Adam Lesinski | 3d9bcb9 | 2014-02-18 14:05:14 -0800 | [diff] [blame] | 787 | if (pm.hasSystemFeature(PackageManager.FEATURE_BACKUP)) { |
| Adam Lesinski | 2cb6c60 | 2014-02-14 17:19:56 -0800 | [diff] [blame] | 788 | mSystemServiceManager.startService(BACKUP_MANAGER_SERVICE_CLASS); |
| Adam Lesinski | 898c13d | 2014-01-28 15:34:50 -0800 | [diff] [blame] | 789 | } |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 790 | } catch (Throwable e) { |
| 791 | Slog.e(TAG, "Failure starting Backup Service", e); |
| 792 | } |
| Christopher Tate | 487529a | 2009-04-29 14:03:25 -0700 | [diff] [blame] | 793 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 794 | try { |
| Adam Lesinski | 3d9bcb9 | 2014-02-18 14:05:14 -0800 | [diff] [blame] | 795 | if (pm.hasSystemFeature(PackageManager.FEATURE_APP_WIDGETS)) { |
| Adam Lesinski | 2cb6c60 | 2014-02-14 17:19:56 -0800 | [diff] [blame] | 796 | mSystemServiceManager.startService(APPWIDGET_SERVICE_CLASS); |
| Adam Lesinski | 898c13d | 2014-01-28 15:34:50 -0800 | [diff] [blame] | 797 | } |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 798 | } catch (Throwable e) { |
| 799 | reportWtf("starting AppWidget Service", e); |
| 800 | } |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 801 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 802 | try { |
| 803 | Slog.i(TAG, "Recognition Service"); |
| 804 | recognition = new RecognitionManagerService(context); |
| 805 | } catch (Throwable e) { |
| 806 | reportWtf("starting Recognition Service", e); |
| 807 | } |
| Dianne Hackborn | 21f1bd1 | 2010-02-19 17:02:21 -0800 | [diff] [blame] | 808 | } |
| Jaikumar Ganesh | 7d0548d | 2010-10-18 15:29:09 -0700 | [diff] [blame] | 809 | |
| Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 810 | try { |
| Dan Egnor | 621bc54 | 2010-03-25 16:20:14 -0700 | [diff] [blame] | 811 | Slog.i(TAG, "DiskStats Service"); |
| 812 | ServiceManager.addService("diskstats", new DiskStatsService(context)); |
| 813 | } catch (Throwable e) { |
| Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 814 | reportWtf("starting DiskStats Service", e); |
| Dan Egnor | 621bc54 | 2010-03-25 16:20:14 -0700 | [diff] [blame] | 815 | } |
| Sen Hu | bde7570 | 2010-05-28 01:54:03 -0700 | [diff] [blame] | 816 | |
| 817 | try { |
| 818 | // need to add this service even if SamplingProfilerIntegration.isEnabled() |
| 819 | // is false, because it is this service that detects system property change and |
| 820 | // turns on SamplingProfilerIntegration. Plus, when sampling profiler doesn't work, |
| 821 | // there is little overhead for running this service. |
| 822 | Slog.i(TAG, "SamplingProfiler Service"); |
| 823 | ServiceManager.addService("samplingprofiler", |
| 824 | new SamplingProfilerService(context)); |
| 825 | } catch (Throwable e) { |
| Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 826 | reportWtf("starting SamplingProfiler Service", e); |
| Sen Hu | bde7570 | 2010-05-28 01:54:03 -0700 | [diff] [blame] | 827 | } |
| Chung-yih Wang | 024d596 | 2010-08-06 12:06:04 +0800 | [diff] [blame] | 828 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 829 | if (!disableNetwork) { |
| 830 | try { |
| 831 | Slog.i(TAG, "NetworkTimeUpdateService"); |
| 832 | networkTimeUpdater = new NetworkTimeUpdateService(context); |
| 833 | } catch (Throwable e) { |
| 834 | reportWtf("starting NetworkTimeUpdate service", e); |
| 835 | } |
| Amith Yamasani | 6734b9f6 | 2010-09-13 16:24:08 -0700 | [diff] [blame] | 836 | } |
| John Grossman | c157673 | 2012-02-01 15:23:33 -0800 | [diff] [blame] | 837 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 838 | if (!disableMedia) { |
| 839 | try { |
| 840 | Slog.i(TAG, "CommonTimeManagementService"); |
| 841 | commonTimeMgmtService = new CommonTimeManagementService(context); |
| 842 | ServiceManager.addService("commontime_management", commonTimeMgmtService); |
| 843 | } catch (Throwable e) { |
| 844 | reportWtf("starting CommonTimeManagementService service", e); |
| 845 | } |
| John Grossman | c157673 | 2012-02-01 15:23:33 -0800 | [diff] [blame] | 846 | } |
| Geremy Condra | 3d33c26 | 2012-05-06 18:32:19 -0700 | [diff] [blame] | 847 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 848 | if (!disableNetwork) { |
| 849 | try { |
| 850 | Slog.i(TAG, "CertBlacklister"); |
| 851 | CertBlacklister blacklister = new CertBlacklister(context); |
| 852 | } catch (Throwable e) { |
| 853 | reportWtf("starting CertBlacklister", e); |
| 854 | } |
| Geremy Condra | 3d33c26 | 2012-05-06 18:32:19 -0700 | [diff] [blame] | 855 | } |
| Jim Miller | 5ecd811 | 2013-01-09 18:50:26 -0800 | [diff] [blame] | 856 | |
| Jeff Brown | e0dd3ca8 | 2014-02-24 13:57:53 -0800 | [diff] [blame] | 857 | if (!disableNonCoreServices) { |
| 858 | // Dreams (interactive idle-time views, a/k/a screen savers, and doze mode) |
| Jeff Brown | 567f7ca | 2014-01-30 23:38:03 -0800 | [diff] [blame] | 859 | mSystemServiceManager.startService(DreamManagerService.class); |
| Daniel Sandler | 7d276c3 | 2012-01-30 14:33:52 -0500 | [diff] [blame] | 860 | } |
| Svetoslav | b3038ec | 2013-02-13 14:39:30 -0800 | [diff] [blame] | 861 | |
| Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 862 | if (!disableNonCoreServices) { |
| 863 | try { |
| 864 | Slog.i(TAG, "Assets Atlas Service"); |
| 865 | atlas = new AssetAtlasService(context); |
| 866 | ServiceManager.addService(AssetAtlasService.ASSET_ATLAS_SERVICE, atlas); |
| 867 | } catch (Throwable e) { |
| 868 | reportWtf("starting AssetAtlasService", e); |
| 869 | } |
| 870 | } |
| 871 | |
| Svetoslav | b3038ec | 2013-02-13 14:39:30 -0800 | [diff] [blame] | 872 | try { |
| 873 | Slog.i(TAG, "IdleMaintenanceService"); |
| Svetoslav | 6a08a12 | 2013-05-03 11:24:26 -0700 | [diff] [blame] | 874 | new IdleMaintenanceService(context, battery); |
| Svetoslav | b3038ec | 2013-02-13 14:39:30 -0800 | [diff] [blame] | 875 | } catch (Throwable e) { |
| 876 | reportWtf("starting IdleMaintenanceService", e); |
| 877 | } |
| Svetoslav Ganov | 4b9a4d1 | 2013-06-11 15:20:06 -0700 | [diff] [blame] | 878 | |
| 879 | try { |
| Adam Lesinski | 3d9bcb9 | 2014-02-18 14:05:14 -0800 | [diff] [blame] | 880 | if (pm.hasSystemFeature(PackageManager.FEATURE_PRINTING)) { |
| Adam Lesinski | 2cb6c60 | 2014-02-14 17:19:56 -0800 | [diff] [blame] | 881 | mSystemServiceManager.startService(PRINT_MANAGER_SERVICE_CLASS); |
| Adam Lesinski | 898c13d | 2014-01-28 15:34:50 -0800 | [diff] [blame] | 882 | } |
| Svetoslav Ganov | 4b9a4d1 | 2013-06-11 15:20:06 -0700 | [diff] [blame] | 883 | } catch (Throwable e) { |
| 884 | reportWtf("starting Print Service", e); |
| 885 | } |
| Jeff Brown | 69b0716 | 2013-11-07 00:30:16 -0800 | [diff] [blame] | 886 | |
| RoboErik | 01fe661 | 2014-02-13 14:19:04 -0800 | [diff] [blame] | 887 | try { |
| 888 | Slog.i(TAG, "MediaSessionService"); |
| 889 | mSystemServiceManager.startService(MediaSessionService.class); |
| 890 | } catch (Throwable e) { |
| 891 | reportWtf("starting MediaSessionService", e); |
| 892 | } |
| 893 | |
| Colin Cross | a42cb8b | 2014-03-21 13:11:02 -0700 | [diff] [blame^] | 894 | try { |
| Jinsuk Kim | 4f512fb | 2014-02-28 17:41:17 +0900 | [diff] [blame] | 895 | mSystemServiceManager.startService(HDMI_CEC_SERVICE_CLASS); |
| 896 | } catch (Throwable e) { |
| 897 | reportWtf("starting HdmiCec Service", e); |
| 898 | } |
| 899 | |
| Jeff Brown | 69b0716 | 2013-11-07 00:30:16 -0800 | [diff] [blame] | 900 | if (!disableNonCoreServices) { |
| 901 | try { |
| 902 | Slog.i(TAG, "Media Router Service"); |
| 903 | mediaRouter = new MediaRouterService(context); |
| 904 | ServiceManager.addService(Context.MEDIA_ROUTER_SERVICE, mediaRouter); |
| 905 | } catch (Throwable e) { |
| 906 | reportWtf("starting MediaRouterService", e); |
| 907 | } |
| 908 | } |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 909 | } |
| 910 | |
| Dianne Hackborn | 6af0d50 | 2009-09-28 13:25:46 -0700 | [diff] [blame] | 911 | // Before things start rolling, be sure we have decided whether |
| 912 | // we are in safe mode. |
| Dianne Hackborn | a34f1ad | 2009-09-02 13:26:28 -0700 | [diff] [blame] | 913 | final boolean safeMode = wm.detectSafeMode(); |
| Dianne Hackborn | 6af0d50 | 2009-09-28 13:25:46 -0700 | [diff] [blame] | 914 | if (safeMode) { |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 915 | mActivityManagerService.enterSafeMode(); |
| Jeff Brown | b09abc1 | 2011-01-13 21:08:27 -0800 | [diff] [blame] | 916 | // Post the safe mode state in the Zygote class |
| 917 | Zygote.systemInSafeMode = true; |
| 918 | // Disable the JIT for the system_server process |
| 919 | VMRuntime.getRuntime().disableJitCompilation(); |
| Ben Cheng | 6c0afff | 2010-02-14 16:18:56 -0800 | [diff] [blame] | 920 | } else { |
| 921 | // Enable the JIT for the system_server process |
| 922 | VMRuntime.getRuntime().startJitCompilation(); |
| Dianne Hackborn | 6af0d50 | 2009-09-28 13:25:46 -0700 | [diff] [blame] | 923 | } |
| Doug Zongker | ab5c49c | 2009-12-04 10:31:43 -0800 | [diff] [blame] | 924 | |
| Dianne Hackborn | 6af0d50 | 2009-09-28 13:25:46 -0700 | [diff] [blame] | 925 | // It is now time to start up the app processes... |
| Joe Onorato | 3027548 | 2009-07-08 17:09:14 -0700 | [diff] [blame] | 926 | |
| Jeff Brown | 7f6c231 | 2012-04-13 20:38:38 -0700 | [diff] [blame] | 927 | try { |
| 928 | vibrator.systemReady(); |
| 929 | } catch (Throwable e) { |
| 930 | reportWtf("making Vibrator Service ready", e); |
| 931 | } |
| 932 | |
| Dan Morrill | e4d9a01 | 2013-03-28 18:10:43 -0700 | [diff] [blame] | 933 | if (lockSettings != null) { |
| 934 | try { |
| 935 | lockSettings.systemReady(); |
| 936 | } catch (Throwable e) { |
| 937 | reportWtf("making Lock Settings Service ready", e); |
| 938 | } |
| Felipe Ramos | f35df5b | 2012-09-18 18:26:27 -0300 | [diff] [blame] | 939 | } |
| 940 | |
| Amith Yamasani | 817ec49 | 2013-12-20 13:27:30 -0800 | [diff] [blame] | 941 | // Needed by DevicePolicyManager for initialization |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 942 | mSystemServiceManager.startBootPhase(SystemService.PHASE_LOCK_SETTINGS_READY); |
| Dianne Hackborn | d684784 | 2010-01-12 18:14:19 -0800 | [diff] [blame] | 943 | |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 944 | mSystemServiceManager.startBootPhase(SystemService.PHASE_SYSTEM_SERVICES_READY); |
| Joe Onorato | 3027548 | 2009-07-08 17:09:14 -0700 | [diff] [blame] | 945 | |
| Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 946 | try { |
| 947 | wm.systemReady(); |
| 948 | } catch (Throwable e) { |
| 949 | reportWtf("making Window Manager Service ready", e); |
| 950 | } |
| Joe Onorato | dc565f4 | 2010-10-04 15:27:22 -0400 | [diff] [blame] | 951 | |
| Jeff Brown | b09abc1 | 2011-01-13 21:08:27 -0800 | [diff] [blame] | 952 | if (safeMode) { |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 953 | mActivityManagerService.showSafeModeOverlay(); |
| Jeff Brown | b09abc1 | 2011-01-13 21:08:27 -0800 | [diff] [blame] | 954 | } |
| 955 | |
| Joe Onorato | dc565f4 | 2010-10-04 15:27:22 -0400 | [diff] [blame] | 956 | // Update the configuration for this context by hand, because we're going |
| 957 | // to start using it before the config change done in wm.systemReady() will |
| 958 | // propagate to it. |
| 959 | Configuration config = wm.computeNewConfiguration(); |
| 960 | DisplayMetrics metrics = new DisplayMetrics(); |
| 961 | WindowManager w = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); |
| 962 | w.getDefaultDisplay().getMetrics(metrics); |
| 963 | context.getResources().updateConfiguration(config, metrics); |
| 964 | |
| Jeff Brown | aa202a6 | 2012-08-21 22:14:26 -0700 | [diff] [blame] | 965 | try { |
| Jeff Brown | 6f357d3 | 2014-01-15 20:40:55 -0800 | [diff] [blame] | 966 | // TODO: use boot phase |
| Jeff Brown | 567f7ca | 2014-01-30 23:38:03 -0800 | [diff] [blame] | 967 | mPowerManagerService.systemReady(); |
| Jeff Brown | aa202a6 | 2012-08-21 22:14:26 -0700 | [diff] [blame] | 968 | } catch (Throwable e) { |
| 969 | reportWtf("making Power Manager Service ready", e); |
| 970 | } |
| 971 | |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 972 | try { |
| 973 | pm.systemReady(); |
| Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 974 | } catch (Throwable e) { |
| 975 | reportWtf("making Package Manager Service ready", e); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 976 | } |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 977 | |
| Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 978 | try { |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 979 | // TODO: use boot phase and communicate these flags some other way |
| 980 | mDisplayManagerService.systemReady(safeMode, onlyCore); |
| Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 981 | } catch (Throwable e) { |
| 982 | reportWtf("making Display Manager Service ready", e); |
| 983 | } |
| 984 | |
| Dianne Hackborn | a34f1ad | 2009-09-02 13:26:28 -0700 | [diff] [blame] | 985 | // These are needed to propagate to the runnable below. |
| Jeff Sharkey | b049e212 | 2012-09-07 23:16:01 -0700 | [diff] [blame] | 986 | final MountService mountServiceF = mountService; |
| Dianne Hackborn | a34f1ad | 2009-09-02 13:26:28 -0700 | [diff] [blame] | 987 | final BatteryService batteryF = battery; |
| Jeff Sharkey | 350083e | 2011-06-29 10:45:16 -0700 | [diff] [blame] | 988 | final NetworkManagementService networkManagementF = networkManagement; |
| Jeff Sharkey | 7527990 | 2011-05-24 18:39:45 -0700 | [diff] [blame] | 989 | final NetworkStatsService networkStatsF = networkStats; |
| Jeff Sharkey | a462079 | 2011-05-20 15:29:23 -0700 | [diff] [blame] | 990 | final NetworkPolicyManagerService networkPolicyF = networkPolicy; |
| Dianne Hackborn | a34f1ad | 2009-09-02 13:26:28 -0700 | [diff] [blame] | 991 | final ConnectivityService connectivityF = connectivity; |
| 992 | final DockObserver dockF = dock; |
| Dianne Hackborn | a34f1ad | 2009-09-02 13:26:28 -0700 | [diff] [blame] | 993 | final WallpaperManagerService wallpaperF = wallpaper; |
| 994 | final InputMethodManagerService immF = imm; |
| Dianne Hackborn | 21f1bd1 | 2010-02-19 17:02:21 -0800 | [diff] [blame] | 995 | final RecognitionManagerService recognitionF = recognition; |
| Mike Lockwood | 46db504 | 2010-02-22 16:36:44 -0500 | [diff] [blame] | 996 | final LocationManagerService locationF = location; |
| Bai Tao | a58a875 | 2010-07-13 15:32:16 +0800 | [diff] [blame] | 997 | final CountryDetectorService countryDetectorF = countryDetector; |
| Amith Yamasani | 6734b9f6 | 2010-09-13 16:24:08 -0700 | [diff] [blame] | 998 | final NetworkTimeUpdateService networkTimeUpdaterF = networkTimeUpdater; |
| John Grossman | c157673 | 2012-02-01 15:23:33 -0800 | [diff] [blame] | 999 | final CommonTimeManagementService commonTimeMgmtServiceF = commonTimeMgmtService; |
| satok | 988323c | 2011-06-22 16:38:13 +0900 | [diff] [blame] | 1000 | final TextServicesManagerService textServiceManagerServiceF = tsms; |
| Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 1001 | final StatusBarManagerService statusBarF = statusBar; |
| Romain Guy | 3b748a4 | 2013-04-17 18:54:38 -0700 | [diff] [blame] | 1002 | final AssetAtlasService atlasF = atlas; |
| Jeff Brown | 6ec6f79 | 2012-04-17 16:52:41 -0700 | [diff] [blame] | 1003 | final InputManagerService inputManagerF = inputManager; |
| Wink Saville | a12a7b3 | 2012-09-20 10:09:45 -0700 | [diff] [blame] | 1004 | final TelephonyRegistry telephonyRegistryF = telephonyRegistry; |
| Jeff Brown | 69b0716 | 2013-11-07 00:30:16 -0800 | [diff] [blame] | 1005 | final MediaRouterService mediaRouterF = mediaRouter; |
| Doug Zongker | ab5c49c | 2009-12-04 10:31:43 -0800 | [diff] [blame] | 1006 | |
| Dianne Hackborn | a34f1ad | 2009-09-02 13:26:28 -0700 | [diff] [blame] | 1007 | // We now tell the activity manager it is okay to run third party |
| 1008 | // code. It will call back into us once it has gotten to the state |
| 1009 | // where third party code can really run (but before it has actually |
| 1010 | // started launching the initial applications), for us to complete our |
| 1011 | // initialization. |
| Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 1012 | mActivityManagerService.systemReady(new Runnable() { |
| Adam Lesinski | 2cb6c60 | 2014-02-14 17:19:56 -0800 | [diff] [blame] | 1013 | @Override |
| Dianne Hackborn | a34f1ad | 2009-09-02 13:26:28 -0700 | [diff] [blame] | 1014 | public void run() { |
| Adam Lesinski | 8793dd8 | 2014-02-21 14:06:47 -0800 | [diff] [blame] | 1015 | Slog.i(TAG, "Making services ready"); |
| 1016 | mSystemServiceManager.startBootPhase( |
| 1017 | SystemService.PHASE_ACTIVITY_MANAGER_READY); |
| Doug Zongker | ab5c49c | 2009-12-04 10:31:43 -0800 | [diff] [blame] | 1018 | |
| Adam Lesinski | 8793dd8 | 2014-02-21 14:06:47 -0800 | [diff] [blame] | 1019 | try { |
| 1020 | mActivityManagerService.startObservingNativeCrashes(); |
| 1021 | } catch (Throwable e) { |
| 1022 | reportWtf("observing native crashes", e); |
| 1023 | } |
| 1024 | try { |
| 1025 | startSystemUi(context); |
| 1026 | } catch (Throwable e) { |
| 1027 | reportWtf("starting System UI", e); |
| 1028 | } |
| 1029 | try { |
| 1030 | if (mountServiceF != null) mountServiceF.systemReady(); |
| 1031 | } catch (Throwable e) { |
| 1032 | reportWtf("making Mount Service ready", e); |
| 1033 | } |
| 1034 | try { |
| 1035 | if (batteryF != null) batteryF.systemReady(); |
| 1036 | } catch (Throwable e) { |
| 1037 | reportWtf("making Battery Service ready", e); |
| 1038 | } |
| 1039 | try { |
| 1040 | if (networkManagementF != null) networkManagementF.systemReady(); |
| 1041 | } catch (Throwable e) { |
| 1042 | reportWtf("making Network Managment Service ready", e); |
| 1043 | } |
| 1044 | try { |
| 1045 | if (networkStatsF != null) networkStatsF.systemReady(); |
| 1046 | } catch (Throwable e) { |
| 1047 | reportWtf("making Network Stats Service ready", e); |
| 1048 | } |
| 1049 | try { |
| 1050 | if (networkPolicyF != null) networkPolicyF.systemReady(); |
| 1051 | } catch (Throwable e) { |
| 1052 | reportWtf("making Network Policy Service ready", e); |
| 1053 | } |
| 1054 | try { |
| 1055 | if (connectivityF != null) connectivityF.systemReady(); |
| 1056 | } catch (Throwable e) { |
| 1057 | reportWtf("making Connectivity Service ready", e); |
| 1058 | } |
| 1059 | try { |
| 1060 | if (dockF != null) dockF.systemReady(); |
| 1061 | } catch (Throwable e) { |
| 1062 | reportWtf("making Dock Service ready", e); |
| 1063 | } |
| 1064 | try { |
| 1065 | if (recognitionF != null) recognitionF.systemReady(); |
| 1066 | } catch (Throwable e) { |
| 1067 | reportWtf("making Recognition Service ready", e); |
| 1068 | } |
| 1069 | Watchdog.getInstance().start(); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1070 | |
| Adam Lesinski | 8793dd8 | 2014-02-21 14:06:47 -0800 | [diff] [blame] | 1071 | // It is now okay to let the various system services start their |
| 1072 | // third party code... |
| 1073 | mSystemServiceManager.startBootPhase( |
| 1074 | SystemService.PHASE_THIRD_PARTY_APPS_CAN_START); |
| Doug Zongker | ab5c49c | 2009-12-04 10:31:43 -0800 | [diff] [blame] | 1075 | |
| Adam Lesinski | 8793dd8 | 2014-02-21 14:06:47 -0800 | [diff] [blame] | 1076 | try { |
| 1077 | if (wallpaperF != null) wallpaperF.systemRunning(); |
| 1078 | } catch (Throwable e) { |
| 1079 | reportWtf("Notifying WallpaperService running", e); |
| 1080 | } |
| 1081 | try { |
| 1082 | if (immF != null) immF.systemRunning(statusBarF); |
| 1083 | } catch (Throwable e) { |
| 1084 | reportWtf("Notifying InputMethodService running", e); |
| 1085 | } |
| 1086 | try { |
| 1087 | if (locationF != null) locationF.systemRunning(); |
| 1088 | } catch (Throwable e) { |
| 1089 | reportWtf("Notifying Location Service running", e); |
| 1090 | } |
| 1091 | try { |
| 1092 | if (countryDetectorF != null) countryDetectorF.systemRunning(); |
| 1093 | } catch (Throwable e) { |
| 1094 | reportWtf("Notifying CountryDetectorService running", e); |
| 1095 | } |
| 1096 | try { |
| 1097 | if (networkTimeUpdaterF != null) networkTimeUpdaterF.systemRunning(); |
| 1098 | } catch (Throwable e) { |
| 1099 | reportWtf("Notifying NetworkTimeService running", e); |
| 1100 | } |
| 1101 | try { |
| 1102 | if (commonTimeMgmtServiceF != null) { |
| 1103 | commonTimeMgmtServiceF.systemRunning(); |
| Adam Lesinski | 2cb6c60 | 2014-02-14 17:19:56 -0800 | [diff] [blame] | 1104 | } |
| Adam Lesinski | 8793dd8 | 2014-02-21 14:06:47 -0800 | [diff] [blame] | 1105 | } catch (Throwable e) { |
| 1106 | reportWtf("Notifying CommonTimeManagementService running", e); |
| 1107 | } |
| 1108 | try { |
| 1109 | if (textServiceManagerServiceF != null) |
| 1110 | textServiceManagerServiceF.systemRunning(); |
| 1111 | } catch (Throwable e) { |
| 1112 | reportWtf("Notifying TextServicesManagerService running", e); |
| 1113 | } |
| 1114 | try { |
| 1115 | if (atlasF != null) atlasF.systemRunning(); |
| 1116 | } catch (Throwable e) { |
| 1117 | reportWtf("Notifying AssetAtlasService running", e); |
| 1118 | } |
| 1119 | try { |
| 1120 | // TODO(BT) Pass parameter to input manager |
| 1121 | if (inputManagerF != null) inputManagerF.systemRunning(); |
| 1122 | } catch (Throwable e) { |
| 1123 | reportWtf("Notifying InputManagerService running", e); |
| 1124 | } |
| 1125 | try { |
| 1126 | if (telephonyRegistryF != null) telephonyRegistryF.systemRunning(); |
| 1127 | } catch (Throwable e) { |
| 1128 | reportWtf("Notifying TelephonyRegistry running", e); |
| 1129 | } |
| 1130 | try { |
| 1131 | if (mediaRouterF != null) mediaRouterF.systemRunning(); |
| 1132 | } catch (Throwable e) { |
| 1133 | reportWtf("Notifying MediaRouterService running", e); |
| 1134 | } |
| 1135 | |
| 1136 | mSystemServiceManager.startBootPhase(SystemService.PHASE_BOOT_COMPLETE); |
| Dianne Hackborn | a34f1ad | 2009-09-02 13:26:28 -0700 | [diff] [blame] | 1137 | } |
| 1138 | }); |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1139 | } |
| Joe Onorato | f3c3c4f | 2010-10-21 11:09:02 -0400 | [diff] [blame] | 1140 | |
| 1141 | static final void startSystemUi(Context context) { |
| 1142 | Intent intent = new Intent(); |
| 1143 | intent.setComponent(new ComponentName("com.android.systemui", |
| 1144 | "com.android.systemui.SystemUIService")); |
| Dianne Hackborn | 40e9f29 | 2012-11-27 19:12:23 -0800 | [diff] [blame] | 1145 | //Slog.d(TAG, "Starting service: " + intent); |
| Amith Yamasani | cd75706 | 2012-10-19 18:23:52 -0700 | [diff] [blame] | 1146 | context.startServiceAsUser(intent, UserHandle.OWNER); |
| Joe Onorato | f3c3c4f | 2010-10-21 11:09:02 -0400 | [diff] [blame] | 1147 | } |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1148 | } |