Merge "Update hasAccumulatedDeltaRange() to return a 3-state int" into udc-dev
This commit is contained in:
@@ -20388,7 +20388,7 @@ package android.location {
|
||||
public final class GnssCapabilities implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method @NonNull public java.util.List<android.location.GnssSignalType> getGnssSignalTypes();
|
||||
method public boolean hasAccumulatedDeltaRange();
|
||||
method public int hasAccumulatedDeltaRange();
|
||||
method public boolean hasAntennaInfo();
|
||||
method public boolean hasGeofencing();
|
||||
method @Deprecated public boolean hasGnssAntennaInfo();
|
||||
@@ -20414,8 +20414,10 @@ package android.location {
|
||||
method public boolean hasSatellitePvt();
|
||||
method public boolean hasScheduling();
|
||||
method public boolean hasSingleShotFix();
|
||||
method public boolean isAccumulatedDeltaRangeCapabilityKnown();
|
||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||
field public static final int CAPABILITY_SUPPORTED = 1; // 0x1
|
||||
field public static final int CAPABILITY_UNKNOWN = 0; // 0x0
|
||||
field public static final int CAPABILITY_UNSUPPORTED = 2; // 0x2
|
||||
field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssCapabilities> CREATOR;
|
||||
}
|
||||
|
||||
@@ -20423,9 +20425,8 @@ package android.location {
|
||||
ctor public GnssCapabilities.Builder();
|
||||
ctor public GnssCapabilities.Builder(@NonNull android.location.GnssCapabilities);
|
||||
method @NonNull public android.location.GnssCapabilities build();
|
||||
method @NonNull public android.location.GnssCapabilities.Builder clearIsAccumulatedDeltaRangeCapabilityKnown();
|
||||
method @NonNull public android.location.GnssCapabilities.Builder setGnssSignalTypes(@NonNull java.util.List<android.location.GnssSignalType>);
|
||||
method @NonNull public android.location.GnssCapabilities.Builder setHasAccumulatedDeltaRange(boolean);
|
||||
method @NonNull public android.location.GnssCapabilities.Builder setHasAccumulatedDeltaRange(int);
|
||||
method @NonNull public android.location.GnssCapabilities.Builder setHasAntennaInfo(boolean);
|
||||
method @NonNull public android.location.GnssCapabilities.Builder setHasGeofencing(boolean);
|
||||
method @NonNull public android.location.GnssCapabilities.Builder setHasLowPowerMode(boolean);
|
||||
|
||||
@@ -123,6 +123,21 @@ public final class GnssCapabilities implements Parcelable {
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface SubHalPowerCapabilityFlags {}
|
||||
|
||||
/** The capability is unknown to be supported or not. */
|
||||
public static final int CAPABILITY_UNKNOWN = 0;
|
||||
/** The capability is supported. */
|
||||
public static final int CAPABILITY_SUPPORTED = 1;
|
||||
/** The capability is not supported. */
|
||||
public static final int CAPABILITY_UNSUPPORTED = 2;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(flag = true, prefix = {"CAPABILITY_"}, value = {CAPABILITY_UNKNOWN,
|
||||
CAPABILITY_SUPPORTED,
|
||||
CAPABILITY_UNSUPPORTED})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface CapabilitySupportType {}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an empty GnssCapabilities object.
|
||||
*
|
||||
@@ -375,30 +390,25 @@ public final class GnssCapabilities implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if GNSS chipset supports accumulated delta range, {@code false}
|
||||
* otherwise.
|
||||
*
|
||||
* <p>The value is only known if {@link #isAccumulatedDeltaRangeCapabilityKnown()} is
|
||||
* true.
|
||||
* Returns {@link #CAPABILITY_SUPPORTED} if GNSS chipset supports accumulated delta
|
||||
* range, {@link #CAPABILITY_UNSUPPORTED} if GNSS chipset does not support accumulated
|
||||
* delta range, and {@link #CAPABILITY_UNKNOWN} if it is unknown, which means GNSS
|
||||
* chipset may or may not support accumulated delta range.
|
||||
*
|
||||
* <p>The accumulated delta range information can be queried in
|
||||
* {@link android.location.GnssMeasurement#getAccumulatedDeltaRangeState()},
|
||||
* {@link android.location.GnssMeasurement#getAccumulatedDeltaRangeMeters()}, and
|
||||
* {@link android.location.GnssMeasurement#getAccumulatedDeltaRangeUncertaintyMeters()}.
|
||||
*/
|
||||
public boolean hasAccumulatedDeltaRange() {
|
||||
public @CapabilitySupportType int hasAccumulatedDeltaRange() {
|
||||
if (!mIsAdrCapabilityKnown) {
|
||||
throw new IllegalStateException("Accumulated delta range capability is unknown.");
|
||||
return CAPABILITY_UNKNOWN;
|
||||
}
|
||||
if ((mTopFlags & TOP_HAL_CAPABILITY_ACCUMULATED_DELTA_RANGE) != 0) {
|
||||
return CAPABILITY_SUPPORTED;
|
||||
} else {
|
||||
return CAPABILITY_UNSUPPORTED;
|
||||
}
|
||||
return (mTopFlags & TOP_HAL_CAPABILITY_ACCUMULATED_DELTA_RANGE) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if {@link #hasAccumulatedDeltaRange()} is known, {@code false}
|
||||
* otherwise.
|
||||
*/
|
||||
public boolean isAccumulatedDeltaRangeCapabilityKnown() {
|
||||
return mIsAdrCapabilityKnown;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -597,9 +607,9 @@ public final class GnssCapabilities implements Parcelable {
|
||||
if (hasMeasurementCorrectionsForDriving()) {
|
||||
builder.append("MEASUREMENT_CORRECTIONS_FOR_DRIVING ");
|
||||
}
|
||||
if (mIsAdrCapabilityKnown && hasAccumulatedDeltaRange()) {
|
||||
if (hasAccumulatedDeltaRange() == CAPABILITY_SUPPORTED) {
|
||||
builder.append("ACCUMULATED_DELTA_RANGE ");
|
||||
} else if (!mIsAdrCapabilityKnown) {
|
||||
} else if (hasAccumulatedDeltaRange() == CAPABILITY_UNKNOWN) {
|
||||
builder.append("ACCUMULATED_DELTA_RANGE(unknown) ");
|
||||
}
|
||||
if (hasMeasurementCorrectionsLosSats()) {
|
||||
@@ -795,19 +805,17 @@ public final class GnssCapabilities implements Parcelable {
|
||||
/**
|
||||
* Sets accumulated delta range capability.
|
||||
*/
|
||||
public @NonNull Builder setHasAccumulatedDeltaRange(boolean capable) {
|
||||
mIsAdrCapabilityKnown = true;
|
||||
mTopFlags = setFlag(mTopFlags, TOP_HAL_CAPABILITY_ACCUMULATED_DELTA_RANGE,
|
||||
capable);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears accumulated delta range capability and sets it as unknown.
|
||||
*/
|
||||
public @NonNull Builder clearIsAccumulatedDeltaRangeCapabilityKnown() {
|
||||
mIsAdrCapabilityKnown = false;
|
||||
mTopFlags = setFlag(mTopFlags, TOP_HAL_CAPABILITY_ACCUMULATED_DELTA_RANGE, false);
|
||||
public @NonNull Builder setHasAccumulatedDeltaRange(@CapabilitySupportType int capable) {
|
||||
if (capable == CAPABILITY_UNKNOWN) {
|
||||
mIsAdrCapabilityKnown = false;
|
||||
mTopFlags = setFlag(mTopFlags, TOP_HAL_CAPABILITY_ACCUMULATED_DELTA_RANGE, false);
|
||||
} else if (capable == CAPABILITY_SUPPORTED) {
|
||||
mIsAdrCapabilityKnown = true;
|
||||
mTopFlags = setFlag(mTopFlags, TOP_HAL_CAPABILITY_ACCUMULATED_DELTA_RANGE, true);
|
||||
} else if (capable == CAPABILITY_UNSUPPORTED) {
|
||||
mIsAdrCapabilityKnown = true;
|
||||
mTopFlags = setFlag(mTopFlags, TOP_HAL_CAPABILITY_ACCUMULATED_DELTA_RANGE, false);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user