Skip to content

Conversation

@jinchengwu-ola
Copy link
Contributor

@jinchengwu-ola jinchengwu-ola commented Sep 7, 2023

Reply already submitted in Android 13 while user request permissions (eg. post_notification, locations)

List at least one fixed issue.
Fatal Exception: java.lang.RuntimeException
Failure delivering result ResultInfo{who=@android:requestPermissions:, request=24, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity: java.lang.IllegalStateException: Reply already submitted

io.flutter.embedding.engine.dart.DartMessenger$Reply.reply (DartMessenger.java:435)
io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success (MethodChannel.java:263)
com.baseflow.permissionhandler.g.a (Unknown Source:2)
com.baseflow.permissionhandler.n.onRequestPermissionsResult (PermissionManager.java:173)
io.flutter.embedding.engine.FlutterEngineConnectionRegistry$FlutterEngineActivityPluginBinding.onRequestPermissionsResult (FlutterEngineConnectionRegistry.java:779)
io.flutter.embedding.engine.FlutterEngineConnectionRegistry.onRequestPermissionsResult (FlutterEngineConnectionRegistry.java:411)
io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onRequestPermissionsResult (FlutterActivityAndFragmentDelegate.java:761)
io.flutter.embedding.android.FlutterActivity.onRequestPermissionsResult (FlutterActivity.java:795)

Pre-launch Checklist

  • I made sure the project builds.
  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is does not need version changes.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I rebased onto main.
  • I added new tests to check the change I am making, or this PR does not need tests.
  • I made sure all existing and new tests are passing.
  • I ran dart format . and committed any changes.
  • I ran flutter analyze and fixed any errors.

@JeroenWeener
Copy link
Contributor

Hi @jinchengwu-ola, thank you for contributing to the flutter-permission-handler plugin!

It is not clear to me which bug your changes are supposed to fix. Could you link us to the issue number?
We recently merged #1139, which might solve the issue you are targeting. Could you confirm this?

@JeroenWeener JeroenWeener self-requested a review September 7, 2023 09:26
@JeroenWeener JeroenWeener self-assigned this Sep 7, 2023
@jinchengwu-ola
Copy link
Contributor Author

Hi @jinchengwu-ola, thank you for contributing to the flutter-permission-handler plugin!

It is not clear to me which bug your changes are supposed to fix. Could you link us to the issue number? We recently merged #1139, which might solve the issue you are targeting. Could you confirm this?

Hi @JeroenWeener , I encounter an issue requesting post_notification permission which will cause 'Reply already submitted' cashing in Android 13, Galaxy S21, xiaomi devices.

It crashes at com.baseflow.permissionhandler.n.onRequestPermissionsResult (PermissionManager.java:173).
And I found that this system recall with empty list params (param permissions is empty, param grantResults is empty, normally it shouldn't be empty, and I ignored this recall than it would not crash).

I guess it is an system pitfall that special permission requesting's result will not only be recall in onActivityResult, but also in onRequestPermissionsResult at the same time. But still need to verify to check Android 13 system source code.

Anyway It looks not exactly like merged #1139 mentioned. Crashes at which merged #1139 mentioned happen in onActivityResult(PermissionManager.java:64).

After all, I found @Shilk1266 have the similar issue with me, bellow is the link.
#1126 (comment)

Hope I make it clear, thanks~

@JeroenWeener
Copy link
Contributor

Hi @jinchengwu-ola thanks for your reply!

This is an interesting issue. We'd be interested in including your PR in the code base.

Before we do that though, we would like to unravel what is causing this issue in the first place. Our suspicion is that maybe another plugin in your project is using the same identifier for requesting permissons. To that end, could you share your pubspec.yaml file? Or if you implemented any Android code in your project that would be interesting to look into as well.

Copy link
Contributor

@JeroenWeener JeroenWeener left a comment

Choose a reason for hiding this comment

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

Could you please update the version number in pubspec.yaml and add a changelog entry in CHANGELOG.md?

…permissionhandler/PermissionManager.java

Co-authored-by: Jeroen Weener <[email protected]>
Copy link
Contributor

@JeroenWeener JeroenWeener left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution @jinchengwu-ola! We hope to see more of you in the future 😄

@JeroenWeener JeroenWeener merged commit 4026813 into Baseflow:main Sep 13, 2023
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.

2 participants