Modern Apps git

← Modern-Apps.git

maps: ratings and reviews only from the archive; Google cut to 2 uses (#planet4)

Commit
bee3668e4f3179eeb9ebeb2b33f334f0193919a0
Author
Vayun Mathur <[email protected]>
When
2026-11-11 21:11 UTC (24 days ago)
Parents
2d7c487
Owner requirement: place ratings, review counts and review summaries come
ONLY from the archive (poi_attrs keys 10/11/12, baked from
reviews_archive.tsv), and the only Google features left are Street View
and non-review place details (photos, hours, phone/website, popular
times) for a selected place.

Removed:
- Google reviews: WebReviewsFetcher (hidden-WebView scrape),
  ReviewsWebParser, service/ReviewsScraperService (+ its ":reviews"
  process entry in the manifest) and ReviewsScraperClient, plus their
  tests. SelectedFeatureViewModel.currentPoiInfo is now one details
  fetch, no review streaming.
- Review fields of the Google model and parser: GooglePoiInfo loses
  rating, reviewCount, editorialSummary, featuredReview, reviews and
  featureId (the review-scrape key); GoogleReview is gone; PoiSection has
  no REVIEWS tab. GooglePoiDataSource no longer reads the rating /
  review / editorial slots, and its pb no longer asks for review posts
  (dropped !3sother_user_google_review_posts... and fixed the enclosing
  counts 8m10->8m9, 72m22->72m21, 24m107->24m106). A live A/B against
  the untrimmed request returned the same 20 results with identical
  name/website/phone/photos/hours/status.
- "Google" naming of things that were already offline: the map POI layer
  (GooglePoiMapViewModel/GooglePoiPin -> PoiMapViewModel/PoiPin, fed by
  PoiIndex.inViewport; rating/prominence fields that were never set are
  gone), and comments claiming Google search (search has been the
  offline index; traffic is api.maproj.org's first-party feed).
- Share link: OpenStreetMap URL instead of maps.google.com.

Archive path (unchanged, now the only one): PoiIndexAttrs keys 10/11/12 ->
osmPlace -> SpecificFeature.GenericPlace.rating/reviewCount/
reviewSummary -> PlaceSheetHeader (stars + "x stars | n reviews") and
PlaceSheet ReviewSummaryRow. The header no longer falls back to Google's
rating.

Still Google (opt-in via Settings > Google services, off by default):
StreetViewDataSource (maps.googleapis.com GeoPhotoService,
google.com/maps/photometa, streetviewpixels-pa tiles) and
GooglePoiDataSource (google.com/search?tbm=map). Inbound geo/Google-Maps
link handling (AndroidManifest intent filters, MapLinkParser) stays: it
parses links other apps send, no network.

Strings, consent text, settings description, maps/AGENTS.md overview
and key files, and metadata_data/maps.md updated (search is offline;
Google only for photos/hours and Street View). Tests reworked: Google
model/parser tests assert no review field exists and the request carries
no review-posts selector; header tests assert rating/count come only from
the archive; a PoiIndexTest pins attrs -> osmPlace -> rating/count/
summary; header and details-fetch tests now reveal the masked sheet
(they predate the mask and never ran because the test set did not
compile); the MapPageScope fixtures (Slice3Pass5, WideHost) gain
userSpeedMps and remember{} their chrome state (lint).

User-visible: no Reviews tab or Google review text/featured review/
editorial blurb; ratings and review summaries show offline and with
Google off wherever the archive has them (16.6k of 200k sampled POIs have
a rating); no hidden WebView process.

Diff

maps/AGENTS.md
diff --git a/maps/AGENTS.md b/maps/AGENTS.mdindex 48d42c6e55..f1dc9daad8 100644--- a/maps/AGENTS.md+++ b/maps/AGENTS.md@@ -16,7 +16,8 @@ _Install: ./install maps (dev by default)._ **Key features:** - On-device routing (drive/walk/bike/transit) over a single packed `.mamaps` archive, downloaded once on first launch; viewed areas keep working offline - Turn-by-turn navigation with voice (TTS), lane guidance, speed-limit widget, and elevation; Android Auto via `car/`-- Place details, saved places, transit departure boards, Street View, parking, and POI search (Google + offline index)+- Place details, saved places, transit departure boards, Street View, parking, and POI search (offline index from the archive; ratings/review counts/summaries are archive-only, `poi_attrs` keys 10-12)+- Google is used for exactly two opt-in features (Settings → Google services): Street View and non-review place details (photos, hours, phone/website, popular times) via `GooglePoiDataSource`. No Google search, traffic, POI discovery or reviews - Handles external `geo:` / `google.navigation:` / Google-Maps links from other apps **Architecture / data-flow:** `ui/` map surface + sheets over per-concern `util/` ViewModels (`SelectedFeatureViewModel`, `MapsSearchViewModel`, `SavedPlacesViewModel`, …) → `data/` stores/parsers + `util/OfflineRouter*` routing against the memory-mapped archive; guidance runs in the `util/NavigationService` foreground service via `NavigationSessionManager`. `onCreateBeforeContent`: `NetworkClient.init(FIRST_PARTY)` → delete the legacy `world_z0-6.pmtiles` → route the cold-start deep link; `Content()` gates on the `.mamaps` download before the map renders. **Entry points + reading order:** `Route` (`MapPage` / `SavedPlacesPage` / `SettingsPage`, inline) → `MainActivity.kt` (`handleIntent`, `navigateTo`) → `ui/MapPage.kt` → `util/SelectedFeatureViewModel.kt` → `util/OfflineRouterRoadRoutes.kt`.@@ -47,17 +48,12 @@ _Install: ./install maps (dev by default)._ - com/vayunmathur/maps/data/SavedPlaceStore.kt - com/vayunmathur/maps/data/RecentSearchStore.kt - com/vayunmathur/maps/data/ParkingStore.kt-- com/vayunmathur/maps/data/google/GoogleSearchDataSource.kt-- com/vayunmathur/maps/data/google/GooglePoiDataSource.kt-- com/vayunmathur/maps/data/google/GooglePoiDiscovery.kt+- com/vayunmathur/maps/data/google/GooglePoiDataSource.kt — Google place details (photos/hours/phone; no ratings/reviews) - com/vayunmathur/maps/data/google/GooglePoiModels.kt-- com/vayunmathur/maps/data/google/GooglePoiMapModels.kt+- com/vayunmathur/maps/data/PoiPin.kt — offline map POI pin - com/vayunmathur/maps/data/google/GoogleResponse.kt-- com/vayunmathur/maps/data/google/GoogleTrafficSource.kt - com/vayunmathur/maps/data/google/StreetViewDataSource.kt - com/vayunmathur/maps/data/google/StreetViewModels.kt-- com/vayunmathur/maps/data/google/ReviewsWebParser.kt-- com/vayunmathur/maps/data/google/WebReviewsFetcher.kt - com/vayunmathur/maps/data/transit/TransitousDataSource.kt - com/vayunmathur/maps/data/transit/TransitousModels.kt ### intents/ — assistant IPC@@ -151,7 +147,7 @@ _Install: ./install maps (dev by default)._ - com/vayunmathur/maps/util/SavedPlacesViewModel.kt - com/vayunmathur/maps/util/MapSettingsViewModel.kt - com/vayunmathur/maps/util/PlacePanelState.kt-- com/vayunmathur/maps/util/GooglePoiMapViewModel.kt+- com/vayunmathur/maps/util/PoiMapViewModel.kt — map POI pins from the offline index - com/vayunmathur/maps/util/TransitStopsViewModel.kt - com/vayunmathur/maps/util/TransitClock.kt - com/vayunmathur/maps/util/ParkingViewModel.kt@@ -167,11 +163,12 @@ _Install: ./install maps (dev by default)._ - com/vayunmathur/maps/util/NavigationTts.kt - com/vayunmathur/maps/util/PolylineProgress.kt - com/vayunmathur/maps/util/GTFSProvider.kt-- com/vayunmathur/maps/util/PoiArchive.kt - com/vayunmathur/maps/util/PoiIndex.kt - com/vayunmathur/maps/util/PoiIndexAttrs.kt - com/vayunmathur/maps/util/PoiIndexSpatial.kt - com/vayunmathur/maps/util/PoiIndexWords.kt+- com/vayunmathur/maps/util/PoiIndexRegion.kt — `poi_region` (kind 15) boundary links+- com/vayunmathur/maps/util/PoiArchive.kt — POI sections out of the archive (per-section mmaps; planet is ~80 GB) - com/vayunmathur/maps/util/PoiCategories.kt - com/vayunmathur/maps/util/SpatialKey.kt - com/vayunmathur/maps/util/RegionalUnits.kt
maps/src/main/AndroidManifest.xml
diff --git a/maps/src/main/AndroidManifest.xml b/maps/src/main/AndroidManifest.xmlindex f472c6caf9..dabb679e5a 100644--- a/maps/src/main/AndroidManifest.xml+++ b/maps/src/main/AndroidManifest.xml@@ -101,10 +101,6 @@             android:name=".util.NavigationService"             android:foregroundServiceType="location"             android:exported="false" />-        <service-            android:name=".service.ReviewsScraperService"-            android:process=":reviews"-            android:exported="false" />          <service             android:name=".car.MapsCarAppService"
maps/src/main/java/com/vayunmathur/maps/MainActivity.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/MainActivity.kt b/maps/src/main/java/com/vayunmathur/maps/MainActivity.ktindex e30a7d5f7a..1ce62fa6f3 100644--- a/maps/src/main/java/com/vayunmathur/maps/MainActivity.kt+++ b/maps/src/main/java/com/vayunmathur/maps/MainActivity.kt@@ -200,7 +200,7 @@ class MainActivity : MaActivity() {                     )                 }             }-            // A query only → run the Google search and auto-select the first hit+            // A query only → run the offline index search and auto-select the first hit             // (same path as the contact-address shortcut).             !query.isNullOrBlank() -> {                 val near = biasPosition()
maps/src/main/java/com/vayunmathur/maps/data/MapPreferences.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/data/MapPreferences.kt b/maps/src/main/java/com/vayunmathur/maps/data/MapPreferences.ktindex ebd946aa45..b6363de697 100644--- a/maps/src/main/java/com/vayunmathur/maps/data/MapPreferences.kt+++ b/maps/src/main/java/com/vayunmathur/maps/data/MapPreferences.kt@@ -22,7 +22,7 @@ object MapPreferences {     const val KEY_LAYER_TRANSIT = "layer_transit"      /**-     * Google services (place enrichment + reviews + Street View). OFF by+     * Google services (place details — photos/hours/phone, never reviews — + Street View). OFF by      * default: nothing contacts Google until the user opts in, via the      * first-launch consent dialog or the settings toggle. A null (never      * asked) value is treated as off — the dialog, not the default, decides.
maps/src/main/java/com/vayunmathur/maps/data/PoiPin.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/data/PoiPin.kt b/maps/src/main/java/com/vayunmathur/maps/data/PoiPin.ktnew file mode 100644index 0000000000..902581b9cf--- /dev/null+++ b/maps/src/main/java/com/vayunmathur/maps/data/PoiPin.kt@@ -0,0 +1,18 @@+package com.vayunmathur.maps.data++/**+ * One ambient POI pin on the map, from the archive's offline POI index (`PoiIndex`):+ * the minimum a pin needs — a stable id, a name, a position and the category label that+ * drives its colour. Tapping one re-selects the place, whose sheet then reads the+ * archive's attributes (hours, phone, rating, review summary) the same way search does.+ *+ * Formerly `GooglePoiPin`, from when pins were discovered by a Google viewport scrape;+ * nothing about a pin comes from Google any more.+ */+data class PoiPin(+    val id: String,+    val name: String,+    val lat: Double,+    val lng: Double,+    val category: String? = null,+)
maps/src/main/java/com/vayunmathur/maps/data/google/GooglePoiDataSource.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/data/google/GooglePoiDataSource.kt b/maps/src/main/java/com/vayunmathur/maps/data/google/GooglePoiDataSource.ktindex c56c6a54f5..8a65ec230f 100644--- a/maps/src/main/java/com/vayunmathur/maps/data/google/GooglePoiDataSource.kt+++ b/maps/src/main/java/com/vayunmathur/maps/data/google/GooglePoiDataSource.kt@@ -13,14 +13,18 @@ import kotlin.math.sin import kotlin.math.sqrt  /**- * Keyless Google Maps POI enrichment.+ * Keyless Google Maps place details: photos, hours/open status, phone, website, price+ * band, fuel price and popular times — and nothing review-shaped. Ratings, review+ * counts, summaries and review text come only from the offline archive+ * (`PoiIndexAttrs`), so this neither requests review posts (the `pb` carries no+ * review-posts selector) nor reads the rating/review/editorial slots of the response.  *  * Follows the NewPipe model: the device calls the same undocumented google.com/maps  * web endpoints a logged-out browser does — no API key, no first-party backend,  * no Play Services. The request is a `pb` protobuf-ish string; the response is a  * guard-prefixed, deeply nested *positional* JSON array (no field names). The- * calibrated index paths ([Paths]) pull rating/reviews/hours/price/website/- * photos/popular-times out of it.+ * calibrated index paths ([Paths]) pull hours/price/website/phone/photos/+ * popular-times out of it.  *  * This is a scrape of a private endpoint, so it is inherently fragile:  *  - a Google-side reshape makes fields go null (paths rot) — every accessor@@ -46,8 +50,7 @@ object GooglePoiDataSource {      // Browser-like identity. The endpoints authorise by referer + a normal     // desktop UA rather than a key, so these headers ARE the credential.-    // `internal` so [WebReviewsFetcher] reuses the same desktop UA for its hidden WebView.-    internal const val USER_AGENT =+    private const val USER_AGENT =         "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " +             "(KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"     private val REQUEST_HEADERS = mapOf(@@ -131,10 +134,6 @@ object GooglePoiDataSource {             // "no such place".             val root = GoogleResponse.parseOrNull(body) ?: return@withContext Outcome.Failed             val entry = pickEntry(root, lat, lon) ?: return@withContext Outcome.NoMatch-            // Reviews are no longer fetched here: the dead `listentitiesreviews` RPC 404s, and the-            // WebView scrape ([WebReviewsFetcher]) is async/slow, so it must NOT block base-            // enrichment. The base info carries reviews = emptyList(); the caller fills them in-            // progressively once it has [GooglePoiInfo.featureId].             parsePlace(entry)?.let { Outcome.Found(it) } ?: Outcome.NoMatch         } @@ -222,8 +221,6 @@ object GooglePoiDataSource {         val statusStr = rich ?: s118 ?: entry.at(*Paths.OPEN_STATUS).str()         val priceText = entry.at(*Paths.PRICE_TEXT).str()         val info = GooglePoiInfo(-            rating = entry.at(*Paths.RATING).dbl(),-            reviewCount = entry.at(*Paths.REVIEW_COUNT).int(),             priceText = priceText,             priceLevel = priceLevelOf(priceText),             website = entry.at(*Paths.WEBSITE).str(),@@ -231,14 +228,10 @@ object GooglePoiDataSource {             openNow = parseOpenNow(statusStr),             statusText = statusStr,             category = entry.at(*Paths.CATEGORY).str(),-            editorialSummary = entry.at(*Paths.EDITORIAL).str()?.trim()?.ifBlank { null },-            featuredReview = entry.at(*Paths.FEATURED_REVIEW).str()?.trim()-                ?.trim('"', '\u201C', '\u201D')?.ifBlank { null },             fuelPrice = parseFuelPrice(entry),             hours = parseHours(entry, prefer118 = rich == null && s118 != null),             photoUrls = parsePhotos(entry),             popularTimes = parsePopularTimes(entry),-            featureId = entry.at(*Paths.FEATURE_ID).str(),         )         // Ignore an entry that carried nothing but a name (no signal to show).         return if (info.isEmpty) null else info@@ -372,7 +365,13 @@ object GooglePoiDataSource {      /** Build the search `pb`. Calibrated template (2026-06): a plain `q=`      *  returns an empty envelope, so search needs this full pb, and results are-     *  viewport-driven (the `!2d<lng>!3d<lat>` block is the OSM point). */+     *  viewport-driven (the `!2d<lng>!3d<lat>` block is the OSM point).+     *+     *  Trimmed 2026-11 of the review-posts selector+     *  (`!3sother_user_google_review_posts__and__hotel_and_vr_partner_review_posts`, with its+     *  enclosing counts `!8m10`→`!8m9`, `!72m22`→`!72m21`, `!24m107`→`!24m106`); a live A/B+     *  against the untrimmed template returned the same 20 results with identical name,+     *  website, phone, photos, hours and status. */     private fun buildSearchPb(query: String, lat: Double, lon: Double): String =         SEARCH_PB_TEMPLATE             .replace("{QUERY}", query.replace('!', ' ').trim())@@ -387,12 +386,12 @@ object GooglePoiDataSource {             "!6b1!14b1!46m1!1b0!96b1!99b1!19m4!2m3!1i360!2i120!4i8!20m57!2m2!1i203!2i100!3m2!2i4!5b1" +             "!6m6!1m2!1i86!2i86!1m2!1i408!2i240!7m33!1m3!1e1!2b0!3e3!1m3!1e2!2b1!3e2!1m3!1e2!2b0!3e3" +             "!1m3!1e8!2b0!3e3!1m3!1e10!2b0!3e3!1m3!1e10!2b1!3e2!1m3!1e10!2b0!3e4!1m3!1e9!2b1!3e2!2b1" +-            "!9b0!15m8!1m7!1m2!1m1!1e2!2m2!1i195!2i195!3i20!15i9937!24m107!1m25!13m9!2b1!3b1!4b1!6i1" ++            "!9b0!15m8!1m7!1m2!1m1!1e2!2m2!1i195!2i195!3i20!15i9937!24m106!1m25!13m9!2b1!3b1!4b1!6i1" +             "!8b1!9b1!14b1!20b1!25b1!18m14!3b1!4b1!5b1!6b1!13b1!14b1!17b1!21b1!22b1!32b1!33m1!1b1" +             "!34b1!36e2!10m1!8e3!11m1!3e1!17b1!20m2!1e3!1e6!24b1!25b1!26b1!27b1!29b1!30m1!2b1!36b1" +             "!37b1!39m3!2m2!2i1!3i1!43b1!52b1!54m1!1b1!55b1!56m1!1b1!61m2!1m1!1e1!65m5!3m4!1m3!1m2" +-            "!1i224!2i298!72m22!1m8!2b1!5b1!7b1!12m4!1b1!2b1!4m1!1e1!4b1!8m10!1m6!4m1!1e1!4m1!1e3" +-            "!4m1!1e4!3sother_user_google_review_posts__and__hotel_and_vr_partner_review_posts!6m1" ++            "!1i224!2i298!72m21!1m8!2b1!5b1!7b1!12m4!1b1!2b1!4m1!1e1!4b1!8m9!1m6!4m1!1e1!4m1!1e3" ++            "!4m1!1e4!6m1" +             "!1e1!9b1!89b1!90m2!1m1!1e2!98m3!1b1!2b1!3b1!103b1!113b1!114m3!1b1!2m1!1b1!117b1!122m1" +             "!1b1!126b1!127b1!128m1!1b0!26m4!2m3!1i80!2i92!4i8!30m28!1m6!1m2!1i0!2i0!2m2!1i530!2i768" +             "!1m6!1m2!1i974!2i0!2m2!1i1024!2i768!1m6!1m2!1i0!2i0!2m2!1i1024!2i20!1m6!1m2!1i0!2i748" +@@ -413,17 +412,12 @@ object GooglePoiDataSource {         val LAT = intArrayOf(1, 9, 2)         val LNG = intArrayOf(1, 9, 3)         val CATEGORY = intArrayOf(1, 13, 0)-        val RATING = intArrayOf(1, 4, 7)-        val REVIEW_COUNT = intArrayOf(1, 4, 8)         val PRICE_TEXT = intArrayOf(1, 4, 2)         val WEBSITE = intArrayOf(1, 7, 0)         val PHONE = intArrayOf(1, 178, 0, 0)-        val FEATURE_ID = intArrayOf(1, 10)         val PHOTOS = intArrayOf(1, 72, 0)         // Hero photo inside the PHOTOS list.         val PHOTO_HERO = intArrayOf(6, 0)-        val FEATURED_REVIEW = intArrayOf(1, 142, 1, 0, 1, 0, 0)-        val EDITORIAL = intArrayOf(1, 32, 1, 1)         val OPEN_STATUS = intArrayOf(1, 203, 1, 8, 0)         val STATUS_RICH = intArrayOf(1, 203, 1, 4, 0)         val STATUS_118 = intArrayOf(1, 118, 0, 3, 1, 4, 0)
maps/src/main/java/com/vayunmathur/maps/data/google/GooglePoiMapModels.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/data/google/GooglePoiMapModels.kt b/maps/src/main/java/com/vayunmathur/maps/data/google/GooglePoiMapModels.ktdeleted file mode 100644index 3271a1e61f..0000000000--- a/maps/src/main/java/com/vayunmathur/maps/data/google/GooglePoiMapModels.kt+++ /dev/null@@ -1,21 +0,0 @@-package com.vayunmathur.maps.data.google--/**- * List-oriented model for the custom Google POI overlay layer.- *- * [GooglePoiInfo] (the bottom-sheet enrichment) deliberately carries no id, no- * lat/lng and no name — the caller already knew the place and supplied its- * position. Map pins are the opposite: we discover many places from a viewport- * scrape and must be able to draw each one and, on tap, re-select it. So this- * fills that gap with the minimum a pin needs: a stable id, a name, a position,- * plus category/rating for styling and [prominence] for ranking/limiting.- */-data class GooglePoiPin(-    val id: String,-    val name: String,-    val lat: Double,-    val lng: Double,-    val category: String? = null,-    val rating: Double? = null,-    val prominence: Double = 0.0,-)
maps/src/main/java/com/vayunmathur/maps/data/google/GooglePoiModels.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/data/google/GooglePoiModels.kt b/maps/src/main/java/com/vayunmathur/maps/data/google/GooglePoiModels.ktindex 0046280587..7bf372d147 100644--- a/maps/src/main/java/com/vayunmathur/maps/data/google/GooglePoiModels.kt+++ b/maps/src/main/java/com/vayunmathur/maps/data/google/GooglePoiModels.kt@@ -1,8 +1,13 @@ package com.vayunmathur.maps.data.google  /**- * Clean, null-safe model of the POI enrichment scraped from Google Maps' keyless- * web endpoints. Every field is nullable/optional because no single response+ * Clean, null-safe model of the NON-review place details fetched from Google Maps'+ * keyless web endpoints: photos, hours/open status, phone, website, price band, fuel+ * price and popular times. Ratings, review counts, review summaries and review text+ * are deliberately absent — those come only from the offline archive's POI attributes+ * (`poi_attrs` keys 10/11/12, see `PoiIndexAttrs.kt`), never from Google.+ *+ * Every field is nullable/optional because no single response  * fills all of them (a keyless response is bot-degraded — popular times and the  * full photo gallery are usually stripped), and because the scrape is fragile:  * a Google-side reshape makes individual fields go null while the rest survive.@@ -11,8 +16,6 @@ package com.vayunmathur.maps.data.google  * field is empty — and the parse never throws.  */ data class GooglePoiInfo(-    val rating: Double? = null,-    val reviewCount: Int? = null,     val priceText: String? = null,      // Google's own label, e.g. "$10–20" / "$$"     val priceLevel: Int? = null,        // derived 1..4     val website: String? = null,@@ -20,23 +23,19 @@ data class GooglePoiInfo(     val openNow: Boolean? = null,     val statusText: String? = null,     // e.g. "Open · Closes 9 PM"     val category: String? = null,-    val editorialSummary: String? = null,-    val featuredReview: String? = null,     val fuelPrice: FuelPrice? = null,   // gas stations only     // Only ever today, e.g. ["Tuesday: 6 AM–10 PM"] — the search response carries no     // weekly schedule (calibrated 2026-09; see readHours in GooglePoiDataSource).     val hours: List<String> = emptyList(),     val photoUrls: List<String> = emptyList(),  // FIFE image URLs, resized for thumbnails-    val reviews: List<GoogleReview> = emptyList(),     val popularTimes: PoiPopularTimes? = null,-    val featureId: String? = null,      // "0x..:0x.." → reviews RPC ) {     /** True when nothing worth showing came back — the UI shows no enrichment. */     val isEmpty: Boolean-        get() = rating == null && reviewCount == null && priceText == null && website == null &&-            phone == null && statusText == null && editorialSummary == null && featuredReview == null &&+        get() = priceText == null && website == null &&+            phone == null && statusText == null &&             fuelPrice == null &&-            hours.isEmpty() && photoUrls.isEmpty() && reviews.isEmpty() && popularTimes == null+            hours.isEmpty() && photoUrls.isEmpty() && popularTimes == null }  /**@@ -49,16 +48,6 @@ data class GooglePoiInfo(  */ data class FuelPrice(val price: String, val grade: String) -/** A single user review. [rating] is 1..5; [text] is null for rating-only reviews. */-data class GoogleReview(-    val author: String,-    val authorPhoto: String?,-    val rating: Int,-    val relativeTime: String?,-    val text: String?,-    val photos: List<String> = emptyList(),-)- /** Google's "popular times": a typical-busyness histogram per day of the week. */ data class PoiPopularTimes(val days: List<PoiDayBusyness>) @@ -70,11 +59,12 @@ data class PoiHourBusyness(val hour: Int, val occupancy: Int)  /**  * One tab's worth of the enrichment. The place sheet shows exactly one of these at a- * time, so what used to be three stacked sections is now three destinations.+ * time. There is no reviews tab: the archive's rating/count sit in the header and its+ * review summary in Details.  *  * Here rather than beside the composable that renders it because the selected section  * outlives that composable: it is held on `SelectedFeatureViewModel` so the tab row (in  * the sheet's measured header) and the panel it switches (below the fold) can agree, and  * a view model naming a type from the `ui` package would invert the module's layering.  */-enum class PoiSection { DETAILS, PHOTOS, REVIEWS }+enum class PoiSection { DETAILS, PHOTOS }
maps/src/main/java/com/vayunmathur/maps/data/google/ReviewsWebParser.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/data/google/ReviewsWebParser.kt b/maps/src/main/java/com/vayunmathur/maps/data/google/ReviewsWebParser.ktdeleted file mode 100644index 4b59965289..0000000000--- a/maps/src/main/java/com/vayunmathur/maps/data/google/ReviewsWebParser.kt+++ /dev/null@@ -1,46 +0,0 @@-package com.vayunmathur.maps.data.google--import kotlinx.serialization.json.Json-import kotlinx.serialization.json.contentOrNull-import kotlinx.serialization.json.intOrNull-import kotlinx.serialization.json.jsonArray-import kotlinx.serialization.json.jsonObject-import kotlinx.serialization.json.jsonPrimitive--/**- * Parses the reviews JSON that [WebReviewsFetcher] builds by reading Google Maps' rendered review- * DOM — Google **deleted** the keyless `listentitiesreviews` endpoint (404) and moved reviews- * behind a `batchexecute` RPC (`rpcids=T4jwAf`) whose proto resisted capture, so we read the- * reviews the real browser engine renders instead.- *- * Parses OUR [GoogleReview] model from the reviews JSON. Each element is- * `{rid:reviewId, r:rating, a:author, d:relativeDate, t:text, av:avatarUrl, p:[photoUrls]}` — `rid`- * is the scraper's cross-scroll de-dup key, ignored here. An element without an author is dropped- * (a card whose name never resolved isn't renderable). Best-effort: a malformed blob → empty list.- */-object ReviewsWebParser {-    /** Google star ratings run 0..5. */-    private const val MIN_RATING = 0-    private const val MAX_RATING = 5--    fun parse(json: String): List<GoogleReview> = runCatching {-        Json.parseToJsonElement(json).jsonArray.mapNotNull { el ->-            val o = el.jsonObject-            val author = o["a"]?.jsonPrimitive?.contentOrNull?.trim().orEmpty()-            if (author.isBlank()) return@mapNotNull null-            val photos = o["p"]?.jsonArray-                ?.mapNotNull { it.jsonPrimitive.contentOrNull }-                ?.filter { it.startsWith("http") }-                ?.distinct()-                .orEmpty()-            GoogleReview(-                author = author,-                authorPhoto = o["av"]?.jsonPrimitive?.contentOrNull?.takeIf { it.startsWith("http") },-                rating = (o["r"]?.jsonPrimitive?.intOrNull ?: 0).coerceIn(MIN_RATING, MAX_RATING),-                relativeTime = o["d"]?.jsonPrimitive?.contentOrNull?.ifBlank { null },-                text = o["t"]?.jsonPrimitive?.contentOrNull?.ifBlank { null },-                photos = photos,-            )-        }-    }.getOrDefault(emptyList())-}
maps/src/main/java/com/vayunmathur/maps/data/google/WebReviewsFetcher.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/data/google/WebReviewsFetcher.kt b/maps/src/main/java/com/vayunmathur/maps/data/google/WebReviewsFetcher.ktdeleted file mode 100644index 61ffaa683f..0000000000--- a/maps/src/main/java/com/vayunmathur/maps/data/google/WebReviewsFetcher.kt+++ /dev/null@@ -1,401 +0,0 @@-package com.vayunmathur.maps.data.google--import android.annotation.SuppressLint-import android.content.Context-import android.os.Handler-import android.os.Looper-import android.webkit.JavascriptInterface-import android.webkit.WebResourceRequest-import android.webkit.WebView-import android.webkit.WebViewClient-import kotlinx.coroutines.CompletableDeferred-import kotlinx.coroutines.Dispatchers-import kotlinx.coroutines.sync.Mutex-import kotlinx.coroutines.sync.withLock-import kotlinx.coroutines.withContext-import kotlinx.coroutines.withTimeoutOrNull-import java.math.BigInteger-import java.util.concurrent.ConcurrentHashMap-import java.util.concurrent.atomic.AtomicInteger--/**- * Fetches a place's reviews through a hidden [WebView] — the keyless reviews source after Google- * **deleted** the old `listentitiesreviews` endpoint (now HTTP 404) and moved reviews behind a- * `batchexecute` RPC (`rpcids=T4jwAf`) whose request proto resisted capture.- *- * Rather than replay that RPC, we let Google's- * own JS render the reviews (loading the place's canonical `?cid=` page, anonymous/no-login,- * desktop UA) and read them back out of the DOM: per review the star rating, author, relative date,- * text **and the reviewer's uploaded photos**. The page builds a JSON array over a JS bridge;- * [ReviewsWebParser] turns it into [GoogleReview]s.- *- * Strictly best-effort + lazy: any failure/timeout returns empty and the place sheet just shows no- * reviews. Serialized by a [Mutex] since the single WebView navigates per place.- *- * Only ever constructed inside [com.vayunmathur.maps.service.ReviewsScraperService]'s `:reviews`- * process: loading Chromium pins ~100 MB that `WebView.destroy()` never unmaps, so it must live in- * a process that can exit.- */-class WebReviewsFetcher(private val context: Context) {-    private val pending = ConcurrentHashMap<String, CompletableDeferred<String>>()-    private val progress = ConcurrentHashMap<String, (Int) -> Unit>()-    private val partial = ConcurrentHashMap<String, (String) -> Unit>()-    private val seq = AtomicInteger()-    private val mutex = Mutex()-    private val main = Handler(Looper.getMainLooper())--    @Volatile private var webView: WebView? = null--    private inner class Bridge {-        @JavascriptInterface-        fun onResult(id: String, payload: String) {-            pending.remove(id)?.complete(payload)-        }--        // Live "N reviews found so far" ticks from the scraper (the scrape runs ~10-40 s on busy-        // pages). Arrives on the WebView's JavaBridge thread — the callback must be thread-safe.-        @JavascriptInterface-        fun onProgress(id: String, n: Int) {-            progress[id]?.invoke(n)-        }--        // The accumulated reviews SO FAR, sent whenever the count grows — the sheet streams them-        // into the list under the progress bar instead of making the user stare at a bar for 30 s.-        // Same JavaBridge thread; the raw JSON is parsed by the client (the final onResult is-        // authoritative).-        @JavascriptInterface-        fun onPartial(id: String, payload: String) {-            partial[id]?.invoke(payload)-        }-    }--    /** Raw reviews JSON (see [ReviewsWebParser]) for [featureId] (`0x..:0x..`) — newest/most-relevant-     *  first as Google renders them, each with its uploaded photos — or null on any failure.-     *  [onProgress] streams the running count while the scrape is in flight; [onPartial] streams the-     *  accumulated reviews JSON (a growing prefix of the final result). Both are called off the main-     *  thread. */-    suspend fun fetch(-        featureId: String,-        onProgress: (Int) -> Unit = {},-        onPartial: (String) -> Unit = {},-    ): String? {-        val cid = cidOf(featureId) ?: return null-        return mutex.withLock { fetchLocked(cid, onProgress, onPartial) }-    }--    private suspend fun fetchLocked(-        cid: String,-        onProgress: (Int) -> Unit,-        onPartial: (String) -> Unit,-    ): String? {-        return run {-            val id = BRIDGE_ID_PREFIX + seq.incrementAndGet()-            val deferred = CompletableDeferred<String>()-            pending[id] = deferred-            progress[id] = onProgress-            partial[id] = onPartial-            val raw = try {-                withTimeoutOrNull(TOTAL_TIMEOUT_MS) {-                    withContext(Dispatchers.Main) {-                        val wv = ensureWebView()-                        val ready = CompletableDeferred<Unit>()-                        wv.webViewClient = object : WebViewClient() {-                            override fun shouldOverrideUrlLoading(-                                view: WebView?,-                                request: WebResourceRequest?,-                            ): Boolean {-                                // Only google.com pages — a stray click on an external link (e.g. the-                                // place's website/menu action) must not navigate the hidden WebView away.-                                val u = request?.url ?: return false-                                val scheme = u.scheme-                                if (scheme != "https" && scheme != "http") return true-                                val host = u.host.orEmpty()-                                return !(host == "google.com" || host.endsWith(".google.com"))-                            }-                            override fun onPageFinished(view: WebView?, url: String?) {-                                main.postDelayed({ if (!ready.isCompleted) ready.complete(Unit) }, SETTLE_MS)-                            }-                        }-                        // Blank the PREVIOUS place's DOM before navigating — a slow load could otherwise-                        // let the MAX_LOAD fallback inject the scraper into the old page and return the-                        // previous place's reviews for THIS featureId (empty > wrong).-                        wv.evaluateJavascript("try{document.documentElement.innerHTML=''}catch(e){}", null)-                        wv.loadUrl("https://www.google.com/maps?cid=$cid&hl=en&gl=us")-                        // Proceed even if the SPA's onPageFinished is slow.-                        main.postDelayed({ if (!ready.isCompleted) ready.complete(Unit) }, MAX_LOAD_MS)-                        ready.await()-                        wv.evaluateJavascript(-                            extractScript(id, SCRAPE_REVIEW_CAP),-                            null,-                        )-                    }-                    deferred.await()-                }-            } finally {-                pending.remove(id)-                progress.remove(id)-                partial.remove(id)-            }-            raw?.ifEmpty { null }-        }-    }--    /** The Google "cid" = the LOW half of the `0xHIGH:0xLOW` feature id as an unsigned decimal — the-     *  canonical `maps.google.com?cid=` deep-link to a place. */-    private fun cidOf(featureId: String): String? {-        val low = featureId.substringAfter(":", "").removePrefix("0x").ifBlank { return null }-        return runCatching { BigInteger(low, CID_RADIX).toString() }.getOrNull()-    }--    @SuppressLint("SetJavaScriptEnabled")-    private fun ensureWebView(): WebView {-        webView?.let { return it }-        val wv = WebView(context)-        wv.settings.javaScriptEnabled = true-        wv.settings.domStorageEnabled = true-        // Desktop UA so Google serves the desktop web Maps (a mobile UA deep-links to intent://).-        wv.settings.userAgentString = GooglePoiDataSource.USER_AGENT-        wv.addJavascriptInterface(Bridge(), "ReviewsBridge")-        // Give the hidden (never-attached) WebView a REAL offscreen viewport. Google's reviews list is-        // virtualized + lazy-loaded off the scroll viewport; a 0×0 headless WebView renders the chrome-        // (rating histogram, topic filters) but NEVER the review cards. A tall explicit layout makes the-        // scroll pane real so the list renders + pages.-        wv.measure(-            android.view.View.MeasureSpec.makeMeasureSpec(WV_WIDTH, android.view.View.MeasureSpec.EXACTLY),-            android.view.View.MeasureSpec.makeMeasureSpec(WV_HEIGHT, android.view.View.MeasureSpec.EXACTLY),-        )-        wv.layout(0, 0, WV_WIDTH, WV_HEIGHT)-        // A never-attached WebView reads as a BACKGROUND page to Chromium: JS timers throttle-        // toward 1 Hz and rAF-driven rendering slows, which is why the visible Google Maps-        // WebView pages reviews near-instantly while this scrape crawled. Explicitly resume-        // the view + its timers so the renderer runs at foreground cadence.-        wv.onResume()-        wv.resumeTimers()-        webView = wv-        return wv-    }--    /** Self-polling DOM scraper: open the full reviews list, then scroll it a window at a time,-     *  ACCUMULATING each review card into a keyed set (Google virtualizes the panel — it recycles-     *  DOM nodes as you scroll, so any single snapshot holds only ~10 cards; the union across scroll-     *  positions is the full list). Bridges the accumulated JSON array back once the list is exhausted-     *  or the cap is hit. */-    private fun extractScript(id: String, cap: Int): String {-        val idj = "\"" + id.replace("\\", "\\\\").replace("\"", "\\\"") + "\""-        return listOf(-            scraperHeader(idj, cap),-            scraperCardHelpers,-            scraperExtract,-            scraperDomUtils,-            scraperOpenFull,-            scraperTick,-            scraperFooter,-        ).joinToString("\n")-    }--    private fun scraperHeader(idj: String, cap: Int): String = """-            (function(){-              var ID=$idj, tries=0, opened=false, acc={}, accN=0, lastN=0, noGrow=0, atBottom=0;-              var openedAt=-1, lastRep=-1, openedBy='', sawEntry=false, everCards=false, btnReclicks=0;-              var CAP=$cap;-    """.trimIndent()--    private val scraperCardHelpers = """-              function num(s){ var m=(s||'').match(/([0-9.]+)\s*star/i); return m?Math.round(parseFloat(m[1])):0; }-              function t1(c,sel){ var e=c.querySelector(sel); return e?(e.textContent||'').trim():''; }-    """.trimIndent()--    private val scraperExtract = """-              function extract(){-                // Review cards are `.jJc9Ad`, each with a unique `data-review-id` — far more robust than the-                // old "div with one star + text" heuristic, which also matched the place header ("4.6 stars-                // (57,969)") and affiliate ticket cards, and missed most real reviews.-                var revs=[].slice.call(document.querySelectorAll('.jJc9Ad'));-                return revs.map(function(c){-                  var idEl=c.querySelector('[data-review-id]'); var rid=idEl?(idEl.getAttribute('data-review-id')||''):'';-                  var star=c.querySelector('[role="img"][aria-label*="star" i], span[aria-label*=" star" i]');-                  // author: Google's review name class, else pull the NAME out of a button aria — the-                  // name is always right before "'s review" (after a "Share "/"Photo N on " prefix) or-                  // after "Photo of ". (Class names rotate; the aria phrasing is stable + semantic.)-                  var author=t1(c,'.d4r55')||t1(c,'.Vpc5Fe')||t1(c,'.TSUbDb');-                  if(!author){ var bs=[].slice.call(c.querySelectorAll('button[aria-label],a[aria-label]'));-                    var strip=/^(?:Share|Like|Response from|Photo of|Photo\s*\d*\s*on|\+?\s*\d*\s*(?:more\s*)?photos?\s*on|\d+\s*photos?\s*on)\s+/i;-                    for(var i=0;i<bs.length;i++){ var a=bs[i].getAttribute('aria-label')||'';-                      var m=a.match(/^(.+?)'s review\b/); var cand=m?m[1]:(a.match(/^Photo of (.+)${'$'}/)||[])[1];-                      if(cand){ var nm=cand.replace(strip,'').trim(); if(nm){ author=nm; break; } } } }-                  // review text: the wiI7pd body, else the longest leaf span that isn't chrome.-                  var text=t1(c,'.wiI7pd');-                  if(!text){ var best=0; [].slice.call(c.querySelectorAll('span')).forEach(function(s){ if(s.childElementCount===0){ var tt=(s.textContent||'').trim(); if(tt.length>best && tt.length>12 && !/^(see more|more|like|share|response from|local guide)/i.test(tt) && !/\bstar/i.test(tt)){ best=tt.length; text=tt; } } }); }-                  // relative date. `.rsqaWe` is the date element when present; else scan leaf spans.-                  // The old fallback grabbed the FIRST span merely CONTAINING "ago" (tt<22, /\bago\b/) —-                  // which also matches a short sentence in the review body ("been pthere ago"… any body-                  // span with "ago") and only knew English "ago"/bare-year. Anchor to the full relative--                  // date shape ("10 months ago", "a year ago", "Edited 2 weeks ago") or a lone year,-                  // skip owner "Response" lines, and skip spans whose text is part of the review body —-                  // so we pick the real date, not a phrase out of the prose.-                  var date=t1(c,'.rsqaWe');-                  if(!date){ var body=(text||'').toLowerCase();-                    var reRel=/^(?:edited\s+)?(?:an?|\d+)\s+(?:second|minute|hour|day|week|month|year)s?\s+ago${'$'}/i;-                    [].slice.call(c.querySelectorAll('span')).forEach(function(s){ if(date||s.childElementCount>0) return;-                      var tt=(s.textContent||'').trim();-                      if(tt.length<28 && (reRel.test(tt)||/^20\d\d${'$'}/.test(tt)) && !/^response/i.test(tt) && body.indexOf(tt.toLowerCase())<0) date=tt; }); }-                  var avatar=''; var ai=c.querySelector('img'); if(ai && /googleusercontent/.test(ai.src||'')) avatar=ai.src;-                  var photos=[];-                  function addPhoto(u){ if(u && u!==avatar && /googleusercontent/.test(u) && !/\/a[\/-]|ACg8oc|ALV-/.test(u) && photos.indexOf(u)<0) photos.push(u); }-                  // Uploaded review photos are a <button>/<a> with a background-image on most layouts, but-                  // some cards expose them as plain <img> tiles — collect BOTH (avatar-filtered) so a card-                  // whose photos aren't button-backed still gets a tappable, author·date-captioned strip.-                  // (Was button-background-only, which silently dropped the whole strip on those cards.)-                  [].slice.call(c.querySelectorAll('button,a')).forEach(function(b){-                    var bg=''; try{ bg=getComputedStyle(b).backgroundImage||''; }catch(e){}-                    var mm=bg.match(/url\(["']?(https:\/\/[^"')]+googleusercontent[^"')]+)/);-                    if(mm) addPhoto(mm[1]);-                  });-                  [].slice.call(c.querySelectorAll('img')).forEach(function(im){ addPhoto(im.src||''); });-                  return { rid:rid, r:num(star&&star.getAttribute('aria-label')), a:author.slice(0,80), d:date, t:text, av:avatar, p:photos.slice(0,10) };-                  // Require an AUTHOR (rid stays the de-dup key): the parser drops author-less entries-                  // anyway, so letting them through only wastes CAP slots on cards we can't render.-                }).filter(function(x){ return x.a; });-              }-    """.trimIndent()--    private val scraperDomUtils = """-              // Expand truncated review bodies. The class hook (`.w8nwRe` is the card's More toggle)-              // works in EVERY UI language; the label regex stays as a fallback for older layouts-              // (it only knows English, which silently skipped expansion under any other hl).-              function expand(){-                [].slice.call(document.querySelectorAll('button.w8nwRe')).forEach(function(b){ try{ b.click(); }catch(e){} });-                [].slice.call(document.querySelectorAll('button')).forEach(function(b){ var l=((b.getAttribute('aria-label')||b.textContent)||'').trim(); if(/^(see more|more)${'$'}/i.test(l)){ try{ b.click(); }catch(e){} } });-              }-              // De-dupe across scroll windows by the review's stable id (falls back to author+date+text).-              function key(x){ return x.rid || ((x.a||'')+'|'+(x.d||'')+'|'+((x.t||'').slice(0,48))); }-              // The accumulated reviews so far, capped — used for both the partial streams and the-              // final result, so a partial is always a prefix-consistent snapshot of the final list.-              function snap(){ var o=[]; for(var k in acc) o.push(acc[k]); return o.slice(0,CAP); }-              // Scroll each tall left-column panel down by ~80% of a viewport (windows overlap so no-              // card is skipped past). Returns true if anything actually moved (false ⇒ at the bottom).-              function scrollStep(){-                var moved=false;-                try{ [].slice.call(document.querySelectorAll('div')).forEach(function(d){-                  if(d.scrollHeight>d.clientHeight+200 && d.clientHeight>250 && d.getBoundingClientRect().left<640){-                    var before=d.scrollTop; d.scrollTop=Math.min(d.scrollHeight, d.scrollTop+Math.round(d.clientHeight*0.8));-                    if(d.scrollTop>before+5) moved=true;-                  }-                }); }catch(e){}-                return moved;-              }-    """.trimIndent()--    private val scraperOpenFull = """-              // Open the FULL reviews list. The canonical entry is the "Reviews" role=tab; fall back to a-              // "More reviews" button for layouts that only expose that. On busy pages (food/retail) the-              // tab's list can take ~8 s to render after the click — the idle-bail is gated on `sawCards`-              // below so we never quit during that blank window (that was the "only 3 reviews" bug).-              function openFull(){-                // Prefer the "Reviews" role=tab. Click it every tick UNTIL it actually reports selected —-                // a click on a not-yet-hydrated tab silently no-ops, so one-and-done can leave the list-                // unopened. Once selected we latch `opened` and STOP clicking: re-clicking a selected-but--                // still-loading list restarts its ~8 s render (that regression turned busy pages back to 3).-                var ts=[].slice.call(document.querySelectorAll('[role="tab"]'));-                for(var i=0;i<ts.length;i++){-                  var tl=((ts[i].getAttribute('aria-label')||ts[i].textContent)||'').trim();-                  if(/^reviews\b/i.test(tl)){-                    sawEntry=true;-                    if((ts[i].getAttribute('aria-selected')||'')==='true'){ if(!opened){ opened=true; openedAt=tries; openedBy='tab'; } return; }-                    try{ ts[i].click(); }catch(e){}-                    return;-                  }-                }-                // No reviews tab in this layout — fall back to the "More reviews" button. Unlike the-                // tab there's no aria-selected to confirm the click took, so it's clicked once and-                // the tick loop re-arms it ONE time if nothing ever renders (a not-yet-hydrated-                // button silently no-ops, same as the tab).-                if(opened) return;-                var bs=[].slice.call(document.querySelectorAll('button'));-                for(var i=0;i<bs.length;i++){ var l=((bs[i].getAttribute('aria-label')||bs[i].textContent)||''); if(/more reviews/i.test(l)){ sawEntry=true; try{ bs[i].click(); }catch(e){} opened=true; openedAt=tries; openedBy='btn'; return; } }-              }-    """.trimIndent()--    private val scraperTick = """-              function tick(){-                tries++;-                // Let the SPA hydrate a beat before clicking the Reviews tab — clicking a not-yet-live-                // tab on tick 1 can silently no-op, and then the list only renders much later.-                if(tries>=2) openFull();-                expand();-                // ACCUMULATE this window's cards (don't replace) — the panel virtualizes, so each-                // scroll position exposes a fresh ~10 that would otherwise be lost when recycled.-                // Except the TEXT: a card is often harvested on the tick its More toggle was-                // clicked, before Google's async re-render swaps in the full body — so a longer-                // text for a known key REPLACES the stored entry (the "…"-truncated first capture-                // otherwise won forever; the ellipsis was in our data, not the UI).-                var revs=extract();-                for(var i=0;i<revs.length;i++){ var k=key(revs[i]); if(k.length>2){ if(!acc[k]){ acc[k]=revs[i]; accN++; } else if((revs[i].t||'').length>(acc[k].t||'').length){ acc[k]=revs[i]; } } }-                // Stream progress whenever the count grows: the running count (drives the "N of ~M"-                // bar) AND the accumulated reviews themselves, so the sheet fills in under the bar-                // while the scrape grinds instead of making the user stare at a bar for 30 s.-                if(accN!==lastRep){ lastRep=accN;-                  try{ ReviewsBridge.onProgress(ID, accN); }catch(e){}-                  try{ ReviewsBridge.onPartial(ID, JSON.stringify(snap())); }catch(e){}-                }-                // Are review cards rendered RIGHT NOW? On busy business pages (food, retail) the Reviews-                // tab's list can take ~8 s to populate after the click; until then the panel holds only-                // the rating histogram + topic chips, NOT the cards. This must be a per-tick check, not a-                // once-latched flag: the OVERVIEW's 3 preview cards render briefly before the tab click-                // blanks the panel, and a latch set by those let the idle-bail fire during the blank-                // window with exactly 3 accumulated (the "loaded 3 then stopped" bug).-                var cardsNow = document.querySelectorAll('.jJc9Ad').length>0;-                if(cardsNow) everCards=true;-                var moved=scrollStep();-                atBottom = moved ? 0 : atBottom+1;-                noGrow = (accN===lastN) ? noGrow+1 : 0;-                lastN=accN;-                // Button-path no-op retry: the click was fired blind (no aria-selected to confirm)-                // and nothing has rendered since — re-arm openFull once. Tab clicks self-retry.-                if(opened && openedBy==='btn' && !everCards && tries>=openedAt+18 && btnReclicks<1){ opened=false; openedAt=-1; btnReclicks++; }-                // Idle-bail ONLY while cards are actually on screen. When an entry (tab/button)-                // exists but hasn't opened yet, hold longer so a late-hydrating tab still gets its-                // click; a layout with NO entry at all (a tiny place whose full list IS the-                // overview) settles quickly — there's nothing more to open.-                var settled = cardsNow && (opened ? tries>=openedAt+13 : (sawEntry ? tries>=30 : tries>=17));-                // Zero-review places: no card will EVER render, so "settled" never fires — bail on-                // a generous empty deadline instead of grinding to the 60-tick hard stop (~33 s of-                // blank spinner on every review-less place).-                var emptyDone = !everCards && accN===0 && (opened ? tries>=openedAt+52 : tries>=65);-                // Idle patience: the OPENED full list pages over the network — Google's lazy-loader-                // routinely takes >2 s to fetch the next ~10 on a busy place, and 4 quiet ticks-                // (2.2 s) misread that as "done" (Taco Bell returned ~15 of 612). The unopened-                // overview has nothing to page, so it keeps the short fuse.-                var idle = opened ? (atBottom>=13 && noGrow>=18) : (atBottom>=9 && noGrow>=9);-                // Done: cap hit, OR settled at the bottom with no new reviews, OR provably empty,-                // OR ran long.-                if( accN>=CAP || (settled && idle) || emptyDone || tries>130 ){-                  try{ ReviewsBridge.onResult(ID, JSON.stringify(snap())); }catch(e){ try{ ReviewsBridge.onResult(ID,'[]'); }catch(e2){} }-                  return;-                }-                setTimeout(tick, 250);-              }-    """.trimIndent()--    private val scraperFooter = """-              tick();-            })();-    """.trimIndent()--    private companion object {-        // Must outlast the script's own hard stop (130 ticks × 250 ms ≈ 33 s + page load) — if Kotlin-        // times out first we return EMPTY, which is worse than few. Lazy + best-effort as ever.-        const val TOTAL_TIMEOUT_MS = 45_000L-        const val SETTLE_MS = 150L-        const val MAX_LOAD_MS = 7_000L-        // Offscreen viewport for the headless WebView — tall so the virtualized review list renders a-        // healthy batch per scroll position.-        const val WV_WIDTH = 1200-        const val WV_HEIGHT = 6000-        // JS bridge request ids and the scraper's own review cap (was a `var CAP=50` literal).-        const val BRIDGE_ID_PREFIX = "r"-        const val SCRAPE_REVIEW_CAP = 50-        // The Google "cid" is the LOW half of `0xHIGH:0xLOW` as hex.-        const val CID_RADIX = 16-    }-}
maps/src/main/java/com/vayunmathur/maps/service/ReviewsScraperClient.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/service/ReviewsScraperClient.kt b/maps/src/main/java/com/vayunmathur/maps/service/ReviewsScraperClient.ktdeleted file mode 100644index 722df4f231..0000000000--- a/maps/src/main/java/com/vayunmathur/maps/service/ReviewsScraperClient.kt+++ /dev/null@@ -1,133 +0,0 @@-package com.vayunmathur.maps.service--import android.content.ComponentName-import android.content.Context-import android.content.Intent-import android.content.ServiceConnection-import android.os.Bundle-import android.os.Handler-import android.os.IBinder-import android.os.Looper-import android.os.Message-import android.os.Messenger-import android.os.RemoteException-import com.vayunmathur.maps.data.google.GoogleReview-import com.vayunmathur.maps.data.google.ReviewsWebParser-import com.vayunmathur.maps.service.ReviewsScraperService.Companion.KEY_FEATURE_ID-import com.vayunmathur.maps.service.ReviewsScraperService.Companion.KEY_JSON-import com.vayunmathur.maps.service.ReviewsScraperService.Companion.MSG_CANCEL-import com.vayunmathur.maps.service.ReviewsScraperService.Companion.MSG_FETCH-import com.vayunmathur.maps.service.ReviewsScraperService.Companion.MSG_PARTIAL-import com.vayunmathur.maps.service.ReviewsScraperService.Companion.MSG_RESULT-import kotlinx.coroutines.CompletableDeferred-import kotlinx.coroutines.Dispatchers-import kotlinx.coroutines.NonCancellable-import kotlinx.coroutines.channels.Channel-import kotlinx.coroutines.withContext-import java.util.concurrent.ConcurrentHashMap-import java.util.concurrent.atomic.AtomicInteger--/**- * Map-process side of [ReviewsScraperService]: binds on demand, streams parsed reviews back, and- * unbinds after [IDLE_UNBIND_MS] without requests so the `:reviews` process (and Chromium) exits.- * Best-effort like the scraper itself: any IPC failure yields an empty list.- */-class ReviewsScraperClient(context: Context) {-    private sealed interface Event {-        data class Partial(val json: String) : Event-        data class Result(val json: String?) : Event-    }--    private val app = context.applicationContext-    private val main = Handler(Looper.getMainLooper())-    private val requests = ConcurrentHashMap<Int, Channel<Event>>()-    private val seq = AtomicInteger()-    private val incoming = Messenger(Handler(Looper.getMainLooper()) { onReply(it); true })-    private val idleUnbind = Runnable { disconnect() }--    // Main thread only.-    private var remote: CompletableDeferred<Messenger?>? = null-    private var connection: ServiceConnection? = null--    suspend fun fetch(featureId: String, onPartial: (List<GoogleReview>) -> Unit): List<GoogleReview> {-        val id = seq.incrementAndGet()-        val events = Channel<Event>(Channel.UNLIMITED)-        requests[id] = events-        var service: Messenger? = null-        try {-            val svc = withContext(Dispatchers.Main) {-                main.removeCallbacks(idleUnbind)-                connect()-            }.await() ?: return emptyList()-            service = svc-            val msg = Message.obtain(null, MSG_FETCH, id, 0)-            msg.data = Bundle().apply { putString(KEY_FEATURE_ID, featureId) }-            msg.replyTo = incoming-            svc.send(msg)-            for (event in events) {-                when (event) {-                    is Event.Partial -> ReviewsWebParser.parse(event.json).takeIf { it.isNotEmpty() }?.let(onPartial)-                    is Event.Result -> return event.json?.let(ReviewsWebParser::parse).orEmpty()-                }-            }-            return emptyList()-        } catch (_: RemoteException) {-            return emptyList()-        } finally {-            requests.remove(id)-            withContext(NonCancellable + Dispatchers.Main) {-                // No-op once the request already finished; frees the scrape slot if it was abandoned.-                runCatching { service?.send(Message.obtain(null, MSG_CANCEL, id, 0)) }-                if (requests.isEmpty() && connection != null) main.postDelayed(idleUnbind, IDLE_UNBIND_MS)-            }-        }-    }--    private fun connect(): CompletableDeferred<Messenger?> {-        remote?.let { return it }-        val deferred = CompletableDeferred<Messenger?>()-        val conn = object : ServiceConnection {-            override fun onServiceConnected(name: ComponentName?, binder: IBinder?) {-                deferred.complete(binder?.let(::Messenger))-            }-            override fun onServiceDisconnected(name: ComponentName?) = onLost()-            override fun onBindingDied(name: ComponentName?) = onLost()-            override fun onNullBinding(name: ComponentName?) = onLost()-        }-        remote = deferred-        connection = conn-        val bound = runCatching {-            app.bindService(Intent(app, ReviewsScraperService::class.java), conn, Context.BIND_AUTO_CREATE)-        }.getOrDefault(false)-        if (!bound) disconnect()-        return deferred-    }--    /** The `:reviews` process died mid-session: fail in-flight requests, rebind on the next fetch. */-    private fun onLost() {-        requests.values.forEach { it.trySend(Event.Result(null)) }-        disconnect()-    }--    private fun disconnect() {-        main.removeCallbacks(idleUnbind)-        connection?.let { runCatching { app.unbindService(it) } }-        connection = null-        remote?.complete(null)-        remote = null-    }--    private fun onReply(msg: Message) {-        val events = requests[msg.arg1] ?: return-        val json = msg.data.getString(KEY_JSON)-        when (msg.what) {-            MSG_PARTIAL -> json?.let { events.trySend(Event.Partial(it)) }-            MSG_RESULT -> events.trySend(Event.Result(json))-        }-    }--    private companion object {-        // Keep the scraper warm across back-to-back place taps, then let the process exit.-        const val IDLE_UNBIND_MS = 120_000L-    }-}
maps/src/main/java/com/vayunmathur/maps/service/ReviewsScraperService.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/service/ReviewsScraperService.kt b/maps/src/main/java/com/vayunmathur/maps/service/ReviewsScraperService.ktdeleted file mode 100644index 7c2fa86574..0000000000--- a/maps/src/main/java/com/vayunmathur/maps/service/ReviewsScraperService.kt+++ /dev/null@@ -1,77 +0,0 @@-package com.vayunmathur.maps.service--import android.app.Service-import android.content.Intent-import android.os.Bundle-import android.os.Handler-import android.os.IBinder-import android.os.Looper-import android.os.Message-import android.os.Messenger-import android.os.Process-import android.os.RemoteException-import com.vayunmathur.maps.data.google.WebReviewsFetcher-import kotlinx.coroutines.CoroutineScope-import kotlinx.coroutines.Dispatchers-import kotlinx.coroutines.Job-import kotlinx.coroutines.SupervisorJob-import kotlinx.coroutines.cancel-import kotlinx.coroutines.launch-import java.util.concurrent.ConcurrentHashMap--/**- * Hosts [WebReviewsFetcher] in the `:reviews` process. Chromium's ~100 MB of mappings stay pinned- * for the life of whichever process first creates a WebView, so the scraper lives here and the- * process exits once [ReviewsScraperClient] unbinds instead of bloating the map process forever.- */-class ReviewsScraperService : Service() {-    private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)-    private val fetcher by lazy { WebReviewsFetcher(applicationContext) }-    private val jobs = ConcurrentHashMap<Int, Job>()-    private val messenger = Messenger(Handler(Looper.getMainLooper()) { handle(it); true })--    override fun onBind(intent: Intent?): IBinder = messenger.binder--    override fun onDestroy() {-        scope.cancel()-        super.onDestroy()-        // Nothing else runs in this process; a cached-but-idle process would keep Chromium resident.-        Process.killProcess(Process.myPid())-    }--    private fun handle(msg: Message) {-        val id = msg.arg1-        when (msg.what) {-            MSG_FETCH -> {-                val reply = msg.replyTo ?: return-                val featureId = msg.data.getString(KEY_FEATURE_ID) ?: return-                val job = scope.launch {-                    val json = fetcher.fetch(featureId, onPartial = { reply.post(MSG_PARTIAL, id, it) })-                    reply.post(MSG_RESULT, id, json)-                }-                jobs[id] = job-                job.invokeOnCompletion { jobs.remove(id, job) }-            }-            MSG_CANCEL -> jobs.remove(id)?.cancel()-        }-    }--    private fun Messenger.post(what: Int, id: Int, json: String?) {-        val msg = Message.obtain(null, what, id, 0)-        msg.data = Bundle().apply { putString(KEY_JSON, json) }-        try {-            send(msg)-        } catch (_: RemoteException) {-            // Client process died; its unbind tears this service down.-        }-    }--    internal companion object {-        const val MSG_FETCH = 1-        const val MSG_CANCEL = 2-        const val MSG_PARTIAL = 3-        const val MSG_RESULT = 4-        const val KEY_FEATURE_ID = "featureId"-        const val KEY_JSON = "json"-    }-}
maps/src/main/java/com/vayunmathur/maps/ui/CategoryChips.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/CategoryChips.kt b/maps/src/main/java/com/vayunmathur/maps/ui/CategoryChips.ktindex 59f91c9b07..f0c9473e84 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/CategoryChips.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/CategoryChips.kt@@ -20,7 +20,7 @@ import com.vayunmathur.maps.R import com.vayunmathur.maps.util.PoiCategories  /**- * One quick category: a display label, the Google search [query] it runs on the+ * One quick category: a display label, the offline index search [query] it runs on the  * search page, the archive [kinds] it filters the drawn POI layers down to on the  * browse screen, and the set of OSM POI [types] ([PoiCategories]) the offline  * index is searched by.@@ -41,7 +41,7 @@ data class MapCategory(  * Shared quick-category definitions, reused by both the browse map screen and  * the search page so the two stay in lock-step. On the  * browse map a chip FILTERS the drawn POI layers to its [MapCategory.kinds];- * on the search page it runs the [MapCategory.query] Google search (P3).+ * on the search page it runs the [MapCategory.query] offline index search (P3).  *  * Gas, Hotels and ATMs only became real filters with the v3 archive: it is the first one  * whose schema has a `fuel`, `hotel` or `atm` kind at all, so before it those three chips@@ -62,7 +62,7 @@ val MAP_CATEGORIES: List<MapCategory> = listOf( /**  * Horizontally-scrolling row of quick category chips. [onCategory] is invoked  * with the tapped [MapCategory] — on browse this toggles the on-map POI filter,- * on the search page it runs the category's Google query. [selected] is the+ * on the search page it runs the category's offline index query. [selected] is the  * currently-active category (shown highlighted), or null when none is active.  *  * [contentPadding] is the row's inset, and is applied *inside* the scroll rather than
maps/src/main/java/com/vayunmathur/maps/ui/GoogleConsentDialog.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/GoogleConsentDialog.kt b/maps/src/main/java/com/vayunmathur/maps/ui/GoogleConsentDialog.ktindex 3a6a067cb4..4da477d849 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/GoogleConsentDialog.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/GoogleConsentDialog.kt@@ -18,10 +18,12 @@ import kotlinx.coroutines.launch /**  * First-launch Google services consent.  *- * Shown once, on the first map open: enabling turns on place enrichment- * (ratings/hours/photos), reviews, and Street View — all of which contact- * Google. Disabled (the default) means zero Google traffic: search, pins,- * routing, traffic, and transit stay fully offline/first-party.+ * Shown once, on the first map open: enabling turns on Google place details+ * (photos, hours, phone/website, popular times) and Street View — the only two+ * features that contact Google. Ratings, review counts and review summaries+ * always come from the offline archive. Disabled (the default) means zero+ * Google traffic: search, pins, routing, traffic, and transit stay fully+ * offline/first-party.  *  * Either answer records [MapPreferences.KEY_GOOGLE_CONSENT_ASKED] so the  * dialog never returns; the choice stays changeable in Settings.
maps/src/main/java/com/vayunmathur/maps/ui/MapPage.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/MapPage.kt b/maps/src/main/java/com/vayunmathur/maps/ui/MapPage.ktindex c2eccfc483..ed0689e5c3 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/MapPage.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/MapPage.kt@@ -62,7 +62,7 @@ import com.vayunmathur.maps.ui.streetview.StreetViewPegman import com.vayunmathur.maps.ui.theme.MapChromeMetrics import com.vayunmathur.maps.ui.map.MapChromeState import com.vayunmathur.maps.util.DeparturesState-import com.vayunmathur.maps.util.GooglePoiMapViewModel+import com.vayunmathur.maps.util.PoiMapViewModel import com.vayunmathur.maps.util.MapTileCache import com.vayunmathur.maps.util.OfflineRouter import com.vayunmathur.maps.util.MapSettingsViewModel@@ -102,9 +102,9 @@ fun MapPage(     parkingViewModel: com.vayunmathur.maps.util.ParkingViewModel,     transitViewModel: com.vayunmathur.maps.util.TransitStopsViewModel, ) {-    // Obtained in-body (not a parameter) so the MainActivity call site stays stable: the Google+    // Obtained in-body (not a parameter) so the MainActivity call site stays stable: the offline     // POI overlay pins are viewport-driven state owned by this screen alone.-    val poiViewModel: GooglePoiMapViewModel = viewModel()+    val poiViewModel: PoiMapViewModel = viewModel()     val context = LocalContext.current     val coroutineScope = rememberCoroutineScope()     val messenger = rememberMessenger()
maps/src/main/java/com/vayunmathur/maps/ui/MapPageScope.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/MapPageScope.kt b/maps/src/main/java/com/vayunmathur/maps/ui/MapPageScope.ktindex f49bd5eb7d..bba50a96f8 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/MapPageScope.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/MapPageScope.kt@@ -33,25 +33,24 @@ import com.vayunmathur.maps.util.TransitStopsViewModel import kotlinx.coroutines.CoroutineScope  /**- * Coarse identity of the place enrichment for the inner place sheet's- * contentKey: review/photo counts plus featured-review presence.+ * Coarse identity of the place details for the inner place sheet's contentKey:+ * photo count plus hours / popular-times presence.  *- * Late-arriving reviews and photos grow the sheet content after measurement,- * which the scaffold's learned ceiling would otherwise never re-learn. Kept- * to counts/presence rather than the full lists so progressive review- * streaming settles the key (null → base → final) instead of resetting the- * ceiling on every partial.+ * Late-arriving details grow the sheet content after measurement, which the+ * scaffold's learned ceiling would otherwise never re-learn. Kept to+ * counts/presence rather than the full lists so the key settles (null → details)+ * instead of resetting the ceiling on every recomposition.  */ data class PoiEnrichmentKey(-    val reviewCount: Int,     val photoCount: Int,-    val hasFeaturedReview: Boolean,+    val hasHours: Boolean,+    val hasPopularTimes: Boolean, ) {     companion object {         fun of(poi: GooglePoiInfo?): PoiEnrichmentKey = PoiEnrichmentKey(-            reviewCount = poi?.reviews?.size ?: 0,             photoCount = poi?.photoUrls?.size ?: 0,-            hasFeaturedReview = poi?.featuredReview != null,+            hasHours = poi?.hours?.isNotEmpty() == true,+            hasPopularTimes = poi?.popularTimes != null,         )     } }@@ -60,7 +59,7 @@ data class PoiEnrichmentKey(  * An open search sheet.  *  * Search used to be a nav destination, so these three lived in the route. They are still needed —- * the bias centre because the Google search is biased toward what the user can see, and+ * the bias centre because the offline index search ranks by distance to what the user can see, and  * [waypointIndex] because picking a result while editing a route replaces that leg rather than  * selecting a place — but now they are the identity of a sheet, not of a page. `null` is the  * closed state, which is why the whole thing is one nullable value rather than a flag plus three
maps/src/main/java/com/vayunmathur/maps/ui/PlaceActionRow.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/PlaceActionRow.kt b/maps/src/main/java/com/vayunmathur/maps/ui/PlaceActionRow.ktindex 7b73d9babd..1b0a3f917c 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/PlaceActionRow.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/PlaceActionRow.kt@@ -117,7 +117,10 @@ private fun PlaceAction(  private fun sharePlace(context: Context, feature: SpecificFeature.RoutableFeature) {     val pos = feature.position-    val url = "https://maps.google.com/?q=${pos.latitude},${pos.longitude}"+    // A neutral, clickable OpenStreetMap link (the map's own data source) rather than a+    // Google Maps URL: the app no longer points people at Google for places.+    val url = "https://www.openstreetmap.org/?mlat=${pos.latitude}&mlon=${pos.longitude}" ++        "#map=$SHARE_ZOOM/${pos.latitude}/${pos.longitude}"     val body = context.getString(R.string.place_share_text, feature.name, url)     val send = Intent(Intent.ACTION_SEND).apply {         type = "text/plain"@@ -128,3 +131,6 @@ private fun sharePlace(context: Context, feature: SpecificFeature.RoutableFeatur     }     ExternalIntents.launch(context, chooser) }++/** Zoom of the shared OpenStreetMap link: street level. */+private const val SHARE_ZOOM = 17
maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheet.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheet.kt b/maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheet.ktindex 83119422f8..874804be6c 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheet.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheet.kt@@ -313,7 +313,7 @@ private fun ReviewSummaryRow(summary: String) { /**  * Five stars, filled up to [rating].  *- * `Double` rather than `Int` because Google's place rating is fractional; a review's own+ * `Double` rather than `Int` because the archive's place rating is fractional; a review's own  * rating is a whole number and converts. There used to be one of these per file, differing  * only in that parameter type.  */
maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheetHeader.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheetHeader.kt b/maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheetHeader.ktindex dce4822bb3..8db27777ba 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheetHeader.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/PlaceSheetHeader.kt@@ -234,7 +234,6 @@ private fun PlaceSheetHeaderContent(                                     when (tab) {                                         PoiSection.DETAILS -> R.string.poi_tab_details                                         PoiSection.PHOTOS -> R.string.poi_photos_header-                                        PoiSection.REVIEWS -> R.string.poi_reviews_header                                     }                                 )                             )@@ -266,13 +265,13 @@ private fun MaskedPlaceHeader( }  /**- * The tabs worth offering for [poi]: Details always, the other two only when the- * enrichment actually came back with something behind them.+ * The tabs worth offering for [poi]: Details always, Photos only when the place details+ * actually came back with photos. There is no reviews tab: the archive's rating and count+ * sit in the header and its review summary in Details.  */ internal fun poiTabs(poi: GooglePoiInfo?): List<PoiSection> = buildList {     add(PoiSection.DETAILS)     if (poi?.photoUrls?.isNotEmpty() == true) add(PoiSection.PHOTOS)-    if (poi?.reviews?.isNotEmpty() == true || poi?.featuredReview != null) add(PoiSection.REVIEWS) }  /**@@ -301,15 +300,14 @@ private fun PlaceHeader(             Text(subtitle, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)         } -        // The archive's rating first, so it shows offline and with Google turned off.-        // Rating and count come from the same source, never one from each.-        val (rating, reviewCount) = offline?.rating?.let { it to offline.reviewCount }-            ?: (poi?.rating to poi?.reviewCount)-        rating?.let {+        // Rating and review count come only from the archive (`poi_attrs` keys 10/11, baked+        // from the review table at build time), so they show offline and with Google off,+        // and Google is never asked for them.+        offline?.rating?.let {             Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {                 RatingStars(it)                 Text(-                    stringResource(R.string.reviews_summary, it, reviewCount ?: 0),+                    stringResource(R.string.reviews_summary, it, offline.reviewCount ?: 0),                     style = MaterialTheme.typography.bodyMedium,                     color = MaterialTheme.colorScheme.onSurfaceVariant,                 )
maps/src/main/java/com/vayunmathur/maps/ui/PoiEnrichment.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/PoiEnrichment.kt b/maps/src/main/java/com/vayunmathur/maps/ui/PoiEnrichment.ktindex 33a3052176..e91cec330c 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/PoiEnrichment.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/PoiEnrichment.kt@@ -9,10 +9,6 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding-import androidx.compose.foundation.layout.size-import androidx.compose.foundation.lazy.LazyRow-import androidx.compose.foundation.lazy.items-import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment@@ -21,7 +17,6 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.stringResource-import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.unit.dp import com.vayunmathur.library.image.compose.AsyncImage import com.vayunmathur.library.ui.Card@@ -35,7 +30,6 @@ import com.vayunmathur.library.ui.Text import com.vayunmathur.library.util.firstLetterUppercase import com.vayunmathur.maps.R import com.vayunmathur.maps.data.google.GooglePoiInfo-import com.vayunmathur.maps.data.google.GoogleReview import com.vayunmathur.maps.data.google.PoiPopularTimes import com.vayunmathur.maps.data.google.PoiSection import kotlinx.datetime.TimeZone@@ -44,7 +38,9 @@ import kotlinx.datetime.toLocalDateTime import kotlin.time.Clock  /**- * Renders one [PoiSection] of the keyless Google Maps POI enrichment.+ * Renders one [PoiSection] of the keyless Google Maps place details (photos, hours,+ * fuel price, popular times). No reviews: rating, count and review summary come from the+ * archive and render in the header and [PlaceSheet]'s Details block.  *  * Every part is conditional on its data being present — a keyless response is  * bot-degraded (popular times and the full photo gallery are usually stripped)@@ -61,7 +57,6 @@ fun GooglePoiEnrichment(info: GooglePoiInfo, section: PoiSection, showHours: Boo         when (section) {             PoiSection.DETAILS -> DetailsSection(info, showHours)             PoiSection.PHOTOS -> PhotosSection(info.photoUrls)-            PoiSection.REVIEWS -> ReviewsSection(info)         }     } }@@ -83,10 +78,6 @@ private fun DetailsSection(info: GooglePoiInfo, showHours: Boolean) {         }     } -    info.editorialSummary?.let {-        Text(it, style = MaterialTheme.typography.bodyMedium, fontStyle = FontStyle.Italic, maxLines = 3)-    }-     // Google's hours, which win when it has them (the OSM block is suppressed by     // the caller in that case). This is today's line only — the search response     // carries no weekly schedule — so it renders as however many lines came back@@ -115,7 +106,7 @@ private fun DetailsSection(info: GooglePoiInfo, showHours: Boolean) { /**  * The photo gallery, two to a row.  *- * A grid rather than the single [LazyRow] this replaces: on its own tab there is+ * A grid rather than the single `LazyRow` this replaces: on its own tab there is  * width to spend and no competing section, and a row of one visible thumbnail was  * most of what made the photos feel hidden.  */@@ -140,23 +131,6 @@ private fun PhotosSection(photoUrls: List<String>) {     } } -@Composable-private fun ReviewsSection(info: GooglePoiInfo) {-    if (info.reviews.isNotEmpty()) {-        info.reviews.forEach { ReviewCard(it) }-    } else info.featuredReview?.let {-        Card {-            Text(-                "\u201C$it\u201D",-                Modifier.padding(12.dp),-                style = MaterialTheme.typography.bodyMedium,-                fontStyle = FontStyle.Italic,-                maxLines = 4,-            )-        }-    }-}- @Composable private fun SectionHeader(title: String, icon: @Composable () -> Unit) {     Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {@@ -165,46 +139,6 @@ private fun SectionHeader(title: String, icon: @Composable () -> Unit) {     } } -@Composable-private fun ReviewCard(review: GoogleReview) {-    Card {-        Column(Modifier.padding(12.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {-            Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {-                review.authorPhoto?.let {-                    AsyncImage(-                        model = it,-                        contentDescription = stringResource(R.string.poi_reviewer_photo_description),-                        modifier = Modifier.size(32.dp).clip(CircleShape),-                        contentScale = ContentScale.Crop,-                    )-                }-                Column {-                    Text(review.author, style = MaterialTheme.typography.bodyMedium, maxLines = 1)-                    review.relativeTime?.let {-                        Text(it, style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)-                    }-                }-            }-            if (review.rating in 1..5) RatingStars(review.rating.toDouble())-            review.text?.let {-                Text(it, style = MaterialTheme.typography.bodyMedium, maxLines = 6)-            }-            if (review.photos.isNotEmpty()) {-                LazyRow(horizontalArrangement = Arrangement.spacedBy(6.dp)) {-                    items(review.photos) { url ->-                        AsyncImage(-                            model = url,-                            contentDescription = stringResource(R.string.poi_photo_description),-                            modifier = Modifier.size(72.dp).clip(RoundedCornerShape(8.dp)),-                            contentScale = ContentScale.Crop,-                        )-                    }-                }-            }-        }-    }-}- @Composable private fun PopularTimesSection(popularTimes: PoiPopularTimes) {     // Show today's histogram (falling back to the first day Google returned).
maps/src/main/java/com/vayunmathur/maps/ui/SavedPlacesLayer.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/SavedPlacesLayer.kt b/maps/src/main/java/com/vayunmathur/maps/ui/SavedPlacesLayer.ktindex 4078603f1d..039e81c462 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/SavedPlacesLayer.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/SavedPlacesLayer.kt@@ -66,7 +66,7 @@ fun SavedPlacesLayer(places: List<SavedPlace>, cameraState: CameraState) { /**  * Convert a hit-tested saved pin feature back into a selectable place, reusing  * [SpecificFeature.GenericPlace] so `SelectedFeatureViewModel.currentPoiInfo`- * fetches the Google enrichment and the place sheet renders.+ * fetches the Google place details (photos/hours) and the place sheet renders.  */ fun Feature1.toSelectedSavedPlace(): SpecificFeature? {     val props = properties ?: return null
maps/src/main/java/com/vayunmathur/maps/ui/SearchResultLayer.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/SearchResultLayer.kt b/maps/src/main/java/com/vayunmathur/maps/ui/SearchResultLayer.ktindex a95f50b44b..14aad88a99 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/SearchResultLayer.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/SearchResultLayer.kt@@ -29,7 +29,7 @@ private val PIN_SIZE = 26.dp private val GLYPH_SIZE = 8.dp  /**- * Search-result pin overlay: the Google search results drawn+ * Search-result pin overlay: the offline index search results drawn  * as plain Compose over VectorMap. Distinct from the ambient POI overlay so search pins read  * as "your results" (a single accent colour) rather than the category-coloured ambient POIs.  * Tap → details via [toSelectedSearchResult].@@ -66,7 +66,7 @@ fun SearchResultLayer(results: List<com.vayunmathur.maps.util.SearchResult>, cam /**  * Convert a hit-tested search pin feature back into a selectable place, reusing  * [SpecificFeature.GenericPlace] so the existing- * `SelectedFeatureViewModel.currentPoiInfo` flow fetches the Google enrichment+ * `SelectedFeatureViewModel.currentPoiInfo` flow fetches the Google place details (photos/hours)  * and `GooglePoiEnrichment` renders in the sheet — no new detail path needed.  */ fun Feature1.toSelectedSearchResult(): SpecificFeature? {
maps/src/main/java/com/vayunmathur/maps/ui/VoiceSearchButton.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/VoiceSearchButton.kt b/maps/src/main/java/com/vayunmathur/maps/ui/VoiceSearchButton.ktindex 39036be5ca..f1ae03e1b9 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/VoiceSearchButton.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/VoiceSearchButton.kt@@ -23,7 +23,7 @@ import com.vayunmathur.library.ui.rememberPermissionRequest  * in-app STT engine.  *  * On a final transcript it calls [onResult]; callers fill the search query and- * run the P3 Google search. RECORD_AUDIO is requested through the shared+ * run the P3 offline index search. RECORD_AUDIO is requested through the shared  * [rememberPermissionRequest] helper (which deep-links to app settings on  * permanent denial). When no recognition service is available the button hides  * itself entirely (renders nothing).
maps/src/main/java/com/vayunmathur/maps/ui/map/MapStylePatch.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/map/MapStylePatch.kt b/maps/src/main/java/com/vayunmathur/maps/ui/map/MapStylePatch.ktindex 766bd276b5..6978bb7c17 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/map/MapStylePatch.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/map/MapStylePatch.kt@@ -10,8 +10,8 @@ import kotlinx.serialization.json.jsonPrimitive import kotlinx.serialization.json.put import kotlinx.serialization.json.putJsonObject -// Native basemap layers suppressed at runtime — amenities are Google-only now-// (custom overlay layer). Keeping this in code (vs editing style.json) makes it+// Native basemap layers suppressed at runtime — amenities come from the archive's+// offline POI index (custom overlay layer). Keeping this in code (vs editing style.json) makes it // OTA-swappable per Decision D1. private val SUPPRESSED_LAYERS = setOf("pois") @@ -43,7 +43,7 @@ fun patchStyleForHybrid(             val type = layer["type"]?.jsonPrimitive?.content ?: ""              // Suppress native basemap POIs at runtime (Decision D1) — amenities-            // are Google-only now, rendered on the custom overlay layer. Dropping+            // come from the offline POI index, rendered on the custom overlay layer. Dropping             // the source layer here (rather than editing style.json) keeps it             // OTA-swappable. Also drops the would-be _base/_hybrid variants.             if (id in SUPPRESSED_LAYERS) return@forEach
maps/src/main/java/com/vayunmathur/maps/ui/map/TrafficPrefetchEffect.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/ui/map/TrafficPrefetchEffect.kt b/maps/src/main/java/com/vayunmathur/maps/ui/map/TrafficPrefetchEffect.ktindex b32fccd715..2fa505191d 100644--- a/maps/src/main/java/com/vayunmathur/maps/ui/map/TrafficPrefetchEffect.kt+++ b/maps/src/main/java/com/vayunmathur/maps/ui/map/TrafficPrefetchEffect.kt@@ -15,7 +15,7 @@ import kotlinx.coroutines.flow.collectLatest  * a re-pan over an already-fetched square is a cheap no-op and the fetched  * data is kept. Keyed on the toggle so it stops when traffic is off.  * `collectLatest { delay() }` is the repo's debounce idiom (see- * GooglePoiMapViewModel): a newer camera position cancels the pending delay,+ * PoiMapViewModel): a newer camera position cancels the pending delay,  * so the fetch only fires after the camera stops moving.  *  * Extracted from MapSurface so no ui file exceeds the [FileLength] limit.
maps/src/main/java/com/vayunmathur/maps/util/MapSettingsViewModel.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/util/MapSettingsViewModel.kt b/maps/src/main/java/com/vayunmathur/maps/util/MapSettingsViewModel.ktindex 145fad2e9a..26bfa7e86c 100644--- a/maps/src/main/java/com/vayunmathur/maps/util/MapSettingsViewModel.kt+++ b/maps/src/main/java/com/vayunmathur/maps/util/MapSettingsViewModel.kt@@ -120,7 +120,7 @@ class MapSettingsViewModel(application: Application) : AndroidViewModel(applicat     )      /**-     * Google services (place enrichment + reviews + Street View). Off by+     * Google services (place details — photos/hours/phone, never reviews — + Street View). Off by      * default; the first-launch consent dialog or the settings toggle opts in.      * Every Google call site gates on this — off means zero Google traffic.      */
maps/src/main/java/com/vayunmathur/maps/util/MapsUiContract.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/util/MapsUiContract.kt b/maps/src/main/java/com/vayunmathur/maps/util/MapsUiContract.ktindex c27dc4f0be..a33ab450ca 100644--- a/maps/src/main/java/com/vayunmathur/maps/util/MapsUiContract.kt+++ b/maps/src/main/java/com/vayunmathur/maps/util/MapsUiContract.kt@@ -63,15 +63,15 @@ enum class SearchPhase {  * without supplying behaviour — [Noop] is the whole implementation a preview needs.  *  * These are not implemented by [MapsSearchViewModel]: a query needs the visible bounding- * box (to bias the Google search toward the map centre) and picking a result touches the+ * box (to rank the offline index search toward the map centre) and picking a result touches the  * selection the map screen owns, so the map screen builds the adapter itself.  */ interface SearchActions {     fun setQuery(query: String) {}     fun selectResult(result: SearchResult) {}     /**-     * Handle a postal address picked from a contact (P17): run the Google search-     * for [address] and auto-select the first result — the same path as tapping+     * Handle a postal address picked from a contact (P17): run the offline index+     * search for [address] and auto-select the first result — the same path as tapping      * the top search row, no user tap required. No-op when the search is empty.      */     fun pickContactAddress(address: String) {}
maps/src/main/java/com/vayunmathur/maps/util/PoiMapViewModel.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/util/GooglePoiMapViewModel.kt b/maps/src/main/java/com/vayunmathur/maps/util/PoiMapViewModel.ktsimilarity index 84%rename from maps/src/main/java/com/vayunmathur/maps/util/GooglePoiMapViewModel.ktrename to maps/src/main/java/com/vayunmathur/maps/util/PoiMapViewModel.ktindex 2a4ffce7a0..f7cc6eaa5e 100644--- a/maps/src/main/java/com/vayunmathur/maps/util/GooglePoiMapViewModel.kt+++ b/maps/src/main/java/com/vayunmathur/maps/util/PoiMapViewModel.kt@@ -3,7 +3,7 @@ package com.vayunmathur.maps.util import android.app.Application import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.viewModelScope-import com.vayunmathur.maps.data.google.GooglePoiPin+import com.vayunmathur.maps.data.PoiPin import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.delay@@ -16,7 +16,7 @@ import kotlin.math.abs  /**  * Drives the ambient POI overlay: turns viewport boxes into a debounced list- * of [GooglePoiPin]s to render (Decisions D3/D7, snappier P23), sourced from+ * of [PoiPin]s to render (Decisions D3/D7, snappier P23), sourced from  * the offline OSM POI index (P29). No network.  *  * The driver keeps the previous pins on screen until a *new, non-empty*@@ -24,10 +24,10 @@ import kotlin.math.abs  * debounces fast pans, and still skips wide views (> ~16 km, [MAX_LAT_SPAN])  * where POI pins are meaningless. All index reads are on [Dispatchers.IO].  */-class GooglePoiMapViewModel(application: Application) : AndroidViewModel(application) {+class PoiMapViewModel(application: Application) : AndroidViewModel(application) { -    private val _pins = MutableStateFlow<List<GooglePoiPin>>(emptyList())-    val pins: StateFlow<List<GooglePoiPin>> = _pins.asStateFlow()+    private val _pins = MutableStateFlow<List<PoiPin>>(emptyList())+    val pins: StateFlow<List<PoiPin>> = _pins.asStateFlow()      // Ambient-pin refresh job. Cancelled on each new viewport so a fast pan debounces.     private var offlineJob: Job? = null@@ -59,10 +59,8 @@ class GooglePoiMapViewModel(application: Application) : AndroidViewModel(applica      /**      * Feed a viewport (from `queryVisibleBoundingBox()`). Views wider than-     * [MAX_LAT_SPAN] are ignored, keeping the last pins (no clear).-     *-     * The retired Google-scrape entry point kept its name so former callers-     * stay compilable during migration; it forwards to [onViewportOffline].+     * [MAX_LAT_SPAN] are ignored, keeping the last pins (no clear). Same as+     * [onViewportOffline]: pins only ever come from the offline index.      */     fun onViewport(north: Double, east: Double, south: Double, west: Double) {         onViewportOffline(north, east, south, west)@@ -70,7 +68,7 @@ class GooglePoiMapViewModel(application: Application) : AndroidViewModel(applica      /** Map an offline index record to the pin model [pins] publishes; the      *  category label drives its data-driven pin colour (P29). */-    private fun PoiIndex.PoiRecord.toPin(): GooglePoiPin = GooglePoiPin(+    private fun PoiIndex.PoiRecord.toPin(): PoiPin = PoiPin(         id = "poi:$latE7:$lonE7",         name = name,         lat = lat,
maps/src/main/java/com/vayunmathur/maps/util/SelectedFeatureViewModel.kt
diff --git a/maps/src/main/java/com/vayunmathur/maps/util/SelectedFeatureViewModel.kt b/maps/src/main/java/com/vayunmathur/maps/util/SelectedFeatureViewModel.ktindex ab73545abb..5d0737eae2 100644--- a/maps/src/main/java/com/vayunmathur/maps/util/SelectedFeatureViewModel.kt+++ b/maps/src/main/java/com/vayunmathur/maps/util/SelectedFeatureViewModel.kt@@ -8,7 +8,6 @@ import com.vayunmathur.maps.data.SpecificFeature import com.vayunmathur.maps.data.osmPlace import com.vayunmathur.maps.data.google.GooglePoiDataSource import com.vayunmathur.maps.data.google.GooglePoiInfo-import com.vayunmathur.maps.service.ReviewsScraperClient import com.vayunmathur.maps.data.parse import com.vayunmathur.maps.data.google.PoiSection import kotlinx.coroutines.Dispatchers@@ -17,7 +16,6 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow-import kotlinx.coroutines.flow.channelFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flow@@ -78,18 +76,7 @@ class SelectedFeatureViewModel(application: Application): AndroidViewModel(appli      */     var selectedRouteMode: RouteService.TravelMode = RouteService.TravelMode.DRIVE -    /**-     * Coalescing gates for the review-streaming partials in [currentPoiInfo]:-     * forward a partial only when the list grew by [PARTIAL_MIN_GROWTH]-     * reviews or [PARTIAL_MIN_INTERVAL_MS] elapsed since the last forward.-     * Dozens of per-parse emissions used to recompose the sheet for a list-     * the user barely sees change; the authoritative final send still always-     * runs, so a dropped partial loses nothing.-     */     private companion object {-        const val PARTIAL_MIN_GROWTH = 5-        const val PARTIAL_MIN_INTERVAL_MS = 2_000L-         /**          * Minimum movement (metres, equirectangular — fine at this scale)          * before the persisted position is rewritten.@@ -146,10 +133,6 @@ class SelectedFeatureViewModel(application: Application): AndroidViewModel(appli      */     private var lastPersisted: GeoPoint? = null -    // Hidden-WebView reviews scraper (keyless; Google 404'd the old reviews RPC), run in the-    // `:reviews` process so Chromium never maps into this one.-    private val webReviews = ReviewsScraperClient(application)-     init {         locationManager.startUpdates(             onUpdateReceived = { position, bearing, speedMps ->@@ -272,10 +255,11 @@ class SelectedFeatureViewModel(application: Application): AndroidViewModel(appli         }      /**-     * Keyless Google Maps enrichment (rating, reviews, hours, photos, price,-     * popular times, …) for the currently selected restaurant or generic place.-     * Emits null for other feature types and while the network scrape is in-     * flight; cancels the in-flight fetch when the selection changes.+     * Keyless Google Maps place details (photos, hours/open status, phone, website, price,+     * popular times — never ratings or reviews, which come only from the archive's POI+     * attributes on the selected [SpecificFeature.GenericPlace]) for the currently selected+     * restaurant or generic place. Emits null for other feature types and while the fetch is+     * in flight; cancels the in-flight fetch when the selection changes.      * [GooglePoiDataSource] caches and does its own IO, so a re-select is instant.      *      * Hard-gated on the Google services toggle: when off, emits null without@@ -297,44 +281,9 @@ class SelectedFeatureViewModel(application: Application): AndroidViewModel(appli                 else -> return@flatMapLatest flowOf(null)             }             if (name.isBlank()) return@flatMapLatest flowOf(null)-            // channelFlow so the WebView scrape's onPartial callback (arriving on a JavaBridge-            // thread) can push progressive review updates into the same stream via trySend.-            channelFlow {-                send(null)-                val base = GooglePoiDataSource.fetch(name, pos.latitude, pos.longitude)-                send(base)-                // Base sheet is up. Reviews load lazily via the hidden WebView: no feature id-                // (e.g. no confident Google match) → nothing more to fetch. Best-effort; any-                // failure/timeout just leaves reviews empty and the sheet as-is.-                val fid = base?.featureId-                if (base != null && !fid.isNullOrBlank()) {-                    // Coalesce the progressive partials: the scraper streams the-                    // accumulated list on every parse, and each trySend-                    // recomposes the sheet that collects this flow. Forward a-                    // partial only when it grew meaningfully or enough time-                    // passed; the authoritative final send below still always-                    // runs, so nothing is ever lost by a dropped partial.-                    var lastPartialSize = 0-                    var lastPartialMs = 0L-                    val reviews = runCatching {-                        webReviews.fetch(-                            featureId = fid,-                            onPartial = { list ->-                                if (list.isNotEmpty()) {-                                    val nowMs = System.currentTimeMillis()-                                    if (list.size - lastPartialSize >= PARTIAL_MIN_GROWTH ||-                                        nowMs - lastPartialMs >= PARTIAL_MIN_INTERVAL_MS-                                    ) {-                                        lastPartialSize = list.size-                                        lastPartialMs = nowMs-                                        trySend(base.copy(reviews = list))-                                    }-                                }-                            },-                        )-                    }.getOrDefault(emptyList())-                    if (reviews.isNotEmpty()) send(base.copy(reviews = reviews))-                }+            flow {+                emit(null)+                emit(GooglePoiDataSource.fetch(name, pos.latitude, pos.longitude))             }.flowOn(Dispatchers.IO)         }         .stateIn(
maps/src/main/res/values-et/strings.xml
diff --git a/maps/src/main/res/values-et/strings.xml b/maps/src/main/res/values-et/strings.xmlindex 484ca0d7ab..b59aac4ddd 100644--- a/maps/src/main/res/values-et/strings.xml+++ b/maps/src/main/res/values-et/strings.xml@@ -22,7 +22,6 @@     <string name="poi_fuel_price_header">Kütusehind</string>     <string name="poi_tab_details">Üksikasjad</string>     <string name="poi_photos_header">Fotod</string>-    <string name="poi_reviews_header">Arvustused</string>     <string name="poi_popular_times_header">Populaarsed kasutusajad</string>     <string name="poi_about_header">Teave</string>     <string name="menu_label">Menüü</string>@@ -44,13 +43,12 @@     <string name="car_searching">Otsin…</string>     <string name="car_route_failed">Seal ei leidunud teekonda.</string>     <string name="poi_photo_description">Asutuse foto</string>-    <string name="poi_reviewer_photo_description">Arvustaja foto</string>     <string name="place_action_website">Veebisait</string>     <string name="add_stop_to_route">Lisa teekonnapunkt</string>     <string name="wikipedia">Vikipeedia</string>     <string name="place_action_order">Telli</string>     <string name="closed_status">Suletud</string>-    <string name="place_share_text"><xliff:g id="name" example="Sinine kohvik">%1$s</xliff:g>\n<xliff:g id="url" example="https://maps.google.com/?q=59.437, 24.745">%2$s</xliff:g></string>+    <string name="place_share_text"><xliff:g id="name" example="Sinine kohvik">%1$s</xliff:g>\n<xliff:g id="url" example="https://www.openstreetmap.org/?mlat=59.437&amp;mlon=24.745#map=17/59.437/24.745">%2$s</xliff:g></string>     <string name="closes_at">Suletakse <xliff:g id="time" example="21:00">%1$s</xliff:g></string>     <string name="opens_at">Avatakse <xliff:g id="time" example="09:00">%1$s</xliff:g></string>     <string name="search_placeholder">Otsi…</string>
maps/src/main/res/values/strings.xml
diff --git a/maps/src/main/res/values/strings.xml b/maps/src/main/res/values/strings.xmlindex efef995ea4..7aa8eeabfe 100644--- a/maps/src/main/res/values/strings.xml+++ b/maps/src/main/res/values/strings.xml@@ -65,8 +65,6 @@     <string name="show_details">Show details</string>     <!-- Place detail: Photos section header. Noun. -->     <string name="poi_photos_header">Photos</string>-    <!-- Place detail: Reviews section header. Noun. -->-    <string name="poi_reviews_header">Reviews</string>     <!-- Place detail: Popular times section header. Noun phrase. -->     <string name="poi_popular_times_header">Popular times</string>     <!-- Place detail: About/overview section header. Noun. -->@@ -77,8 +75,6 @@     <string name="poi_hours_live">Live</string>     <!-- Place detail: Content description for a business photo thumbnail. -->     <string name="poi_photo_description">Business photo</string>-    <!-- Place detail: Content description for a reviewer's profile picture. -->-    <string name="poi_reviewer_photo_description">Reviewer photo</string>     <!-- Button: Get directions. Noun/Verb. -->     <string name="directions">Directions</string>     <!-- Button: Add selected place as stop on route -->@@ -93,7 +89,7 @@     <!-- Place sheet action row: share the place -->     <!-- Place sheet action row: save the place (bookmark) -->     <!-- Share sheet body. %1$s=place name, %2$s=maps URL -->-    <string name="place_share_text"><xliff:g id="name" example="Blue Bottle Coffee">%1$s</xliff:g>\n<xliff:g id="url" example="https://maps.google.com/?q=37.0,-122.0">%2$s</xliff:g></string>+    <string name="place_share_text"><xliff:g id="name" example="Blue Bottle Coffee">%1$s</xliff:g>\n<xliff:g id="url" example="https://www.openstreetmap.org/?mlat=37.0&amp;mlon=-122.0#map=17/37.0/-122.0">%2$s</xliff:g></string>     <!-- Label: Place is currently open. Adjective. -->     <!-- Label: Place is closed. Adjective. -->     <string name="closed_status">Closed</string>@@ -375,7 +371,7 @@     <!-- Google consent dialog: title. Noun phrase. -->     <string name="google_consent_title">Enable Google services?</string>     <!-- Google consent dialog: body explaining what enabling contacts. -->-    <string name="google_consent_message">Place details, reviews, and Street View come from Google. If you keep this off, the map stays fully offline and nothing is sent to Google.</string>+    <string name="google_consent_message">Place photos and hours, and Street View, come from Google. Ratings and review summaries always come from the offline map. If you keep this off, nothing is sent to Google.</string>     <!-- Google consent dialog: opt-in button. Verb. -->     <string name="google_consent_enable">Enable</string>     <!-- Google consent dialog: opt-out button. Verb. -->@@ -383,7 +379,7 @@     <!-- Settings: Google services toggle title. Noun. -->     <string name="settings_google_services">Google services</string>     <!-- Settings: Google services toggle description. -->-    <string name="settings_google_services_desc">Place details, reviews, Street View</string>+    <string name="settings_google_services_desc">Place photos and hours, Street View</string>     <!-- Settings: section header for offline map data. Noun. -->     <string name="settings_section_map_data">Offline map data</string>     <!-- Settings: check-for-updates row title. Verb phrase. -->
maps/src/test/java/com/vayunmathur/maps/data/google/GooglePoiDataSourceSlice1Test.kt
diff --git a/maps/src/test/java/com/vayunmathur/maps/data/google/GooglePoiDataSourceSlice1Test.kt b/maps/src/test/java/com/vayunmathur/maps/data/google/GooglePoiDataSourceSlice1Test.ktindex 8e97109ee9..ad35e0e502 100644--- a/maps/src/test/java/com/vayunmathur/maps/data/google/GooglePoiDataSourceSlice1Test.kt+++ b/maps/src/test/java/com/vayunmathur/maps/data/google/GooglePoiDataSourceSlice1Test.kt@@ -104,8 +104,10 @@ class GooglePoiDataSourceSlice1Test {     }      @Test-    fun `a full entry parses every field`() {+    fun `a full entry parses every non-review field and no review field`() {         val node = place(extra = {+            // Rating, review count, editorial summary, featured review and feature id are+            // all present in the response, and must not surface: reviews come from the archive.             set(4, 7, value = JsonPrimitive(4.5))             set(4, 8, value = JsonPrimitive(230))             set(4, 2, value = JsonPrimitive("$10–20"))@@ -119,8 +121,6 @@ class GooglePoiDataSourceSlice1Test {         })         runWithFetch(Payload().searchBody(entry(node))) {             val info = assertNotNull(GooglePoiDataSource.fetch("Slice1 Cafe", 37.7749, -122.4194))-            assertEquals(4.5, info.rating)-            assertEquals(230, info.reviewCount)             assertEquals("$10–20", info.priceText)             assertEquals(2, info.priceLevel)             assertEquals("https://cafe.example", info.website)@@ -128,30 +128,37 @@ class GooglePoiDataSourceSlice1Test {             assertEquals(true, info.openNow)             assertEquals("Open · Closes 9 PM", info.statusText)             assertEquals("Cafe", info.category)-            assertEquals("A sunny corner spot.", info.editorialSummary)-            assertEquals("Best oat latte.", info.featuredReview)-            assertEquals("0x808580:0x808581", info.featureId)+            // The model has no review-shaped field left to fill: everything it carries is a+            // place fact. (A compile-time guarantee; this pins the surviving field set.)+            assertEquals(+                GooglePoiInfo(+                    priceText = "$10–20", priceLevel = 2, website = "https://cafe.example",+                    phone = "+14155550123", openNow = true, statusText = "Open · Closes 9 PM",+                    category = "Cafe",+                ),+                info.copy(hours = emptyList(), photoUrls = emptyList(), popularTimes = null, fuelPrice = null),+            )         }     }      @Test     fun `the nearest entry inside the match radius wins`() {         val near = entry(place(name = "Slice1 Near", lat = 37.7750, lng = -122.4195) {-            set(4, 7, value = JsonPrimitive(4.0))+            set(7, 0, value = JsonPrimitive("https://near.example"))         })         val far = entry(place(name = "Slice1 Far", lat = 37.7900, lng = -122.4194) {-            set(4, 7, value = JsonPrimitive(1.0))+            set(7, 0, value = JsonPrimitive("https://far.example"))         })         runWithFetch(Payload().searchBody(far, near)) {             val info = assertNotNull(GooglePoiDataSource.fetch("Slice1 Pick", 37.7749, -122.4194))-            assertEquals(4.0, info.rating, "the near entry must win over the far one")+            assertEquals("https://near.example", info.website, "the near entry must win over the far one")         }     }      @Test     fun `no close match is a negative-cacheable no-match`() {         val far = entry(place(name = "Slice1 Elsewhere", lat = 38.0, lng = -122.0) {-            set(4, 7, value = JsonPrimitive(4.0))+            set(7, 0, value = JsonPrimitive("https://elsewhere.example"))         })         runWithFetch(Payload().searchBody(far, far)) { requested ->             assertNull(GooglePoiDataSource.fetch("Slice1 Nowhere", 37.7749, -122.4194))@@ -163,11 +170,11 @@ class GooglePoiDataSourceSlice1Test {     @Test     fun `a lone far entry is still accepted`() {         val lone = entry(place(name = "Slice1 Lone", lat = 38.5, lng = -121.0) {-            set(4, 7, value = JsonPrimitive(3.5))+            set(7, 0, value = JsonPrimitive("https://lone.example"))         })         runWithFetch(Payload().searchBody(lone)) {             val info = assertNotNull(GooglePoiDataSource.fetch("Slice1 Lone", 37.7749, -122.4194))-            assertEquals(3.5, info.rating)+            assertEquals("https://lone.example", info.website)         }     } @@ -190,7 +197,7 @@ class GooglePoiDataSourceSlice1Test {         fun fuelled(kind: String?, tag: String) = entry(place(name = "Slice1 Fuel $tag") {             set(88, 1, value = kind?.let { JsonPrimitive(it) } ?: JsonNull)             set(88, 0, value = JsonPrimitive("$6.20/Regular"))-            set(4, 7, value = JsonPrimitive(4.0))+            set(7, 0, value = JsonPrimitive("https://$tag.example"))         })         runWithFetch(Payload().searchBody(fuelled("SearchResult.TYPE_GAS_STATION", "gas"))) {             val info = assertNotNull(GooglePoiDataSource.fetch("Slice1 Gas", 37.7749, -122.4194))@@ -345,12 +352,12 @@ class GooglePoiDataSourceSlice1Test {     fun `a single geocoded node resolves like a list entry`() {         // SINGLE = [0,1,0,14]: root[0][1][0][14] carries the place node itself.         val node = place(name = "Slice1 Single", extra = {-            set(4, 7, value = JsonPrimitive(4.2))+            set(7, 0, value = JsonPrimitive("https://single.example"))         })         val body = Payload().apply { set(0, 1, 0, 14, value = node) }.body()         runWithFetch(body) {             val info = assertNotNull(GooglePoiDataSource.fetch("Slice1 Single", 37.7749, -122.4194))-            assertEquals(4.2, info.rating)+            assertEquals("https://single.example", info.website)         }     } }
maps/src/test/java/com/vayunmathur/maps/data/google/GooglePoiModelsSlice1Test.kt
diff --git a/maps/src/test/java/com/vayunmathur/maps/data/google/GooglePoiModelsSlice1Test.kt b/maps/src/test/java/com/vayunmathur/maps/data/google/GooglePoiModelsSlice1Test.ktindex 30654c31be..ec98df5ef4 100644--- a/maps/src/test/java/com/vayunmathur/maps/data/google/GooglePoiModelsSlice1Test.kt+++ b/maps/src/test/java/com/vayunmathur/maps/data/google/GooglePoiModelsSlice1Test.kt@@ -1,5 +1,6 @@ package com.vayunmathur.maps.data.google +import com.vayunmathur.maps.data.PoiPin import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertFalse@@ -7,29 +8,23 @@ import kotlin.test.assertNull import kotlin.test.assertTrue  /**- * Slice 1/3 (maps): the [GooglePoiInfo]/[GooglePoiPin] model layer —- * in particular [GooglePoiInfo.isEmpty], the gate that decides whether the- * place sheet shows an enrichment section at all.+ * Slice 1/3 (maps): the [GooglePoiInfo] place-details model and the offline [PoiPin] —+ * in particular [GooglePoiInfo.isEmpty], the gate that decides whether the place sheet+ * shows a details section at all. The model carries no review-shaped field: ratings,+ * counts and summaries come only from the archive.  */ class GooglePoiModelsSlice1Test {      @Test-    fun `a blank info is empty and any signal clears it`() {+    fun `a blank info is empty and any place fact clears it`() {         assertTrue(GooglePoiInfo().isEmpty)-        assertFalse(GooglePoiInfo(rating = 4.5).isEmpty)-        assertFalse(GooglePoiInfo(reviewCount = 10).isEmpty)         assertFalse(GooglePoiInfo(priceText = "$$").isEmpty)         assertFalse(GooglePoiInfo(website = "https://x.example").isEmpty)         assertFalse(GooglePoiInfo(phone = "1").isEmpty)         assertFalse(GooglePoiInfo(statusText = "Open").isEmpty)-        assertFalse(GooglePoiInfo(editorialSummary = "Nice").isEmpty)-        assertFalse(GooglePoiInfo(featuredReview = "Great").isEmpty)         assertFalse(GooglePoiInfo(fuelPrice = FuelPrice("$6.20", "Regular")).isEmpty)         assertFalse(GooglePoiInfo(hours = listOf("Tue: 9-5")).isEmpty)         assertFalse(GooglePoiInfo(photoUrls = listOf("https://x")).isEmpty)-        assertFalse(-            GooglePoiInfo(reviews = listOf(GoogleReview("A", null, 5, null, null))).isEmpty,-        )         assertFalse(             GooglePoiInfo(popularTimes = PoiPopularTimes(listOf(PoiDayBusyness(1, emptyList())))).isEmpty,         )@@ -37,46 +32,31 @@ class GooglePoiModelsSlice1Test {      @Test     fun `fields that never render alone do not clear emptiness`() {-        // openNow, category, priceLevel and featureId carry no section of their-        // own, so an info with only those is still nothing worth showing.+        // openNow, category and priceLevel carry no section of their own, so an info+        // with only those is still nothing worth showing.         assertTrue(GooglePoiInfo(openNow = true).isEmpty)         assertTrue(GooglePoiInfo(category = "Cafe").isEmpty)         assertTrue(GooglePoiInfo(priceLevel = 2).isEmpty)-        assertTrue(GooglePoiInfo(featureId = "0x1:0x2").isEmpty)     }      @Test-    fun `review and busyness models hold their documented ranges`() {-        val review = GoogleReview(-            author = "A",-            authorPhoto = null,-            rating = 5,-            relativeTime = "yesterday",-            text = "Good",-            photos = listOf("https://x"),-        )-        assertEquals("A", review.author)-        assertEquals(emptyList(), GoogleReview("B", null, 1, null, null).photos)-+    fun `busyness models hold their documented ranges`() {         val hour = PoiHourBusyness(hour = 9, occupancy = 80)         assertEquals(9, hour.hour)         assertEquals(PoiDayBusyness(dayOfWeek = 2, hours = listOf(hour)), PoiDayBusyness(2, listOf(hour)))     }      @Test-    fun `poi sections cover details photos and reviews`() {-        assertEquals(3, PoiSection.entries.size)-        assertTrue(PoiSection.entries.containsAll(listOf(PoiSection.DETAILS, PoiSection.PHOTOS, PoiSection.REVIEWS)))+    fun `poi sections are details and photos only`() {+        assertEquals(listOf(PoiSection.DETAILS, PoiSection.PHOTOS), PoiSection.entries.toList())     }      @Test     fun `a pin carries the minimum a map marker needs`() {-        val pin = GooglePoiPin(id = "p1", name = "Cafe", lat = 37.0, lng = -122.0)+        val pin = PoiPin(id = "p1", name = "Cafe", lat = 37.0, lng = -122.0)         assertEquals("p1", pin.id)         assertEquals("Cafe", pin.name)         assertNull(pin.category)-        assertNull(pin.rating)-        assertEquals(0.0, pin.prominence)         // Data-class copy keeps identity while restyling.         assertEquals("Diner", pin.copy(name = "Diner").name)         assertEquals(pin.id, pin.copy(name = "Diner").id)
maps/src/test/java/com/vayunmathur/maps/data/google/ReviewsWebParserSlice1Test.kt
diff --git a/maps/src/test/java/com/vayunmathur/maps/data/google/ReviewsWebParserSlice1Test.kt b/maps/src/test/java/com/vayunmathur/maps/data/google/ReviewsWebParserSlice1Test.ktdeleted file mode 100644index 5903f7c0bb..0000000000--- a/maps/src/test/java/com/vayunmathur/maps/data/google/ReviewsWebParserSlice1Test.kt+++ /dev/null@@ -1,90 +0,0 @@-package com.vayunmathur.maps.data.google--import kotlin.test.Test-import kotlin.test.assertEquals-import kotlin.test.assertNull-import kotlin.test.assertTrue--/**- * Slice 1/3 (maps): [ReviewsWebParser] — the DOM-scraped reviews JSON our own- * [WebReviewsFetcher] builds, parsed back into [GoogleReview]s.- *- * The parser is best-effort by contract (a malformed blob is an empty list,- * never a throw), so the tests pin the hostile inputs as well as the fields.- */-class ReviewsWebParserSlice1Test {--    @Test-    fun `a full card parses every field`() {-        val json = """[{-            "rid":"r1","r":5,"a":"Ada Lovelace","d":"2 weeks ago","t":"Lovely spot.",-            "av":"https://lh3.googleusercontent.com/a/avatar",-            "p":["https://lh3.googleusercontent.com/p/1","https://lh3.googleusercontent.com/p/2"]-        }]"""-        val reviews = ReviewsWebParser.parse(json)-        assertEquals(1, reviews.size)-        val r = reviews.single()-        assertEquals("Ada Lovelace", r.author)-        assertEquals(5, r.rating)-        assertEquals("2 weeks ago", r.relativeTime)-        assertEquals("Lovely spot.", r.text)-        assertEquals("https://lh3.googleusercontent.com/a/avatar", r.authorPhoto)-        assertEquals(-            listOf(-                "https://lh3.googleusercontent.com/p/1",-                "https://lh3.googleusercontent.com/p/2",-            ),-            r.photos,-        )-    }--    @Test-    fun `a card without an author is dropped`() {-        val json = """[{"rid":"r1","r":4,"a":"  ","t":"Ghost review"},{"rid":"r2","r":4,"t":"Nameless"}]"""-        assertTrue(ReviewsWebParser.parse(json).isEmpty())-    }--    @Test-    fun `ratings clamp to the 0 to 5 range`() {-        val json = """[{"a":"High","r":9},{"a":"Low","r":-3},{"a":"Missing"}]"""-        val ratings = ReviewsWebParser.parse(json).map { it.rating }-        assertEquals(listOf(5, 0, 0), ratings)-    }--    @Test-    fun `non-http photo and avatar urls are ignored`() {-        val json = """[{-            "a":"Picky","r":3,-            "av":"data:image/png;base64,xx",-            "p":["https://lh3.googleusercontent.com/p/1","https://lh3.googleusercontent.com/p/1","blob:internal","/relative/path"]-        }]"""-        val r = ReviewsWebParser.parse(json).single()-        assertNull(r.authorPhoto)-        // De-duplicated, http-only.-        assertEquals(listOf("https://lh3.googleusercontent.com/p/1"), r.photos)-    }--    @Test-    fun `blank date and text become null`() {-        val json = """[{"a":"Terse","r":4,"d":"  ","t":""}]"""-        val r = ReviewsWebParser.parse(json).single()-        assertNull(r.relativeTime)-        assertNull(r.text)-    }--    @Test-    fun `rating-only reviews keep a null text`() {-        val json = """[{"a":"Stars","r":5}]"""-        val r = ReviewsWebParser.parse(json).single()-        assertEquals(5, r.rating)-        assertNull(r.text)-    }--    @Test-    fun `malformed blobs parse to empty, never throw`() {-        assertTrue(ReviewsWebParser.parse("").isEmpty())-        assertTrue(ReviewsWebParser.parse("not json").isEmpty())-        assertTrue(ReviewsWebParser.parse("""{"not":"an array"}""").isEmpty())-        assertTrue(ReviewsWebParser.parse("[]").isEmpty())-    }-}
maps/src/test/java/com/vayunmathur/maps/data/google/Slice1Pass2ReviewsFetchTest.kt
diff --git a/maps/src/test/java/com/vayunmathur/maps/data/google/Slice1Pass2ReviewsFetchTest.kt b/maps/src/test/java/com/vayunmathur/maps/data/google/Slice1Pass2ReviewsFetchTest.ktdeleted file mode 100644index 87eede8196..0000000000--- a/maps/src/test/java/com/vayunmathur/maps/data/google/Slice1Pass2ReviewsFetchTest.kt+++ /dev/null@@ -1,43 +0,0 @@-package com.vayunmathur.maps.data.google--import androidx.test.core.app.ApplicationProvider-import kotlinx.coroutines.CoroutineScope-import kotlinx.coroutines.Dispatchers-import kotlinx.coroutines.async-import kotlinx.coroutines.runBlocking-import org.junit.runner.RunWith-import org.robolectric.RobolectricTestRunner-import org.robolectric.shadows.ShadowLooper-import kotlin.test.Test-import kotlin.test.assertNull-import kotlin.test.assertTrue--/**- * Slice 1/3 second pass (maps): [WebReviewsFetcher.fetch] with a valid cid —- * the hidden-WebView scrape in the sandbox never answers through the JS- * bridge, so the fetch must walk its load/settle path and give up (null)- * at its own timeout rather than hanging or throwing.- */-@RunWith(RobolectricTestRunner::class)-class Slice1Pass2ReviewsFetchTest {--    @Test-    fun `valid cid scrape times out to null in the sandbox`() = runBlocking {-        val fetcher = WebReviewsFetcher(-            ApplicationProvider.getApplicationContext(),-        )-        var progressTicks = 0-        val deferred = CoroutineScope(Dispatchers.Default).async {-            fetcher.fetch("0x1234:0xABCD", onProgress = { progressTicks++ })-        }-        // the fetcher waits on the main looper for page settle; pump it while-        // the scrape's own 45s timeout runs down in real time-        val deadline = System.currentTimeMillis() + 90_000-        while (!deferred.isCompleted && System.currentTimeMillis() < deadline) {-            ShadowLooper.idleMainLooper()-            Thread.sleep(100)-        }-        assertTrue(deferred.isCompleted)-        assertNull(deferred.await())-    }-}
maps/src/test/java/com/vayunmathur/maps/service/ReviewsScraperSlice3ExtraTest.kt
diff --git a/maps/src/test/java/com/vayunmathur/maps/service/ReviewsScraperSlice3ExtraTest.kt b/maps/src/test/java/com/vayunmathur/maps/service/ReviewsScraperSlice3ExtraTest.ktdeleted file mode 100644index 3abce83767..0000000000--- a/maps/src/test/java/com/vayunmathur/maps/service/ReviewsScraperSlice3ExtraTest.kt+++ /dev/null@@ -1,106 +0,0 @@-package com.vayunmathur.maps.service--import android.content.ComponentName-import android.content.Context-import android.os.Bundle-import android.os.Handler-import android.os.Looper-import android.os.Message-import android.os.Messenger-import androidx.test.core.app.ApplicationProvider-import kotlin.test.Test-import kotlin.test.assertEquals-import kotlin.test.assertTrue-import kotlinx.coroutines.Dispatchers-import kotlinx.coroutines.async-import kotlinx.coroutines.delay-import kotlinx.coroutines.runBlocking-import kotlinx.coroutines.withTimeout-import org.junit.runner.RunWith-import org.robolectric.RobolectricTestRunner-import org.robolectric.Shadows-import org.robolectric.annotation.Config-import org.robolectric.shadows.ShadowApplication--/**- * Slice 3/3 extra: [ReviewsScraperClient] IPC against a fake scraper service- * (a Messenger that speaks the MSG_FETCH/MSG_PARTIAL/MSG_RESULT protocol),- * plus the unbound failure path.- */-@RunWith(RobolectricTestRunner::class)-@Config(sdk = [34])-class ReviewsScraperSlice3ExtraTest {--    private val app get() = ApplicationProvider.getApplicationContext<android.content.Context>()--    private val reviewsJson = """[{"a":"Ann","r":5,"d":"a week ago","t":"Loved it"},{"a":"Bo","r":3,"t":"Ok"}]"""--    /** Installs a fake :reviews service that replies PARTIAL then RESULT for any FETCH. */-    private fun installFakeService(replyJson: String?, sendPartial: Boolean = true) {-        val handler = object : Handler(Looper.getMainLooper()) {-            override fun handleMessage(msg: Message) {-                if (msg.what != ReviewsScraperService.MSG_FETCH) return-                val id = msg.arg1-                val replyTo = msg.replyTo ?: return-                if (sendPartial) {-                    val partial = Message.obtain(null, ReviewsScraperService.MSG_PARTIAL, id, 0)-                    partial.data = Bundle().apply { putString(ReviewsScraperService.KEY_JSON, replyJson) }-                    replyTo.send(partial)-                }-                val result = Message.obtain(null, ReviewsScraperService.MSG_RESULT, id, 0)-                result.data = Bundle().apply { putString(ReviewsScraperService.KEY_JSON, replyJson) }-                replyTo.send(result)-            }-        }-        val messenger = Messenger(handler)-        val shadow = Shadows.shadowOf(app as android.app.Application) as ShadowApplication-        shadow.setComponentNameAndServiceForBindService(-            ComponentName(app, ReviewsScraperService::class.java),-            messenger.binder,-        )-    }--    /** fetch() hops to Dispatchers.Main, whose Robolectric looper is paused: pump it. */-    private suspend fun <T> pumpMain(block: suspend () -> T): T {-        val deferred = kotlinx.coroutines.CoroutineScope(Dispatchers.Default).async { block() }-        withTimeout(15000) {-            while (!deferred.isCompleted) {-                Shadows.shadowOf(Looper.getMainLooper()).idle()-                delay(25)-            }-        }-        return deferred.await()-    }--    @Test fun fetchStreamsPartialsAndReturnsParsedResult() { runBlocking {-        installFakeService(reviewsJson)-        val client = ReviewsScraperClient(app)-        val partials = mutableListOf<Int>()-        val reviews = pumpMain { client.fetch("feature-1") { partials.add(it.size) } }-        assertEquals(listOf("Ann", "Bo"), reviews.map { it.author })-        assertEquals(5, reviews[0].rating)-        assertEquals(listOf(2), partials) // one partial with both reviews-        // Second fetch reuses the warm binding-        val again = pumpMain { client.fetch("feature-2") {} }-        assertEquals(2, again.size)-        Unit-    } }--    @Test fun fetchWithNullResultReturnsEmpty() { runBlocking {-        installFakeService(null, sendPartial = false)-        val client = ReviewsScraperClient(app)-        val reviews = pumpMain { client.fetch("feature-x") {} }-        assertTrue(reviews.isEmpty())-        Unit-    } }--    @Test fun fetchWithoutServiceReturnsEmpty() { runBlocking {-        // No fake service installed and no real :reviews process under Robolectric:-        // bind fails or never connects, and fetch must degrade to empty, not hang.-        // Robolectric's bindService for an unresolvable component returns false.-        val client = ReviewsScraperClient(app)-        val reviews = pumpMain { client.fetch("feature-y") {} }-        assertTrue(reviews.isEmpty())-        Unit-    } }-}
maps/src/test/java/com/vayunmathur/maps/ui/BottomSheetWiringSlice2Test.kt
diff --git a/maps/src/test/java/com/vayunmathur/maps/ui/BottomSheetWiringSlice2Test.kt b/maps/src/test/java/com/vayunmathur/maps/ui/BottomSheetWiringSlice2Test.ktindex b2216b0526..9728b7ef44 100644--- a/maps/src/test/java/com/vayunmathur/maps/ui/BottomSheetWiringSlice2Test.kt+++ b/maps/src/test/java/com/vayunmathur/maps/ui/BottomSheetWiringSlice2Test.kt@@ -72,11 +72,11 @@ class BottomSheetWiringSlice2Test {             }         }         rule.runOnIdle {-            actions.setPoiSection(PoiSection.REVIEWS)+            actions.setPoiSection(PoiSection.PHOTOS)             actions.openNearestStop(37.8, -122.4)         }-        assertEquals(PoiSection.REVIEWS, section)-        assertEquals(PoiSection.REVIEWS, selected.poiSection.value)+        assertEquals(PoiSection.PHOTOS, section)+        assertEquals(PoiSection.PHOTOS, selected.poiSection.value)         assertEquals(37.8, opened?.first)         assertEquals(-122.4, opened?.second)     }
maps/src/test/java/com/vayunmathur/maps/ui/PlaceHeaderDeepSlice3ExtraTest.kt
diff --git a/maps/src/test/java/com/vayunmathur/maps/ui/PlaceHeaderDeepSlice3ExtraTest.kt b/maps/src/test/java/com/vayunmathur/maps/ui/PlaceHeaderDeepSlice3ExtraTest.ktindex f95b93c4a0..4490d449c1 100644--- a/maps/src/test/java/com/vayunmathur/maps/ui/PlaceHeaderDeepSlice3ExtraTest.kt+++ b/maps/src/test/java/com/vayunmathur/maps/ui/PlaceHeaderDeepSlice3ExtraTest.kt@@ -55,7 +55,7 @@ class PlaceHeaderDeepSlice3ExtraTest {     @Test fun headerWithPoiShowsTabsAndSwitchesSection() {         val actions = RecordingActions()         val state = PlacePanelState(-            poi = GooglePoiInfo(rating = 4.2, reviewCount = 87, popularTimes = null),+            poi = GooglePoiInfo(photoUrls = listOf("https://example.com/p.jpg"), popularTimes = null),             saved = emptyList(),         )         rule.setContent {
maps/src/test/java/com/vayunmathur/maps/ui/PlaceSheetSlice3Test.kt
diff --git a/maps/src/test/java/com/vayunmathur/maps/ui/PlaceSheetSlice3Test.kt b/maps/src/test/java/com/vayunmathur/maps/ui/PlaceSheetSlice3Test.ktindex 645386b1e1..b0d0032346 100644--- a/maps/src/test/java/com/vayunmathur/maps/ui/PlaceSheetSlice3Test.kt+++ b/maps/src/test/java/com/vayunmathur/maps/ui/PlaceSheetSlice3Test.kt@@ -11,7 +11,6 @@ import com.vayunmathur.library.map.GeoPoint import com.vayunmathur.maps.data.OpeningHours import com.vayunmathur.maps.data.SpecificFeature import com.vayunmathur.maps.data.google.GooglePoiInfo-import com.vayunmathur.maps.data.google.GoogleReview import com.vayunmathur.maps.data.google.PoiSection import com.vayunmathur.maps.util.PlacePanelActions import com.vayunmathur.maps.util.PlacePanelState@@ -60,7 +59,7 @@ class PlaceSheetSlice3Test {      // Header tests below exercise the revealed state; the mask itself is     // pinned in PlaceMaskTest.-    private fun panel(saved: Boolean = false) = PlacePanelState(saved = emptyList(), detailsRevealed = true)+    private fun panel() = PlacePanelState(saved = emptyList(), detailsRevealed = true)      // --- PlaceSheet (generic) --- @@ -138,28 +137,6 @@ class PlaceSheetSlice3Test {         rule.onNodeWithText("Tuesday", substring = true).assertDoesNotExist()     } -    @Test-    fun `enrichment details show the editorial summary`() {-        val info = GooglePoiInfo(editorialSummary = "A landmark ferry terminal")-        rule.setContent {-            GooglePoiEnrichment(info, PoiSection.DETAILS)-        }-        rule.onNodeWithText("A landmark ferry terminal").assertIsDisplayed()-    }--    @Test-    fun `enrichment reviews tab lists the reviews`() {-        val info = GooglePoiInfo(-            reviews = listOf(-                GoogleReview("Ann", null, 5, "a week ago", "Loved it"),-            ),-        )-        rule.setContent {-            GooglePoiEnrichment(info, PoiSection.REVIEWS)-        }-        rule.onNodeWithText("Loved it", substring = true).assertIsDisplayed()-    }-     // --- PlaceSheetHeader ---      @Test@@ -172,7 +149,7 @@ class PlaceSheetSlice3Test {         }         rule.setContent {             PlaceSheetHeader(-                panelState = panel(saved = false),+                panelState = panel(),                 panelActions = actions,                 inactiveNavigation = null,                 feature = genericPlace(),
maps/src/test/java/com/vayunmathur/maps/ui/PoiEnrichmentKeyTest.kt
diff --git a/maps/src/test/java/com/vayunmathur/maps/ui/PoiEnrichmentKeyTest.kt b/maps/src/test/java/com/vayunmathur/maps/ui/PoiEnrichmentKeyTest.ktindex 43c5909907..766023d361 100644--- a/maps/src/test/java/com/vayunmathur/maps/ui/PoiEnrichmentKeyTest.kt+++ b/maps/src/test/java/com/vayunmathur/maps/ui/PoiEnrichmentKeyTest.kt@@ -1,40 +1,22 @@ package com.vayunmathur.maps.ui  import com.vayunmathur.maps.data.google.GooglePoiInfo-import com.vayunmathur.maps.data.google.GoogleReview import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertNotEquals  /**- * The coarse enrichment identity behind the inner place sheet's contentKey.+ * The coarse place-details identity behind the inner place sheet's contentKey.  *- * Late-arriving reviews/photos grow the sheet content after measurement, which- * the scaffold's learned ceiling would otherwise never re-learn — so the key- * must move when the enrichment arrives. But it must stay coarse- * (counts/presence, not the lists): progressive review streaming would reset- * the ceiling on every partial if the key named the content itself.+ * Late-arriving details grow the sheet content after measurement, which the scaffold's+ * learned ceiling would otherwise never re-learn — so the key must move when the details+ * arrive. But it must stay coarse (counts/presence, not the lists).  */ class PoiEnrichmentKeyTest { -    private fun review(i: Int) = GoogleReview(-        author = "a$i",-        authorPhoto = null,-        rating = 5,-        relativeTime = null,-        text = "review $i",-    )-     @Test     fun `null enrichment keys to zero`() {-        assertEquals(PoiEnrichmentKey(0, 0, false), PoiEnrichmentKey.of(null))-    }--    @Test-    fun `arriving reviews move the key`() {-        val before = PoiEnrichmentKey.of(GooglePoiInfo())-        val after = PoiEnrichmentKey.of(GooglePoiInfo(reviews = List(8, ::review)))-        assertNotEquals(before, after)+        assertEquals(PoiEnrichmentKey(0, hasHours = false, hasPopularTimes = false), PoiEnrichmentKey.of(null))     }      @Test@@ -45,20 +27,16 @@ class PoiEnrichmentKeyTest {     }      @Test-    fun `a featured review moves the key`() {+    fun `arriving hours move the key`() {         val before = PoiEnrichmentKey.of(GooglePoiInfo())-        val after = PoiEnrichmentKey.of(GooglePoiInfo(featuredReview = "great soup"))+        val after = PoiEnrichmentKey.of(GooglePoiInfo(hours = listOf("Tuesday: 9 AM–5 PM")))         assertNotEquals(before, after)     }      @Test-    fun `review text churn without growth keeps the key`() {-        // Progressive streaming re-sends the accumulated list on every parse:-        // same size, same shape → same key → the ceiling survives the partials.-        val a = PoiEnrichmentKey.of(GooglePoiInfo(reviews = List(8, ::review)))-        val b = PoiEnrichmentKey.of(-            GooglePoiInfo(reviews = List(8) { review(it).copy(text = "edited $it") })-        )+    fun `photo url churn without growth keeps the key`() {+        val a = PoiEnrichmentKey.of(GooglePoiInfo(photoUrls = listOf("u1", "u2")))+        val b = PoiEnrichmentKey.of(GooglePoiInfo(photoUrls = listOf("v1", "v2")))         assertEquals(a, b)     } }
maps/src/test/java/com/vayunmathur/maps/ui/PoiEnrichmentSlice3ExtraTest.kt
diff --git a/maps/src/test/java/com/vayunmathur/maps/ui/PoiEnrichmentSlice3ExtraTest.kt b/maps/src/test/java/com/vayunmathur/maps/ui/PoiEnrichmentSlice3ExtraTest.ktindex 909a5658f1..3792a57d5d 100644--- a/maps/src/test/java/com/vayunmathur/maps/ui/PoiEnrichmentSlice3ExtraTest.kt+++ b/maps/src/test/java/com/vayunmathur/maps/ui/PoiEnrichmentSlice3ExtraTest.kt@@ -10,7 +10,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import com.vayunmathur.library.ui.DynamicTheme import com.vayunmathur.maps.data.google.FuelPrice import com.vayunmathur.maps.data.google.GooglePoiInfo-import com.vayunmathur.maps.data.google.GoogleReview import com.vayunmathur.maps.data.google.PoiDayBusyness import com.vayunmathur.maps.data.google.PoiHourBusyness import com.vayunmathur.maps.data.google.PoiPopularTimes@@ -30,7 +29,6 @@ class PoiEnrichmentSlice3ExtraTest {      @Test fun detailsWithFuelHoursAndPopularTimes() {         val info = GooglePoiInfo(-            editorialSummary = "A busy station",             fuelPrice = FuelPrice("$3.89", "Regular"),             hours = listOf("Monday: 6 AM–10 PM", "Funday 24 hours"), // second line has no day separator             popularTimes = PoiPopularTimes(listOf(@@ -41,7 +39,6 @@ class PoiEnrichmentSlice3ExtraTest {         rule.setContent { DynamicTheme { GooglePoiEnrichment(info, PoiSection.DETAILS) } }         rule.onNodeWithText("$3.89").assertIsDisplayed()         rule.onNodeWithText("Regular").assertIsDisplayed()-        rule.onNodeWithText("A busy station").assertIsDisplayed()         rule.onNodeWithText("Monday").assertIsDisplayed()         rule.onNodeWithText("Popular times", substring = true).assertIsDisplayed()         rule.onRoot().captureToImage()@@ -66,38 +63,17 @@ class PoiEnrichmentSlice3ExtraTest {         rule.onRoot().captureToImage()     } -    @Test fun reviewsCardsAndFeaturedFallback() {-        val info = GooglePoiInfo(reviews = listOf(-            GoogleReview("Ann", "https://example.com/av.jpg", 5, "a week ago", "Loved the food", photos = listOf("https://example.com/r1.jpg")),-            GoogleReview("Bo", null, 0, null, null), // rating-only, no stars row (0 out of 1..5), no text-        ))-        rule.setCon

Diff truncated.