summaryrefslogtreecommitdiffstats
path: root/core/java/android/hardware/location/GeofenceHardwareImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/hardware/location/GeofenceHardwareImpl.java')
-rw-r--r--core/java/android/hardware/location/GeofenceHardwareImpl.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/core/java/android/hardware/location/GeofenceHardwareImpl.java b/core/java/android/hardware/location/GeofenceHardwareImpl.java
index 5d40e94..ee2d43c 100644
--- a/core/java/android/hardware/location/GeofenceHardwareImpl.java
+++ b/core/java/android/hardware/location/GeofenceHardwareImpl.java
@@ -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;
@@ -230,7 +239,12 @@ public final class GeofenceHardwareImpl {
case GeofenceHardware.MONITORING_TYPE_GPS_HARDWARE:
return CAPABILITY_GNSS;
case GeofenceHardware.MONITORING_TYPE_FUSED_HARDWARE:
- return mCapabilities;
+ if (mVersion >= FIRST_VERSION_WITH_CAPABILITIES) {
+ return mCapabilities;
+ }
+ // This was the implied capability on old FLP HAL versions that didn't
+ // have the capability callback.
+ return CAPABILITY_GNSS;
}
break;
}