IMapProvider exists so a map is a new implementation rather than a branch inside MapsActivity — see rule 7 in AGENTS.md. Google and AMap are implemented; MapLibre is the obvious third, and it is the one most people forking this project seem to want.
Why MapLibre specifically
Its API descends from Mapbox GL, so it lines up almost one-to-one with the existing GoogleMapProvider: SymbolManager for markers, LineManager for polylines, CameraUpdateFactory, addOnMapClickListener. Porting is close to mechanical.
It also renders vector tiles, so setRotateGesturesEnabled and setCompassEnabled map onto real behaviour rather than becoming no-ops — which is what would happen with a raster library like osmdroid.
The part that makes it mergeable
MapLibre ships no tiles. It renders whatever style URL it is given, so this needs a source, and that is the whole design decision:
- Do not bundle a key or pick a vendor. Same reasoning as rule 5 — a bundled key belongs to whoever ships the app, not to its users.
- Take a style URL from Settings, exactly as AMap takes a key today. One provider then covers MapTiler, Stadia, Protomaps, a self-hosted style, or anything else, without this project having a relationship with any of them.
- Selecting MapLibre without a style URL must not save, matching the AMap behaviour in Settings and on the first-run screen.
- Defaulting to
tile.openstreetmap.org is not an option: OSM's tile usage policy does not cover app traffic, and a popular app pointed at it is quietly abusing a volunteer-funded service.
Done looks like
MapLibreProvider implements IMapProvider — all 23 methods, no changes to MapsActivity
- Registered in
MapProviderFactory
- A style URL field in Settings, with the same not-saveable-when-empty rule as AMap
- Strings added through
scripts/add_strings.py so all ten locales have them
Worth knowing before starting: the instrumented tests run on an aosp-atd image with no Play Services, so anything that touches Maps cannot be tested there today — see #63.
Written by Claude Code.
IMapProviderexists so a map is a new implementation rather than a branch insideMapsActivity— see rule 7 in AGENTS.md. Google and AMap are implemented; MapLibre is the obvious third, and it is the one most people forking this project seem to want.Why MapLibre specifically
Its API descends from Mapbox GL, so it lines up almost one-to-one with the existing
GoogleMapProvider:SymbolManagerfor markers,LineManagerfor polylines,CameraUpdateFactory,addOnMapClickListener. Porting is close to mechanical.It also renders vector tiles, so
setRotateGesturesEnabledandsetCompassEnabledmap onto real behaviour rather than becoming no-ops — which is what would happen with a raster library like osmdroid.The part that makes it mergeable
MapLibre ships no tiles. It renders whatever style URL it is given, so this needs a source, and that is the whole design decision:
tile.openstreetmap.orgis not an option: OSM's tile usage policy does not cover app traffic, and a popular app pointed at it is quietly abusing a volunteer-funded service.Done looks like
MapLibreProvider implements IMapProvider— all 23 methods, no changes toMapsActivityMapProviderFactoryscripts/add_strings.pyso all ten locales have themWorth knowing before starting: the instrumented tests run on an
aosp-atdimage with no Play Services, so anything that touches Maps cannot be tested there today — see #63.Written by Claude Code.