SystemServer.java revision 6e6cd7a5660af1a4b5a9ad091c41ef1c72ad2000
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 17package com.android.server; 18 19import com.android.server.accessibility.AccessibilityManagerService; 20import com.android.server.am.ActivityManagerService; 21import com.android.server.pm.PackageManagerService; 22import com.android.server.usb.UsbService; 23import com.android.server.wm.WindowManagerService; 24import com.android.internal.app.ShutdownThread; 25import com.android.internal.os.BinderInternal; 26import com.android.internal.os.SamplingProfilerIntegration; 27 28import dalvik.system.VMRuntime; 29import dalvik.system.Zygote; 30 31import android.accounts.AccountManagerService; 32import android.app.ActivityManagerNative; 33import android.bluetooth.BluetoothAdapter; 34import android.content.ComponentName; 35import android.content.ContentResolver; 36import android.content.ContentService; 37import android.content.Context; 38import android.content.Intent; 39import android.content.pm.IPackageManager; 40import android.content.res.Configuration; 41import android.database.ContentObserver; 42import android.media.AudioService; 43import android.os.Build; 44import android.os.Looper; 45import android.os.RemoteException; 46import android.os.ServiceManager; 47import android.os.StrictMode; 48import android.os.SystemClock; 49import android.os.SystemProperties; 50import android.provider.Contacts.People; 51import android.provider.Settings; 52import android.server.BluetoothA2dpService; 53import android.server.BluetoothService; 54import android.server.search.SearchManagerService; 55import android.util.DisplayMetrics; 56import android.util.EventLog; 57import android.util.Log; 58import android.util.Slog; 59import android.view.Display; 60import android.view.WindowManager; 61 62import java.io.File; 63import java.util.Timer; 64import java.util.TimerTask; 65 66class ServerThread extends Thread { 67 private static final String TAG = "SystemServer"; 68 69 ContentResolver mContentResolver; 70 71 private class AdbSettingsObserver extends ContentObserver { 72 public AdbSettingsObserver() { 73 super(null); 74 } 75 @Override 76 public void onChange(boolean selfChange) { 77 boolean enableAdb = (Settings.Secure.getInt(mContentResolver, 78 Settings.Secure.ADB_ENABLED, 0) > 0); 79 // setting this secure property will start or stop adbd 80 SystemProperties.set("persist.service.adb.enable", enableAdb ? "1" : "0"); 81 } 82 } 83 84 @Override 85 public void run() { 86 EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_SYSTEM_RUN, 87 SystemClock.uptimeMillis()); 88 89 Looper.prepare(); 90 91 android.os.Process.setThreadPriority( 92 android.os.Process.THREAD_PRIORITY_FOREGROUND); 93 94 BinderInternal.disableBackgroundScheduling(true); 95 android.os.Process.setCanSelfBackground(false); 96 97 // Check whether we failed to shut down last time we tried. 98 { 99 final String shutdownAction = SystemProperties.get( 100 ShutdownThread.SHUTDOWN_ACTION_PROPERTY, ""); 101 if (shutdownAction != null && shutdownAction.length() > 0) { 102 boolean reboot = (shutdownAction.charAt(0) == '1'); 103 104 final String reason; 105 if (shutdownAction.length() > 1) { 106 reason = shutdownAction.substring(1, shutdownAction.length()); 107 } else { 108 reason = null; 109 } 110 111 ShutdownThread.rebootOrShutdown(reboot, reason); 112 } 113 } 114 115 String factoryTestStr = SystemProperties.get("ro.factorytest"); 116 int factoryTest = "".equals(factoryTestStr) ? SystemServer.FACTORY_TEST_OFF 117 : Integer.parseInt(factoryTestStr); 118 119 LightsService lights = null; 120 PowerManagerService power = null; 121 BatteryService battery = null; 122 ConnectivityService connectivity = null; 123 IPackageManager pm = null; 124 Context context = null; 125 WindowManagerService wm = null; 126 BluetoothService bluetooth = null; 127 BluetoothA2dpService bluetoothA2dp = null; 128 WiredAccessoryObserver wiredAccessory = null; 129 DockObserver dock = null; 130 UsbService usb = null; 131 UiModeManagerService uiMode = null; 132 RecognitionManagerService recognition = null; 133 ThrottleService throttle = null; 134 NetworkTimeUpdateService networkTimeUpdater = null; 135 136 // Critical services... 137 try { 138 Slog.i(TAG, "Entropy Service"); 139 ServiceManager.addService("entropy", new EntropyService()); 140 141 Slog.i(TAG, "Power Manager"); 142 power = new PowerManagerService(); 143 ServiceManager.addService(Context.POWER_SERVICE, power); 144 145 Slog.i(TAG, "Activity Manager"); 146 context = ActivityManagerService.main(factoryTest); 147 148 Slog.i(TAG, "Telephony Registry"); 149 ServiceManager.addService("telephony.registry", new TelephonyRegistry(context)); 150 151 AttributeCache.init(context); 152 153 Slog.i(TAG, "Package Manager"); 154 pm = PackageManagerService.main(context, 155 factoryTest != SystemServer.FACTORY_TEST_OFF); 156 157 ActivityManagerService.setSystemProcess(); 158 159 mContentResolver = context.getContentResolver(); 160 161 // The AccountManager must come before the ContentService 162 try { 163 Slog.i(TAG, "Account Manager"); 164 ServiceManager.addService(Context.ACCOUNT_SERVICE, 165 new AccountManagerService(context)); 166 } catch (Throwable e) { 167 Slog.e(TAG, "Failure starting Account Manager", e); 168 } 169 170 Slog.i(TAG, "Content Manager"); 171 ContentService.main(context, 172 factoryTest == SystemServer.FACTORY_TEST_LOW_LEVEL); 173 174 Slog.i(TAG, "System Content Providers"); 175 ActivityManagerService.installSystemProviders(); 176 177 Slog.i(TAG, "Lights Service"); 178 lights = new LightsService(context); 179 180 Slog.i(TAG, "Battery Service"); 181 battery = new BatteryService(context, lights); 182 ServiceManager.addService("battery", battery); 183 184 Slog.i(TAG, "Vibrator Service"); 185 ServiceManager.addService("vibrator", new VibratorService(context)); 186 187 // only initialize the power service after we have started the 188 // lights service, content providers and the battery service. 189 power.init(context, lights, ActivityManagerService.getDefault(), battery); 190 191 Slog.i(TAG, "Alarm Manager"); 192 AlarmManagerService alarm = new AlarmManagerService(context); 193 ServiceManager.addService(Context.ALARM_SERVICE, alarm); 194 195 Slog.i(TAG, "Init Watchdog"); 196 Watchdog.getInstance().init(context, battery, power, alarm, 197 ActivityManagerService.self()); 198 199 Slog.i(TAG, "Window Manager"); 200 wm = WindowManagerService.main(context, power, 201 factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL); 202 ServiceManager.addService(Context.WINDOW_SERVICE, wm); 203 204 ((ActivityManagerService)ServiceManager.getService("activity")) 205 .setWindowManager(wm); 206 207 // Skip Bluetooth if we have an emulator kernel 208 // TODO: Use a more reliable check to see if this product should 209 // support Bluetooth - see bug 988521 210 if (SystemProperties.get("ro.kernel.qemu").equals("1")) { 211 Slog.i(TAG, "No Bluetooh Service (emulator)"); 212 } else if (factoryTest == SystemServer.FACTORY_TEST_LOW_LEVEL) { 213 Slog.i(TAG, "No Bluetooth Service (factory test)"); 214 } else { 215 Slog.i(TAG, "Bluetooth Service"); 216 bluetooth = new BluetoothService(context); 217 ServiceManager.addService(BluetoothAdapter.BLUETOOTH_SERVICE, bluetooth); 218 bluetooth.initAfterRegistration(); 219 bluetoothA2dp = new BluetoothA2dpService(context, bluetooth); 220 ServiceManager.addService(BluetoothA2dpService.BLUETOOTH_A2DP_SERVICE, 221 bluetoothA2dp); 222 bluetooth.initAfterA2dpRegistration(); 223 224 int bluetoothOn = Settings.Secure.getInt(mContentResolver, 225 Settings.Secure.BLUETOOTH_ON, 0); 226 if (bluetoothOn > 0) { 227 bluetooth.enable(); 228 } 229 } 230 231 } catch (RuntimeException e) { 232 Slog.e("System", "Failure starting core service", e); 233 } 234 235 DevicePolicyManagerService devicePolicy = null; 236 StatusBarManagerService statusBar = null; 237 InputMethodManagerService imm = null; 238 AppWidgetService appWidget = null; 239 NotificationManagerService notification = null; 240 WallpaperManagerService wallpaper = null; 241 LocationManagerService location = null; 242 CountryDetectorService countryDetector = null; 243 244 if (factoryTest != SystemServer.FACTORY_TEST_LOW_LEVEL) { 245 try { 246 Slog.i(TAG, "Device Policy"); 247 devicePolicy = new DevicePolicyManagerService(context); 248 ServiceManager.addService(Context.DEVICE_POLICY_SERVICE, devicePolicy); 249 } catch (Throwable e) { 250 Slog.e(TAG, "Failure starting DevicePolicyService", e); 251 } 252 253 try { 254 Slog.i(TAG, "Status Bar"); 255 statusBar = new StatusBarManagerService(context, wm); 256 ServiceManager.addService(Context.STATUS_BAR_SERVICE, statusBar); 257 } catch (Throwable e) { 258 Slog.e(TAG, "Failure starting StatusBarManagerService", e); 259 } 260 261 try { 262 Slog.i(TAG, "Clipboard Service"); 263 ServiceManager.addService(Context.CLIPBOARD_SERVICE, 264 new ClipboardService(context)); 265 } catch (Throwable e) { 266 Slog.e(TAG, "Failure starting Clipboard Service", e); 267 } 268 269 try { 270 Slog.i(TAG, "Input Method Service"); 271 imm = new InputMethodManagerService(context, statusBar); 272 ServiceManager.addService(Context.INPUT_METHOD_SERVICE, imm); 273 } catch (Throwable e) { 274 Slog.e(TAG, "Failure starting Input Manager Service", e); 275 } 276 277 try { 278 Slog.i(TAG, "NetStat Service"); 279 ServiceManager.addService("netstat", new NetStatService(context)); 280 } catch (Throwable e) { 281 Slog.e(TAG, "Failure starting NetStat Service", e); 282 } 283 284 try { 285 Slog.i(TAG, "NetworkManagement Service"); 286 ServiceManager.addService( 287 Context.NETWORKMANAGEMENT_SERVICE, 288 NetworkManagementService.create(context)); 289 } catch (Throwable e) { 290 Slog.e(TAG, "Failure starting NetworkManagement Service", e); 291 } 292 293 try { 294 Slog.i(TAG, "Connectivity Service"); 295 connectivity = ConnectivityService.getInstance(context); 296 ServiceManager.addService(Context.CONNECTIVITY_SERVICE, connectivity); 297 } catch (Throwable e) { 298 Slog.e(TAG, "Failure starting Connectivity Service", e); 299 } 300 301 try { 302 Slog.i(TAG, "Throttle Service"); 303 throttle = new ThrottleService(context); 304 ServiceManager.addService( 305 Context.THROTTLE_SERVICE, throttle); 306 } catch (Throwable e) { 307 Slog.e(TAG, "Failure starting ThrottleService", e); 308 } 309 310 try { 311 Slog.i(TAG, "Accessibility Manager"); 312 ServiceManager.addService(Context.ACCESSIBILITY_SERVICE, 313 new AccessibilityManagerService(context)); 314 } catch (Throwable e) { 315 Slog.e(TAG, "Failure starting Accessibility Manager", e); 316 } 317 318 try { 319 /* 320 * NotificationManagerService is dependant on MountService, 321 * (for media / usb notifications) so we must start MountService first. 322 */ 323 Slog.i(TAG, "Mount Service"); 324 ServiceManager.addService("mount", new MountService(context)); 325 } catch (Throwable e) { 326 Slog.e(TAG, "Failure starting Mount Service", e); 327 } 328 329 try { 330 Slog.i(TAG, "Notification Manager"); 331 notification = new NotificationManagerService(context, statusBar, lights); 332 ServiceManager.addService(Context.NOTIFICATION_SERVICE, notification); 333 } catch (Throwable e) { 334 Slog.e(TAG, "Failure starting Notification Manager", e); 335 } 336 337 try { 338 Slog.i(TAG, "Device Storage Monitor"); 339 ServiceManager.addService(DeviceStorageMonitorService.SERVICE, 340 new DeviceStorageMonitorService(context)); 341 } catch (Throwable e) { 342 Slog.e(TAG, "Failure starting DeviceStorageMonitor service", e); 343 } 344 345 try { 346 Slog.i(TAG, "Location Manager"); 347 location = new LocationManagerService(context); 348 ServiceManager.addService(Context.LOCATION_SERVICE, location); 349 } catch (Throwable e) { 350 Slog.e(TAG, "Failure starting Location Manager", e); 351 } 352 353 try { 354 Slog.i(TAG, "Country Detector"); 355 countryDetector = new CountryDetectorService(context); 356 ServiceManager.addService(Context.COUNTRY_DETECTOR, countryDetector); 357 } catch (Throwable e) { 358 Slog.e(TAG, "Failure starting Country Detector", e); 359 } 360 361 try { 362 Slog.i(TAG, "Search Service"); 363 ServiceManager.addService(Context.SEARCH_SERVICE, 364 new SearchManagerService(context)); 365 } catch (Throwable e) { 366 Slog.e(TAG, "Failure starting Search Service", e); 367 } 368 369 try { 370 Slog.i(TAG, "DropBox Service"); 371 ServiceManager.addService(Context.DROPBOX_SERVICE, 372 new DropBoxManagerService(context, new File("/data/system/dropbox"))); 373 } catch (Throwable e) { 374 Slog.e(TAG, "Failure starting DropBoxManagerService", e); 375 } 376 377 try { 378 Slog.i(TAG, "Wallpaper Service"); 379 wallpaper = new WallpaperManagerService(context); 380 ServiceManager.addService(Context.WALLPAPER_SERVICE, wallpaper); 381 } catch (Throwable e) { 382 Slog.e(TAG, "Failure starting Wallpaper Service", e); 383 } 384 385 try { 386 Slog.i(TAG, "Audio Service"); 387 ServiceManager.addService(Context.AUDIO_SERVICE, new AudioService(context)); 388 } catch (Throwable e) { 389 Slog.e(TAG, "Failure starting Audio Service", e); 390 } 391 392 try { 393 Slog.i(TAG, "Dock Observer"); 394 // Listen for dock station changes 395 dock = new DockObserver(context, power); 396 } catch (Throwable e) { 397 Slog.e(TAG, "Failure starting DockObserver", e); 398 } 399 400 try { 401 Slog.i(TAG, "Wired Accessory Observer"); 402 // Listen for wired headset changes 403 wiredAccessory = new WiredAccessoryObserver(context); 404 } catch (Throwable e) { 405 Slog.e(TAG, "Failure starting WiredAccessoryObserver", e); 406 } 407 408 try { 409 Slog.i(TAG, "USB Observer"); 410 // Listen for USB changes 411 usb = new UsbService(context); 412 ServiceManager.addService(Context.USB_SERVICE, usb); 413 } catch (Throwable e) { 414 Slog.e(TAG, "Failure starting UsbService", e); 415 } 416 417 try { 418 Slog.i(TAG, "UI Mode Manager Service"); 419 // Listen for UI mode changes 420 uiMode = new UiModeManagerService(context); 421 } catch (Throwable e) { 422 Slog.e(TAG, "Failure starting UiModeManagerService", e); 423 } 424 425 try { 426 Slog.i(TAG, "Backup Service"); 427 ServiceManager.addService(Context.BACKUP_SERVICE, 428 new BackupManagerService(context)); 429 } catch (Throwable e) { 430 Slog.e(TAG, "Failure starting Backup Service", e); 431 } 432 433 try { 434 Slog.i(TAG, "AppWidget Service"); 435 appWidget = new AppWidgetService(context); 436 ServiceManager.addService(Context.APPWIDGET_SERVICE, appWidget); 437 } catch (Throwable e) { 438 Slog.e(TAG, "Failure starting AppWidget Service", e); 439 } 440 441 try { 442 Slog.i(TAG, "Recognition Service"); 443 recognition = new RecognitionManagerService(context); 444 } catch (Throwable e) { 445 Slog.e(TAG, "Failure starting Recognition Service", e); 446 } 447 448 try { 449 Slog.i(TAG, "DiskStats Service"); 450 ServiceManager.addService("diskstats", new DiskStatsService(context)); 451 } catch (Throwable e) { 452 Slog.e(TAG, "Failure starting DiskStats Service", e); 453 } 454 455 try { 456 // need to add this service even if SamplingProfilerIntegration.isEnabled() 457 // is false, because it is this service that detects system property change and 458 // turns on SamplingProfilerIntegration. Plus, when sampling profiler doesn't work, 459 // there is little overhead for running this service. 460 Slog.i(TAG, "SamplingProfiler Service"); 461 ServiceManager.addService("samplingprofiler", 462 new SamplingProfilerService(context)); 463 } catch (Throwable e) { 464 Slog.e(TAG, "Failure starting SamplingProfiler Service", e); 465 } 466 467 try { 468 Slog.i(TAG, "NetworkTimeUpdateService"); 469 networkTimeUpdater = new NetworkTimeUpdateService(context); 470 } catch (Throwable e) { 471 Slog.e(TAG, "Failure starting NetworkTimeUpdate service"); 472 } 473 } 474 475 // make sure the ADB_ENABLED setting value matches the secure property value 476 Settings.Secure.putInt(mContentResolver, Settings.Secure.ADB_ENABLED, 477 "1".equals(SystemProperties.get("persist.service.adb.enable")) ? 1 : 0); 478 479 // register observer to listen for settings changes 480 mContentResolver.registerContentObserver(Settings.Secure.getUriFor(Settings.Secure.ADB_ENABLED), 481 false, new AdbSettingsObserver()); 482 483 // Before things start rolling, be sure we have decided whether 484 // we are in safe mode. 485 final boolean safeMode = wm.detectSafeMode(); 486 if (safeMode) { 487 ActivityManagerService.self().enterSafeMode(); 488 // Post the safe mode state in the Zygote class 489 Zygote.systemInSafeMode = true; 490 // Disable the JIT for the system_server process 491 VMRuntime.getRuntime().disableJitCompilation(); 492 } else { 493 // Enable the JIT for the system_server process 494 VMRuntime.getRuntime().startJitCompilation(); 495 } 496 497 // It is now time to start up the app processes... 498 499 if (devicePolicy != null) { 500 devicePolicy.systemReady(); 501 } 502 503 if (notification != null) { 504 notification.systemReady(); 505 } 506 507 wm.systemReady(); 508 509 if (safeMode) { 510 ActivityManagerService.self().showSafeModeOverlay(); 511 } 512 513 // Update the configuration for this context by hand, because we're going 514 // to start using it before the config change done in wm.systemReady() will 515 // propagate to it. 516 Configuration config = wm.computeNewConfiguration(); 517 DisplayMetrics metrics = new DisplayMetrics(); 518 WindowManager w = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE); 519 w.getDefaultDisplay().getMetrics(metrics); 520 context.getResources().updateConfiguration(config, metrics); 521 522 power.systemReady(); 523 try { 524 pm.systemReady(); 525 } catch (RemoteException e) { 526 } 527 528 // These are needed to propagate to the runnable below. 529 final Context contextF = context; 530 final BatteryService batteryF = battery; 531 final ConnectivityService connectivityF = connectivity; 532 final DockObserver dockF = dock; 533 final UsbService usbF = usb; 534 final ThrottleService throttleF = throttle; 535 final UiModeManagerService uiModeF = uiMode; 536 final AppWidgetService appWidgetF = appWidget; 537 final WallpaperManagerService wallpaperF = wallpaper; 538 final InputMethodManagerService immF = imm; 539 final RecognitionManagerService recognitionF = recognition; 540 final LocationManagerService locationF = location; 541 final CountryDetectorService countryDetectorF = countryDetector; 542 final NetworkTimeUpdateService networkTimeUpdaterF = networkTimeUpdater; 543 544 // We now tell the activity manager it is okay to run third party 545 // code. It will call back into us once it has gotten to the state 546 // where third party code can really run (but before it has actually 547 // started launching the initial applications), for us to complete our 548 // initialization. 549 ((ActivityManagerService)ActivityManagerNative.getDefault()) 550 .systemReady(new Runnable() { 551 public void run() { 552 Slog.i(TAG, "Making services ready"); 553 554 startSystemUi(contextF); 555 if (batteryF != null) batteryF.systemReady(); 556 if (connectivityF != null) connectivityF.systemReady(); 557 if (dockF != null) dockF.systemReady(); 558 if (usbF != null) usbF.systemReady(); 559 if (uiModeF != null) uiModeF.systemReady(); 560 if (recognitionF != null) recognitionF.systemReady(); 561 Watchdog.getInstance().start(); 562 563 // It is now okay to let the various system services start their 564 // third party code... 565 566 if (appWidgetF != null) appWidgetF.systemReady(safeMode); 567 if (wallpaperF != null) wallpaperF.systemReady(); 568 if (immF != null) immF.systemReady(); 569 if (locationF != null) locationF.systemReady(); 570 if (countryDetectorF != null) countryDetectorF.systemReady(); 571 if (throttleF != null) throttleF.systemReady(); 572 if (networkTimeUpdaterF != null) networkTimeUpdaterF.systemReady(); 573 } 574 }); 575 576 // For debug builds, log event loop stalls to dropbox for analysis. 577 if (StrictMode.conditionallyEnableDebugLogging()) { 578 Slog.i(TAG, "Enabled StrictMode for system server main thread."); 579 } 580 581 Looper.loop(); 582 Slog.d(TAG, "System ServerThread is exiting!"); 583 } 584 585 static final void startSystemUi(Context context) { 586 Intent intent = new Intent(); 587 intent.setComponent(new ComponentName("com.android.systemui", 588 "com.android.systemui.SystemUIService")); 589 Slog.d(TAG, "Starting service: " + intent); 590 context.startService(intent); 591 } 592} 593 594public class SystemServer { 595 private static final String TAG = "SystemServer"; 596 597 public static final int FACTORY_TEST_OFF = 0; 598 public static final int FACTORY_TEST_LOW_LEVEL = 1; 599 public static final int FACTORY_TEST_HIGH_LEVEL = 2; 600 601 static Timer timer; 602 static final long SNAPSHOT_INTERVAL = 60 * 60 * 1000; // 1hr 603 604 // The earliest supported time. We pick one day into 1970, to 605 // give any timezone code room without going into negative time. 606 private static final long EARLIEST_SUPPORTED_TIME = 86400 * 1000; 607 608 /** 609 * This method is called from Zygote to initialize the system. This will cause the native 610 * services (SurfaceFlinger, AudioFlinger, etc..) to be started. After that it will call back 611 * up into init2() to start the Android services. 612 */ 613 native public static void init1(String[] args); 614 615 public static void main(String[] args) { 616 if (System.currentTimeMillis() < EARLIEST_SUPPORTED_TIME) { 617 // If a device's clock is before 1970 (before 0), a lot of 618 // APIs crash dealing with negative numbers, notably 619 // java.io.File#setLastModified, so instead we fake it and 620 // hope that time from cell towers or NTP fixes it 621 // shortly. 622 Slog.w(TAG, "System clock is before 1970; setting to 1970."); 623 SystemClock.setCurrentTimeMillis(EARLIEST_SUPPORTED_TIME); 624 } 625 626 if (SamplingProfilerIntegration.isEnabled()) { 627 SamplingProfilerIntegration.start(); 628 timer = new Timer(); 629 timer.schedule(new TimerTask() { 630 @Override 631 public void run() { 632 SamplingProfilerIntegration.writeSnapshot("system_server", null); 633 } 634 }, SNAPSHOT_INTERVAL, SNAPSHOT_INTERVAL); 635 } 636 637 // Mmmmmm... more memory! 638 dalvik.system.VMRuntime.getRuntime().clearGrowthLimit(); 639 640 // The system server has to run all of the time, so it needs to be 641 // as efficient as possible with its memory usage. 642 VMRuntime.getRuntime().setTargetHeapUtilization(0.8f); 643 644 System.loadLibrary("android_servers"); 645 init1(args); 646 } 647 648 public static final void init2() { 649 Slog.i(TAG, "Entered the Android system server!"); 650 Thread thr = new ServerThread(); 651 thr.setName("android.server.ServerThread"); 652 thr.start(); 653 } 654} 655