mapbox-maps-android
mapbox-maps-android copied to clipboard
Map freezes or becomes black some times on Android Auto
Environment
- Android OS version: 14
- Devices affected: Samsung Galaxy S21, Samsung Galaxy S22+, Samsung Galaxy Flip 3 (other users have reported this as well, I'll try to get their phone model)
- Android Auto version: 10.9.634644
- Maps SDK Version: 10.16.3 (Android Auto extensions 0.5.0)
Observed behavior and steps to reproduce
Has been hard for us to reproduce. One user reports that the map is just always black, but alertboxes, navigation manuevers, speedometer and action strip is shown and works.
In our reproduced version of the bug, the map worked for some time but then froze. Everything except the map worked and the screen reacted to touch. According to the log scrolls, zooms and flings where detected as expected, but nothing happened on the screen. Clicking into a menu and going back the map turned black.
The map on the phone worked fine throughout all of this.
Will update with video of the behaviour if I can reproduce it again or make a user send a video.
Expected behavior
Screen is not black.
Notes / preliminary analysis
I've seen this in the log coming up rapidly (~50 times a second) on a device that experienced the issue, but I'm not sure this is related: [maps-android\Mbgl-RenderThread]: renderThreadPrepared=false and Android surface is not valid (isValid=false). Waiting for new one.
The issue has only started appearing after updating to 10.16.3
Additional links and references
@maxrimmer
- What version did you upgrade from to v10.16.3?
- Can you confirm that you did not also bump Android Auto / any other related 3d party dependency?
@kiryldz
We bumped from v10.14.1 We haven't bumped any related dependencies.
I just received this example of the issue from a customer:
Running on a Samsung Galaxy S22 Ultra Android Auto version 10.9.634644-release One UI-Version 6.0 Android 14
@maxrimmer you mentioned in initial description following logs:
[maps-android\Mbgl-RenderThread]: renderThreadPrepared=false and Android surface is not valid (isValid=false). Waiting for new one.
Can you please attach more logs? The logs should cover the moment when the map turns black.
Also from https://github.com/mapbox/mapbox-maps-android/issues/2251#issuecomment-1882860133 it is not clear what actually happened: the map was black and then the map appeared with some visual artefacts? Logs will be also appreciated
@kiryldz the log I mentioned in the initial description was from when I replicated the issue. From the user I only have loglines from our own packages. So I unfortunately can't provide more logs at the moment. I will attach logs if I manage to replicate the issue again.
The first image shows the issue yesterday 8/1. This was on a drive lasting from 19:56 to 20:28 where seemingly all throughout the drive the map was black. But as can be seen in the top right corner the action strip works. But our speedometer widget and the mapbox logo widget is not shown.
Ignore the second image, I attached it by mistake, it was from a previous version that had this issue: https://github.com/mapbox/mapbox-maps-android/issues/2241 but was fixed with 10.16.3
@maxrimmer without logs it's rather impossible to say what happened. The logs
[maps-android\Mbgl-RenderThread]: renderThreadPrepared=false and Android surface is not valid (isValid=false). Waiting for new one.
Actually explain why the map is black and no widgets are drawn (as Android surface is not valid) however in normal conditions if drawing surface becomes invalid, the Android should send the new one. As this does not happen in your use-case - more logs might help us understand why the surface actually became invalid.
Hello, we have the same Problem on Android 14 Phones from Samsung with Esri Maps. After a switch to anohter Application, the Map freeze. On Google Pixel Phones with Android 14 we haven´t a problem.
@malugermany please see my comment. If you could reproduce it, can you please attach the logs covering the moment when the map turns black.
Hi @kiryldz I have managed to reproduce it. Attached are all logs with the tag Mapbox. I have also attached a screen recording of the issue.
https://github.com/mapbox/mapbox-maps-android/assets/14841486/a0f2c7da-fe23-4866-b52a-d02ffefe98b1
@maxrimmer thanks, however sadly your logs cover the moment when the map is already black, so we keep spamming
[maps-android\Mbgl-RenderThread]: renderThreadPrepared=false and Android surface is not valid (isValid=false). Waiting for new one.
This sadly does not help. As I mentioned in this comment: The logs should cover the moment when the map turns black. Also not only Mapbox logs are needed but all the logs as Android surface has become invalid for the reasons that might be out of Mapbox SDK control (e.g. some GPU driver error).
So summing up: it would be great if you could get us all the logs (not just Mapbox ones) that start let's say 1 second before
[maps-android\Mbgl-RenderThread]: renderThreadPrepared=false and Android surface is not valid (isValid=false). Waiting for new one.
is spammed.
@kiryldz here are the complete logs. The map freezes some seconds after it's initialized (when I start mocking a new location) and is not frozen when a new instance of the map is created (as seen on the video after I go into a menu and back)
@maxrimmer many thanks! Firstly I hope the logs are covering correct time interval cause in the video from https://github.com/mapbox/mapbox-maps-android/issues/2251#issuecomment-1892015665 time is 12.40 while the logs cover 12.47.
Secondly from the logs you provided it is seen on 12:47:44.778 that system destroys the surface, so Mapbox SDK also destroys the drawing surface. After that we have
[maps-android\Mbgl-RenderThread]: Renderer paused
line that in general is triggered when Activity / Fragment has calls onStop().
After that we do not receive any new surface from Android but try to render staff though and that fails with a warning that surface is not valid (and it is indeed not valid as it was destroyed before).
Before the very first line that we start destroying surface there are no Mapbox specific logs.
2024-01-15 12:47:44.766 1390-1983 InputDispatcher system_server D Focus entered window (0): 8e72955 com.sec.android.app.launcher/com.android.quickstep.RecentsActivity
2024-01-15 12:47:44.772 2486-2486 ViewRootIm...sActivity] com.sec.android.app.launcher I MSG_WINDOW_FOCUS_CHANGED 1 0
2024-01-15 12:47:44.772 2486-2486 InputMethodManager com.sec.android.app.launcher I startInputInner - IInputMethodManagerGlobalInvoker.startInputOrWindowGainedFocus
2024-01-15 12:47:44.777 14025-14025 SurfaceView@d1d0e67 my.examplelink.alpha I onWindowVisibilityChanged(8) false android.view.SurfaceView{d1d0e67 V.E...... ........ 0,0-1080,2176 #7f0a0271 app:id/mapbox_mapview} of ViewRootImpl@50584ec[ActivityMain]
2024-01-15 12:47:44.777 14025-14025 SurfaceView my.examplelink.alpha I 220008039 Changes: creating=false format=false size=false visible=true alpha=false hint=false visible=true left=false top=false z=false attached=true lifecycleStrategy=false
2024-01-15 12:47:44.777 1390-3730 InputMetho...gerService system_server D setWindowStateInner, windowToken=android.os.BinderProxy@708fc0c, state=ImeTargetWindowState{ imeToken null imeFocusChanged true hasEditorFocused false requestedImeVisible false imeDisplayId 0 softInputModeState STATE_UNSPECIFIED|ADJUST_RESIZE isStartInputByGainFocus true}
2024-01-15 12:47:44.777 1390-3730 InputMetho...gerService system_server V Unspecified window will hide input
2024-01-15 12:47:44.777 1390-3730 InputMetho...gerService system_server V applyImeVisibility state=6
2024-01-15 12:47:44.777 14025-14025 SurfaceView@d1d0e67 my.examplelink.alpha I 220008039 Cur surface: Surface(name=null)/@0x4e9e704
2024-01-15 12:47:44.778 1390-3730 ImeTracker system_server I com.sec.android.app.launcher:5ee65c29: onRequestHide at ORIGIN_SERVER_HIDE_INPUT reason HIDE_UNSPECIFIED_WINDOW
2024-01-15 12:47:44.778 14025-14025 SurfaceView my.examplelink.alpha I 220008039 surfaceDestroyed
2024-01-15 12:47:44.778 1390-3730 InputMetho...gerService system_server D setWindowStateInner, windowToken=android.os.BinderProxy@708fc0c, state=ImeTargetWindowState{ imeToken android.os.Binder@7f1c59e imeFocusChanged true hasEditorFocused false requestedImeVisible false imeDisplayId 0 softInputModeState STATE_UNSPECIFIED|ADJUST_RESIZE isStartInputByGainFocus true}
2024-01-15 12:47:44.778 14025-14025 SurfaceView@d1d0e67 my.examplelink.alpha I surfaceDestroyed callback.size 1 #2 android.view.SurfaceView{d1d0e67 V.E...... ........ 0,0-1080,2176 #7f0a0271 app:id/mapbox_mapview}
2024-01-15 12:47:44.778 1390-3730 ImeTracker system_server I com.sec.android.app.launcher:5ee65c29: onCancelled at PHASE_SERVER_SHOULD_HIDE
2024-01-15 12:47:44.778 1390-3730 InputMetho...gerService system_server V hideCurrentInputLocked : canceled, shouldHideSoftInput=false, mInputShown=false, mImeWindowVis=0
2024-01-15 12:47:44.778 14025-14025 Mapbox my.examplelink.alpha I [maps-android\Mbgl-RenderThread]: onSurfaceDestroyed
I may get it wrong but it seems that we gain focus for com.sec.android.app.launcher/com.android.quickstep.RecentsActivity for a moment, that actually hides your activity window, triggers cleaning up surface. That sounds strange though when looking in your video.
I also wonder why don't I see any logs related to Mapbox Android Auto extension here...
@kiryldz sorry about the logs, the timing seems weird. I will try to come up with some new ones
@kiryldz here is a video with logcat running at the same time: https://drive.google.com/file/d/1imMXPd-BTULPpYRx_kCUUoAKVGuUOM1_/view?usp=sharing (I'd recommend downloading the video if you want to follow along with the logs, as Google Drive compresses the video to much when streaming) Please note that I start out with signing in on our app on the phone, after this is done the map is shortly initialised on the phone, but I put the app on the phone in the background before I begin to touch the Android Auto screen.
The log from approximately 3 seconds after is attached here: map_freeze_2023_01_16.txt (didn't manage to export it early enough to get from the begining, but you can see the same in the logcat that's running on the video)
This is on a Samsung Galaxy S21
Can this be looked at? Its a major problem for many of our users...
@kiryldz is there any news on this. Still getting lots of reports on this. Only on Samsung phones
Any news on this ?
following
We've just upgraded to the latest Mapbox Maps 10.17.0 hoping that this would be fixed, but are still getting customers reporting the same problem on Samsung devices running Android 14 when rendering maps on Android Auto. This seems to be becoming more & more problematic as people upgrade their phones to Android 14.
Mapbox folks - any updates on progress/a potential fix?
@markbeaton there's no particular progress. I looked again in logs provided by @maxrimmer in https://github.com/mapbox/mapbox-maps-android/issues/2251#issuecomment-1893216606 and I do not see the reason why actually the drawing surface becomes invalid (that's the reason why the map freezes / becomes black) and Android does not send us the new valid one so that we could proceed rendering.
I also built our Mapbox Android Auto sample application with v10.17.0. I tested it on Samsung Z Fold 4 running Android 14 using DHU and tried bunch of things like putting our maps to background, changing viewport etc. Sadly (or on the contrary luckily) I did not observe any black screens.
Additionally I've ran thru changes between v10.14.1 and v10.16.3 (as @maxrimmer was reporting that it broke between those versions) and I can't see any code changed related to how we handle surfaces.
I am not sure what's the best path forward here. Perhaps, if you could reproduce this, you can try follow reproduction steps but test not your app but in Mapbox Android Auto sample application. If it will be not reproducible you should consider checking your application code then. Alternatively, you may try switching to Maps v11.3.0 (perhaps it's magically fixed there among bunch of other changes).