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

Crash when fast taps from notification Android 11 #850

Closed
nt4f04uNd opened this issue Oct 13, 2021 · 3 comments · Fixed by #851
Closed

Crash when fast taps from notification Android 11 #850

nt4f04uNd opened this issue Oct 13, 2021 · 3 comments · Fixed by #851
Assignees
Labels
1 backlog bug Something isn't working

Comments

@nt4f04uNd
Copy link
Contributor

nt4f04uNd commented Oct 13, 2021

Which API doesn't behave as documented, and how does it misbehave?
Fast taps on notification play next/prev will crash

Minimal reproduction project
The one from #834

To Reproduce (i.e. user steps, not code)
Steps to reproduce the behavior:

  1. Start playback
  2. Fast tap play next/prev in the notification

Error messages

D/MediaBrowserCompat( 1134): Connecting to a MediaBrowserService.
D/MediaBrowserCompat( 1134): Connecting to a MediaBrowserService.
D/MediaBrowserCompat( 1134): Connecting to a MediaBrowserService.
E/flutter ( 1134): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Connection aborted
E/flutter ( 1134): #0      AudioPlayer._load
package:just_audio/just_audio.dart:719
E/flutter ( 1134): <asynchronous suspension>
E/flutter ( 1134): #1      AudioPlayer.load
package:just_audio/just_audio.dart:651
E/flutter ( 1134): <asynchronous suspension>
E/flutter ( 1134): #2      AudioPlayer.setAudioSource
package:just_audio/just_audio.dart:628
E/flutter ( 1134): <asynchronous suspension>
E/flutter ( 1134):
E/flutter ( 1134): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(abort, Connection aborted, null, null)
E/flutter ( 1134):
D/MediaBrowserCompat( 1134): Connecting to a MediaBrowserService.
I/OMXClient( 1134): IOmx service obtained
I/ACodec  ( 1134): codec does not support config priority (err -2147483648)
D/AndroidRuntime( 1134): Shutting down VM
E/AndroidRuntime( 1134): FATAL EXCEPTION: main
E/AndroidRuntime( 1134): Process: com.example.audio_service_834, PID: 1134
E/AndroidRuntime( 1134): android.app.RemoteServiceException: Bad notification(tag=null, id=1124) posted from package com.example.audio_service_834, crashing app(uid=10160, pid=1134): Couldn't inflate contentViewsjava.lang.IndexOutOfBoundsException: Index: 3, Size: 3
E/AndroidRuntime( 1134): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2005)
E/AndroidRuntime( 1134): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 1134): 	at android.os.Looper.loop(Looper.java:223)
E/AndroidRuntime( 1134): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
E/AndroidRuntime( 1134): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 1134): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/AndroidRuntime( 1134): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I/Process ( 1134): Sending signal. PID: 1134 SIG: 9
Lost connection to device.

Expected behavior
No crash

Screenshots
n/a

Runtime Environment (please complete the following information if relevant):

  • Device: emulator
  • OS: Android 11

Flutter SDK version

[√] Flutter (Channel master, 2.6.0-12.0.pre.273, on Microsoft Windows [Version
    10.0.19041.1237], locale ru-RU)
    • Flutter version 2.6.0-12.0.pre.273 at C:\dev\src\flutter
    • Upstream repository [email protected]:nt4f04und/flutter.git
    • FLUTTER_GIT_URL = [email protected]:nt4f04und/flutter.git
    • Framework revision 1d102be762 (8 hours ago), 2021-10-08 23:23:04 +0530  
    • Engine revision a2773d5ec3
    • Dart version 2.15.0 (build 2.15.0-178.0.dev)

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at C:\Users\danya\AppData\Local\Android\sdk
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.   
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.       
      See https://flutter.dev/docs/get-started/install/windows#android-setup for
      more details.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.7)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual
      Studio\2019\Community
    • Visual Studio Community 2019 version 16.7.30621.155
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 4.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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 1.8.0_242-release-1644-b01)

[√] IntelliJ IDEA Community Edition (version 2020.3)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition
      2020.3.3
    • 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

[√] VS Code (version 1.61.0)
    • VS Code at C:\Users\danya\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.27.0

[√] Connected device (4 available)
    • sdk gphone x86 (mobile) • emulator-5554 • android-x86    • Android 11 (API
      30) (emulator)
    • Windows (desktop)       • windows       • windows-x64    • Microsoft Windows      [Version 10.0.19041.1237]
    • Chrome (web)            • chrome        • web-javascript • Google Chrome
      94.0.4606.71
    • Edge (web)              • edge          • web-javascript • Microsoft Edge
      94.0.992.38

! Doctor found issues in 1 category.

Additional context
No

@nt4f04uNd
Copy link
Contributor Author

nt4f04uNd commented Oct 13, 2021

Also, the crash won't happen if you tap next/prev from the app UI, only notification.

Removing the updateNotfication from spawned thread fixes the crash. This appears to be an Android bug, it should be completely fine to update notification from non-UI thread.

Submitted a PR to fix this.

@nt4f04uNd
Copy link
Contributor Author

(Tried making a minimal repro to report this to Android, but had no luck)

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with audio_service.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 backlog bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants