microsoft / appcenter-sdk-android

Development repository for the App Center SDK for Android
Other
277 stars 134 forks source link

[Distribute] Consider opt-in for "Draw over apps" permission #1624

Closed fabiendem closed 2 years ago

fabiendem commented 2 years ago

Is your feature request related to a problem? Please describe.

When installing an update for the first time, the user is prompted for the "Draw over apps" permission:

As far as I know, this so that the app can restart automatically after the app installation: https://developer.android.com/guide/components/activities/background-starts

Snippets of code in the AppCenter library:

This is a bit overwhelming for the users since we're adding yet another permission.

Describe the solution you'd like

Is this permission really needed given the exceptions at: https://developer.android.com/guide/components/activities/background-starts#exceptions ?

  • The app has an activity that was started very recently.
  • The app called [finish()](https://developer.android.com/reference/android/app/Activity#finish()) on an activity very recently. This applies only when the app had either an activity in the foreground or an activity in the back stack of the foreground task at the time finish() was called.
  • The app receives a PendingIntent that is sent from a different, visible app.

You seem to send an intent to the app, so maybe this is enough? https://github.com/microsoft/appcenter-sdk-android/blob/929f9ca66c624d5082c0da0f85ff8a0b0bbd8b64/sdk/appcenter-distribute/src/main/java/com/microsoft/appcenter/distribute/InstallerUtils.java#L186-L205

If it's really needed, would it be possible for the library to provide an opt-out via the API so we can decide or not if the permission is requested (and at the same time the auto restart)?

Describe alternatives you've considered

See above

Additional context Add any other context or screenshots about the feature request here.

DmitriyKirakosyan commented 2 years ago

Hi @fabiendem , thank you for reporting this issue! I created a work item on our board. We will inform you on the progress.

MatkovIvan commented 2 years ago

You seem to send an intent to the app, so maybe this is enough?

It's not that part of code, but anyway - starting the app doesn't work without this permission.

would it be possible for the library to provide an opt-out

Currently it's already optional - we'll try to install even if the customer just cancel this dialog.

This is a bit overwhelming for the users since we're adding yet another permission.

I totally agree. We decided to remove it in future versions and post notification instead of opening the app.

fabiendem commented 2 years ago

Thanks @MatkovIvan!

It's not that part of code, but anyway

πŸ™ƒ I got lost in trying.

Currently it's already optional - we'll try to install even if the customer just cancel this dialog.

Yes I noticed that.

I totally agree. We decided to remove it in future versions and post notification instead of opening the app.

Awesome thank you πŸš€

fabiendem commented 2 years ago

One note though, Android 13 will introduce...... "Notification permission": https://developer.android.com/about/versions/13/changes/notification-permission

DmitriyKirakosyan commented 2 years ago

The fix has been released! I'm closing the issue, but feel free to reopen if you face it again.