Deep in Android's location service there's a file called LocationFudger, and a comment in it that tells you exactly what the fuzzy "approximate location" grant is for. The random offset it adds to your position, it says, "changes very slowly over time, to mitigate against taking many location samples and averaging them out."
That's the whole promise. Give a weather app approximate location instead of precise, and it gets your rough area, accurate to within about 3 km² per Google's docs. The offset stops the app from collecting a pile of those rough fixes and averaging its way back to your front door, because the offset barely moves.
Except it does move. It gets wiped and redrawn, from scratch, every time you reboot.
What approximate actually does to a fix
When you grant coarse location, your real position never reaches the app. LocationFudger does two things to it first. It adds a random offset drawn from a gaussian, nextGaussian() * accuracy / 4 on each axis, so about 500 m of sigma at the default 2 km accuracy. Then it snaps the result to a 2 km grid (each cell is 4 km², a bit more than the 3 km² the docs round it to).
The snap is what makes the result stable. Open the app twice in a row and you get the same grid square both times, because your position plus the slow-moving offset lands in the same cell. The offset is the clever bit: without it, anyone standing near a grid boundary would flip between two cells and give themselves away, and a drifting offset means you can't just average a stack of fixes to cancel it out. The comment is right that a slow offset beats averaging.
The thing is, the offset is only slow within one boot.
The offset is a per-boot secret
Here's the constructor. LocationFudger is built with a fresh SecureRandom, and the first thing it does is draw its offsets:
public LocationFudger(float accuracyM) {
this(accuracyM, SystemClock.elapsedRealtimeClock(), new SecureRandom());
}
public void resetOffsets() {
mLatitudeOffsetM = nextRandomOffset();
mLongitudeOffsetM = nextRandomOffset();
}
mLatitudeOffsetM and mLongitudeOffsetM are plain fields. Nothing writes them to disk, nothing reads them back. The slow drift the comment talks about nudges them by 3% an hour while the service is up, so over a day they barely budge. But the location service is built when the system starts, and torn down when it stops. Reboot, and the constructor runs again, new SecureRandom() and all, and you get a brand new offset with no relation to the last one.
So a reboot isn't more of the same slow drift. It's a fresh, independent sample of the blur. And every independent sample is one more thing to average.
You don't have to take the comment's word for the re-roll. I compiled the real LocationFudger straight from AOSP and built it fresh 5,000 times, which is what Android does to it at each service start, feeding one unmoving point. Within a single instance, asking for the same point twice gave identical coarse fixes, as the grid snap promises. Across the 5,000 instances, every single one was different: 5,000 distinct coarse points for one home that never moved.
It holds on a running build too. I put the AOSP Android 17 system image in an emulator, pinned a mock GPS fix at one spot in London, and gave a throwaway app nothing but ACCESS_COARSE_LOCATION. Opened twice in one boot, it read back the identical coarse fix to seven decimal places. Rebooted, and it came back with a different one, and a different one again after that. The app can tell which fixes are independent without any extra permission: BOOT_COUNT has been a public Settings.Global value since 2016, so it reads that and keeps one fix per number. If it wanted to be sneaky about it, currentTimeMillis minus elapsedRealtime gives the boot time too.
A year of updates, averaged
Once you've got independent samples of a known blur, pinning the real position is just maths, and the grid is open source so the app knows its size and where its lines fall. How close you get depends a bit on where in a cell you happen to live, so rather than read too much into the one home I'd measured, I ran the exact AOSP constants through a simulation (2 km accuracy, 500 m offset sigma, the same grid snap) over 20,000 random homes, scoring a best-guess estimate against how many reboots the app had caught:
Median error estimating a fixed home, by reboots the app has seen (the data)
Posterior-mean estimate against the true point, 20,000 trials per value. One raw fix is a median
944 m out.
One fix is about 940 m off, which is the blur doing its job. Twelve, roughly a year of monthly security patches, and you're down to 263 m. Fifty, and it's 128 m. The curve keeps going - a few years of updates and you're inside a couple of blocks. The app never asked for precise location, and the user never granted it.
And you don't have to wait for the user to travel. This works on a fixed point, like the place the phone sits every night. An app that catches you at home once per boot is building the average whether you move or not.
Reboots aren't rare. Monthly security patches are one a month on their own. Play system updates add more, and a 2025 Play services update brought a 72-hour inactivity reboot that restarts a phone left locked for three days. Call it a dozen fresh draws a year without trying, more if you actually turn your phone off and on.
It's worse than one draw per boot
I've been saying "one fix per boot", but a coarse-only app can do better than that. LocationManagerService builds a separate provider manager for network, fused and gps, and each one gets its own LocationFudger with its own offset:
mLocationFudger = new LocationFudger(mSettingsHelper.getCoarseLocationAccuracyM());
On the emulator, the gps and passive providers handed my app two different grid squares for the same real point, in the same boot. That's two independent offsets to average, not one. The split is deliberate: each provider gets its own fudger so one can't be used to work out another's offset, and the code even resets a provider's offset the moment a mock provider is removed, because "the mock provider could have been used to infer the current location fudger offsets". Fair enough. But it means a reboot resets every provider's offset at once, and the app gets several fresh samples each time instead of one. So the reboot counts on that chart are really a worst case: with two or three providers answering per boot, the same error arrives in a fraction of the reboots.
Google was told
None of this is a bug in the sense of a crash. It's the coarsening behaving exactly as written. The question is whether "exactly as written" defeats the point of approximate location, and Google's own approximate-geolocation explainer suggests it should care: it names "precise location reconstruction" from many approximate fixes as a threat that coarsening algorithms "are expected to implement mitigations against", and points at LocationFudger as the mitigation. Averaging across reboots walks straight around it.
This got reported. It went to Google's vulnerability reward programme in November, and the answer came back:
The reply, trimmed to the body.
"Not a security vulnerability" is a fair call, depending on where you draw the line. It's not a remote exploit, and it needs an app you installed and granted location to first. The bit I didn't expect was "Won't Fix (Infeasible)". From the outside the fix looks like a few lines, write the offset to disk at shutdown and read it back at start, or seed it from a stable per-install value so a reboot doesn't redraw it. Google didn't say what makes that infeasible, and a persisted offset does turn into one more stable per-install value an app could try to fingerprint, so maybe there's a reason that isn't obvious from the source. They did log it "for potential remediation in a future version", so it's not nothing.
I've not gone hunting for an app that actually does this, and I'd be mildly surprised to find one in the wild - it's a slow, patient trick for a fairly small prize. The point is that nothing in the platform stops it.
If you want an app to have your rough area once and no more, the "only this time" grant or the one-shot location button hand it a single fix with nothing to average, and anything that doesn't need your location can just be told no. Picking "approximate" over "precise" still feels like the careful choice. It mostly just makes finding you take longer.
More like this on blog.peng.ly


Top comments (0)