Repository navigation
Conversation
bearing を「値を増やすと地図が時計回りに回る」向きに統一し、ネイティブ SDK との変換をコアの CameraBearing に集約する。 Co-authored-by: masashi <info@mkgeeklab.com>
The pins had drifted far enough that the aggregate build was assembling a
different SDK than the one every submodule publishes: android-sdk-core was
33 commits behind, the providers 3-13, and the extension modules sat on the
pre-migration OverlayCollector API.
Two catalog entries have to move with them, because the aggregate build
resolves `libs` from this file and not from each submodule's own catalog:
- material3 gets its own version again. It was pointing at composeLibs
(1.7.8), and material3 has no 1.7.8 - so example-app could not resolve
its own classpath. The aggregate build was already failing on this
before these pointers moved.
- kotlinx-coroutines-test is added; android-sdk-core's build file has
referenced it since the OverlayCollector debounce test landed.
Verified: ./gradlew assembleDebug reports BUILD SUCCESSFUL with all 22
submodules checked out at these commits.
…108) * Make bearing a clockwise map rotation bearing を「値を増やすと地図が時計回りに回る」向きに統一し、ネイティブ SDK との変換をコアの CameraBearing に集約する。 * Add android-vectortile: MapLibre vector styles on any backend An independent module, not a core change — it implements the core's TileProviderInterface and serves through the existing LocalTileServer, the same way android-heatmap and android-geojson-layer do, so backends that cannot render a vector style see an ordinary raster layer. The renderer and its .so come from the mapconductor-vectortile repo via scripts/sync-sdk.sh; only the integration layer lives here. Verified on a Pixel 5a: provider -> tile server route -> URL template -> HTTP on loopback -> PNG. Consumers need a network security config permitting cleartext to 127.0.0.1, which is true of every tile-server backed layer in this SDK and is now documented on VectorTileLayer. * Add a vector tile page to example-app Renders a MapLibre style over whichever backend is selected, which is the point: none of them can draw a vector style, yet all of them show this one, because what they receive is an ordinary raster layer. The provider now logs fetch and render time separately at DEBUG. On a Pixel 5a a street-level tile splits roughly evenly between the two (~850 ms each), and knowing which half is slow saved guessing. * Bound tile cache memory and cap render concurrency The 256-entry LruCache was ~64 MB of vector tiles; combined with the tile server running eight renders at once, the native allocator failed and aborted the process. The cache is now budgeted in bytes and concurrent rasterisation is capped at half the cores - which also removes the contention that had render times climbing from 235 ms to 1790 ms within a single viewport. Adds a 256/512 tile size switch to the example page, which is how the comparison below was measured. * Cache rendered tiles on disk across app launches Within a session this changes little: the map SDK already caches raster tiles, measured at 9 renders for 7 distinct tiles across a pan away and back. What it removes is re-rendering everything on the next launch — on a Pixel 5a, launch two served all seven visible tiles from disk with zero renders, against ~1 s of fetch plus ~1 s of rasterising each on launch one. Entries are keyed by a digest of the style, so a restyle misses rather than needing invalidation, and the budget is enforced by an amortised sweep rather than per-write. The cache directory is the caller's to choose. A library helping itself to disk behind an app's back is not a favour, so there is no default. * Sync renderer with compiled filters (513 -> 322 ms/tile on device) * Promote GPU rendering from experiment to a module feature VectorTileProvider gains a RenderMode: CPU, GPU, or AUTO, which probes for an OpenGL ES context and falls back. The value is less raw speed than which processor pays - drawing moves off the CPU the map SDK and the app are already competing for. An EGL context belongs to the thread that made it current, but the tile server calls renderTile from a pool of eight workers, so the GL work runs on one dedicated thread with requests marshalled onto it. That also serialises drawing, which costs nothing at ~2 ms a tile and matches the GPU being a single resource. A GPU failure falls back to the CPU per tile rather than losing it. Output is deliberately not bit-identical to the CPU path: MSAA against analytic coverage differs on thin-line edges, measured at 0.39% of pixels on a dense street tile. The test asserts no region disagrees rather than demanding equality. * Carry per-vertex colour through the GL shell Follows the renderer's vertex format: the shader takes aColor and interpolates it, the batch stride drops to two ints, and the correctness test compares 8x8 block averages instead of raw pixels. The pixel-exact comparison was asking the wrong question. The two rasterisers differ on edges by construction — MSAA against analytic coverage — and the test tile is a whole world at z0, which is almost entirely coastline. Block averages ask whether any *region* disagrees, which is the actual claim. On device: 0.00% of blocks differ, worst channel delta 18/255. * Follow the shared packing's timing slots * Measure where marker tile rendering spends its time There was no measurement of this path at all, which is why it was possible to believe the Rust renderer would help it. On a Pixel 5a, per tile: query prepare draw composite encode z12 916m 9 26 385 26 249 z6 19998m 74 248 9191 26 133 The draw is 20k blits at 0.46 ms each, and the reason is sub-pixel placement: the destination rect comes from a projection, so it almost never lands on a whole pixel, and a filtered non-integer blit costs 20x an aligned one. Rounding the destination takes 4270 ms to 203 ms for 20k markers. Turning filtering off without rounding only reaches 2172 ms, so the alignment is what matters, not the filter. Two other things the profile showed. The conservative-first-pass optimisation never pays: maxHalfExtentPx exceeds the 32dp assumption on every tile measured, so query and prepare always run twice. And the padded-then-cropped composite is a flat 26 ms per tile regardless of content. The Rust PNG encoder is 30-40 ms against Bitmap.compress at 133-249 ms, so it is worth having, but second: encode is 68% of a sparse tile and 1% of a dense one, and the draw dominates both until it is fixed. Note it also produces ~1.7x larger files (Compression::Fast) and that copyPixelsToBuffer hands over premultiplied pixels, which would need undoing before the bytes are correct. The tile cache is worth 1478 ms cold against 0.004 ms warm. The web Service Worker path has no equivalent and re-renders on every fetch. * Pin marker tile placement, and pick up the whole-pixel draw markersLandWhereTheirCoordinatesSay guards the rounding in android-sdk-core: a faster draw that puts markers somewhere else would be worth nothing. Its positions are derived from the tile's own bounds rather than written down — hand-computed coordinates put one marker in the neighbouring tile on the first attempt, which read as a renderer bug until the arithmetic was checked. * Pick up the native PNG encoder in the core * Rebuild the native libraries with 16 KB page alignment * Encode GPU tiles through the core's encoder * Assert stacked duplicates render identically * Pick up the query padding fix * Pick up the unsorted radius search * Pick up decluttering support * Add a street tree sample, and benchmark it Tokyo's 144,183 street trees from the metropolitan government's open data. A harder set than the post offices this app already shows: six times as many, packed into one metropolitan area rather than spread over a country, and one colour per species — so the renderer cannot collapse two trees of different kinds that land on the same pixel. Species with fewer than a hundred trees are folded into one bucket. The distribution has a long tail: a hundred species cover 96% of the trees, and the remaining three hundred would be colours nobody could tell apart or read off a legend. The bucket is still the fifth largest group, so it is not a rounding error being hidden. The asset is packed rather than the source CSV: 12.4 MB of Shift-JIS becomes 2.75 MB, and the device does not spend the first seconds of the page parsing it. Ward and road names are interned, since 144k trees share 23 wards and 171 roads between them. Decluttering is on at 14 px, the icon's own width. Trees are planted a few metres apart along a road, so below street level most of them sit on top of one another; thinning them halves the tile bytes and shows the same map. StreetTreeCostTest measures the same data on device, which is what it is really for — the post office set is too sparse to put the tiling path under pressure. Per tile on a Pixel 5a, against the pre-optimisation renderer: z9 3135 ms -> 1159 ms z11 1672 ms -> 678 ms z12 789 ms -> 326 ms z14 211 ms -> 60 ms * Group overlapping markers by sorting, not by hashing The dedup pass keyed a HashMap by the group, which boxes a Long and an Int per marker. On a tile holding the whole dataset that is hundreds of thousands of objects, and it showed: the process aborted inside Canvas create_canvas when the next tile could not allocate its bitmap. Sorting an array of (group, index) pairs answers the same question with two primitive arrays — the winner of a group is the last index in its run. Per tile on the tablet with Tokyo's 144k street trees, decluttered: z9 1113 ms -> 341 ms z11 364 ms -> 204 ms GridIndexPrototypeTest is the measurement that chose the grid's cell size. It is kept because the constants in MarkerGridIndex are only defensible with it. StreetTreeCostTest reads its asset header properly again. Restoring the file from git during a bisect dropped the magic check and two table skips, so it read the magic as a species count of over a billion and allocated icons until the process died — which then looked like the index change breaking it, on two different devices. * Take the street tree page off its recording tour The page flew a fixed route on load and turned decluttering off, so the before and after videos would do the same thing at the same moments. That was for the footage, not for anyone reading the sample: it moves the camera out from under the user and draws every one of 144k trees on top of one another below street level. The camera is theirs again and declutterPx is back to an icon width. Also runs ktlintFormat over the files this work touched. The GPU renderer and the vector tile provider went in unformatted, so the module has been failing its own check since. * Give iOS the same marker grid index, and fix two holes in it MarkerGridIndex.swift is the Kotlin index line for line: one Int64 a marker, its cell key above its position in a snapshot, sorted once and binary-searched per cell. Same 0.005 degree cells, same scan-instead threshold, same reasons — the hex registry it replaces was built at zoom 20, about 12 cm a cell, so it grouped nothing while charging a HexCell and a String id per marker. Writing the tests it deserved turned up two defects, both of which were in the Android version as shipped an hour ago: A box crossing the antimeridian has its east corner west of its west one. The cell walk ran lonFrom..lonTo straight, which is an empty range in Kotlin — no markers, silently — and a trap in Swift. It now walks to the unwrapped end and folds each column back onto the globe, which also covers the ring search near 180 degrees. findNearest stopped one ring after its first hit. A ring is a square, so a hit in a corner sits about 1.4 cells further out than a hit on an edge, and the marker it returned was simply not the nearest one — on 5,000 markers it was wrong for two of three probe points. The rule is now a distance: having finished ring r, everything unsearched is at least r cells away, so stop once that exceeds the best found. Neither would have thrown. Both would have quietly returned the wrong markers, which is why the tests compare against a brute-force scan on every query rather than checking that a query returns something. Also fills the gaps left when the index changed hands. findByIdPrefix builds the hex registry itself now — nothing else builds it any more, so it had been returning nothing at all — and getMemoryStats counts the grid instead of reporting no spatial index at all. * Measure where a street tree tile's time goes The sweep reports one number a tile, which is enough to see a change and useless for deciding what to change. On a Pixel 5a at zoom 9, with all 144k trees on one tile, the number is 1,329 ms and the question was whether that is just an old phone. z candidates total query rust encode project + draw 9 141,221 1329ms 204ms 12ms 1113ms 11 59,476 401ms 90ms 15ms 296ms 12 23,597 197ms 31ms 14ms 152ms It is not the phone, or not mostly. The cost is linear in candidates at about 8 microseconds each, and at zoom 9 the renderer prepares all 141,221 of them — projection, icon lookup, scale callback, half extents — to keep at most 9,216, which is what a 1344 px tile holds at a 14 px declutter. The tablet does the same work three times faster on a tile 1.5 times smaller, which is the whole of the device gap. The first cut of this test measured Bitmap.compress and reported it as the encode cost: 140 ms a tile, a third of the total. The renderer tries the Rust encoder first and reaches compress only if the native library is missing, so that column was a cost nobody pays. Both are measured now — the Rust path at 12-15 ms against compress at 140-152 ms is also the clearest evidence that the native encoder is loading on this device at all. * Sort DemoAppScreen imports Left over from adding the vector tile page: ktlint wants the block ordered and the new import went in beside a neighbour rather than in its place. * Answer decluttered tile queries from the grid's cells, not its markers At zoom 9 every one of Tokyo's 144,183 street trees lands on one tile, and the renderer read all 141,221 of them to keep 9,216 — what a 1344 px tile holds at a 14 px declutter. Reading a position off an entity costs 0.72 microseconds on a Pixel 5a, so merely looking at that set was 101 ms before anything was done with it, and the tile took 1,180 ms. A caller that is about to keep one marker per cell has already said the markers inside a cell are interchangeable. MarkerTileRenderer now says so, passing the declutter distance in degrees, and MarkerGridIndex answers from its cells: a binary search each, and where a cell lies wholly inside the box, one entry taken off the end of its run without scanning it. The walk visits the roughly 5,000 cells that hold trees rather than the trees. Per tile on a Pixel 5a, warmed, 14 px declutter: z9 1180ms -> 105ms 141,221 candidates z11 460ms -> 465ms 59,476 declined: cells too coarse to honour 14px z12 200ms -> 191ms 23,597 likewise The index declines whenever its 0.005 degree cells are coarser than the separation asked for, which is every zoom above 9 or so — and those are the zooms that do not have this many candidates. Nothing changes there, and the tiles come out byte-identical. At zoom 9 the PNG is 5.8% smaller because the survivor of a cell is now chosen by the index rather than by the pass that follows; the density is the same and the pass still applies the real rule. Two things measured along the way did not survive: Thinning before `prepareMarkers` rather than inside the index. It cut zoom 9 by 40% but cost 12% at zoom 11, where the projection pass runs over all 59,476 and saves less prepare than it spends. The index does the same job by not reading the markers at all, so the pre-pass was deleted rather than kept behind a threshold. Grouping on the marker's centre instead of its drawn rectangle. Two cell passes against grids offset by the icon's anchor thin twice, and a street tree tile came back 15% lighter than the caller had asked for. The declutter key also gets its bits back. It was `(cx shl 32) xor cy` shifted left by the index width, which kept the low 8 bits of `cx`: at the default 14 px cell a tile spans about 100 columns and nothing showed, but at a 1 px cell on a 1344 px tile, columns 0 and 256 shared a key and markers 256 px apart decluttered into one another. * Bring the minor roads back to the street tree map above zoom 13 The style was stripped to land, water, the major roads and the place names so that 144k coloured dots would read as street trees rather than as noise on top of 51 transportation layers. That holds while the whole city is on screen. Zoom into a ward and it stops holding: the trees follow the streets, and without the streets there is nothing for them to follow. Ten layers come back from the base style, at minzoom 13 — secondary, tertiary and minor roads with their casings, plus the bridge and tunnel variants so a road does not break where it crosses something. Their widths are the base style's own, so they arrive as hairlines at 13, are legible by 14 and grow from there. They take the same flat grey as the roads already in the style: colour belongs to the trees here, and a road that draws attention to itself is the thing this style was made to avoid. Checked on the tablet at 12.5 and 14.5. At 12.5 the fine grid is absent and the tree lines carry the map; at 14.5 the streets of Chiyoda and Chuo are all there under the dots. Paths, tracks and railways stay off. The base style groups service roads and tracks in with minor, so those come along, which at 14 and above is what a street map looks like. The style file itself was never committed. tokyo-trees.bin was, so a fresh clone got the trees and then asked for a basemap that was not there. * Stop taps on an InfoBubble from reaching the map underneath The map is an AndroidView laid under a full-screen Compose overlay, and an event nobody consumed goes to it. So tapping the padding of a bubble, or its title, or anywhere its content did not itself handle, was read as a tap on the map: on the street tree page that selected whichever tree happened to sit under the bubble and swapped the contents for another one. "Hit the bubble and nothing wanted it" is not the same as "missed the bubble". The overlay Box now consumes what its content leaves behind, so the first case stops there and the second still falls through to the map. Consumption happens on the Main pass. Compose delivers Main from the child outwards, so by the time it arrives here the bubble's own buttons and clickable rows have already taken theirs; consuming on Initial would have killed them. Verified on the tablet with the Multiple Bubbles sample, whose bubbles close themselves when tapped: the tapped one still closes and its neighbour stays open. The Box is the bubble's bounding rectangle, so the corners beside the tail count as the bubble. That is a few pixels either way and the alternative is hit-testing the drawn shape, which is not worth it to make a corner pixel pan the map. Panning still works, and a tap on the map away from the bubble still dismisses it. All three InfoBubble entry points share this overlay, so all three are fixed. * Match the bubble's hit area to its drawn shape The consuming modifier was on InfoBubbleOverlay, whose Box is the bounding rectangle. That made the corners either side of the tail count as bubble: an area half the bubble's width by the tail's height where the map is plainly visible and a tap did nothing. The shape is known to DrawInfoBubble, not to the overlay, so the consuming moves there. isInsideBubble is the same geometry the Canvas draws — the body down to height minus the tail, plus the triangle closing linearly to its tip. Corner rounding is ignored; at the default it is 4dp against a tail-side area of half the width by 8dp, which is what this is about. InfoBubbleCustom draws its own shape and so keeps its own hit behaviour. It has no tail this code knows about and no rectangle worth guessing at. DrawInfoBubbleHitTest pins the boundary. Consuming too much and consuming too little both look like "it sometimes ignores me" and neither logs anything, so the edges are worth stating: body inside, beside the tail outside, the tail itself inside and narrowing. * Leave the bubble's tail out of its hit area The tail is 8dp at the default. Hit-testing the triangle costs a line of geometry and a test to hold it up, and buys the case where someone aims at the point itself — where the consequence of missing is that the map below responds, not that something they were aiming at fails to move. The rule is now the body rectangle, which is what the consuming was for. * Have states report their own changes instead of being read for them Dragging the street tree map was heavy on a Pixel 5a long after the tile rendering stopped being the reason. Frame stats put 270 to 380 ms of every janky frame between AnimationStart and PerformTraversalsStart, with the GPU at a 16 ms 90th percentile; simpleperf put three quarters of the main thread in androidx.collection.ScatterSet.contains, under advanceGlobalSnapshot, under a snapshotFlow's apply observer. That observer belonged to the collector. To find in-place changes it read every state's fingerprint inside one snapshotFlow, and Compose asks such an observer, on every snapshot commit anywhere in the app, whether any object it read is among the changed ones — one contains per object read. 144,183 markers of a dozen fields each is about 1.7 million probes, and a drag commits a snapshot every frame. The loop ran the wrong way round. Asking "of everything I read, did any of it change?" costs the size of the collection whether or not anything changed; being told "this one changed" costs one call per actual change, and during a drag markers do not change at all. So the states push: every mutable field goes through StateMutationSignal.notifying, which writes through to the same mutableStateOf — the field stays readable from a composition exactly as before — and reports the write. On a Pixel 5a, same 144k markers, same drag: janky frames 17.7% -> 1.4% 90th 350ms -> 21ms 99th 700ms -> 24ms slow UI thread 19 -> 2 which is where an empty map already was (0.2%, 16ms, 19ms). Quartering the markers had quartered the cost, so this was never about what was drawn. The collector keeps its own id-to-state map of who is reporting. Membership reaches `flow` through a debounce, so a state added and removed inside one window is not in that map when the removal arrives; clearing by id there found nothing and left the state reporting for the rest of the collector's life, which the removal test caught. Two things go with it. The FingerPrint type parameter, which existed only for the diff — fingerPrint() stays, several providers do their own diffing with it. And asFlow() on all six state types plus CollectAndUpdateEach, the per-state watcher this replaced twice over: nothing called either, and they are the shape that must not come back. The failure mode of the swap is silent — a setter that forgets to report leaves the renderer drawing the old value, with nothing logged and nothing thrown — so OverlayCollectorMutationTest states the contract: a write arrives, an equal write does not, repeats inside a window collapse to the latest, a removed state goes quiet, and two states changing together both arrive. * Wire labels through to Android, and stop the GPU path losing them The renderer could draw labels; nothing fetched the glyphs it needed. This adds the round trip — the tile is decoded, asked what ranges its text needs, those are fetched once each and kept — and the place names appear on a Pixel 5a. Three defects on the way, each of which fails without saying so. A renderer that draws more than the one before it must not serve the earlier one's tiles. The disk cache was keyed on the style and the tile size, so a build that had learned to draw labels kept handing back the unlabelled PNGs its predecessor had cached. The key carries an output version now. `add_glyphs` took `&mut self`, which promises exclusivity that a raw handle cannot give: the hosts render on a thread pool, and two tiles wanting glyphs at once crashed inside it. The store is behind a read/write lock, and a test runs eight threads mixing reads with writes. The GPU path tessellates fills and lines and knows nothing about glyphs, and it is preferred wherever there is a GL context — so a style with labels rendered without them and reported nothing. The label pass does not care how the pixels underneath were made, so it now runs over the readback before encoding. Forcing such styles onto the CPU was the first fix and lost the GPU for them. Glyph cost on a Pixel 5a, first view of Tokyo: 18 to 21 ranges in four to five seconds, 69 in thirteen. Ranges are shared by every later tile, so it stops costing after the first few, and asking the tile rather than the style is what keeps it to dozens instead of the 82 a CJK font carries. Labels still repeat across tile seams — placement is per tile, so a name near an edge is placed twice by neighbours who cannot see each other. Visible in the screenshots as a second 豊島区 and 中央区. * Stop waiting on glyphs, and hand tiles over rather than replacing them Zooming out stopped the drawing, and what came back flickered. Two causes, one after the other. A glyph range is a 0.4 to 1.3 second round trip and a tile at low zoom wants dozens of them — the text on it is what decides. Fetching them inside the render meant the tile drew nothing until the last one landed: 69 ranges, 13 seconds, measured. Tiles are drawn now with whatever glyphs are loaded, the same way MapLibre does it, and the fetches go to a pool of six. Splitting the cost showed where it was: 8 ranges cost 10.7 seconds of fetching summed across threads and 25 ms of parsing. Then the flicker. A raster layer whose source URL changes is removed and added again, so between the two there is no layer at all and every visible tile is refetched from nothing. The layer now adds the replacement alongside and drops the old one after a window: the new tiles are opaque, so they cover the old ones as they arrive and no frame is ever empty. The generation also keys the tile caches, or the unlabelled tiles would simply be served again. Verified by recording the load and measuring it rather than watching: the handover fires 8.6 seconds after launch, and across the 55 seconds there is no near-uniform frame after the first 5 and no frame-to-frame change above 2 — the flash is gone, not merely smaller. Notifications are coalesced over 400 ms, so a viewport's worth of ranges asks for one handover rather than dozens. The KDoc moves are mine to own: three inserts landed between a doc comment and the declaration it described, which ktlint catches and a reader would not. * Hand tiles over once, when the glyphs are in The flash was not a blank frame. In the recording the map alternates between two brightness levels a few greys apart -- the labelled picture and the unlabelled one, taking turns about twice a second. Both halves of that are here. The notification waited 400ms after the first range arrived, but ranges do not come in one burst: six threads, 0.4 to 1.3 seconds each, dozens wanted at low zoom, so the window kept closing between arrivals. Twelve handovers for one screen, each one a full redraw. It now holds the window open while any fetch is still out, capped at ten seconds so a range that never answers cannot hold the labels back, and the wait sits on its own thread rather than occupying one of the six fetch slots. Same pan, same cold cache: 12 handovers became 1, and whole-map redraws while the map was still went 4 to 1. The other half is order. The two generations are both raster layers and the provider sorts them by zIndex, which was 0 for both, so which one ended up on top was down to iteration order -- and with the old layer on top its cached unlabelled tiles hid the labelled ones underneath. The replacement now carries its generation as its zIndex. * Keep the tiles a handover cannot change Your log has the rest of it. In 41 seconds of use the glyph generation climbed to 81 and six handovers went out, and every one of them called evictAll() on the vector tile cache -- the source data, which glyphs have nothing to do with. So each handover refetched the viewport over the network and redrew it at 557 to 861ms a tile at z16. That is the churn in the second half of the recording. Two changes. The vector cache is no longer dropped: glyphs change what a tile is drawn with, not what it contains. And a rendered tile now goes to one of two keys -- a tile that had every glyph it wanted is finished, no later arrival can change it, and it is stored without a generation so it survives every handover; only a tile drawn short of glyphs is tied to the generation it was drawn at, and only those are redrawn. A handover that finds nothing was drawn short now does not go out at all. Pixel 5a, cold cache, launch and sit still, same viewport both runs: the handover redraws the same 7 tiles either way, but the network fetches behind them went 7 to 0. Under a harsher script -- 10 pans into fresh ground with double-taps, 60s -- change-and-return flashes went 10 to 1 and no frame was blank. * Drop tiles the map has left behind, before drawing them Checkpoints where the waiting actually happens: before each source tile, before the render, and again after acquiring a render slot -- a tile can sit in that queue for seconds while the map moves on. Pixel 5a, same 12-fling script, cold cache: tiles rendered and then thrown away went 31 to 13-15 across runs, with 11-13 dropped before the render started. The remainder are tiles the map abandoned while the native render was already running, which cannot be interrupted. Also fixes reportsStyleDiagnostics, which asserted that symbol layers were not drawn. That stopped being true when the renderer learned to draw them, and the test kept passing anyway because it only checked that some message contained "symbol". It now covers what diagnostics actually reports. Worth noting the gap it uncovered: the symbol limitations that remain -- labels along a line, and icons -- are computed but never reach Style::diagnostics, so nothing reports them. * Keep glyph ranges, so a launch does not start mute The store the renderer draws from lived in memory only, and the ranges it wants are not known until a tile has been decoded -- so every launch drew its first tiles with no place names on them and handed them over once the ranges landed. For Japanese that is a long wait: CJK is spread thinly across 256-codepoint blocks, one view of Tokyo asks for 69 ranges, and at 0.4 to 1.3 seconds each the map on a Pixel 5a was up and unlabelled for 7.0 to 7.5 seconds. Ranges never change, so they are now written to disk beside the rendered tiles, and read back into the store before the first tile is drawn. The warm start does not know which URLs it wants, so it does not ask: every stored file is handed to the renderer, which takes the fontstack and range from inside the PBF. Measured on a Pixel 5a, second launch with the rendered tiles deleted so they had to be drawn again: cold : 0 ranges from disk, 69 fetched, 7.0s unlabelled warm : 69 ranges from disk in 51ms, 0 fetched, no handover at all -- every tile had its labels the first time it was drawn The budget is 32MB and that number is measured, not guessed: the 8MB I first gave it swept away 26 of the 69 while they were still being fetched, and the next launch still spent 3.4 seconds unlabelled. A range averages 150KB. The genuinely first launch is unchanged. Nothing can know which glyphs a map needs before it has seen the text. * Fetch the style's sprite, and keep it The renderer can draw icons now; this is the half that gets the sheet to it. Two files, both named by the style itself, so unlike glyphs they can be fetched without waiting to see what a tile contains -- and a sheet already on disk is loaded before the first tile is drawn rather than arriving in a handover afterwards. When it does have to come over the network the existing handover carries it: a tile drawn before the sheet landed is short of ink it will have later, so it goes to the provisional cache key and is redrawn once, the same as a tile drawn before its glyphs. GlyphDiskCache is now StyleAssetCache, because it holds both. The warm pass stays glyph-shaped -- a warm start cannot know which ranges it wants until it has drawn a tile -- while the sheet is fetched through get() by name like any ordinary cache entry. OUTPUT_VERSION goes to 3: tiles rendered by the previous build have no icons on them and must not be served by this one. * Serve tiles drawn by the renderer that knows about lines OUTPUT_VERSION 4: the previous build's tiles have no one-way arrows on them and its labels were placed against a different padding rule, so they must not be served by this one. * Send a tile to the CPU when the style patterns it The provider asks the renderer, per tile, whether anything in it needs the pattern shader, and keeps the GPU for everything else. OUTPUT_VERSION goes to 5: tiles from the previous build have solid lines where they should be dashed. * Retry a source tile that failed rather than calling it empty A source tile that answers "nothing here" was remembered, which is right, but so was one that failed to answer at all -- a timeout, a dropped connection -- and that memory lasts as long as the process. One transient failure and every tile that needs that data draws without it for the rest of the session, silently: the tile still renders, just missing whatever was in that source. The two cases are now told apart. A failure is logged and tried again next time; only an actual empty answer is remembered. * Fetch a tile's plan all at once A plan used to be one tile and is now nine: the tile and the ring of neighbours the renderer needs to finish a label that crosses an edge. Fetching them one after another would have been most of a second of waiting for what takes a fraction of it in parallel. Most are hits in steady use -- every tile is its neighbours' neighbour. The source cache goes from 16MB to 48MB for the same reason: the working set for a screen is now the tiles on it plus the ring around them, and at low zoom a tile is most of a megabyte. Too small a cache here does not lose the picture, it re-fetches it. OUTPUT_VERSION 6: tiles from the previous build have their edge labels cut in half. * Say which rasteriser a provider got One line at startup: ES3 with MSAA, ES2 without it, or the CPU. Working out which one was drawing has come up in every performance question so far, and the answer was only reachable by calling a method nobody calls. * Serve tiles whose labels follow the style's own priority OUTPUT_VERSION 7: tiles from the previous build settled their collisions by whichever label the tile listed first, and their halos have hard edges. * Serve tiles that carry their road names OUTPUT_VERSION 8: tiles from the previous build have no street names on them at all. * Report render phases, fetch in parallel, and share downloads Instrumentation and plumbing from the performance session: - The GPU rasteriser logs per-tile phase times behind the debug flag: decode, tessellate (with the loop broken out), labels, encode. Every question in this session was answered by these numbers, including the ones the guesses got wrong. - Labels and PNG encoding moved off the GL thread, where they were serialising eight workers behind work that has nothing to do with the GPU. - Source fetches run through a pool sized for all the workers rather than one tile's plan, and one URL is downloaded once however many tiles want it -- on a cold screen every neighbour is wanted by up to nine. * Serve the map as two stacked layers: ground and labels One VectorTileProvider now exposes two routes. The geometry route draws on the GPU with no label pass, caches under a single key, and is never invalidated -- glyphs cannot change a fill. The label route draws text and icons on a transparent ground, pure CPU, cached under the complete/provisional scheme as before, and it alone hands over when fonts arrive. VectorTileLayer mounts them as two raster layers, labels above ground. To the map and the user they read as one -- but the halves now render in parallel (GPU under, CPU over), a glyph handover costs a moment of doubled labels instead of a whole redraw, and the worst case on any refresh is a map briefly missing its names, never a bare map. Measured on a Pixel 5a over the same double-tap zoom to street level: before, one route, tile median 515ms; after, geometry and label tiles median 201ms across both routes, and the geometry request count stayed flat through the glyph handover where it used to double. An empty label tile -- water, fields -- is one shared transparent PNG, encoded once. * Draw the label overlay at twice the tile's grain The labels were blurry, and for a straightforward reason: the image was rendered at one pixel per style pixel and the screen is nearly three device pixels per style pixel, so every glyph arrived at the eye stretched to roughly triple size. Text is where resolution is seen. The label overlay is now drawn at twice the tile's nominal size -- the image covers the same ground, only its grain changes. The ground layer deliberately stays at one-to-one: a fill's edge does not show the stretch the way a letter does, and its cost is per pixel on the GPU readback. This split is the two-layer architecture paying off again -- resolution is spent only on the layer that shows it. The label pass scales everything from the buffer size, so the glyphs are drawn into the finer grid at the same on-screen size; nothing about placement or collision changes. Startup renders went from a median of 45ms to 122ms -- four times the pixels to draw and encode on the tiles that have ink -- which the parallel CPU workers absorb. OUTPUT_VERSION 9: cached label tiles at the old resolution must not be served under the new declaration. * Serve tiles from the renderer that caches its glyphs OUTPUT_VERSION 10: label tiles rendered by the previous build can carry labels garbled across bends. * Serve tiles whose road names overflow bends instead of breaking OUTPUT_VERSION 11. * Store the label overlay as the premultiplied buffer it is The style asks for a white halo on twenty-nine label layers and the map showed a grey shadow. The label pass composites source-over into a transparent buffer, and that arithmetic leaves every channel scaled by its own alpha -- premultiplied. Encoding it as straight alpha stored white-at-0.8 as the grey 204, and the map then composited the grey. One flag: the encoder is told the truth and un-premultiplies before writing the PNG. The single-layer path was never wrong, only lucky -- its ground was opaque, alpha was always one, and the two readings agree at one. OUTPUT_VERSION 12: cached label tiles carry grey shadows. * Serve tiles whose seam labels agree with their neighbours OUTPUT_VERSION 13. * Point the submodules at the merged core android-sdk-core carried the PNG encoder, the marker grid index and the collector redesign on feature/bearing-clockwise, and this repo was already pinned to that branch — but the submodule was checked out on develop, where none of it existed. That is why android-sdk-compose did not compile: it wanted OverlayCollector<T> and develop still had OverlayCollector<T, FingerPrint>. The branch is merged into develop now, so the pin follows develop. The other five move with the API baselines their surfaces picked up from it. * Document android-vectortile The module had neither a README nor a licence, unlike android-heatmap and the rest. Leads with the cleartext-to-loopback requirement rather than burying it in the reference: tiles are served over plain HTTP on 127.0.0.1, and without a network security config permitting it the layer stays blank with no error and no crash. * Run the unit tests on every pull request CI here was lint and publish only. apiCheck sees the shape of the public API, not what is behind it, so a change that kept every signature and broke the implementation went through green. Five modules, and deliberately not more. `android-for-*` need the HERE aar, Mappls, and GitHub Packages credentials -- most of their failures would be "no key", not a defect. The five left run with nothing configured, and android-sdk-core holds the bulk of the logic anyway. `connectedAndroidTest` stays out too: emulators take minutes to boot and fail for their own reasons. TilePngEncoder and LocalTileServer deserve device coverage, on their own trigger. Also picks up the projection work: core now carries doubles through Web Mercator and clamps and wraps as ios-sdk does, and marker-clustering stops rounding its hulls on the way out. * Size the street tree icons in dp, like every other icon The sample built its dots at raw pixels: `Bitmap.createBitmap(14, 14)`, declared as `Size(14, 14)`. Core's own AbstractDefaultIcon does not — it goes through `dpToPxForBitmap(iconSize)` — so this was the one icon in the app whose apparent size shrank as the screen got denser. Measured at density 2.13 it came out 8.47 dp where a 14 dp icon should be 18. ios-sdk sizes in points and react-sdk in CSS px, both density independent, so this is also why the same sample looked different on the three platforms. It was never an iOS problem. The size drops from 14 to 10 at the same time, on all three. IconSizeProbeTest counts what actually reaches the tile rather than deriving it: one marker, one tile, measure the drawn pixels. Deriving it is how the wrong conclusion gets reached — the units differ at four points between the icon and the screen. ios-sdk-core has the matching probe, and the two agree: 12.71 dp against 13.33 pt. * Bump android-sdk-core: square Morton marker grid and seam consistency * Bump android-sdk-core: tile server answers empty with pixels, failure with 503 * Bump providers: declutterPx actually reaches the marker tile renderer * Bump android-for-openmobilemaps: switchable tile-request trace * Bump android-sdk-core: on-device pixel seam test * Bump providers: raster overlays sit under the basemap's labels * Bump android-for-arcgis: tile levels match the grid they name * Bump android-for-arcgis: tile levels come from the unified zoom * Bump core and arcgis: providers can state their tile size * Bump android-for-arcgis: hold the tile size preference * Bump android-for-arcgis: ask SceneView-sized tiles * Bump core and arcgis: no crash on a projection that cannot answer * Bump android-for-arcgis: SceneView-sized tiles * Hide the basemap under the vector tile sample on every backend that can Bumps core, arcgis, mapbox, maptiler, openmobilemaps, longdo and tomtom for their None designs; the sample's "As basemap" chip now covers them. HERE and Mappls have no design that draws nothing. * Sync the renderer with the triangulation cache; keep the GPU ground for glyph handovers The provider keeps the straight-RGBA ground of every tile the GPU drew (64 MB LRU) and, for a full tile whose glyphs arrived later, composites the labels onto it instead of drawing the geometry again. Also carries the source-level offset and per-tile fetch/render logging from the SceneView tile-size work. * Bump core and arcgis: transparent ancestors on the 3D view * Bump arcgis: local layers rebuilt in place * Keep source tiles and style assets on disk; pooled readback buffers in the GPU rasteriser; more tests StyleAssetCache also holds source MVT tiles (128 MB); the GPU rasteriser pools its readback/encoder buffers per worker and uploads a tile's geometry in one go; the renderer guards native calls with a read-write lock. New tests: attribution, geometry neighbours. * Give every sample page a modifier and rebuild the vector tile page Every page takes a Modifier and passes it through; the vector tile page and its style loader are rewritten, and the MapLibre blank style ships as an asset. * Vector styles handed to MapLibre-based maps directly, and offline packages VectorTileLayer(asBasemap) hands the style to a map that registers VectorStyleSupport instead of rasterising it. OfflinePackage and OfflinePackageDownloader fetch the tiles, glyph ranges and sprite an area needs into a directory; the layer draws from it and, offline, refuses the network without poisoning caches. Tiles drawn short of a source are not kept. Sample: an Offline Map page with a select-area mode (two draggable corner markers and a shade with the area cut out, following the area wherever it is), Download, an airplane-mode toggle and fetch counters. * Harden vector tile offline packages * Update offline map provider adapters * Update core local tile rendering * Update core to fix marker rendering at tile boundaries * Improve vector tile resolution and release renderers off the UI thread * fix: make vector tile render admission cancellable * chore: checkpoint pending SDK changes * Apply raster tile preferences to vector tiles * feat: let VectorTileLayer take StyleRules A style can now be adjusted on the vector-tile path: the rules are compiled into the document off the main thread before anything mounts, so a rule that hides a role leaves those layers out of what the renderer is given. Nothing mounts until the compile finishes, or the layers being hidden would flash first. fix: put the drawn document in the tile URL The ground template carried a fixed cache key, which was enough while only the tile size could change the pixels. A map refetches a raster source whose URL changed and not otherwise, so a restyle at the same size either changed nothing or changed once and then stuck. The key is the drawn document's hash — content, not a counter, so rebuilding the overlay content does not mint a URL and refetch every tile. examples: draw/skip switches and a colour per category on the vector tile page, built from the same rules. Each category covers several roles (land is the background plus landuse plus sites); labels can be switched off but not tinted. style: ktlintFormat over the two modules, which were already failing the lint gate before this change, plus the four over-long lines and the KDoc that a refactor had separated from renderGroundTile. UISettingsMapPage suppresses RestrictedApi with its reason: reading the vendor's own map object is what that diagnostic is for. * Keep each file's line endings as they are on develop The checkpoint commit rewrote whole files between LF and CRLF, which buried its real changes under line-ending noise. Content is unchanged. --------- Co-authored-by: masashi <info@mkgeeklab.com>
Point android-marker-clustering at the import cleanup
Port the iOS street-tree labels: above zoom 16 each tree gets its species name, placed beside its road (vertical text above/below, horizontal text left/right) by a per-road chooser. Each road keeps its previous side while that side still places at least two thirds as many labels as the best side, so panning no longer flips labels. A 'camera' intent extra (lat,lng,zoom) opens the page at a given spot for checks.
Label street trees on Android and keep label sides across pans
The marker icons page adds an ImageIcon(imageUrl = ...) marker, and the ground image page gets an "image from URL" switch that loads the same drone image from GitHub instead of the bundled drawable.
Show an image URL in the marker icons and ground image samples
Point android-for-googlemaps at the ground image fix
…1.0f android-sdk-compose and android-sdk-core now default Circle strokeWidth to 1.dp and GroundImage opacity to 1.0f for both the composable and the state, and PolygonState strokeWidth to 1.dp. Update the parameter lists (en / ja / es-419) and the signature snippets. CircleStateSignature already disagreed with the code (it said 2.dp; CircleState has always defaulted to 1.dp).
The area example labelled a positive signed area as counter-clockwise. Spherical.computeSignedArea returns a positive value for a clockwise ring (north-up) on every platform.
Unify shape defaults (Circle/Polygon stroke 1, GroundImage opacity 1.0)
The page held the flags in a page-local remember and wrote them into the state on every composition, so after a rotation they came back all-true and overwrote whatever the state had restored. The switches now read and write state.uiSettings directly; the --es gestures preset is applied once per state.
report() matched the native map object against the state types, so no branch ever matched and every provider logged 'no native reader'.
Shape opacity defaults, InfoBubble following its icon, and map state (design, uiSettings, camera paddings) surviving configuration changes.
Keep map state across rotation; bump submodules
A grid of hexagons registered with one Polygons(states) call, with buttons to add and remove rows and to replace every state with a new fill.
The same Overture Maps extract as the React sample (central Boston, 688 buildings, ODbL), coloured by height, with 2 x 2 and 4 x 4 copies for load testing. The camera and grid extras fix the view for measurements.
… a tap hit Same data and behaviour as the React sample. Every tap is also logged under BostonTap (seq, id, map-click position), which is how hit testing is checked from outside. The area extra replaces grid.
About 100,000 polygons each, read from the app's external files directory (too large for the APK; push them with adb, see BostonData.kt). Same binary format as the React sample. `data` (downtown, buildings or parcels) joins `camera` and `area` as an intent extra.
Same as the React sample: parcels coloured by land use with a legend (the label is "<GIS_ID>|<land use>"), an overlay saying how far reading, decoding, building the states and drawing have got, and the tapped polygon's data in an InfoBubble at the tap, closed by tapping the map elsewhere. The stats also give the time to the second frame after the list reached Polygons().
Update MapTiler SDK to 2.5.0 in the aggregate catalog
Move all submodules to their current develop
Update TomTom Maps SDK to 2.7.2 in the aggregate catalog
T-Mobile / Sprint (pink) and Verizon (red) were too close to tell apart on the map.
Draw Verizon in orange in the antenna sample
Points android-sdk-core and android-sdk-compose at their add-progress branches.
Add progress callbacks for Markers/Circles/Polylines/Polygons
MapConductor/android-sdk-core#46: zoomed-in circle tiles read only the blocks round them.
Point android-sdk-core at circle files stored by place
Point android-sdk-core at the marker tap fix
- Bump every submodule to its 1.4.0 release commit
Release 1.4.0
Fix import order in CircleFilteringStressTest
- ktlintFormat over example-app, plus explicit imports and one wrapped line in AntennaHorizonsPage (the parts it cannot fix itself) - Add dummy TOMTOM/MAPTILER/LONGDO keys to local.defaults.properties so the manifest merges without secrets.properties (Android Lint on CI) - Bump android-sdk-core to allow a few ULPs in the zoom golden test (core #50)
Fix example-app lint and the core golden test
Bump android-sdk-core for the golden-test fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge develop into main for the 1.4.0 release.