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

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

Merge "Add GnssGeofence AIDL HAL (hardware/interfaces)"

parents 911f8f61 3089df3b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ interface IGnss {
  android.hardware.gnss.IGnssMeasurementInterface getExtensionGnssMeasurement();
  android.hardware.gnss.IGnssPowerIndication getExtensionGnssPowerIndication();
  @nullable android.hardware.gnss.IGnssBatching getExtensionGnssBatching();
  @nullable android.hardware.gnss.IGnssGeofence getExtensionGnssGeofence();
  const int ERROR_INVALID_ARGUMENT = 1;
  const int ERROR_ALREADY_INIT = 2;
  const int ERROR_GENERIC = 3;
+42 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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.
 */
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
///////////////////////////////////////////////////////////////////////////////

// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
//     the interface (from the latest frozen version), the build system will
//     prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.

package android.hardware.gnss;
@VintfStability
interface IGnssGeofence {
  void setCallback(in android.hardware.gnss.IGnssGeofenceCallback callback);
  void addGeofence(in int geofenceId, in double latitudeDegrees, in double longitudeDegrees, in double radiusMeters, in int lastTransition, in int monitorTransitions, in int notificationResponsivenessMs, in int unknownTimerMs);
  void pauseGeofence(in int geofenceId);
  void resumeGeofence(in int geofenceId, in int monitorTransitions);
  void removeGeofence(in int geofenceId);
}
+54 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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.
 */
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
///////////////////////////////////////////////////////////////////////////////

// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
//     the interface (from the latest frozen version), the build system will
//     prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.

package android.hardware.gnss;
@VintfStability
interface IGnssGeofenceCallback {
  void gnssGeofenceTransitionCb(in int geofenceId, in android.hardware.gnss.GnssLocation location, in int transition, in long timestampMillis);
  void gnssGeofenceStatusCb(in int availability, in android.hardware.gnss.GnssLocation lastLocation);
  void gnssGeofenceAddCb(in int geofenceId, in int status);
  void gnssGeofenceRemoveCb(in int geofenceId, in int status);
  void gnssGeofencePauseCb(in int geofenceId, in int status);
  void gnssGeofenceResumeCb(in int geofenceId, in int status);
  const int ENTERED = 1;
  const int EXITED = 2;
  const int UNCERTAIN = 4;
  const int UNAVAILABLE = 1;
  const int AVAILABLE = 2;
  const int OPERATION_SUCCESS = 0;
  const int ERROR_TOO_MANY_GEOFENCES = -100;
  const int ERROR_ID_EXISTS = -101;
  const int ERROR_ID_UNKNOWN = -102;
  const int ERROR_INVALID_TRANSITION = -103;
  const int ERROR_GENERIC = -149;
}
+8 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.hardware.gnss;
import android.hardware.gnss.IGnssBatching;
import android.hardware.gnss.IGnssCallback;
import android.hardware.gnss.IGnssConfiguration;
import android.hardware.gnss.IGnssGeofence;
import android.hardware.gnss.IGnssMeasurementInterface;
import android.hardware.gnss.IGnssPowerIndication;
import android.hardware.gnss.IGnssPsds;
@@ -110,4 +111,11 @@ interface IGnss {
     * @return Handle to the IGnssBatching interface.
     */
    @nullable IGnssBatching getExtensionGnssBatching();

    /**
     * This method returns the IGnssGeofence interface.
     *
     * @return Handle to the IGnssGeofence interface.
     */
    @nullable IGnssGeofence getExtensionGnssGeofence();
}
+82 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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.hardware.gnss;

import android.hardware.gnss.IGnssGeofenceCallback;

/** Extended interface for GNSS Geofence support. */
@VintfStability
interface IGnssGeofence {
    /**
     * Opens the geofence interface and provides the callback routines to the HAL.
     *
     * @param callback Handle to the IGnssGeofenceCallback interface.
     */
    void setCallback(in IGnssGeofenceCallback callback);

    /**
     * Add a geofence area. This api currently supports circular geofences.
     *
     * @param geofenceId The id for the geofence. If a geofence with this id already exists, an
     * error value (ERROR_ID_EXISTS) must be returned.
     * @param latitudeDegrees The latitude(in degrees) for the geofence lastTransition.
     * @param longitudeDegrees The longitude(in degrees) for the geofence lastTransition.
     * @param radiusMeters The radius(in meters) for the geofence lastTransition.
     * @param lastTransition The current state of the geofence. It can be one of the transition
     * states (ENTERED, EXITED, UNCERTAIN) as defined in IGnssGeofenceCallback. For example, if
     * the system already knows that the user is inside the geofence, this will be set to ENTERED.
     * In most cases, it will be UNCERTAIN.
     * @param monitorTransitions A bitfield of ENTERED, EXITED and UNCERTAIN. It represents which
     * transitions to monitor.
     * @param notificationResponsivenessMs - Defines the best-effort description of how soon must
     * the callback be called when the transition associated with the Geofence is triggered. For
     * instance, if set to 1000 milliseconds with ENTERED, the callback must be called 1000
     * milliseconds within entering the geofence. This parameter is defined in milliseconds.
     * NOTE: This is not to be confused with the rate that the GNSS is polled at. It is acceptable
     * to dynamically vary the rate of sampling the GNSS for power-saving reasons; thus the rate of
     * sampling may be faster or slower than this.
     * @param unknownTimerMs - The time limit in millisecondsafter which the UNCERTAIN transition
     * must be triggered.
     */
    void addGeofence(in int geofenceId, in double latitudeDegrees, in double longitudeDegrees,
            in double radiusMeters, in int lastTransition, in int monitorTransitions,
            in int notificationResponsivenessMs, in int unknownTimerMs);

    /**
     * Pause monitoring a particular geofence.
     *
     * @param geofenceId The id for the geofence.
     */
    void pauseGeofence(in int geofenceId);

    /**
     * Resume monitoring a particular geofence.
     *
     * @param geofenceId - The id for the geofence.
     * @param monitorTransitions Specifies which transitions to monitor. It can be a bitwise OR of
     * ENTERED, EXITED and UNCERTAIN. This supersedes the value associated provided in the
     * addGeofence call.
     */
    void resumeGeofence(in int geofenceId, in int monitorTransitions);

    /**
     * Remove a geofence area. After the function returns, no notifications must be sent.
     *
     * @param geofenceId The id of the geofence.
     */
    void removeGeofence(in int geofenceId);
}
Loading