flutter-permission-handler icon indicating copy to clipboard operation
flutter-permission-handler copied to clipboard

Cannot dismiss permission dialog on Android R (10)

Open 1encore opened this issue 2 years ago • 1 comments

🐛 Bug Report

Expected behavior

It should be possible to dismiss the permission dialog with back button or by clicking outside of the dialog

Reproduction steps

  1. launch any app with permission_handler
  2. request any permission which shows a dialog (allow/deny)
  3. press back button or outside of the dialog

Configuration

flutter 2.5.3 dart 2.14

Version: 9.0.2

Platform:

  • [ ] :iphone: iOS
  • [x ] :robot: Android 10

1encore avatar Feb 17 '22 13:02 1encore

this is android behavior not related to this plugin

DJafari avatar Feb 25 '22 10:02 DJafari

Hi @1encore, thank you for opening this issue!

As @DJafari mentions, this behavior is not related to the plugin, as we hand over the control flow to the OS the moment we request the permission. I.e. the plugin is not the one showing the dialog, Android is.

Nonetheless, I just tested this behavior with the newest version (10.4.1) of the permission_handler example application on an Android emulator running API 33 (Android 13). Behavior there is as expected. Dialogs can be closed by pressing the back button, or by tapping outside of the dialog.

It might be that certain versions of Android behave differently, showcasing the behavior you mentioned. In that case, it is an OS issue and not related to the plugin. I am therefore closing this issue.

JeroenWeener avatar Jul 03 '23 13:07 JeroenWeener

@JeroenWeener, the problem here might be that when the permission dialog is dismissed a result is never returned to Dart, causing the original Dart call (for example Permissions.photos.request()) to hang forever.

Requesting the (any) permission afterwards will result into an exception with the message:

A request for permissions is already running, please wait for it to finish before doing another request (note that you can request multiple permissions at the same time).

Would be good to verify this though, however if this is the case we could look into this and see if there is an option to catch the back button press and cancel permission requests that are in progress.

mvanbeusekom avatar Jul 03 '23 14:07 mvanbeusekom

Thanks for chiming in @mvanbeusekom. Reopening this issue so we can investigate.

JeroenWeener avatar Jul 03 '23 14:07 JeroenWeener

This should no longer be an issue. Dialogs that are dismissed also return a result. We made sure the returned results are correct in PR #1125 and #1130.

JeroenWeener avatar Sep 19 '23 15:09 JeroenWeener