mapbox / mapbox-maps-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
https://www.mapbox.com/mobile-maps-sdk
Other
466 stars 131 forks source link

Map flickering during zooming #2390

Open dryaz opened 4 months ago

dryaz commented 4 months ago

Environment

Observed behavior and steps to reproduce

Zoom in-out, map has black artifacts while zooming.

https://github.com/mapbox/mapbox-maps-android/assets/1395176/54469e38-d8d8-40c6-a54d-f454aadda62b

Expected behavior

Map has no artifacts during zooming

Notes / preliminary analysis

dryaz commented 3 months ago

Observation: it's not a SW issues probably but smth with HW rendering (maybe buffers for drawing on screen).

https://github.com/mapbox/mapbox-maps-android/assets/1395176/dab6e0dc-546f-400f-8f6c-c6968e32faf9

kiryldz commented 3 months ago

Observation: it's not a SW issues probably but smth with HW rendering (maybe buffers for drawing on screen).

EABF51FD-2C64-4DFD-8E03-A8032F4E9702.MP4

@dryaz thanks for reporting! In the last video it seems that the issue is quite easily reproducible when you bring the map to back / front, can you share the code that reproduces the issue?

dryaz commented 3 months ago

Observation: it's not a SW issues probably but smth with HW rendering (maybe buffers for drawing on screen). EABF51FD-2C64-4DFD-8E03-A8032F4E9702.MP4

@dryaz thanks for reporting! In the last video it seems that the issue is quite easily reproducible when you bring the map to back / front, can you share the code that reproduces the issue?

I've also noticed that when you press home on this screen and apps moved to recent gallery UI zoomed out smoothly but map keeps the same, seems like it keep drawing on full surface. Mapbox compose sample works fine on this device. Also our app works fine on other devices (including other samsungs).

You also could notice that you're trying to capture the screen - there is no such black bars/areas but recent apps still has the issue.

CleanShot 2024-06-04 at 09 49 24@2x

I've integrated mapbox in already existing app to replace google maps, so whole code is a bit 'complex' but here how it looks like:

CleanShot 2024-06-04 at 09 55 30@2x

Nothing fancy about implementation itself:

    MapboxMap(
        modifier = Modifier.fillMaxSize(),
        style = { MapStyle(style = MAP_STYLE) },
        mapViewportState = mapViewportState,
        compass = {},
        scaleBar = {},
        logo = {
            Logo(
                contentPadding = PaddingValues(
                    bottom = 16.dp,
                    start = 4.dp,
                    end = 4.dp,
                    top = 4.dp
                )
            )
        },
        attribution = {
            Attribution(
                contentPadding = PaddingValues(
                    bottom = 16.dp,
                    start = 92.dp,
                    top = 4.dp,
                    end = 4.dp
                )
            )
        }
    ) { /* Some map effects to setup map */ }
dryaz commented 3 months ago

And about that case of going to recent (which I believe should be a case). On the very first run of the app apps goes well to recents BUT next press on recent will have the issue.

Seems like smth about pause/resume of the map rendering engine on this very device.

CleanShot 2024-06-04 at 10 04 47

kiryldz commented 3 months ago

@dryaz last comments seem to be related to completely another issue, right? Initially we were talking about artifacts when zooming out that I thought might've been connected with bunch of view annotations. However taking into account last comments + the fact you're able to reproduce this only on one device - I can't say I am sure what direction we should move now from here.

dryaz commented 3 months ago

@dryaz last comments seem to be related to completely another issue, right? Initially we were talking about artifacts when zooming out that I thought might've been connected with bunch of view annotations. However taking into account last comments + the fact you're able to reproduce this only on one device - I can't say I am sure what direction we should move now from here.

First I've faced this bug after zooming in/out with annotations but then during trying to find consistant repro steps I've encoutered this flow as well. Maybe the same but maybe different, don't know yet, keeping try to find it out locally as well.

dryaz commented 2 months ago

@kiryldz I've found out that on my side that issue with going to recent was happening when we've updated libs androidxComposeMaterial = "1.7.0-beta01" androidxComposeMaterial3 = "1.3.0-beta01"

I've reverted back to androidxComposeBom = "2024.06.00" (according to https://developer.android.com/develop/ui/compose/bom/bom-mapping it contains 1.6.8 for compose libs). androidxComposeMaterial3 = "1.3.0-alpha05" (we started to use 1.3.0 for an internal reason)

For that setup recent issue is gone and yet can't reproduce that black thing.

As I side note - I've came across that dependency solution while was trying to fix our other issue:

          Fatal Exception: java.lang.IllegalStateException: Recording currently in progress - missing #endRecording() call?
       at android.graphics.RenderNode.beginRecording(RenderNode.java:483)
       at android.graphics.RenderNode.beginRecording(RenderNode.java:502)
       at androidx.compose.ui.graphics.layer.GraphicsLayerV29.r(GraphicsLayerV29.java:5)
       at androidx.compose.ui.graphics.layer.GraphicsLayer.recordInternal(GraphicsLayer.java:52)
       at androidx.compose.ui.graphics.layer.GraphicsLayer.record-mL-hObY(GraphicsLayer.java:133)
       at androidx.compose.ui.platform.GraphicsLayerOwnerLayer.updateDisplayList(GraphicsLayerOwnerLayer.java:133)
       at androidx.compose.ui.platform.AndroidComposeView.dispatchDraw(AndroidComposeView.java:68)
       at android.view.View.draw(View.java:24629)
       at android.view.View.updateDisplayListIfDirty(View.java:23492)
       at android.view.View.draw(View.java:24356)
       at android.view.ViewGroup.drawChild(ViewGroup.java:4576)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4337)
       at android.view.View.updateDisplayListIfDirty(View.java:23483)

According to stack it seems to be also related to some screenshoting/recording which also could be a 'recent' issue.

divkovi12 commented 1 month ago

I have the similar issue, the map flickers every time some android compose widget (e.g. Button) is displayed above the map, so it can be reproduced by showing/hiding the widget above the map. I would say the reported issue is the same, the bottom sheet over the map is causing it.