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

Commit d46d3085 authored by Lifu Tang's avatar Lifu Tang
Browse files

Worked around the crash caused by API renaming

Bug: 26885642
Change-Id: I1f1ad76d18444d5f250397ef491e1dd4858f0a1d
parent 818aa2c2
Loading
Loading
Loading
Loading
+229 −0
Original line number Original line Diff line number Diff line
@@ -20574,6 +20574,231 @@ package android.location {
    method public void onStopped();
    method public void onStopped();
  }
  }
  public class GpsClock implements android.os.Parcelable {
    method public int describeContents();
    method public double getBiasInNs();
    method public double getBiasUncertaintyInNs();
    method public double getDriftInNsPerSec();
    method public double getDriftUncertaintyInNsPerSec();
    method public long getFullBiasInNs();
    method public short getLeapSecond();
    method public long getTimeInNs();
    method public double getTimeUncertaintyInNs();
    method public byte getType();
    method public boolean hasBiasInNs();
    method public boolean hasBiasUncertaintyInNs();
    method public boolean hasDriftInNsPerSec();
    method public boolean hasDriftUncertaintyInNsPerSec();
    method public boolean hasFullBiasInNs();
    method public boolean hasLeapSecond();
    method public boolean hasTimeUncertaintyInNs();
    method public void reset();
    method public void resetBiasInNs();
    method public void resetBiasUncertaintyInNs();
    method public void resetDriftInNsPerSec();
    method public void resetDriftUncertaintyInNsPerSec();
    method public void resetFullBiasInNs();
    method public void resetLeapSecond();
    method public void resetTimeUncertaintyInNs();
    method public void set(android.location.GpsClock);
    method public void setBiasInNs(double);
    method public void setBiasUncertaintyInNs(double);
    method public void setDriftInNsPerSec(double);
    method public void setDriftUncertaintyInNsPerSec(double);
    method public void setFullBiasInNs(long);
    method public void setLeapSecond(short);
    method public void setTimeInNs(long);
    method public void setTimeUncertaintyInNs(double);
    method public void setType(byte);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.location.GpsClock> CREATOR;
    field public static final byte TYPE_GPS_TIME = 2; // 0x2
    field public static final byte TYPE_LOCAL_HW_TIME = 1; // 0x1
    field public static final byte TYPE_UNKNOWN = 0; // 0x0
  }
  public class GpsMeasurement implements android.os.Parcelable {
    method public int describeContents();
    method public double getAccumulatedDeltaRangeInMeters();
    method public short getAccumulatedDeltaRangeState();
    method public double getAccumulatedDeltaRangeUncertaintyInMeters();
    method public double getAzimuthInDeg();
    method public double getAzimuthUncertaintyInDeg();
    method public int getBitNumber();
    method public long getCarrierCycles();
    method public float getCarrierFrequencyInHz();
    method public double getCarrierPhase();
    method public double getCarrierPhaseUncertainty();
    method public double getCn0InDbHz();
    method public double getCodePhaseInChips();
    method public double getCodePhaseUncertaintyInChips();
    method public double getDopplerShiftInHz();
    method public double getDopplerShiftUncertaintyInHz();
    method public double getElevationInDeg();
    method public double getElevationUncertaintyInDeg();
    method public byte getLossOfLock();
    method public byte getMultipathIndicator();
    method public byte getPrn();
    method public double getPseudorangeInMeters();
    method public double getPseudorangeRateInMetersPerSec();
    method public double getPseudorangeRateUncertaintyInMetersPerSec();
    method public double getPseudorangeUncertaintyInMeters();
    method public long getReceivedGpsTowInNs();
    method public long getReceivedGpsTowUncertaintyInNs();
    method public double getSnrInDb();
    method public short getState();
    method public short getTimeFromLastBitInMs();
    method public double getTimeOffsetInNs();
    method public boolean hasAzimuthInDeg();
    method public boolean hasAzimuthUncertaintyInDeg();
    method public boolean hasBitNumber();
    method public boolean hasCarrierCycles();
    method public boolean hasCarrierFrequencyInHz();
    method public boolean hasCarrierPhase();
    method public boolean hasCarrierPhaseUncertainty();
    method public boolean hasCodePhaseInChips();
    method public boolean hasCodePhaseUncertaintyInChips();
    method public boolean hasDopplerShiftInHz();
    method public boolean hasDopplerShiftUncertaintyInHz();
    method public boolean hasElevationInDeg();
    method public boolean hasElevationUncertaintyInDeg();
    method public boolean hasPseudorangeInMeters();
    method public boolean hasPseudorangeUncertaintyInMeters();
    method public boolean hasSnrInDb();
    method public boolean hasTimeFromLastBitInMs();
    method public boolean isPseudorangeRateCorrected();
    method public boolean isUsedInFix();
    method public void reset();
    method public void resetAzimuthInDeg();
    method public void resetAzimuthUncertaintyInDeg();
    method public void resetBitNumber();
    method public void resetCarrierCycles();
    method public void resetCarrierFrequencyInHz();
    method public void resetCarrierPhase();
    method public void resetCarrierPhaseUncertainty();
    method public void resetCodePhaseInChips();
    method public void resetCodePhaseUncertaintyInChips();
    method public void resetDopplerShiftInHz();
    method public void resetDopplerShiftUncertaintyInHz();
    method public void resetElevationInDeg();
    method public void resetElevationUncertaintyInDeg();
    method public void resetPseudorangeInMeters();
    method public void resetPseudorangeUncertaintyInMeters();
    method public void resetSnrInDb();
    method public void resetTimeFromLastBitInMs();
    method public void set(android.location.GpsMeasurement);
    method public void setAccumulatedDeltaRangeInMeters(double);
    method public void setAccumulatedDeltaRangeState(short);
    method public void setAccumulatedDeltaRangeUncertaintyInMeters(double);
    method public void setAzimuthInDeg(double);
    method public void setAzimuthUncertaintyInDeg(double);
    method public void setBitNumber(int);
    method public void setCarrierCycles(long);
    method public void setCarrierFrequencyInHz(float);
    method public void setCarrierPhase(double);
    method public void setCarrierPhaseUncertainty(double);
    method public void setCn0InDbHz(double);
    method public void setCodePhaseInChips(double);
    method public void setCodePhaseUncertaintyInChips(double);
    method public void setDopplerShiftInHz(double);
    method public void setDopplerShiftUncertaintyInHz(double);
    method public void setElevationInDeg(double);
    method public void setElevationUncertaintyInDeg(double);
    method public void setLossOfLock(byte);
    method public void setMultipathIndicator(byte);
    method public void setPrn(byte);
    method public void setPseudorangeInMeters(double);
    method public void setPseudorangeRateInMetersPerSec(double);
    method public void setPseudorangeRateUncertaintyInMetersPerSec(double);
    method public void setPseudorangeUncertaintyInMeters(double);
    method public void setReceivedGpsTowInNs(long);
    method public void setReceivedGpsTowUncertaintyInNs(long);
    method public void setSnrInDb(double);
    method public void setState(short);
    method public void setTimeFromLastBitInMs(short);
    method public void setTimeOffsetInNs(double);
    method public void setUsedInFix(boolean);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final short ADR_STATE_CYCLE_SLIP = 4; // 0x4
    field public static final short ADR_STATE_RESET = 2; // 0x2
    field public static final short ADR_STATE_UNKNOWN = 0; // 0x0
    field public static final short ADR_STATE_VALID = 1; // 0x1
    field public static final android.os.Parcelable.Creator<android.location.GpsMeasurement> CREATOR;
    field public static final byte LOSS_OF_LOCK_CYCLE_SLIP = 2; // 0x2
    field public static final byte LOSS_OF_LOCK_OK = 1; // 0x1
    field public static final byte LOSS_OF_LOCK_UNKNOWN = 0; // 0x0
    field public static final byte MULTIPATH_INDICATOR_DETECTED = 1; // 0x1
    field public static final byte MULTIPATH_INDICATOR_NOT_USED = 2; // 0x2
    field public static final byte MULTIPATH_INDICATOR_UNKNOWN = 0; // 0x0
    field public static final short STATE_BIT_SYNC = 2; // 0x2
    field public static final short STATE_CODE_LOCK = 1; // 0x1
    field public static final short STATE_MSEC_AMBIGUOUS = 16; // 0x10
    field public static final short STATE_SUBFRAME_SYNC = 4; // 0x4
    field public static final short STATE_TOW_DECODED = 8; // 0x8
    field public static final short STATE_UNKNOWN = 0; // 0x0
  }
  public class GpsMeasurementsEvent implements android.os.Parcelable {
    ctor public GpsMeasurementsEvent(android.location.GpsClock, android.location.GpsMeasurement[]);
    method public int describeContents();
    method public android.location.GpsClock getClock();
    method public java.util.Collection<android.location.GpsMeasurement> getMeasurements();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.location.GpsMeasurementsEvent> CREATOR;
    field public static final int STATUS_GPS_LOCATION_DISABLED = 2; // 0x2
    field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
    field public static final int STATUS_READY = 1; // 0x1
  }
  public static abstract interface GpsMeasurementsEvent.Listener {
    method public abstract void onGpsMeasurementsReceived(android.location.GpsMeasurementsEvent);
    method public abstract void onStatusChanged(int);
  }
  public class GpsNavigationMessage implements android.os.Parcelable {
    method public int describeContents();
    method public byte[] getData();
    method public short getMessageId();
    method public byte getPrn();
    method public short getStatus();
    method public short getSubmessageId();
    method public byte getType();
    method public void reset();
    method public void set(android.location.GpsNavigationMessage);
    method public void setData(byte[]);
    method public void setMessageId(short);
    method public void setPrn(byte);
    method public void setStatus(short);
    method public void setSubmessageId(short);
    method public void setType(byte);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.location.GpsNavigationMessage> CREATOR;
    field public static final short STATUS_PARITY_PASSED = 1; // 0x1
    field public static final short STATUS_PARITY_REBUILT = 2; // 0x2
    field public static final short STATUS_UNKNOWN = 0; // 0x0
    field public static final byte TYPE_CNAV2 = 4; // 0x4
    field public static final byte TYPE_L1CA = 1; // 0x1
    field public static final byte TYPE_L2CNAV = 2; // 0x2
    field public static final byte TYPE_L5CNAV = 3; // 0x3
    field public static final byte TYPE_UNKNOWN = 0; // 0x0
  }
  public class GpsNavigationMessageEvent implements android.os.Parcelable {
    ctor public GpsNavigationMessageEvent(android.location.GpsNavigationMessage);
    method public int describeContents();
    method public android.location.GpsNavigationMessage getNavigationMessage();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.location.GpsNavigationMessageEvent> CREATOR;
    field public static int STATUS_GPS_LOCATION_DISABLED;
    field public static int STATUS_NOT_SUPPORTED;
    field public static int STATUS_READY;
  }
  public static abstract interface GpsNavigationMessageEvent.Listener {
    method public abstract void onGpsNavigationMessageReceived(android.location.GpsNavigationMessageEvent);
    method public abstract void onStatusChanged(int);
  }
  public final class GpsSatellite {
  public final class GpsSatellite {
    method public float getAzimuth();
    method public float getAzimuth();
    method public float getElevation();
    method public float getElevation();
@@ -20678,6 +20903,8 @@ package android.location {
  }
  }
  public class LocationManager {
  public class LocationManager {
    method public deprecated boolean addGpsMeasurementListener(android.location.GpsMeasurementsEvent.Listener);
    method public deprecated boolean addGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
    method public deprecated boolean addGpsStatusListener(android.location.GpsStatus.Listener);
    method public deprecated boolean addGpsStatusListener(android.location.GpsStatus.Listener);
    method public deprecated boolean addNmeaListener(android.location.GpsStatus.NmeaListener);
    method public deprecated boolean addNmeaListener(android.location.GpsStatus.NmeaListener);
    method public boolean addNmeaListener(android.location.GnssNmeaListener);
    method public boolean addNmeaListener(android.location.GnssNmeaListener);
@@ -20701,6 +20928,8 @@ package android.location {
    method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback, android.os.Handler);
    method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback, android.os.Handler);
    method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback);
    method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback);
    method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback, android.os.Handler);
    method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback, android.os.Handler);
    method public deprecated void removeGpsMeasurementListener(android.location.GpsMeasurementsEvent.Listener);
    method public deprecated void removeGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
    method public deprecated void removeGpsStatusListener(android.location.GpsStatus.Listener);
    method public deprecated void removeGpsStatusListener(android.location.GpsStatus.Listener);
    method public deprecated void removeNmeaListener(android.location.GpsStatus.NmeaListener);
    method public deprecated void removeNmeaListener(android.location.GpsStatus.NmeaListener);
    method public void removeNmeaListener(android.location.GnssNmeaListener);
    method public void removeNmeaListener(android.location.GnssNmeaListener);
+503 −0

File added.

Preview size limit exceeded, changes collapsed.

+1413 −0

File added.

Preview size limit exceeded, changes collapsed.

+159 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License
 */

package android.location;

import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;

import java.security.InvalidParameterException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;

/**
 * A class implementing a container for data associated with a measurement event.
 * Events are delivered to registered instances of {@link Listener}.
 *
 * @hide
 */
@SystemApi
public class GpsMeasurementsEvent implements Parcelable {

    /**
     * The system does not support tracking of GPS Measurements. This status will not change in the
     * future.
     */
    public static final int STATUS_NOT_SUPPORTED = 0;

    /**
     * GPS Measurements are successfully being tracked, it will receive updates once they are
     * available.
     */
    public static final int STATUS_READY = 1;

    /**
     * GPS provider or Location is disabled, updates will not be received until they are enabled.
     */
    public static final int STATUS_GPS_LOCATION_DISABLED = 2;

    private final GpsClock mClock;
    private final Collection<GpsMeasurement> mReadOnlyMeasurements;

    /**
     * Used for receiving GPS satellite measurements from the GPS engine.
     * Each measurement contains raw and computed data identifying a satellite.
     * You can implement this interface and call {@link LocationManager#addGpsMeasurementListener}.
     *
     * @hide
     */
    @SystemApi
    public interface Listener {

        /**
         * Returns the latest collected GPS Measurements.
         */
        void onGpsMeasurementsReceived(GpsMeasurementsEvent eventArgs);

        /**
         * Returns the latest status of the GPS Measurements sub-system.
         */
        void onStatusChanged(int status);
    }

    public GpsMeasurementsEvent(GpsClock clock, GpsMeasurement[] measurements) {
        if (clock == null) {
            throw new InvalidParameterException("Parameter 'clock' must not be null.");
        }
        if (measurements == null || measurements.length == 0) {
            throw new InvalidParameterException(
                    "Parameter 'measurements' must not be null or empty.");
        }

        mClock = clock;
        Collection<GpsMeasurement> measurementCollection = Arrays.asList(measurements);
        mReadOnlyMeasurements = Collections.unmodifiableCollection(measurementCollection);
    }

    @NonNull
    public GpsClock getClock() {
        return mClock;
    }

    /**
     * Gets a read-only collection of measurements associated with the current event.
     */
    @NonNull
    public Collection<GpsMeasurement> getMeasurements() {
        return mReadOnlyMeasurements;
    }

    public static final Creator<GpsMeasurementsEvent> CREATOR =
            new Creator<GpsMeasurementsEvent>() {
        @Override
        public GpsMeasurementsEvent createFromParcel(Parcel in) {
            ClassLoader classLoader = getClass().getClassLoader();

            GpsClock clock = in.readParcelable(classLoader);

            int measurementsLength = in.readInt();
            GpsMeasurement[] measurementsArray = new GpsMeasurement[measurementsLength];
            in.readTypedArray(measurementsArray, GpsMeasurement.CREATOR);

            return new GpsMeasurementsEvent(clock, measurementsArray);
        }

        @Override
        public GpsMeasurementsEvent[] newArray(int size) {
            return new GpsMeasurementsEvent[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int flags) {
        parcel.writeParcelable(mClock, flags);

        int measurementsCount = mReadOnlyMeasurements.size();
        GpsMeasurement[] measurementsArray =
                mReadOnlyMeasurements.toArray(new GpsMeasurement[measurementsCount]);
        parcel.writeInt(measurementsArray.length);
        parcel.writeTypedArray(measurementsArray, flags);
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder("[ GpsMeasurementsEvent:\n\n");

        builder.append(mClock.toString());
        builder.append("\n");

        for (GpsMeasurement measurement : mReadOnlyMeasurements) {
            builder.append(measurement.toString());
            builder.append("\n");
        }

        builder.append("]");

        return builder.toString();
    }
}
+324 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading