From d2309fa3a9b490feb4196df2b8114d2562de198b Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Wed, 28 Sep 2022 22:58:51 +0000 Subject: Add passive listener support for GnssMeasurement Bug: 248291428 Test: atest GnssMeasurementRegistrationTest Change-Id: Ifac665ff1e85ee9625613e87548460c8974a81bc --- .../java/android/location/GnssMeasurementRequest.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'location/java') 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. * *

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. * *

An interval of 0 milliseconds means the fastest rate the chipset can report. * -- cgit v1.2.3-59-g8ed1b