Service dies on Android 4.3
Posted: Sat Jul 20, 2013 8:44 am
The service dies on android 4.3 when the device screen is off. This happens both on the lock screen when pressing next, and when the next track is invoked with the screen off. It appears that graphical resources are being recycled on screen off in the latest Android OS. Perhaps we need to register as a broadcast listener for screen on/off events?
- Code: Select all
E/AndroidRuntime( 5307): FATAL EXCEPTION: Thread-298
E/AndroidRuntime( 5307): java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@42127e60
E/AndroidRuntime( 5307): at android.graphics.Canvas.throwIfRecycled(Canvas.java:1058)
E/AndroidRuntime( 5307): at android.graphics.Canvas.drawBitmap(Canvas.java:1128)
E/AndroidRuntime( 5307): at android.media.RemoteControlClient.scaleBitmapIfTooBig(RemoteControlClient.java:1571)
E/AndroidRuntime( 5307): at android.media.RemoteControlClient.sendArtworkToDisplay(RemoteControlClient.java:1340)
E/AndroidRuntime( 5307): at android.media.RemoteControlClient.sendArtwork_syncCacheLock(RemoteControlClient.java:1325)
E/AndroidRuntime( 5307): at android.media.RemoteControlClient.access$800(RemoteControlClient.java:65)
E/AndroidRuntime( 5307): at android.media.RemoteControlClient$MetadataEditor.apply(RemoteControlClient.java:568)
E/AndroidRuntime( 5307): at github.daneren2005.dsub.util.ImageLoader.setImage(ImageLoader.java:190)
E/AndroidRuntime( 5307): at github.daneren2005.dsub.util.ImageLoader.loadImage(ImageLoader.java:135)
E/AndroidRuntime( 5307): at github.daneren2005.dsub.util.compat.RemoteControlClientICS.updateMetadata(RemoteControlClientICS.java:75)
E/AndroidRuntime( 5307): at github.daneren2005.dsub.service.DownloadServiceImpl.setCurrentPlaying(DownloadServiceImpl.java:547)
E/AndroidRuntime( 5307): at github.daneren2005.dsub.service.DownloadServiceImpl.playNext(DownloadServiceImpl.java:688)
E/AndroidRuntime( 5307): at github.daneren2005.dsub.service.DownloadServiceImpl.playNext(DownloadServiceImpl.java:672)
E/AndroidRuntime( 5307): at github.daneren2005.dsub.service.DownloadServiceImpl.access$1400(DownloadServiceImpl.java:71)
E/AndroidRuntime( 5307): at github.daneren2005.dsub.service.DownloadServiceImpl$7.onCompletion(DownloadServiceImpl.java:1192)
E/AndroidRuntime( 5307): at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:2306)
E/AndroidRuntime( 5307): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 5307): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 5307): at github.daneren2005.dsub.service.DownloadServiceImpl$1.run(DownloadServiceImpl.java:168)
E/AndroidRuntime( 5307): at java.lang.Thread.run(Thread.java:841)