Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 7749835f authored by Ludovic Barman's avatar Ludovic Barman
Browse files

Coarse locations based on population density.

At a high-level, this adds the option to coarsen (fudge) locations based on the population density at the device location. This feature is gated behind a flag.

In details:

Adds a new LocationFudgerCache to the existing LocationFudger. This cache is responsible for querying and storing values from the population density provider created in the other commits of this topic.
The cache is necessary because of the asynchronous nature of the provider, whereas the LocationFudger requires an immediate answer.
The cache is a simple fixed-size LIFO cache that stores S2CellIds, and returns the S2 level when a query corresponds to a cell in the cache.
If the cache doesn't hold a corresponding value, it returns a default value.

Changes the LocationFudger to use this cache and coarsen the location to the indicated S2 level.

Changes the LocationProviderManager and LocationManagerService to pass the new LocationFudgerCache to LocationFudger.

Tests:
- atest FrameworksMockingServicesTests:LocationManagerServiceTest
- atest FrameworksMockingServicesTests:LocationProviderManagerTest
- atest FrameworksMockingServicesTests:LocationFudgerTest
- atest FrameworksMockingServicesTests:LocationFudgerCacheTest

Test: manual atest on Pixel 7 pro (see above)
Bug: 376198890
Flag: android.location.flags.density_based_coarse_locations
Change-Id: I66d1d80fdb75e82781d09e787e8a2c17af092747
parent 4f699aab
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment