Add option for framework overlay to handle the GPS_PROVIDER in LocationManagerService.
Bug: 260010264 Test: Manual Change-Id: I657a6c9061492c31382a7ab619607d4a011a0af9
This commit is contained in:
@@ -1828,6 +1828,14 @@
|
||||
config_enableFusedLocationOverlay is false. -->
|
||||
<string name="config_fusedLocationProviderPackageName" translatable="false">com.android.location.fused</string>
|
||||
|
||||
<!-- If true will use the GNSS hardware implementation to service the GPS_PROVIDER. If false
|
||||
will allow the GPS_PROVIDER to be replaced by an app at run-time (restricted to the package
|
||||
specified by config_gnssLocationProviderPackageName). -->
|
||||
<bool name="config_useGnssHardwareProvider" translatable="false">true</bool>
|
||||
<!-- Package name providing GNSS location support. Used only when
|
||||
config_useGnssHardwareProvider is false. -->
|
||||
<string name="config_gnssLocationProviderPackageName" translatable="false">@null</string>
|
||||
|
||||
<!-- Default value for the ADAS GNSS Location Enabled setting if this setting has never been
|
||||
set before. -->
|
||||
<bool name="config_defaultAdasGnssLocationEnabled" translatable="false">false</bool>
|
||||
|
||||
@@ -1963,6 +1963,7 @@
|
||||
<java-symbol type="bool" name="config_enableActivityRecognitionHardwareOverlay" />
|
||||
<java-symbol type="bool" name="config_defaultAdasGnssLocationEnabled" />
|
||||
<java-symbol type="bool" name="config_enableFusedLocationOverlay" />
|
||||
<java-symbol type="bool" name="config_useGnssHardwareProvider" />
|
||||
<java-symbol type="bool" name="config_enableGeocoderOverlay" />
|
||||
<java-symbol type="bool" name="config_enableGeofenceOverlay" />
|
||||
<java-symbol type="bool" name="config_enableNetworkLocationOverlay" />
|
||||
@@ -2125,6 +2126,7 @@
|
||||
<java-symbol type="string" name="config_datause_iface" />
|
||||
<java-symbol type="string" name="config_activityRecognitionHardwarePackageName" />
|
||||
<java-symbol type="string" name="config_fusedLocationProviderPackageName" />
|
||||
<java-symbol type="string" name="config_gnssLocationProviderPackageName" />
|
||||
<java-symbol type="string" name="config_geocoderProviderPackageName" />
|
||||
<java-symbol type="string" name="config_geofenceProviderPackageName" />
|
||||
<java-symbol type="string" name="config_networkLocationProviderPackageName" />
|
||||
|
||||
@@ -101,6 +101,15 @@ public abstract class LocationProviderBase {
|
||||
public static final String ACTION_FUSED_PROVIDER =
|
||||
"com.android.location.service.FusedLocationProvider";
|
||||
|
||||
/**
|
||||
* The action the wrapping service should have in its intent filter to implement the
|
||||
* {@link android.location.LocationManager#GPS_PROVIDER}.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final String ACTION_GNSS_PROVIDER =
|
||||
"android.location.provider.action.GNSS_PROVIDER";
|
||||
|
||||
final String mTag;
|
||||
final @Nullable String mAttributionTag;
|
||||
final IBinder mBinder;
|
||||
|
||||
@@ -28,6 +28,7 @@ import static android.location.LocationManager.GPS_PROVIDER;
|
||||
import static android.location.LocationManager.NETWORK_PROVIDER;
|
||||
import static android.location.LocationRequest.LOW_POWER_EXCEPTIONS;
|
||||
import static android.location.provider.LocationProviderBase.ACTION_FUSED_PROVIDER;
|
||||
import static android.location.provider.LocationProviderBase.ACTION_GNSS_PROVIDER;
|
||||
import static android.location.provider.LocationProviderBase.ACTION_NETWORK_PROVIDER;
|
||||
|
||||
import static com.android.server.location.LocationPermissions.PERMISSION_COARSE;
|
||||
@@ -439,9 +440,24 @@ public class LocationManagerService extends ILocationManager.Stub implements
|
||||
mGnssManagerService = new GnssManagerService(mContext, mInjector, gnssNative);
|
||||
mGnssManagerService.onSystemReady();
|
||||
|
||||
boolean useGnssHardwareProvider = mContext.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_useGnssHardwareProvider);
|
||||
AbstractLocationProvider gnssProvider = null;
|
||||
if (!useGnssHardwareProvider) {
|
||||
gnssProvider = ProxyLocationProvider.create(
|
||||
mContext,
|
||||
GPS_PROVIDER,
|
||||
ACTION_GNSS_PROVIDER,
|
||||
com.android.internal.R.bool.config_useGnssHardwareProvider,
|
||||
com.android.internal.R.string.config_gnssLocationProviderPackageName);
|
||||
}
|
||||
if (gnssProvider == null) {
|
||||
gnssProvider = mGnssManagerService.getGnssLocationProvider();
|
||||
}
|
||||
|
||||
LocationProviderManager gnssManager = new LocationProviderManager(mContext, mInjector,
|
||||
GPS_PROVIDER, mPassiveManager);
|
||||
addLocationProviderManager(gnssManager, mGnssManagerService.getGnssLocationProvider());
|
||||
addLocationProviderManager(gnssManager, gnssProvider);
|
||||
}
|
||||
|
||||
// bind to geocoder provider
|
||||
|
||||
Reference in New Issue
Block a user