vanilla-music / vanilla

Vanilla Music Player for Android
GNU General Public License v3.0
1.19k stars 296 forks source link

(Soft?) Crash after ending a received phone call #1174

Open opusforlife2 opened 1 year ago

opusforlife2 commented 1 year ago

Description

After a phone call I received ended, Scoop caught a crash report for Vanilla. However, the app did not stop playing music. Instead, the "Vanilla has been stopped" OS dialogue showed up. Only after tapping it and closing the app did the music stop playing.

Steps to reproduce the issue

This happened only once.

  1. Played music via Vanilla.
  2. Received a phone call.
  3. The other person ended the call.
  4. The error showed up.

Crash logs

FATAL EXCEPTION: PlaybackService
Process: ch.blinkenlights.android.vanilla, PID: 6780
android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service ch.blinkenlights.android.vanilla/.PlaybackService
    at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
    at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
    at android.os.Parcel.readParcelable(Parcel.java:3334)
    at android.os.Parcel.createExceptionOrNull(Parcel.java:2421)
    at android.os.Parcel.createException(Parcel.java:2410)
    at android.os.Parcel.readException(Parcel.java:2393)
    at android.os.Parcel.readException(Parcel.java:2335)
    at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7158)
    at android.app.Service.startForeground(Service.java:736)
    at ch.blinkenlights.android.vanilla.PlaybackService.processNewState(PlaybackService.java:1033)
    at ch.blinkenlights.android.vanilla.PlaybackService.handleMessage(PlaybackService.java:1580)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.os.HandlerThread.run(HandlerThread.java:67)
lineinthesand commented 2 weeks ago

It is even easier to reproduce, just start a call yourself while the music is playing, then hang up.

lineinthesand commented 2 weeks ago

I've proposed a patch for this issue; it seems to fix the problem on my Android 12 phone and I did not note any negative side effects in behavior.