Shields loading optimization
Closes NAVAND-483
Description
After reviewing RoadShiled loading logic, I've noticed that we were caching RoadShield image data in 3 different places.
-
ShieldResultCache-RouteShieldin LruCache -
ShieldByteArrayCache-ByteArrayin LruCache - Native
TileStore-ByteArrayon disk
The ShieldResultCache already caches image data together with RouteShield; therefore, ShieldByteArrayCache is redundant.
In this PR, I optimized RoadShield loading by:
- deleting duplicate image cache
- separating download from caching logic - introduced local ResourceLoader and CacheResourceLoader decorator
- renaming
ShieldResultCache->RoadShieldLoaderand loosely coupling it with sprites and image loaders - loosely coupling
RoadShieldContentManagerImplwith theRoadShieldLoaderclass
(new setup)

Changelog
Features
- Introduced
ViewStyleCustomization.infoPanelGuidelineMaxPosPercentthat allows customization of theNavigationViewInfoPanel bottom guideline maximum position. Increased default value to 50%. #6792
Bug fixes and improvements
-
Fixed an issue with
NavigationViewthat caused info panel to shrink in landscape mode with a full screen theme. #6780 -
:warning: Updated the
NavigationViewdefault navigation puck asset. #6678Previous puck can be restored by injecting
LocationPuck2Dwith thebearingImageset tocom.mapbox.navigation.ui.maps.R.drawable.mapbox_navigation_puck_icondrawable:navigationView.customizeViewStyles { locationPuckOptions = LocationPuckOptions.Builder(context) .defaultPuck( LocationPuck2D( bearingImage = ContextCompat.getDrawable( context, com.mapbox.navigation.ui.maps.R.drawable.mapbox_navigation_puck_icon, ) ) ) .idlePuck(regularPuck(context)) .build() } -
Fixed an issue where the first voice instruction might have been played twice. #6766
-
Added guarantees that route progress with
RouteProgress#currentState == OFF_ROUTEarrives earlier thanNavigationRerouteController#rerouteis called. #6764 -
Introduced
NavigationViewListener.onSpeedInfoClickedthat would be triggered whenMapboxSpeedInfoViewis clicked upon. #6770 -
Each newly instantiated MapboxRouteArrowView class will initialize the layers with the provided options on the first render call. Previously this would only be done if the layers hadn't already been initialized. #6466
-
Fixed a rare
java.lang.NullPointerException: Attempt to read from field 'SpeechAnnouncement PlayCallback.announcement' on a null object referencecrash inPlayCallback.getAnnouncement. #6760 -
Fixed standalone
MapboxManeuverViewappearance when the app also integrates Drop-In UI. #6774
Known issues :warning:
Other changes
Android Auto Changelog
Features
Bug fixes and improvements
Codecov Report
Merging #6826 (b8a6655) into main (61415ea) will decrease coverage by
0.04%. The diff coverage is85.29%.
@@ Coverage Diff @@
## main #6826 +/- ##
============================================
- Coverage 72.64% 72.61% -0.04%
- Complexity 5569 5600 +31
============================================
Files 780 783 +3
Lines 30104 30106 +2
Branches 3553 3555 +2
============================================
- Hits 21869 21860 -9
- Misses 6808 6815 +7
- Partials 1427 1431 +4
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...ion/ui/shield/RoadShieldContentManagerContainer.kt | 8.33% <0.00%> (-16.67%) |
:arrow_down: |
| ...igation/ui/shield/internal/RoadShieldDownloader.kt | 64.28% <66.66%> (ø) |
|
| ...navigation/ui/shield/internal/loader/Downloader.kt | 70.00% <70.00%> (ø) |
|
| ...vigation/ui/shield/RoadShieldContentManagerImpl.kt | 91.30% <90.74%> (-2.39%) |
:arrow_down: |
| .../shield/internal/loader/ShieldSpritesDownloader.kt | 94.11% <94.11%> (ø) |
|
| ...tion/ui/shield/internal/loader/RoadShieldLoader.kt | 96.29% <96.29%> (ø) |
|
| ...vigation/ui/shield/internal/loader/CachedLoader.kt | 100.00% <100.00%> (ø) |
@abhishek1508 Can you review and merge this?
@abhishek1508 Can you review and merge this?
cc @LukasPaczos