diff options
Diffstat (limited to 'services/core/java/com/android')
-rw-r--r-- | services/core/java/com/android/server/location/FlpHardwareProvider.java | 19 | ||||
-rw-r--r-- | services/core/java/com/android/server/location/FusedLocationHardwareSecure.java | 6 |
2 files changed, 24 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/location/FlpHardwareProvider.java b/services/core/java/com/android/server/location/FlpHardwareProvider.java index 834dff2..1fb22be 100644 --- a/services/core/java/com/android/server/location/FlpHardwareProvider.java +++ b/services/core/java/com/android/server/location/FlpHardwareProvider.java @@ -42,11 +42,13 @@ import android.util.Log; * {@hide} */ public class FlpHardwareProvider { + private static final int FIRST_VERSION_WITH_FLUSH_LOCATIONS = 2; private GeofenceHardwareImpl mGeofenceHardwareSink = null; private IFusedLocationHardwareSink mLocationSink = null; // Capabilities provided by FlpCallbacks private boolean mHaveBatchingCapabilities; private int mBatchingCapabilities; + private int mVersion; private static FlpHardwareProvider sSingletonInstance = null; @@ -150,6 +152,11 @@ public class FlpHardwareProvider { } } + private void setVersion(int version) { + mVersion = version; + getGeofenceHardwareSink().setVersion(version); + } + private void maybeSendCapabilities() { IFusedLocationHardwareSink sink; boolean haveBatchingCapabilities; @@ -366,7 +373,12 @@ public class FlpHardwareProvider { @Override public void flushBatchedLocations() { - nativeFlushBatchedLocations(); + if (mVersion >= FIRST_VERSION_WITH_FLUSH_LOCATIONS) { + nativeFlushBatchedLocations(); + } else { + Log.wtf(TAG, + "Tried to call flushBatchedLocations on an unsupported implementation"); + } } @Override @@ -388,6 +400,11 @@ public class FlpHardwareProvider { public void injectDeviceContext(int deviceEnabledContext) { nativeInjectDeviceContext(deviceEnabledContext); } + + @Override + public int getVersion() { + return mVersion; + } }; private final IFusedGeofenceHardware mGeofenceHardwareService = diff --git a/services/core/java/com/android/server/location/FusedLocationHardwareSecure.java b/services/core/java/com/android/server/location/FusedLocationHardwareSecure.java index e49c411..a08d326 100644 --- a/services/core/java/com/android/server/location/FusedLocationHardwareSecure.java +++ b/services/core/java/com/android/server/location/FusedLocationHardwareSecure.java @@ -122,4 +122,10 @@ public class FusedLocationHardwareSecure extends IFusedLocationHardware.Stub { checkPermissions(); mLocationHardware.flushBatchedLocations(); } + + @Override + public int getVersion() throws RemoteException { + checkPermissions(); + return mLocationHardware.getVersion(); + } } |