Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added AppLifecycle Activation API spec. #279

Merged
merged 5 commits into from
Jan 29, 2021

Conversation

andreww-msft
Copy link
Contributor

No description provided.

@ghost ghost added the needs-triage label Nov 6, 2020
{
// Get the AppLifecycle sub-object for activation registration.
ActivationRegistrationManager registrationManager =
AppLifecycle::GetActivationRegistrationManager();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any state that requires an instance class, or would this make more sense as a static class with register methods on it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can imagine that at some point we might want a "get manager for sub application". Doing that is usually a breaking change unless it's already an instance, but in the spirit of Project Reunion, feel free to avoid complexity and make these static methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@@ -0,0 +1,248 @@
# AppLifecycle - Rich Activation

Reunion introduces a new AppLifecycle component that provides a core set of functionality related to app activation and lifecycle. Much of this functionality is directly equivalent - or very similar - to existing functionality within the platform. However, there is value in abstracting this functionality so that all app types can use it, delivering it out-of-band from the OS, and making it available as open-source. The totality of AppLifecycle features in v1 is as follows (additional features may be added in later releases):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same note on wrapping, please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please clarify: you want hard returns at col 80?
BTW - I don't seen a option in Prettier or Markdown All In One to do word wrapping.

specs/AppLifecycle/Activation/AppLifecycle Activation.md Outdated Show resolved Hide resolved
specs/AppLifecycle/Activation/AppLifecycle Activation.md Outdated Show resolved Hide resolved
specs/AppLifecycle/Activation/AppLifecycle Activation.md Outdated Show resolved Hide resolved
- Which activation kinds will unpackaged apps be able to use?
- How does the app tell the system which activation kinds it wants to use?

### Which activation kinds will unpackaged apps be able to use?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit on phrasing - consider just "Supported Activation kind for unpackaged apps"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.


UWP apps can only register for activation kinds via manifest declarations, and therefore this happens during app install. Conversely, traditional app types can write registry entries at any time.

A key requirement is to enable unpackaged Win32 apps to use the set of rich activations using familiar designs, without any additional friction. Specifically, AppLifecycle will provide APIs which the app can call to register its interest in rich activations. The app is not required to have an MSIX manifest, nor an MSIX package. Using the API approach rather than the manifest approach has the added benefit that it also addresses a related customer request for dynamic activation registrations even for UWP apps.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a requirement on us, but what's this give to developers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.


A key requirement is to enable unpackaged Win32 apps to use the set of rich activations using familiar designs, without any additional friction. Specifically, AppLifecycle will provide APIs which the app can call to register its interest in rich activations. The app is not required to have an MSIX manifest, nor an MSIX package. Using the API approach rather than the manifest approach has the added benefit that it also addresses a related customer request for dynamic activation registrations even for UWP apps.

Ideally, if the app is installed per-machine then any activation registrations would also be per-machine; and if installed per-user then registrations would be per-user. The platform will not offer any additional API features for this - that is, the app doesn't get to choose whether its activation registrations are per-machine or per-user. Instead, the activations should be registered to match the way the app is installed. For v1, the platform will support only per-user registration.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little confusing. Maybe lead off with "Currently all registered activation points are managed per-user. If your app is installed for multiple users via an MSI or elevated installer your app will need to re-register launch points for every user. Consider using {this sample technique} to ensure registrations only happen once per user."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

{
// Get the AppLifecycle sub-object for activation registration.
ActivationRegistrationManager registrationManager =
AppLifecycle::GetActivationRegistrationManager();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can imagine that at some point we might want a "get manager for sub application". Doing that is usually a breaking change unless it's already an instance, but in the spirit of Project Reunion, feel free to avoid complexity and make these static methods.

auto toastArgs = args.as<ToastNotificationActivatedEventArgs>();
DoSomethingWithToastArgs(toastArgs.Argument());
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe put a comment down here like "The app was launched for other reasons, or was not launched for one of our known types, so let the regular app launch behavior handle it."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The app can only be launched for the activation kinds it registers for (launch activation covers the case where it doesn't register for anything).


// Unregister one or more registered filetypes.
registrationManager.UnregisterForFileTypeActivation(
new string[]{ ".jpg", ".png", ".bmp" });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C++ style would be to say { L".jpg", ...} - new string[] is a C#-ism :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pasting from my mocked C++ app, which builds ok...

@andreww-msft andreww-msft requested a review from timkur November 11, 2020 20:37
- Calling a method to register activation.
- Calling a method in their entrypoint to handle activation.

From a Win32 app perspective, the 2 activation kinds that do not require any registration (Shortcut/Tile Launch and CommandLine) are effectively the same in terms of activation payload. Indeed, it is not possible to distinguish a launch activation of a Win32 app from a commandline activation. Therefore, the AppLifecycle implementation will merge Launch and CommandLine into one (Launch) activation kind.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the shortcut file that launches the app can be retrieved and can be used to provide context for the launch. for example the console uses the shortcut to store configuration data, colors, window size, etc. given the property set stored in the shortcut this can be a general purpose configuration store.

consider providing access to the shortcut that launched the app, or its property store.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an API for this already, or something we'd add as part of this effort? A little naive bing-ing doesn't lead me anywhere useful.

// Register one or more supported image filetypes, an icon,
// and zero or more verbs for the File Explorer context menu.
ActivationRegistrationManager::RegisterForFileTypeActivation(
new string[]{ ".jpg", ".png", ".bmp" },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like C#.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but it's legal C++, right?

@andreww-msft andreww-msft merged commit 52f97ef into user/andreww-msft Jan 29, 2021
@andreww-msft andreww-msft deleted the andreww-msft-patch-2 branch January 29, 2021 21:17
andreww-msft added a commit that referenced this pull request Mar 24, 2021
* Create .gitkeep

* Create .gitkeep

* Create .gitkeep

* Create .gitkeep

* Added AppLifecycle State/Power Notifications API spec. (#278)

* Add files via upload

Added AppLifecycle State/Power Notifications API spec.

* Update AppLifecycle StateNotifications.md

* Update AppLifecycle StateNotifications.md

* Added AppLifecycle Activation API spec. (#279)

* Add files via upload

* Update AppLifecycle Activation.md

* Update AppLifecycle Activation.md

* Update AppLifecycle Activation.md (#401)

* Update AppLifecycle Activation.md

* Added AppLifecycle Single/Multi-instancing API spec. (#280)

* Add files via upload

* Update AppLifecycle SingleMulti-Instancing.md

* Update AppLifecycle SingleMulti-Instancing.md

Removed toast sample snippet.

* Update AppLifecycle Activation.md (#434)

* Update AppLifecycle Activation.md

Added the exePath parameter to Register/Unregister methods.

* Update AppLifecycle Activation.md

Fixed the array declarations.

* Update AppLifecycle Activation.md

Changed RegisterForStartupActivation isEnabled to isDisabled.

* Update AppLifecycle Activation.md

Updated Startup registration to remove displayName, and add taskId to unregister.

* Update AppLifecycle Activation.md

Fixed array declarations again.

* Update AppLifecycle Activation.md

Removed isEnabled from StartupTask registration, as it makes no sense.

* Update AppLifecycle Activation.md

Fixed typo.

* Update AppLifecycle Activation.md

Dropped all the function overloads, added DisplayName to File & Protocol, added Logo to Protocol.

* Update AppLifecycle SingleMulti-Instancing.md

Removed toast sample snippet.

* Update AppLifecycle Activation.md

Renamed to AppInstance, and updated ExtendedActivationKind.

* Update AppLifecycle SingleMulti-Instancing.md

Renamed AppLifecycle to AppInstance, updated instancing APIs.

* Update AppLifecycle Activation.md

* Update AppLifecycle Activation.md

Made GetActivatedEventArgs an instance method instead of static.

* Update AppLifecycle SingleMulti-Instancing.md

Made GetActivatedEventArgs an instance method not static.

* Update AppLifecycle Activation.md

Added ProcessId.

* Update AppLifecycle SingleMulti-Instancing.md

Added ProcessId.

* Update AppLifecycle Activation.md

Added ProcessId example.

* Tidy up app activation

* Tidy up instancing

* Tidy up power state

* Update AppLifecycle Activation.md

Resolved a number of review comments.

* Update AppLifecycle SingleMulti-Instancing.md

Fixed most review comments.

* Update AppLifecycle SingleMulti-Instancing.md

Additional review fixes.

* Update AppLifecycle Activation.md

* Update AppLifecycle Activation.md

* Update AppLifecycle SingleMulti-Instancing.md

* Update AppLifecycle StateNotifications.md

Updated per review comments.

Co-authored-by: Jon Wiswall <jonwis@microsoft.com>
wjk pushed a commit to SunburstApps/ProjectReunion that referenced this pull request Apr 12, 2021
* Create .gitkeep

* Create .gitkeep

* Create .gitkeep

* Create .gitkeep

* Added AppLifecycle State/Power Notifications API spec. (microsoft#278)

* Add files via upload

Added AppLifecycle State/Power Notifications API spec.

* Update AppLifecycle StateNotifications.md

* Update AppLifecycle StateNotifications.md

* Added AppLifecycle Activation API spec. (microsoft#279)

* Add files via upload

* Update AppLifecycle Activation.md

* Update AppLifecycle Activation.md

* Update AppLifecycle Activation.md (microsoft#401)

* Update AppLifecycle Activation.md

* Added AppLifecycle Single/Multi-instancing API spec. (microsoft#280)

* Add files via upload

* Update AppLifecycle SingleMulti-Instancing.md

* Update AppLifecycle SingleMulti-Instancing.md

Removed toast sample snippet.

* Update AppLifecycle Activation.md (microsoft#434)

* Update AppLifecycle Activation.md

Added the exePath parameter to Register/Unregister methods.

* Update AppLifecycle Activation.md

Fixed the array declarations.

* Update AppLifecycle Activation.md

Changed RegisterForStartupActivation isEnabled to isDisabled.

* Update AppLifecycle Activation.md

Updated Startup registration to remove displayName, and add taskId to unregister.

* Update AppLifecycle Activation.md

Fixed array declarations again.

* Update AppLifecycle Activation.md

Removed isEnabled from StartupTask registration, as it makes no sense.

* Update AppLifecycle Activation.md

Fixed typo.

* Update AppLifecycle Activation.md

Dropped all the function overloads, added DisplayName to File & Protocol, added Logo to Protocol.

* Update AppLifecycle SingleMulti-Instancing.md

Removed toast sample snippet.

* Update AppLifecycle Activation.md

Renamed to AppInstance, and updated ExtendedActivationKind.

* Update AppLifecycle SingleMulti-Instancing.md

Renamed AppLifecycle to AppInstance, updated instancing APIs.

* Update AppLifecycle Activation.md

* Update AppLifecycle Activation.md

Made GetActivatedEventArgs an instance method instead of static.

* Update AppLifecycle SingleMulti-Instancing.md

Made GetActivatedEventArgs an instance method not static.

* Update AppLifecycle Activation.md

Added ProcessId.

* Update AppLifecycle SingleMulti-Instancing.md

Added ProcessId.

* Update AppLifecycle Activation.md

Added ProcessId example.

* Tidy up app activation

* Tidy up instancing

* Tidy up power state

* Update AppLifecycle Activation.md

Resolved a number of review comments.

* Update AppLifecycle SingleMulti-Instancing.md

Fixed most review comments.

* Update AppLifecycle SingleMulti-Instancing.md

Additional review fixes.

* Update AppLifecycle Activation.md

* Update AppLifecycle Activation.md

* Update AppLifecycle SingleMulti-Instancing.md

* Update AppLifecycle StateNotifications.md

Updated per review comments.

Co-authored-by: Jon Wiswall <jonwis@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants