ev-map/EVMap

Crash when viewing chargers with pictures

Closed this issue · 8 comments

Hey,

The app is crashing when viewing some chargers from Open Charge Map. It doesn't happen right away or even always, but when it happens it seems to be on entries with pictures. I'm not completely sure, but it seems to crash after the app downloads the high resolution files? (I could be wrong.)

Initially I thought it was caused by the custom ROM I use (LineageOS 20/Android 13), but it also happens on a friend's phone, which runs 100% stock software (OnePlus' OxygenOS/Android 13).

The crash happens on both the F-Droid and the Play Store's versions of the app. I couldn't make it crash when using GoingElectric.de as source, but to be honest, they're missing most chargers around here and I never used it as much as OCM. The two chargers I clicked on the screen recording below are:

Video:

crash.mp4

Hi, thanks for the bug report! Did you already send the crash report via email as suggested by the app?

I've clicked "ok" on that prompt at the end of the video and the app then closes. It doesn't mention any email/opens my email app though, so I was under the impression that the app was sending the report behind the scenes.

If this isn't the case, what do you need? Is the report saved in a folder somewhere or do you want a full system log?

Ah, strange... the OK button should usually allow you to choose an email app to send the report.

But based on your info I could reproduce the issue now, the log is the following:

java.lang.RuntimeException: Canvas: trying to draw too large(108000000bytes) bitmap.
        at android.graphics.RecordingCanvas.throwIfCannotDraw(RecordingCanvas.java:266)
        at android.graphics.BaseRecordingCanvas.drawBitmap(BaseRecordingCanvas.java:94)
        at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:549)
        at android.widget.ImageView.onDraw(ImageView.java:1446)
        at android.view.View.draw(View.java:23194)

so indeed it's about the pictures being too large. I'll see what I can do about that.
Unfortunately OCM only supports 3 different sizes - thumbnail (100 pixels wide), medium (400 pixels wide) and original size (which is apparently not limited by the server at all...).

Should be fixed with f8d5b78 - I think this SizeResolver(OriginalSize) was neeeded earlier to make animations work correctly, but is now apparently unnecessary. If I remove it, the image is scaled down according to the ImageView size before being displayed, so it doesn't crash even if the original image is very large.

Thanks Johan. I'll test when the next update is released and report back if I find any issues.

The update to 1.4.9 is now uploaded - it should be available within a couple of days on both Google Play (after Google's review) and F-Droid (when their build server picks it up during the next sync).

I've tested with the apks from this release and it seems to be working well. No crashes.

Thanks again for fixing this and for your work on the app.

Great, thank you for testing! 👏🏻