2009-03-03 19:31:44 -08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2006 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package com.android.server;
|
|
|
|
|
|
|
|
import android.app.ActivityManagerNative;
|
2014-01-15 20:40:55 -08:00
|
|
|
import android.app.ActivityThread;
|
2013-12-05 16:48:06 -08:00
|
|
|
import android.app.IAlarmManager;
|
|
|
|
import android.app.INotificationManager;
|
2014-07-16 19:09:13 -07:00
|
|
|
import android.app.usage.UsageStatsManagerInternal;
|
2010-10-21 11:09:02 -04:00
|
|
|
import android.content.ComponentName;
|
2009-03-03 19:31:44 -08:00
|
|
|
import android.content.ContentResolver;
|
|
|
|
import android.content.Context;
|
2010-10-21 11:09:02 -04:00
|
|
|
import android.content.Intent;
|
2013-04-26 12:37:54 -07:00
|
|
|
import android.content.pm.PackageManager;
|
2010-10-04 15:27:22 -04:00
|
|
|
import android.content.res.Configuration;
|
2015-05-06 10:41:43 -07:00
|
|
|
import android.content.res.Resources.Theme;
|
2014-04-09 18:07:19 -07:00
|
|
|
import android.os.Build;
|
2013-04-19 13:25:04 -07:00
|
|
|
import android.os.Environment;
|
2014-01-15 20:40:55 -08:00
|
|
|
import android.os.FactoryTest;
|
2016-01-19 14:22:24 -08:00
|
|
|
import android.os.FileUtils;
|
2014-01-15 20:40:55 -08:00
|
|
|
import android.os.IPowerManager;
|
2010-06-09 15:45:18 -05:00
|
|
|
import android.os.Looper;
|
2016-01-19 14:22:24 -08:00
|
|
|
import android.os.PowerManager;
|
|
|
|
import android.os.RecoverySystem;
|
2010-06-09 15:45:18 -05:00
|
|
|
import android.os.RemoteException;
|
|
|
|
import android.os.ServiceManager;
|
2010-09-10 16:03:29 -07:00
|
|
|
import android.os.StrictMode;
|
2010-06-09 15:45:18 -05:00
|
|
|
import android.os.SystemClock;
|
|
|
|
import android.os.SystemProperties;
|
2015-06-30 17:07:32 +09:00
|
|
|
import android.os.Trace;
|
2012-10-19 18:23:52 -07:00
|
|
|
import android.os.UserHandle;
|
2015-03-21 20:41:00 -07:00
|
|
|
import android.os.storage.IMountService;
|
2010-10-04 15:27:22 -04:00
|
|
|
import android.util.DisplayMetrics;
|
2009-03-03 19:31:44 -08:00
|
|
|
import android.util.EventLog;
|
2010-02-26 18:56:32 -08:00
|
|
|
import android.util.Slog;
|
2010-10-12 13:12:18 -07:00
|
|
|
import android.view.WindowManager;
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2013-03-28 18:10:43 -07:00
|
|
|
import com.android.internal.R;
|
2011-05-19 17:12:49 -07:00
|
|
|
import com.android.internal.os.BinderInternal;
|
|
|
|
import com.android.internal.os.SamplingProfilerIntegration;
|
2015-06-10 18:25:44 -07:00
|
|
|
import com.android.internal.os.ZygoteInit;
|
2014-03-17 12:54:03 -07:00
|
|
|
import com.android.server.accessibility.AccessibilityManagerService;
|
2012-11-15 14:01:46 -08:00
|
|
|
import com.android.server.accounts.AccountManagerService;
|
2011-05-19 17:12:49 -07:00
|
|
|
import com.android.server.am.ActivityManagerService;
|
2015-02-06 19:46:04 -05:00
|
|
|
import com.android.server.audio.AudioService;
|
2015-03-20 22:18:55 -07:00
|
|
|
import com.android.server.camera.CameraService;
|
2013-11-06 14:54:50 -08:00
|
|
|
import com.android.server.clipboard.ClipboardService;
|
2012-11-15 14:01:46 -08:00
|
|
|
import com.android.server.content.ContentService;
|
2014-04-23 13:46:21 -07:00
|
|
|
import com.android.server.devicepolicy.DevicePolicyManagerService;
|
2012-07-23 19:26:30 -07:00
|
|
|
import com.android.server.display.DisplayManagerService;
|
2012-09-25 18:58:48 -07:00
|
|
|
import com.android.server.dreams.DreamManagerService;
|
2014-06-06 15:00:49 -07:00
|
|
|
import com.android.server.fingerprint.FingerprintService;
|
2014-04-23 17:57:26 +09:00
|
|
|
import com.android.server.hdmi.HdmiControlService;
|
2012-04-17 16:52:41 -07:00
|
|
|
import com.android.server.input.InputManagerService;
|
2014-06-09 19:50:00 -07:00
|
|
|
import com.android.server.job.JobSchedulerService;
|
2013-12-05 16:48:06 -08:00
|
|
|
import com.android.server.lights.LightsService;
|
2016-01-27 19:05:43 -08:00
|
|
|
import com.android.internal.widget.ILockSettings;
|
2013-11-07 00:30:16 -08:00
|
|
|
import com.android.server.media.MediaRouterService;
|
2014-02-13 14:19:04 -08:00
|
|
|
import com.android.server.media.MediaSessionService;
|
2015-12-14 21:57:34 +09:00
|
|
|
import com.android.server.media.MediaResourceMonitorService;
|
2014-07-08 18:07:36 -07:00
|
|
|
import com.android.server.media.projection.MediaProjectionManagerService;
|
2011-05-19 17:12:49 -07:00
|
|
|
import com.android.server.net.NetworkPolicyManagerService;
|
2011-05-24 18:39:45 -07:00
|
|
|
import com.android.server.net.NetworkStatsService;
|
2013-12-05 16:48:06 -08:00
|
|
|
import com.android.server.notification.NotificationManagerService;
|
2012-11-15 14:01:46 -08:00
|
|
|
import com.android.server.os.SchedulingPolicyService;
|
2014-04-28 22:11:01 -07:00
|
|
|
import com.android.server.pm.BackgroundDexOptService;
|
2012-09-12 17:00:34 -07:00
|
|
|
import com.android.server.pm.Installer;
|
2014-02-19 14:31:52 -08:00
|
|
|
import com.android.server.pm.LauncherAppsService;
|
2015-11-10 08:58:14 -08:00
|
|
|
import com.android.server.pm.OtaDexoptService;
|
2011-05-19 17:12:49 -07:00
|
|
|
import com.android.server.pm.PackageManagerService;
|
2012-08-10 17:06:33 -07:00
|
|
|
import com.android.server.pm.UserManagerService;
|
2012-06-18 18:29:13 -07:00
|
|
|
import com.android.server.power.PowerManagerService;
|
|
|
|
import com.android.server.power.ShutdownThread;
|
2014-05-24 15:34:37 -07:00
|
|
|
import com.android.server.restrictions.RestrictionsManagerService;
|
2016-01-25 10:33:11 -08:00
|
|
|
import com.android.server.soundtrigger.SoundTriggerService;
|
2013-12-05 16:48:06 -08:00
|
|
|
import com.android.server.statusbar.StatusBarManagerService;
|
|
|
|
import com.android.server.storage.DeviceStorageMonitorService;
|
2014-11-21 15:20:15 -08:00
|
|
|
import com.android.server.telecom.TelecomLoaderService;
|
2014-03-27 14:56:59 +01:00
|
|
|
import com.android.server.trust.TrustManagerService;
|
2014-02-20 18:23:25 -08:00
|
|
|
import com.android.server.tv.TvInputManagerService;
|
2013-12-05 16:48:06 -08:00
|
|
|
import com.android.server.twilight.TwilightService;
|
2014-07-16 19:09:13 -07:00
|
|
|
import com.android.server.usage.UsageStatsService;
|
2015-12-04 16:16:31 -08:00
|
|
|
import com.android.server.vr.VrManagerService;
|
2013-11-06 14:54:50 -08:00
|
|
|
import com.android.server.wallpaper.WallpaperManagerService;
|
2014-05-08 16:07:05 +01:00
|
|
|
import com.android.server.webkit.WebViewUpdateService;
|
2011-05-19 17:12:49 -07:00
|
|
|
import com.android.server.wm.WindowManagerService;
|
|
|
|
|
|
|
|
import dalvik.system.VMRuntime;
|
|
|
|
|
2016-01-19 14:22:24 -08:00
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
2015-08-11 15:40:34 +01:00
|
|
|
import java.util.Locale;
|
2009-09-04 18:31:17 -07:00
|
|
|
import java.util.Timer;
|
|
|
|
import java.util.TimerTask;
|
|
|
|
|
2014-01-15 20:40:55 -08:00
|
|
|
public final class SystemServer {
|
2009-03-03 19:31:44 -08:00
|
|
|
private static final String TAG = "SystemServer";
|
2014-01-15 20:40:55 -08:00
|
|
|
|
2011-09-19 14:25:28 -07:00
|
|
|
private static final String ENCRYPTING_STATE = "trigger_restart_min_framework";
|
2011-09-23 15:08:24 -07:00
|
|
|
private static final String ENCRYPTED_STATE = "1";
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2014-01-15 20:40:55 -08:00
|
|
|
private static final long SNAPSHOT_INTERVAL = 60 * 60 * 1000; // 1hr
|
|
|
|
|
|
|
|
// The earliest supported time. We pick one day into 1970, to
|
|
|
|
// give any timezone code room without going into negative time.
|
|
|
|
private static final long EARLIEST_SUPPORTED_TIME = 86400 * 1000;
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2013-12-20 13:27:30 -08:00
|
|
|
/*
|
|
|
|
* Implementation class names. TODO: Move them to a codegen class or load
|
|
|
|
* them from the build system somehow.
|
|
|
|
*/
|
|
|
|
private static final String BACKUP_MANAGER_SERVICE_CLASS =
|
2014-02-10 19:47:07 -08:00
|
|
|
"com.android.server.backup.BackupManagerService$Lifecycle";
|
2013-12-20 13:27:30 -08:00
|
|
|
private static final String APPWIDGET_SERVICE_CLASS =
|
|
|
|
"com.android.server.appwidget.AppWidgetService";
|
2014-04-04 18:02:06 -07:00
|
|
|
private static final String VOICE_RECOGNITION_MANAGER_SERVICE_CLASS =
|
|
|
|
"com.android.server.voiceinteraction.VoiceInteractionManagerService";
|
2013-12-20 13:27:30 -08:00
|
|
|
private static final String PRINT_MANAGER_SERVICE_CLASS =
|
|
|
|
"com.android.server.print.PrintManagerService";
|
2014-02-14 17:19:56 -08:00
|
|
|
private static final String USB_SERVICE_CLASS =
|
|
|
|
"com.android.server.usb.UsbService$Lifecycle";
|
2015-03-27 13:23:41 -07:00
|
|
|
private static final String MIDI_SERVICE_CLASS =
|
|
|
|
"com.android.server.midi.MidiService$Lifecycle";
|
2014-02-19 12:29:58 -08:00
|
|
|
private static final String WIFI_SERVICE_CLASS =
|
|
|
|
"com.android.server.wifi.WifiService";
|
2015-09-29 13:49:02 -07:00
|
|
|
private static final String WIFI_NAN_SERVICE_CLASS =
|
|
|
|
"com.android.server.wifi.nan.WifiNanService";
|
2014-02-19 12:29:58 -08:00
|
|
|
private static final String WIFI_P2P_SERVICE_CLASS =
|
|
|
|
"com.android.server.wifi.p2p.WifiP2pService";
|
2014-05-21 16:32:11 -07:00
|
|
|
private static final String ETHERNET_SERVICE_CLASS =
|
|
|
|
"com.android.server.ethernet.EthernetService";
|
2014-06-09 19:50:00 -07:00
|
|
|
private static final String JOB_SCHEDULER_SERVICE_CLASS =
|
|
|
|
"com.android.server.job.JobSchedulerService";
|
2016-01-27 19:05:43 -08:00
|
|
|
private static final String LOCK_SETTINGS_SERVICE_CLASS =
|
|
|
|
"com.android.server.LockSettingsService$Lifecycle";
|
2015-03-21 20:41:00 -07:00
|
|
|
private static final String MOUNT_SERVICE_CLASS =
|
|
|
|
"com.android.server.MountService$Lifecycle";
|
2016-01-09 14:57:45 -07:00
|
|
|
private static final String SEARCH_MANAGER_SERVICE_CLASS =
|
|
|
|
"com.android.server.search.SearchManagerService$Lifecycle";
|
|
|
|
|
2014-07-01 19:40:41 -07:00
|
|
|
private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst";
|
2013-12-20 13:27:30 -08:00
|
|
|
|
2016-01-19 14:22:24 -08:00
|
|
|
private static final String UNCRYPT_PACKAGE_FILE = "/cache/recovery/uncrypt_file";
|
|
|
|
private static final String BLOCK_MAP_FILE = "/cache/recovery/block.map";
|
|
|
|
|
2015-12-16 15:28:23 -05:00
|
|
|
/**
|
|
|
|
* Default theme used by the system context. This is used to style
|
|
|
|
* system-provided dialogs, such as the Power Off dialog, and other
|
|
|
|
* visual content.
|
|
|
|
*/
|
|
|
|
private static final int DEFAULT_SYSTEM_THEME =
|
|
|
|
com.android.internal.R.style.Theme_Material_DayNight_DarkActionBar;
|
|
|
|
|
2014-01-15 20:40:55 -08:00
|
|
|
private final int mFactoryTestMode;
|
|
|
|
private Timer mProfilerSnapshotTimer;
|
|
|
|
|
|
|
|
private Context mSystemContext;
|
|
|
|
private SystemServiceManager mSystemServiceManager;
|
|
|
|
|
2014-01-16 22:16:42 -08:00
|
|
|
// TODO: remove all of these references by improving dependency resolution and boot phases
|
|
|
|
private PowerManagerService mPowerManagerService;
|
|
|
|
private ActivityManagerService mActivityManagerService;
|
2015-10-30 19:25:37 +00:00
|
|
|
private WebViewUpdateService mWebViewUpdateService;
|
2014-01-16 22:16:42 -08:00
|
|
|
private DisplayManagerService mDisplayManagerService;
|
2014-06-12 22:38:59 -07:00
|
|
|
private PackageManagerService mPackageManagerService;
|
|
|
|
private PackageManager mPackageManager;
|
2014-01-15 20:40:55 -08:00
|
|
|
private ContentResolver mContentResolver;
|
|
|
|
|
2014-06-12 22:38:59 -07:00
|
|
|
private boolean mOnlyCore;
|
|
|
|
private boolean mFirstBoot;
|
|
|
|
|
2014-01-15 20:40:55 -08:00
|
|
|
/**
|
2015-04-30 10:38:13 -07:00
|
|
|
* Start the sensor service.
|
2014-01-15 20:40:55 -08:00
|
|
|
*/
|
2015-04-30 10:38:13 -07:00
|
|
|
private static native void startSensorService();
|
2014-01-15 20:40:55 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The main entry point from zygote.
|
|
|
|
*/
|
|
|
|
public static void main(String[] args) {
|
|
|
|
new SystemServer().run();
|
2011-08-22 00:26:20 -07:00
|
|
|
}
|
|
|
|
|
2014-01-15 20:40:55 -08:00
|
|
|
public SystemServer() {
|
2014-06-12 22:38:59 -07:00
|
|
|
// Check for factory test mode.
|
2014-01-15 20:40:55 -08:00
|
|
|
mFactoryTestMode = FactoryTest.getMode();
|
|
|
|
}
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2014-01-15 20:40:55 -08:00
|
|
|
private void run() {
|
2015-06-30 17:07:32 +09:00
|
|
|
try {
|
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "InitBeforeStartServices");
|
|
|
|
// If a device's clock is before 1970 (before 0), a lot of
|
|
|
|
// APIs crash dealing with negative numbers, notably
|
|
|
|
// java.io.File#setLastModified, so instead we fake it and
|
|
|
|
// hope that time from cell towers or NTP fixes it shortly.
|
|
|
|
if (System.currentTimeMillis() < EARLIEST_SUPPORTED_TIME) {
|
|
|
|
Slog.w(TAG, "System clock is before 1970; setting to 1970.");
|
|
|
|
SystemClock.setCurrentTimeMillis(EARLIEST_SUPPORTED_TIME);
|
|
|
|
}
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2015-09-02 22:48:13 +09:00
|
|
|
// If the system has "persist.sys.language" and friends set, replace them with
|
|
|
|
// "persist.sys.locale". Note that the default locale at this point is calculated
|
|
|
|
// using the "-Duser.locale" command line flag. That flag is usually populated by
|
|
|
|
// AndroidRuntime using the same set of system properties, but only the system_server
|
|
|
|
// and system apps are allowed to set them.
|
|
|
|
//
|
|
|
|
// NOTE: Most changes made here will need an equivalent change to
|
|
|
|
// core/jni/AndroidRuntime.cpp
|
|
|
|
if (!SystemProperties.get("persist.sys.language").isEmpty()) {
|
|
|
|
final String languageTag = Locale.getDefault().toLanguageTag();
|
|
|
|
|
|
|
|
SystemProperties.set("persist.sys.locale", languageTag);
|
|
|
|
SystemProperties.set("persist.sys.language", "");
|
|
|
|
SystemProperties.set("persist.sys.country", "");
|
|
|
|
SystemProperties.set("persist.sys.localevar", "");
|
|
|
|
}
|
2015-08-11 15:40:34 +01:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
// Here we go!
|
|
|
|
Slog.i(TAG, "Entered the Android system server!");
|
|
|
|
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_SYSTEM_RUN, SystemClock.uptimeMillis());
|
|
|
|
|
|
|
|
// In case the runtime switched since last boot (such as when
|
|
|
|
// the old runtime was removed in an OTA), set the system
|
|
|
|
// property so that it is in sync. We can't do this in
|
|
|
|
// libnativehelper's JniInvocation::Init code where we already
|
|
|
|
// had to fallback to a different runtime because it is
|
|
|
|
// running as root and we need to be the system user to set
|
|
|
|
// the property. http://b/11463182
|
|
|
|
SystemProperties.set("persist.sys.dalvik.vm.lib.2", VMRuntime.getRuntime().vmLibrary());
|
|
|
|
|
|
|
|
// Enable the sampling profiler.
|
|
|
|
if (SamplingProfilerIntegration.isEnabled()) {
|
|
|
|
SamplingProfilerIntegration.start();
|
|
|
|
mProfilerSnapshotTimer = new Timer();
|
|
|
|
mProfilerSnapshotTimer.schedule(new TimerTask() {
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
SamplingProfilerIntegration.writeSnapshot("system_server", null);
|
|
|
|
}
|
|
|
|
}, SNAPSHOT_INTERVAL, SNAPSHOT_INTERVAL);
|
|
|
|
}
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
// Mmmmmm... more memory!
|
|
|
|
VMRuntime.getRuntime().clearGrowthLimit();
|
2014-01-15 20:40:55 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
// The system server has to run all of the time, so it needs to be
|
|
|
|
// as efficient as possible with its memory usage.
|
|
|
|
VMRuntime.getRuntime().setTargetHeapUtilization(0.8f);
|
2014-01-15 20:40:55 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
// Some devices rely on runtime fingerprint generation, so make sure
|
|
|
|
// we've defined it before booting further.
|
|
|
|
Build.ensureFingerprintProperty();
|
2014-04-09 18:07:19 -07:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
// Within the system server, it is an error to access Environment paths without
|
|
|
|
// explicitly specifying a user.
|
|
|
|
Environment.setUserRequired(true);
|
2014-01-15 20:40:55 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
// Ensure binder calls into the system always run at foreground priority.
|
|
|
|
BinderInternal.disableBackgroundScheduling(true);
|
2014-01-15 20:40:55 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
// Prepare the main looper thread (this thread).
|
|
|
|
android.os.Process.setThreadPriority(
|
2014-01-15 20:40:55 -08:00
|
|
|
android.os.Process.THREAD_PRIORITY_FOREGROUND);
|
2015-06-30 17:07:32 +09:00
|
|
|
android.os.Process.setCanSelfBackground(false);
|
|
|
|
Looper.prepareMainLooper();
|
2014-01-15 20:40:55 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
// Initialize native services.
|
|
|
|
System.loadLibrary("android_servers");
|
2010-05-28 01:54:03 -07:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
// Check whether we failed to shut down last time we tried.
|
|
|
|
// This call may not return.
|
|
|
|
performPendingShutdown();
|
2014-01-15 20:40:55 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
// Initialize the system context.
|
|
|
|
createSystemContext();
|
2014-01-15 20:40:55 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
// Create the system service manager.
|
|
|
|
mSystemServiceManager = new SystemServiceManager(mSystemContext);
|
|
|
|
LocalServices.addService(SystemServiceManager.class, mSystemServiceManager);
|
|
|
|
} finally {
|
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
|
|
|
}
|
2014-01-15 20:40:55 -08:00
|
|
|
|
|
|
|
// Start services.
|
|
|
|
try {
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "StartServices");
|
2014-01-15 20:40:55 -08:00
|
|
|
startBootstrapServices();
|
2014-01-16 22:16:42 -08:00
|
|
|
startCoreServices();
|
2014-01-15 20:40:55 -08:00
|
|
|
startOtherServices();
|
2014-06-12 22:38:59 -07:00
|
|
|
} catch (Throwable ex) {
|
2014-01-15 20:40:55 -08:00
|
|
|
Slog.e("System", "******************************************");
|
|
|
|
Slog.e("System", "************ Failure starting system services", ex);
|
|
|
|
throw ex;
|
2015-06-30 17:07:32 +09:00
|
|
|
} finally {
|
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2014-01-15 20:40:55 -08:00
|
|
|
}
|
2010-09-22 10:36:48 -07:00
|
|
|
|
2014-01-15 20:40:55 -08:00
|
|
|
// For debug builds, log event loop stalls to dropbox for analysis.
|
|
|
|
if (StrictMode.conditionallyEnableDebugLogging()) {
|
|
|
|
Slog.i(TAG, "Enabled StrictMode for system server main thread.");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Loop forever.
|
|
|
|
Looper.loop();
|
|
|
|
throw new RuntimeException("Main thread loop unexpectedly exited");
|
|
|
|
}
|
|
|
|
|
|
|
|
private void reportWtf(String msg, Throwable e) {
|
|
|
|
Slog.w(TAG, "***********************************************");
|
2014-10-01 14:59:58 -07:00
|
|
|
Slog.wtf(TAG, "BOOT FAILURE " + msg, e);
|
2014-01-15 20:40:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
private void performPendingShutdown() {
|
|
|
|
final String shutdownAction = SystemProperties.get(
|
|
|
|
ShutdownThread.SHUTDOWN_ACTION_PROPERTY, "");
|
|
|
|
if (shutdownAction != null && shutdownAction.length() > 0) {
|
|
|
|
boolean reboot = (shutdownAction.charAt(0) == '1');
|
|
|
|
|
|
|
|
final String reason;
|
|
|
|
if (shutdownAction.length() > 1) {
|
|
|
|
reason = shutdownAction.substring(1, shutdownAction.length());
|
|
|
|
} else {
|
|
|
|
reason = null;
|
2010-09-22 10:36:48 -07:00
|
|
|
}
|
2014-01-15 20:40:55 -08:00
|
|
|
|
2016-01-19 14:22:24 -08:00
|
|
|
// If it's a pending reboot into recovery to apply an update,
|
|
|
|
// always make sure uncrypt gets executed properly when needed.
|
|
|
|
// If '/cache/recovery/block.map' hasn't been created, stop the
|
|
|
|
// reboot which will fail for sure, and get a chance to capture a
|
2015-12-31 07:44:55 -08:00
|
|
|
// bugreport when that's still feasible. (Bug: 26444951)
|
|
|
|
if (PowerManager.REBOOT_RECOVERY_UPDATE.equals(reason)) {
|
2016-01-19 14:22:24 -08:00
|
|
|
File packageFile = new File(UNCRYPT_PACKAGE_FILE);
|
|
|
|
if (packageFile.exists()) {
|
|
|
|
String filename = null;
|
|
|
|
try {
|
|
|
|
filename = FileUtils.readTextFile(packageFile, 0, null);
|
|
|
|
} catch (IOException e) {
|
|
|
|
Slog.e(TAG, "Error reading uncrypt package file", e);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (filename != null && filename.startsWith("/data")) {
|
|
|
|
if (!new File(BLOCK_MAP_FILE).exists()) {
|
|
|
|
Slog.e(TAG, "Can't find block map file, uncrypt failed or " +
|
|
|
|
"unexpected runtime restart?");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-03-19 01:11:55 +08:00
|
|
|
ShutdownThread.rebootOrShutdown(null, reboot, reason);
|
2010-09-22 10:36:48 -07:00
|
|
|
}
|
2014-01-15 20:40:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
private void createSystemContext() {
|
|
|
|
ActivityThread activityThread = ActivityThread.systemMain();
|
|
|
|
mSystemContext = activityThread.getSystemContext();
|
2015-12-16 15:28:23 -05:00
|
|
|
mSystemContext.setTheme(DEFAULT_SYSTEM_THEME);
|
2014-01-15 20:40:55 -08:00
|
|
|
}
|
|
|
|
|
2014-06-12 22:38:59 -07:00
|
|
|
/**
|
|
|
|
* Starts the small tangle of critical services that are needed to get
|
|
|
|
* the system off the ground. These services have complex mutual dependencies
|
|
|
|
* which is why we initialize them all in one place here. Unless your service
|
|
|
|
* is also entwined in these dependencies, it should be initialized in one of
|
|
|
|
* the other functions.
|
|
|
|
*/
|
2014-01-15 20:40:55 -08:00
|
|
|
private void startBootstrapServices() {
|
|
|
|
// Wait for installd to finish starting up so that it has a chance to
|
|
|
|
// create critical directories such as /data/user with the appropriate
|
|
|
|
// permissions. We need this to complete before we initialize other services.
|
2014-11-10 14:23:41 +00:00
|
|
|
Installer installer = mSystemServiceManager.startService(Installer.class);
|
2010-09-22 10:36:48 -07:00
|
|
|
|
2014-01-15 20:40:55 -08:00
|
|
|
// Activity manager runs the show.
|
2014-01-16 22:16:42 -08:00
|
|
|
mActivityManagerService = mSystemServiceManager.startService(
|
|
|
|
ActivityManagerService.Lifecycle.class).getService();
|
2014-04-04 18:02:06 -07:00
|
|
|
mActivityManagerService.setSystemServiceManager(mSystemServiceManager);
|
2014-11-10 14:23:41 +00:00
|
|
|
mActivityManagerService.setInstaller(installer);
|
2014-01-15 20:40:55 -08:00
|
|
|
|
2014-06-12 22:38:59 -07:00
|
|
|
// Power manager needs to be started early because other services need it.
|
|
|
|
// Native daemons may be watching for it to be registered so it must be ready
|
|
|
|
// to handle incoming binder calls immediately (including being able to verify
|
|
|
|
// the permissions for those calls).
|
|
|
|
mPowerManagerService = mSystemServiceManager.startService(PowerManagerService.class);
|
|
|
|
|
|
|
|
// Now that the power manager has been started, let the activity manager
|
|
|
|
// initialize power management features.
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "InitPowerManagement");
|
2014-06-12 22:38:59 -07:00
|
|
|
mActivityManagerService.initPowerManagement();
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2014-06-12 22:38:59 -07:00
|
|
|
|
2015-04-10 20:15:01 -07:00
|
|
|
// Manages LEDs and display backlight so we need it to bring up the display.
|
|
|
|
mSystemServiceManager.startService(LightsService.class);
|
|
|
|
|
2014-01-16 22:16:42 -08:00
|
|
|
// Display manager is needed to provide display metrics before package manager
|
|
|
|
// starts up.
|
|
|
|
mDisplayManagerService = mSystemServiceManager.startService(DisplayManagerService.class);
|
2014-06-12 22:38:59 -07:00
|
|
|
|
|
|
|
// We need the default display before we can initialize the package manager.
|
|
|
|
mSystemServiceManager.startBootPhase(SystemService.PHASE_WAIT_FOR_DEFAULT_DISPLAY);
|
|
|
|
|
|
|
|
// Only run "core" apps if we're encrypting the device.
|
|
|
|
String cryptState = SystemProperties.get("vold.decrypt");
|
|
|
|
if (ENCRYPTING_STATE.equals(cryptState)) {
|
|
|
|
Slog.w(TAG, "Detected encryption in progress - only parsing core apps");
|
|
|
|
mOnlyCore = true;
|
|
|
|
} else if (ENCRYPTED_STATE.equals(cryptState)) {
|
|
|
|
Slog.w(TAG, "Device encrypted - only parsing core apps");
|
|
|
|
mOnlyCore = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Start the package manager.
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartPackageManagerService");
|
2014-11-10 14:23:41 +00:00
|
|
|
mPackageManagerService = PackageManagerService.main(mSystemContext, installer,
|
2014-06-12 22:38:59 -07:00
|
|
|
mFactoryTestMode != FactoryTest.FACTORY_TEST_OFF, mOnlyCore);
|
|
|
|
mFirstBoot = mPackageManagerService.isFirstBoot();
|
|
|
|
mPackageManager = mSystemContext.getPackageManager();
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2014-06-12 22:38:59 -07:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartUserManagerService");
|
2014-07-23 17:34:34 -07:00
|
|
|
ServiceManager.addService(Context.USER_SERVICE, UserManagerService.getInstance());
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2014-07-23 17:34:34 -07:00
|
|
|
|
2014-06-12 22:38:59 -07:00
|
|
|
// Initialize attribute cache used to cache resources from packages.
|
|
|
|
AttributeCache.init(mSystemContext);
|
|
|
|
|
|
|
|
// Set up the Application instance for the system process and get started.
|
|
|
|
mActivityManagerService.setSystemProcess();
|
2015-04-30 10:38:13 -07:00
|
|
|
|
|
|
|
// The sensor service needs access to package manager service, app ops
|
|
|
|
// service, and permissions service, therefore we start it after them.
|
|
|
|
startSensorService();
|
2014-01-16 22:16:42 -08:00
|
|
|
}
|
2014-01-15 20:40:55 -08:00
|
|
|
|
2014-06-12 22:38:59 -07:00
|
|
|
/**
|
|
|
|
* Starts some essential services that are not tangled up in the bootstrap process.
|
|
|
|
*/
|
|
|
|
private void startCoreServices() {
|
2014-06-13 19:00:36 -07:00
|
|
|
// Tracks the battery level. Requires LightService.
|
|
|
|
mSystemServiceManager.startService(BatteryService.class);
|
2014-07-16 19:09:13 -07:00
|
|
|
|
|
|
|
// Tracks application usage stats.
|
|
|
|
mSystemServiceManager.startService(UsageStatsService.class);
|
|
|
|
mActivityManagerService.setUsageStatsManager(
|
|
|
|
LocalServices.getService(UsageStatsManagerInternal.class));
|
2014-07-29 19:14:24 +01:00
|
|
|
|
|
|
|
// Tracks whether the updatable WebView is in a ready state and watches for update installs.
|
2015-10-30 19:25:37 +00:00
|
|
|
mWebViewUpdateService = mSystemServiceManager.startService(WebViewUpdateService.class);
|
2014-06-12 22:38:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Starts a miscellaneous grab bag of stuff that has yet to be refactored
|
|
|
|
* and organized.
|
|
|
|
*/
|
2014-01-16 22:16:42 -08:00
|
|
|
private void startOtherServices() {
|
2014-01-15 20:40:55 -08:00
|
|
|
final Context context = mSystemContext;
|
2012-07-30 12:58:03 -07:00
|
|
|
AccountManagerService accountManager = null;
|
|
|
|
ContentService contentService = null;
|
2012-04-13 20:38:38 -07:00
|
|
|
VibratorService vibrator = null;
|
2013-12-05 16:48:06 -08:00
|
|
|
IAlarmManager alarm = null;
|
2015-03-21 20:41:00 -07:00
|
|
|
IMountService mountService = null;
|
2011-05-19 17:12:49 -07:00
|
|
|
NetworkManagementService networkManagement = null;
|
2011-05-24 18:39:45 -07:00
|
|
|
NetworkStatsService networkStats = null;
|
2011-05-20 15:29:23 -07:00
|
|
|
NetworkPolicyManagerService networkPolicy = null;
|
2009-08-14 14:18:49 -04:00
|
|
|
ConnectivityService connectivity = null;
|
2014-04-16 17:29:40 -07:00
|
|
|
NetworkScoreService networkScore = null;
|
2012-03-22 17:01:39 -07:00
|
|
|
NsdService serviceDiscovery= null;
|
2009-03-03 19:31:44 -08:00
|
|
|
WindowManagerService wm = null;
|
2011-08-29 20:11:07 -04:00
|
|
|
SerialService serial = null;
|
2010-09-13 16:24:08 -07:00
|
|
|
NetworkTimeUpdateService networkTimeUpdater = null;
|
2012-02-01 15:23:33 -08:00
|
|
|
CommonTimeManagementService commonTimeMgmtService = null;
|
2012-04-17 16:52:41 -07:00
|
|
|
InputManagerService inputManager = null;
|
2012-09-20 10:09:45 -07:00
|
|
|
TelephonyRegistry telephonyRegistry = null;
|
2013-06-26 11:06:51 -07:00
|
|
|
ConsumerIrService consumerIr = null;
|
2014-07-24 12:56:45 -07:00
|
|
|
MmsServiceBroker mmsService = null;
|
2014-11-25 12:59:12 -08:00
|
|
|
EntropyMixer entropyMixer = null;
|
2015-12-04 16:16:31 -08:00
|
|
|
VrManagerService vrManagerService = null;
|
2016-02-12 20:38:23 +01:00
|
|
|
HardwarePropertiesManagerService hardwarePropertiesService = null;
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2013-03-28 18:10:43 -07:00
|
|
|
boolean disableStorage = SystemProperties.getBoolean("config.disable_storage", false);
|
|
|
|
boolean disableBluetooth = SystemProperties.getBoolean("config.disable_bluetooth", false);
|
|
|
|
boolean disableLocation = SystemProperties.getBoolean("config.disable_location", false);
|
|
|
|
boolean disableSystemUI = SystemProperties.getBoolean("config.disable_systemui", false);
|
|
|
|
boolean disableNonCoreServices = SystemProperties.getBoolean("config.disable_noncore", false);
|
|
|
|
boolean disableNetwork = SystemProperties.getBoolean("config.disable_network", false);
|
2014-10-16 13:31:39 -07:00
|
|
|
boolean disableNetworkTime = SystemProperties.getBoolean("config.disable_networktime", false);
|
2016-02-03 16:57:31 -08:00
|
|
|
boolean disableRtt = SystemProperties.getBoolean("config.disable_rtt", false);
|
2014-06-10 14:51:30 +09:00
|
|
|
boolean isEmulator = SystemProperties.get("ro.kernel.qemu").equals("1");
|
2013-03-28 18:10:43 -07:00
|
|
|
|
|
|
|
try {
|
2014-06-30 14:43:28 -07:00
|
|
|
Slog.i(TAG, "Reading configuration...");
|
|
|
|
SystemConfig.getInstance();
|
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartSchedulingPolicyService");
|
2013-09-16 10:57:39 -07:00
|
|
|
ServiceManager.addService("scheduling_policy", new SchedulingPolicyService());
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2012-04-23 15:00:43 -07:00
|
|
|
|
2014-11-21 15:20:15 -08:00
|
|
|
mSystemServiceManager.startService(TelecomLoaderService.class);
|
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartTelephonyRegistry");
|
2014-06-12 22:38:59 -07:00
|
|
|
telephonyRegistry = new TelephonyRegistry(context);
|
|
|
|
ServiceManager.addService("telephony.registry", telephonyRegistry);
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2013-02-13 14:39:30 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartEntropyMixer");
|
2014-11-25 12:59:12 -08:00
|
|
|
entropyMixer = new EntropyMixer(context);
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2013-03-04 13:05:32 -08:00
|
|
|
|
2009-03-03 19:31:44 -08:00
|
|
|
mContentResolver = context.getContentResolver();
|
|
|
|
|
2015-03-20 22:18:55 -07:00
|
|
|
Slog.i(TAG, "Camera Service");
|
|
|
|
mSystemServiceManager.startService(CameraService.class);
|
|
|
|
|
2009-09-29 20:44:30 -07:00
|
|
|
// The AccountManager must come before the ContentService
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartAccountManagerService");
|
2009-03-24 22:48:12 -07:00
|
|
|
try {
|
2013-03-28 18:10:43 -07:00
|
|
|
// TODO: seems like this should be disable-able, but req'd by ContentService
|
2012-07-30 12:58:03 -07:00
|
|
|
accountManager = new AccountManagerService(context);
|
|
|
|
ServiceManager.addService(Context.ACCOUNT_SERVICE, accountManager);
|
2009-03-24 22:48:12 -07:00
|
|
|
} catch (Throwable e) {
|
2010-02-26 18:56:32 -08:00
|
|
|
Slog.e(TAG, "Failure starting Account Manager", e);
|
2009-03-24 22:48:12 -07:00
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-03-24 22:48:12 -07:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartContentService");
|
2012-07-30 12:58:03 -07:00
|
|
|
contentService = ContentService.main(context,
|
2014-01-15 20:40:55 -08:00
|
|
|
mFactoryTestMode == FactoryTest.FACTORY_TEST_LOW_LEVEL);
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("InstallSystemProviders");
|
2014-01-16 22:16:42 -08:00
|
|
|
mActivityManagerService.installSystemProviders();
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartVibratorService");
|
2012-04-13 20:38:38 -07:00
|
|
|
vibrator = new VibratorService(context);
|
|
|
|
ServiceManager.addService("vibrator", vibrator);
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-03-18 17:39:46 -07:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartConsumerIrService");
|
2014-01-15 20:40:55 -08:00
|
|
|
consumerIr = new ConsumerIrService(context);
|
|
|
|
ServiceManager.addService(Context.CONSUMER_IR_SERVICE, consumerIr);
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2014-01-15 20:40:55 -08:00
|
|
|
|
|
|
|
mSystemServiceManager.startService(AlarmManagerService.class);
|
2013-12-05 16:48:06 -08:00
|
|
|
alarm = IAlarmManager.Stub.asInterface(
|
|
|
|
ServiceManager.getService(Context.ALARM_SERVICE));
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("InitWatchdog");
|
2014-01-15 20:40:55 -08:00
|
|
|
final Watchdog watchdog = Watchdog.getInstance();
|
2014-01-16 22:16:42 -08:00
|
|
|
watchdog.init(context, mActivityManagerService);
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartInputManagerService");
|
2014-01-16 22:16:42 -08:00
|
|
|
inputManager = new InputManagerService(context);
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2012-09-20 16:48:17 -07:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartWindowManagerService");
|
2014-01-16 22:16:42 -08:00
|
|
|
wm = WindowManagerService.main(context, inputManager,
|
2014-01-15 20:40:55 -08:00
|
|
|
mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL,
|
2014-06-12 22:38:59 -07:00
|
|
|
!mFirstBoot, mOnlyCore);
|
2009-03-03 19:31:44 -08:00
|
|
|
ServiceManager.addService(Context.WINDOW_SERVICE, wm);
|
2012-04-17 16:52:41 -07:00
|
|
|
ServiceManager.addService(Context.INPUT_SERVICE, inputManager);
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2015-12-04 16:16:31 -08:00
|
|
|
traceBeginAndSlog("StartVrManagerService");
|
|
|
|
mSystemServiceManager.startService(VrManagerService.class);
|
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
|
|
|
|
2014-01-16 22:16:42 -08:00
|
|
|
mActivityManagerService.setWindowManager(wm);
|
2012-09-20 16:48:17 -07:00
|
|
|
|
|
|
|
inputManager.setWindowManagerCallbacks(wm.getInputMonitor());
|
|
|
|
inputManager.start();
|
|
|
|
|
2014-01-16 22:16:42 -08:00
|
|
|
// TODO: Use service dependencies instead.
|
|
|
|
mDisplayManagerService.windowManagerAndInputReady();
|
2009-03-03 19:31:44 -08:00
|
|
|
|
|
|
|
// Skip Bluetooth if we have an emulator kernel
|
|
|
|
// TODO: Use a more reliable check to see if this product should
|
|
|
|
// support Bluetooth - see bug 988521
|
2014-06-10 14:51:30 +09:00
|
|
|
if (isEmulator) {
|
2015-07-06 22:10:36 -07:00
|
|
|
Slog.i(TAG, "No Bluetooth Service (emulator)");
|
2014-01-15 20:40:55 -08:00
|
|
|
} else if (mFactoryTestMode == FactoryTest.FACTORY_TEST_LOW_LEVEL) {
|
2011-01-17 00:32:33 +01:00
|
|
|
Slog.i(TAG, "No Bluetooth Service (factory test)");
|
2013-04-26 12:37:54 -07:00
|
|
|
} else if (!context.getPackageManager().hasSystemFeature
|
|
|
|
(PackageManager.FEATURE_BLUETOOTH)) {
|
|
|
|
Slog.i(TAG, "No Bluetooth Service (Bluetooth Hardware Not Present)");
|
2013-03-28 18:10:43 -07:00
|
|
|
} else if (disableBluetooth) {
|
|
|
|
Slog.i(TAG, "Bluetooth Service disabled by config");
|
2009-03-03 19:31:44 -08:00
|
|
|
} else {
|
2015-06-26 17:14:35 -07:00
|
|
|
mSystemServiceManager.startService(BluetoothService.class);
|
2009-03-03 19:31:44 -08:00
|
|
|
}
|
|
|
|
} catch (RuntimeException e) {
|
2011-08-22 00:26:20 -07:00
|
|
|
Slog.e("System", "******************************************");
|
|
|
|
Slog.e("System", "************ Failure starting core service", e);
|
2009-03-03 19:31:44 -08:00
|
|
|
}
|
|
|
|
|
2010-04-12 08:18:45 -07:00
|
|
|
StatusBarManagerService statusBar = null;
|
2013-12-05 16:48:06 -08:00
|
|
|
INotificationManager notification = null;
|
2009-08-13 10:20:21 -07:00
|
|
|
WallpaperManagerService wallpaper = null;
|
2010-02-22 16:36:44 -05:00
|
|
|
LocationManagerService location = null;
|
2010-07-13 15:32:16 +08:00
|
|
|
CountryDetectorService countryDetector = null;
|
2011-06-22 16:38:13 +09:00
|
|
|
TextServicesManagerService tsms = null;
|
2016-01-27 19:05:43 -08:00
|
|
|
ILockSettings lockSettings = null;
|
Pack preloaded framework assets in a texture atlas
When the Android runtime starts, the system preloads a series of assets
in the Zygote process. These assets are shared across all processes.
Unfortunately, each one of these assets is later uploaded in its own
OpenGL texture, once per process. This wastes memory and generates
unnecessary OpenGL state changes.
This CL introduces an asset server that provides an atlas to all processes.
Note: bitmaps used by skia shaders are *not* sampled from the atlas.
It's an uncommon use case and would require extra texture transforms
in the GL shaders.
WHAT IS THE ASSETS ATLAS
The "assets atlas" is a single, shareable graphic buffer that contains
all the system's preloaded bitmap drawables (this includes 9-patches.)
The atlas is made of two distinct objects: the graphic buffer that
contains the actual pixels and the map which indicates where each
preloaded bitmap can be found in the atlas (essentially a pair of
x and y coordinates.)
HOW IS THE ASSETS ATLAS GENERATED
Because we need to support a wide variety of devices and because it
is easy to change the list of preloaded drawables, the atlas is
generated at runtime, during the startup phase of the system process.
There are several steps that lead to the atlas generation:
1. If the device is booting for the first time, or if the device was
updated, we need to find the best atlas configuration. To do so,
the atlas service tries a number of width, height and algorithm
variations that allows us to pack as many assets as possible while
using as little memory as possible. Once a best configuration is found,
it gets written to disk in /data/system/framework_atlas
2. Given a best configuration (algorithm variant, dimensions and
number of bitmaps that can be packed in the atlas), the atlas service
packs all the preloaded bitmaps into a single graphic buffer object.
3. The packing is done using Skia in a temporary native bitmap. The
Skia bitmap is then copied into the graphic buffer using OpenGL ES
to benefit from texture swizzling.
HOW PROCESSES USE THE ATLAS
Whenever a process' hardware renderer initializes its EGL context,
it queries the atlas service for the graphic buffer and the map.
It is important to remember that both the context and the map will
be valid for the lifetime of the hardware renderer (if the system
process goes down, all apps get killed as well.)
Every time the hardware renderer needs to render a bitmap, it first
checks whether the bitmap can be found in the assets atlas. When
the bitmap is part of the atlas, texture coordinates are remapped
appropriately before rendering.
Change-Id: I8eaecf53e7f6a33d90da3d0047c5ceec89ea3af0
2013-04-17 18:54:38 -07:00
|
|
|
AssetAtlasService atlas = null;
|
2013-11-07 00:30:16 -08:00
|
|
|
MediaRouterService mediaRouter = null;
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2011-08-22 00:26:20 -07:00
|
|
|
// Bring up services needed for UI.
|
2014-01-15 20:40:55 -08:00
|
|
|
if (mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL) {
|
2016-01-21 12:02:58 -08:00
|
|
|
mSystemServiceManager.startService(InputMethodManagerService.Lifecycle.class);
|
2011-08-22 00:26:20 -07:00
|
|
|
|
2015-09-02 22:48:13 +09:00
|
|
|
traceBeginAndSlog("StartAccessibilityManagerService");
|
2014-11-25 15:33:26 -08:00
|
|
|
try {
|
|
|
|
ServiceManager.addService(Context.ACCESSIBILITY_SERVICE,
|
|
|
|
new AccessibilityManagerService(context));
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting Accessibility Manager", e);
|
2011-08-22 00:26:20 -07:00
|
|
|
}
|
2015-09-02 22:48:13 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2011-08-22 00:26:20 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
wm.displayReady();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("making display ready", e);
|
|
|
|
}
|
2011-08-25 13:30:53 -07:00
|
|
|
|
2014-01-15 20:40:55 -08:00
|
|
|
if (mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL) {
|
2013-03-28 18:10:43 -07:00
|
|
|
if (!disableStorage &&
|
|
|
|
!"0".equals(SystemProperties.get("system_init.startmountservice"))) {
|
2012-05-17 13:30:28 -07:00
|
|
|
try {
|
|
|
|
/*
|
|
|
|
* NotificationManagerService is dependant on MountService,
|
|
|
|
* (for media / usb notifications) so we must start MountService first.
|
|
|
|
*/
|
2015-03-21 20:41:00 -07:00
|
|
|
mSystemServiceManager.startService(MOUNT_SERVICE_CLASS);
|
|
|
|
mountService = IMountService.Stub.asInterface(
|
|
|
|
ServiceManager.getService("mount"));
|
2012-05-17 13:30:28 -07:00
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting Mount Service", e);
|
|
|
|
}
|
|
|
|
}
|
2014-11-05 16:54:50 +05:30
|
|
|
}
|
2012-05-17 13:30:28 -07:00
|
|
|
|
2015-03-19 14:37:11 -07:00
|
|
|
// We start this here so that we update our configuration to set watch or television
|
|
|
|
// as appropriate.
|
|
|
|
mSystemServiceManager.startService(UiModeManagerService.class);
|
|
|
|
|
2015-11-05 16:54:09 +00:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "PerformFstrimIfNeeded");
|
2014-11-05 16:54:50 +05:30
|
|
|
try {
|
2015-11-05 16:54:09 +00:00
|
|
|
mPackageManagerService.performFstrimIfNeeded();
|
2014-11-05 16:54:50 +05:30
|
|
|
} catch (Throwable e) {
|
2015-11-05 16:54:09 +00:00
|
|
|
reportWtf("performing fstrim", e);
|
2014-11-05 16:54:50 +05:30
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2014-11-05 16:54:50 +05:30
|
|
|
|
2016-01-20 14:04:40 +00:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "ExtractPackagesIfNeeded");
|
|
|
|
try {
|
|
|
|
mPackageManagerService.extractPackagesIfNeeded();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("extract packages", e);
|
|
|
|
}
|
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
|
|
|
|
2014-11-05 16:54:50 +05:30
|
|
|
try {
|
|
|
|
ActivityManagerNative.getDefault().showBootMessage(
|
|
|
|
context.getResources().getText(
|
|
|
|
com.android.internal.R.string.android_upgrading_starting_apps),
|
|
|
|
false);
|
|
|
|
} catch (RemoteException e) {
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL) {
|
2013-03-28 18:10:43 -07:00
|
|
|
if (!disableNonCoreServices) {
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartLockSettingsService");
|
2013-03-28 18:10:43 -07:00
|
|
|
try {
|
2016-01-27 19:05:43 -08:00
|
|
|
mSystemServiceManager.startService(LOCK_SETTINGS_SERVICE_CLASS);
|
|
|
|
lockSettings = ILockSettings.Stub.asInterface(
|
|
|
|
ServiceManager.getService("lock_settings"));
|
2013-03-28 18:10:43 -07:00
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting LockSettingsService service", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2012-03-28 11:42:42 -07:00
|
|
|
|
2014-07-01 19:40:41 -07:00
|
|
|
if (!SystemProperties.get(PERSISTENT_DATA_BLOCK_PROP).equals("")) {
|
|
|
|
mSystemServiceManager.startService(PersistentDataBlockService.class);
|
|
|
|
}
|
|
|
|
|
2015-04-27 09:47:32 -07:00
|
|
|
mSystemServiceManager.startService(DeviceIdleController.class);
|
|
|
|
|
2014-06-12 22:38:59 -07:00
|
|
|
// Always start the Device Policy Manager, so that the API is compatible with
|
|
|
|
// API8.
|
|
|
|
mSystemServiceManager.startService(DevicePolicyManagerService.Lifecycle.class);
|
2010-01-12 18:14:19 -08:00
|
|
|
}
|
|
|
|
|
2013-03-28 18:10:43 -07:00
|
|
|
if (!disableSystemUI) {
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartStatusBarManagerService");
|
2013-03-28 18:10:43 -07:00
|
|
|
try {
|
|
|
|
statusBar = new StatusBarManagerService(context, wm);
|
|
|
|
ServiceManager.addService(Context.STATUS_BAR_SERVICE, statusBar);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting StatusBarManagerService", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-03-03 19:31:44 -08:00
|
|
|
}
|
|
|
|
|
2013-03-28 18:10:43 -07:00
|
|
|
if (!disableNonCoreServices) {
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartClipboardService");
|
2013-03-28 18:10:43 -07:00
|
|
|
try {
|
|
|
|
ServiceManager.addService(Context.CLIPBOARD_SERVICE,
|
|
|
|
new ClipboardService(context));
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting Clipboard Service", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-03-03 19:31:44 -08:00
|
|
|
}
|
|
|
|
|
2013-03-28 18:10:43 -07:00
|
|
|
if (!disableNetwork) {
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartNetworkManagementService");
|
2013-03-28 18:10:43 -07:00
|
|
|
try {
|
|
|
|
networkManagement = NetworkManagementService.create(context);
|
|
|
|
ServiceManager.addService(Context.NETWORKMANAGEMENT_SERVICE, networkManagement);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting NetworkManagement Service", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-03-03 19:31:44 -08:00
|
|
|
}
|
|
|
|
|
2013-03-28 18:10:43 -07:00
|
|
|
if (!disableNonCoreServices) {
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartTextServicesManagerService");
|
2013-03-28 18:10:43 -07:00
|
|
|
try {
|
|
|
|
tsms = new TextServicesManagerService(context);
|
|
|
|
ServiceManager.addService(Context.TEXT_SERVICES_MANAGER_SERVICE, tsms);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting Text Service Manager Service", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2011-06-22 16:38:13 +09:00
|
|
|
}
|
|
|
|
|
2013-03-28 18:10:43 -07:00
|
|
|
if (!disableNetwork) {
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartNetworkScoreService");
|
2014-03-31 19:12:07 -07:00
|
|
|
try {
|
|
|
|
networkScore = new NetworkScoreService(context);
|
|
|
|
ServiceManager.addService(Context.NETWORK_SCORE_SERVICE, networkScore);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting Network Score Service", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2014-03-31 19:12:07 -07:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartNetworkStatsService");
|
2013-03-28 18:10:43 -07:00
|
|
|
try {
|
2016-02-17 13:03:38 -08:00
|
|
|
networkStats = NetworkStatsService.create(context, networkManagement);
|
2013-03-28 18:10:43 -07:00
|
|
|
ServiceManager.addService(Context.NETWORK_STATS_SERVICE, networkStats);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting NetworkStats Service", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2011-05-20 15:29:23 -07:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartNetworkPolicyManagerService");
|
2013-03-28 18:10:43 -07:00
|
|
|
try {
|
|
|
|
networkPolicy = new NetworkPolicyManagerService(
|
2014-01-16 22:16:42 -08:00
|
|
|
context, mActivityManagerService,
|
2014-01-15 20:40:55 -08:00
|
|
|
(IPowerManager)ServiceManager.getService(Context.POWER_SERVICE),
|
2013-03-28 18:10:43 -07:00
|
|
|
networkStats, networkManagement);
|
|
|
|
ServiceManager.addService(Context.NETWORK_POLICY_SERVICE, networkPolicy);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting NetworkPolicy Service", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2010-01-26 06:17:26 -08:00
|
|
|
|
2015-09-29 13:49:02 -07:00
|
|
|
if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI_NAN)) {
|
|
|
|
mSystemServiceManager.startService(WIFI_NAN_SERVICE_CLASS);
|
|
|
|
} else {
|
|
|
|
Slog.i(TAG, "No Wi-Fi NAN Service (NAN support Not Present)");
|
|
|
|
}
|
2014-06-12 22:38:59 -07:00
|
|
|
mSystemServiceManager.startService(WIFI_P2P_SERVICE_CLASS);
|
|
|
|
mSystemServiceManager.startService(WIFI_SERVICE_CLASS);
|
|
|
|
mSystemServiceManager.startService(
|
2014-05-07 21:09:11 -07:00
|
|
|
"com.android.server.wifi.WifiScanningService");
|
|
|
|
|
2016-02-03 16:57:31 -08:00
|
|
|
if (!disableRtt) {
|
|
|
|
mSystemServiceManager.startService("com.android.server.wifi.RttService");
|
|
|
|
}
|
2014-07-25 17:46:14 -07:00
|
|
|
|
2014-11-25 21:52:12 +09:00
|
|
|
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_ETHERNET) ||
|
|
|
|
mPackageManager.hasSystemFeature(PackageManager.FEATURE_USB_HOST)) {
|
2014-06-12 22:38:59 -07:00
|
|
|
mSystemServiceManager.startService(ETHERNET_SERVICE_CLASS);
|
2014-05-21 16:32:11 -07:00
|
|
|
}
|
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartConnectivityService");
|
2013-03-28 18:10:43 -07:00
|
|
|
try {
|
|
|
|
connectivity = new ConnectivityService(
|
|
|
|
context, networkManagement, networkStats, networkPolicy);
|
|
|
|
ServiceManager.addService(Context.CONNECTIVITY_SERVICE, connectivity);
|
|
|
|
networkStats.bindConnectivityManager(connectivity);
|
|
|
|
networkPolicy.bindConnectivityManager(connectivity);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting Connectivity Service", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartNsdService");
|
2013-03-28 18:10:43 -07:00
|
|
|
try {
|
|
|
|
serviceDiscovery = NsdService.create(context);
|
|
|
|
ServiceManager.addService(
|
|
|
|
Context.NSD_SERVICE, serviceDiscovery);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting Service Discovery Service", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2012-03-22 17:01:39 -07:00
|
|
|
}
|
|
|
|
|
2013-03-28 18:10:43 -07:00
|
|
|
if (!disableNonCoreServices) {
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartUpdateLockService");
|
2013-03-28 18:10:43 -07:00
|
|
|
try {
|
|
|
|
ServiceManager.addService(Context.UPDATE_LOCK_SERVICE,
|
|
|
|
new UpdateLockService(context));
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting UpdateLockService", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2012-02-23 14:59:36 -08:00
|
|
|
}
|
|
|
|
|
2015-12-31 07:44:55 -08:00
|
|
|
if (!disableNonCoreServices) {
|
|
|
|
mSystemServiceManager.startService(RecoverySystemService.class);
|
|
|
|
}
|
|
|
|
|
2012-05-17 13:30:28 -07:00
|
|
|
/*
|
|
|
|
* MountService has a few dependencies: Notification Manager and
|
|
|
|
* AppWidget Provider. Make sure MountService is completely started
|
|
|
|
* first before continuing.
|
|
|
|
*/
|
2014-06-12 22:38:59 -07:00
|
|
|
if (mountService != null && !mOnlyCore) {
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "WaitForAsecScan");
|
2015-03-21 20:41:00 -07:00
|
|
|
try {
|
|
|
|
mountService.waitForAsecScan();
|
|
|
|
} catch (RemoteException ignored) {
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-03-03 19:31:44 -08:00
|
|
|
}
|
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "MakeAccountManagerServiceReady");
|
2012-07-30 12:58:03 -07:00
|
|
|
try {
|
|
|
|
if (accountManager != null)
|
|
|
|
accountManager.systemReady();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("making Account Manager Service ready", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2012-07-30 12:58:03 -07:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "MakeContentServiceReady");
|
2012-07-30 12:58:03 -07:00
|
|
|
try {
|
|
|
|
if (contentService != null)
|
|
|
|
contentService.systemReady();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("making Content Service ready", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2012-07-30 12:58:03 -07:00
|
|
|
|
2014-01-15 20:40:55 -08:00
|
|
|
mSystemServiceManager.startService(NotificationManagerService.class);
|
2013-12-05 16:48:06 -08:00
|
|
|
notification = INotificationManager.Stub.asInterface(
|
|
|
|
ServiceManager.getService(Context.NOTIFICATION_SERVICE));
|
|
|
|
networkPolicy.bindNotificationManager(notification);
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2014-01-15 20:40:55 -08:00
|
|
|
mSystemServiceManager.startService(DeviceStorageMonitorService.class);
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2013-03-28 18:10:43 -07:00
|
|
|
if (!disableLocation) {
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartLocationManagerService");
|
2013-03-28 18:10:43 -07:00
|
|
|
try {
|
|
|
|
location = new LocationManagerService(context);
|
|
|
|
ServiceManager.addService(Context.LOCATION_SERVICE, location);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting Location Manager", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartCountryDetectorService");
|
2013-03-28 18:10:43 -07:00
|
|
|
try {
|
|
|
|
countryDetector = new CountryDetectorService(context);
|
|
|
|
ServiceManager.addService(Context.COUNTRY_DETECTOR, countryDetector);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting Country Detector", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2010-07-13 15:32:16 +08:00
|
|
|
}
|
|
|
|
|
2013-03-28 18:10:43 -07:00
|
|
|
if (!disableNonCoreServices) {
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartSearchManagerService");
|
2013-03-28 18:10:43 -07:00
|
|
|
try {
|
2016-01-09 14:57:45 -07:00
|
|
|
mSystemServiceManager.startService(SEARCH_MANAGER_SERVICE_CLASS);
|
2013-03-28 18:10:43 -07:00
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting Search Service", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-03-03 19:31:44 -08:00
|
|
|
}
|
|
|
|
|
2015-05-28 11:48:43 -07:00
|
|
|
mSystemServiceManager.startService(DropBoxManagerService.class);
|
2009-09-11 16:40:01 -07:00
|
|
|
|
2013-03-28 18:10:43 -07:00
|
|
|
if (!disableNonCoreServices && context.getResources().getBoolean(
|
|
|
|
R.bool.config_enableWallpaperService)) {
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartWallpaperManagerService");
|
2011-10-31 12:50:12 -04:00
|
|
|
try {
|
2013-11-15 11:01:47 -08:00
|
|
|
wallpaper = new WallpaperManagerService(context);
|
|
|
|
ServiceManager.addService(Context.WALLPAPER_SERVICE, wallpaper);
|
2011-10-31 12:50:12 -04:00
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting Wallpaper Service", e);
|
2011-08-12 13:55:22 -07:00
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-03-03 19:31:44 -08:00
|
|
|
}
|
|
|
|
|
2015-09-02 22:48:13 +09:00
|
|
|
traceBeginAndSlog("StartAudioService");
|
2015-10-15 17:28:35 -07:00
|
|
|
mSystemServiceManager.startService(AudioService.Lifecycle.class);
|
2015-09-02 22:48:13 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2013-03-28 18:10:43 -07:00
|
|
|
if (!disableNonCoreServices) {
|
2014-05-29 17:48:33 -07:00
|
|
|
mSystemServiceManager.startService(DockObserver.class);
|
2015-09-25 16:43:01 -07:00
|
|
|
|
|
|
|
if (context.getPackageManager().hasSystemFeature
|
|
|
|
(PackageManager.FEATURE_WATCH)) {
|
|
|
|
mSystemServiceManager.startService(ThermalObserver.class);
|
|
|
|
}
|
2009-08-12 15:15:43 -05:00
|
|
|
}
|
|
|
|
|
2015-09-02 22:48:13 +09:00
|
|
|
traceBeginAndSlog("StartWiredAccessoryManager");
|
2015-03-24 12:40:15 -04:00
|
|
|
try {
|
|
|
|
// Listen for wired headset changes
|
|
|
|
inputManager.setWiredAccessoryCallbacks(
|
|
|
|
new WiredAccessoryManager(context, inputManager));
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting WiredAccessoryManager", e);
|
2010-10-06 15:23:14 -05:00
|
|
|
}
|
2015-09-02 22:48:13 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2010-10-06 15:23:14 -05:00
|
|
|
|
2013-03-28 18:10:43 -07:00
|
|
|
if (!disableNonCoreServices) {
|
2015-03-27 13:23:41 -07:00
|
|
|
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_MIDI)) {
|
|
|
|
// Start MIDI Manager service
|
|
|
|
mSystemServiceManager.startService(MIDI_SERVICE_CLASS);
|
|
|
|
}
|
|
|
|
|
2014-06-12 22:38:59 -07:00
|
|
|
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_USB_HOST)
|
|
|
|
|| mPackageManager.hasSystemFeature(
|
|
|
|
PackageManager.FEATURE_USB_ACCESSORY)) {
|
|
|
|
// Manage USB host and device support
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "StartUsbService");
|
2014-06-12 22:38:59 -07:00
|
|
|
mSystemServiceManager.startService(USB_SERVICE_CLASS);
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2013-03-28 18:10:43 -07:00
|
|
|
}
|
2011-08-29 20:11:07 -04:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartSerialService");
|
2013-03-28 18:10:43 -07:00
|
|
|
try {
|
|
|
|
// Serial port support
|
|
|
|
serial = new SerialService(context);
|
|
|
|
ServiceManager.addService(Context.SERIAL_SERVICE, serial);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
Slog.e(TAG, "Failure starting SerialService", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2016-02-12 20:38:23 +01:00
|
|
|
|
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER,
|
|
|
|
"StartHardwarePropertiesManagerService");
|
|
|
|
try {
|
|
|
|
hardwarePropertiesService = new HardwarePropertiesManagerService(context);
|
|
|
|
ServiceManager.addService(Context.HARDWARE_PROPERTIES_SERVICE,
|
|
|
|
hardwarePropertiesService);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
Slog.e(TAG, "Failure starting HardwarePropertiesManagerService", e);
|
|
|
|
}
|
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2010-06-23 17:36:36 -04:00
|
|
|
}
|
|
|
|
|
2014-01-15 20:40:55 -08:00
|
|
|
mSystemServiceManager.startService(TwilightService.class);
|
2012-08-21 22:12:20 -07:00
|
|
|
|
2014-06-09 19:50:00 -07:00
|
|
|
mSystemServiceManager.startService(JobSchedulerService.class);
|
2014-05-19 13:46:29 -07:00
|
|
|
|
2016-01-25 10:33:11 -08:00
|
|
|
mSystemServiceManager.startService(SoundTriggerService.class);
|
|
|
|
|
2013-03-28 18:10:43 -07:00
|
|
|
if (!disableNonCoreServices) {
|
2014-06-12 22:38:59 -07:00
|
|
|
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_BACKUP)) {
|
|
|
|
mSystemServiceManager.startService(BACKUP_MANAGER_SERVICE_CLASS);
|
2013-03-28 18:10:43 -07:00
|
|
|
}
|
2009-04-29 14:03:25 -07:00
|
|
|
|
2014-06-12 22:38:59 -07:00
|
|
|
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_APP_WIDGETS)) {
|
|
|
|
mSystemServiceManager.startService(APPWIDGET_SERVICE_CLASS);
|
2013-03-28 18:10:43 -07:00
|
|
|
}
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2014-06-12 22:38:59 -07:00
|
|
|
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_VOICE_RECOGNIZERS)) {
|
|
|
|
mSystemServiceManager.startService(VOICE_RECOGNITION_MANAGER_SERVICE_CLASS);
|
2014-04-04 18:02:06 -07:00
|
|
|
}
|
2015-07-21 17:43:53 -07:00
|
|
|
|
|
|
|
if (GestureLauncherService.isGestureLauncherEnabled(context.getResources())) {
|
|
|
|
Slog.i(TAG, "Gesture Launcher Service");
|
|
|
|
mSystemServiceManager.startService(GestureLauncherService.class);
|
|
|
|
}
|
2016-01-20 00:05:45 -08:00
|
|
|
mSystemServiceManager.startService(SensorNotificationService.class);
|
2010-02-19 17:02:21 -08:00
|
|
|
}
|
2010-10-18 15:29:09 -07:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartDiskStatsService");
|
2010-03-25 16:20:14 -07:00
|
|
|
try {
|
|
|
|
ServiceManager.addService("diskstats", new DiskStatsService(context));
|
|
|
|
} catch (Throwable e) {
|
2011-08-22 00:26:20 -07:00
|
|
|
reportWtf("starting DiskStats Service", e);
|
2010-03-25 16:20:14 -07:00
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2010-05-28 01:54:03 -07:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartSamplingProfilerService");
|
2010-05-28 01:54:03 -07:00
|
|
|
try {
|
|
|
|
// need to add this service even if SamplingProfilerIntegration.isEnabled()
|
|
|
|
// is false, because it is this service that detects system property change and
|
|
|
|
// turns on SamplingProfilerIntegration. Plus, when sampling profiler doesn't work,
|
|
|
|
// there is little overhead for running this service.
|
|
|
|
ServiceManager.addService("samplingprofiler",
|
|
|
|
new SamplingProfilerService(context));
|
|
|
|
} catch (Throwable e) {
|
2011-08-22 00:26:20 -07:00
|
|
|
reportWtf("starting SamplingProfiler Service", e);
|
2010-05-28 01:54:03 -07:00
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2010-08-06 12:06:04 +08:00
|
|
|
|
2014-10-16 13:31:39 -07:00
|
|
|
if (!disableNetwork && !disableNetworkTime) {
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartNetworkTimeUpdateService");
|
2013-03-28 18:10:43 -07:00
|
|
|
try {
|
|
|
|
networkTimeUpdater = new NetworkTimeUpdateService(context);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting NetworkTimeUpdate service", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2010-09-13 16:24:08 -07:00
|
|
|
}
|
2012-02-01 15:23:33 -08:00
|
|
|
|
2015-09-02 22:48:13 +09:00
|
|
|
traceBeginAndSlog("StartCommonTimeManagementService");
|
2015-03-24 12:40:15 -04:00
|
|
|
try {
|
|
|
|
commonTimeMgmtService = new CommonTimeManagementService(context);
|
|
|
|
ServiceManager.addService("commontime_management", commonTimeMgmtService);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting CommonTimeManagementService service", e);
|
2012-02-01 15:23:33 -08:00
|
|
|
}
|
2015-09-02 22:48:13 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2012-05-06 18:32:19 -07:00
|
|
|
|
2013-03-28 18:10:43 -07:00
|
|
|
if (!disableNetwork) {
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("CertBlacklister");
|
2013-03-28 18:10:43 -07:00
|
|
|
try {
|
|
|
|
CertBlacklister blacklister = new CertBlacklister(context);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting CertBlacklister", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2012-05-06 18:32:19 -07:00
|
|
|
}
|
2013-01-09 18:50:26 -08:00
|
|
|
|
2014-02-24 13:57:53 -08:00
|
|
|
if (!disableNonCoreServices) {
|
|
|
|
// Dreams (interactive idle-time views, a/k/a screen savers, and doze mode)
|
2014-01-30 23:38:03 -08:00
|
|
|
mSystemServiceManager.startService(DreamManagerService.class);
|
2012-01-30 14:33:52 -05:00
|
|
|
}
|
2013-02-13 14:39:30 -08:00
|
|
|
|
2015-06-10 18:25:44 -07:00
|
|
|
if (!disableNonCoreServices && ZygoteInit.PRELOAD_RESOURCES) {
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartAssetAtlasService");
|
Pack preloaded framework assets in a texture atlas
When the Android runtime starts, the system preloads a series of assets
in the Zygote process. These assets are shared across all processes.
Unfortunately, each one of these assets is later uploaded in its own
OpenGL texture, once per process. This wastes memory and generates
unnecessary OpenGL state changes.
This CL introduces an asset server that provides an atlas to all processes.
Note: bitmaps used by skia shaders are *not* sampled from the atlas.
It's an uncommon use case and would require extra texture transforms
in the GL shaders.
WHAT IS THE ASSETS ATLAS
The "assets atlas" is a single, shareable graphic buffer that contains
all the system's preloaded bitmap drawables (this includes 9-patches.)
The atlas is made of two distinct objects: the graphic buffer that
contains the actual pixels and the map which indicates where each
preloaded bitmap can be found in the atlas (essentially a pair of
x and y coordinates.)
HOW IS THE ASSETS ATLAS GENERATED
Because we need to support a wide variety of devices and because it
is easy to change the list of preloaded drawables, the atlas is
generated at runtime, during the startup phase of the system process.
There are several steps that lead to the atlas generation:
1. If the device is booting for the first time, or if the device was
updated, we need to find the best atlas configuration. To do so,
the atlas service tries a number of width, height and algorithm
variations that allows us to pack as many assets as possible while
using as little memory as possible. Once a best configuration is found,
it gets written to disk in /data/system/framework_atlas
2. Given a best configuration (algorithm variant, dimensions and
number of bitmaps that can be packed in the atlas), the atlas service
packs all the preloaded bitmaps into a single graphic buffer object.
3. The packing is done using Skia in a temporary native bitmap. The
Skia bitmap is then copied into the graphic buffer using OpenGL ES
to benefit from texture swizzling.
HOW PROCESSES USE THE ATLAS
Whenever a process' hardware renderer initializes its EGL context,
it queries the atlas service for the graphic buffer and the map.
It is important to remember that both the context and the map will
be valid for the lifetime of the hardware renderer (if the system
process goes down, all apps get killed as well.)
Every time the hardware renderer needs to render a bitmap, it first
checks whether the bitmap can be found in the assets atlas. When
the bitmap is part of the atlas, texture coordinates are remapped
appropriately before rendering.
Change-Id: I8eaecf53e7f6a33d90da3d0047c5ceec89ea3af0
2013-04-17 18:54:38 -07:00
|
|
|
try {
|
|
|
|
atlas = new AssetAtlasService(context);
|
|
|
|
ServiceManager.addService(AssetAtlasService.ASSET_ATLAS_SERVICE, atlas);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting AssetAtlasService", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
Pack preloaded framework assets in a texture atlas
When the Android runtime starts, the system preloads a series of assets
in the Zygote process. These assets are shared across all processes.
Unfortunately, each one of these assets is later uploaded in its own
OpenGL texture, once per process. This wastes memory and generates
unnecessary OpenGL state changes.
This CL introduces an asset server that provides an atlas to all processes.
Note: bitmaps used by skia shaders are *not* sampled from the atlas.
It's an uncommon use case and would require extra texture transforms
in the GL shaders.
WHAT IS THE ASSETS ATLAS
The "assets atlas" is a single, shareable graphic buffer that contains
all the system's preloaded bitmap drawables (this includes 9-patches.)
The atlas is made of two distinct objects: the graphic buffer that
contains the actual pixels and the map which indicates where each
preloaded bitmap can be found in the atlas (essentially a pair of
x and y coordinates.)
HOW IS THE ASSETS ATLAS GENERATED
Because we need to support a wide variety of devices and because it
is easy to change the list of preloaded drawables, the atlas is
generated at runtime, during the startup phase of the system process.
There are several steps that lead to the atlas generation:
1. If the device is booting for the first time, or if the device was
updated, we need to find the best atlas configuration. To do so,
the atlas service tries a number of width, height and algorithm
variations that allows us to pack as many assets as possible while
using as little memory as possible. Once a best configuration is found,
it gets written to disk in /data/system/framework_atlas
2. Given a best configuration (algorithm variant, dimensions and
number of bitmaps that can be packed in the atlas), the atlas service
packs all the preloaded bitmaps into a single graphic buffer object.
3. The packing is done using Skia in a temporary native bitmap. The
Skia bitmap is then copied into the graphic buffer using OpenGL ES
to benefit from texture swizzling.
HOW PROCESSES USE THE ATLAS
Whenever a process' hardware renderer initializes its EGL context,
it queries the atlas service for the graphic buffer and the map.
It is important to remember that both the context and the map will
be valid for the lifetime of the hardware renderer (if the system
process goes down, all apps get killed as well.)
Every time the hardware renderer needs to render a bitmap, it first
checks whether the bitmap can be found in the assets atlas. When
the bitmap is part of the atlas, texture coordinates are remapped
appropriately before rendering.
Change-Id: I8eaecf53e7f6a33d90da3d0047c5ceec89ea3af0
2013-04-17 18:54:38 -07:00
|
|
|
}
|
|
|
|
|
2015-03-18 15:24:33 -07:00
|
|
|
if (!disableNonCoreServices) {
|
|
|
|
ServiceManager.addService(GraphicsStatsService.GRAPHICS_STATS_SERVICE,
|
|
|
|
new GraphicsStatsService(context));
|
|
|
|
}
|
|
|
|
|
2014-06-12 22:38:59 -07:00
|
|
|
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_PRINTING)) {
|
|
|
|
mSystemServiceManager.startService(PRINT_MANAGER_SERVICE_CLASS);
|
2013-06-11 15:20:06 -07:00
|
|
|
}
|
2013-11-07 00:30:16 -08:00
|
|
|
|
2014-06-12 22:38:59 -07:00
|
|
|
mSystemServiceManager.startService(RestrictionsManagerService.class);
|
2014-05-24 15:34:37 -07:00
|
|
|
|
2014-06-12 22:38:59 -07:00
|
|
|
mSystemServiceManager.startService(MediaSessionService.class);
|
2014-02-13 14:19:04 -08:00
|
|
|
|
2014-07-10 20:49:27 +09:00
|
|
|
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_HDMI_CEC)) {
|
|
|
|
mSystemServiceManager.startService(HdmiControlService.class);
|
|
|
|
}
|
2014-04-23 17:57:26 +09:00
|
|
|
|
2014-08-27 23:50:37 -07:00
|
|
|
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_LIVE_TV)) {
|
2014-07-24 16:28:35 +09:00
|
|
|
mSystemServiceManager.startService(TvInputManagerService.class);
|
|
|
|
}
|
2014-02-20 18:23:25 -08:00
|
|
|
|
2016-01-14 10:10:22 -08:00
|
|
|
mSystemServiceManager.startService(MediaResourceMonitorService.class);
|
2015-12-14 21:57:34 +09:00
|
|
|
|
2013-11-07 00:30:16 -08:00
|
|
|
if (!disableNonCoreServices) {
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartMediaRouterService");
|
2013-11-07 00:30:16 -08:00
|
|
|
try {
|
|
|
|
mediaRouter = new MediaRouterService(context);
|
|
|
|
ServiceManager.addService(Context.MEDIA_ROUTER_SERVICE, mediaRouter);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting MediaRouterService", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2014-03-27 14:56:59 +01:00
|
|
|
|
2014-06-12 22:38:59 -07:00
|
|
|
mSystemServiceManager.startService(TrustManagerService.class);
|
2014-05-07 15:21:14 -07:00
|
|
|
|
2016-02-03 14:31:37 -08:00
|
|
|
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
|
|
|
|
mSystemServiceManager.startService(FingerprintService.class);
|
|
|
|
}
|
2014-06-06 15:00:49 -07:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
traceBeginAndSlog("StartBackgroundDexOptService");
|
2014-04-28 22:11:01 -07:00
|
|
|
try {
|
2015-12-23 18:55:08 +02:00
|
|
|
BackgroundDexOptService.schedule(context);
|
2014-04-28 22:11:01 -07:00
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting BackgroundDexOptService", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2014-06-06 15:00:49 -07:00
|
|
|
|
2015-11-10 08:58:14 -08:00
|
|
|
// Manages A/B OTA dexopting.
|
|
|
|
boolean disableOtaDexopt = SystemProperties.getBoolean("config.disable_otadexopt",
|
|
|
|
false);
|
|
|
|
if (!disableOtaDexopt) {
|
|
|
|
traceBeginAndSlog("StartOtaDexOptService");
|
|
|
|
try {
|
|
|
|
OtaDexoptService.main(mSystemContext, mPackageManagerService);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting BackgroundDexOptService", e);
|
|
|
|
}
|
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
|
|
|
}
|
2013-11-07 00:30:16 -08:00
|
|
|
}
|
2014-02-19 14:31:52 -08:00
|
|
|
|
2014-06-12 22:38:59 -07:00
|
|
|
mSystemServiceManager.startService(LauncherAppsService.class);
|
2009-03-03 19:31:44 -08:00
|
|
|
}
|
|
|
|
|
2014-07-08 18:07:36 -07:00
|
|
|
if (!disableNonCoreServices) {
|
|
|
|
mSystemServiceManager.startService(MediaProjectionManagerService.class);
|
|
|
|
}
|
|
|
|
|
2009-09-28 13:25:46 -07:00
|
|
|
// Before things start rolling, be sure we have decided whether
|
|
|
|
// we are in safe mode.
|
2009-09-02 13:26:28 -07:00
|
|
|
final boolean safeMode = wm.detectSafeMode();
|
2009-09-28 13:25:46 -07:00
|
|
|
if (safeMode) {
|
2014-01-16 22:16:42 -08:00
|
|
|
mActivityManagerService.enterSafeMode();
|
2011-01-13 21:08:27 -08:00
|
|
|
// Disable the JIT for the system_server process
|
|
|
|
VMRuntime.getRuntime().disableJitCompilation();
|
2010-02-14 16:18:56 -08:00
|
|
|
} else {
|
|
|
|
// Enable the JIT for the system_server process
|
|
|
|
VMRuntime.getRuntime().startJitCompilation();
|
2009-09-28 13:25:46 -07:00
|
|
|
}
|
2009-12-04 10:31:43 -08:00
|
|
|
|
2014-07-24 12:56:45 -07:00
|
|
|
// MMS service broker
|
|
|
|
mmsService = mSystemServiceManager.startService(MmsServiceBroker.class);
|
|
|
|
|
2009-09-28 13:25:46 -07:00
|
|
|
// It is now time to start up the app processes...
|
2009-07-08 17:09:14 -07:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "MakeVibratorServiceReady");
|
2012-04-13 20:38:38 -07:00
|
|
|
try {
|
|
|
|
vibrator.systemReady();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("making Vibrator Service ready", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2012-04-13 20:38:38 -07:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "MakeLockSettingsServiceReady");
|
2013-03-28 18:10:43 -07:00
|
|
|
if (lockSettings != null) {
|
|
|
|
try {
|
|
|
|
lockSettings.systemReady();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("making Lock Settings Service ready", e);
|
|
|
|
}
|
Fixing services start order that impacts ICS - JB upgrade
JB has introduced LockSettingsService. When the phone is
upgrading from ICS, that used another way to store lock
settings, the LockSettingsService needs to import these
settings to store in its database. This happens when the
systemReady() method of this class is called by SystemServer.
The problem resides in the fact that the
DevicePolicyManagerService actually needs to access the
LockSettingsService during its systemReady() initialization,
causing invalid values to be read by it which propagates and
ends up causing a invalid return in the method
isActivePasswordSufficient.
If user had a Google corporate account that enforces password
related policies through Google Apps Device Policy (GADP) app
in ICS, when he upgrades to JB, the GADP will throw a
notification saying that the password doesn't meet the required
policies and needs to be changed, incorrectly, since it wasn't
touched during upgrade.
This fix initializes the LockSettingsService before the
DevicePolicyManagerService, which is the correct way since
the latter uses the first in its initialization. This prevents
this issue to happen, and probably future issues, depending
on the way that LockSettingsService evolves.
Change-Id: I3d4334a8b728f0ad9ae744cece430d15af25a0b7
2012-09-18 18:26:27 -03:00
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
Fixing services start order that impacts ICS - JB upgrade
JB has introduced LockSettingsService. When the phone is
upgrading from ICS, that used another way to store lock
settings, the LockSettingsService needs to import these
settings to store in its database. This happens when the
systemReady() method of this class is called by SystemServer.
The problem resides in the fact that the
DevicePolicyManagerService actually needs to access the
LockSettingsService during its systemReady() initialization,
causing invalid values to be read by it which propagates and
ends up causing a invalid return in the method
isActivePasswordSufficient.
If user had a Google corporate account that enforces password
related policies through Google Apps Device Policy (GADP) app
in ICS, when he upgrades to JB, the GADP will throw a
notification saying that the password doesn't meet the required
policies and needs to be changed, incorrectly, since it wasn't
touched during upgrade.
This fix initializes the LockSettingsService before the
DevicePolicyManagerService, which is the correct way since
the latter uses the first in its initialization. This prevents
this issue to happen, and probably future issues, depending
on the way that LockSettingsService evolves.
Change-Id: I3d4334a8b728f0ad9ae744cece430d15af25a0b7
2012-09-18 18:26:27 -03:00
|
|
|
|
2013-12-20 13:27:30 -08:00
|
|
|
// Needed by DevicePolicyManager for initialization
|
2014-01-15 20:40:55 -08:00
|
|
|
mSystemServiceManager.startBootPhase(SystemService.PHASE_LOCK_SETTINGS_READY);
|
2010-01-12 18:14:19 -08:00
|
|
|
|
2014-01-15 20:40:55 -08:00
|
|
|
mSystemServiceManager.startBootPhase(SystemService.PHASE_SYSTEM_SERVICES_READY);
|
2009-07-08 17:09:14 -07:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "MakeWindowManagerServiceReady");
|
2011-08-22 00:26:20 -07:00
|
|
|
try {
|
|
|
|
wm.systemReady();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("making Window Manager Service ready", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2010-10-04 15:27:22 -04:00
|
|
|
|
2011-01-13 21:08:27 -08:00
|
|
|
if (safeMode) {
|
2014-01-16 22:16:42 -08:00
|
|
|
mActivityManagerService.showSafeModeOverlay();
|
2011-01-13 21:08:27 -08:00
|
|
|
}
|
|
|
|
|
2010-10-04 15:27:22 -04:00
|
|
|
// Update the configuration for this context by hand, because we're going
|
|
|
|
// to start using it before the config change done in wm.systemReady() will
|
|
|
|
// propagate to it.
|
|
|
|
Configuration config = wm.computeNewConfiguration();
|
|
|
|
DisplayMetrics metrics = new DisplayMetrics();
|
|
|
|
WindowManager w = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
|
|
|
|
w.getDefaultDisplay().getMetrics(metrics);
|
|
|
|
context.getResources().updateConfiguration(config, metrics);
|
|
|
|
|
2015-08-11 17:27:04 -04:00
|
|
|
// The system context's theme may be configuration-dependent.
|
|
|
|
final Theme systemTheme = context.getTheme();
|
|
|
|
if (systemTheme.getChangingConfigurations() != 0) {
|
|
|
|
systemTheme.rebase();
|
|
|
|
}
|
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "MakePowerManagerServiceReady");
|
2012-08-21 22:14:26 -07:00
|
|
|
try {
|
2014-01-15 20:40:55 -08:00
|
|
|
// TODO: use boot phase
|
2014-06-13 19:00:36 -07:00
|
|
|
mPowerManagerService.systemReady(mActivityManagerService.getAppOpsService());
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2012-08-21 22:14:26 -07:00
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("making Power Manager Service ready", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2012-08-21 22:14:26 -07:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "MakePackageManagerServiceReady");
|
2009-03-03 19:31:44 -08:00
|
|
|
try {
|
2014-06-12 22:38:59 -07:00
|
|
|
mPackageManagerService.systemReady();
|
2011-08-22 00:26:20 -07:00
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("making Package Manager Service ready", e);
|
2009-03-03 19:31:44 -08:00
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-03-03 19:31:44 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "MakeDisplayManagerServiceReady");
|
2012-08-28 03:27:37 -07:00
|
|
|
try {
|
2014-01-16 22:16:42 -08:00
|
|
|
// TODO: use boot phase and communicate these flags some other way
|
2014-06-12 22:38:59 -07:00
|
|
|
mDisplayManagerService.systemReady(safeMode, mOnlyCore);
|
2012-08-28 03:27:37 -07:00
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("making Display Manager Service ready", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2012-08-28 03:27:37 -07:00
|
|
|
|
2009-09-02 13:26:28 -07:00
|
|
|
// These are needed to propagate to the runnable below.
|
2011-06-29 10:45:16 -07:00
|
|
|
final NetworkManagementService networkManagementF = networkManagement;
|
2011-05-24 18:39:45 -07:00
|
|
|
final NetworkStatsService networkStatsF = networkStats;
|
2011-05-20 15:29:23 -07:00
|
|
|
final NetworkPolicyManagerService networkPolicyF = networkPolicy;
|
2009-09-02 13:26:28 -07:00
|
|
|
final ConnectivityService connectivityF = connectivity;
|
2014-04-16 17:29:40 -07:00
|
|
|
final NetworkScoreService networkScoreF = networkScore;
|
2009-09-02 13:26:28 -07:00
|
|
|
final WallpaperManagerService wallpaperF = wallpaper;
|
2010-02-22 16:36:44 -05:00
|
|
|
final LocationManagerService locationF = location;
|
2010-07-13 15:32:16 +08:00
|
|
|
final CountryDetectorService countryDetectorF = countryDetector;
|
2010-09-13 16:24:08 -07:00
|
|
|
final NetworkTimeUpdateService networkTimeUpdaterF = networkTimeUpdater;
|
2012-02-01 15:23:33 -08:00
|
|
|
final CommonTimeManagementService commonTimeMgmtServiceF = commonTimeMgmtService;
|
2011-06-22 16:38:13 +09:00
|
|
|
final TextServicesManagerService textServiceManagerServiceF = tsms;
|
2011-08-22 00:26:20 -07:00
|
|
|
final StatusBarManagerService statusBarF = statusBar;
|
Pack preloaded framework assets in a texture atlas
When the Android runtime starts, the system preloads a series of assets
in the Zygote process. These assets are shared across all processes.
Unfortunately, each one of these assets is later uploaded in its own
OpenGL texture, once per process. This wastes memory and generates
unnecessary OpenGL state changes.
This CL introduces an asset server that provides an atlas to all processes.
Note: bitmaps used by skia shaders are *not* sampled from the atlas.
It's an uncommon use case and would require extra texture transforms
in the GL shaders.
WHAT IS THE ASSETS ATLAS
The "assets atlas" is a single, shareable graphic buffer that contains
all the system's preloaded bitmap drawables (this includes 9-patches.)
The atlas is made of two distinct objects: the graphic buffer that
contains the actual pixels and the map which indicates where each
preloaded bitmap can be found in the atlas (essentially a pair of
x and y coordinates.)
HOW IS THE ASSETS ATLAS GENERATED
Because we need to support a wide variety of devices and because it
is easy to change the list of preloaded drawables, the atlas is
generated at runtime, during the startup phase of the system process.
There are several steps that lead to the atlas generation:
1. If the device is booting for the first time, or if the device was
updated, we need to find the best atlas configuration. To do so,
the atlas service tries a number of width, height and algorithm
variations that allows us to pack as many assets as possible while
using as little memory as possible. Once a best configuration is found,
it gets written to disk in /data/system/framework_atlas
2. Given a best configuration (algorithm variant, dimensions and
number of bitmaps that can be packed in the atlas), the atlas service
packs all the preloaded bitmaps into a single graphic buffer object.
3. The packing is done using Skia in a temporary native bitmap. The
Skia bitmap is then copied into the graphic buffer using OpenGL ES
to benefit from texture swizzling.
HOW PROCESSES USE THE ATLAS
Whenever a process' hardware renderer initializes its EGL context,
it queries the atlas service for the graphic buffer and the map.
It is important to remember that both the context and the map will
be valid for the lifetime of the hardware renderer (if the system
process goes down, all apps get killed as well.)
Every time the hardware renderer needs to render a bitmap, it first
checks whether the bitmap can be found in the assets atlas. When
the bitmap is part of the atlas, texture coordinates are remapped
appropriately before rendering.
Change-Id: I8eaecf53e7f6a33d90da3d0047c5ceec89ea3af0
2013-04-17 18:54:38 -07:00
|
|
|
final AssetAtlasService atlasF = atlas;
|
2012-04-17 16:52:41 -07:00
|
|
|
final InputManagerService inputManagerF = inputManager;
|
2012-09-20 10:09:45 -07:00
|
|
|
final TelephonyRegistry telephonyRegistryF = telephonyRegistry;
|
2013-11-07 00:30:16 -08:00
|
|
|
final MediaRouterService mediaRouterF = mediaRouter;
|
2014-07-24 12:56:45 -07:00
|
|
|
final MmsServiceBroker mmsServiceF = mmsService;
|
2009-12-04 10:31:43 -08:00
|
|
|
|
2009-09-02 13:26:28 -07:00
|
|
|
// We now tell the activity manager it is okay to run third party
|
|
|
|
// code. It will call back into us once it has gotten to the state
|
|
|
|
// where third party code can really run (but before it has actually
|
|
|
|
// started launching the initial applications), for us to complete our
|
|
|
|
// initialization.
|
2014-01-16 22:16:42 -08:00
|
|
|
mActivityManagerService.systemReady(new Runnable() {
|
2014-02-14 17:19:56 -08:00
|
|
|
@Override
|
2009-09-02 13:26:28 -07:00
|
|
|
public void run() {
|
2014-02-21 14:06:47 -08:00
|
|
|
Slog.i(TAG, "Making services ready");
|
|
|
|
mSystemServiceManager.startBootPhase(
|
|
|
|
SystemService.PHASE_ACTIVITY_MANAGER_READY);
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "PhaseActivityManagerReady");
|
2014-02-21 14:06:47 -08:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "StartObservingNativeCrashes");
|
2014-02-21 14:06:47 -08:00
|
|
|
try {
|
|
|
|
mActivityManagerService.startObservingNativeCrashes();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("observing native crashes", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2014-07-25 18:03:16 +01:00
|
|
|
|
|
|
|
Slog.i(TAG, "WebViewFactory preparation");
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "WebViewFactoryPreparation");
|
2015-10-30 19:25:37 +00:00
|
|
|
mWebViewUpdateService.prepareWebViewInSystemServer();
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2014-07-25 18:03:16 +01:00
|
|
|
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "StartSystemUI");
|
2014-02-21 14:06:47 -08:00
|
|
|
try {
|
|
|
|
startSystemUi(context);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("starting System UI", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "MakeMountServiceReady");
|
2014-04-16 17:29:40 -07:00
|
|
|
try {
|
|
|
|
if (networkScoreF != null) networkScoreF.systemReady();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("making Network Score Service ready", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "MakeNetworkManagementServiceReady");
|
2014-02-21 14:06:47 -08:00
|
|
|
try {
|
|
|
|
if (networkManagementF != null) networkManagementF.systemReady();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("making Network Managment Service ready", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "MakeNetworkStatsServiceReady");
|
2014-02-21 14:06:47 -08:00
|
|
|
try {
|
|
|
|
if (networkStatsF != null) networkStatsF.systemReady();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("making Network Stats Service ready", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "MakeNetworkPolicyServiceReady");
|
2014-02-21 14:06:47 -08:00
|
|
|
try {
|
|
|
|
if (networkPolicyF != null) networkPolicyF.systemReady();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("making Network Policy Service ready", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "MakeConnectivityServiceReady");
|
2014-02-21 14:06:47 -08:00
|
|
|
try {
|
|
|
|
if (connectivityF != null) connectivityF.systemReady();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("making Connectivity Service ready", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2015-10-15 17:28:35 -07:00
|
|
|
|
2014-02-21 14:06:47 -08:00
|
|
|
Watchdog.getInstance().start();
|
|
|
|
|
|
|
|
// It is now okay to let the various system services start their
|
|
|
|
// third party code...
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, "PhaseThirdPartyAppsCanStart");
|
2014-02-21 14:06:47 -08:00
|
|
|
mSystemServiceManager.startBootPhase(
|
|
|
|
SystemService.PHASE_THIRD_PARTY_APPS_CAN_START);
|
|
|
|
|
|
|
|
try {
|
|
|
|
if (wallpaperF != null) wallpaperF.systemRunning();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("Notifying WallpaperService running", e);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
if (locationF != null) locationF.systemRunning();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("Notifying Location Service running", e);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
if (countryDetectorF != null) countryDetectorF.systemRunning();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("Notifying CountryDetectorService running", e);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
if (networkTimeUpdaterF != null) networkTimeUpdaterF.systemRunning();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("Notifying NetworkTimeService running", e);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
if (commonTimeMgmtServiceF != null) {
|
|
|
|
commonTimeMgmtServiceF.systemRunning();
|
2014-02-14 17:19:56 -08:00
|
|
|
}
|
2014-02-21 14:06:47 -08:00
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("Notifying CommonTimeManagementService running", e);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
if (textServiceManagerServiceF != null)
|
|
|
|
textServiceManagerServiceF.systemRunning();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("Notifying TextServicesManagerService running", e);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
if (atlasF != null) atlasF.systemRunning();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("Notifying AssetAtlasService running", e);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
// TODO(BT) Pass parameter to input manager
|
|
|
|
if (inputManagerF != null) inputManagerF.systemRunning();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("Notifying InputManagerService running", e);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
if (telephonyRegistryF != null) telephonyRegistryF.systemRunning();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("Notifying TelephonyRegistry running", e);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
if (mediaRouterF != null) mediaRouterF.systemRunning();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("Notifying MediaRouterService running", e);
|
|
|
|
}
|
|
|
|
|
2014-07-24 12:56:45 -07:00
|
|
|
try {
|
|
|
|
if (mmsServiceF != null) mmsServiceF.systemRunning();
|
|
|
|
} catch (Throwable e) {
|
|
|
|
reportWtf("Notifying MmsService running", e);
|
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
Trace.traceEnd(Trace.TRACE_TAG_SYSTEM_SERVER);
|
2009-09-02 13:26:28 -07:00
|
|
|
}
|
|
|
|
});
|
2009-03-03 19:31:44 -08:00
|
|
|
}
|
2010-10-21 11:09:02 -04:00
|
|
|
|
|
|
|
static final void startSystemUi(Context context) {
|
|
|
|
Intent intent = new Intent();
|
|
|
|
intent.setComponent(new ComponentName("com.android.systemui",
|
|
|
|
"com.android.systemui.SystemUIService"));
|
2015-12-21 14:16:43 -07:00
|
|
|
intent.addFlags(Intent.FLAG_DEBUG_TRIAGED_MISSING);
|
2012-11-27 19:12:23 -08:00
|
|
|
//Slog.d(TAG, "Starting service: " + intent);
|
2015-04-28 14:21:43 -07:00
|
|
|
context.startServiceAsUser(intent, UserHandle.SYSTEM);
|
2010-10-21 11:09:02 -04:00
|
|
|
}
|
2015-06-30 17:07:32 +09:00
|
|
|
|
|
|
|
private static void traceBeginAndSlog(String name) {
|
|
|
|
Trace.traceBegin(Trace.TRACE_TAG_SYSTEM_SERVER, name);
|
|
|
|
Slog.i(TAG, name);
|
|
|
|
}
|
2015-11-05 16:54:09 +00:00
|
|
|
}
|