diff options
author | David Christie <dnchrist@google.com> | 2015-04-08 15:31:30 -0700 |
---|---|---|
committer | David Christie <dnchrist@google.com> | 2015-04-08 17:33:38 -0700 |
commit | 295a93b99f1773638553a0d00898824dc7ba79e5 (patch) | |
tree | 7828e35f42940e01e45355ba9cbd685caa67a588 | |
parent | 1c146c78af00f30f6fa71c4577a66f27a5981aa2 (diff) | |
download | frameworks_base-295a93b99f1773638553a0d00898824dc7ba79e5.zip frameworks_base-295a93b99f1773638553a0d00898824dc7ba79e5.tar.gz frameworks_base-295a93b99f1773638553a0d00898824dc7ba79e5.tar.bz2 |
Add smallest displacement field to FLP HAL
Change-Id: I4d857256c035c65185be3be8401bec8d45091aaf
3 files changed, 28 insertions, 0 deletions
diff --git a/location/java/android/location/FusedBatchOptions.java b/location/java/android/location/FusedBatchOptions.java index 5600aeb..aa4a860 100644 --- a/location/java/android/location/FusedBatchOptions.java +++ b/location/java/android/location/FusedBatchOptions.java @@ -30,6 +30,8 @@ public class FusedBatchOptions implements Parcelable { // the default value is set to request fixes at no cost private volatile double mMaxPowerAllocationInMW = 0; + // If non-zero can be used for power savings by throttling location when device hasn't moved. + private volatile float mSmallestDisplacementMeters = 0; /* * Getters and setters for properties needed to hold the options. @@ -50,6 +52,14 @@ public class FusedBatchOptions implements Parcelable { return mPeriodInNS; } + public void setSmallestDisplacementMeters(float value) { + mSmallestDisplacementMeters = value; + } + + public float getSmallestDisplacementMeters() { + return mSmallestDisplacementMeters; + } + public void setSourceToUse(int source) { mSourcesToUse |= source; } @@ -112,6 +122,7 @@ public class FusedBatchOptions implements Parcelable { options.setPeriodInNS(parcel.readLong()); options.setSourceToUse(parcel.readInt()); options.setFlag(parcel.readInt()); + options.setSmallestDisplacementMeters(parcel.readFloat()); return options; } @@ -132,5 +143,6 @@ public class FusedBatchOptions implements Parcelable { parcel.writeLong(mPeriodInNS); parcel.writeInt(mSourcesToUse); parcel.writeInt(mFlags); + parcel.writeFloat(mSmallestDisplacementMeters); } } diff --git a/location/lib/java/com/android/location/provider/GmsFusedBatchOptions.java b/location/lib/java/com/android/location/provider/GmsFusedBatchOptions.java index fd3f402..29818ec 100644 --- a/location/lib/java/com/android/location/provider/GmsFusedBatchOptions.java +++ b/location/lib/java/com/android/location/provider/GmsFusedBatchOptions.java @@ -43,6 +43,14 @@ public class GmsFusedBatchOptions { return mOptions.getPeriodInNS(); } + public void setSmallestDisplacementMeters(float value) { + mOptions.setSmallestDisplacementMeters(value); + } + + public float getSmallestDisplacementMeters() { + return mOptions.getSmallestDisplacementMeters(); + } + public void setSourceToUse(int source) { mOptions.setSourceToUse(source); } diff --git a/services/core/jni/com_android_server_location_FlpHardwareProvider.cpp b/services/core/jni/com_android_server_location_FlpHardwareProvider.cpp index 049e455..d5508bc 100644 --- a/services/core/jni/com_android_server_location_FlpHardwareProvider.cpp +++ b/services/core/jni/com_android_server_location_FlpHardwareProvider.cpp @@ -297,6 +297,14 @@ static void TranslateFromObject( getSourcesToUse ); + jmethodID getSmallestDisplacementMeters = env->GetMethodID( + batchOptionsClass, + "getSmallestDisplacementMeters", + "()F" + ); + batchOptions.smallest_displacement_meters + = env->CallFloatMethod(batchOptionsObject, getSmallestDisplacementMeters); + jmethodID getFlags = env->GetMethodID(batchOptionsClass, "getFlags", "()I"); batchOptions.flags = env->CallIntMethod(batchOptionsObject, getFlags); |