Task Scheduler Overview

The Task Scheduler enables clients to schedule tasks for time-based and condition-based execution. The Task Scheduler is a Startup State Aware component. This ensures no task is initiated before all system-level services are up and running.

The time or condition for task execution is defined in a schedule. Schedules and tasks can be persistent or transient. Schedules can be created, edited and deleted.

The Task Scheduler participates in a system-wide backup or restore operation initiated by the Secure Backup Engine as a passive backup client. This ensures the persistent schedules are backed up and restored.

Required background

In a condition-based schedule, a condition can be user-defined or system condition. User defined conditions are published using Publish and Subscribe keys. For more information about Publish and Subscribe concept refer Publish and Subscribe.

Key concepts and terms

Task

The execution of an application or program.

Schedule

A plan for performing a task.

Persistent Schedule

The lifetime of a persistent schedule is not limited to the lifetime of the tasks associated with it.

Transient Schedule

A Transient schedule is created with a new scheduled task and is destroyed on task destruction. Transient schedules and tasks are not persisted on disk-based storage.

Time-based Schedule

A Time-based schedule contains one or more tasks that are due for execution at a specified time.

Condition-based Schedule

A condition-based schedule contains one or more tasks which are executed when either a set of certin Publish and Subscribe conditions are met or a default time-out is reached.

Home-Time based Schedule

A home-time based schedule occur at a given local time. Local time typically includes changes for time zone and DST. These schedules are referred to as ‘floating’ schedules.

Daylight Saving Time (DST)

Daylight Saving Time (or summertime as it is called in many countries) is a way of utilizing more daylight by advancing the local time by one hour during the summer.

Coordinated Universal Time (UTC)

UTC is independent of location. UTC-based schedules occur at a given UTC time regardless of the local time.

Architecture

The task scheduler is a permanent server. It is automatically started when the phone boots or reboots and does not shutdown while the phone is running. If the server fails, and cannot be automatically restarted, the phone restarts automatically. Persistent schedules are stored the permanent file store. Transient schedules are lost if the server fails.

A client must register with the task scheduler before it can schedule a task.

APIs

The main APIs of the task scheduler are:

API Description

CScheduledTask

A scheduled task

RScheduler

The client side interface to the Task Scheduler.

Typical uses

The main uses of the task scheduler are:

  • Schedule a sequence of tasks to be executed based on time.

  • Schedule a sequence of tasks to be executed based on conditions.

For more information about using the task scheduler APIs, see the Developing Programs with Task Scheduling Capabilities section.

See also

Backup and Restore on Scheduled Tasks in Persistent Schedules