MapView.setMaximumFps not working properly on secondary screens (Android Auto)
Environment
- Android OS version: 15
- Devices affected: Probably all Android devices, tested with a Pixel 6 Pro
- Maps SDK Version: 11.8.0
Observed behavior and steps to reproduce
When having multiple displays and calling MapView.setMaximumFps the framerate is not applied properly when doing this for any other screen then the primary one. I'm running an app with up to 3 MapViews, one on the phone screen and up to 2 on Android Auto (head unit and cluster display). I added some simple logging using onRenderFrameFinished to calculate the fps and compared this to what I specified on setMaximumFps and it is always off by the factor of 2 until I disable "Smooth display" in Android Settings (so limiting the primary screen to 60 Hz).
FpsManager is initialized with the proper refresh rate of the actual display, I can see screenRefreshRate being 60 Hz for the Android Auto screen even when the phone has "Smooth display" enabled (so running at 120 Hz). https://github.com/mapbox/mapbox-maps-android/blob/main/maps-sdk/src/main/java/com/mapbox/maps/MapView.kt#L233 But somewhere in the map rendering the userToScreenRefreshRateRatio seems to be applied to the primary screens refresh rate instead to the actual screen the map is rendered on.
On these logs you can see the initial ~120fps rendering, then I try to limit it to 30fps but it is actually ~60fps then. 2025-07-08 21:09:08.490 16469-16469 RNMBXMapView D *** 120 fps 2025-07-08 21:09:09.491 16469-16469 RNMBXMapView D *** 119 fps 2025-07-08 21:09:21.520 16469-17333 Mapbox I [maps-android\Mbgl-FpsManager]: User set max FPS to 30 2025-07-08 21:09:30.404 16469-17333 Mapbox I [maps-android\Mbgl-FpsManager]: User defined ratio is 0.5 2025-07-08 21:09:31.447 16469-16469 RNMBXMapView D *** 56 fps 2025-07-08 21:09:32.454 16469-16469 RNMBXMapView D *** 59 fps 2025-07-08 21:09:33.462 16469-16469 RNMBXMapView D *** 59 fps
Expected behavior
Calling MapView.setMaximumFps should limit the fps on the display/screen the map is rendered on properly. So specifying 30fps should not lead to 60fps.