diff options
author | David Christie <dnchrist@google.com> | 2015-04-14 12:14:03 -0700 |
---|---|---|
committer | David Christie <dnchrist@google.com> | 2015-04-14 12:14:03 -0700 |
commit | cfc9b6d6ab3c622ea4f9d06c28d6e0d2055d98e1 (patch) | |
tree | 1fed5109ca15005e7a688d4bd4d28678748fe53e /location | |
parent | fff30439cafb737eb54de807caab4fb61432f2cc (diff) | |
download | frameworks_base-cfc9b6d6ab3c622ea4f9d06c28d6e0d2055d98e1.zip frameworks_base-cfc9b6d6ab3c622ea4f9d06c28d6e0d2055d98e1.tar.gz frameworks_base-cfc9b6d6ab3c622ea4f9d06c28d6e0d2055d98e1.tar.bz2 |
Add versioning to FLP HAL.
Retain compatibility with implementations compiled
against old headers or left unchanged from LMP.
Change-Id: I3f7cfaaf0cba8697c312940a805b053c6040caa6
Diffstat (limited to 'location')
-rw-r--r-- | location/lib/java/com/android/location/provider/FusedLocationHardware.java | 20 | ||||
-rw-r--r-- | location/lib/java/com/android/location/provider/FusedLocationHardwareSink.java | 3 |
2 files changed, 22 insertions, 1 deletions
diff --git a/location/lib/java/com/android/location/provider/FusedLocationHardware.java b/location/lib/java/com/android/location/provider/FusedLocationHardware.java index 480a18c..eb3b2f4 100644 --- a/location/lib/java/com/android/location/provider/FusedLocationHardware.java +++ b/location/lib/java/com/android/location/provider/FusedLocationHardware.java @@ -216,6 +216,26 @@ public final class FusedLocationHardware { } } + + /** + * Returns the version of the FLP HAL. + * + * <p>Version 1 is the initial release. + * <p>Version 2 adds the ability to use {@link #flushBatchedLocations}, + * {@link FusedLocationHardwareSink#onCapabilities}, and + * {@link FusedLocationHardwareSink#onStatusChanged}. + * + * <p>This method is only available on API 23 or later. Older APIs have version 1. + */ + public int getVersion() { + try { + return mLocationHardware.getVersion(); + } catch(RemoteException e) { + Log.e(TAG, "RemoteException at getVersion"); + } + return 1; + } + /* * Helper methods and classes */ diff --git a/location/lib/java/com/android/location/provider/FusedLocationHardwareSink.java b/location/lib/java/com/android/location/provider/FusedLocationHardwareSink.java index 618d5d6..01d37ac 100644 --- a/location/lib/java/com/android/location/provider/FusedLocationHardwareSink.java +++ b/location/lib/java/com/android/location/provider/FusedLocationHardwareSink.java @@ -54,7 +54,8 @@ public class FusedLocationHardwareSink { /** * Called when the status changes in the underlying FLP HAL * implementation (the ability to compute location). This - * callback will only be made on API 23 or later. + * callback will only be made on version 2 or later + * (see {@link FusedLocationHardware#getVersion()}). * * @param status One of FLP_STATUS_LOCATION_AVAILABLE or * FLP_STATUS_LOCATION_UNAVAILABLE as defined in |