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

Commit 1afbd5f2 authored by Yu-Han Yang's avatar Yu-Han Yang
Browse files

Add navigation methods to IGnss AIDL HAL (hardware/interfaces)

Bug: 205185251
Test: atest VtsHalGnssTargetTest
Change-Id: Ib412aeb0b302952d13e236554f00690206b98253
parent 219d915b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -37,8 +37,8 @@ interface IAGnss {
  void setCallback(in android.hardware.gnss.IAGnssCallback callback);
  void dataConnClosed();
  void dataConnFailed();
  void setServer(in android.hardware.gnss.IAGnssCallback.AGnssType type, in String hostname, in int port);
  void dataConnOpen(in long networkHandle, in String apn, in android.hardware.gnss.IAGnss.ApnIpType apnIpType);
  void setServer(in android.hardware.gnss.IAGnssCallback.AGnssType type, in @utf8InCpp String hostname, in int port);
  void dataConnOpen(in long networkHandle, in @utf8InCpp String apn, in android.hardware.gnss.IAGnss.ApnIpType apnIpType);
  @Backing(type="int") @VintfStability
  enum ApnIpType {
    INVALID = 0,
+34 −0
Original line number Diff line number Diff line
@@ -46,7 +46,41 @@ interface IGnss {
  android.hardware.gnss.IAGnss getExtensionAGnss();
  android.hardware.gnss.IGnssDebug getExtensionGnssDebug();
  android.hardware.gnss.visibility_control.IGnssVisibilityControl getExtensionGnssVisibilityControl();
  void start();
  void stop();
  void injectTime(in long timeMs, in long timeReferenceMs, in int uncertaintyMs);
  void injectLocation(in android.hardware.gnss.GnssLocation location);
  void injectBestLocation(in android.hardware.gnss.GnssLocation location);
  void deleteAidingData(in android.hardware.gnss.IGnss.GnssAidingData aidingDataFlags);
  void setPositionMode(in android.hardware.gnss.IGnss.GnssPositionMode mode, in android.hardware.gnss.IGnss.GnssPositionRecurrence recurrence, in int minIntervalMs, in int preferredAccuracyMeters, in int preferredTimeMs, in boolean lowPowerMode);
  const int ERROR_INVALID_ARGUMENT = 1;
  const int ERROR_ALREADY_INIT = 2;
  const int ERROR_GENERIC = 3;
  @Backing(type="int") @VintfStability
  enum GnssPositionMode {
    STANDALONE = 0,
    MS_BASED = 1,
    MS_ASSISTED = 2,
  }
  @Backing(type="int") @VintfStability
  enum GnssPositionRecurrence {
    RECURRENCE_PERIODIC = 0,
    RECURRENCE_SINGLE = 1,
  }
  @Backing(type="int") @VintfStability
  enum GnssAidingData {
    DELETE_EPHEMERIS = 1,
    DELETE_ALMANAC = 2,
    DELETE_POSITION = 4,
    DELETE_TIME = 8,
    DELETE_IONO = 16,
    DELETE_UTC = 32,
    DELETE_HEALTH = 64,
    DELETE_SVDIR = 128,
    DELETE_SVSTEER = 256,
    DELETE_SADATA = 512,
    DELETE_RTI = 1024,
    DELETE_CELLDB_INFO = 32768,
    DELETE_ALL = 65535,
  }
}
+52 −0
Original line number Diff line number Diff line
@@ -35,8 +35,60 @@ package android.hardware.gnss;
@VintfStability
interface IGnssCallback {
  void gnssSetCapabilitiesCb(in int capabilities);
  void gnssStatusCb(in android.hardware.gnss.IGnssCallback.GnssStatusValue status);
  void gnssSvStatusCb(in android.hardware.gnss.IGnssCallback.GnssSvInfo[] svInfoList);
  void gnssLocationCb(in android.hardware.gnss.GnssLocation location);
  void gnssNmeaCb(in long timestamp, in @utf8InCpp String nmea);
  void gnssAcquireWakelockCb();
  void gnssReleaseWakelockCb();
  void gnssSetSystemInfoCb(in android.hardware.gnss.IGnssCallback.GnssSystemInfo info);
  void gnssRequestTimeCb();
  void gnssRequestLocationCb(in boolean independentFromGnss, in boolean isUserEmergency);
  const int CAPABILITY_SCHEDULING = 1;
  const int CAPABILITY_MSB = 2;
  const int CAPABILITY_MSA = 4;
  const int CAPABILITY_SINGLE_SHOT = 8;
  const int CAPABILITY_ON_DEMAND_TIME = 16;
  const int CAPABILITY_GEOFENCING = 32;
  const int CAPABILITY_MEASUREMENTS = 64;
  const int CAPABILITY_NAV_MESSAGES = 128;
  const int CAPABILITY_LOW_POWER_MODE = 256;
  const int CAPABILITY_SATELLITE_BLOCKLIST = 512;
  const int CAPABILITY_MEASUREMENT_CORRECTIONS = 1024;
  const int CAPABILITY_ANTENNA_INFO = 2048;
  const int CAPABILITY_CORRELATION_VECTOR = 4096;
  const int CAPABILITY_SATELLITE_PVT = 8192;
  const int CAPABILITY_MEASUREMENT_CORRECTIONS_FOR_DRIVING = 16384;
  @Backing(type="int") @VintfStability
  enum GnssStatusValue {
    NONE = 0,
    SESSION_BEGIN = 1,
    SESSION_END = 2,
    ENGINE_ON = 3,
    ENGINE_OFF = 4,
  }
  @Backing(type="int") @VintfStability
  enum GnssSvFlags {
    NONE = 0,
    HAS_EPHEMERIS_DATA = 1,
    HAS_ALMANAC_DATA = 2,
    USED_IN_FIX = 4,
    HAS_CARRIER_FREQUENCY = 8,
  }
  @VintfStability
  parcelable GnssSvInfo {
    int svid;
    android.hardware.gnss.GnssConstellationType constellation;
    float cN0Dbhz;
    float basebandCN0DbHz;
    float elevationDegrees;
    float azimuthDegrees;
    long carrierFrequencyHz;
    int svFlag;
  }
  @VintfStability
  parcelable GnssSystemInfo {
    int yearOfHw;
    @utf8InCpp String name;
  }
}
+3 −2
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ interface IAGnss {
     * @param hostname Hostname of the AGNSS server.
     * @param port Port number associated with the server.
     */
    void setServer(in AGnssType type, in String hostname, in int port);
    void setServer(in AGnssType type, in @utf8InCpp String hostname, in int port);

    /**
     * Notifies GNSS that a data connection is available and sets the network handle,
@@ -75,5 +75,6 @@ interface IAGnss {
     * @param apn Access Point Name (follows regular APN naming convention).
     * @param apnIpType Specifies IP type of APN.
     */
    void dataConnOpen(in long networkHandle, in String apn, in ApnIpType apnIpType);
    void dataConnOpen(
            in long networkHandle, in @utf8InCpp String apn, in ApnIpType apnIpType);
}
+125 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.hardware.gnss;

import android.hardware.gnss.GnssLocation;
import android.hardware.gnss.IAGnss;
import android.hardware.gnss.IGnssBatching;
import android.hardware.gnss.IGnssCallback;
@@ -45,6 +46,53 @@ interface IGnss {
    /** Any other error. */
    const int ERROR_GENERIC = 3;

    /** Requested operational mode for GNSS operation. */
    @VintfStability
    @Backing(type="int")
    enum GnssPositionMode {
        /** Mode for running GNSS standalone (no assistance). */
        STANDALONE = 0,
        /** AGNSS MS-Based mode. */
        MS_BASED = 1,
        /**
         * AGNSS MS-Assisted mode. This mode is not maintained by the platform anymore.
         * It is strongly recommended to use MS_BASED instead.
         */
        MS_ASSISTED = 2,
    }

    /** Requested recurrence mode for GNSS operation. */
    @VintfStability
    @Backing(type="int")
    enum GnssPositionRecurrence {
        /** Receive GNSS fixes on a recurring basis at a specified period. */
        RECURRENCE_PERIODIC = 0,
        /** Request a single shot GNSS fix. */
        RECURRENCE_SINGLE = 1,
    }

    /**
     * Flags used to specify which aiding data to delete when calling
     * deleteAidingData().
     */
    @VintfStability
    @Backing(type="int")
    enum GnssAidingData {
        DELETE_EPHEMERIS = 0x0001,
        DELETE_ALMANAC = 0x0002,
        DELETE_POSITION = 0x0004,
        DELETE_TIME = 0x0008,
        DELETE_IONO = 0x0010,
        DELETE_UTC = 0x0020,
        DELETE_HEALTH = 0x0040,
        DELETE_SVDIR = 0x0080,
        DELETE_SVSTEER = 0x0100,
        DELETE_SADATA = 0x0200,
        DELETE_RTI = 0x0400,
        DELETE_CELLDB_INFO = 0x8000,
        DELETE_ALL = 0xFFFF
    }

    /**
     * Opens the interface and provides the callback routines to the implementation of this
     * interface.
@@ -152,4 +200,81 @@ interface IGnss {
     * @return Handle to the IGnssVisibilityControl.
     */
    IGnssVisibilityControl getExtensionGnssVisibilityControl();

    /**
     * Starts a location output stream using the IGnssCallback gnssLocationCb(), following the
     * settings from the most recent call to setPositionMode().
     *
     * This output must operate independently of any GNSS location batching operations,
     * see the IGnssBatching for details.
     */
    void start();

    /**
     * Stops the location output stream.
     */
    void stop();

    /**
     * Injects the current time.
     *
     * @param timeMs This is the UTC time received from the NTP server, its value is given in
     *     milliseconds since January 1, 1970.
     * @param timeReferenceMs The corresponding value of SystemClock.elapsedRealtime() from the
     *     device when the NTP response was received in milliseconds.
     * @param uncertaintyMs Uncertainty associated with the value represented by time. Represented
     *     in milliseconds.
     */
    void injectTime(in long timeMs, in long timeReferenceMs, in int uncertaintyMs);

    /**
     * Injects current location from another (typically network) location provider.
     *
     * @param location Current location from the location provider
     */
    void injectLocation(in GnssLocation location);

    /**
     * Injects current location from the best available location provider.
     *
     * Unlike injectLocation, this method may inject a recent GNSS location from the HAL
     * implementation, if that is the best available location known to the framework.
     *
     * @param location Location information from the best available location provider.
     */
    void injectBestLocation(in GnssLocation location);

    /**
     * Specifies that the next call to start will not use the information defined in the flags.
     * GnssAidingData value of DELETE_ALL is passed for a cold start.
     *
     * @param aidingDataFlags Flags specifying the aiding data to be deleted.
     */
    void deleteAidingData(in GnssAidingData aidingDataFlags);

    /**
     * Sets the GnssPositionMode parameter, its associated recurrence value, the time between fixes,
     * requested fix accuracy, time to first fix.
     *
     * @param mode Parameter must be one of MS_BASED or STANDALONE. It is allowed by the platform
     *     (and it is recommended) to fallback to MS_BASED if MS_ASSISTED is passed in, and MS_BASED
     *     is supported.
     * @param recurrence GNSS position recurrence value, either periodic or single.
     * @param minIntervalMs Represents the time between fixes in milliseconds.
     * @param preferredAccuracyMeters Represents the requested fix accuracy in meters.
     * @param preferredTimeMs Represents the requested time to first fix in milliseconds.
     * @param lowPowerMode When true, and IGnss is the only client to the GNSS hardware, the GNSS
     *     hardware must make strong tradeoffs to substantially restrict power use. Specifically, in
     *     the case of a several second long minIntervalMs, the GNSS hardware must not, on average,
     *     run power hungry operations like RF and signal searches for more than one second per
     *     interval, and must make exactly one call to gnssSvStatusCb(), and either zero or one call
     *     to GnssLocationCb() at each interval. When false, HAL must operate in the nominal mode
     *     and is expected to make power and performance tradoffs such as duty-cycling when signal
     *     conditions are good and more active searches to reacquire GNSS signals when no signals
     *     are present. When there are additional clients using the GNSS hardware other than IGnss,
     *     the GNSS hardware may operate in a higher power mode, on behalf of those clients.
     */
    void setPositionMode(in GnssPositionMode mode, in GnssPositionRecurrence recurrence,
            in int minIntervalMs, in int preferredAccuracyMeters, in int preferredTimeMs,
            in boolean lowPowerMode);
}
Loading