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