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

Commit 2e955bcb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add basebandCn0Dbhz to GnssMeasurement"

parents 4946882d 9fe06dda
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -327,6 +327,7 @@ java_library {
        "android.hardware.cas-V1.1-java",
        "android.hardware.cas-V1.0-java",
        "android.hardware.contexthub-V1.0-java",
        "android.hardware.gnss-V1.0-java",
        "android.hardware.health-V1.0-java-constants",
        "android.hardware.radio-V1.0-java",
        "android.hardware.radio-V1.1-java",
+2 −0
Original line number Diff line number Diff line
@@ -22960,6 +22960,7 @@ package android.location {
    method public int getAccumulatedDeltaRangeState();
    method public double getAccumulatedDeltaRangeUncertaintyMeters();
    method public double getAutomaticGainControlLevelDb();
    method @FloatRange(from=0, to=50) public double getBasebandCn0DbHz();
    method @Deprecated public long getCarrierCycles();
    method public float getCarrierFrequencyHz();
    method @Deprecated public double getCarrierPhase();
@@ -22977,6 +22978,7 @@ package android.location {
    method public int getSvid();
    method public double getTimeOffsetNanos();
    method public boolean hasAutomaticGainControlLevelDb();
    method public boolean hasBasebandCn0DbHz();
    method @Deprecated public boolean hasCarrierCycles();
    method public boolean hasCarrierFrequencyHz();
    method @Deprecated public boolean hasCarrierPhase();
+2 −0
Original line number Diff line number Diff line
@@ -1086,6 +1086,7 @@ package android.location {
    ctor public GnssMeasurement();
    method public void reset();
    method public void resetAutomaticGainControlLevel();
    method public void resetBasebandCn0DbHz();
    method @Deprecated public void resetCarrierCycles();
    method public void resetCarrierFrequencyHz();
    method @Deprecated public void resetCarrierPhase();
@@ -1097,6 +1098,7 @@ package android.location {
    method public void setAccumulatedDeltaRangeState(int);
    method public void setAccumulatedDeltaRangeUncertaintyMeters(double);
    method public void setAutomaticGainControlLevelInDb(double);
    method public void setBasebandCn0DbHz(double);
    method @Deprecated public void setCarrierCycles(long);
    method public void setCarrierFrequencyHz(float);
    method @Deprecated public void setCarrierPhase(double);
+2 −0
Original line number Diff line number Diff line
@@ -399,6 +399,8 @@ GetterSetterNames: android.location.GnssClock#setLeapSecond(int):
    
GetterSetterNames: android.location.GnssClock#setTimeUncertaintyNanos(double):
    
GetterSetterNames: android.location.GnssMeasurement#setBasebandCn0DbHz(double):

GetterSetterNames: android.location.GnssMeasurement#setCarrierFrequencyHz(float):
    
GetterSetterNames: android.location.GnssMeasurement#setCodeType(String):
+64 −7
Original line number Diff line number Diff line
@@ -16,9 +16,11 @@

package android.location;

import android.annotation.FloatRange;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.TestApi;
import android.hardware.gnss.V1_0.IGnssMeasurementCallback.GnssMeasurementFlags;
import android.os.Parcel;
import android.os.Parcelable;

@@ -37,6 +39,7 @@ public final class GnssMeasurement implements Parcelable {
    private long mReceivedSvTimeNanos;
    private long mReceivedSvTimeUncertaintyNanos;
    private double mCn0DbHz;
    private double mBasebandCn0DbHz;
    private double mPseudorangeRateMetersPerSecond;
    private double mPseudorangeRateUncertaintyMetersPerSecond;
    private int mAccumulatedDeltaRangeState;
@@ -51,16 +54,20 @@ public final class GnssMeasurement implements Parcelable {
    private double mAutomaticGainControlLevelInDb;
    @NonNull private String mCodeType;

    // The following enumerations must be in sync with the values declared in gps.h
    // The following enumerations must be in sync with the values declared in GNSS HAL.

    private static final int HAS_NO_FLAGS = 0;
    private static final int HAS_SNR = (1<<0);
    private static final int HAS_CARRIER_FREQUENCY = (1<<9);
    private static final int HAS_CARRIER_CYCLES = (1<<10);
    private static final int HAS_CARRIER_PHASE = (1<<11);
    private static final int HAS_CARRIER_PHASE_UNCERTAINTY = (1<<12);
    private static final int HAS_AUTOMATIC_GAIN_CONTROL = (1<<13);
    private static final int HAS_SNR = GnssMeasurementFlags.HAS_SNR;
    private static final int HAS_CARRIER_FREQUENCY = GnssMeasurementFlags.HAS_CARRIER_FREQUENCY;
    private static final int HAS_CARRIER_CYCLES = GnssMeasurementFlags.HAS_CARRIER_CYCLES;
    private static final int HAS_CARRIER_PHASE = GnssMeasurementFlags.HAS_CARRIER_PHASE;
    private static final int HAS_CARRIER_PHASE_UNCERTAINTY =
            GnssMeasurementFlags.HAS_CARRIER_PHASE_UNCERTAINTY;
    private static final int HAS_AUTOMATIC_GAIN_CONTROL =
            GnssMeasurementFlags.HAS_AUTOMATIC_GAIN_CONTROL;

    private static final int HAS_CODE_TYPE = (1 << 14);
    private static final int HAS_BASEBAND_CN0 = (1 << 15);

    /**
     * The status of the multipath indicator.
@@ -240,6 +247,7 @@ public final class GnssMeasurement implements Parcelable {
        mReceivedSvTimeNanos = measurement.mReceivedSvTimeNanos;
        mReceivedSvTimeUncertaintyNanos = measurement.mReceivedSvTimeUncertaintyNanos;
        mCn0DbHz = measurement.mCn0DbHz;
        mBasebandCn0DbHz = measurement.mBasebandCn0DbHz;
        mPseudorangeRateMetersPerSecond = measurement.mPseudorangeRateMetersPerSecond;
        mPseudorangeRateUncertaintyMetersPerSecond =
                measurement.mPseudorangeRateUncertaintyMetersPerSecond;
@@ -787,6 +795,49 @@ public final class GnssMeasurement implements Parcelable {
        mCn0DbHz = value;
    }

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

    /**
     * Gets the baseband carrier-to-noise density in dB-Hz.
     *
     * <p>Typical range: 0-50 dB-Hz.
     *
     * <p>The value contains the measured C/N0 for the signal at the baseband. This is typically
     * a few dB weaker than the value estimated for C/N0 at the antenna port, which is reported
     * in {@link #getCn0DbHz()}.
     */
    @FloatRange(from = 0, to = 50)
    public double getBasebandCn0DbHz() {
        return mBasebandCn0DbHz;
    }

    /**
     * Sets the baseband carrier-to-noise density in dB-Hz.
     *
     * @hide
     */
    @TestApi
    public void setBasebandCn0DbHz(double value) {
        setFlag(HAS_BASEBAND_CN0);
        mBasebandCn0DbHz = value;
    }

    /**
     * Resets the baseband carrier-to-noise density in dB-Hz.
     *
     * @hide
     */
    @TestApi
    public void resetBasebandCn0DbHz() {
        resetFlag(HAS_BASEBAND_CN0);
        mBasebandCn0DbHz = Double.NaN;
    }

    /**
     * Gets the Pseudorange rate at the timestamp in m/s.
     *
@@ -1400,6 +1451,7 @@ public final class GnssMeasurement implements Parcelable {
            gnssMeasurement.mSnrInDb = parcel.readDouble();
            gnssMeasurement.mAutomaticGainControlLevelInDb = parcel.readDouble();
            gnssMeasurement.mCodeType = parcel.readString();
            gnssMeasurement.mBasebandCn0DbHz = parcel.readDouble();

            return gnssMeasurement;
        }
@@ -1433,6 +1485,7 @@ public final class GnssMeasurement implements Parcelable {
        parcel.writeDouble(mSnrInDb);
        parcel.writeDouble(mAutomaticGainControlLevelInDb);
        parcel.writeString(mCodeType);
        parcel.writeDouble(mBasebandCn0DbHz);
    }

    @Override
@@ -1461,6 +1514,9 @@ public final class GnssMeasurement implements Parcelable {

        builder.append(String.format(format, "Cn0DbHz", mCn0DbHz));

        builder.append(String.format(format, "BasebandCn0DbHz",
                hasBasebandCn0DbHz() ? mBasebandCn0DbHz : null));

        builder.append(String.format(
                formatWithUncertainty,
                "PseudorangeRateMetersPerSecond",
@@ -1536,6 +1592,7 @@ public final class GnssMeasurement implements Parcelable {
        resetSnrInDb();
        resetAutomaticGainControlLevel();
        resetCodeType();
        resetBasebandCn0DbHz();
    }

    private void setFlag(int flag) {