surfstudio / flutter-otp-autofill

Made by Surf πŸ„
Apache License 2.0
75 stars 42 forks source link

[BUG] Android App crashes when phone allowed two SMS at the same time. #10

Closed dalerugs closed 1 year ago

dalerugs commented 2 years ago

Describe the bug

When the android phone receives two SMS at the same time, and the user allows the two OTPs, the app crashes. Below is the error found in the logs.

E/AndroidRuntime( 4770): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2, result=-1, data=Intent { (has extras) }} to activity {com.sample.app/com.sample.app.MainActivity}: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime( 4770):    at android.app.ActivityThread.deliverResults(ActivityThread.java:5506)
E/AndroidRuntime( 4770):    at android.app.ActivityThread.handleSendResult(ActivityThread.java:5547)
E/AndroidRuntime( 4770):    at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
E/AndroidRuntime( 4770):    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime( 4770):    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime( 4770):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307)
E/AndroidRuntime( 4770):    at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 4770):    at android.os.Looper.loop(Looper.java:246)
E/AndroidRuntime( 4770):    at android.app.ActivityThread.main(ActivityThread.java:8506)
E/AndroidRuntime( 4770):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 4770):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
E/AndroidRuntime( 4770):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
E/AndroidRuntime( 4770): Caused by: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime( 4770):    at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:164)
E/AndroidRuntime( 4770):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:238)
E/AndroidRuntime( 4770):    at ru.surfstudio.otp_autofill.OTPPlugin.onActivityResult(OTPPlugin.kt:122)
E/AndroidRuntime( 4770):    at io.flutter.embedding.engine.FlutterEngineConnectionRegistry$FlutterEngineActivityPluginBinding.onActivityResult(FlutterEngineConnectionRegistry.java:741)
E/AndroidRuntime( 4770):    at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.onActivityResult(FlutterEngineConnectionRegistry.java:426)
E/AndroidRuntime( 4770):    at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult(FlutterActivityAndFragmentDelegate.java:749)
E/AndroidRuntime( 4770):    at io.flutter.embedding.android.FlutterActivity.onActivityResult(FlutterActivity.java:651)
E/AndroidRuntime( 4770):    at android.app.Activity.dispatchActivityResult(Activity.java:8541)
E/AndroidRuntime( 4770):    at android.app.ActivityThread.deliverResults(ActivityThread.java:5499)
E/AndroidRuntime( 4770):    ... 11 more
I/Process ( 4770): Sending signal. PID: 4770 SIG: 9

Steps to Reproduce

  1. Send SMS to the phone at the same time.
  2. Two user consent modals will show.
  3. Click the allow button on the two modals.

What is the expected behavior?

The app should not crash when clicking the allow button and the latest OTP must be displayed on the field.

dalerugs commented 2 years ago

Hi, any updates on this issue? Thank you.

dalerugs commented 2 years ago

Hi, any updates on this issue? Thank you.

MbIXjkee commented 2 years ago

Thx for issue, looks like bug in native part, we will check is it trouble in our part or system.

MbIXjkee commented 2 years ago

@dalerugs Can you add code example to reproduce behavior which you get? You get this on every device? We try to reproduce it, but get only one modal. Need more information.

internetova commented 2 years ago

Hello @dalerugs,

We tried to reproduce described error but we failed. However, we managed to get similar error in console while incorrect subscription initialization. We have suspicions that you could write an incorrect code and we would like to help to resolve it.

Can you please provide us with the following data:

  1. Code for error reproduction.
  2. What simulator or emulator was used with the operating system?
  3. If you used phone, what was the model of the phone and what operating system is installed of the phone where error occurred?
  4. Flutter doctor.
  5. Video record of an error.

Thank you.

wesam-salama commented 2 years ago

I/flutter (19097): signature - 0VH2py/xFgh I/Timeline(19097): Timeline: Activity_launch_request time:593250429 I/Timeline(19097): Timeline: Activity_launch_request time:593250439 V/PhoneWindow(19097): DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@6e7ac29, this = DecorView@7cefbae[MainActivity] I/flutter (19097): Your Application receive code - 1308 I/Timeline(19097): Timeline: Activity_launch_request time:593278665 D/AndroidRuntime(19097): Shutting down VM E/AndroidRuntime(19097): FATAL EXCEPTION: main E/AndroidRuntime(19097): Process: ru.surfstudio.otp_autofill, PID: 19097 E/AndroidRuntime(19097): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2, result=-1, data=Intent { (has extras) }} to activity {ru.surfstudio.otp_autofill/ru.surfstudio.otp_autofill_example.MainActivity}: java.lang.IllegalStateException: Reply already submitted E/AndroidRuntime(19097): at android.app.ActivityThread.deliverResults(ActivityThread.java:5195) E/AndroidRuntime(19097): at android.app.ActivityThread.handleSendResult(ActivityThread.java:5236) E/AndroidRuntime(19097): at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51) E/AndroidRuntime(19097): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) E/AndroidRuntime(19097): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) E/AndroidRuntime(19097): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2187) E/AndroidRuntime(19097): at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime(19097): at android.os.Looper.loop(Looper.java:236) E/AndroidRuntime(19097): at android.app.ActivityThread.main(ActivityThread.java:8057) E/AndroidRuntime(19097): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(19097): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:620) E/AndroidRuntime(19097): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011) E/AndroidRuntime(19097): Caused by: java.lang.IllegalStateException: Reply already submitted E/AndroidRuntime(19097): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:431) E/AndroidRuntime(19097): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:267) E/AndroidRuntime(19097): at ru.surfstudio.otp_autofill.OTPPlugin.onActivityResult(OTPPlugin.kt:122) E/AndroidRuntime(19097): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry$FlutterEngineActivityPluginBinding.onActivityResult(FlutterEngineConnectionRegistry.java:840) E/AndroidRuntime(19097): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.onActivityResult(FlutterEngineConnectionRegistry.java:441) E/AndroidRuntime(19097): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult(FlutterActivityAndFragmentDelegate.java:772) E/AndroidRuntime(19097): at io.flutter.embedding.android.FlutterActivity.onActivityResult(FlutterActivity.java:685) E/AndroidRuntime(19097): at android.app.Activity.dispatchActivityResult(Activity.java:8516) E/AndroidRuntime(19097): at android.app.ActivityThread.deliverResults(ActivityThread.java:5188) E/AndroidRuntime(19097): ... 11 more I/Process (19097): Sending signal. PID: 19097 SIG: 9 Lost connection to device.

[βœ“] Android toolchain - develop for Android devices (Android SDK version 31.0.0) β€’ Android SDK at /Users/wesamsalama/Library/Android/sdk β€’ Platform android-31, build-tools 31.0.0 β€’ Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java β€’ Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763) β€’ All Android licenses accepted.

[βœ“] Xcode - develop for iOS and macOS (Xcode 13.2.1) β€’ Xcode at /Applications/Xcode.app/Contents/Developer β€’ CocoaPods version 1.11.2

[βœ“] Chrome - develop for the web β€’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[βœ“] Android Studio (version 2021.1) β€’ Android Studio at /Applications/Android Studio.app/Contents β€’ Flutter plugin can be installed from: πŸ”¨ https://plugins.jetbrains.com/plugin/9212-flutter β€’ Dart plugin can be installed from: πŸ”¨ https://plugins.jetbrains.com/plugin/6351-dart β€’ Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[βœ“] VS Code (version 1.64.2) β€’ VS Code at /Applications/Visual Studio Code.app/Contents β€’ Flutter extension version 3.34.0

[βœ“] Connected device (2 available) β€’ Redmi Note 8 Pro (mobile) β€’ aaaqof8xhuqwmrdi β€’ android-arm64 β€’ Android 11 (API 30) β€’ Chrome (web) β€’ chrome β€’ web-javascript β€’ Google Chrome 98.0.4758.109

[βœ“] HTTP Host Availability β€’ All required HTTP hosts are available

β€’ No issues found!

telegram-cloud-photo-size-4-5834665866086692683-y

wesam-salama commented 2 years ago
indraseptama commented 1 year ago

any update?

BLUECALF commented 1 year ago
jale-codex commented 1 year ago

Any update? Absolutely the same situation here. Receive the code for the first time, then on the second one the app crashes

BLUECALF commented 1 year ago

If you are using retriever that needs the app signature at SMS , the only solution I got is to use other package.

BLUECALF commented 1 year ago

I used sms_autofil package and it worked even with spamming sms. App did not crash.