public final class TwilightService extends SystemService implements AlarmManager.OnAlarmListener, Handler.Callback, LocationListener
Used by the UI mode manager and other components to adjust night mode effects based on sunrise and sunset.
PHASE_ACTIVITY_MANAGER_READY, PHASE_BOOT_COMPLETED, PHASE_LOCK_SETTINGS_READY, PHASE_SYSTEM_SERVICES_READY, PHASE_THIRD_PARTY_APPS_CAN_START, PHASE_WAIT_FOR_DEFAULT_DISPLAY
Constructor and Description |
---|
TwilightService(Context context) |
Modifier and Type | Method and Description |
---|---|
boolean |
handleMessage(Message msg) |
void |
onAlarm()
Callback method that is invoked by the system when the alarm time is reached.
|
void |
onBootPhase(int phase)
Called on each phase of the boot process.
|
void |
onLocationChanged(Location location)
Called when the location has changed.
|
void |
onProviderDisabled(String provider)
Called when the provider is disabled by the user.
|
void |
onProviderEnabled(String provider)
Called when the provider is enabled by the user.
|
void |
onStart()
Called when the dependencies listed in the @Service class-annotation are available
and after the chosen start phase.
|
void |
onStatusChanged(String provider,
int status,
Bundle extras)
Called when the provider status changes.
|
getBinderService, getContext, getLocalService, isSafeMode, onCleanupUser, onStartUser, onStopUser, onSwitchUser, onUnlockUser, publishBinderService, publishBinderService, publishLocalService
public TwilightService(Context context)
public void onStart()
SystemService
onStart
in class SystemService
public void onBootPhase(int phase)
SystemService
onBootPhase
in class SystemService
phase
- The current boot phase.public boolean handleMessage(Message msg)
handleMessage
in interface Handler.Callback
public void onAlarm()
AlarmManager.OnAlarmListener
onAlarm
in interface AlarmManager.OnAlarmListener
public void onLocationChanged(Location location)
LocationListener
There are no restrictions on the use of the supplied Location object.
onLocationChanged
in interface LocationListener
location
- The new location, as a Location object.public void onStatusChanged(String provider, int status, Bundle extras)
LocationListener
onStatusChanged
in interface LocationListener
provider
- the name of the location provider associated with this
update.status
- LocationProvider.OUT_OF_SERVICE
if the
provider is out of service, and this is not expected to change in the
near future; LocationProvider.TEMPORARILY_UNAVAILABLE
if
the provider is temporarily unavailable but is expected to be available
shortly; and LocationProvider.AVAILABLE
if the
provider is currently available.extras
- an optional Bundle which will contain provider specific
status variables.
A number of common key/value pairs for the extras Bundle are listed below. Providers that use any of the keys on this list must provide the corresponding value as described below.
public void onProviderEnabled(String provider)
LocationListener
onProviderEnabled
in interface LocationListener
provider
- the name of the location provider associated with this
update.public void onProviderDisabled(String provider)
LocationListener
onProviderDisabled
in interface LocationListener
provider
- the name of the location provider associated with this
update.