Add PopulationDensityProvider
This change adds the concept of population density providers in AOSP. It allows the framework to query the population density at a given location. Internally, this is backed by a new type of Provider, following the current conventions in the location package. There is no app-facing change, only the LocationManagerService will access this provider (see other CLs in the topic).
Because the provider will be implemented by Play Services (or OEM implementations), we add a proxy mechanism identical to the current ProxyLocationProvider, which reads the config.xml and instantiates the correct provider.
The core of the change is IPopulationDensityProvider.aidl.
In details:
- We add a new IPopulationDensityProvider IDL with its associated implementation PopulationDensityProviderBase.
- We add the IDL for two callback type for the S2CellId and the default coarsening level.
- We change the LocationManagerService to instantiate a ProxyPopulationDensityProvider.
- This ProxyPopulationDensityProvider creates the correct provider given the XML config.
Tests:
- atest CtsLocationNoneTestCases:PopulationDensityProviderBaseTest
- atest FrameworksMockingServicesTests:LocationManagerServiceTest
NB: I also did a manual test by implementing a fake provider and querying it, this works on Pixel 7 pro, see linked commits with topic "population-density-provider-test-dns"
Test: manual atest on Pixel 7 pro (see above)
Bug: 376198890
Flag: android.location.flags.population_density_provider
Change-Id: I90663d478200c734abbf5f442dfb1bb8bb79a875
diff --git a/location/api/system-current.txt b/location/api/system-current.txt
index cf3f740..8cd08d3 100644
--- a/location/api/system-current.txt
+++ b/location/api/system-current.txt
@@ -642,6 +642,14 @@
method public void onFlushComplete();
}
+ @FlaggedApi("android.location.flags.population_density_provider") public abstract class PopulationDensityProviderBase {
+ ctor public PopulationDensityProviderBase(@NonNull android.content.Context, @NonNull String);
+ method @Nullable public final android.os.IBinder getBinder();
+ method public abstract void onGetCoarsenedS2Cell(double, double, @NonNull android.os.OutcomeReceiver<long[],java.lang.Throwable>);
+ method public abstract void onGetDefaultCoarseningLevel(@NonNull android.os.OutcomeReceiver<java.lang.Integer,java.lang.Throwable>);
+ field public static final String ACTION_POPULATION_DENSITY_PROVIDER = "com.android.location.service.PopulationDensityProvider";
+ }
+
public final class ProviderRequest implements android.os.Parcelable {
method public int describeContents();
method @IntRange(from=0) public long getIntervalMillis();