Skip to content

Commit e208a6e

Browse files
authored
Merge pull request #115322 from trrwilson/cofogg/fixAboveLockActivationDocs
Cofogg/fix above lock activation docs
2 parents 765c63b + 9579c85 commit e208a6e

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

articles/cognitive-services/Speech-Service/windows-voice-assistants-best-practices.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ When the assistant app has focus, the customer intent is clearly to interact wit
7474

7575
Available with 19H2, assistants built on Windows voice activation platform are available to answer above lock.
7676

77-
> [!NOTE]
78-
> Due to an active issue, assistants that draw above lock UI must implement WindowService.CloseWindow() for all dismissals. This will result in app termination, but mitigates a technical issue and keeps the assistant in a clean state. Furthermore, to maintain clean state if an app is enabled for above lock voice activation, it must listen for lock state changes and WindowService.CloseWindow() when the device locks.
79-
8077
### Customer opt-in
8178

8279
Voice activation above lock is always disabled by default. Customers opt-in through the Windows settings>Privacy>Voice Activation. For details on monitoring and prompting for this setting, see the [above lock implementation guide](windows-voice-assistants-implementation-guide.md#detecting-above-lock-activation-user-preference).

articles/cognitive-services/Speech-Service/windows-voice-assistants-implementation-guide.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,28 @@ await appView.TryEnterViewModeAsync(ApplicationViewMode.Default);
108108

109109
## Implementing above lock activation
110110

111-
The following steps cover the requirements to enable a voice assistant on Windows to run above lock, including references to example code and guidelines for managing the application lifecycle. For guidance on designing above lock experiences, visit the [best practices guide](windows-voice-assistants-best-practices.md).
111+
The following steps cover the requirements to enable a voice assistant on Windows to run above lock, including references to example code and guidelines for managing the application lifecycle.
112+
113+
For guidance on designing above lock experiences, visit the [best practices guide](windows-voice-assistants-best-practices.md).
114+
115+
When an app shows a view above lock, it is considered to be in "Kiosk Mode". For more information on implementing an app that uses Kiosk Mode, see the [kiosk mode documentation](https://docs.microsoft.com/windows-hardware/drivers/partnerapps/create-a-kiosk-app-for-assigned-access).
116+
117+
### Transitioning above lock
118+
119+
An activation above lock is similar to an activation below lock. If there are no active instances of the application, a new instance will be started in the background and `OnBackgroundActivated` in App.xaml.cs will be called. If there is an instance of the application, that instance will get a notification through the `ConversationalAgentSession.SignalDetected` event.
120+
121+
If the application is not already showing above lock, it must call `ConversationalAgentSession.RequestForegroundActivationAsync`. This triggers the `OnLaunched` method in App.xaml.cs which should navigate to the view that will be shown above lock.
112122

113123
### Detecting lock screen transitions
114124

115-
The ConversationalAgent library in the Windows SDK provides an API to make the lock screen state and changes to the lock screen state easily accessible. To detect the current lock screen state, check the `ConversationalAgentSession.IsUserAuthenticated` field. To detect changes in lock state, add an event handler to the `ConversationalAgentSession` object's `SystemStateChanged` event. It will fire whenever the screen changes from unlocked to locked or vice versa. If the value of the event arguments is `ConversationalAgentSystemStateChangeType.UserAuthentication`, then the lock screen state has changed and the application should close.
125+
The ConversationalAgent library in the Windows SDK provides an API to make the lock screen state and changes to the lock screen state easily accessible. To detect the current lock screen state, check the `ConversationalAgentSession.IsUserAuthenticated` field. To detect changes in lock state, add an event handler to the `ConversationalAgentSession` object's `SystemStateChanged` event. It will fire whenever the screen changes from unlocked to locked or vice versa. If the value of the event arguments is `ConversationalAgentSystemStateChangeType.UserAuthentication`, then the lock screen state has changed.
116126

117127
```csharp
118-
// When the app changes lock state, close the application to prevent duplicates running at once
119128
conversationalAgentSession.SystemStateChanged += (s, e) =>
120129
{
121130
if (e.SystemStateChangeType == ConversationalAgentSystemStateChangeType.UserAuthentication)
122131
{
123-
WindowService.CloseWindow();
132+
// Handle lock state change
124133
}
125134
};
126135
```
@@ -133,6 +142,9 @@ The application entry in the Voice Activation Privacy settings page has a toggle
133142

134143
To properly close the application programmatically while above or below lock, use the `WindowService.CloseWindow()` API. This triggers all UWP lifecycle methods, including OnSuspend, allowing the application to dispose of its `ConversationalAgentSession` instance before closing.
135144

145+
> [!NOTE]
146+
> The application can close without closing the [below lock instance](https://docs.microsoft.com/windows-hardware/drivers/partnerapps/create-a-kiosk-app-for-assigned-access#add-a-way-out-of-assigned-access-). In this case, the above lock view needs to "clean up", ensuring that once the screen is unlocked, there are no event handlers or tasks that will try to manipulate the above lock view.
147+
136148
## Next steps
137149

138150
> [!div class="nextstepaction"]

0 commit comments

Comments
 (0)