summaryrefslogtreecommitdiff
path: root/location/java
diff options
context:
space:
mode:
author Yu-Han Yang <yuhany@google.com> 2022-09-28 22:58:51 +0000
committer Yu-Han Yang <yuhany@google.com> 2022-09-30 01:08:14 +0000
commitd2309fa3a9b490feb4196df2b8114d2562de198b (patch)
treedf7a3a338f3b0f1a225546a557a5a79f1834d550 /location/java
parent545fa2aa455acc7b94fceb8407d94b710e66550a (diff)
Add passive listener support for GnssMeasurement
Bug: 248291428 Test: atest GnssMeasurementRegistrationTest Change-Id: Ifac665ff1e85ee9625613e87548460c8974a81bc
Diffstat (limited to 'location/java')
-rw-r--r--location/java/android/location/GnssMeasurementRequest.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/location/java/android/location/GnssMeasurementRequest.java b/location/java/android/location/GnssMeasurementRequest.java
index 71cb0e32a706..a924b977f288 100644
--- a/location/java/android/location/GnssMeasurementRequest.java
+++ b/location/java/android/location/GnssMeasurementRequest.java
@@ -31,6 +31,15 @@ import java.util.Objects;
* This class contains extra parameters to pass in a GNSS measurement request.
*/
public final class GnssMeasurementRequest implements Parcelable {
+ /**
+ * Represents a passive only request. Such a request will not trigger any active GNSS
+ * measurements or power usage itself, but may receive GNSS measurements generated in response
+ * to other requests.
+ *
+ * @see GnssMeasurementRequest#getIntervalMillis()
+ */
+ public static final int PASSIVE_INTERVAL = Integer.MAX_VALUE;
+
private final boolean mCorrelationVectorOutputsEnabled;
private final boolean mFullTracking;
private final int mIntervalMillis;
@@ -76,7 +85,10 @@ public final class GnssMeasurementRequest implements Parcelable {
}
/**
- * Represents the requested time interval between the reported measurements in milliseconds.
+ * Returns the requested time interval between the reported measurements in milliseconds, or
+ * {@link #PASSIVE_INTERVAL} if this is a passive, no power request. A passive request will not
+ * actively generate GNSS measurement updates, but may receive GNSS measurement updates
+ * generated as a result of other GNSS measurement requests.
*
* <p>If the time interval is not set, the default value is 0, which means the fastest rate the
* GNSS chipset can report.
@@ -213,7 +225,9 @@ public final class GnssMeasurementRequest implements Parcelable {
/**
* Set the time interval between the reported measurements in milliseconds, which is 0 by
- * default.
+ * default. The request interval may be set to {@link #PASSIVE_INTERVAL} which indicates
+ * this request will not actively generate GNSS measurement updates, but may receive
+ * GNSS measurement updates generated as a result of other GNSS measurement requests.
*
* <p>An interval of 0 milliseconds means the fastest rate the chipset can report.
*