Skip to content

use population density for coarse locations - #423

Open
soupslurpr wants to merge 6 commits into
GrapheneOS:17from
soupslurpr:population-density-provider
Open

use population density for coarse locations#423
soupslurpr wants to merge 6 commits into
GrapheneOS:17from
soupslurpr:population-density-provider

Conversation

@soupslurpr

@soupslurpr soupslurpr commented Aug 5, 2026

Copy link
Copy Markdown
Member

Use population density to select S2 granularity for coarse locations. Replace the asynchronous density cache and fixed-grid fallback with bounded synchronous provider queries. Quantize query coordinates, derive output cells locally using only provider-returned levels, share identical in-flight queries without retaining completed provider answers, and fail closed when coarsening is unavailable.

Pin the provider to NetworkLocation and require its population density service to declare android.permission.BIND_POPULATION_DENSITY_PROVIDER_SERVICE as its bind permission. Bound batch coarsening work, preserve registrations after suppressed fixes, correct the S2 edge table, and synchronize the two random offset components.

Testing:

  • focused FrameworksMockingServicesTests classes: 136 passed
  • relevant CtsLocationCoarseTestCases and CtsLocationFineTestCases classes: 20 passed
  • NetworkLocation device, cold-start, and Rust integration tests: 32 passed
  • full akita cur userdebug build and flash
  • real-world density-based coarsening on the development device

Related repository: GrapheneOS/platform_external_population-density.

Related changes:

Replace the asynchronous density cache with bounded synchronous
queries. Quantize provider inputs, derive output cells locally using
only provider-returned levels, and share identical in-flight queries.
Do not retain completed answers. Suppress provider faults instead of
allowing under-coarsened results. Keep the finalized provider SystemApi
signatures unchanged.
Fail closed when population density coarsening is unavailable instead
of reverting to a fixed grid. Retain streaming and current-location
registrations after suppressed real fixes so transient provider faults
recover on a later delivery. Preserve null timeout completion for
current-location requests and move the app-op note after coarsening.
Stop before each LocationResult query once the batch-wide budget is
spent. Deliver the completed oldest-to-newest prefix, or fail closed
when the deadline expires before the first location. Keep direct
Location coarsening outside the batch deadline and cover both paths
with deterministic clocks.
Bind population density only from NetworkLocation. Require the service
to protect its Binder entry point with the platform bind permission.
Add a permission-aware config supplier overload while preserving the
existing internal call shape for other service watchers.
Restore the geometric halving sequence at levels 9 and 11. Extend
the edge test across both corrected entries and their shared neighbor.
Refresh, read, and reset both random offset components under the same
monitor. This preserves a consistent pair and establishes visibility for
security-motivated resets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant