Windows Mobile 6.5 Wake Lock APIs Explained

Windows Mobile 6.5 relied on the Windows Embedded CE Power Manager architecture to manage device sleep states, requiring developers to use specific native APIs to keep the operating system awake during critical background or foreground operations. Rather than utilizing a single unified "wake lock" method like modern mobile platforms, developers primarily utilized SystemIdleTimerReset, SetPowerRequirement, and unattended execution mode via PowerPolicyNotify to control power transitions, keep the CPU active, and prevent device suspension.

SystemIdleTimerReset

The most basic mechanism to prevent a Windows Mobile device from sleeping during continuous active use was SystemIdleTimerReset. Windows Mobile monitored three main idle timers: user idle, system idle, and suspend. When the system idle timer expired without activity, the device transitioned into a low-power suspend state.

Calling SystemIdleTimerReset() periodically reset these internal timers, signaling to the OS that the system was still engaged. This was commonly used during media playback or navigation tasks to keep the screen backlight illuminated and the CPU active without requiring actual physical input on the touch screen or hardware buttons.

SetPowerRequirement

For fine-grained control over specific hardware devices, developers used SetPowerRequirement. This function informed the Power Manager that a particular device (such as the CPU, display, or cellular radio) had to remain in a minimum device power state, typically D0 (fully on).

Key aspects of SetPowerRequirement included:

  • Targeted Locking: Developers passed the device name (for example, "PWR1:" or a specific driver name) along with the desired power state (D0).
  • Persistence: The requirement stayed active across system power transitions until explicitly released.
  • Release Requirement: Applications had to call ReleasePowerRequirement using the handle returned by SetPowerRequirement once the critical task finished to allow the device to resume normal battery-saving sleep cycles.

Unattended Mode via PowerPolicyNotify

When an application required the CPU to remain active while allowing the screen and backlight to turn off to conserve battery—such as downloading a large file, synchronizing email, or recording audio—it used Unattended Mode.

Developers invoked Unattended Mode using:

PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE);

When a user pressed the power button while Unattended Mode was active, Windows Mobile turned off the display and audio but kept the core CPU running in the POWER_STATE_UNATTENDED state. Once the background process finished, the application called PowerPolicyNotify(PPN_UNATTENDEDMODE, FALSE) to allow the device to enter a full suspend state (POWER_STATE_SUSPEND).