Make sure the FlpHardwareProvider is only advertised to GmsCore if the platform supports it.
b/14117917 Change-Id: Id6c2444893bcf192049e3233d1296eac16fcf826
This commit is contained in:
@@ -426,29 +426,33 @@ public class LocationManagerService extends ILocationManager.Stub {
|
||||
Slog.e(TAG, "no geocoder provider found");
|
||||
}
|
||||
|
||||
// bind to fused provider
|
||||
FlpHardwareProvider flpHardwareProvider = FlpHardwareProvider.getInstance(mContext);
|
||||
FusedProxy fusedProxy = FusedProxy.createAndBind(
|
||||
mContext,
|
||||
mLocationHandler,
|
||||
flpHardwareProvider.getLocationHardware(),
|
||||
com.android.internal.R.bool.config_enableFusedLocationOverlay,
|
||||
com.android.internal.R.string.config_fusedLocationProviderPackageName,
|
||||
com.android.internal.R.array.config_locationProviderPackageNames);
|
||||
if(fusedProxy == null) {
|
||||
Slog.e(TAG, "No FusedProvider found.");
|
||||
}
|
||||
// bind to fused provider if supported
|
||||
if (FlpHardwareProvider.isSupported()) {
|
||||
FlpHardwareProvider flpHardwareProvider = FlpHardwareProvider.getInstance(mContext);
|
||||
FusedProxy fusedProxy = FusedProxy.createAndBind(
|
||||
mContext,
|
||||
mLocationHandler,
|
||||
flpHardwareProvider.getLocationHardware(),
|
||||
com.android.internal.R.bool.config_enableFusedLocationOverlay,
|
||||
com.android.internal.R.string.config_fusedLocationProviderPackageName,
|
||||
com.android.internal.R.array.config_locationProviderPackageNames);
|
||||
if(fusedProxy == null) {
|
||||
Slog.e(TAG, "Unable to bind FusedProxy.");
|
||||
}
|
||||
|
||||
// bind to geofence provider
|
||||
GeofenceProxy provider = GeofenceProxy.createAndBind(mContext,
|
||||
com.android.internal.R.bool.config_enableGeofenceOverlay,
|
||||
com.android.internal.R.string.config_geofenceProviderPackageName,
|
||||
com.android.internal.R.array.config_locationProviderPackageNames,
|
||||
mLocationHandler,
|
||||
gpsProvider.getGpsGeofenceProxy(),
|
||||
flpHardwareProvider.getGeofenceHardware());
|
||||
if (provider == null) {
|
||||
Slog.e(TAG, "no geofence provider found");
|
||||
// bind to geofence provider
|
||||
GeofenceProxy provider = GeofenceProxy.createAndBind(mContext,
|
||||
com.android.internal.R.bool.config_enableGeofenceOverlay,
|
||||
com.android.internal.R.string.config_geofenceProviderPackageName,
|
||||
com.android.internal.R.array.config_locationProviderPackageNames,
|
||||
mLocationHandler,
|
||||
gpsProvider.getGpsGeofenceProxy(),
|
||||
flpHardwareProvider.getGeofenceHardware());
|
||||
if (provider == null) {
|
||||
Slog.e(TAG, "Unable to bind FLP Geofence proxy.");
|
||||
}
|
||||
} else {
|
||||
Slog.e(TAG, "FLP HAL not supported.");
|
||||
}
|
||||
|
||||
String[] testProviderStrings = resources.getStringArray(
|
||||
|
||||
@@ -69,6 +69,7 @@ public class FlpHardwareProvider {
|
||||
sSingletonInstance = new FlpHardwareProvider(context);
|
||||
}
|
||||
|
||||
nativeInit();
|
||||
return sSingletonInstance;
|
||||
}
|
||||
|
||||
@@ -96,6 +97,7 @@ public class FlpHardwareProvider {
|
||||
}
|
||||
|
||||
public static boolean isSupported() {
|
||||
nativeInit();
|
||||
return nativeIsSupported();
|
||||
}
|
||||
|
||||
@@ -216,9 +218,9 @@ public class FlpHardwareProvider {
|
||||
// Core members
|
||||
private static native void nativeClassInit();
|
||||
private static native boolean nativeIsSupported();
|
||||
private static native void nativeInit();
|
||||
|
||||
// FlpLocationInterface members
|
||||
private native void nativeInit();
|
||||
private native int nativeGetBatchSize();
|
||||
private native void nativeStartBatching(int requestId, FusedBatchOptions options);
|
||||
private native void nativeUpdateBatchingOptions(int requestId, FusedBatchOptions optionsObject);
|
||||
@@ -258,12 +260,10 @@ public class FlpHardwareProvider {
|
||||
public static final String GEOFENCING = "Geofencing";
|
||||
|
||||
public IFusedLocationHardware getLocationHardware() {
|
||||
nativeInit();
|
||||
return mLocationHardware;
|
||||
}
|
||||
|
||||
public IFusedGeofenceHardware getGeofenceHardware() {
|
||||
nativeInit();
|
||||
return mGeofenceHardwareService;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user