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

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

Merge "Bluesky Android Q Platform Changes"

parents 36db4ebb 226b7b77
Loading
Loading
Loading
Loading
+77 −0
Original line number Diff line number Diff line
@@ -2577,6 +2577,81 @@ package android.location {
    method public void onLocationBatch(java.util.List<android.location.Location>);
  }

  public final class GnssMeasurementCorrections implements android.os.Parcelable {
    method public int describeContents();
    method public double getAltitudeMeters();
    method public double getLatitudeDegrees();
    method public double getLongitudeDegrees();
    method public java.util.List<android.location.GnssSingleSatCorrection> getSingleSatCorrectionList();
    method public long getToaGpsNanosecondsOfWeek();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.location.GnssMeasurementCorrections> CREATOR;
  }

  public static class GnssMeasurementCorrections.Builder {
    ctor public GnssMeasurementCorrections.Builder();
    method public android.location.GnssMeasurementCorrections build();
    method public android.location.GnssMeasurementCorrections.Builder setAltitudeMeters(double);
    method public android.location.GnssMeasurementCorrections.Builder setLatitudeDegrees(double);
    method public android.location.GnssMeasurementCorrections.Builder setLongitudeDegrees(double);
    method public android.location.GnssMeasurementCorrections.Builder setSingleSatCorrectionList(java.util.List<android.location.GnssSingleSatCorrection>);
    method public android.location.GnssMeasurementCorrections.Builder setToaGpsNanosecondsOfWeek(long);
  }

  public final class GnssReflectingPlane implements android.os.Parcelable {
    method public int describeContents();
    method public double getAltitudeMeters();
    method public double getAzimuthDegrees();
    method public double getLatitudeDegrees();
    method public double getLongitudeDegrees();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.location.GnssReflectingPlane> CREATOR;
  }

  public static class GnssReflectingPlane.Builder {
    ctor public GnssReflectingPlane.Builder();
    method public android.location.GnssReflectingPlane build();
    method public android.location.GnssReflectingPlane.Builder setAltitudeMeters(double);
    method public android.location.GnssReflectingPlane.Builder setAzimuthDegrees(double);
    method public android.location.GnssReflectingPlane.Builder setLatitudeDegrees(double);
    method public android.location.GnssReflectingPlane.Builder setLongitudeDegrees(double);
  }

  public final class GnssSingleSatCorrection implements android.os.Parcelable {
    method public int describeContents();
    method public float getCarrierFrequencyHz();
    method public int getConstellationType();
    method public float getExcessPathLengthMeters();
    method public float getExcessPathLengthUncertaintyMeters();
    method public android.location.GnssReflectingPlane getReflectingPlane();
    method public int getSatId();
    method public int getSingleSatCorrectionFlags();
    method public boolean hasExcessPathLength();
    method public boolean hasExcessPathLengthUncertainty();
    method public boolean hasReflectingPlane();
    method public boolean hasSatelliteLineOfSight();
    method public boolean isSatelliteLineOfSight();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.location.GnssSingleSatCorrection> CREATOR;
    field public static final int HAS_EXCESS_PATH_LENGTH_MASK = 2; // 0x2
    field public static final int HAS_EXCESS_PATH_LENGTH_UNC_MASK = 4; // 0x4
    field public static final int HAS_REFLECTING_PLANE_MASK = 8; // 0x8
    field public static final int HAS_SAT_IS_LOS_MASK = 1; // 0x1
  }

  public static class GnssSingleSatCorrection.Builder {
    ctor public GnssSingleSatCorrection.Builder();
    method public android.location.GnssSingleSatCorrection build();
    method public android.location.GnssSingleSatCorrection.Builder setCarrierFrequencyHz(float);
    method public android.location.GnssSingleSatCorrection.Builder setConstellationType(int);
    method public android.location.GnssSingleSatCorrection.Builder setExcessPathLengthMeters(float);
    method public android.location.GnssSingleSatCorrection.Builder setExcessPathLengthUncertaintyMeters(float);
    method public android.location.GnssSingleSatCorrection.Builder setReflectingPlane(android.location.GnssReflectingPlane);
    method public android.location.GnssSingleSatCorrection.Builder setSatId(int);
    method public android.location.GnssSingleSatCorrection.Builder setSatIsLos(boolean);
    method public android.location.GnssSingleSatCorrection.Builder setSingleSatCorrectionFlags(int);
  }

  public class GpsClock implements android.os.Parcelable {
    method public int describeContents();
    method public double getBiasInNs();
@@ -2813,8 +2888,10 @@ package android.location {
    method public deprecated boolean addGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
    method public void flushGnssBatch();
    method public int getGnssBatchSize();
    method public int getGnssCapabilities();
    method public java.lang.String getLocationControllerExtraPackage();
    method public java.lang.String getNetworkProviderPackage();
    method public void injectGnssMeasurementCorrections(android.location.GnssMeasurementCorrections);
    method public boolean isLocationControllerExtraPackageEnabled();
    method public boolean isLocationEnabledForUser(android.os.UserHandle);
    method public boolean isProviderEnabledForUser(java.lang.String, android.os.UserHandle);
+27 −7
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ package android.location;
import android.content.Context;
import android.os.RemoteException;

import com.android.internal.util.Preconditions;

/**
 * A handler class to manage transport callbacks for {@link GnssMeasurementsEvent.Callback}.
 *
@@ -26,12 +28,13 @@ import android.os.RemoteException;
 */
class GnssMeasurementCallbackTransport
        extends LocalListenerHelper<GnssMeasurementsEvent.Callback> {
    private static final String TAG = "GnssMeasCbTransport";
    private final ILocationManager mLocationManager;

    private final IGnssMeasurementsListener mListenerTransport = new ListenerTransport();

    public GnssMeasurementCallbackTransport(Context context, ILocationManager locationManager) {
        super(context, "GnssMeasurementListenerTransport");
        super(context, TAG);
        mLocationManager = locationManager;
    }

@@ -47,6 +50,23 @@ class GnssMeasurementCallbackTransport
        mLocationManager.removeGnssMeasurementsListener(mListenerTransport);
    }

    /**
     * Injects GNSS measurement corrections into the GNSS chipset.
     *
     * @param measurementCorrections a {@link GnssMeasurementCorrections} object with the GNSS
     *     measurement corrections to be injected into the GNSS chipset.
     */
    protected void injectGnssMeasurementCorrections(
            GnssMeasurementCorrections measurementCorrections) throws RemoteException {
        Preconditions.checkNotNull(measurementCorrections);
        mLocationManager.injectGnssMeasurementCorrections(
                measurementCorrections, getContext().getPackageName());
    }

    protected int getGnssCapabilities() throws RemoteException {
        return mLocationManager.getGnssCapabilities(getContext().getPackageName());
    }

    private class ListenerTransport extends IGnssMeasurementsListener.Stub {
        @Override
        public void onGnssMeasurementsReceived(final GnssMeasurementsEvent event) {
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 208 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;

parcelable GnssMeasurementCorrections;
+210 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 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.Nullable;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * A class representing a GNSS measurement corrections for all used GNSS satellites at the location
 * and time specified
 *
 * @hide
 */
@SystemApi
public final class GnssMeasurementCorrections implements Parcelable {

    /** Represents latitude in degrees at which the corrections are computed. */
    private double mLatitudeDegrees;
    /** Represents longitude in degrees at which the corrections are computed. */
    private double mLongitudeDegrees;
    /**
     * Represents altitude in meters above the WGS 84 reference ellipsoid at which the corrections
     * are computed.
     */
    private double mAltitudeMeters;

    /** Time Of Applicability, GPS time of week */
    private long mToaGpsNanosecondsOfWeek;

    /**
     * A set of {@link GnssSingleSatCorrection} each containing measurement corrections for a
     * satellite in view
     */
    private @Nullable List<GnssSingleSatCorrection> mSingleSatCorrectionList;

    private GnssMeasurementCorrections(Builder builder) {
        mLatitudeDegrees = builder.mLatitudeDegrees;
        mLongitudeDegrees = builder.mLongitudeDegrees;
        mAltitudeMeters = builder.mAltitudeMeters;
        mToaGpsNanosecondsOfWeek = builder.mToaGpsNanosecondsOfWeek;
        mSingleSatCorrectionList =
                builder.mSingleSatCorrectionList == null
                        ? null
                        : Collections.unmodifiableList(
                                new ArrayList<>(builder.mSingleSatCorrectionList));
    }

    /** Gets the latitude in degrees at which the corrections are computed. */
    public double getLatitudeDegrees() {
        return mLatitudeDegrees;
    }

    /** Gets the longitude in degrees at which the corrections are computed. */
    public double getLongitudeDegrees() {
        return mLongitudeDegrees;
    }

    /**
     * Gets the altitude in meters above the WGS 84 reference ellipsoid at which the corrections are
     * computed.
     */
    public double getAltitudeMeters() {
        return mAltitudeMeters;
    }

    /** Gets the time of applicability, GPS time of week in nanoseconds. */
    public long getToaGpsNanosecondsOfWeek() {
        return mToaGpsNanosecondsOfWeek;
    }

    /**
     * Gets a set of {@link GnssSingleSatCorrection} each containing measurement corrections for a
     * satellite in view
     */
    public @Nullable List<GnssSingleSatCorrection> getSingleSatCorrectionList() {
        return mSingleSatCorrectionList;
    }

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

    public static final Creator<GnssMeasurementCorrections> CREATOR =
            new Creator<GnssMeasurementCorrections>() {
                @Override
                public GnssMeasurementCorrections createFromParcel(Parcel parcel) {
                    GnssMeasurementCorrections.Builder gnssMeasurementCorrectons =
                            new Builder()
                                    .setLatitudeDegrees(parcel.readDouble())
                                    .setLongitudeDegrees(parcel.readDouble())
                                    .setAltitudeMeters(parcel.readDouble())
                                    .setToaGpsNanosecondsOfWeek(parcel.readLong());
                    List<GnssSingleSatCorrection> singleSatCorrectionList = new ArrayList<>();
                    parcel.readTypedList(singleSatCorrectionList, GnssSingleSatCorrection.CREATOR);
                    gnssMeasurementCorrectons.setSingleSatCorrectionList(
                            singleSatCorrectionList.isEmpty() ? null : singleSatCorrectionList);
                    return gnssMeasurementCorrectons.build();
                }

                @Override
                public GnssMeasurementCorrections[] newArray(int i) {
                    return new GnssMeasurementCorrections[i];
                }
            };

    @Override
    public String toString() {
        final String format = "   %-29s = %s\n";
        StringBuilder builder = new StringBuilder("GnssMeasurementCorrections:\n");
        builder.append(String.format(format, "LatitudeDegrees = ", mLatitudeDegrees));
        builder.append(String.format(format, "LongitudeDegrees = ", mLongitudeDegrees));
        builder.append(String.format(format, "AltitudeMeters = ", mAltitudeMeters));
        builder.append(
                String.format(format, "ToaGpsNanosecondsOfWeek = ", mToaGpsNanosecondsOfWeek));
        builder.append(
                String.format(format, "mSingleSatCorrectionList = ", mSingleSatCorrectionList));
        return builder.toString();
    }

    @Override
    public void writeToParcel(Parcel parcel, int flags) {
        parcel.writeDouble(mLatitudeDegrees);
        parcel.writeDouble(mLongitudeDegrees);
        parcel.writeDouble(mAltitudeMeters);
        parcel.writeLong(mToaGpsNanosecondsOfWeek);
        parcel.writeTypedList(mSingleSatCorrectionList);
    }

    /** Builder for {@link GnssMeasurementCorrections} */
    public static class Builder {
        /**
         * For documentation of below fields, see corresponding fields in {@link
         * GnssMeasurementCorrections}.
         */
        private double mLatitudeDegrees;

        private double mLongitudeDegrees;
        private double mAltitudeMeters;
        private long mToaGpsNanosecondsOfWeek;
        private List<GnssSingleSatCorrection> mSingleSatCorrectionList;

        /** Sets the latitude in degrees at which the corrections are computed. */
        public Builder setLatitudeDegrees(double latitudeDegrees) {
            mLatitudeDegrees = latitudeDegrees;
            return this;
        }

        /** Sets the longitude in degrees at which the corrections are computed. */
        public Builder setLongitudeDegrees(double longitudeDegrees) {
            mLongitudeDegrees = longitudeDegrees;
            return this;
        }

        /**
         * Sets the altitude in meters above the WGS 84 reference ellipsoid at which the corrections
         * are computed.
         */
        public Builder setAltitudeMeters(double altitudeMeters) {
            mAltitudeMeters = altitudeMeters;
            return this;
        }

        /** Sets the time of applicability, GPS time of week in nanoseconds. */
        public Builder setToaGpsNanosecondsOfWeek(long toaGpsNanosecondsOfWeek) {
            mToaGpsNanosecondsOfWeek = toaGpsNanosecondsOfWeek;
            return this;
        }

        /**
         * Sets a the list of {@link GnssSingleSatCorrection} containing measurement corrections for
         * a satellite in view
         */
        public Builder setSingleSatCorrectionList(
                @Nullable List<GnssSingleSatCorrection> singleSatCorrectionList) {
            if (singleSatCorrectionList == null) {
                mSingleSatCorrectionList = null;
            } else {
                mSingleSatCorrectionList =
                        Collections.unmodifiableList(new ArrayList<>(singleSatCorrectionList));
            }
            return this;
        }

        /** Builds a {@link GnssMeasurementCorrections} instance as specified by this builder. */
        public GnssMeasurementCorrections build() {
            return new GnssMeasurementCorrections(this);
        }
    }
}
+159 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 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.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * Holds the characteristics of the reflecting plane that a satellite signal has bounced from.
 *
 * @hide
 */
@SystemApi
public final class GnssReflectingPlane implements Parcelable {

    /** Represents latitude in degrees of the reflecting plane */
    private double mLatitudeDegrees;
    /** Represents longitude in degrees of the reflecting plane. */
    private double mLongitudeDegrees;
    /**
     * Represents altitude in meters above the WGS 84 reference ellipsoid of the reflection point in
     * the plane
     */
    private double mAltitudeMeters;

    /** Represents azimuth clockwise from north of the reflecting plane in degrees. */
    private double mAzimuthDegrees;

    private GnssReflectingPlane(Builder builder) {
        mLatitudeDegrees = builder.mLatitudeDegrees;
        mLongitudeDegrees = builder.mLongitudeDegrees;
        mAltitudeMeters = builder.mAltitudeMeters;
        mAzimuthDegrees = builder.mAzimuthDegrees;
    }

    /** Gets the latitude in degrees of the reflecting plane. */
    public double getLatitudeDegrees() {
        return mLatitudeDegrees;
    }

    /** Gets the longitude in degrees of the reflecting plane. */
    public double getLongitudeDegrees() {
        return mLongitudeDegrees;
    }

    /**
     * Gets the altitude in meters above the WGS 84 reference ellipsoid of the reflecting point
     * within the plane
     */
    public double getAltitudeMeters() {
        return mAltitudeMeters;
    }

    /** Gets the azimuth clockwise from north of the reflecting plane in degrees. */
    public double getAzimuthDegrees() {
        return mAzimuthDegrees;
    }

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

    public static final Creator<GnssReflectingPlane> CREATOR =
            new Creator<GnssReflectingPlane>() {
                @Override
                public GnssReflectingPlane createFromParcel(Parcel parcel) {
                    GnssReflectingPlane reflectingPlane =
                            new Builder()
                                    .setLatitudeDegrees(parcel.readDouble())
                                    .setLongitudeDegrees(parcel.readDouble())
                                    .setAltitudeMeters(parcel.readDouble())
                                    .setAzimuthDegrees(parcel.readDouble())
                                    .build();
                    return reflectingPlane;
                }

                @Override
                public GnssReflectingPlane[] newArray(int i) {
                    return new GnssReflectingPlane[i];
                }
            };

    @Override
    public String toString() {
        final String format = "   %-29s = %s\n";
        StringBuilder builder = new StringBuilder("ReflectingPlane:\n");
        builder.append(String.format(format, "LatitudeDegrees = ", mLatitudeDegrees));
        builder.append(String.format(format, "LongitudeDegrees = ", mLongitudeDegrees));
        builder.append(String.format(format, "AltitudeMeters = ", mAltitudeMeters));
        builder.append(String.format(format, "AzimuthDegrees = ", mAzimuthDegrees));
        return builder.toString();
    }

    @Override
    public void writeToParcel(Parcel parcel, int flags) {
        parcel.writeDouble(mLatitudeDegrees);
        parcel.writeDouble(mLongitudeDegrees);
        parcel.writeDouble(mAltitudeMeters);
        parcel.writeDouble(mAzimuthDegrees);
    }

    /** Builder for {@link GnssReflectingPlane} */
    public static class Builder {
        /** For documentation, see corresponding fields in {@link GnssReflectingPlane}. */
        private double mLatitudeDegrees;

        private double mLongitudeDegrees;
        private double mAltitudeMeters;
        private double mAzimuthDegrees;

        /** Sets the latitude in degrees of the reflecting plane. */
        public Builder setLatitudeDegrees(double latitudeDegrees) {
            mLatitudeDegrees = latitudeDegrees;
            return this;
        }

        /** Sets the longitude in degrees of the reflecting plane. */
        public Builder setLongitudeDegrees(double longitudeDegrees) {
            mLongitudeDegrees = longitudeDegrees;
            return this;
        }

        /**
         * Sets the altitude in meters above the WGS 84 reference ellipsoid of the reflecting point
         * within the plane
         */
        public Builder setAltitudeMeters(double altitudeMeters) {
            mAltitudeMeters = altitudeMeters;
            return this;
        }

        /** Sets the azimuth clockwise from north of the reflecting plane in degrees. */
        public Builder setAzimuthDegrees(double azimuthDegrees) {
            mAzimuthDegrees = azimuthDegrees;
            return this;
        }

        /** Builds a {@link GnssReflectingPlane} object as specified by this builder. */
        public GnssReflectingPlane build() {
            return new GnssReflectingPlane(this);
        }
    }
}
Loading