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

[UWP App Model] Proposal: Improve register-app-for-start-at-log-in Experience #46

Closed
Felix-Dev opened this issue May 2, 2020 · 12 comments
Assignees

Comments

@Felix-Dev
Copy link

Proposal: Improve register-app-for-start-at-log-in Experience (UWP App Model)

Summary

Using the StartupTask API app developers can register their app to automatically start at log-in. The API is available for both UWP apps and DesktopBridge apps (MSIX-packaged Win32 apps). Depending on the "app model" this API has a different User Experience and I want to highlight one major difference in this proposal.

The linked documentation above states the following:

UWP apps must call RequestEnableAsync from a UI thread to trigger a user-consent dialog. If the user consents, the UWP app will then start on startup or user log in. Note that UWP startup apps will start minimized.

If RequestEnableAsync is called from a packaged desktop app, no user-consent dialog is shown.

It is this user-consent dialog which is at the heart of this proposal.

If the user has granted an UWP app start at log-in permission in the Windows Settings app, every subsequent API pair call of StartupTask.Disable() and permission-granting StartupTask.RequestEnableAsync() will trigger this user-consent dialog (*1). You can observe this behavior in the following GIF below. In this GIF the app initially has its start at log-in permission granted in the Settings app.

uwp-startup-sandbox-demo

(*1) (If the user has denied the app this permission in the Settings app or denies the request using the user-consent dialog, the next call to StartupTask.RequestEnableAsync() will fail and show no such dialog.)

Now observe how the API behaves when calling it from a DesktopBridge app given the documentation above. Again, the app already was granted start at log-in behavior by the user in the Settings app (or the Task Manager):

desktopbridge-startup-sandbox-demo

As stated in the documentation, as long the app start at log-in has been disabled with a StartupTask.Disable() call, a subsequent call to StartupTask.RequestEnableAsync() will enable app start at log-in without asking for user consent again.

This does not feature the, what I consider, bad UX of UWP apps where a user is asked twice if they really want to enable automatic app start. (First ask is the user clicking the ToggleSwitch button, second ask is the user-consent dialog prompt.) The UX here should be fast and straight-forward and should not require by default to have the user confirm their choice whenever they want to enable start-at-log-in for the app in question.

Proposal: UWP apps should feature the same straight-forward register-app-for-start-at-log-in experience as DesktopBridge apps come with as shown in the GIF above.

It is important to note that this proposal will not result in the user losing control over their apps! As long as the user denies the app start at log-in permission in the Settings app, a call to StartupTask.RequestEnableAsync() will not succeed:

desktopbridge-startup-sandbox-demo-control

As this GIF shows, if the user denied the app permission in Windows Settings at the time of the request, the app cannot programmatically set itself as a startup app.

For each UWP app, the system default is that the user has not granted the app permission to start at log-in. As such, even without the user actively denying the app permission, the app's very first call to StartupTask.RequestEnableAsync() since installation will also fail. It will, of course, require the user to first actively grant the app this permission in the Settings app.

No malicious app can use the absence of the user-consent dialog as outlined in this proposal to just do as it pleases. The user still rules!

Scope

Capability Priority
This proposal will allow apps to set themselves as start-at-log-in apps without showing a user-consent dialog when the user has not denied the app this permission in the Settings app (*2) after actively granting the app this permission in the Settings app before. Must
This proposal will allow apps to just set themselves as start-at-log-in apps as they please. Won't

(*2) Or denied the request using the user-consent dialog prompt.

Additional Context

@BenJKuhn Feedback Hub entry here.

Attached Files

I created a sample project showcasing the current behavior for both UWP and DesktopBridge apps. Please check that out if you still have questions regarding the different behavior:
StartupSandboxDemo.zip

@michael-hawker
Copy link

If the user has denied the app this permission in the Settings app or denies the request using the user-consent dialog, the next call to StartupTask.RequestEnableAsync() will fail and show no such dialog.

Does this mean that if the app is disabled in settings, the app has no way to re-enable itself and has to get the user to go back to the settings dialog?

@Felix-Dev
Copy link
Author

@michael-hawker Yes. Just as with UWP/DesktopBridge apps today, the moment the permission is disabled in Settings by the user themself the app can no longer programmatically give itself that permission. The user will first have to allow the app to start at log-in via the Settings app again.

@Felix-Dev
Copy link
Author

@jesbis Should I move this issue to Project Reunion?

@jesbis
Copy link
Member

jesbis commented May 22, 2020

I think that makes sense - if no objections I can just directly move this issue to that repo?

@Felix-Dev
Copy link
Author

@jesbis No objections from me 🙂

@jesbis jesbis transferred this issue from microsoft/microsoft-ui-xaml May 22, 2020
@stevewri stevewri assigned stevewri and jonwis and unassigned stevewri May 22, 2020
@stevewri
Copy link
Contributor

Related to @jonwis #10 Common Startup Task Support

@Felix-Dev
Copy link
Author

Felix-Dev commented May 22, 2020

@stevewri In regards to issue #10 I'm not seeing anywhere in that issue a proposal to relax the user-consent dialog prompt behavior for UWP apps. I assume that's why you have - in my view correctly - reopened this issue.

@jonwis
Copy link
Member

jonwis commented May 22, 2020

One for @andreww-msft ... @Felix-Dev , I think you're saying that "if the app itself disables its task, then calls enable, do not show a prompt at all." So we'd only only ever show the prompt once on first request, then either (a) the app has disable/re-enabled it so no prompt (b) the user has toggled back on the task in startup so there's no prompt. That correct?

Correct, #10 is about providing a similar API for Win32 apps that want startup task behavior without having to write it themselves.

@Felix-Dev
Copy link
Author

Felix-Dev commented May 22, 2020

@jonwis Yes, that is correct. Essentially, what I'm proposing here is to bring over the current DesktopBridge Startup Task API behavior to UWP apps minus the ability of DesktopBridge apps to set their initial startup behavior to "enabled" in their manifest. (If the user disabled startup for the app in Windows Settings, all bets are off for the app and the user will have to enable startup for this app in Windows Settings again.)

@andreww-msft
Copy link
Contributor

Let me see if I understand:

  1. User enables the Startup task for the app (either because the app called StartupTask.RequestEnableAsync, and the user said Enable – or because the user went to Settings and enabled it there).
  2. App later calls StartupTask.Disable to disable itself.
    a. Note this will also disable it in Settings.
  3. Later still, app calls StartupTask.RequestEnableAsync.
    a. At this point we pop a prompt dialog again.
    b. The ask is that we don't prompt at this point, since the user previously enabled it, right?

If the foregoing is accurate, the problem is that calling Disable also changes the setting. That means there's a chance that in the meantime the user could've gone to Settings to disable it and found it already disabled, and they rely on the fact that if the app tried to enable it later they'd get a prompt. Given this, I believe we should err on the side of caution, and we should not change this behavior.

@Felix-Dev
Copy link
Author

@andreww-msft Yes, you understood it correctly.

If the foregoing is accurate, the problem is that calling Disable also changes the setting. That means there's a chance that in the meantime the user could've gone to Settings to disable it and found it already disabled, and they rely on the fact that if the app tried to enable it later they'd get a prompt. Given this, I believe we should err on the side of caution, and we should not change this behavior.

Good point. I guess it's reasonable then to keep the current behavior.

@stephen147
Copy link

stephen147 commented Dec 2, 2021

DesktopBridge app

Do you still have the project file for this or on Github so I can see how this works? The Github example from MS only comes in UWP which can be found here. https://github.com/microsoft/AppModelSamples/tree/master/Samples/TestRestart/TestRestart

Apologies for not seeing the StartupSandboxDemo.zip file. Thanks for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants