Skip to content

Proposal - CoreApp and app lifecycle helpers #9

@jonwis

Description

@jonwis

Proposal: CoreApp Everywhere

Summary

Provide a variant of CoreApplication that gives Win32 apps the same common events as UWPs. Expose a set of common app/user/session lifecycle events for all kinds of apps to use under a single API surface.

Rationale

While UWP has a rich app-lifecycle model for applications under system control, Win32 has historically made it hard to detect and react to app/user/system/session power and lifecycle events. There should be a single type that collects & generates events for the lifecycle of an app. As Windows' power management functionality improves having a single type collecting these events is critical.

  • Setting up Win32 notifications for user lock & unlock is challenging
  • Notifications for query-end-session and end-session are hard to implement
  • Power state transitions let apps reduce their footprint on the system when the user goes on battery
  • Detecting whether a session is locked right now is complex
  • UWP provides platform support for app single-instancing, Win32 does not (easily)
  • Integration with restart manager means apps restore after both app & OS update

Scope

Capability Priority
A single API surface usable by Win32 and UWP apps Must
Apps get a set of events they can listen to and react in their own way Must
Connect apps to Restart Manager to support OS servicing Should
Provide APIs for user state transitions for apps to use Should
Expose more of the power state management directly to apps Could
Provide a "default main thread message pump" for Win32 apps Could
Prevent user sign-out (by blocking end-session) Won't
Let the system control and manage resource usage with the UWP model on Win32 apps Won't
Require Win32 app use CoreApplication/CoreWindow for windowing Won't

Important Notes

The existing CoreApplication type mixes together basic app functionality like lifecycle and window generation. Reunion's CoreApp should expose only app lifecycle events. UWP activation paths like OnActivated should be moved to another object that's clearly about UWP activation and windowing behavior.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions