Merge "Add versioning to FLP HAL."

This commit is contained in:
David Christie
2015-04-14 21:36:59 +00:00
committed by Android (Google) Code Review
7 changed files with 74 additions and 3 deletions

View File

@@ -41,6 +41,7 @@ import java.util.Iterator;
public final class GeofenceHardwareImpl {
private static final String TAG = "GeofenceHardwareImpl";
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
private static final int FIRST_VERSION_WITH_CAPABILITIES = 2;
private final Context mContext;
private static GeofenceHardwareImpl sInstance;
@@ -54,6 +55,7 @@ public final class GeofenceHardwareImpl {
private IFusedGeofenceHardware mFusedService;
private IGpsGeofenceHardware mGpsService;
private int mCapabilities;
private int mVersion = 1;
private int[] mSupportedMonitorTypes = new int[GeofenceHardware.NUM_MONITORS];
@@ -145,8 +147,10 @@ public final class GeofenceHardwareImpl {
private void updateFusedHardwareAvailability() {
boolean fusedSupported;
try {
final boolean hasGnnsCapabilities = (mVersion < FIRST_VERSION_WITH_CAPABILITIES)
|| (mCapabilities & CAPABILITY_GNSS) != 0;
fusedSupported = (mFusedService != null
? mFusedService.isSupported() && (mCapabilities & CAPABILITY_GNSS) != 0
? mFusedService.isSupported() && hasGnnsCapabilities
: false);
} catch (RemoteException e) {
Log.e(TAG, "RemoteException calling LocationManagerService");
@@ -177,6 +181,11 @@ public final class GeofenceHardwareImpl {
updateFusedHardwareAvailability();
}
public void setVersion(int version) {
mVersion = version;
updateFusedHardwareAvailability();
}
public void setFusedGeofenceHardware(IFusedGeofenceHardware service) {
if(mFusedService == null) {
mFusedService = service;

View File

@@ -121,4 +121,9 @@ interface IFusedLocationHardware {
* of the locations returned in this call.
*/
void flushBatchedLocations() = 11;
/**
* Returns the version of this FLP HAL implementation.
*/
int getVersion() = 12;
}