Fields Summary |
---|
public static final int | PHASE_WAIT_FOR_DEFAULT_DISPLAY |
public static final int | PHASE_LOCK_SETTINGS_READYAfter receiving this boot phase, services can obtain lock settings data. |
public static final int | PHASE_SYSTEM_SERVICES_READYAfter receiving this boot phase, services can safely call into core system services
such as the PowerManager or PackageManager. |
public static final int | PHASE_ACTIVITY_MANAGER_READYAfter receiving this boot phase, services can broadcast Intents. |
public static final int | PHASE_THIRD_PARTY_APPS_CAN_STARTAfter receiving this boot phase, services can start/bind to third party apps.
Apps will be able to make Binder calls into services at this point. |
public static final int | PHASE_BOOT_COMPLETEDAfter receiving this boot phase, services can allow user interaction with the device.
This phase occurs when boot has completed and the home application has started.
System services may prefer to listen to this phase rather than registering a
broadcast receiver for ACTION_BOOT_COMPLETED to reduce overall latency. |
private final android.content.Context | mContext |
Methods Summary |
---|
protected final android.os.IBinder | getBinderService(java.lang.String name)Get a binder service by its name.
return ServiceManager.getService(name);
|
public final android.content.Context | getContext()Gets the system context.
return mContext;
|
protected final T | getLocalService(java.lang.Class type)Get a local service by interface.
return LocalServices.getService(type);
|
private SystemServiceManager | getManager()
return LocalServices.getService(SystemServiceManager.class);
|
public final boolean | isSafeMode()Returns true if the system is running in safe mode.
TODO: we should define in which phase this becomes valid
return getManager().isSafeMode();
|
public void | onBootPhase(int phase)Called on each phase of the boot process. Phases before the service's start phase
(as defined in the @Service annotation) are never received.
|
public void | onCleanupUser(int userHandle)Called when an existing user is stopping, for system services to finalize any per-user
state they maintain for running users. This is called after all application process
teardown of the user is complete.
|
public abstract void | onStart()Called when the dependencies listed in the @Service class-annotation are available
and after the chosen start phase.
When this method returns, the service should be published.
|
public void | onStartUser(int userHandle)Called when a new user is starting, for system services to initialize any per-user
state they maintain for running users.
|
public void | onStopUser(int userHandle)Called when an existing user is stopping, for system services to finalize any per-user
state they maintain for running users. This is called prior to sending the SHUTDOWN
broadcast to the user; it is a good place to stop making use of any resources of that
user (such as binding to a service running in the user).
|
public void | onSwitchUser(int userHandle)Called when switching to a different foreground user, for system services that have
special behavior for whichever user is currently in the foreground. This is called
before any application processes are aware of the new user.
|
protected final void | publishBinderService(java.lang.String name, android.os.IBinder service)Publish the service so it is accessible to other services and apps.
publishBinderService(name, service, false);
|
protected final void | publishBinderService(java.lang.String name, android.os.IBinder service, boolean allowIsolated)Publish the service so it is accessible to other services and apps.
ServiceManager.addService(name, service, allowIsolated);
|
protected final void | publishLocalService(java.lang.Class type, T service)Publish the service so it is only accessible to the system process.
LocalServices.addService(type, service);
|