Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c622cdf6 authored by Yu-Han Yang's avatar Yu-Han Yang Committed by Android (Google) Code Review
Browse files

Merge "Add inter-signal bias fields to GnssMeasurement and GnssClock"

parents 414e1576 ad03c473
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -340,6 +340,7 @@ java_library {
        "android.hardware.cas-V1.2-java",
        "android.hardware.contexthub-V1.0-java",
        "android.hardware.gnss-V1.0-java",
        "android.hardware.gnss-V2.1-java",
        "android.hardware.health-V1.0-java-constants",
        "android.hardware.radio-V1.0-java",
        "android.hardware.radio-V1.1-java",
+14 −0
Original line number Diff line number Diff line
@@ -23390,6 +23390,9 @@ package android.location {
    method public long getFullBiasNanos();
    method public int getHardwareClockDiscontinuityCount();
    method public int getLeapSecond();
    method @FloatRange(from=0.0) public double getReferenceCarrierFrequencyHzForIsb();
    method @NonNull public String getReferenceCodeTypeForIsb();
    method public int getReferenceConstellationTypeForIsb();
    method public long getTimeNanos();
    method @FloatRange(from=0.0f) public double getTimeUncertaintyNanos();
    method public boolean hasBiasNanos();
@@ -23400,6 +23403,9 @@ package android.location {
    method public boolean hasElapsedRealtimeUncertaintyNanos();
    method public boolean hasFullBiasNanos();
    method public boolean hasLeapSecond();
    method public boolean hasReferenceCarrierFrequencyHzForIsb();
    method public boolean hasReferenceCodeTypeForIsb();
    method public boolean hasReferenceConstellationTypeForIsb();
    method public boolean hasTimeUncertaintyNanos();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssClock> CREATOR;
@@ -23424,6 +23430,10 @@ package android.location {
    method public double getPseudorangeRateUncertaintyMetersPerSecond();
    method public long getReceivedSvTimeNanos();
    method public long getReceivedSvTimeUncertaintyNanos();
    method public double getReceiverInterSignalBiasNanos();
    method @FloatRange(from=0.0) public double getReceiverInterSignalBiasUncertaintyNanos();
    method public double getSatelliteInterSignalBiasNanos();
    method @FloatRange(from=0.0) public double getSatelliteInterSignalBiasUncertaintyNanos();
    method public double getSnrInDb();
    method public int getState();
    method public int getSvid();
@@ -23435,6 +23445,10 @@ package android.location {
    method @Deprecated public boolean hasCarrierPhase();
    method @Deprecated public boolean hasCarrierPhaseUncertainty();
    method public boolean hasCodeType();
    method public boolean hasReceiverInterSignalBiasNanos();
    method public boolean hasReceiverInterSignalBiasUncertaintyNanos();
    method public boolean hasSatelliteInterSignalBiasNanos();
    method public boolean hasSatelliteInterSignalBiasUncertaintyNanos();
    method public boolean hasSnrInDb();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int ADR_STATE_CYCLE_SLIP = 4; // 0x4
+14 −0
Original line number Diff line number Diff line
@@ -1187,6 +1187,9 @@ package android.location {
    method public void resetElapsedRealtimeUncertaintyNanos();
    method public void resetFullBiasNanos();
    method public void resetLeapSecond();
    method public void resetReferenceCarrierFrequencyHzForIsb();
    method public void resetReferenceCodeTypeForIsb();
    method public void resetReferenceConstellationTypeForIsb();
    method public void resetTimeUncertaintyNanos();
    method public void set(android.location.GnssClock);
    method public void setBiasNanos(double);
@@ -1198,6 +1201,9 @@ package android.location {
    method public void setFullBiasNanos(long);
    method public void setHardwareClockDiscontinuityCount(int);
    method public void setLeapSecond(int);
    method public void setReferenceCarrierFrequencyHzForIsb(@FloatRange(from=0.0) double);
    method public void setReferenceCodeTypeForIsb(@NonNull String);
    method public void setReferenceConstellationTypeForIsb(int);
    method public void setTimeNanos(long);
    method public void setTimeUncertaintyNanos(@FloatRange(from=0.0f) double);
  }
@@ -1212,6 +1218,10 @@ package android.location {
    method @Deprecated public void resetCarrierPhase();
    method @Deprecated public void resetCarrierPhaseUncertainty();
    method public void resetCodeType();
    method public void resetReceiverInterSignalBiasNanos();
    method public void resetReceiverInterSignalBiasUncertaintyNanos();
    method public void resetSatelliteInterSignalBiasNanos();
    method public void resetSatelliteInterSignalBiasUncertaintyNanos();
    method public void resetSnrInDb();
    method public void set(android.location.GnssMeasurement);
    method public void setAccumulatedDeltaRangeMeters(double);
@@ -1231,6 +1241,10 @@ package android.location {
    method public void setPseudorangeRateUncertaintyMetersPerSecond(double);
    method public void setReceivedSvTimeNanos(long);
    method public void setReceivedSvTimeUncertaintyNanos(long);
    method public void setReceiverInterSignalBiasNanos(double);
    method public void setReceiverInterSignalBiasUncertaintyNanos(@FloatRange(from=0.0) double);
    method public void setSatelliteInterSignalBiasNanos(double);
    method public void setSatelliteInterSignalBiasUncertaintyNanos(@FloatRange(from=0.0) double);
    method public void setSnrInDb(double);
    method public void setState(int);
    method public void setSvid(int);
+16 −2
Original line number Diff line number Diff line
@@ -407,6 +407,12 @@ GetterSetterNames: android.location.GnssClock#setFullBiasNanos(long):
    
GetterSetterNames: android.location.GnssClock#setLeapSecond(int):

GetterSetterNames: android.location.GnssClock#setReferenceConstellationTypeForIsb(int):

GetterSetterNames: android.location.GnssClock#setReferenceCarrierFrequencyHzForIsb(double):

GetterSetterNames: android.location.GnssClock#setReferenceCodeTypeForIsb(String):

GetterSetterNames: android.location.GnssClock#setTimeUncertaintyNanos(double):
    
GetterSetterNames: android.location.GnssMeasurement#setBasebandCn0DbHz(double):
@@ -415,6 +421,14 @@ GetterSetterNames: android.location.GnssMeasurement#setCarrierFrequencyHz(float)
    
GetterSetterNames: android.location.GnssMeasurement#setCodeType(String):

GetterSetterNames: android.location.GnssMeasurement#setReceiverInterSignalBiasNanos(double):

GetterSetterNames: android.location.GnssMeasurement#setReceiverInterSignalBiasUncertaintyNanos(double):

GetterSetterNames: android.location.GnssMeasurement#setSatelliteInterSignalBiasNanos(double):

GetterSetterNames: android.location.GnssMeasurement#setSatelliteInterSignalBiasUncertaintyNanos(double):

GetterSetterNames: android.location.GnssMeasurement#setSnrInDb(double):
    
GetterSetterNames: android.location.LocationRequest#isLocationSettingsIgnored():
+186 −31
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.location;

import android.annotation.FloatRange;
import android.annotation.NonNull;
import android.annotation.TestApi;
import android.os.Parcel;
import android.os.Parcelable;
@@ -39,6 +40,9 @@ public final class GnssClock implements Parcelable {
    private static final int HAS_DRIFT_UNCERTAINTY = (1<<6);
    private static final int HAS_ELAPSED_REALTIME_NANOS = (1 << 7);
    private static final int HAS_ELAPSED_REALTIME_UNCERTAINTY_NANOS = (1 << 8);
    private static final int HAS_REFERENCE_CONSTELLATION_TYPE_FOR_ISB = (1 << 9);
    private static final int HAS_REFERENCE_CARRIER_FREQUENCY_FOR_ISB = (1 << 10);
    private static final int HAS_REFERENCE_CODE_TYPE_FOR_ISB = (1 << 11);

    // End enumerations in sync with gps.h

@@ -54,6 +58,9 @@ public final class GnssClock implements Parcelable {
    private int mHardwareClockDiscontinuityCount;
    private long mElapsedRealtimeNanos;
    private double mElapsedRealtimeUncertaintyNanos;
    private int mReferenceConstellationTypeForIsb;
    private double mReferenceCarrierFrequencyHzForIsb;
    private String mReferenceCodeTypeForIsb;

    /**
     * @hide
@@ -81,6 +88,9 @@ public final class GnssClock implements Parcelable {
        mHardwareClockDiscontinuityCount = clock.mHardwareClockDiscontinuityCount;
        mElapsedRealtimeNanos = clock.mElapsedRealtimeNanos;
        mElapsedRealtimeUncertaintyNanos = clock.mElapsedRealtimeUncertaintyNanos;
        mReferenceConstellationTypeForIsb = clock.mReferenceConstellationTypeForIsb;
        mReferenceCarrierFrequencyHzForIsb = clock.mReferenceCarrierFrequencyHzForIsb;
        mReferenceCodeTypeForIsb = clock.mReferenceCodeTypeForIsb;
    }

    /**
@@ -196,7 +206,6 @@ public final class GnssClock implements Parcelable {
    @TestApi
    public void resetTimeUncertaintyNanos() {
        resetFlag(HAS_TIME_UNCERTAINTY);
        mTimeUncertaintyNanos = Double.NaN;
    }

    /**
@@ -286,7 +295,6 @@ public final class GnssClock implements Parcelable {
    @TestApi
    public void resetBiasNanos() {
        resetFlag(HAS_BIAS);
        mBiasNanos = Double.NaN;
    }

    /**
@@ -327,7 +335,6 @@ public final class GnssClock implements Parcelable {
    @TestApi
    public void resetBiasUncertaintyNanos() {
        resetFlag(HAS_BIAS_UNCERTAINTY);
        mBiasUncertaintyNanos = Double.NaN;
    }

    /**
@@ -371,7 +378,6 @@ public final class GnssClock implements Parcelable {
    @TestApi
    public void resetDriftNanosPerSecond() {
        resetFlag(HAS_DRIFT);
        mDriftNanosPerSecond = Double.NaN;
    }

    /**
@@ -411,7 +417,6 @@ public final class GnssClock implements Parcelable {
    @TestApi
    public void resetDriftUncertaintyNanosPerSecond() {
        resetFlag(HAS_DRIFT_UNCERTAINTY);
        mDriftUncertaintyNanosPerSecond = Double.NaN;
    }

    /**
@@ -495,7 +500,128 @@ public final class GnssClock implements Parcelable {
    @TestApi
    public void resetElapsedRealtimeUncertaintyNanos() {
        resetFlag(HAS_ELAPSED_REALTIME_UNCERTAINTY_NANOS);
        mElapsedRealtimeUncertaintyNanos = Double.NaN;
    }

    /**
     * Returns {@code true} if {@link #getReferenceConstellationTypeForIsb()} is available,
     * {@code false} otherwise.
     */
    public boolean hasReferenceConstellationTypeForIsb() {
        return isFlagSet(HAS_REFERENCE_CONSTELLATION_TYPE_FOR_ISB);
    }

    /**
     * Returns the reference constellation type for inter-signal bias.
     *
     * <p>The value is only available if {@link #hasReferenceConstellationTypeForIsb()} is
     * {@code true}.
     *
     * <p>The return value is one of those constants with {@code CONSTELLATION_} prefix in
     * {@link GnssStatus}.
     */
    @GnssStatus.ConstellationType
    public int getReferenceConstellationTypeForIsb() {
        return mReferenceConstellationTypeForIsb;
    }

    /**
     * Sets the reference constellation type for inter-signal bias.
     * @hide
     */
    @TestApi
    public void setReferenceConstellationTypeForIsb(@GnssStatus.ConstellationType int value) {
        setFlag(HAS_REFERENCE_CONSTELLATION_TYPE_FOR_ISB);
        mReferenceConstellationTypeForIsb = value;
    }

    /**
     * Resets the reference constellation type for inter-signal bias.
     * @hide
     */
    @TestApi
    public void resetReferenceConstellationTypeForIsb() {
        resetFlag(HAS_REFERENCE_CONSTELLATION_TYPE_FOR_ISB);
        mReferenceConstellationTypeForIsb = GnssStatus.CONSTELLATION_UNKNOWN;
    }

    /**
     * Returns {@code true} if {@link #getReferenceCarrierFrequencyHzForIsb()} is available, {@code
     * false} otherwise.
     */
    public boolean hasReferenceCarrierFrequencyHzForIsb() {
        return isFlagSet(HAS_REFERENCE_CARRIER_FREQUENCY_FOR_ISB);
    }

    /**
     * Returns the reference carrier frequency in Hz for inter-signal bias.
     *
     * <p>The value is only available if {@link #hasReferenceCarrierFrequencyHzForIsb()} is
     * {@code true}.
     */
    @FloatRange(from = 0.0)
    public double getReferenceCarrierFrequencyHzForIsb() {
        return mReferenceCarrierFrequencyHzForIsb;
    }

    /**
     * Sets the reference carrier frequency in Hz for inter-signal bias.
     * @hide
     */
    @TestApi
    public void setReferenceCarrierFrequencyHzForIsb(@FloatRange(from = 0.0) double value) {
        setFlag(HAS_REFERENCE_CARRIER_FREQUENCY_FOR_ISB);
        mReferenceCarrierFrequencyHzForIsb = value;
    }

    /**
     * Resets the reference carrier frequency in Hz for inter-signal bias.
     * @hide
     */
    @TestApi
    public void resetReferenceCarrierFrequencyHzForIsb() {
        resetFlag(HAS_REFERENCE_CARRIER_FREQUENCY_FOR_ISB);
    }

    /**
     * Returns {@code true} if {@link #getReferenceCodeTypeForIsb()} is available, {@code
     * false} otherwise.
     */
    public boolean hasReferenceCodeTypeForIsb() {
        return isFlagSet(HAS_REFERENCE_CODE_TYPE_FOR_ISB);
    }

    /**
     * Returns the reference code type for inter-signal bias.
     *
     * <p>The value is only available if {@link #hasReferenceCodeTypeForIsb()} is
     * {@code true}.
     *
     * <p>The return value is one of those constants defined in
     * {@link GnssMeasurement#getCodeType()}.
     */
    @NonNull
    public String getReferenceCodeTypeForIsb() {
        return mReferenceCodeTypeForIsb;
    }

    /**
     * Sets the reference code type for inter-signal bias.
     * @hide
     */
    @TestApi
    public void setReferenceCodeTypeForIsb(@NonNull String codeType) {
        setFlag(HAS_REFERENCE_CODE_TYPE_FOR_ISB);
        mReferenceCodeTypeForIsb = codeType;
    }

    /**
     * Resets the reference code type for inter-signal bias.
     * @hide
     */
    @TestApi
    public void resetReferenceCodeTypeForIsb() {
        resetFlag(HAS_REFERENCE_CODE_TYPE_FOR_ISB);
        mReferenceCodeTypeForIsb = "UNKNOWN";
    }

    /**
@@ -543,6 +669,9 @@ public final class GnssClock implements Parcelable {
            gpsClock.mHardwareClockDiscontinuityCount = parcel.readInt();
            gpsClock.mElapsedRealtimeNanos = parcel.readLong();
            gpsClock.mElapsedRealtimeUncertaintyNanos = parcel.readDouble();
            gpsClock.mReferenceConstellationTypeForIsb = parcel.readInt();
            gpsClock.mReferenceCarrierFrequencyHzForIsb = parcel.readDouble();
            gpsClock.mReferenceCodeTypeForIsb = parcel.readString();

            return gpsClock;
        }
@@ -567,6 +696,9 @@ public final class GnssClock implements Parcelable {
        parcel.writeInt(mHardwareClockDiscontinuityCount);
        parcel.writeLong(mElapsedRealtimeNanos);
        parcel.writeDouble(mElapsedRealtimeUncertaintyNanos);
        parcel.writeInt(mReferenceConstellationTypeForIsb);
        parcel.writeDouble(mReferenceCarrierFrequencyHzForIsb);
        parcel.writeString(mReferenceCodeTypeForIsb);
    }

    @Override
@@ -580,7 +712,9 @@ public final class GnssClock implements Parcelable {
        final String formatWithUncertainty = "   %-15s = %-25s   %-26s = %s\n";
        StringBuilder builder = new StringBuilder("GnssClock:\n");

        builder.append(String.format(format, "LeapSecond", hasLeapSecond() ? mLeapSecond : null));
        if (hasLeapSecond()) {
            builder.append(String.format(format, "LeapSecond", mLeapSecond));
        }

        builder.append(String.format(
                formatWithUncertainty,
@@ -589,39 +723,57 @@ public final class GnssClock implements Parcelable {
                "TimeUncertaintyNanos",
                hasTimeUncertaintyNanos() ? mTimeUncertaintyNanos : null));

        builder.append(String.format(
                format,
                "FullBiasNanos",
                hasFullBiasNanos() ? mFullBiasNanos : null));
        if (hasFullBiasNanos()) {
            builder.append(String.format(format, "FullBiasNanos", mFullBiasNanos));
        }

        if (hasBiasNanos() || hasBiasUncertaintyNanos()) {
            builder.append(String.format(
                    formatWithUncertainty,
                    "BiasNanos",
                    hasBiasNanos() ? mBiasNanos : null,
                    "BiasUncertaintyNanos",
                    hasBiasUncertaintyNanos() ? mBiasUncertaintyNanos : null));
        }

        if (hasDriftNanosPerSecond() || hasDriftUncertaintyNanosPerSecond()) {
            builder.append(String.format(
                    formatWithUncertainty,
                    "DriftNanosPerSecond",
                    hasDriftNanosPerSecond() ? mDriftNanosPerSecond : null,
                    "DriftUncertaintyNanosPerSecond",
                    hasDriftUncertaintyNanosPerSecond() ? mDriftUncertaintyNanosPerSecond : null));
        }

        builder.append(String.format(
                format,
                "HardwareClockDiscontinuityCount",
                mHardwareClockDiscontinuityCount));

        if (hasElapsedRealtimeNanos() || hasElapsedRealtimeUncertaintyNanos()) {
            builder.append(String.format(
                format,
                    formatWithUncertainty,
                    "ElapsedRealtimeNanos",
                hasElapsedRealtimeNanos() ? mElapsedRealtimeNanos : null));

        builder.append(String.format(
                format,
                    hasElapsedRealtimeNanos() ? mElapsedRealtimeNanos : null,
                    "ElapsedRealtimeUncertaintyNanos",
                hasElapsedRealtimeUncertaintyNanos() ? mElapsedRealtimeUncertaintyNanos : null));
                    hasElapsedRealtimeUncertaintyNanos() ? mElapsedRealtimeUncertaintyNanos
                            : null));
        }

        if (hasReferenceConstellationTypeForIsb()) {
            builder.append(String.format(format, "ReferenceConstellationTypeForIsb",
                    mReferenceConstellationTypeForIsb));
        }

        if (hasReferenceCarrierFrequencyHzForIsb()) {
            builder.append(String.format(format, "ReferenceCarrierFrequencyHzForIsb",
                    mReferenceCarrierFrequencyHzForIsb));
        }

        if (hasReferenceCodeTypeForIsb()) {
            builder.append(
                    String.format(format, "ReferenceCodeTypeForIsb", mReferenceCodeTypeForIsb));
        }

        return builder.toString();
    }
@@ -639,6 +791,9 @@ public final class GnssClock implements Parcelable {
        setHardwareClockDiscontinuityCount(Integer.MIN_VALUE);
        resetElapsedRealtimeNanos();
        resetElapsedRealtimeUncertaintyNanos();
        resetReferenceConstellationTypeForIsb();
        resetReferenceCarrierFrequencyHzForIsb();
        resetReferenceCodeTypeForIsb();
    }

    private void setFlag(int flag) {
Loading